:root {
  --ink: #152433;
  --ink-soft: #4a5d70;
  --paper: #e6f0f7;
  --paper-2: #f6fafd;
  --rule: #c5d6e6;
  --sidebar: #0c1c2e;
  --sidebar-2: #16324a;
  --accent: #c46e38;
  --accent-2: #e8c4b0;
  --bad: #b5463a;
  --turn: #c4891a;
  --ok: #2f7a5b;
  --muted: #6a7784;
  --shadow: 0 22px 50px rgba(21, 36, 51, 0.08);
  --stock-dock-h: 128px;
  --sans: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  height: auto;
}
html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body {
  display: flex;
  flex-direction: column;
  overflow: visible;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(196, 110, 56, 0.12), transparent 55%),
    radial-gradient(900px 420px at 8% 0%, rgba(140, 184, 214, 0.28), transparent 50%),
    var(--paper);
}

.sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  background:
    linear-gradient(180deg, rgba(140, 184, 214, 0.12), transparent 55%),
    linear-gradient(180deg, var(--sidebar) 0%, #071320 100%);
  color: #e8f0f6;
  padding: max(10px, env(safe-area-inset-top, 0px)) 20px 10px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  min-height: 0;
  height: auto;
  overflow: visible;
  border-bottom: 1px solid rgba(140, 184, 214, 0.18);
  box-shadow: 0 10px 24px rgba(7, 19, 32, 0.18);
}
.brand { display: flex; gap: 10px; align-items: center; flex: 0 0 auto; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  color: var(--accent-2);
  display: grid; place-items: center;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  padding: 0;
  box-shadow: inset 0 0 0 3px rgba(196, 110, 56, 0.16);
}
.brand strong {
  display: block;
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: 0;
  line-height: 1.25;
  font-weight: 650;
}
.brand em {
  font-style: normal;
  font-family: var(--sans);
  color: #8aa0b4;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.35;
  display: block;
  margin-top: 2px;
}
.stamp {
  margin: 0;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  color: #7a8fa3;
  white-space: nowrap;
}
.morning-stamp {
  white-space: normal;
  line-height: 1.35;
  max-width: 16rem;
}

.nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
}
.nav[hidden] { display: none !important; }
.nav button, .nav-ext {
  appearance: none; border: 0; background: transparent;
  color: #c5d4e0; text-align: center; padding: 7px 11px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer; border-radius: 2px;
  text-decoration: none;
  white-space: nowrap;
}
.nav button:hover, .nav-ext:hover { background: var(--sidebar-2); color: #fff; }
.nav button.active, .nav-ext.active {
  background: #1a3a54;
  color: #f0d4c4;
  box-shadow: inset 0 -2px 0 var(--accent);
}
body[data-nav-zone="hub"] .model-field,
body[data-nav-zone="hub"] #job-pill,
body[data-nav-zone="hub"] #preflight,
body[data-nav-zone="oa"] .model-field,
body[data-nav-zone="oa"] #job-pill,
body[data-nav-zone="oa"] #preflight {
  display: none;
}
.hub-cards .card { min-height: 200px; }
.oa-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 8px 0 12px;
}
.oa-add {
  display: flex;
  gap: 8px;
  align-items: center;
}
.oa-add input {
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 7px 10px;
  font: inherit;
  min-width: 160px;
}
.oa-new-grants {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.oa-grant, .oa-check { font-size: 13px; color: var(--ink-soft); }
.oa-status { color: var(--accent); min-height: 1.4em; }
.oa-del {
  appearance: none;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--bad);
  font: inherit;
  font-size: 12px;
  padding: 2px 8px;
  margin-left: 4px;
  cursor: pointer;
}
.oa-del:hover { background: #f7ece9; }
.oa-table-wrap { overflow-x: auto; }
.oa-matrix th { white-space: nowrap; vertical-align: bottom; }
.oa-th-tags, .oa-tag { font-size: 10px; letter-spacing: 0.04em; }
.oa-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  color: var(--muted);
}
.oa-tag.warn { color: var(--turn); border-color: #e0c47a; }
.nav-ext.unread {
  color: #7ec8ff;
  font-weight: 700;
}
.nav-ext.unread.active {
  color: #9ad4ff;
}

.sidebar-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-left: auto;
  flex: 0 0 auto;
}
.sidebar-tools .model-field {
  display: flex;
  align-items: center;
  color: #9bb3c6;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  gap: 6px;
  white-space: nowrap;
}
.sidebar-tools .model-field select {
  background: #123049;
  color: #e8f0f6;
  border-color: rgba(140, 184, 214, 0.28);
  min-width: 168px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}
.sidebar-tools .model-field select option {
  background: #123049;
  color: #e8f0f6;
}
.nav-logout {
  appearance: none;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(240, 212, 196, 0.32);
  background: transparent;
  color: #f0d4c4;
  padding: 6px 12px;
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.nav-logout:hover {
  background: var(--sidebar-2);
  color: #fff;
}
.sidebar-tools .pill {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  color: #152433;
}
.preflight {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px 14px;
  flex-basis: 100%;
  margin-top: 0;
}
.pf-item {
  display: flex; justify-content: flex-start; gap: 6px;
  font-size: 11px; color: #a8b8c6;
}
.pf-item span:last-child { display: none; }
.sidebar-foot { display: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.ok { background: #3d9a72; }
.dot.bad { background: #c45c4a; }
.sidebar-foot { color: #7a8fa3; font-size: 11px; line-height: 1.5; margin: 0; }

.main {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-height: auto;
  height: auto;
  overflow: visible;
}
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 28px 40px 18px;
  width: 100%;
}
.kicker {
  margin: 0 0 6px;
  letter-spacing: 0.28em;
  padding-right: 0.28em;
  text-transform: uppercase;
  font-size: 11px;
  line-height: 1.4;
  color: var(--accent);
}
.topbar h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-family: var(--serif);
}
.topbar-right { display: flex; gap: 14px; align-items: center; }
.model-field {
  font-size: 12px; color: var(--ink-soft); display: flex; gap: 8px; align-items: center;
}
.model-field select {
  border: 1px solid var(--rule); background: var(--paper-2);
  padding: 7px 10px; min-width: 176px; font: inherit; color: var(--ink);
}
.pill {
  font-size: 12px; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--rule); background: #e4eef6;
  color: #152433;
}
.pill.idle { color: #152433; background: #e4eef6; }
.pill.running { background: #f3e2b8; border-color: #e0c47a; color: #5a4310; }
.pill.done { background: #d7efe3; border-color: #9dceb6; color: #1f4d38; }
.pill.error { background: #f4d6d1; border-color: #e0a399; color: #7a2e26; }

.view { display: none; padding: 8px 40px 56px; width: 100%; }
.view.active { display: block; }
.view[hidden] { display: none !important; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 18px;
}
.card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 22px 20px 16px;
  box-shadow: var(--shadow);
  min-height: 176px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit; color: inherit;
  position: relative;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.card::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 26px 48px rgba(21, 36, 51, 0.12);
  border-color: var(--accent);
}
.card .kicker {
  color: var(--accent);
  margin: 0;
}
.card h2 { margin: 0; font-size: 20px; font-family: var(--serif); letter-spacing: 0.04em; }
.card p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.6; flex: 1; }
a.card { text-decoration: none; color: inherit; }
.card.unread h2 { color: #1a5fd4; font-weight: 700; }
.card .meta {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.card .stamp-date {
  align-self: flex-start;
  border: 1px solid var(--accent);
  color: #8a4a28;
  font-size: 11px;
  padding: 2px 8px;
  letter-spacing: 0.08em;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.kpi {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 18px 16px 14px;
  box-shadow: var(--shadow);
}
.kpi b { display: block; font-size: 36px; line-height: 1; font-family: var(--serif); }
.kpi span { color: var(--ink-soft); font-size: 12px; letter-spacing: 0.1em; }
.kpi.bad b { color: var(--bad); }
.kpi.turn b { color: var(--turn); }
.kpi.ok b { color: var(--ok); }

.ind-groups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 0 0 22px;
}
.ind-col {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 16px 18px 12px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.ind-col h3 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0.14em;
}
.ind-col .path-note { margin: 0 0 10px; }
.ind-row { margin-bottom: 12px; }
.ind-row h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}
.ind-row h4 b {
  font-family: var(--serif);
  color: var(--ink);
  margin-left: 4px;
}
.ticks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tick {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 3px 8px;
  background: #eef5fa;
  border: 1px solid var(--rule);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tick i {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
}
.muted { color: var(--muted); font-size: 12px; }

.report .table-wrap {
  overflow-x: auto;
  margin: 10px 0 22px;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  width: 100%;
}
.report table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}
.report th, .report td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.report thead th {
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: 0.04em;
  background: #eef5fa;
  white-space: nowrap;
}
.report tbody tr:nth-child(even) { background: rgba(140, 184, 214, 0.12); }
.report td .badge {
  white-space: nowrap;
  padding: 2px 10px;
}
.report table.tbl-status {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}
.report table.tbl-status col.col-code { width: 8.2em; }
.report table.tbl-status col.col-name { width: 6.2em; }
.report table.tbl-status col.col-status { width: 5.6em; }
.report table.tbl-status col.col-note { width: auto; }
.report table.tbl-status:not(:has(col.col-name)) col.col-code { width: 11em; }
.report table.tbl-status th.col-code,
.report table.tbl-status td.col-code {
  white-space: nowrap;
  padding-right: 8px;
}
.report table.tbl-status th.col-name,
.report table.tbl-status td.col-name {
  white-space: normal;
  word-break: break-word;
  padding-right: 8px;
}
.report table.tbl-status th.col-status,
.report table.tbl-status td.col-status {
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
  padding-left: 6px;
  padding-right: 6px;
}
.report table.tbl-status th.col-note,
.report table.tbl-status td.col-note {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.layer, .sector-table {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.layer { border-left: 4px solid var(--rule); }
.layer.bad { border-left-color: var(--bad); }
.layer.turn { border-left-color: var(--turn); }
.layer.ok { border-left-color: var(--ok); }
.layer h3, .sector-table h3 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.14em;
}
.layer ul { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.layer li.watch { color: var(--turn); }
.layer p { margin: 10px 0 0; font-size: 12px; color: var(--muted); }

table.plain { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plain th, table.plain td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--rule); }
table.plain th { color: var(--ink-soft); font-weight: 500; letter-spacing: 0.08em; }
table.plain tbody tr:nth-child(even) { background: rgba(140, 184, 214, 0.16); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 18px;
}
.toolbar select, .toolbar input, .toolbar textarea {
  border: 1px solid var(--rule);
  background: var(--paper-2);
  font: inherit;
  padding: 8px 10px;
  color: var(--ink);
}
.toolbar textarea { width: min(520px, 100%); min-height: 72px; }
.btn {
  appearance: none; border: 1px solid var(--ink);
  background: var(--ink); color: #f4f8fb;
  padding: 8px 16px; font: inherit; cursor: pointer;
  letter-spacing: 0.08em;
}
.btn.ghost { background: transparent; color: var(--ink); }
.btn.gold, .btn.accent {
  background: transparent;
  border-color: var(--accent);
  color: #8a4a28;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.xq {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff8f3;
  font-size: 15px;
  font-weight: 650;
  padding: 11px 20px;
  letter-spacing: 0.04em;
  min-height: 42px;
  box-shadow: 0 2px 0 #8a4a28;
}
.btn.xq:hover:not(:disabled) { filter: brightness(1.06); }
.btn.stop {
  background: transparent;
  border: 1px solid var(--bad);
  color: var(--bad);
  font-size: 14px;
  padding: 10px 16px;
  min-height: 42px;
  letter-spacing: 0.04em;
}
.btn.stop:hover:not(:disabled) { background: rgba(181, 70, 58, 0.08); }
.toolbar-grow { flex: 1 1 32px; min-width: 8px; }
.check { font-size: 13px; color: var(--ink-soft); display: flex; gap: 6px; align-items: center; }
.welcome { max-width: 42em; font-size: 15px; line-height: 1.7; color: var(--ink-soft); margin: 0 0 22px; }
.hint { font-size: 13px; color: var(--ink-soft); margin: 0 0 16px; }
.toolbar .status { font-size: 13px; color: var(--ok); }

.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  width: 100%;
}
.toc {
  position: sticky; top: 76px;
  max-height: calc(100dvh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 12px; color: var(--ink-soft);
  line-height: 1.8;
  letter-spacing: 0.04em;
}
.toc ul { list-style: none; padding-left: 0; margin: 0; }
.toc ul ul { padding-left: 12px; }
.toc a { color: inherit; text-decoration: none; }
.toc a:hover { color: var(--ink); }

.report {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  padding: 40px 56px 64px;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: calc(100vh - 220px);
  line-height: 1.8;
}
.report.empty, .empty { color: var(--ink-soft); }
.masthead {
  margin: 0 0 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--accent);
}
.masthead .kicker { margin: 0 0 8px; }
.masthead h2 {
  margin: 0;
  font-size: 26px;
  font-family: var(--serif);
  border: 0;
  padding: 0;
  letter-spacing: 0.05em;
}
.masthead .meta { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.report .masthead + h1 { display: none; }
.report h1 { font-size: 26px; margin: 0 0 14px; font-family: var(--serif); }
.report h2 {
  font-size: 15px;
  margin: 34px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  letter-spacing: 0.18em;
}
.report h2::before {
  content: none;
  display: none;
}
.report h3 { font-size: 14px; margin: 22px 0 8px; }
.report details.fold-section {
  margin: 34px 0 12px;
}
.report details.fold-section.fold-h3 {
  margin: 22px 0 8px;
}
.report details.fold-section > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  user-select: none;
}
.report details.fold-section > summary::-webkit-details-marker { display: none; }
.report details.fold-section > summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 13px;
  width: 1em;
  flex: none;
}
.report details.fold-section[open] > summary::before { content: "▾"; }
.report details.fold-section > summary h2,
.report details.fold-section > summary h3 {
  margin: 0;
  padding: 0;
  border: 0;
  flex: 1;
}
.report details.fold-section .fold-hint {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0;
  font-weight: 400;
  font-family: var(--sans);
}
.report details.fold-section .fold-hint::after { content: "点击展开"; }
.report details.fold-section[open] .fold-hint::after { content: "点击收起"; }
.report details.fold-section.fold-h3 .fold-hint::after { content: "点击打开"; }
.report details.fold-section.fold-h3[open] .fold-hint::after { content: "点击收起"; }
.report blockquote {
  margin: 0 0 18px;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: #eef5fa;
  color: var(--ink-soft);
  font-size: 13px;
}
.report ul { padding-left: 20px; }
.report li { margin: 10px 0; line-height: 1.75; }
.report li strong { color: var(--ink); }
.report a { color: #8a4a28; }
.report.theme-client {
  font-family: var(--serif);
  padding: 52px 60px 80px;
}
.report.theme-client h1, .report.theme-client .masthead h2 {
  font-weight: 600;
  letter-spacing: 0.08em;
}
.report.theme-client p { font-size: 16.5px; }
.report.theme-client p:first-of-type { font-size: 17.5px; }

.report.theme-stock {
  font-family: var(--serif);
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 40px 44px 72px;
  background: #fbfcfd;
}
.report.theme-stock .masthead {
  margin: 0 0 28px;
  padding-bottom: 18px;
}
.report.theme-stock .masthead h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
}
.report.theme-stock .masthead .stock-tp {
  display: inline-block;
  padding: 3px 12px;
  border: 1px solid var(--accent);
  color: #8a4a28;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.4;
  white-space: nowrap;
}
.report.theme-stock .masthead .stock-up {
  border-color: #2f6f4e;
  color: #2f6f4e;
}
.report.theme-stock .masthead .stock-down {
  border-color: #8a4a28;
  color: #8a4a28;
  opacity: 0.9;
}
.report.theme-stock .masthead .meta {
  margin-top: 10px;
  letter-spacing: 0.04em;
}
.report.theme-stock p {
  font-size: 16.5px;
  line-height: 1.9;
}
.report.theme-stock li {
  line-height: 1.85;
}
.report.theme-stock h2 {
  margin-top: 40px;
  letter-spacing: 0.12em;
}
.report.theme-stock blockquote {
  font-size: 14px;
  line-height: 1.75;
  background: #f3f7fb;
}

.stock-hero {
  max-width: 40rem;
  margin: 0 0 22px;
}
.stock-hero p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  line-height: 1.7;
}
.stock-search {
  margin: 0 0 18px;
  max-width: 360px;
}
.stock-search input {
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
}
.stock-group-mode {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
}
.stock-group-mode button {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
}
.stock-group-mode button.active {
  border-color: var(--accent);
  color: var(--ink);
  background: #fff;
}
.market-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 28px;
}
.market-jump a {
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 6px 12px;
  font-size: 13px;
}
.market-jump a:hover { color: var(--ink); border-color: var(--accent); }
.market-block { margin: 0 0 36px; }
.market-block > h2 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 0 0 14px;
  letter-spacing: 0.08em;
}
.market-block > h2 b {
  font-weight: 500;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  margin-left: 8px;
}
.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.stock-card {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  box-shadow: var(--shadow);
  padding: 22px 18px 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 108px;
  position: relative;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.stock-card::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.stock-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 40px rgba(21, 36, 51, 0.1);
  border-color: var(--accent);
}
.stock-card .name {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.35;
  font-weight: 600;
}
.stock-card.unread .name {
  color: #1a5fd4;
  font-weight: 700;
}
.stock-card .code {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.stock-card .meta {
  margin-top: auto;
  font-size: 11px;
  color: #8aa0b4;
}
.stock-card[hidden], .market-block[hidden] { display: none !important; }
.stock-chrome {
  position: sticky;
  top: var(--app-nav-h, 52px);
  z-index: 21;
  isolation: isolate;
  background: transparent;
  padding: 6px 0 28px;
  margin: 0 0 6px;
  border-bottom: 0;
}
.stock-chrome::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
  background: linear-gradient(
    180deg,
    rgb(230 240 247 / 80%) 0%,
    rgb(230 240 247 / 46%) 42%,
    rgb(230 240 247 / 16%) 78%,
    rgb(230 240 247 / 0%) 100%
  );
  backdrop-filter: blur(16px) saturate(1.18);
  -webkit-backdrop-filter: blur(16px) saturate(1.18);
  mask-image: linear-gradient(180deg, #000 0%, #000 52%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 52%, transparent 100%);
}
.stock-chrome.is-glazed::before {
  opacity: 1;
}
.stock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 0 0 8px;
}
.stock-ver {
  margin: 0;
  flex: 0 0 auto;
  margin-left: auto;
}
.stock-ver select {
  min-width: 12em;
  max-width: 22em;
}
.stock-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}
.stock-crumb a,
.stock-crumb button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: none;
}
.stock-reader {
  width: 100%;
  min-width: 0;
}
.stock-dock-space { display: none; }
.stock-reader .toolbar {
  position: static;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 4px 0 0;
  border: 0;
  background: transparent;
}
.stock-toolbar-left,
.stock-toolbar-mid,
.stock-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.stock-toolbar-left { justify-self: start; }
.stock-toolbar-mid { justify-self: center; }
.stock-toolbar-right { justify-self: end; }
.lang-switch {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper-2);
}
.lang-switch[hidden] { display: none; }
.lang-switch button {
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  padding: 8px 14px;
  cursor: pointer;
}
.lang-switch button.on {
  background: var(--accent);
  color: #fff;
}
.stock-reader .stock-btn-back,
.stock-reader .stock-btn-edit {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.04em;
  padding: 10px 22px;
}
.stock-reader .stock-btn-back { min-width: 7.8em; }
.stock-reader .stock-btn-edit { min-width: 5.6em; }
.stock-reader .btn.xq {
  min-width: 12.5em;
  padding: 11px 28px;
  font-size: 16px;
}
.xq-box {
  margin: 0 0 32px;
  background:
    linear-gradient(180deg, rgba(196, 110, 56, 0.08), rgba(140, 184, 214, 0.12));
  border: 1px solid var(--rule);
  border-left: 8px solid var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.xq-box-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 4px 8px 4px 4px;
}
.xq-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  padding: 12px 10px;
  color: var(--ink);
  font: inherit;
}
.xq-toggle-title {
  font-size: 18px;
  font-weight: 650;
  line-height: 1.35;
}
.xq-caret {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}
.xq-box:not(.open) .xq-caret::after { content: "展开"; }
.xq-box.open .xq-caret::after { content: "收起"; }
.xq-box-body {
  display: none;
  padding: 4px 18px 16px;
  border-top: 1px dashed var(--rule);
}
.xq-box.open .xq-box-body:not([hidden]) { display: block; }
.xq-box-body h2 { font-size: 16px; margin: 16px 0 8px; }
.xq-box-body h3 { font-size: 14px; margin: 14px 0 6px; }
.xq-panel {
  margin: 0 0 28px;
  padding: 16px 18px 8px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
}
.xq-panel h1 {
  font-size: 20px;
  margin: 0 0 8px;
}
.xq-panel h2 {
  font-size: 16px;
  margin: 18px 0 8px;
}
.stock-reader .workspace {
  align-items: start;
  grid-template-columns: minmax(200px, 228px) minmax(0, 1fr);
  gap: 20px;
  width: 100%;
  min-width: 0;
}
.stock-side {
  position: sticky;
  top: 20dvh;
  z-index: 15;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: var(--stock-side-h, calc(100dvh - 20dvh - 16px));
  max-height: var(--stock-side-h, calc(100dvh - 20dvh - 16px));
  min-height: 0;
  min-width: 0;
}
.stock-reader .toc {
  position: static;
  top: auto;
  z-index: 15;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-sizing: border-box;
  min-height: 0;
  max-height: none;
  margin-top: 0;
  padding-top: 0;
  overflow-y: auto;
  flex: 1 1 auto;
  font-size: 16px;
  font-weight: 700;
  line-height: 2.15;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.stock-xq-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  padding-bottom: 4px;
}
.stock-xq-actions .btn {
  width: 100%;
  min-width: 0;
  justify-content: center;
  padding: 10px 12px;
  font-size: 15px;
}
.stock-reader .stock-xq-actions .btn.xq {
  min-width: 0;
  padding: 10px 12px;
  font-size: 15px;
}
.ff-dialog {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
}
.ff-dialog[hidden] { display: none !important; }
.ff-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 28, 46, 0.38);
}
.ff-dialog-card {
  position: relative;
  width: min(420px, calc(100vw - 36px));
  background: var(--paper-2);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  padding: 28px 24px 20px;
  text-align: center;
}
.ff-dialog-text {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}
.ff-dialog-card .btn { min-width: 6em; }
.xq-drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
  overscroll-behavior: none;
}
.xq-drawer[hidden] { display: none !important; }
.xq-drawer-dim {
  position: absolute;
  inset: 0;
  background: rgba(12, 28, 46, 0.28);
  opacity: 0;
  transition: opacity 0.28s ease;
  touch-action: none;
}
.xq-drawer.is-open .xq-drawer-dim { opacity: 1; }
.xq-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 75%;
  height: 100%;
  max-height: 100dvh;
  background: var(--paper-2);
  box-shadow: 16px 0 40px rgba(21, 36, 51, 0.16);
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.xq-drawer.is-open .xq-drawer-panel { transform: translateX(0); }
.xq-drawer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 16px 56px 12px 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  flex: 0 0 auto;
}
.xq-drawer-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}
.xq-drawer-body,
.xq-drawer-body.report,
.xq-drawer-body.report.theme-stock {
  flex: 1 1 0%;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 20px 28px 40px;
  min-width: 0;
  width: auto;
  box-shadow: none;
  border: 0;
}
.xq-drawer-close {
  appearance: none;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #f4f8fb;
  font-size: 58px;
  font-weight: 300;
  line-height: 1;
  padding: 0 10px 6px 0;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(21, 36, 51, 0.22);
  z-index: 2;
}
.xq-drawer-close:hover { filter: brightness(1.08); }
html.xq-drawer-on,
html.xq-drawer-on body {
  overflow: hidden !important;
  overscroll-behavior: none;
}
body.xq-drawer-on {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}
.stock-reader .toc a {
  font-weight: 700;
  color: var(--ink);
}
.report-reader .report {
  padding: 40px 44px 72px;
  background: #fbfcfd;
}
.report-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: flex-start;
  padding: 8px 0 18px;
}
.report-opts:empty { display: none; }
.report-opts .check input,
.report-opts .check select {
  border: 1px solid var(--rule);
  background: var(--paper-2);
  font: inherit;
  padding: 7px 10px;
  color: var(--ink);
}
.report-opts textarea {
  width: min(420px, 100%);
  min-height: 56px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  font: inherit;
  padding: 8px 10px;
  color: var(--ink);
}
.report-reader .report-opts textarea#opt-notes {
  flex: 1 1 100%;
  width: 100%;
  min-height: 180px;
  resize: vertical;
}
.report-opts .path-note { width: 100%; margin: 0; }
.stock-reader.is-compose .workspace,
.stock-reader .workspace:not(:has(.toc:not([hidden]))) {
  grid-template-columns: minmax(0, 1fr);
}
.stock-upload {
  margin: 0 0 22px;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
}
.stock-workbar {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto auto auto;
  column-gap: 10px;
  row-gap: 0;
  align-items: stretch;
}
.stock-mod {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 3;
  align-items: stretch;
  gap: 7px;
  min-width: 0;
  min-height: 0;
  padding: 11px 11px 10px;
  background:
    linear-gradient(180deg, #fff, var(--paper-2));
  border: 1px solid var(--rule);
  box-shadow: 0 8px 20px rgba(21, 36, 51, 0.05);
  position: relative;
}
.stock-mod::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.stock-mod-create::before { background: var(--sidebar-2); }
.stock-mod-upload::before { background: var(--ok); }
.stock-mod.is-on {
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(196, 110, 56, 0.12);
}
.stock-mod-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.stock-mod-head > div {
  min-width: 0;
  flex: 1 1 auto;
}
.stock-mod-idx {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(196, 110, 56, 0.06);
}
.stock-mod-create .stock-mod-idx {
  border-color: var(--sidebar-2);
  color: var(--sidebar-2);
  background: rgba(22, 50, 74, 0.06);
}
.stock-mod-upload .stock-mod-idx {
  border-color: var(--ok);
  color: var(--ok);
  background: rgba(47, 122, 91, 0.08);
}
.stock-mod h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.25;
}
.stock-mod .lede {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.stock-mod-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  align-self: stretch;
}
.stock-mod-gen .stock-mod-body {
  justify-content: flex-start;
  position: static;
}
.stock-mod-gen #stock-lookup-hint {
  position: static;
  left: auto;
  right: auto;
  top: auto;
  margin: 0;
  min-height: 1.35em;
}
.stock-mod-copy {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.stock-mod #stock-query,
.stock-mod #stock-up-target,
.stock-kind-seg {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--rule);
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.stock-mod #stock-query,
.stock-mod #stock-up-target {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  padding: 6px 9px;
}
.stock-kind-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0;
  overflow: hidden;
}
.stock-kind-seg label {
  display: block;
  margin: 0;
  padding: 5px 6px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  border-right: 1px solid var(--rule);
}
.stock-kind-seg label:last-child { border-right: 0; }
.stock-kind-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.stock-kind-seg label:has(input:checked) {
  background: var(--ink);
  color: #f4f8fb;
}
.stock-mod .path-note {
  margin: 0;
  min-height: 0;
}
.stock-mod > .btn {
  margin-top: 0;
  align-self: end;
}
.stock-workbar > .stock-work-msg {
  grid-column: 1 / -1;
  margin: 8px 0 0;
}
.stock-workbar > .stock-work-msg:empty,
.stock-workbar > .stock-work-msg[hidden] {
  display: none;
}
.stock-mod .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-decoration: none;
  padding: 10px 14px;
  font-weight: 650;
  letter-spacing: 0.06em;
}
.stock-mod .btn.gold,
.stock-mod .btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff8f3;
  box-shadow: 0 2px 0 #8a4a28;
}
.stock-mod .btn.gold:hover:not(:disabled),
.stock-mod .btn.accent:hover:not(:disabled) {
  filter: brightness(1.06);
}
.stock-mod .btn.ghost {
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}
.stock-mod-create .btn.gold {
  background: var(--sidebar);
  border-color: var(--sidebar);
  color: #e8f0f6;
  box-shadow: 0 2px 0 #071320;
}
@media (max-width: 980px) {
  .stock-workbar {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .stock-mod {
    display: flex;
    flex-direction: column;
    grid-row: auto;
  }
  .stock-mod-gen .stock-mod-body {
    position: static;
    justify-content: flex-start;
  }
  .stock-mod-gen #stock-lookup-hint {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    margin: 0;
  }
}
.stock-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 18px 0 0;
}
.stock-edit-form[hidden] {
  display: none !important;
}
.stock-edit-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 148px;
  gap: 12px 16px;
  margin: 0 0 18px;
}
.stock-edit-field {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-soft);
}
@media (max-width: 720px) {
  .stock-edit-meta { grid-template-columns: 1fr; }
}
.stock-edit-field input,
.stock-edit-field select {
  border: 1px solid var(--rule);
  background: #fff;
  font: inherit;
  padding: 8px 10px;
  color: var(--ink);
}
.stock-edit-tools {
  display: flex;
  gap: 8px;
}
.md-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--rule);
  border-bottom: 0;
  background: #fff;
}
.md-sep {
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: #d5deE6;
}
.md-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #3a4a58;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  font: 13px/1 var(--sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.md-btn:hover { background: #eef3f7; }
.md-select {
  border: 0;
  background: transparent;
  font: 12px/1.2 var(--sans);
  color: #3a4a58;
  height: 28px;
  padding: 0 4px;
}
.md-file { position: relative; overflow: hidden; cursor: pointer; }
.md-file input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}
.stock-edit-form .stock-editor {
  margin-top: 0;
  border-top: 0;
  min-height: 56vh;
}
.stock-workbar-row, .stock-upload-row, .stock-upload-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
#stock-query {
  flex: 1 1 220px;
  min-width: 0;
  border: 1px solid var(--rule);
  background: #fff;
  font: inherit;
  padding: 8px 10px;
  color: var(--ink);
}
.path-note.ok { color: var(--ok); }
.path-note.err { color: var(--bad); }
.report img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 16px auto;
}
.stock-upload-meta {
  margin-top: 10px;
}
.stock-upload-meta label {
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  gap: 6px;
  align-items: center;
}
.stock-upload-meta input {
  border: 1px solid var(--rule);
  background: #fff;
  font: inherit;
  padding: 6px 8px;
  color: var(--ink);
  width: 140px;
}
.stock-file-btn { position: relative; overflow: hidden; }
.stock-file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}
.pdf-frame {
  width: 100%;
  min-height: 78vh;
  border: 1px solid var(--rule);
  background: #fff;
}
.stock-editor {
  width: 100%;
  min-height: 70vh;
  margin-top: 12px;
  border: 1px solid var(--rule);
  background: #fff;
  font: 14px/1.6 ui-monospace, Consolas, monospace;
  padding: 12px;
  color: var(--ink);
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--sans);
  line-height: 1.5;
}
.badge-bad { background: #f3d6d1; color: var(--bad); }
.badge-turn-up, .badge-turn-down { background: #f6e4bc; color: #8a5a10; }
.badge-ok { background: #d9eee4; color: var(--ok); }
.badge-muted, .badge-warn { background: #e4eef4; color: var(--muted); }

.path-note { font-size: 12px; color: var(--muted); margin: 0 0 12px; }

.log-drawer {
  border-top: 1px solid var(--rule);
  background: #dde8f1;
  padding: 10px 40px 16px;
  width: 100%;
  position: sticky;
  bottom: 0;
  z-index: 40;
}
.log-head { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.log-head-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.log-head button {
  appearance: none; border: 0; background: transparent;
  font: inherit; color: var(--ink-soft); cursor: pointer;
}
.log-head .btn.stop {
  margin: 0;
  min-height: 32px;
  padding: 6px 12px;
  font-size: 13px;
}
.log {
  max-height: 180px;
  overflow: auto;
  background: #0c1c2e;
  color: #dce8f2;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.45;
}

.notice {
  background: #f8ece6;
  border: 1px solid #e0b8a4;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

@media print {
  html, body { height: auto; overflow: visible; }
  .sidebar, .topbar, .toolbar, .log-drawer, .toc, .sidebar-hit { display: none !important; }
  body { display: block; background: #fff; overflow: visible; }
  .main { height: auto; overflow: visible; }
  .view { display: block !important; padding: 0; max-width: none; }
  .report { border: 0; box-shadow: none; max-width: none; min-height: 0; }
  details.fold-section > *:not(summary) { display: block !important; }
  details.fold-section > summary .fold-hint,
  details.fold-section > summary::before { display: none; }
  details.fold-section > summary h2,
  details.fold-section > summary h3 {
    margin: 22px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--rule);
  }
}

@media (hover: none) {
  .card:hover, .stock-card:hover { transform: none; }
}

@media (min-width: 1280px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .card { min-height: 200px; }
}

@media (min-width: 1600px) {
  .topbar, .view, .log-drawer { padding-left: 48px; padding-right: 48px; }
  .report { padding: 48px 72px 72px; }
}

@media (max-width: 960px) {
  html, body {
    height: auto;
    min-height: 100%;
    max-width: 100%;
  }
  html {
    overflow-x: hidden;
    overflow-y: auto;
  }
  body { overflow: visible; }
  .sidebar {
    padding: max(10px, env(safe-area-inset-top, 0px)) 12px 8px;
    gap: 8px 10px;
  }
  .nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; height: 0; }
  .nav button, .nav-ext { flex: 0 0 auto; }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: 0; }
  .stamp, .preflight, .sidebar-tools .pill { display: none; }
  .brand {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
  }
  .brand em { display: none; }
  .sidebar-tools {
    order: 2;
    margin-left: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .sidebar-tools .model-field {
    width: auto;
    font-size: 0;
    gap: 0;
  }
  .sidebar-tools .model-field select {
    min-width: 0;
    width: 9.5em;
    max-width: 42vw;
    font-size: 12px;
    padding: 6px 8px;
  }
  .nav-logout { padding: 6px 10px; }
  .nav {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }
  .nav button, .nav-ext { padding: 8px 10px; font-size: 13px; }
  .kicker { letter-spacing: 0.12em; padding-right: 0.12em; }
  .main {
    min-height: auto;
    height: auto;
    flex: 1 0 auto;
    overflow: visible;
  }
  .workspace, .kpis, .layers, .ind-groups { grid-template-columns: 1fr; }
  .view, .topbar, .log-drawer { padding-left: 16px; padding-right: 16px; min-width: 0; }
  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    padding-top: 16px;
    padding-bottom: 10px;
    background: var(--paper);
    position: relative;
    z-index: 1;
  }
  .topbar h1 { font-size: 24px; }
  .topbar-right { flex-wrap: wrap; width: 100%; }
  .topbar-right .model-field { width: 100%; }
  .topbar-right .model-field select { min-width: 0; flex: 1; }
  .stock-side {
    position: static;
    height: auto;
    max-height: none;
    min-height: 0;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
  }
  .stock-xq-actions {
    margin-top: 16px;
    margin-bottom: 0;
    padding: 0 16px 8px;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    box-sizing: border-box;
    gap: 10px;
  }
  .stock-xq-actions .btn,
  .stock-reader .stock-xq-actions .btn.xq {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
  }
  .toc,
  .stock-reader .toc {
    position: static;
    min-height: 0;
    max-height: 140px;
    justify-content: flex-start;
    overflow: auto;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rule);
    font-size: 13px;
  }
  .report { min-height: 0; padding: 28px 18px 40px; overflow: visible; }
  .xq-drawer-body.report,
  .xq-drawer-body.report.theme-stock {
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 0%;
    min-height: 0;
    width: auto;
    max-width: none;
  }
  .report.theme-stock { padding: 24px 16px 48px; max-width: none; width: 100%; }
  .report.theme-stock .masthead h2 { font-size: 22px; }
  .stock-reader .workspace {
    display: flex;
    flex-direction: column;
    grid-template-columns: minmax(0, 1fr);
  }
  .stock-reader .report { order: 1; }
  .stock-reader .stock-side { order: 2; }
  .stock-reader {
    padding-bottom: calc(var(--stock-dock-h, 128px) + 24px);
  }
  .stock-dock-space {
    display: block;
    width: 100%;
    height: 8px;
    min-height: 8px;
    flex-shrink: 0;
    pointer-events: none;
  }
  .stock-reader .toolbar {
    position: fixed;
    display: flex;
    flex-wrap: wrap;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 70;
    margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--paper);
    border-top: 1px solid var(--rule);
    border-bottom: 0;
    box-shadow: 0 -8px 20px rgba(21, 36, 51, 0.08);
  }
  .xq-drawer-panel {
    width: min(92vw, 100%);
  }
  .xq-drawer-head {
    padding: max(12px, env(safe-area-inset-top, 0px)) 56px 10px 16px;
  }
  .xq-drawer-body {
    padding: 16px 16px calc(48px + env(safe-area-inset-bottom, 0px));
  }
  .stock-chrome {
    position: static;
    isolation: auto;
    border-bottom: 0;
    margin-bottom: 8px;
    padding: 4px 0 8px;
  }
  .stock-chrome::before { content: none; }
  .sidebar.is-glazed {
    background: rgba(12, 28, 46, 0.78);
    backdrop-filter: blur(16px) saturate(1.18);
    -webkit-backdrop-filter: blur(16px) saturate(1.18);
  }
  .report h2 { letter-spacing: 0.08em; }
  .report table.tbl-status col.col-code { width: 7.2em; }
  .report table.tbl-status col.col-name { width: 5.2em; }
  .report table.tbl-status col.col-status { width: 5.2em; }
  .report .table-wrap {
    overflow-x: auto;
    max-width: 100%;
  }
  .report table {
    width: max-content;
    min-width: 100%;
  }
  .report th, .report td { word-break: break-word; overflow-wrap: anywhere; }
  .report thead th { white-space: nowrap; }
}

@media (max-width: 720px) {
  .view, .topbar, .log-drawer { padding-left: 12px; padding-right: 12px; }
  .stock-reader .toc { display: none; }
  .stock-reader .toolbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 70;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--paper);
    border-top: 1px solid var(--rule);
    border-bottom: 0;
    box-shadow: 0 -8px 20px rgba(21, 36, 51, 0.08);
  }
  .stock-reader {
    padding-bottom: calc(var(--stock-dock-h, 128px) + 24px);
  }
  .stock-side {
    padding-left: 0;
    padding-right: 0;
  }
  .stock-xq-actions {
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 8px;
  }
  .report-reader .stock-side:not(:has(.stock-xq-actions)) {
    display: none;
  }
  .stock-crumb { font-size: 12px; }
  .report.theme-stock {
    padding: 16px 12px 36px;
  }
  .report.theme-stock p,
  .report.theme-stock li {
    font-size: 15.5px;
    line-height: 1.75;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .report.theme-stock h1 { font-size: 22px; }
  .report.theme-stock h2 {
    font-size: 16px;
    letter-spacing: 0.04em;
    margin-top: 26px;
  }
  .report.theme-stock h3 { font-size: 14px; }
  .report.theme-stock .masthead h2 { font-size: 20px; }
  .report.theme-stock .masthead .stock-tp {
    white-space: normal;
    font-size: 13px;
  }
  .report th, .report td {
    padding: 8px 8px;
    font-size: 12px;
  }
  .pdf-frame { min-height: 58vh; }
  .stock-search input { width: 100%; }
}

body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  min-height: 100%;
  min-height: 100dvh;
  overflow: auto;
  padding: max(28px, env(safe-area-inset-top, 0px)) 18px max(28px, env(safe-area-inset-bottom, 0px));
}
@media (max-width: 960px) {
  body.login-page { align-items: flex-start; }
}
.login-card {
  width: min(420px, 100%);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  padding: 28px 24px 22px;
  border-radius: 4px;
}
.login-card .brand { margin-bottom: 22px; color: var(--ink); }
.login-card .brand-mark {
  background: var(--sidebar);
  color: var(--accent-2);
}
.login-card .brand em { color: var(--ink-soft); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
}
.login-form input {
  appearance: none;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 12px 12px;
  border-radius: 2px;
  font-size: 16px;
}
.login-form input:focus {
  outline: 2px solid rgba(196, 110, 56, 0.35);
  border-color: var(--accent);
}
.login-form button {
  appearance: none;
  border: 0;
  background: var(--sidebar);
  color: #f0d4c4;
  font: inherit;
  padding: 12px 14px;
  margin-top: 6px;
  cursor: pointer;
  letter-spacing: 0.12em;
}
.login-form button:hover { background: var(--sidebar-2); }
.login-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  background: #f8ece6;
  border: 1px solid #e0b8a4;
  color: var(--bad);
  font-size: 13px;
}
.login-foot {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.xq-status {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 0 14px;
  padding: 12px 16px;
  background: #fff6ee;
  border: 1px solid var(--accent);
  border-left-width: 6px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
.xq-status[hidden] { display: none !important; }
.xq-status.ok {
  background: #eaf6ef;
  border-color: var(--ok);
}
.xq-status.err {
  background: #f8ece6;
  border-color: var(--bad);
}

.archive-kind {
  margin: 28px 0 14px;
  font-size: 15px;
  letter-spacing: 0.14em;
}
a.btn {
  display: inline-block;
  text-decoration: none;
  line-height: 1.4;
}
dialog.sheet {
  border: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 22px;
  width: min(560px, 92vw);
  color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(12, 28, 46, 0.45); }
dialog.sheet h2 { margin: 0 0 8px; font-size: 18px; font-family: var(--serif); }
dialog.sheet textarea {
  width: 100%; min-height: 140px; font: inherit; padding: 10px;
  border: 1px solid var(--rule); background: #fff;
}
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.path-note { font-size: 13px; color: var(--ink-soft); }
#xq-status { min-height: 1.4em; font-size: 13px; margin: 0 0 12px; }
#xq-status.err { color: var(--bad); }
.err { color: var(--bad); font-size: 13px; }

.nav-edge { display: none; }
