/* ==========================================================================
   V3 · 档案工作台 / Dossier workbench
   Loaded after style.css. Tightens the masthead, lifts the ledger above the
   fold, and gives the provincial atlas the full page width. Identity
   (cinnabar seal, Song serif, ruled ledger) is kept; decoration is reduced.
   ========================================================================== */

/* ---------- palette: cooler archival paper, deeper cinnabar ---------- */
:root {
  --paper: #f1efe9;
  --paper-2: #e8e5dc;
  --paper-3: #ddd9cd;
  --card: #f8f7f2;
  --ink: #111416;
  --ink-2: #34393c;
  --muted: #6d6a61;
  --faint: #98938a;
  --line: rgba(17, 20, 22, 0.17);
  --line-soft: rgba(17, 20, 22, 0.08);
  --cinnabar: #a72b21;
  --cinnabar-deep: #862018;
  --gold: #a47f45;
  --moss: #566457;
  --header-bg: rgba(241, 239, 233, 0.93);
  --drawer-bg: #f1efe9;
  --header-h: 64px;
}

[data-theme="dark"] {
  --paper: #0c0f11;
  --paper-2: #121619;
  --paper-3: #181d21;
  --card: #111518;
  --ink: #e9e4da;
  --ink-2: #c6c0b4;
  --muted: #918b80;
  --faint: #6a655c;
  --line: rgba(233, 228, 218, 0.18);
  --line-soft: rgba(233, 228, 218, 0.09);
  --cinnabar: #c25646;
  --cinnabar-deep: #d06a58;
  --gold: #c19a5f;
  --moss: #82907e;
  --header-bg: rgba(12, 15, 17, 0.93);
  --drawer-bg: #0c0f11;
}

/* ---------- base: one quiet paper wash, no colour blobs ---------- */
body {
  font-size: 15.5px;
  background-image: linear-gradient(180deg, rgba(167, 43, 33, 0.022), transparent 340px);
}
.grain { opacity: 0.035; }

/* ---------- header: 74 -> 64, quieter type ---------- */
.brand-seal { width: 32px; height: 32px; flex-basis: 32px; font-size: 18px; }
.brand-seal::after { inset: 2px; }
.brand-text strong { font-size: 15px; }
.brand-text em { font-size: 8.5px; margin-top: 2px; }
.main-nav button { font-size: 12.5px; padding: 0 clamp(8px, 1vw, 14px); }
.main-nav .nav-no { font-size: 8px; }
.icon-btn { width: 32px; height: 32px; }

/* ---------- hero: masthead, not a landing page ---------- */
@media (min-width: 901px) {
  .hero { padding: 24px 0 18px; }
  .hero::before {
    font-size: clamp(180px, 24vw, 360px);
    opacity: 0.026;
    top: -0.26em;
  }
  .hero-kicker { font-size: 9.5px; letter-spacing: 0.15em; }
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 292px;
    gap: clamp(28px, 4vw, 56px);
    align-items: start;
    margin-top: 13px;
  }
  .hero-title {
    font-size: clamp(40px, 4.5vw, 58px);
    line-height: 1.03;
    letter-spacing: -0.015em;
  }
  .hero-lede {
    max-width: 640px;
    margin: 11px 0 15px;
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--ink-2);
  }
  .hero-search { max-width: 640px; }
  .hero-search input { padding: 9px 0; font-size: 15px; }
  .hero-search .btn {
    min-height: 34px;
    padding: 6px 16px;
    margin: 3px 0 3px 12px;
    font-size: 12px;
  }
  .hero-chips { margin-top: 10px; gap: 6px; }
  .hero-chips button { padding: 3px 9px; font-size: 11px; }
  .hero-grid { align-items: stretch; }
  .hero-side { padding-left: 22px; padding-bottom: 0; display: flex; flex-direction: column; }
  .stamp { margin-bottom: 11px; gap: 12px; }
  .stamp-char { width: 50px; height: 50px; flex-basis: 50px; font-size: 26px; border-width: 1px; }
  .stamp-char::after { inset: 3px; }
  .stamp-line { height: 38px; }
  .stamp-label { font-size: 7.5px; line-height: 1.7; }
  .hero-meta > div { padding: 6px 0; }
  .hero-meta dt { font-size: 9px; }
  .hero-meta dd { font-size: 12px; }
  .hero-note { margin-top: auto; padding-top: 9px; border-top: 1px solid var(--line-soft); font-size: 10px; line-height: 1.6; }
  [lang="en"] .hero-title { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.08; }
  [lang="en"] .hero::before { font-size: clamp(80px, 10vw, 150px); }
}

/* ---------- KPI ledger: tighter, numbers still the loudest thing ---------- */
.kpi-ledger { margin-top: 8px; border-top-width: 1px; }
.kpi { padding: 12px clamp(10px, 1.3vw, 17px) 13px; }
.kpi:first-child { padding-left: 0; }
.kpi-label { font-size: 9px; letter-spacing: 0.12em; }
.kpi-num { font-size: clamp(24px, 2.15vw, 31px); margin: 6px 0 4px; }
.kpi-date { font-size: clamp(15px, 1.35vw, 19px); padding-top: 6px; }
.kpi-note { font-size: 10px; line-height: 1.45; }

/* ---------- section rhythm: 92px of air -> 54px ---------- */
.section { margin-top: clamp(36px, 4vw, 54px); }
.section-head { padding-bottom: 9px; margin-bottom: 14px; gap: 16px; }
.sec-title { gap: 9px; }
.sec-no { font-size: 9px; }
.sec-title h2 { font-size: clamp(21px, 2.05vw, 28px); }
.sec-title h3 { font-size: clamp(17px, 1.45vw, 19px); }
.sec-note { font-size: 11.5px; margin-bottom: 2px; }
.seg button { padding: 4px 10px; font-size: 10.5px; }
.grid-3 { gap: clamp(20px, 2.2vw, 32px); margin-top: clamp(28px, 3vw, 40px); align-items: start; }
.panel { padding-top: 12px; }
.panel-head { margin-bottom: 10px; }

/* ---------- atlas: the one place that goes loud ---------- */
.grid-map { display: block; margin-top: clamp(32px, 3.4vw, 46px); }
.panel-map { border-top: 2px solid var(--ink); padding-top: 13px; }
.panel-map .panel-head { margin-bottom: 6px; }
.tilemap { margin-top: 2px; }
.tile-svg { max-height: none; }
.map-foot { margin-top: 9px; padding-top: 8px; }
.tile-name { font-family: var(--serif); font-weight: 600; }
.tile-count { font-family: var(--mono); }

@media (min-width: 1021px) {
  .rank-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: clamp(24px, 3vw, 48px);
  }
  .rank-row {
    grid-template-columns: 24px minmax(54px, 0.55fr) minmax(80px, 1fr) auto;
    gap: 8px;
    padding: 7px 0;
  }
  .rank-name { font-size: 13px; }
  .rank-val { font-size: 11.5px; }
  .rank-no { font-size: 9.5px; }
  .rank-bar i { background: var(--ink-2); }
  .rank-row:first-child .rank-bar i { background: var(--cinnabar); }
}
.panel-rank { margin-top: 24px; padding-top: 13px; border-top: 1px solid var(--line); }
.panel-rank .panel-head { margin-bottom: 4px; }

/* ---------- source index: denser, only the central file opens ---------- */
.window-dist-summary { font-size: 10px; margin-bottom: 8px; }
.window-dist { display: block; columns: 2; column-gap: clamp(28px, 3.2vw, 44px); }
.dist-site { break-inside: avoid; }
.dist-site summary { padding: 7px 0; }
.dist-site-name { font-size: 13.5px; }
.dist-site-counts { font-size: 9px; }
.dist-window { padding: 4px 0; font-size: 10.5px; }
.dist-site-body { padding-left: 10px; padding-bottom: 6px; }

/* ---------- regional atlas: seven columns, equal cells, heat by volume ---------- */
.atlas {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.atlas-region {
  min-width: 0;
  padding: 10px 12px 12px;
  border-left: 1px solid var(--line-soft);
}
.atlas-region:first-child { border-left: 0; padding-left: 0; }
.atlas-region:last-child { padding-right: 0; }
.atlas-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
  padding-bottom: 5px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.atlas-head h4 {
  font-family: var(--serif); font-size: 14.5px; font-weight: 600; line-height: 1.2;
  white-space: nowrap;
}
.atlas-head span {
  font-family: var(--mono); font-size: 9.5px; color: var(--muted);
  letter-spacing: 0.02em; font-variant-numeric: tabular-nums;
}
.atlas-cells { display: flex; flex-direction: column; gap: 3px; }
.atlas-cell {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; height: 38px; padding: 0 9px;
  border: 1px solid transparent; min-width: 0; text-align: left;
  transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.atlas-cell:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--ink); }
.atlas-cell:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.atlas-name {
  font-family: var(--serif); font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.atlas-count {
  font-family: var(--mono); font-size: 10.5px; font-variant-numeric: tabular-nums;
  opacity: 0.82; flex-shrink: 0;
}
.atlas-cell.is-empty {
  border: 1px dashed var(--line);
  background: transparent !important;
  color: var(--muted) !important;
}
.atlas-cell.is-central { box-shadow: inset 2px 0 0 var(--cinnabar); }
.scale-bar { background: linear-gradient(90deg, var(--paper-2), var(--cinnabar)) !important; }

@media (max-width: 1020px) {
  .atlas { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .atlas-region:nth-child(4n + 1) { border-left: 0; padding-left: 0; }
  .atlas-region:nth-child(n + 5) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 760px) {
  .atlas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atlas-region:nth-child(2n + 1) { border-left: 0; padding-left: 0; }
  .atlas-region:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 480px) {
  .atlas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atlas-region { padding: 9px 8px 10px; }
  .atlas-head h4 { font-size: 13.5px; }
  .atlas-head span { font-size: 8.5px; }
  .atlas-cell { height: 36px; padding: 0 7px; gap: 6px; }
  .atlas-name { font-size: 12.5px; }
  .atlas-count { font-size: 9.5px; }
}

/* ---------- latest entries: a ledger, not cards ---------- */
@media (min-width: 821px) {
  .latest-item {
    grid-template-columns: 74px minmax(0, 1fr) 180px 18px;
    gap: 18px;
    padding: 13px 0 14px;
    align-items: start;
  }
  .latest-date { font-size: 10px; padding-top: 3px; }
  .latest-name { font-size: clamp(17px, 1.55vw, 20px); }
  .latest-pos { font-size: 11.5px; }
  .latest-org { font-size: 10px; }
  .latest-source { font-size: 10px; }
  .latest-side { gap: 3px; }
}

/* ---------- charts: readable labels, no clipped legends ---------- */
.chart-trend { height: 340px; }
.chart-frame-trend { min-height: 340px; }
.axis-y, .axis-x { font-size: 10px; }
.legend { gap: 12px 20px; }
.legend span { font-size: 11.5px; white-space: nowrap; }
.chart-foot { margin-top: 8px; padding-top: 8px; }
.row-label { font-size: 12px; }
.row-value { font-size: 11.5px; }
.row-pct { font-size: 9.5px; }
.col-top { font-size: 9.5px; }

/* ---------- small screens: keep the original mobile rhythm ---------- */
@media (max-width: 900px) {
  .hero { padding-top: 22px; }
  .hero-title { font-size: clamp(38px, 10.5vw, 56px); }
  [lang="en"] .hero-title { font-size: clamp(29px, 7.6vw, 44px); }
  .hero-lede { font-size: 13.5px; }
}
@media (max-width: 820px) {
  :root { --header-h: 60px; }
  .kpi-num { font-size: 30px; }
  .kpi-date { font-size: 20px; }
  .window-dist { columns: 1; }
  .section { margin-top: 40px; }
  /* the base mobile nav rules load before this file: restore single-line labels */
  .main-nav button { font-size: 10.5px; padding: 0 1px; white-space: nowrap; letter-spacing: -0.01em; }
  .main-nav button span { white-space: nowrap; }
  .main-nav .nav-no { display: none; }
}
@media (max-width: 520px) {
  .panel-rank { margin-top: 20px; }
  .window-dist { columns: 1; }
  .legend span { font-size: 11px; }
}

/* ---------- print / motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .view.is-active { animation: none; }
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   V4 · detail pass
   Readability, precise hierarchy and calmer interaction. The archive keeps
   its paper/ink identity; labels stop whispering, controls get a consistent
   minimum, and the eye lands on the numbers rather than the furniture.
   ========================================================================== */

/* Contrast: --faint was 2.66:1 on paper and 3.32:1 in dark. Both are used for
   real labels, so lift them above 4.5:1 instead of treating them as decoration. */
:root {
  --muted: #5f5b53;
  --faint: #6d685d;
  --gold: #8a652f;
  --moss: #4f5c51;
}
[data-theme="dark"] {
  --muted: #aaa294;
  --faint: #8c8579;
  --cinnabar: #d06a58;
  --cinnabar-deep: #de7b68;
  --gold: #d0a76a;
  --moss: #8b9987;
}

html { text-rendering: optimizeLegibility; }
body { -webkit-font-smoothing: antialiased; }
::selection { background: rgba(167, 43, 33, 0.18); }
[data-theme="dark"] ::selection { background: rgba(208, 106, 88, 0.32); }

/* Masthead: a hairline shadow only after the page moves; no permanent box. */
.site-header { transition: box-shadow 0.22s var(--ease), background 0.22s var(--ease); }
body.is-scrolled .site-header {
  box-shadow: 0 1px 0 var(--line), 0 18px 36px -30px rgba(17, 20, 22, 0.55);
}

/* Keep the oversized watermark from widening the hero's scroll box. */
.hero { overflow: clip; }
.hero-title, .page-head h1, .sec-title h2, .login-card h2 { text-wrap: balance; }
.hero-lede, .page-lede, .state-block p { text-wrap: pretty; }

/* Micro-type: 8.5–10px labels are now readable, while staying subordinate. */
.brand-text em { font-size: 9.5px; }
.main-nav .nav-no { font-size: 9px; }
.live b { font-size: 10.5px; }
.live em { font-size: 10px; }
.hero-kicker, .page-kicker { font-size: 10.5px; }
.hero-issue { font-size: 10px; }
.hero-meta dt { font-size: 10px; }
.hero-meta dd { font-size: 12.5px; }
.hero-note { font-size: 11px; }
.kpi-label { font-size: 10px; letter-spacing: 0.1em; }
.kpi-note { font-size: 10.5px; }
.sec-no { font-size: 10px; }
.sec-note { font-size: 12px; }
.window-dist-summary { font-size: 11px; }
.dist-site-counts { font-size: 10px; }
.dist-window { font-size: 11px; }
.window-row-count { font-size: 11px; }
.window-row-date { font-size: 10px; }
.window-gloss { font-size: 9.5px; }
.window-row-last { font-size: 10.5px; }
.site-rail-count { font-size: 10px; }
.step-no { font-size: 10px; }
.field-note { font-size: 10.5px; }

@media (min-width: 700px) and (max-width: 900px) {
  .kpi-ledger { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi { border-left: 1px solid var(--line-soft); border-top: 1px solid var(--line-soft); }
  .kpi:nth-child(4n+1) { border-left: 0; padding-left: 0; }
  .kpi:nth-child(-n+4) { border-top: 0; }
  .kpi:last-child:nth-child(odd) { grid-column: auto; }
}
@media (max-width: 820px) {
  .hero-side { display: none; }
  .admin-tabs { flex-wrap: wrap; gap: 2px 14px; overflow: visible; padding-bottom: 2px; }
  .admin-tabs button { padding: 9px 0 7px; }
}
@media (max-width: 560px) {
  .admin-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
  .admin-tabs button { text-align: left; }
}
.latest-date { font-size: 10.5px; }
.latest-pos { font-size: 12px; }
.latest-org, .latest-source { font-size: 11px; }
.axis-y, .axis-x { font-size: 10.5px; }
.row-pct, .col-top { font-size: 10px; }
.atlas-head span { font-size: 10px; }
.atlas-count { font-size: 11px; }
.footer-col, .footer-brand p { font-size: 12px; }
.footer-bottom { font-size: 9.5px; }

/* Controls: one minimum height, so a row of chips no longer looks like debris. */
.hero-chips button, .seg button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.field label, .form-row label, .pass-field span, .file-field > span, .inline-form label {
  font-size: 10px;
  letter-spacing: 0.08em;
}
.field input, .field select { font-size: 13px; }
.field-date input { font-size: 11px; }
.login-hint { font-size: 11px; color: var(--muted); }

/* Admin: the control room is read at a glance; don't make its labels microscopic. */
.as-label { font-size: 9.5px; }
.as-val { font-size: 11.5px; }
.as-meta, .as-user { font-size: 10px; }
.as-user b { font-size: 10.5px; }
.admin-kpi span { font-size: 10px; }
.admin-tabs button { font-size: 12.5px; padding: 13px 0 11px; }
.adm-kv { font-size: 12px; }
.adm-table th { font-size: 9.5px; letter-spacing: 0.07em; padding-bottom: 9px; }
.adm-table td { font-size: 11.5px; }
.adm-table td.mono { font-size: 10px; }
.adm-table .status-pill { font-size: 9px; }
.adm-table tr:hover td { background: var(--paper-2); }

/* Citation action and empty-state action are quiet, not another loud button. */
.cite-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.cite-actions .btn { min-height: 30px; }
.state-block { padding: clamp(36px, 5vw, 64px) 0; }
.state-block .btn { margin-top: 2px; }

@media (max-width: 820px) {
  .hero-chips button, .seg button { min-height: 34px; }
  .as-meta { font-size: 9.5px; }
  .adm-table th { font-size: 9px; }
}

@media (max-width: 480px) {
  .atlas-head span { font-size: 9.5px; }
  .atlas-count { font-size: 10.5px; }
  .brand-text em { font-size: 9px; }
}

/* Result toolbar: share / export / sort stay together and wrap before they crowd. */
.result-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.result-tools .btn { min-height: 30px; padding: 0 11px; font-size: 11.5px; }
.result-tools .sort-field { margin-left: 4px; }
@media (max-width: 720px) {
  .filter-shell { position: static; box-shadow: none; }
  .result-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .result-tools { width: 100%; justify-content: flex-start; }
  .result-tools .sort-field { margin-left: auto; }
}

/* ---------- recent searches (local only) ---------- */
.recent-searches {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-soft);
}
.recent-searches[hidden] { display: none; }
.recent-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); white-space: nowrap;
}
.recent-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.recent-chip {
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 8px; border: 1px solid var(--line); background: transparent;
  color: var(--ink-2); font-family: var(--sans); font-size: 11px; line-height: 1.5;
  cursor: pointer; transition: border-color .18s var(--ease), color .18s var(--ease);
}
.recent-chip:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.recent-clear { margin-left: auto; font-size: 10px; }
@media (max-width: 720px) {
  .recent-searches { gap: 6px; }
  .recent-chip { max-width: 180px; }
  .recent-clear { margin-left: 0; }
}

/* ---------- result density ---------- */
.result-summary { display: flex; align-items: center; gap: 12px; min-width: 0; }
.density-toggle { font-size: 10px; white-space: nowrap; }
[data-density="compact"] .entry-card { padding: 12px 0 13px; gap: clamp(12px, 1.7vw, 22px); }
[data-density="compact"] .entry-name { font-size: clamp(19px, 1.8vw, 23px); }
[data-density="compact"] .entry-role { margin-top: 1px; }
[data-density="compact"] .entry-org { margin-top: 1px; }
[data-density="compact"] .entry-excerpt {
  margin-top: 6px; font-size: 11.5px; line-height: 1.6;
  -webkit-line-clamp: 1;
}
[data-density="compact"] .entry-date { gap: 2px; padding-top: 2px; }
[data-density="compact"] .entry-side { gap: 4px; padding-top: 2px; }
[data-density="compact"] .entry-card::before { top: 12px; bottom: 13px; }
@media (max-width: 720px) {
  .result-summary { flex-wrap: wrap; gap: 8px; }
  .density-toggle { font-size: 9.5px; }
  [data-density="compact"] .entry-card { padding: 12px 0 14px; }
}

/* ---------- saved searches ---------- */
.recent-save { font-size: 10px; white-space: nowrap; }
.saved-searches {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 4px; padding-top: 2px;
}
.saved-searches[hidden] { display: none; }
.saved-chip {
  display: inline-flex; align-items: stretch; max-width: 260px;
  border: 1px solid var(--line); background: transparent;
}
.saved-apply {
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 7px; border: 0; background: transparent; color: var(--ink-2);
  font-family: var(--sans); font-size: 11px; line-height: 1.5; cursor: pointer;
}
.saved-x {
  border: 0; border-left: 1px solid var(--line-soft); background: transparent;
  color: var(--faint); font-size: 12px; line-height: 1; padding: 0 6px; cursor: pointer;
}
.saved-apply:hover { color: var(--cinnabar); }
.saved-x:hover { color: var(--cinnabar); background: var(--cinnabar-soft, rgba(168,52,42,.08)); }
@media (max-width: 720px) {
  .saved-chip { max-width: 210px; }
  .saved-apply { max-width: 170px; }
}

/* 结果内分面：当前筛选下的构成，可点击切换类型 */
.result-facets { display: flex; flex-direction: column; gap: 6px; margin: -2px 0 10px; }
.result-facet-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.result-facet-label { flex: 0 0 auto; min-width: 52px; font-family: var(--sans); font-size: 10.5px; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }
.result-facet { border: 1px solid var(--line); background: transparent; color: var(--ink-2); font: inherit; font-size: 11.5px; line-height: 1; padding: 5px 8px; cursor: pointer; }
.result-facet b { font-weight: 600; color: var(--ink); margin-left: 2px; }
.result-facet:hover { border-color: var(--ink); }
.result-facet.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.result-facet.is-active b { color: var(--paper); }
@media (max-width: 720px) {
  .result-facets { gap: 7px; margin-bottom: 12px; }
  .result-facet-row { gap: 6px; }
  .result-facet-label { min-width: 42px; }
  .result-facet { padding: 5px 7px; }
}

/* 保存检索重命名 */
.saved-chip.is-editing { padding-right: 3px; }
.saved-input { width: 132px; min-height: 26px; border: 1px solid var(--ink); background: var(--card); color: var(--ink); font: inherit; font-size: 11.5px; padding: 0 6px; }
.saved-rename, .saved-ok, .saved-cancel { border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; padding: 0 3px; }
.saved-rename:hover, .saved-ok:hover, .saved-cancel:hover { color: var(--cinnabar); }
.saved-rename { font-size: 10.5px; letter-spacing: .02em; }
@media (max-width: 720px) {
  /* 移动端只保留“结果构成”，层级/年份仍可从筛选下拉使用，避免三行分面占掉首屏 */
  .result-facets .result-facet-row:nth-child(n+2) { display: none; }
}
.date-presets {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 10px 0 0; padding-top: 9px; border-top: 1px dotted rgba(20,22,26,.14);
}
.date-presets .recent-label { margin-right: 2px; }
.date-preset {
  appearance: none; background: transparent; color: var(--muted);
  border: 1px solid rgba(20,22,26,.16); padding: 4px 8px; border-radius: 2px;
  font-family: var(--sans); font-size: 11px; line-height: 1.3; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.date-preset:hover { color: var(--ink); border-color: rgba(20,22,26,.32); }
.date-preset.is-active { color: var(--cinnabar); border-color: rgba(168,52,42,.55); background: rgba(168,52,42,.06); }
[data-theme="dark"] .date-preset { border-color: rgba(255,255,255,.16); }
[data-theme="dark"] .date-preset.is-active { border-color: rgba(224,123,107,.55); background: rgba(224,123,107,.10); }
@media (max-width: 720px) {
  .date-presets { gap: 5px; margin-top: 8px; }
  .date-preset { padding: 3px 7px; font-size: 10.5px; }
}
/* 时间快捷：并入活跃筛选行，避免多占一行把首条结果推到折叠线下 */
.filter-meta { flex-wrap: wrap; gap: 6px 12px; }
.filter-meta .date-presets {
  margin: 0; padding: 0; border: 0; flex: 0 1 auto; gap: 4px;
}
.filter-meta .date-presets .recent-label { display: none; }
.filter-meta .date-preset { padding: 2px 6px; font-size: 10.5px; }
.result-facets { gap: 4px; margin-bottom: 6px; }
@media (max-width: 720px) {
  .filter-meta { gap: 6px; }
  .filter-meta .date-presets { order: 3; width: 100%; margin-top: 2px; }
  .filter-meta .date-presets .recent-label { display: inline; }
  .filter-meta .active-filters { flex: 1 1 100%; }
  .filter-meta .filter-count { margin-left: auto; }
}
/* 已进入检索态后收起解释性文字，把首屏让给结果 */
body.is-searching #view-explore .page-lede,
body.is-searching #view-explore .lock-note { display: none; }

/* admin: per-channel retry */
.adm-retry{font:inherit;font-size:10.5px;line-height:1;padding:5px 9px;border:1px solid var(--line);background:transparent;color:var(--cinnabar);cursor:pointer;letter-spacing:.04em}
.adm-retry:hover{border-color:var(--cinnabar);background:rgba(168,52,42,.06)}
.adm-retry[disabled]{opacity:.45;cursor:not-allowed;border-color:var(--line);color:var(--muted)}
.adm-act{white-space:nowrap}
.adm-muted{color:var(--faint);font-size:10.5px}

/* admin: approval validity + quota */
.adm-req-num{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;color:var(--muted);white-space:nowrap}
.adm-req-num input{width:52px;height:26px;padding:2px 5px;border:1px solid var(--line);background:var(--card);color:var(--ink);font:inherit;font-size:11px}
.adm-req-act{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.adm-approve .btn-primary{margin-top:9px}

@media(max-width:820px){#view-admin{padding-bottom:88px}}

/* approval notice fallback */
.notice-sheet{position:fixed;inset:0;z-index:200;background:rgba(12,14,17,.55);display:grid;place-items:center;padding:20px}
.notice-card{width:min(560px,100%);max-height:80vh;overflow:auto;background:var(--card);border:1px solid var(--line);box-shadow:0 24px 80px rgba(0,0,0,.3);padding:20px 22px}
.notice-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.notice-head h3{font:600 18px/1.4 var(--serif);margin:0;color:var(--ink)}
.notice-close{border:0;background:none;color:var(--muted);font-size:22px;line-height:1;cursor:pointer;padding:2px 6px}
.notice-hint{margin:8px 0 10px;font-size:11.5px;color:var(--muted)}
.notice-card textarea{width:100%;min-height:180px;resize:vertical;border:1px solid var(--line);background:var(--paper);color:var(--ink);padding:12px;font:12px/1.7 var(--sans)}
.notice-foot{display:flex;justify-content:flex-end;margin-top:12px}

/* revoked / expired */
.status-revoked{color:#8a5a5a;border-color:rgba(138,90,90,.35);background:rgba(138,90,90,.08)}
.pkg-row.is-expired{opacity:.62}
.pkg-expired{font:10px/1 var(--sans);color:var(--muted);letter-spacing:.04em;text-transform:uppercase}

/* admin: package-level authorization */
.adm-req-pkg{display:flex;flex-direction:column;gap:4px;font-size:10.5px;color:var(--muted);min-width:210px}
.adm-req-pkg select{width:100%;min-height:58px;border:1px solid var(--line);background:var(--card);color:var(--ink);font:inherit;font-size:11px;padding:4px}
.adm-req-note{font-size:9.5px;color:var(--faint);letter-spacing:.02em}

.adm-req-all{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;color:var(--muted);white-space:nowrap}
.adm-req-all input{width:14px;height:14px}

/* accessibility fixes */
.switch input:focus-visible + span{outline:2px solid var(--cinnabar);outline-offset:2px}
.switch input:disabled + span{opacity:.55;cursor:not-allowed}
.adm-search:focus-visible{outline:2px solid var(--cinnabar);outline-offset:2px}
[data-theme="dark"] .btn-primary:hover{background:#b34a3a;color:#fff}
[data-theme="dark"] .status-revoked{color:#e6a3a3;border-color:rgba(230,163,163,.35)}
.excerpt-note{color:var(--muted)}
@media (max-width:960px){
  .header-inner{min-width:0}
  .brand{min-width:0}
  .brand-text strong{max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .main-nav{min-width:0;gap:0 2px}
  .main-nav button{font-size:10.5px;padding:0 4px}
}
