/* 期货研究工作台 — research terminal. Dark chrome, light panels, blue accents. */
:root {
  --chrome: #12161c; --chrome-2: #1a2029; --chrome-3: #232b36; --chrome-line: #2c3542;
  --chrome-ink: #dfe5ec; --chrome-muted: #8d98a6;
  --canvas: #e6eaf0; --panel: #ffffff; --panel-head: #f4f6f9; --line: #d8dee6; --line-soft: #e8ecf1;
  --ink: #16202b; --ink-2: #2b3744; --muted: #5d6977;
  --accent: #2463eb; --accent-2: #1a4fc4; --accent-soft: #e5edff; --focus: #f59e0b;
  --ok: #157347; --ok-soft: #e2f4ea; --warn: #8a5a00; --warn-soft: #fff3d6; --bad: #b42318; --bad-soft: #fde7e5;
  --p-real: #0b6e60; --p-real-soft: #ddf3ee;
  --p-syn: #b3460b; --p-syn-soft: #ffeedd;
  --p-res: #5b33c7; --p-res-soft: #eee8fd;
  --p-mis: #56606d; --p-mis-soft: #eef0f3;
  --up: #1d4ed8; --up-soft: #dde8ff; --down: #a14709; --down-soft: #fde9da; --flat-soft: #eef1f5;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --head-h: 52px; --side-w: 228px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--canvas); color: var(--ink); font: 13px/1.55 var(--sans); font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 6px 10px; z-index: 50; }
.skip:focus { left: 8px; }

/* -- shell ---------------------------------------------------------------------------------- */
.top { position: fixed; inset: 0 0 auto 0; height: var(--head-h); background: var(--chrome); color: var(--chrome-ink);
  display: flex; align-items: center; gap: 14px; padding: 0 14px; z-index: 20; border-bottom: 1px solid var(--chrome-line); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--chrome-ink); font-weight: 700; letter-spacing: .02em; min-width: 196px; }
.brand:hover { text-decoration: none; }
.mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; }
.brand small { display: block; font-weight: 400; color: var(--chrome-muted); font-size: 11px; letter-spacing: 0; }
.icon-btn { flex: none; background: transparent; border: 1px solid transparent; color: var(--chrome-ink); border-radius: 6px; width: 32px; height: 32px; cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: var(--chrome-3); }
.search { min-width: 0; flex: 1; max-width: 520px; display: flex; align-items: center; background: var(--chrome-2); border: 1px solid var(--chrome-line); border-radius: 7px; padding: 0 10px; height: 34px; }
.search input { min-width: 0; width: 100%; flex: 1; background: transparent; border: 0; color: var(--chrome-ink); font: inherit; outline: none; }
.search input::placeholder { color: var(--chrome-muted); }
.search kbd { color: var(--chrome-muted); border: 1px solid var(--chrome-line); border-radius: 4px; padding: 0 5px; font: 11px var(--mono); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mode { font-size: 12px; padding: 3px 9px; border-radius: 12px; border: 1px dashed #f0a45f; color: #ffcf9e; background: #3a2412; white-space: nowrap; }
.mode.live { border-style: solid; border-color: #4ade80; color: #bbf7d0; background: #123222; }
.top-link { color: var(--chrome-ink); font-size: 12px; white-space: nowrap; } .top-link:hover { color: #fff; }
.top-right { flex: none; }
.search { min-width: 150px; } .search input { min-width: 0; width: 100%; }
/* Narrow desktop windows: the replay badge keeps its short form (full text stays in its title) so every
   top-bar item, including 重置布局 and 系统, stays inside the window. */
@media (max-width: 1279px) { .mode .long { display: none; } }

.side { position: fixed; top: var(--head-h); bottom: 0; left: 0; width: var(--side-w); background: var(--chrome); color: var(--chrome-ink);
  overflow-y: auto; border-right: 1px solid var(--chrome-line); z-index: 15; padding: 10px 0 24px; }
.side h2 { font-size: 11px; letter-spacing: .14em; color: var(--chrome-muted); margin: 14px 18px 6px; font-weight: 600; }
.side a { display: flex; align-items: center; gap: 10px; color: var(--chrome-ink); padding: 8px 18px; font-size: 13px; border-left: 3px solid transparent; }
.side a:hover { background: var(--chrome-2); text-decoration: none; }
.side a.on { background: var(--chrome-3); border-left-color: var(--accent); color: #fff; font-weight: 600; }
.side .ico { width: 18px; text-align: center; color: var(--chrome-muted); font-size: 14px; }
.side a.on .ico { color: #8fb3ff; }
.side .count { margin-left: auto; font-size: 11px; min-width: 20px; text-align: center; padding: 0 6px; border-radius: 9px; background: #4a3410; color: #ffd48a; }
.side .tag { margin-left: auto; font: 10px var(--mono); color: var(--chrome-muted); border: 1px solid var(--chrome-line); border-radius: 3px; padding: 0 4px; }
.side .commodity { margin: 4px 12px 8px; padding: 9px 12px; background: var(--chrome-2); border: 1px solid var(--chrome-line); border-radius: 8px; }
.side .commodity strong { font-size: 15px; } .side .commodity div { color: var(--chrome-muted); font-size: 12px; }
body.side-collapsed .side { width: 56px; } body.side-collapsed .side .label, body.side-collapsed .side h2,
body.side-collapsed .side .count, body.side-collapsed .side .tag, body.side-collapsed .side .commodity { display: none; }
body.side-collapsed main { margin-left: 56px; }

main { margin: var(--head-h) 0 0 var(--side-w); padding: 14px 16px 48px; min-height: calc(100vh - var(--head-h)); }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 2px 2px 12px; }
.page-head h1 { font-size: 19px; margin: 0; letter-spacing: .01em; }
.page-head .sub { color: var(--muted); font-size: 12.5px; margin: 0; flex-basis: 100%; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.crumbs { font-size: 12px; color: var(--muted); margin: 0 2px 4px; } .crumbs a { color: var(--muted); }

/* -- panels and the board ------------------------------------------------------------------ */
.board { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: start; grid-auto-flow: row dense; }
.panel[data-panel="inspector"] { grid-row: span 3; position: sticky; top: calc(var(--head-h) + 12px); max-height: calc(100vh - var(--head-h) - 24px); }
.panel[data-panel="inspector"] .panel-body { overflow: auto; }
@media (max-width: 1279px) { .panel[data-panel="inspector"] { position: static; grid-row: auto; max-height: none; } }
.panel { grid-column: span var(--span, 12); background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  display: flex; flex-direction: column; min-width: 0; box-shadow: 0 1px 0 rgba(16, 24, 40, .03); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 0; min-height: 38px; background: var(--panel-head);
  border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.panel.collapsed .panel-head { border-bottom: 0; border-radius: 8px; }
.panel-title { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 38px; min-width: 0; flex-shrink: 0; max-width: 72%; }
.panel-title .ptag { width: 20px; height: 20px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 11px; display: grid; place-items: center; flex: none; }
.panel-title h2 { font-size: 12.5px; font-weight: 700; margin: 0; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.panel-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; min-width: 0; flex: 0 1 auto; }
.pt { width: 28px; height: 28px; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 5px; cursor: pointer; font-size: 13px; line-height: 1; }
.pt:hover { background: var(--line-soft); color: var(--ink); }
.pt[data-act="move"] { cursor: grab; }
.panel-filter { height: 26px; border: 1px solid var(--line); border-radius: 5px; padding: 0 8px; font: 12px var(--sans); width: 150px; flex: 0 1 150px; min-width: 64px; margin-right: 4px; background: #fff; }
.panel-body { padding: 12px; min-width: 0; overflow-x: auto; }
.panel-body.flush { padding: 0; }
.panel.collapsed .panel-body, .panel.collapsed .panel-foot { display: none; }
.panel-foot { border-top: 1px solid var(--line-soft); padding: 7px 12px; font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.panel.dragging { opacity: .45; } .panel.drop-before { box-shadow: -3px 0 0 var(--accent); } .panel.drop-after { box-shadow: 3px 0 0 var(--accent); }
.panel.maxed { position: fixed; z-index: 30; top: calc(var(--head-h) + 10px); left: calc(var(--side-w) + 12px); right: 12px; bottom: 12px; }
body.side-collapsed .panel.maxed { left: 68px; }
.panel.maxed .panel-body { overflow: auto; flex: 1; }
.backdrop { position: fixed; inset: var(--head-h) 0 0 0; background: rgba(15, 20, 28, .35); z-index: 25; display: none; }
.backdrop.on { display: block; }
.scroll { overflow: auto; max-height: var(--max-h, 420px); position: relative; }
.scroll.tall { --max-h: 640px; } .scroll.short { --max-h: 300px; }
/* Keep a two-column workspace in intermediate desktop windows. */
@media (min-width: 861px) and (max-width: 1279px) {
  :root { --side-w: 184px; }
  .panel { grid-column: span 6; }
  .panel[data-span="12"], .panel[data-span="8"], .panel[data-panel="inspector"] { grid-column: span 12; }
  .panel-head { flex-wrap: wrap; }
  .panel-title { max-width: 100%; }
  .pipe a { padding: 8px 5px; }
  .pipe .n { font-size: 19px; }
  .pipe .note { overflow-wrap: anywhere; }
}
@media (max-width: 860px) { .panel { grid-column: span 12; } .pt[data-act="width"] { display: none; } }
@media (max-width: 1279px) {
  .top { gap: 8px; padding: 0 10px; }
  .brand { min-width: 154px; }
  .top-right { gap: 6px; flex: none; }
  .mode .long { display: none; }
  .top-link { display: none; }
  .page-head .actions { margin-left: 0; max-width: 100%; flex-wrap: wrap; }
}
@media (min-width: 761px) and (max-width: 960px) {
  .brand > span:not(.mark) { display: none; }
  .brand { min-width: 26px; }
  #layout-reset { padding: 5px 7px; }
}
@media (max-width: 760px) {
  .top { gap: 8px; padding: 0 8px; } .brand { min-width: 0; } .brand > span:not(.mark) { display: none; }
  .search { min-width: 0; } .search kbd, .top-link, #layout-reset { display: none; }
  .page-head .actions { margin-left: 0; flex-wrap: wrap; }
  .panel-head { flex-wrap: wrap; } .panel-title { max-width: 100%; } .panel-tools { margin-left: auto; }
  .panel-filter { width: 96px; flex-basis: 96px; } .pt[data-act="move"] { display: none; }
  .side { width: 56px; } .side .label, .side h2, .side .count, .side .tag, .side .commodity { display: none; }
  main { margin-left: 56px; padding: 10px; } .brand small, .mode .long { display: none; } .brand { min-width: 0; }
  .panel.maxed { left: 8px; right: 8px; }
}

/* -- tables -------------------------------------------------------------------------------- */
table.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.dt th { position: sticky; top: 0; z-index: 2; background: var(--panel-head); color: var(--muted); font-weight: 600; font-size: 11.5px;
  text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dt th[data-sort] { cursor: pointer; user-select: none; } .dt th[data-sort]:hover { color: var(--ink); }
.dt th[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; } .dt th[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }
.dt td.nowrap, .dt th.nowrap { white-space: nowrap; }
.dt td { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.dt tbody tr:hover td { background: #f7f9fc; }
.dt tr.sel td { background: var(--accent-soft) !important; }
.dt td.num, .dt th.num { text-align: right; } .dt tr.hidden { display: none; }
.dt .wrap { white-space: normal; min-width: 260px; line-height: 1.7; }
.empty { color: var(--muted); padding: 16px; text-align: center; }

/* -- badges and provenance ---------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; white-space: nowrap; background: var(--flat-soft); color: var(--ink-2); border: 1px solid transparent; }
.b-ok { background: var(--ok-soft); color: var(--ok); } .b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); } .b-acc { background: var(--accent-soft); color: var(--accent-2); }
.prov { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; height: 19px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid; }
.prov::before { font-size: 10px; }
.prov-real { color: var(--p-real); background: var(--p-real-soft); border-color: #a9ddd2; } .prov-real::before { content: "●"; }
.prov-synthetic { color: var(--p-syn); background: var(--p-syn-soft); border-color: #f5b989; border-style: dashed; } .prov-synthetic::before { content: "◇"; }
.prov-restricted { color: var(--p-res); background: var(--p-res-soft); border-color: #cbbcf6; } .prov-restricted::before { content: "◐"; }
.prov-missing { color: var(--p-mis); background: repeating-linear-gradient(135deg, var(--p-mis-soft) 0 4px, #fff 4px 8px); border-color: #c8ced6; } .prov-missing::before { content: "○"; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span.item { display: inline-flex; gap: 6px; align-items: center; }

/* -- research content ------------------------------------------------------------------------ */
.prose { font-size: 14px; line-height: 1.85; color: var(--ink); }
.prose p { margin: 0 0 8px; }
.kv { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 5px 12px; font-size: 12.5px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mono { font-family: var(--mono); font-size: 11.5px; } .muted { color: var(--muted); } .small { font-size: 12px; }
.ev { display: inline-block; font: 11px var(--mono); padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; margin: 1px 2px 1px 0; background: #f8fafc; color: var(--accent-2); }
.ev:hover { border-color: var(--accent); text-decoration: none; }
[data-ev], [data-claim] { cursor: pointer; }
.selectable { border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; margin: -6px -8px 4px; display: block; text-align: left; width: calc(100% + 16px);
  background: transparent; font: inherit; color: inherit; }
.selectable:hover { border-color: var(--line); background: #f8fafc; }
.selectable.sel, [data-ev].sel { border-color: var(--accent); background: var(--accent-soft); }
.restrict { border-left: 3px solid var(--p-res); background: var(--p-res-soft); padding: 8px 12px; border-radius: 0 6px 6px 0; font-size: 12.5px; margin: 0 0 10px; line-height: 1.7; }
.restrict.syn { border-left-color: var(--p-syn); background: var(--p-syn-soft); }
.restrict.mis { border-left-color: var(--p-mis); background: var(--p-mis-soft); }
.flash { background: var(--ok-soft); color: var(--ok); border: 1px solid #b6e2c7; padding: 7px 12px; border-radius: 6px; margin: 0 0 12px; }
.error { background: var(--bad-soft); color: var(--bad); border: 1px solid #f4c0ba; padding: 12px 14px; border-radius: 8px; line-height: 1.7; }
.checks { list-style: none; padding: 0; margin: 0; } .checks li { padding: 6px 0; border-bottom: 1px dashed var(--line-soft); }
.checks li:last-child { border-bottom: 0; } .checks .code { font: 10.5px var(--mono); color: var(--muted); }
.checks .detail { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* pipeline strip */
.pipe { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 0; }
.pipe a { display: block; padding: 10px 12px; border-right: 1px solid var(--line-soft); color: var(--ink); position: relative; }
.pipe a:last-child { border-right: 0; } .pipe a:hover { background: #f7f9fc; text-decoration: none; }
.pipe .n { font-size: 22px; font-weight: 700; line-height: 1.2; } .pipe .of { color: var(--muted); font-size: 13px; font-weight: 400; }
.pipe .name { font-size: 12px; font-weight: 600; color: var(--ink-2); } .pipe .note { font-size: 11px; color: var(--muted); }
.pipe a::after { content: "›"; position: absolute; right: -5px; top: 18px; color: #9aa6b3; font-size: 16px; }
.pipe a:last-child::after { content: none; }
@media (max-width: 860px) { .pipe { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pipe a::after { content: none; } .pipe a { border-bottom: 1px solid var(--line-soft); } }

/* heat matrix */
.matrix { border-collapse: separate; border-spacing: 3px; width: 100%; }
.matrix th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: left; padding: 2px 4px; white-space: nowrap; }
.matrix td { padding: 0; }
.cell { width: 100%; min-height: 40px; border: 1px solid transparent; border-radius: 5px; padding: 4px 6px; font: 12px var(--sans); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.cell .lab { font-weight: 600; } .cell .chg { font-size: 10.5px; color: var(--muted); }
.d-up { background: var(--up-soft); color: var(--up); } .d-down { background: var(--down-soft); color: var(--down); }
.d-flat { background: var(--flat-soft); color: var(--ink-2); }
.d-unclear { background: repeating-linear-gradient(135deg, #f1f3f6 0 5px, #fff 5px 10px); color: var(--p-mis); border-color: #d5dae1; }
.cell.changed { box-shadow: inset 0 0 0 2px rgba(36, 99, 235, .55); } .cell.turning::after { content: "拐点"; font-size: 10px; color: var(--bad); font-weight: 700; }
.cell.sel { outline: 2px solid var(--ink); outline-offset: 1px; }

/* state card */
.card8 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.card8 .c { border-radius: 6px; padding: 6px 8px; font-size: 12px; } .card8 .c b { display: block; font-size: 13px; }
@media (max-width: 760px) { .card8 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 8 x 4 grid */
.grid84 { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.grid84 th { position: sticky; top: 0; z-index: 2; background: var(--panel-head); font-size: 11.5px; color: var(--muted); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.grid84 td { vertical-align: top; padding: 7px 8px; border-bottom: 1px solid var(--line-soft); line-height: 1.65; min-width: 136px; }
.grid84 td.sec { min-width: 112px; } .grid84 .st { font-size: 10.5px; color: var(--muted); display: block; }
.grid84 td[data-ev]:hover { background: #f7f9fc; } .grid84 td.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

/* source reader */
.reader { font-size: 14px; line-height: 1.85; }
.reader .ln { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 8px; padding: 2px 10px 2px 0; border-left: 3px solid transparent; scroll-margin-top: 80px; }
.reader .ln .n { font: 11px/2.3 var(--mono); color: #96a1ad; text-align: right; user-select: none; }
.reader .ln.non { color: #98a2ae; font-size: 12.5px; } .reader .ln.event { background: #fff7d6; border-left-color: #e0a800; }
.reader .ln.cited { background: #eef4ff; border-left-color: #93b4f5; }
.reader .ln.hit, .reader .ln:target { background: var(--accent-soft); border-left-color: var(--accent); }
.reader .nums { display: block; font: 11px var(--mono); color: var(--muted); }

/* inspector */
.inspector .hint { color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.inspector .claim { font-size: 14px; line-height: 1.8; margin: 0 0 10px; }
.inspector .claim-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.passage { border: 1px solid var(--line); border-radius: 7px; margin: 0 0 10px; overflow: hidden; }
.passage .q { padding: 10px 12px; font-size: 14px; line-height: 1.85; background: #fbfcfe; border-left: 3px solid var(--accent); }
.passage .meta { padding: 7px 12px; font-size: 11.5px; color: var(--muted); display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 2px 8px; border-top: 1px solid var(--line-soft); }
.passage .meta b { color: var(--ink-2); font-weight: 600; }
.sticky { position: sticky; top: calc(var(--head-h) + 12px); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -12px -12px 12px; padding: 0 8px; background: #fafbfc; }
.tabs button { border: 0; background: transparent; padding: 9px 12px; font: 600 12.5px var(--sans); color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--accent-2); border-bottom-color: var(--accent); }
[role="tabpanel"][hidden] { display: none; }

/* steps */
.steps { display: flex; gap: 4px; flex-wrap: wrap; }
.step { padding: 2px 9px; border-radius: 11px; font-size: 11.5px; background: var(--flat-soft); color: var(--muted); border: 1px solid var(--line); }
.step.done { background: var(--ok-soft); color: var(--ok); border-color: #b6e2c7; } .step.hold { background: var(--warn-soft); color: var(--warn); border-color: #f0d79a; }
.step.now { background: var(--accent-soft); color: var(--accent-2); border-color: #b9cdfb; font-weight: 600; }

/* forms */
button.btn, .btn { white-space: nowrap; font: 600 12.5px var(--sans); padding: 6px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.btn:hover { background: var(--accent-2); text-decoration: none; } .btn.ghost { background: #fff; color: var(--accent-2); }
.btn.ghost:hover { background: var(--accent-soft); } .btn.light { background: transparent; color: var(--chrome-ink); border-color: var(--chrome-line); }
.btn .demo { font-weight: 400; font-size: 10.5px; padding: 0 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); }
.btn.ghost .demo { background: var(--p-syn-soft); color: var(--p-syn); }
input[type=text], input[type=number], select, textarea { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); max-width: 100%; }
textarea { width: 100%; min-height: 70px; line-height: 1.7; }
label { color: var(--ink-2); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.scores { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 6px 12px; margin: 8px 0; }
.scores label { font-size: 12px; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.signform { border: 1px solid #c9d7f6; background: #f7f9ff; border-radius: 8px; padding: 12px; }
.signform h3 { margin: 0 0 6px; font-size: 13px; }
details summary { cursor: pointer; color: var(--accent-2); font-size: 12.5px; }
pre { white-space: pre-wrap; word-break: break-word; background: #f6f8fa; padding: 8px; border-radius: 6px; font-size: 11.5px; }
h3 { font-size: 13px; margin: 14px 0 6px; } h3:first-child { margin-top: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); line-height: 1.6; }
ul.plain li:last-child { border-bottom: 0; }

/* chart */
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: #e4e8ee; } svg.chart .axis { fill: #6b7683; font-size: 10.5px; }
svg.chart .line { fill: none; stroke: var(--accent); stroke-width: 1.8; } svg.chart .line.synthetic { stroke: var(--p-syn); stroke-dasharray: 5 3; }
svg.chart .win { fill: rgba(36, 99, 235, .08); stroke: rgba(36, 99, 235, .35); stroke-dasharray: 3 3; }
svg.chart .mark { fill: #fff; stroke: var(--ink); stroke-width: 1.5; }
svg.chart .watermark { fill: var(--p-syn); font-size: 12px; font-weight: 700; opacity: .8; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* -- restoration: research date, sync note, dated items, reading view, catalog, uploads ------- */
.upload-entry .count { font-size: 11px; padding: 0 6px; border-radius: 9px; background: #4a3410; color: #ffd48a; }
.datepick { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.datepick label { display: inline-flex; align-items: center; gap: 6px; }
.datepick select { font: 12px var(--sans); height: 30px; padding: 0 6px; border-radius: 6px; max-width: 190px; }
.datepick.dp-top .dp-label { color: var(--chrome-muted); }
.datepick.dp-top select { background: var(--chrome-2); color: var(--chrome-ink); border: 1px solid var(--chrome-line); }
.datepick.dp-top.history select { border-color: #f0a45f; color: #ffcf9e; background: #3a2412; }
.datepick .dp-follow { color: #ffcf9e; border: 1px solid #f0a45f; border-radius: 6px; padding: 5px 8px; font-weight: 600; }
.datepick .dp-follow:hover { text-decoration: none; background: #3a2412; }
.datepick.dp-mobile { display: none; }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: #f1d79b; }
@media (max-width: 1599px) { .datepick.dp-top .dp-label { display: none; } .datepick.dp-top select { width: 164px; } }
.datepick.dp-top { flex: none; } .upload-entry { flex: none; }
@media (max-width: 760px) {
  .datepick.dp-top, .upload-entry { display: none; }
  .datepick.dp-mobile { display: flex; margin: 0 0 8px; color: var(--muted); }
  .datepick.dp-mobile select { background: var(--panel); border: 1px solid var(--line); color: var(--ink); flex: 1; max-width: none; height: 28px; }
  .datepick.dp-mobile label { flex: 1; }
  .datepick.dp-mobile.history select { border-color: #e9c46a; background: #fffbea; }
  .datepick.dp-mobile .dp-follow { color: var(--warn); border-color: #e9c46a; background: #fffbea; }
}
.sync-note { background: var(--accent-soft); color: var(--accent-2); border: 1px solid #c4d5ff; padding: 6px 12px; border-radius: 6px; margin: 0 0 12px; font-size: 12.5px; }
.sync-note[data-error] { background: var(--warn-soft); color: var(--warn); border-color: #f1d79b; }
ul.dated > li, .item > summary { display: flex; align-items: flex-start; gap: 12px; }
ul.dated > li { padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
ul.dated > li > details { flex: 1; min-width: 0; }
ul.dated > li > details > summary { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; list-style: none; }
ul.dated > li > button.selectable { display: flex; gap: 12px; align-items: flex-start; width: 100%; }
.it { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.65; }
.it-date { flex: none; margin-left: auto; color: var(--muted); font: 12px var(--mono); white-space: nowrap; min-width: 6.5em; text-align: right; }
.dt th.date-col, .dt td.date-col { text-align: right; white-space: nowrap; font-family: var(--mono); }
.dt tr.group th { position: static; background: #fafbfc; color: var(--ink-2); font-size: 12px; }
.all-versions { margin-top: 10px; font-size: 12.5px; } .all-versions summary { cursor: pointer; color: var(--muted); }
.reading .rp { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 10px; margin: 0 0 10px; font-size: 14px; line-height: 1.85; }
.reading .rp.meta { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.reading .rl, .table-sentences .rl { color: var(--muted); font-size: 11.5px; padding-top: 3px; }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 9px; font-size: 11px; background: var(--accent-soft); color: var(--accent-2); }
.table-sentences { padding-left: 0; list-style: none; margin: 0; } .table-sentences li { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); line-height: 1.7; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.image-grid figure { margin: 0; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: #fbfcfd; }
.image-grid img { width: 100%; height: auto; display: block; }
.catalog-jump { display: flex; flex-wrap: wrap; gap: 6px 14px; flex-basis: 100%; font-size: 12.5px; }
.catalog-module { margin: 0 0 18px; }
.cm-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 0 2px 8px; border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.cm-head h2 { font-size: 16px; margin: 0; }
.cat-grid { --card-h: 18rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1280px) { .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .cat-grid { grid-template-columns: minmax(0, 1fr); } }
.cat-card { height: var(--card-h); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.cat-card > header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel-head); border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.cat-card h3 { font-size: 13.5px; margin: 0; }
.count-badge { margin-left: auto; font-size: 11px; min-width: 22px; text-align: center; padding: 0 6px; border-radius: 9px; background: var(--flat-soft); color: var(--muted); }
.cat-body { flex: 1; overflow: auto; padding: 8px 12px; font-size: 12.5px; line-height: 1.6; }
.cat-body .xref { margin: 0 0 6px; }
.cat-body .item { border-bottom: 1px solid var(--line-soft); padding: 4px 0; }
.cat-body .item > summary { cursor: pointer; list-style: none; }
.cat-body .item > summary::-webkit-details-marker, ul.dated summary::-webkit-details-marker { display: none; }
.cat-body .empty { padding: 6px 0; text-align: left; }
.factor-list li { padding: 3px 0; border-bottom: 1px dotted var(--line-soft); }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 140px; border: 2px dashed var(--line);
  border-radius: 10px; background: #fafbfd; cursor: pointer; text-align: center; padding: 16px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type="file"] { max-width: 100%; }
.dz-main { font-weight: 600; } .dz-sub { color: var(--muted); font-size: 12px; }
.stages { margin: 0; padding-left: 20px; } .stages li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.stages .st-failed strong { color: var(--bad); }
.nowrap { white-space: nowrap; }
.cat-body .item > summary, ul.dated summary { color: var(--ink); }
.legacy-item .orig { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; }
.legacy-item table.cols { border-collapse: collapse; margin: 4px 0; font-size: 12px; }
.legacy-item table.cols th, .legacy-item table.cols td { border: 1px solid var(--line-soft); padding: 2px 8px; text-align: left; font-weight: 400; }
.legacy-item table.cols th { color: var(--muted); background: var(--panel-head); }
.grid-foot { padding: 2px 12px; border-top: 1px solid var(--line-soft); line-height: 20px; font-size: 11.5px; }
.grid-foot summary { font-size: 11.5px; }
.grid-foot p { margin: 6px 0 0; line-height: 1.7; }
.tabs.compact { float: right; margin: 0 0 6px 12px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: #fff; gap: 0; position: relative; z-index: 1; }
.tabs.compact button { padding: 3px 10px; font-size: 12px; border-bottom: 0; border-radius: 4px; }
.tabs.compact button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-2); }

/* -- readability fixes for clipping seen in the reference captures --------------------------- */
.dt td.breakable, .breakable { overflow-wrap: anywhere; word-break: normal; }
.dt td.code-cell { font-size: 11px; min-width: 7em; }
.grid84 th:first-child { position: sticky; left: 0; z-index: 3; }
.grid84 td.sec { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--line-soft); }
.grid84 td.sec.sel { background: var(--accent-soft); }
/* Scroll shadows: an edge shadow appears only on the side that has more columns to scroll to. */
.scroll.x-shadow, .x-scroll.x-shadow {
  background: linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) right center / 24px 100% no-repeat local,
              linear-gradient(to left, rgba(22, 32, 43, .14), rgba(22, 32, 43, 0)) right center / 10px 100% no-repeat scroll;
}
.grid84 td.sec:hover { background: #f7f9fc; }
@media (max-width: 760px) {
  /* Title and tools share the first row; status badges go below instead of leaving an empty band. */
  .panel-head .panel-tools { order: 2; }
  .panel-head .panel-badges { order: 3; flex-basis: 100%; padding: 0 10px 8px; }
  .panel-head .panel-badges:empty { display: none; }
}

/* -- layout check at 1920 / 1440 / 1024 / 375 (2026-11-05) ----------------------------------- */
/* Tablet-width windows keep only the mark, as on phones, and a narrower research-date selector. */
@media (min-width: 761px) and (max-width: 1023px) {
  .top { gap: 10px; } .brand { min-width: 0; } .brand > span:not(.mark) { display: none; }
  .datepick.dp-top select { width: 140px; }
}
/* Inspector: hashes and version ids wrap inside the passage box instead of being cut off. */
.passage .meta > span { min-width: 0; overflow-wrap: anywhere; }
/* IDs break only where the filter put <wbr> (after "_"); dates stay whole. */
.ids { overflow-wrap: break-word; }
/* Heat maps: labels never split mid-word; on narrow panels the map scrolls sideways with the 板块 column pinned. */
.x-scroll { overflow-x: auto; position: relative; }
.matrix .cell .lab, .matrix .cell .chg { white-space: nowrap; }
.matrix tbody th[scope="row"] { position: sticky; left: 0; z-index: 1; background: var(--panel); }
/* A long button label wraps inside its panel instead of widening it on phones. */
.btn.btn-wrap { white-space: normal; max-width: 100%; }

.public-notice {padding:10px 12px;border:1px solid #c7d7f7;background:#edf3ff;border-radius:7px;margin-bottom:14px;} .public-footer {margin-top:24px;color:var(--muted);font-size:12px;} .public-card {padding:14px 0;border-bottom:1px solid var(--line-soft);} .public-card h3{margin:0 0 5px;} .public-card p{margin:0;} .public-status{font-size:18px;font-weight:700;color:var(--muted);} .public-flow{line-height:1.85;}
