:root {
  --bg: #f3f0e9;
  --bg-deep: #eae5da;
  --surface: #fffdf8;
  --surface-2: #faf7f0;
  --surface-3: #f5f1e7;
  --ink: #171b1f;
  --ink-2: #3b4249;
  --muted: #7b8087;
  --muted-2: #9a9ea3;
  --line: #e4ded1;
  --line-strong: #d2c9b7;
  --brand: #b08d4f;
  --brand-2: #8c6d36;
  --brand-soft: #f4ead6;
  --deep: #12181c;
  --deep-2: #1a2428;
  --green: #2f6b4f;
  --green-soft: #e8f1ea;
  --red: #a63b2f;
  --red-soft: #f8e9e5;
  --amber: #a8741d;
  --amber-soft: #f9efdb;
  --blue: #3b5a7a;
  --blue-soft: #e9eff5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(23, 27, 31, .04), 0 18px 42px -30px rgba(23, 27, 31, .35);
  --font-sans: "Inter", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --font-num: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--brand-soft); color: var(--ink); }

.app-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(1200px 500px at -20% -10%, #223029 0%, transparent 55%), linear-gradient(180deg, #131a1e 0%, #0d1215 100%);
  color: #c9ced2; padding: 22px 14px 16px; z-index: 40; overflow: hidden;
}
.sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 100% 28px; opacity: .5;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; position: relative; z-index: 1; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid rgba(176, 141, 79, .65);
  display: grid; place-items: center; background: linear-gradient(145deg, rgba(176,141,79,.22), rgba(176,141,79,.04));
  color: #e8d5ad; flex: none;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-family: var(--font-serif); font-size: 19px; letter-spacing: .12em; color: #f0e9da; line-height: 1.1; }
.brand-sub { font-size: 10px; letter-spacing: .16em; color: #8e969b; margin-top: 4px; text-transform: uppercase; }
.nav { position: relative; z-index: 1; flex: 1; overflow-y: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-group { margin-bottom: 18px; }
.nav-label { font-size: 10px; letter-spacing: .18em; color: #6e777c; padding: 0 12px 8px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px;
  color: #aeb5b9; font-size: 13.5px; letter-spacing: .01em; position: relative; transition: background .18s, color .18s;
  margin-bottom: 2px;
}
.nav-item svg { width: 17px; height: 17px; opacity: .82; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.055); color: #f4f1ea; }
.nav-item.active { background: rgba(255,255,255,.075); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 2px; background: var(--brand); border-radius: 2px;
}
.nav-item .nav-dot { margin-left: auto; width: 5px; height: 5px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(166,59,47,.12); }
.sidebar-foot { position: relative; z-index: 1; border-top: 1px solid rgba(255,255,255,.08); padding: 14px 10px 2px; }
.source-line { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: #8f989d; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #5fae82; box-shadow: 0 0 0 4px rgba(95,174,130,.12); flex: none; }
.sidebar-meta { margin-top: 8px; font-size: 11px; color: #6f787d; line-height: 1.7; }
.sidebar-meta strong { color: #aab2b6; font-weight: 500; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; min-height: 64px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 30px; border-bottom: 1px solid var(--line);
  background: rgba(243, 240, 233, .88); backdrop-filter: blur(12px);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.crumbs b { color: var(--ink-2); font-weight: 600; }
.crumbs .sep { color: var(--muted-2); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.period-select, .scope-select {
  appearance: none; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px;
  height: 34px; padding: 0 30px 0 12px; font-size: 12.5px; color: var(--ink-2); cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%237b8087' stroke-width='1.4' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); transition: .18s;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand-2); }
.icon-btn svg { width: 16px; height: 16px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--deep); color: #e8d5ad; font-family: var(--font-serif); font-size: 13px; letter-spacing: .05em;
  border: 1px solid rgba(176,141,79,.4);
}
.snapshot-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 11.5px; white-space: nowrap;
}
.snapshot-pill .pulse { width: 6px; height: 6px; }
.snapshot-pill.warn { border-color: rgba(166,59,47,.3); color: var(--red); background: var(--red-soft); }
.snapshot-pill.warn .pulse { background: var(--red); box-shadow: 0 0 0 3px rgba(166,59,47,.12); }

.content { padding: 26px 30px 90px; max-width: 1600px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-head-left { min-width: 0; }
.eyebrow { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.eyebrow .bar { width: 18px; height: 1px; background: var(--brand); display: inline-block; }
.page-title { font-family: var(--font-serif); font-size: 30px; line-height: 1.32; font-weight: 600; margin: 8px 0 6px; letter-spacing: -.01em; color: var(--ink); max-width: 960px; text-wrap: balance; }
.page-sub { color: var(--muted); font-size: 12.8px; line-height: 1.7; }
.page-head-actions { display: flex; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 15px;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  font-size: 12.5px; transition: .18s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand-2); }
.btn.primary { background: var(--deep); color: #f3ede1; border-color: var(--deep); }
.btn.primary:hover { background: #22302a; color: #fff; }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fffdf8; }
.btn.brand:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; }
.btn.small { height: 30px; padding: 0 11px; font-size: 11.5px; }
.btn svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.grid { display: grid; gap: 16px; }
.grid-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-12 { grid-column: span 12; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-pad, .split > *, .report-content > *, .report-body { min-width: 0; }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; letter-spacing: .01em; }
.card-title .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.card-desc { color: var(--muted); font-size: 11.8px; line-height: 1.65; margin-top: 3px; }
.card-link { color: var(--brand-2); font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.card-link:hover { text-decoration: underline; }
.card-link svg { width: 12px; height: 12px; }

.memo {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: linear-gradient(135deg, #fffdf8 0%, #fbf7ed 62%, #f6efe1 100%);
  border: 1px solid var(--line); box-shadow: var(--shadow); padding: 24px 26px 22px 30px;
}
.memo::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--brand), rgba(176,141,79,.15)); }
.memo::after {
  content: "“"; position: absolute; right: 22px; top: -18px; font-family: var(--font-serif); font-size: 120px;
  color: rgba(176,141,79,.12); line-height: 1; pointer-events: none;
}
.memo-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.memo-label { display: flex; align-items: center; gap: 9px; font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--brand-2); }
.memo-label .ai-orb {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #e9d3a3, #b08d4f); color: #fff; font-size: 9px; letter-spacing: .04em;
  box-shadow: 0 0 0 4px rgba(176,141,79,.12);
}
.memo-headline { font-family: var(--font-serif); font-size: 24px; line-height: 1.45; margin: 0 0 12px; color: var(--ink); }
.memo-body p { margin: 0 0 9px; color: var(--ink-2); font-size: 13.6px; line-height: 1.85; }
.memo-body p:last-child { margin-bottom: 0; }
.memo-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-strong); flex-wrap: wrap; }
.memo-sources { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.source-chip { padding: 2px 7px; border-radius: 4px; background: rgba(255,255,255,.66); border: 1px solid var(--line); font-family: var(--font-num); font-size: 9.5px; letter-spacing: .02em; }
.confidence { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--muted); }
.conf-track { width: 92px; height: 4px; border-radius: 4px; background: var(--bg-deep); overflow: hidden; }
.conf-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--amber), var(--green)); }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.metric-cell { padding: 16px 18px; border-right: 1px solid var(--line); position: relative; min-width: 0; }
.metric-cell:last-child { border-right: 0; }
.metric-label { font-size: 10.5px; color: var(--muted); letter-spacing: .04em; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.metric-value { font-family: var(--font-num); font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; margin-top: 6px; color: var(--ink); font-variant-numeric: tabular-nums; }
.metric-value small { font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: 0; margin-left: 2px; }
.metric-sub { font-size: 10.8px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-cell.risk .metric-value { color: var(--red); }
.metric-cell.warn .metric-value { color: var(--amber); }
.metric-cell.good .metric-value { color: var(--green); }
.operating-metrics .metric-label, .operating-metrics .metric-sub { letter-spacing: 0; }
.operating-metrics .metric-sub { white-space: normal; }
.operating-metrics .metric-value { letter-spacing: 0; }

.focus-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.focus-card { position: relative; padding: 20px 20px 18px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.focus-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.focus-card.risk::before { background: var(--red); }
.focus-card.warn::before { background: var(--amber); }
.focus-card.good::before { background: var(--green); }
.focus-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; line-height: 1.7; border: 1px solid transparent; white-space: nowrap; }
.badge.risk { background: var(--red-soft); color: var(--red); border-color: rgba(166,59,47,.16); }
.badge.warn { background: var(--amber-soft); color: var(--amber); border-color: rgba(168,116,29,.18); }
.badge.good { background: var(--green-soft); color: var(--green); border-color: rgba(47,107,79,.16); }
.badge.info { background: var(--blue-soft); color: var(--blue); border-color: rgba(59,90,122,.14); }
.badge.muted { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
.badge.accent { background: var(--brand-soft); color: var(--brand-2); border-color: rgba(176,141,79,.2); }
.focus-entity { font-size: 11px; color: var(--muted); letter-spacing: .05em; }
.focus-title { font-family: var(--font-serif); font-size: 17px; line-height: 1.5; margin: 2px 0 8px; color: var(--ink); }
.focus-text { font-size: 12.3px; color: var(--ink-2); line-height: 1.75; margin: 0 0 12px; }
.focus-metrics { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.focus-metric { min-width: 54px; }
.focus-metric b { display: block; font-family: var(--font-num); font-size: 15px; font-weight: 600; }
.focus-metric span { font-size: 9.8px; color: var(--muted); }
.focus-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.evidence-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.evidence-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 9.8px; padding: 2px 6px; border-radius: 4px; background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); cursor: pointer; }
.evidence-chip:hover { border-color: var(--brand); color: var(--brand-2); }
.evidence-chip .ev-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted-2); }
.evidence-chip.has { background: var(--green-soft); color: var(--green); border-color: rgba(47,107,79,.14); }
.evidence-chip.has .ev-dot { background: var(--green); }

.table-wrap { overflow: auto; border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.2px; }
table.data th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 10.5px; letter-spacing: .04em;
  padding: 9px 10px; border-bottom: 1px solid var(--line-strong); background: var(--surface-2); white-space: nowrap;
}
table.data td { padding: 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .14s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.row-risk td:first-child { box-shadow: inset 2px 0 0 var(--red); }
table.data tbody tr.row-warn td:first-child { box-shadow: inset 2px 0 0 var(--amber); }
table.data .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
table.data .strong { font-weight: 600; color: var(--ink); }
table.data .muted { color: var(--muted); }
.table-company { font-weight: 600; color: var(--ink); white-space: nowrap; }
.table-company small { display: block; font-weight: 400; color: var(--muted); font-size: 9.8px; letter-spacing: .02em; }
.tag-list { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 9.6px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag.risk { background: var(--red-soft); color: var(--red); border-color: rgba(166,59,47,.13); }
.tag.warn { background: var(--amber-soft); color: var(--amber); border-color: rgba(168,116,29,.15); }
.tag.good { background: var(--green-soft); color: var(--green); border-color: rgba(47,107,79,.13); }

.sparkline { display: block; overflow: visible; }
.rate-text { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600; }
.rate-text.risk { color: var(--red); }
.rate-text.warn { color: var(--amber); }
.rate-text.good { color: var(--green); }

.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.section-gap { margin-top: 16px; }

.insight-list { display: flex; flex-direction: column; }
.insight-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.insight-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.insight-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--amber); }
.insight-dot.risk { background: var(--red); }
.insight-dot.good { background: var(--green); }
.insight-dot.info { background: var(--blue); }
.insight-main { min-width: 0; flex: 1; }
.insight-title { font-size: 12.6px; font-weight: 600; color: var(--ink); line-height: 1.5; }
.insight-desc { font-size: 11.5px; color: var(--muted); line-height: 1.7; margin-top: 3px; }
.insight-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: 10.5px; color: var(--muted-2); flex-wrap: wrap; }
.insight-meta a { color: var(--brand-2); }

.progress-row { display: flex; align-items: center; gap: 10px; margin: 9px 0; }
.progress-label { width: 92px; flex: none; font-size: 11px; color: var(--muted); }
.progress-track { flex: 1; height: 5px; background: var(--bg-deep); border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 5px; background: var(--brand); }
.progress-fill.risk { background: var(--red); }
.progress-fill.warn { background: var(--amber); }
.progress-fill.good { background: var(--green); }
.progress-value { width: 48px; text-align: right; font-family: var(--font-num); font-size: 11px; color: var(--ink-2); flex: none; }

.ask-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.ask-bar svg { width: 17px; height: 17px; color: var(--brand); flex: none; }
.ask-bar input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 13px; min-width: 0; }
.ask-bar input::placeholder { color: var(--muted-2); }
.ask-suggest { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.ask-chip { font-size: 11px; color: var(--muted); border: 1px solid var(--line); background: var(--surface); padding: 3px 9px; border-radius: 999px; cursor: pointer; }
.ask-chip:hover { border-color: var(--brand); color: var(--brand-2); }

.select-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 11px; font-size: 11.5px; color: var(--muted); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--deep); color: #f3ede1; }

.chart-card { padding: 18px 20px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.chart-legend { display: flex; gap: 12px; font-size: 10.5px; color: var(--muted); flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 14px; height: 3px; border-radius: 3px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-point { cursor: pointer; }
.chart-point:hover circle { stroke-width: 2.4; }
.chart-point:hover text { fill: var(--brand); }
.chart-svg text { font-family: var(--font-sans); }

.quadrant-wrap { position: relative; }
.quadrant-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 10.5px; color: var(--muted); }
.quadrant-note { font-size: 10.5px; color: var(--muted-2); margin-top: 4px; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(18,24,28,.42); backdrop-filter: blur(2px); z-index: 100; display: flex; justify-content: flex-end; animation: fadeIn .18s ease; }
.drawer { width: min(720px, 96vw); height: 100%; background: var(--surface); box-shadow: -30px 0 80px rgba(18,24,28,.2); display: flex; flex-direction: column; animation: slideIn .24s cubic-bezier(.22,.61,.36,1); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 20px 24px 40px; overflow-y: auto; }
.drawer-title { font-family: var(--font-serif); font-size: 21px; line-height: 1.4; margin: 3px 0 4px; }
.drawer-sub { font-size: 11.5px; color: var(--muted); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(36px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }

.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 500; color: var(--ink-2); text-align: right; }
.quote-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 12px; color: var(--ink-2); line-height: 1.8; white-space: pre-wrap; }
.attachment-list { display: flex; flex-direction: column; gap: 8px; }
.attachment { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12px; }
.attachment .file-type { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font-size: 9px; flex: none; }
.attachment a { color: var(--brand-2); margin-left: auto; font-size: 11px; }

.signal-table td .signal-level { display: inline-flex; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; }
.signal-level.high { background: var(--red); }
.signal-level.medium { background: var(--amber); }
.signal-level.low { background: var(--green); }
.signal-level.na { background: var(--muted-2); }

.cred-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
@media (max-width: 1280px) { .cred-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) { .cred-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cred-grid { grid-template-columns: 1fr; } }
.cred-card { display: flex; flex-direction: column; gap: 10px; }
.cred-top { display: flex; align-items: center; justify-content: space-between; }
.cred-grade { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-num); font-weight: 600; font-size: 17px; }
.cred-grade.A { background: var(--green-soft); color: var(--green); }
.cred-grade.B { background: var(--blue-soft); color: var(--blue); }
.cred-grade.C { background: var(--amber-soft); color: var(--amber); }
.cred-grade.D { background: var(--red-soft); color: var(--red); }
.cred-grade.na { background: var(--surface-3); color: var(--muted); }
.cred-score { font-family: var(--font-num); font-size: 19px; font-weight: 600; }
.cred-score small { font-size: 10px; color: var(--muted); font-weight: 400; }

.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.board-col { background: rgba(255,253,248,.55); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 160px; }
.board-col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 9px; font-size: 11.5px; color: var(--muted); }
.board-count { font-family: var(--font-num); font-size: 10px; background: var(--surface-3); border-radius: 999px; padding: 1px 7px; }
.issue-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; margin-bottom: 8px; cursor: pointer; transition: .16s; }
.issue-card:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow); }
.issue-title { font-size: 12.3px; font-weight: 600; line-height: 1.55; color: var(--ink); }
.issue-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 10.2px; color: var(--muted); flex-wrap: wrap; }
.issue-prio { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.issue-prio.中 { background: var(--amber); }
.issue-prio.低 { background: var(--muted-2); }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 5px; bottom: 5px; width: 1px; background: var(--line-strong); }
.timeline-item { position: relative; padding: 0 0 16px 4px; }
.timeline-item::before { content: ""; position: absolute; left: -19px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--brand); }
.timeline-item.auto::before { border-color: var(--muted-2); }
.timeline-at { font-size: 10px; color: var(--muted-2); font-family: var(--font-num); }
.timeline-text { font-size: 12.2px; color: var(--ink-2); line-height: 1.7; margin-top: 2px; }
.timeline-actor { font-size: 10.5px; color: var(--muted); margin-left: 6px; }

.chat-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.chat-card { display: flex; flex-direction: column; min-height: 640px; max-height: calc(100vh - 150px); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px 22px 10px; }
.chat-empty { padding: 36px 25px; text-align: center; }
.chat-empty .orb { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #ead8b0, #b08d4f); color: #fff; font-family: var(--font-serif); font-size: 20px; box-shadow: 0 0 0 8px rgba(176,141,79,.1); }
.chat-empty h3 { font-family: var(--font-serif); font-size: 21px; margin: 0 0 6px; }
.chat-empty p { color: var(--muted); font-size: 12.5px; margin: 0 auto; max-width: 430px; line-height: 1.8; }
.chat-suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 18px; text-align: left; }
.chat-suggest button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 12px; font-size: 11.8px; color: var(--ink-2); text-align: left; line-height: 1.5; }
.chat-suggest button:hover { border-color: var(--brand); color: var(--brand-2); }
.chat-user { display: flex; justify-content: flex-end; margin: 10px 0 14px; }
.chat-user .bubble { max-width: 78%; background: var(--deep); color: #f2ede2; padding: 10px 14px; border-radius: 12px 12px 3px 12px; font-size: 13px; line-height: 1.65; }
.chat-assistant { margin: 0 0 20px; }
.chat-answer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chat-answer-title { font-family: var(--font-serif); font-size: 18px; line-height: 1.55; color: var(--ink); }
.typing-dots { display: inline-flex; align-items: center; gap: 3px; margin-left: 2px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--brand); opacity: .3; animation: typingDot 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}
.agent-session-select { max-width: 250px; }
.session-list { display: flex; flex-direction: column; gap: 6px; max-height: 250px; overflow-y: auto; }
.session-entry { position: relative; }
.session-item { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 8px 48px 8px 10px; cursor: pointer; transition: .16s; }
.session-item:hover { border-color: var(--brand); }
.session-item.active { border-color: var(--brand); background: var(--brand-soft); }
.session-delete { position: absolute; right: 3px; bottom: 2px; width: 44px; height: 44px; display: grid; place-items: end center; padding: 0 0 7px; color: var(--muted); background: transparent; border: 0; border-radius: 6px; }
.session-delete:hover:not(:disabled), .session-delete:focus-visible { color: #973e36; background: #f7e7e2; }
.session-delete:disabled { opacity: .45; cursor: default; }
.session-title { display: block; font-size: 11.8px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-preview { display: block; margin-top: 3px; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-meta { display: block; margin-top: 3px; font-size: 9.8px; color: var(--muted-2); }
.memory-box { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; font-size: 11px; color: var(--muted); }
.memory-box summary { cursor: pointer; color: var(--brand-2); font-size: 11px; }
.memory-box p { margin: 8px 0 0; line-height: 1.8; color: var(--ink-2); white-space: pre-wrap; }
.chat-chat { padding: 2px 0 4px; }
.chat-chat-label { display: flex; align-items: center; gap: 7px; font-size: 10.5px; letter-spacing: .1em; color: var(--muted); }
.chat-chat-text { margin-top: 9px; font-family: var(--font-serif); font-size: 16px; line-height: 1.85; color: var(--ink); }
.chat-chat .chat-followups { margin-top: 10px; }
.chat-answer-body p { margin: 0 0 8px; font-size: 12.8px; line-height: 1.8; color: var(--ink-2); }
.chat-answer-body .fact-list { margin: 8px 0; padding-left: 0; list-style: none; }
.chat-answer-body .fact-list li { position: relative; padding-left: 13px; font-size: 12.2px; color: var(--ink-2); line-height: 1.8; }
.chat-answer-body .fact-list li::before { content: ""; position: absolute; left: 0; top: 8px; width: 4px; height: 4px; border-radius: 50%; background: var(--brand); }
.chat-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 12px 0; }
.chat-metric { background: var(--surface); padding: 9px 11px; }
.chat-metric span { display: block; font-size: 9.8px; color: var(--muted); }
.chat-metric b { font-family: var(--font-num); font-size: 15px; font-weight: 600; }
.chat-samples { display: flex; gap: 5px; flex-wrap: wrap; margin: 9px 0; }
.chat-section-label { font-size: 10px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; margin: 14px 0 6px; }
.chat-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chat-followups { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.chat-followups button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 3px 9px; font-size: 10.8px; color: var(--muted); }
.chat-followups button:hover { border-color: var(--brand); color: var(--brand-2); }
.chat-steps { margin: 10px 0 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.chat-steps summary { cursor: pointer; padding: 8px 12px; font-size: 11.2px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
.chat-steps summary::-webkit-details-marker { display: none; }
.chat-steps[open] summary { border-bottom: 1px solid var(--line); }
.steps-body { padding: 10px 12px 8px; }
.step { display: flex; gap: 10px; padding: 5px 0; font-size: 11.2px; }
.step-idx { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); color: var(--muted); font-family: var(--font-num); font-size: 9.5px; display: grid; place-items: center; flex: none; }
.step-main b { font-weight: 600; color: var(--ink-2); font-size: 11.5px; }
.step-main span { color: var(--muted); }
.step-api { font-family: var(--font-num); font-size: 9.2px; color: var(--brand-2); background: var(--brand-soft); padding: 1px 4px; border-radius: 3px; }
.chat-input { border-top: 1px solid var(--line); padding: 12px 14px 14px; background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.chat-input .ask-bar { box-shadow: none; }
.chat-side { position: sticky; top: 80px; }
.context-list { display: flex; flex-direction: column; gap: 8px; }
.context-row { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--muted); padding: 6px 0; border-bottom: 1px dashed var(--line); }
.context-row b { color: var(--ink-2); font-weight: 500; }
.limitation-list { margin: 0; padding-left: 15px; font-size: 11.2px; color: var(--muted); line-height: 1.8; }

.report-list { display: flex; flex-direction: column; }
.report-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.report-row:hover { background: var(--surface-2); }
.report-row:last-child { border-bottom: 0; }
.report-type { width: 40px; height: 40px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; font-size: 10.5px; letter-spacing: .04em; flex: none; }
.report-main { flex: 1; min-width: 0; }
.report-title { font-size: 13.2px; font-weight: 600; color: var(--ink); }
.report-meta { font-size: 10.8px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.report-status { font-size: 10.5px; }
.report-content { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px; align-items: start; }
.report-toc { position: sticky; top: 84px; border-left: 2px solid var(--line); padding-left: 14px; }
.report-toc a { display: block; font-size: 11.5px; color: var(--muted); padding: 5px 0; }
.report-toc a:hover { color: var(--brand-2); }
.report-body { max-width: 940px; }
.report-body h2 { font-family: var(--font-serif); font-size: 21px; margin: 30px 0 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.report-body h2:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.report-lead { font-family: var(--font-serif); font-size: 23px; line-height: 1.55; margin: 4px 0 14px; }
.report-summary { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; }
.report-summary p { margin: 0 0 8px; font-size: 12.8px; line-height: 1.85; color: var(--ink-2); }
.report-summary p:last-child { margin-bottom: 0; }
.report-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
.report-metric { background: var(--surface); padding: 12px 14px; }
.report-metric span { font-size: 10px; color: var(--muted); }
.report-metric b { display: block; font-family: var(--font-num); font-size: 19px; margin-top: 2px; }
.report-metric small { font-size: 10px; color: var(--muted); }
.section-block { margin: 26px 0; }
.section-block h3 { font-size: 15px; margin: 0 0 4px; }
.section-block .desc { font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.note-list { margin: 0; padding-left: 16px; font-size: 11.8px; color: var(--muted); line-height: 1.9; }
.action-list { counter-reset: act; list-style: none; padding: 0; margin: 0; }
.action-list li { counter-increment: act; position: relative; padding: 8px 0 8px 30px; border-bottom: 1px dashed var(--line); font-size: 12.2px; color: var(--ink-2); line-height: 1.75; }
.action-list li:last-child { border-bottom: 0; }
.action-list li::before { content: counter(act); position: absolute; left: 0; top: 9px; width: 19px; height: 19px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); font-family: var(--font-num); font-size: 9.5px; display: grid; place-items: center; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.settings-wide { grid-column: 1 / -1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin-top: 8px; }
.form-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.form-field > label { font-size: 10.5px; color: var(--muted); letter-spacing: .03em; }
.form-field input, .form-field select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface);
  padding: 8px 10px; font-size: 12px; outline: none; transition: border-color .16s;
}
.form-field input:focus, .form-field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(176,141,79,.12); }
.form-field.checkbox-field { justify-content: flex-end; }
.form-field.checkbox-field label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.form-field.checkbox-field input { width: auto; accent-color: var(--brand); }
.ai-note { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-2); font-size: 11px; line-height: 1.8; }
.settings-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.llm-test-result { font-size: 11px; color: var(--muted); }
.llm-test-result.ok { color: var(--green); }
.llm-test-result.error { color: var(--red); }
.ai-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 11px 14px; border: 1px solid var(--amber); background: var(--amber-soft); border-radius: 10px; color: var(--amber); font-size: 11.5px; line-height: 1.7; }
.ai-banner a { color: var(--brand-2); text-decoration: underline; white-space: nowrap; }
.engine-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.engine-chip.llm { background: var(--green-soft); border-color: rgba(47,107,79,.18); color: var(--green); }
.engine-chip.fallback { background: var(--amber-soft); border-color: rgba(168,116,29,.18); color: var(--amber); }
.ai-fallback-note { margin-top: 6px; font-size: 10.5px; color: var(--amber); line-height: 1.7; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.field-row:last-child { border-bottom: 0; }
.field-row label { color: var(--muted); }
.field-row input { width: 100px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 5px 8px; font-family: var(--font-num); font-size: 11.5px; background: var(--surface); text-align: right; }
.gap-item { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.gap-item:last-child { border-bottom: 0; }
.gap-title { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.gap-text { font-size: 11px; color: var(--muted); line-height: 1.7; margin-top: 2px; }
.audit-row { display: flex; gap: 10px; padding: 6px 0; font-size: 11px; color: var(--muted); border-bottom: 1px dashed var(--line); }
.audit-row time { font-family: var(--font-num); font-size: 9.8px; color: var(--muted-2); flex: none; }
.audit-row b { color: var(--ink-2); font-weight: 500; }

.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-state .icon { width: 38px; height: 38px; margin: 0 auto 10px; color: var(--line-strong); }
.empty-state h3 { font-family: var(--font-serif); font-size: 18px; color: var(--ink-2); margin: 0 0 4px; }
.empty-state p { margin: 0; font-size: 11.8px; }
.error-state { padding: 30px; border: 1px solid rgba(166,59,47,.2); background: var(--red-soft); border-radius: 10px; color: var(--red); font-size: 12.5px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-line { height: 12px; margin-bottom: 8px; }
.sk-block { height: 120px; }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--deep); color: #f1ece1; padding: 10px 14px; border-radius: 8px; font-size: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: toastIn .2s ease; max-width: 360px; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.brand-logo { overflow: hidden; background: #fff; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 7px; }
.sidebar-logout { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; font-size: 10.5px; color: #7f888d; }
.sidebar-logout:hover { color: #e8d5ad; }
.sidebar-logout svg { width: 13px; height: 13px; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--bg); }
.login-brand {
  position: relative; overflow: hidden; padding: 52px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 520px at -10% 0%, #253731 0%, transparent 58%),
    radial-gradient(700px 500px at 110% 110%, #2a2117 0%, transparent 55%),
    linear-gradient(180deg, #141b1f 0%, #0d1215 100%);
  color: #f2ede2;
}
.login-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .45;
  background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 100% 30px;
}
.login-brand-top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.login-logo { width: 58px; height: 58px; border-radius: 14px; background: #fff; padding: 4px; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.2); flex: none; }
.login-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; display: block; }
.login-brand-name { font-family: var(--font-serif); font-size: 26px; letter-spacing: .08em; color: #f4eee2; line-height: 1.2; }
.login-brand-sub { font-size: 10px; letter-spacing: .18em; color: #9aa2a7; margin-top: 4px; text-transform: uppercase; }
.login-brand-main { position: relative; z-index: 1; max-width: 520px; }
.login-eyebrow { font-size: 10px; letter-spacing: .2em; color: var(--brand); margin-bottom: 14px; }
.login-brand-main h1 { font-family: var(--font-serif); font-size: 38px; line-height: 1.42; font-weight: 600; margin: 0 0 16px; color: #f6f1e7; }
.login-brand-main p { color: #b8bfc3; font-size: 13.5px; line-height: 1.9; margin: 0 0 26px; max-width: 440px; }
.login-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.login-points li { display: grid; grid-template-columns: 32px 86px 1fr; gap: 10px; align-items: baseline; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.login-points b { font-family: var(--font-num); color: var(--brand); font-size: 11px; letter-spacing: .05em; }
.login-points span { font-size: 12.5px; color: #e8e2d6; }
.login-points em { font-style: normal; font-size: 11.5px; color: #8f989d; line-height: 1.7; }
.login-brand-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; color: #6f787d; letter-spacing: .05em; position: relative; z-index: 1; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 28px; background: var(--bg); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 34px 32px 28px; }
.login-card-head { margin-bottom: 22px; }
.login-card-head h2 { font-family: var(--font-serif); font-size: 26px; margin: 10px 0 6px; color: var(--ink); }
.login-card-head p { color: var(--muted); font-size: 12px; margin: 0; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 10.5px; color: var(--muted); margin-bottom: 6px; letter-spacing: .04em; }
.login-field input { width: 100%; height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); padding: 0 12px; font-size: 14px; outline: none; transition: border-color .18s, box-shadow .18s, background .18s; }
.login-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(176,141,79,.12); background: var(--surface); }
.login-password { position: relative; }
.login-password input { padding-right: 56px; }
.login-password button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--brand-2); font-size: 11px; padding: 6px 8px; }
.login-error { color: var(--red); font-size: 11.5px; line-height: 1.6; margin: 2px 0 12px; min-height: 18px; }
.login-error.hidden { visibility: hidden; }
.login-submit { width: 100%; height: 44px; font-size: 13.5px; margin-top: 2px; }
.login-note { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 10.5px; color: var(--muted-2); line-height: 1.8; }

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 24px 22px; min-height: auto; }
  .login-brand-main h1 { font-size: 26px; margin-bottom: 8px; }
  .login-brand-main p { display: none; }
  .login-points { display: none; }
  .login-brand-foot { display: none; }
  .login-panel { padding: 20px 16px 40px; align-items: flex-start; }
  .login-card { padding: 26px 22px; border-radius: 14px; }
  .login-brand-name { font-size: 22px; }
  .login-logo { width: 48px; height: 48px; }
}
@media (max-width: 640px) {
  .login-shell { min-height: 100dvh; }
  .login-brand { padding: 20px 18px 16px; }
  .login-brand-main { display: none; }
  .login-card-head h2 { font-size: 23px; }
  .login-field input { font-size: 16px; }
  .login-panel { padding-top: 16px; }
  .logout-btn { display: none; }
}

.mobile-nav-btn { display: none; }

.mobile-status, .mobile-tabbar, .sidebar-backdrop { display: none; }
.mobile-only { display: none !important; }
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(18,24,28,.42); backdrop-filter: blur(2px); z-index: 35;
}
.sidebar-backdrop.open { display: block; }
.m-card {
  display: block; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  padding: 13px 14px; margin-bottom: 9px; color: inherit; transition: border-color .16s, background .16s;
}
.m-card:last-child { margin-bottom: 0; }
.m-card:active { border-color: var(--brand); background: var(--brand-soft); }
.m-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.m-card-name { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.m-card-name small { font-weight: 400; font-size: 10px; color: var(--muted); white-space: nowrap; }
.m-card-rate-group { display: grid; justify-items: end; flex: none; }
.m-card-rate-group small { color: var(--muted); font-size: 10px; }
.m-card-rate-group .rate-text { font-size: 16px; }
.m-card-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 9px; }
.m-card-pending { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m-card-pending.with-won { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.m-card-metric span { display: block; font-size: 9px; color: var(--muted); }
.m-card-metric b { display: block; font-family: var(--font-num); font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 1px; }
.m-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); }
.m-card-foot .tag-list { gap: 4px; }
.m-card-foot .muted { font-size: 10px; color: var(--muted); }
.m-card-spark { flex: none; }
.m-list-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 10px; color: var(--muted); letter-spacing: .05em; }
.m-event { border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; margin-bottom: 8px; background: var(--surface); }
.m-event-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.m-event-name { font-size: 12.5px; font-weight: 600; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-event-text { font-size: 11.2px; color: var(--muted); line-height: 1.7; margin-top: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-event-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 9.8px; color: var(--muted-2); flex-wrap: wrap; }

@media (max-width: 1280px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-cell:nth-child(3n) { border-right: 0; }
  .metric-cell:nth-child(n+4) { border-top: 1px solid var(--line); }
  .focus-grid { grid-template-columns: 1fr; }
  .grid-12 > .col-3, .grid-12 > .col-4, .grid-12 > .col-5 { grid-column: span 6; }
  .grid-12 > .col-7, .grid-12 > .col-8, .grid-12 > .col-9 { grid-column: span 12; }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 258px; transform: translateX(-104%); transition: transform .24s ease; z-index: 40; box-shadow: 24px 0 60px rgba(18,24,28,.24); }
  .sidebar.open { transform: translateX(0); }
  .mobile-nav-btn { display: grid; }
  .topbar { padding: 10px 16px; min-height: 58px; gap: 10px; }
  .crumbs { min-width: 0; font-size: 12.5px; }
  .crumbs > span:first-child, .crumbs .sep { display: none; }
  #crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-right { gap: 8px; flex-wrap: nowrap; }
  .topbar .scope-select, .topbar .snapshot-pill, .topbar .avatar { display: none; }
  .mobile-status {
    display: flex; align-items: center; gap: 8px; padding: 6px 16px; border-bottom: 1px solid var(--line);
    background: var(--surface-2); font-size: 10.5px; color: var(--muted); position: sticky; top: 58px; z-index: 29;
  }
  .mobile-status.warn { background: var(--red-soft); color: var(--red); border-bottom-color: rgba(166,59,47,.15); }
  .mobile-status.warn .pulse { background: var(--red); box-shadow: 0 0 0 3px rgba(166,59,47,.12); }
  .mobile-status #mobile-status-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-ai { flex: none; font-size: 9px; padding: 1px 5px; border-radius: 999px; background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); }
  .mobile-ai.online { background: var(--green-soft); color: var(--green); border-color: rgba(47,107,79,.16); }
  .mobile-scope { height: 24px; border: 0; background-color: transparent; font-size: 10.5px; padding: 0 20px 0 6px; color: var(--ink-2); flex: none; background-position: right 4px center; }
  .mobile-tabbar {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: rgba(255,253,248,.97); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 28px rgba(23,27,31,.07);
  }
  .mobile-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0 3px; color: var(--muted); font-size: 9.5px; border-radius: 8px; min-height: 44px; justify-content: center; }
  .mobile-tab svg { width: 20px; height: 20px; }
  .mobile-tab.active { color: var(--brand-2); background: var(--brand-soft); }
  .content { padding: 18px 16px calc(94px + env(safe-area-inset-bottom)); }
  .split { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .chat-side { position: static; }
  .chat-card { min-height: 560px; max-height: calc(100vh - 210px); }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-content { grid-template-columns: 1fr; }
  .report-toc { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 26px; }
}

.customer-mode .period-select, .customer-mode .scope-select { display: none; }
.customer-timestamp { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; flex-wrap: wrap; }
.customer-timestamp.customer-stale { color: var(--amber); }
.customer-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.customer-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 9px 5px 10px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; }
.customer-tabs a[aria-current] { border-color: var(--brand); color: var(--ink); font-weight: 600; }
.customer-tabs a:hover, .customer-tabs a:focus-visible { color: var(--brand-2); }
.customer-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); border-radius: 8px; overflow: hidden; }
.customer-metric { min-width: 0; padding: 12px 16px; border-right: 1px solid var(--line); }
.customer-metric:last-child { border-right: 0; }
.customer-metric:hover, .customer-metric:focus-visible { background: var(--surface-2); }
.customer-metric > span { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 12px; color: var(--muted); }
.customer-metric strong { display: block; font-family: var(--font-num); font-size: 24px; font-weight: 650; color: var(--ink); }
.customer-metric small { display: block; font-size: 11px; color: var(--muted); }
.customer-high a, .customer-high strong { color: var(--green); }
.customer-section { margin: 18px 0; padding: 14px 0 0; border-top: 1px solid var(--line); min-width: 0; }
.customer-section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; margin-bottom: 12px; }
.customer-section-head h2 { font-size: 15px; font-weight: 650; margin: 0; }
.customer-section-head > span, .customer-count, .customer-muted, .customer-footnote { color: var(--muted); font-size: 11px; }
.customer-count { margin-left: 5px; font-weight: 500; }
.customer-muted { display: block; font-weight: 400; }
.customer-distribution { display: flex; height: 10px; border-radius: 4px; overflow: hidden; background: var(--surface-3); }
.customer-distribution .high, .customer-legend .high { background: var(--green); }
.customer-distribution .middle, .customer-legend .middle { background: var(--blue); }
.customer-distribution .low, .customer-legend .low { background: var(--brand); }
.customer-distribution .other, .customer-legend .other { background: var(--line-strong); }
.customer-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 9px; font-size: 11px; color: var(--muted); }
.customer-legend span { display: inline-flex; align-items: center; gap: 5px; }
.customer-legend i { width: 7px; height: 7px; border-radius: 2px; }
.customer-legend b { color: var(--ink-2); }
.customer-overview-table table { min-width: 525px; }
.customer-overview-table th a { display: inline-flex; align-items: center; gap: 3px; }
.customer-list-table table { min-width: 580px; }
.customer-name-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); text-align: left; font-weight: 600; overflow-wrap: anywhere; max-width: 100%; }
button.customer-name-link { border: 0; padding: 0; background: transparent; font: inherit; font-weight: 600; cursor: pointer; }
.customer-name-link svg { flex: none; color: var(--muted); }
.customer-name-link:hover, .customer-cell-link:hover, .customer-overview-table th a:hover { color: var(--brand-2); text-decoration: underline; }
.pending-visit-link { display: inline-flex; gap: 3px; align-items: center; color: var(--brand-2); }
.pending-visit-link:hover { text-decoration: underline; }
.m-card-pending .pending-visit-link { min-height: 24px; }
.pending-unavailable { font-family: var(--font-sans); font-weight: 400; }
.customer-filters { display: grid; grid-template-columns: repeat(5, minmax(92px, 1fr)); align-items: end; gap: 10px 12px; }
.customer-filters label, .customer-pager label { display: grid; gap: 4px; font-size: 11px; color: var(--muted); }
.customer-filters input, .customer-filters select, .customer-pager input { min-width: 0; width: 100%; height: 36px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 8px; color: var(--ink); background: var(--surface); font: inherit; font-size: 12px; }
.customer-keyword { grid-column: span 2; }
.customer-filter-actions, .customer-pager { display: flex; gap: 7px; align-items: center; }
.customer-results { scroll-margin-top: 135px; }
.customer-pager { margin-top: 12px; justify-content: flex-end; flex-wrap: wrap; }
.customer-pager label { display: flex; align-items: center; }
.customer-pager input { width: 60px; height: 30px; text-align: center; }
.customer-pager .btn[aria-label] { min-width: 35px; justify-content: center; padding-inline: 5px; }
.customer-pager .btn[aria-label="上一页"] svg { transform: rotate(180deg); }
[data-customer-drawer] .drawer-head > div { min-width: 0; }
[data-customer-drawer] .drawer-title, .customer-profile-fields b { overflow-wrap: anywhere; }
[data-customer-drawer] [data-close-drawer] { flex: none; }
.customer-profile-history { margin-top: 20px; }
.customer-visit-timeline .timeline-item { padding-bottom: 10px; }
.customer-visit-timeline .timeline-item::before { top: 16px; }
.customer-visit { border: 1px solid var(--line); border-radius: 8px; }
.customer-visit-summary { display: grid; grid-template-columns: minmax(96px, auto) auto minmax(0, 1fr) 16px; gap: 8px; align-items: center; padding: 9px 10px; cursor: pointer; list-style: none; }
.customer-visit-summary::-webkit-details-marker { display: none; }
.customer-visit-summary::marker { content: ''; }
.customer-visit-summary:hover, .customer-visit-summary:focus-visible { background: var(--surface-2); }
.customer-visit-summary:focus-visible { outline-offset: -2px; }
.customer-visit-date { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.customer-visit-date time { font: 12px var(--font-num); color: var(--ink-2); }
.customer-visit-date .card-desc { margin: 0; }
.customer-visit-count { text-align: right; }
.customer-visit-chevron { color: var(--muted); display: inline-flex; }
.customer-visit[open] .customer-visit-chevron { transform: rotate(90deg); }
.customer-visit-body { padding: 0 10px 11px; }
.customer-visit-fields { display: grid; gap: 10px; margin: 0; white-space: normal; }
.customer-visit-fields dt { color: var(--muted); font-weight: 500; }
.customer-visit-fields dd { margin: 1px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.customer-visit-files h3 { font-weight: 500; }
.customer-visit-files .attachment-list:not(:first-child) { margin-top: 6px; }
.customer-visit-files .attachment a { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.customer-file-name { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .customer-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-metric { padding: 9px 12px; }
  .customer-metric strong { font-size: 21px; }
  .customer-metric:nth-child(2) { border-right: 0; }
  .customer-metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .customer-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-filters input, .customer-filters select { font-size: 16px; }
  .customer-filter-actions { grid-column: span 2; }
  .customer-list-table table { min-width: 0; display: block; }
  .customer-list-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .customer-list-table tbody { display: grid; gap: 4px; }
  .customer-list-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .customer-list-table td { border: 0; padding: 1px 5px; min-width: 0; overflow-wrap: anywhere; }
  .customer-list-table td:nth-child(2) { grid-row: 2; }
  .customer-list-table td:nth-child(3) { grid-row: 1; grid-column: 2; }
  .customer-list-table td:nth-child(5) { grid-column: 1 / -1; }
  .customer-profile-fields { gap: 0 12px; }
  .customer-visit-summary { gap: 6px; min-height: 44px; padding: 7px; grid-template-columns: minmax(80px, auto) auto minmax(0, 1fr) 16px; }
  .customer-visit-body { padding: 0 7px 8px; }
}
@media (max-width: 640px) {
  body { -webkit-text-size-adjust: 100%; }
  .topbar { padding: 8px 12px; min-height: 54px; }
  .period-select { width: 88px; height: 32px; padding-left: 9px; padding-right: 24px; font-size: 11.5px; background-position: right 8px center; }
  .icon-btn { width: 34px; height: 34px; }
  .mobile-status { top: 54px; padding: 5px 12px; font-size: 10px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-head-actions { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .page-head-actions .btn { flex: none; }
  .page-title { font-size: 23px; line-height: 1.42; }
  .page-sub { font-size: 11.5px; }
  .content { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); }
  .card-pad { padding: 15px 16px; }
  .memo { padding: 18px 16px 16px 20px; }
  .memo-headline { font-size: 20px; }
  .memo-body p { font-size: 13px; line-height: 1.8; }
  .memo-top { flex-wrap: wrap; gap: 8px; }
  .memo-label { font-size: 10px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-cell { padding: 13px 14px; }
  .metric-cell:nth-child(odd) { border-right: 1px solid var(--line); }
  .metric-cell:nth-child(2n) { border-right: 0; }
  .metric-cell:nth-child(n+3) { border-top: 1px solid var(--line); }
  .metric-value { font-size: 22px; }
  .focus-grid { grid-template-columns: 1fr; }
  .focus-card { padding: 17px 16px 15px 19px; }
  .focus-title { font-size: 16px; }
  .focus-foot { flex-wrap: wrap; }
  .board { grid-template-columns: 1fr; }
  .grid-12 > [class*="col-"] { grid-column: span 12; }
  .chat-suggest { grid-template-columns: 1fr; }
  .chat-card { height: calc(100vh - 300px); height: calc(100dvh - 300px); min-height: 380px; max-height: none; }
  .chat-scroll { padding: 16px 14px 84px; }
  .chat-input { position: sticky; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 12; border-radius: 0 0 12px 12px; box-shadow: 0 -8px 18px rgba(23,27,31,.05); }
  .chat-suggest button:nth-child(n+4) { display: none; }
  .chat-empty { padding: 20px 12px; }
  .chat-empty .orb { width: 44px; height: 44px; margin-bottom: 10px; }
  .chat-empty h3 { font-size: 18px; }
  .chat-empty p { font-size: 11.5px; }
  .chat-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-session-select { max-width: 170px; }
  .chat-answer-title { font-size: 16px; }
  .chat-answer-head { flex-wrap: wrap; }
  .chat-input { padding: 10px 10px 12px; }
  .chat-input .ask-bar input { font-size: 16px; }
  .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
  .report-content, .report-body, .report-summary, .section-block { min-width: 0; }
  .report-summary { padding: 14px; }
  .report-summary p { font-size: 12px; line-height: 1.8; }
  .report-body h2 { font-size: 19px; }
  .report-lead { font-size: 19px; }
  .table-wrap { max-width: 100%; }
  .drawer-backdrop { align-items: flex-end; }
  .drawer { width: 100%; height: 92vh; border-radius: 16px 16px 0 0; animation: slideUp .26s cubic-bezier(.22,.61,.36,1); }
  .drawer-head { padding: 16px 16px 12px; position: relative; }
  .drawer-body { padding: 16px 16px 32px; }
  .drawer-head::before { content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 34px; height: 3px; border-radius: 3px; background: var(--line-strong); }
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field input, .form-field select, .ask-bar input { font-size: 16px; }
  .table-wrap { margin: 0 -2px; }
  .section-gap { margin-top: 12px; }
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
@media print {
  .sidebar, .topbar, .page-head-actions, .report-toc { display: none !important; }
  .app-shell { grid-template-columns: 1fr; }
  .content { padding: 0; }
  .card, .report-summary { box-shadow: none; }
}

/* Preserve the reader's position while only the active turn is updated. */
.chat-scroll { min-height: 0; overflow-anchor: none; overscroll-behavior-y: contain; }
.chat-input { position: relative; flex: none; }
.chat-jump { position: absolute; bottom: calc(100% + 8px); right: 14px; z-index: 2; box-shadow: 0 2px 9px #2222; }
.chat-jump[hidden] { display: none; }
.chat-user .bubble, .agent-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-live, .agent-section, .visit-field { border-radius: 8px; padding: 9px 11px; }
.chat-live { background: var(--surface-2); border: 1px solid var(--line); margin: 8px 0 12px; }
.chat-live-label { color: var(--ink); font-size: 12.8px; font-weight: 600; }
.chat-live-error .chat-live-label { color: #8a462d; }
.chat-live-steps, .agent-sources { list-style: none; margin: 4px 0 0; padding: 0; }
.chat-live-steps.saved, .agent-sources { padding: 4px 11px 8px; }
.chat-live-steps li, .agent-sources li { border-left: 2px solid var(--line-strong); margin-top: 6px; padding: 0 0 0 8px; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.chat-live-steps .warn { border-color: #b4803f; }
.chat-live-steps span, .agent-sources span { display: block; color: var(--muted); }
.agent-section { margin-top: 8px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; line-height: 1.75; }
.agent-section > b { display: block; margin-bottom: 3px; font-size: 11.5px; }
.agent-section.fact, .visit-field.need { background: #edf4f8; color: #244960; }
.agent-section.action, .visit-field.plan { background: #edf5ef; color: #28563b; }
.agent-section.limit, .visit-field.reason { background: #faf2e4; color: #704c21; }
.agent-section.text { padding: 0; background: transparent; }
.visit-fields { display: grid; gap: 7px; margin: 8px 0; }
.visit-field { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.visit-field dt { font-size: 11.5px; font-weight: 700; margin: 0 0 3px; }
.visit-field dd { margin: 0; font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.visit-field.reason dd, .visit-field.need dd, .visit-field.plan dd { font-weight: 600; }

/* AI messages use the same body font as the rest of the workspace. */
.chat-card { font-family: var(--font-sans); }
.chat-user .bubble { background: var(--surface-3); border: 1px solid var(--line); color: var(--ink); font: 400 14px/1.75 var(--font-sans); padding: 9px 14px; }
.chat-card .chat-answer-title, .chat-card .chat-chat-text { font: 500 15px/1.8 var(--font-sans); }
.chat-card .agent-text strong { font-weight: 650; }
.agent-section { font-size: 14px; line-height: 1.8; }
.agent-section.fact { background: var(--surface-2); color: var(--ink-2); border-left: 2px solid var(--line-strong); }
.agent-section.action { background: var(--green-soft); color: var(--green); }
.agent-section.limit { background: var(--amber-soft); color: #745019; }

/* One expandable entry per tool invocation, shared by live and saved turns. */
.trace-record { margin: 12px 0 6px; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm); }
.trace-record > summary, .trace-summary { cursor: pointer; list-style: none; }
.trace-record > summary::-webkit-details-marker, .trace-summary::-webkit-details-marker { display: none; }
.trace-record > summary { display: flex; gap: 8px; align-items: center; padding: 8px 10px; min-height: 38px; color: var(--ink-2); font-size: 12px; }
.trace-record > summary > span { color: var(--muted); font-size: 11px; flex: 1; }
.trace-summary > svg:last-child, .trace-record > summary > svg:last-child { flex: none; color: var(--muted); }
.trace-record[open] > summary > svg:last-child, .trace-call[open] > summary > svg:last-child { transform: rotate(90deg); }
.trace-list { display: grid; gap: 5px; min-width: 0; }
.trace-record > .trace-list { padding: 0 8px 8px; }
.chat-live-trace:not(:empty) { margin-top: 8px; }
.trace-call { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.trace-summary { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 14px; gap: 7px; align-items: center; padding: 7px 8px; min-height: 43px; }
.trace-icon { border-radius: 5px; display: grid; place-items: center; height: 23px; color: var(--brand-2); background: var(--brand-soft); }
.trace-main { min-width: 0; font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.trace-main b { color: var(--ink-2); font-weight: 600; }
.trace-main > span, .trace-state > span:not(.trace-pill) { display: block; font-size: 11px; color: var(--muted); }
.trace-state { font-size: 11px; color: var(--muted); text-align: right; line-height: 1.55; }
.trace-pill { display: inline-block; padding: 1px 6px; border-radius: 4px; background: var(--brand-soft); color: var(--brand-2); }
.trace-pill.ok { background: var(--green-soft); color: var(--green); }
.trace-pill.warn { background: var(--amber-soft); color: #745019; }
.trace-body { border-top: 1px solid var(--line); padding: 9px 10px 10px; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.trace-caption { color: var(--brand-2); font-weight: 650; margin: 8px 0 4px; }
.trace-caption:first-child { margin-top: 0; }
.trace-via { margin: 0 0 4px; color: var(--ink-2); }
.trace-pairs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr)); gap: 4px; margin: 0 0 7px; }
.trace-pairs > div { padding: 4px 6px; border-radius: 4px; background: var(--surface-2); }
.trace-pairs dt { color: var(--muted); font-size: 11px; }
.trace-pairs dd { margin: 0; color: var(--ink); }
.trace-missing { color: var(--muted); }
.trace-pairs .trace-cited, .trace-table .trace-cited { background: var(--brand-soft); }
.trace-cited small { display: inline-block; margin-left: 4px; color: var(--brand-2); font-size: 10px; }
.trace-note { color: var(--ink-2); margin: 4px 0; }
.trace-comparison { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 8px; }
.trace-table-wrap { max-width: 100%; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 5px; }
.trace-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.trace-table th, .trace-table td { white-space: nowrap; padding: 5px 7px; text-align: left; border-bottom: 1px solid var(--line); }
.trace-table th { position: sticky; top: 0; color: var(--ink-2); background: var(--surface-3); }
.trace-audit-list { margin: 0; padding-left: 18px; }
.trace-audit-list li + li { margin-top: 5px; }
.trace-audit-list span { display: block; color: var(--muted); }
.trace-audit-list .warn b { color: #745019; }

/* A turn reads like an activity stream, with inspection one click from each query. */
.chat-live { background: transparent; border: 0; border-left: 2px solid var(--line-strong); border-radius: 0; padding: 3px 0 4px 12px; }
.chat-live-label { color: var(--muted); font-weight: 500; }
.trace-record { min-width: 0; margin: 7px 0 15px; background: transparent; border: 0; }
.trace-record > summary { width: fit-content; max-width: 100%; flex-wrap: wrap; padding: 5px 1px; min-height: 31px; color: var(--muted); }
.trace-record > summary > span { flex: none; }
.trace-record > .trace-list { border-left: 2px solid var(--line-strong); margin-left: 7px; padding: 2px 0 1px 12px; }
.trace-list { gap: 8px; }
.trace-message { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.trace-message svg { flex: none; margin-top: 2px; color: var(--muted); }
.trace-message b { color: var(--ink-2); margin-right: 6px; }
.trace-message span { color: var(--muted); }
.trace-operation { min-width: 0; }
.trace-purpose { color: var(--ink-2); font-size: 12.5px; line-height: 1.65; margin: 0 0 4px; }
.trace-tool { background: var(--surface-2); }
.trace-tool .trace-body { background: var(--surface); }
.trace-main .trace-finding { color: var(--ink-2); font-size: 12px; overflow-wrap: anywhere; }
.trace-audit { border-color: transparent; background: transparent; }
.trace-audit .trace-summary { min-height: 35px; padding-block: 4px; }
.chat-card .agent-reply.analysis .chat-answer-title { font-weight: 650; font-size: 16px; line-height: 1.65; }
.agent-reply .agent-section.fact, .agent-reply .agent-section.judgment, .agent-reply .agent-section.text { border: 0; background: transparent; padding: 0; }
.agent-reply .agent-section.action { margin-top: 11px; border-left: 2px solid var(--green); }
.agent-reply .agent-section.limit { background: transparent; padding: 0; color: var(--muted); font-size: 12px; }
.agent-reply .agent-section.limit > b { display: inline; padding-right: 6px; color: var(--ink-2); }
.agent-reply .agent-section.limit .agent-text { display: inline; }

/* CEO operating assessment shares workspace typography and trace controls. */
.operating-brief { min-width: 0; font-family: var(--font-sans); }
.operating-brief .memo-top { position: relative; z-index: 1; flex-wrap: wrap; }
.brief-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 11px; }
.brief-controls .btn[hidden] { display: none; }
.brief-scope { color: var(--muted); font-size: 11.5px; }
.brief-priority { font: 650 clamp(17px, 2vw, 21px)/1.5 var(--font-sans); margin: 0 0 6px; overflow-wrap: anywhere; }
.brief-why, .brief-status, .brief-contrast { margin: 0 0 10px; font-size: 13px; line-height: 1.75; color: var(--ink-2); overflow-wrap: anywhere; }
.brief-status { color: var(--muted); }
.brief-status:last-child { margin-bottom: 0; }
.brief-contrast { display: flex; flex-wrap: wrap; gap: 0 8px; padding: 8px 11px; border-radius: var(--radius-sm); background: var(--surface-3); }
.brief-contrast strong { color: var(--brand-2); }
.brief-contrast > span { flex: 1 1 220px; }
.brief-companies { margin-top: 14px; }
.brief-companies h3 { font: 650 13px/1.5 var(--font-sans); margin: 0 0 7px; }
.brief-company-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 236px), 1fr)); gap: 8px; }
.brief-company { min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.brief-company > div { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; margin-bottom: 4px; }
.brief-company h4 { margin: 0; font: 650 13px/1.5 var(--font-sans); }
.brief-company p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--ink-2); overflow-wrap: anywhere; }
.brief-tag { padding: 1px 6px; border-radius: 4px; font-size: 10.5px; color: var(--muted); background: var(--surface-3); }
.brief-tag.positive { color: var(--green); background: var(--green-soft); }
.brief-tag.watch { color: #745019; background: var(--amber-soft); }
.brief-action { display: grid; grid-template-columns: minmax(105px, .55fr) minmax(0, 1.45fr) minmax(0, 1.25fr); gap: 14px; margin-top: 13px; padding: 12px 14px; border: 1px solid var(--line); border-left: 2px solid var(--brand); border-radius: var(--radius-sm); background: var(--surface); }
.brief-action span { display: block; font-size: 11px; font-weight: 650; color: var(--brand-2); margin-bottom: 3px; }
.brief-action p, .brief-action strong { color: var(--ink-2); margin: 0; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.brief-boundary, .brief-basis { color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.brief-boundary { display: flex; align-items: flex-start; gap: 5px; margin: 10px 0 0; }
.brief-boundary svg { flex: none; margin-top: 2px; }
.brief-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 0 0 7px; }
.brief-newer { color: var(--brand-2); }
.brief-trace, [data-brief-live] { min-width: 0; margin-top: 10px; border-top: 1px solid var(--line); }
.operating-brief .trace-record { margin-bottom: 0; }
.operating-brief [data-brief-live]:not([hidden]) { margin-bottom: 12px; }
.operating-brief [data-brief-live-trace] { min-width: 0; }
.brief-signal-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin-bottom: 6px; color: var(--ink-2); font-size: 12px; font-weight: 650; }
.brief-signal-label span { color: var(--muted); font-size: 11px; font-weight: 400; }
@media (max-width: 700px) { .brief-action { grid-template-columns: minmax(0, 1fr); gap: 9px; } }

/* The destructive confirmation uses the same surface, type and buttons as the workbench. */
.session-delete-dialog { width: min(420px, calc(100% - 28px)); max-width: none; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; box-shadow: 0 18px 68px #12181c40; }
.session-delete-dialog::backdrop { background: #12181c75; }
.delete-dialog-heading { display: flex; align-items: center; gap: 10px; }
.delete-dialog-heading h2 { flex: 1; font: 650 17px/1.4 var(--font-sans); margin: 0; }
.delete-dialog-icon { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--red); background: var(--red-soft); }
.delete-dialog-close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; }
.delete-dialog-close:hover { background: var(--surface-3); color: var(--ink); }
#delete-session-desc { margin-top: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
#delete-session-desc p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.delete-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 19px; }
.delete-dialog-actions .btn { min-height: 40px; }
.btn.danger { background: var(--red); color: #fffdf8; border-color: var(--red); }
.btn.danger:hover { background: #892e25; border-color: #892e25; }
.session-delete-dialog :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 600px) { .session-delete-dialog { padding: 17px; } .delete-dialog-actions .btn { min-height: 44px; } }

/* Thread boundary and per-record review use the workspace's own type and surfaces. */
.agent-thread-label { display:flex; align-items:center; gap:7px; padding:9px 14px; color:var(--muted); font-size:12px; border-bottom:1px solid var(--line); }
.agent-thread-label svg { flex:none; }
.agent-thread-label span { min-width:0; overflow-wrap:anywhere; }
.agent-visit-review { display:grid; gap:8px; min-width:0; margin:14px 0 4px; }
.agent-review-head h3 { font:650 14px/1.5 var(--font-sans); margin:0; }
.agent-review-head p { color:var(--muted); font-size:12px; line-height:1.55; margin:3px 0 0; }
.agent-review-row { min-width:0; padding:10px 12px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface-2); overflow-wrap:anywhere; }
.agent-review-row-head, .agent-review-foot { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:6px 12px; }
.agent-review-row h4 { margin:0; font:650 13px/1.5 var(--font-sans); }
.agent-review-row h4 small { font-weight:400; color:var(--muted); }
.agent-review-analysis { margin:5px 0; font-size:13px; line-height:1.65; }
.agent-review-excerpt summary { cursor:pointer; font-size:12px; color:var(--brand-2); width:fit-content; }
.agent-review-foot { margin-top:7px; color:var(--muted); font-size:11.5px; }
.agent-progress { min-width: 0; margin-top: 16px; }
.agent-progress h3 { margin: 14px 0 4px; font: 650 14px/1.5 var(--font-sans); }
.agent-progress h4 { margin: 0 0 4px; font: 650 13px/1.5 var(--font-sans); overflow-wrap: anywhere; }
.agent-progress-group { padding: 9px 0; border-top: 1px solid var(--line); }
.agent-progress-group.advanced { margin: 6px 0; padding: 10px 12px; border: 0; border-left: 2px solid var(--green); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); }
.agent-progress-summary, .agent-progress-next { margin: 4px 0; font-size: 13px; line-height: 1.75; }
.agent-progress-summary { color: var(--ink-2); }
.agent-progress-next { color: var(--muted); }
.agent-progress-next.agreed { color: var(--green); }
.agent-progress-record + .agent-progress-record { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.agent-progress-quote { margin:5px 0; padding-left:8px; border-left:2px solid var(--line); color:var(--ink-2); }
.agent-progress-coverage { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 6px; }
.agent-progress-coverage p { color: var(--muted); font-size: 12px; line-height: 1.65; margin: 6px 0; }
.brief-audit { min-width: 0; border-top: 1px solid var(--line); margin-top: 12px; }
.brief-audit > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; padding: 9px 0 0; cursor: pointer; list-style: none; font-size: 12px; }
.brief-audit > summary::-webkit-details-marker { display: none; }
.brief-audit > summary span, .brief-audit-note { color: var(--muted); font-size: 11.5px; line-height: 1.65; }
.brief-audit > summary svg { flex: none; }
.brief-audit > summary svg:last-child { margin-left: auto; }
.brief-audit[open] > summary svg:last-child { transform: rotate(90deg); }
.brief-audit-body { margin-top: 8px; }
.brief-audit-batch { border-top: 1px solid var(--line); padding: 6px 0; min-width: 0; }
.brief-audit-batch > summary { cursor: pointer; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.brief-audit-batch > summary > span { margin-left: 8px; color: var(--muted); }
.brief-audit-row { border-left: 2px solid var(--line); padding: 6px 9px; margin: 8px 0; min-width: 0; overflow-wrap: anywhere; }
.brief-audit-row-head, .brief-audit-followups li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; }
.brief-audit-row time, .brief-audit-followups span { color: var(--muted); }
.brief-audit-row p, .brief-audit-row blockquote { margin: 5px 0; font-size: 12px; line-height: 1.65; }
.brief-audit-row blockquote { color: var(--ink-2); padding-left: 8px; border-left: 2px solid var(--brand); }
.brief-audit-row .btn { margin-top: 6px; }
.brief-audit-followups { margin: 5px 0 10px; padding: 0; }
.brief-audit-followups li { border-top: 1px solid var(--line); padding: 5px 0; }
