:root {
  color: #253044;
  background: #f7f9fc;
  font-family: system-ui, "Microsoft YaHei", sans-serif;
  font-size: 14px;
  --accent: #345f9f;
  --accent-hover: #244b84;
  --soft: #edf3fc;
  --line: #e5eaf1;
  --muted: #7b8492;
  --white: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, input, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; background: var(--white); }
button, select, summary { cursor: pointer; }
button { white-space: nowrap; }
button:hover, summary:hover { color: var(--accent); border-color: #c0cfe3; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: white; }
button.primary:hover { background: var(--accent-hover); }
button[aria-pressed="true"] { color: var(--accent); background: var(--soft); border-color: #c4d4eb; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 54px; padding: 8px 24px; background: white; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: #2a4f81; font-size: 18px; font-weight: 750; white-space: nowrap; }
.brand-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; color: white; background: var(--accent); font-size: 18px; }
.brand small { margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--line); color: var(--muted); font-weight: 400; font-size: 12px; }
.header-side { display: flex; align-items: center; gap: 18px; min-width: 0; }
.sync-info { margin: 0; color: var(--muted); font-size: 11px; white-space: nowrap; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.account-menu, .display-menu, .resource-menu { position: relative; }
.account-menu:has(#account-actions[hidden]), .resource-menu:has(#resources[hidden]) { display: none; }
.account-menu > summary, .display-menu > summary, .resource-menu > summary { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: 12px; white-space: nowrap; }
.account-menu > summary span, .display-menu > summary span, .resource-menu > summary span { margin-left: 5px; color: var(--muted); }
#account-actions, .display-options, #resources { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; display: grid; gap: 7px; min-width: 170px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: 0 8px 24px #20334d14; }
#account-actions button { text-align: left; border: 0; background: transparent; }
#account-actions button:hover { background: var(--soft); }
.display-options { min-width: 210px; }
.display-options label { color: var(--muted); font-size: 12px; }
#resources { width: min(310px, calc(100vw - 32px)); }
#resources a, #resources span { padding: 5px; font-size: 12px; overflow-wrap: anywhere; }
main { padding: 12px 24px 20px; max-width: 1840px; margin: auto; }
.panel { background: white; border: 1px solid var(--line); border-radius: 10px; }
.catalogue-panel { border-radius: 10px 10px 0 0; }
.gate { max-width: 430px; margin: 9vh auto; padding: 30px; }
.gate form, .gate label { display: grid; gap: 8px; }
.gate form { gap: 16px; }
.gate p { color: var(--muted); line-height: 1.7; }
.gate input, .gate button { padding-block: 9px; }
h1 { margin: 5px 0 12px; font-size: 25px; }
h2 { margin: 0; font-size: 17px; }
h3 { font-size: 14px; margin: 20px 0 10px; }
.eyebrow { font-size: 12px; color: var(--accent); font-weight: 650; }
.tabs { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; padding: 0 12px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tabs button { flex: 0 0 auto; padding: 13px 12px 11px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: #626c7b; font-size: 13px; font-weight: 500; }
.tabs button[aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); background: transparent; font-weight: 700; }
.tabs small, .source-count { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 5px; }
.search-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px 8px; }
.search-bar { display: flex; flex: 1 1 340px; gap: 0; min-width: 240px; max-width: 510px; }
.search-bar input { min-width: 0; width: 100%; border-radius: 6px 0 0 6px; padding-left: 11px; }
.search-bar select { border-left: 0; border-radius: 0; padding-inline: 6px; color: var(--muted); font-size: 12px; }
.search-bar button { border-radius: 0 6px 6px 0; padding-inline: 15px; }
.search-bar input, .search-bar select, .search-bar button { height: 33px; }
.quick-shortcuts { display: flex; align-items: center; gap: 6px; }
.quick-shortcuts button, #clear { font-size: 12px; padding: 6px 8px; }
#clear { border-color: transparent; color: var(--accent); background: transparent; }
.topics { display: flex; align-items: center; gap: 6px; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: thin; }
.topics button { flex: 0 0 auto; padding: 4px 7px; border-color: transparent; background: #f7f9fc; color: #667286; font-size: 11px; }
.topics button[aria-pressed="true"] { color: var(--accent); background: var(--soft); border-color: #d7e3f4; }
.advanced-filters { padding: 11px 12px; border-top: 1px solid var(--line); background: #fbfcfe; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter { position: relative; font-size: 12px; }
.filter summary { min-width: 108px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.filter summary::after { content: "⌄"; float: right; margin-left: 14px; color: var(--muted); }
.filter-options, .filter-loading { position: absolute; z-index: 25; top: calc(100% + 5px); left: 0; display: grid; gap: 7px; width: 260px; max-width: calc(100vw - 28px); padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: 0 8px 24px #20334d1c; }
.filter:nth-child(n+7) .filter-options, .filter:nth-child(n+7) .filter-loading { left: auto; right: 0; }
.filter-loading { min-width: 180px; color: var(--muted); padding: 15px; }
.filter-options input[type="search"] { width: 100%; min-width: 0; }
.filter-options label { display: flex; align-items: start; gap: 7px; padding: 5px 4px; line-height: 1.5; cursor: pointer; border-radius: 4px; }
.filter-options input[type="checkbox"] { flex: 0 0 auto; margin: 3px 0 0; accent-color: var(--accent); }
.filter-options label:hover { background: var(--soft); }
.filter-list { max-height: 230px; overflow: auto; overflow-wrap: anywhere; }
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: #687589; }
.quick label { display: inline-flex; align-items: center; gap: 5px; }
.quick input[type="date"] { min-width: 0; padding: 5px 6px; font-size: 12px; }
.selected-filters { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 12px 8px; }
.selected-filters:empty { display: none; }
.selected-filters button { font-size: 11px; padding: 4px 7px; color: var(--accent); background: var(--soft); border-color: #d7e3f4; }
.results { display: flex; flex-direction: column; min-width: 0; margin-top: -1px; border-radius: 0 0 10px 10px; overflow: visible; }
.result-bar, .pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; font-size: 12px; }
.result-bar { min-height: 43px; border-bottom: 1px solid var(--line); }
.result-bar strong { font-size: 12px; font-weight: 600; white-space: nowrap; }
.result-bar select, .result-bar button, .result-bar summary { font-size: 11px; padding: 5px 7px; }
.result-summary { flex-wrap: nowrap; }
.result-tools { flex-wrap: nowrap; }
.table-wrap { overflow: auto; max-height: calc(100dvh - 275px); min-height: 180px; scrollbar-width: thin; }
table { min-width: 100%; width: max-content; border-collapse: separate; border-spacing: 0; font-size: 12px; }
th, td { padding: 9px 10px; text-align: left; border-right: 1px solid #edf0f5; border-bottom: 1px solid #edf0f5; line-height: 1.45; }
th { position: sticky; top: 0; z-index: 4; color: #4d5b70; background: #f8fafd; white-space: nowrap; padding-right: 15px; font-weight: 600; }
th button, .header-sort { padding: 0; border: 0; border-radius: 0; color: inherit; background: transparent; font-size: inherit; font-weight: inherit; }
.column-filter { margin-left: 5px; padding: 1px 2px; border: 0; background: transparent; color: #7f8ea3; font-size: 11px; vertical-align: middle; }
.column-filter[aria-pressed="true"] { color: var(--accent); background: #e2edfc; }
.column-grip { position: absolute; inset: 0 0 0 auto; width: 6px; cursor: col-resize; touch-action: none; }
.column-grip:hover { border-right: 2px solid #8aa9d2; }
td { min-width: 72px; max-width: 240px; vertical-align: middle; background: white; }
.title-cell { position: sticky; left: 0; z-index: 2; width: 340px; min-width: 300px; max-width: 380px; background: white; }
th.title-cell { z-index: 6; background: #f8fafd; }
td .title-button, .cards .title-button { padding: 0; border: 0; background: transparent; color: #2f4c73; text-align: left; font-size: inherit; font-weight: 500; line-height: inherit; }
.cell-content, td .title-button { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 240px; }
td.title-cell .title-button { max-width: 340px; }
.comfortable td, .table-wrap.comfortable td { padding-block: 10px; vertical-align: top; }
.comfortable .cell-content, .comfortable td .title-button { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; white-space: normal; overflow-wrap: anywhere; }
tbody tr:hover td { background: #f7faff; }
.row-viewed .title-button { color: #7b8798; }
.row-viewed td { background: #fcfdff; }
.row-viewed:hover td { background: #f7faff; }
.action-cell { position: sticky; right: 0; z-index: 3; min-width: 160px; max-width: 190px; border-left: 1px solid var(--line); border-right: 0; background: white; box-shadow: -5px 0 8px #334b6b04; }
th.action-cell { z-index: 7; background: #f8fafd; }
.row-actions { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.row-actions button { min-width: 27px; min-height: 27px; padding: 3px 5px; border-color: transparent; border-radius: 5px; background: transparent; color: #7c8796; font-size: 12px; }
.row-actions a { font-size: 11px; text-decoration: none; }
.row-actions button:hover { color: var(--accent); background: var(--soft); }
.row-actions .mark-saved, button.mark-saved { color: #b27a1d; background: #fff7df; }
.row-actions .mark-applied, button.mark-applied { color: #28765b; background: #eaf7ef; }
.tag { display: inline-block; max-width: 100%; padding: 2px 6px; border-radius: 5px; color: #526b94; background: #edf2fa; font-size: 11px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.tag-location { color: #8a6d27; background: #fff7db; }
.tag-education { color: #566f99; background: #eaf2ff; }
.tag-category { color: #596f9b; background: #eef2ff; }
.tag-success { color: #278060; background: #eaf7ef; }
.tag-warning { color: #a4652a; background: #fff1df; }
.tag-muted { color: #8a919c; background: #f0f2f5; }
.pagination { min-height: 43px; justify-content: flex-end; color: var(--muted); }
.pagination button, .pagination select, .pagination input { padding: 4px 7px; font-size: 11px; }
.pagination form, .page-size-label { display: inline-flex; align-items: center; gap: 5px; }
.pagination input { width: 58px; }
#page-info { min-width: 48px; text-align: center; font-size: 11px; }
.empty { color: var(--muted); text-align: center; padding: 30px 12px; font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 10px; padding: 12px; }
.card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.card .title-button { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; width: 100%; white-space: normal; overflow: hidden; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; font-weight: 650; }
.card p { margin: 8px 0 0; color: #7b8492; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.card-meta p { margin: 0; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; margin-top: 12px; border-top: 1px solid #f0f3f7; }
.card-actions button, .card-actions a { font-size: 12px; }
.card-actions a { margin-right: auto; text-decoration: none; }
.card dl { display: grid; grid-template-columns: 75px 1fr; gap: 5px 8px; margin: 10px 0 0; font-size: 12px; line-height: 1.6; }
.card dt { color: var(--muted); }
.card dd { margin: 0; overflow-wrap: anywhere; }
.results:fullscreen { padding: 12px; border-radius: 0; overflow: auto; background: white; }
.results:fullscreen .table-wrap { flex: 1; max-height: calc(100dvh - 108px); }
dialog { width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 12px; color: inherit; box-shadow: 0 20px 90px #20334d22; }
dialog::backdrop { background: #17283e66; }
dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
dialog > header button { padding: 1px 8px; border-color: transparent; background: transparent; color: var(--muted); font-size: 23px; }
#dialog-body { padding: 16px 18px 20px; max-height: calc(100dvh - 110px); overflow: auto; }
#dialog-body h2 { line-height: 1.6; }
#dialog-body form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
#dialog-body form input { flex: 1; min-width: 140px; }
#dialog-body textarea { width: 100%; resize: vertical; }
#dialog-body dl { display: grid; grid-template-columns: 96px 1fr; gap: 9px 12px; font-size: 13px; line-height: 1.65; }
#dialog-body dt { color: var(--muted); }
#dialog-body dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
#dialog-body > .actions { margin-top: 18px; }
.list-line { display: flex; align-items: start; justify-content: space-between; gap: 10px; padding-block: 9px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.list-line small { color: var(--muted); }
.error { color: #b03d4e !important; font-size: 12px; line-height: 1.6; }
.error:empty { display: none; }
.results .error:not(:empty) { margin: 0; padding: 10px 12px; border-bottom: 1px solid #f1dce0; background: #fff8f9; }
.toast { position: fixed; bottom: 18px; right: 18px; z-index: 50; max-width: calc(100vw - 36px); padding: 10px 16px; border-radius: 8px; color: white; background: #2b3f5c; font-size: 13px; line-height: 1.5; box-shadow: 0 6px 20px #20334d22; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 1000px) {
  .brand small { display: none; }
  .search-bar { max-width: none; }
}
@media (max-width: 700px) {
  .topbar { position: sticky; top: 0; z-index: 40; height: 53px; gap: 10px; padding-inline: 12px; }
  .brand { gap: 7px; font-size: 17px; }
  .brand-icon { width: 27px; height: 27px; font-size: 16px; }
  .header-side { gap: 0; }
  .header-side .sync-info { display: none; }
  .account-menu > summary { font-size: 11px; padding: 6px 7px; }
  main { padding: 8px 8px 20px; }
  .tabs { padding-inline: 6px; }
  .tabs button { padding: 11px 9px 9px; font-size: 12px; }
  .search-toolbar { gap: 7px; padding: 9px 9px 6px; }
  .search-bar { flex-basis: 100%; min-width: 0; max-width: none; }
  .search-bar input { font-size: 13px; }
  .search-bar input, .search-bar select, .search-bar button { height: 35px; }
  .search-bar button { padding-inline: 13px; }
  .quick-shortcuts { flex: 1 1 auto; min-width: 0; gap: 4px; }
  .quick-shortcuts button, #clear { padding: 6px; font-size: 11px; }
  .topics { padding: 0 9px 8px; gap: 4px; }
  .topics button { padding: 4px 6px; }
  .advanced-filters { padding: 10px 9px; }
  .filters { gap: 6px; }
  .filter summary { min-width: 99px; padding: 8px; }
  .filter-options, .filter-loading, .filter:nth-child(n+7) .filter-options, .filter:nth-child(n+7) .filter-loading { position: fixed; left: 12px; right: 12px; top: 18%; width: auto; max-width: none; max-height: 70dvh; overflow: auto; }
  .filter-options input[type="search"] { padding: 9px; font-size: 14px; }
  .filter-options label { padding-block: 8px; font-size: 14px; }
  .filter-options input[type="checkbox"] { width: 16px; height: 16px; }
  .filter-list { max-height: 39dvh; }
  .quick { gap: 7px; }
  .quick label { font-size: 11px; }
  .quick input[type="date"] { width: 122px; }
  .selected-filters { padding-inline: 9px; }
  .result-bar { flex-wrap: wrap; gap: 7px; padding: 7px 9px; }
  .result-summary { flex: 1 1 auto; gap: 5px; }
  .result-summary strong { font-size: 11px; }
  .result-summary select { max-width: 100px; }
  .result-tools { gap: 4px; margin-left: auto; }
  .result-tools > button, .result-tools summary { padding: 5px 6px; font-size: 10px; }
  .resource-menu > summary { max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
  .table-wrap { max-height: calc(100dvh - 310px); }
  .cards { grid-template-columns: 1fr; gap: 0; padding: 0; }
  .card { padding: 13px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .card:last-child { border-bottom: 0; }
  .card .title-button { font-size: 14px; }
  .card-actions button, .card-actions a { min-height: 38px; }
  .pagination { flex-wrap: wrap; justify-content: center; gap: 6px; padding: 10px 8px; }
  .pagination form { display: none; }
  .pagination select { min-height: 28px; }
  .page-size-label { font-size: 11px; }
  .gate { margin: 8vh auto; padding: 25px; }
  dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  dialog > header { padding: 12px 14px; }
  #dialog-body { padding: 13px 14px 18px; max-height: calc(100dvh - 90px); }
  #dialog-body dl { grid-template-columns: 75px 1fr; gap: 8px 10px; font-size: 12px; }
}
