/* ============ tokens ============ */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  --sidebar-w: 276px;
  --thread-w: 800px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="light"] {
  --bg: #f6f5f1;
  --bg-2: #efede7;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --surface-3: #f2f0ea;
  --ink: #16181d;
  --ink-2: #3a3f48;
  --ink-3: #7b808a;
  --ink-4: #a5a9b0;
  --line: #e2dfd7;
  --line-2: #ebe8e1;
  --grid: #e6e3dc;
  --accent: #c8102e;
  --accent-ink: #a00c24;
  --accent-soft: rgba(200, 16, 46, .07);
  --accent-soft-2: rgba(200, 16, 46, .13);
  --gold: #b8893a;
  --gold-soft: rgba(184, 137, 58, .12);
  --c1: #c8102e;
  --c2: #2f4a6d;
  --c3: #b8893a;
  --c4: #3f7f6e;
  --c5: #7a4e8c;
  --c6: #8c8f96;
  --shadow-1: 0 1px 2px rgba(22, 24, 29, .04), 0 1px 1px rgba(22, 24, 29, .03);
  --shadow-2: 0 12px 32px -12px rgba(22, 24, 29, .18), 0 2px 6px rgba(22, 24, 29, .05);
  --shadow-3: 0 24px 64px -16px rgba(22, 24, 29, .28);
  --paper-dot: rgba(22, 24, 29, .055);
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --bg-2: #0a0d11;
  --surface: #151a21;
  --surface-2: #181e26;
  --surface-3: #1e252e;
  --ink: #ebe8e2;
  --ink-2: #c4c7cd;
  --ink-3: #878d97;
  --ink-4: #5c626c;
  --line: #262d37;
  --line-2: #1f252e;
  --grid: #232a33;
  --accent: #e8423f;
  --accent-ink: #f47a6e;
  --accent-soft: rgba(232, 66, 63, .10);
  --accent-soft-2: rgba(232, 66, 63, .18);
  --gold: #d9b25f;
  --gold-soft: rgba(217, 178, 95, .14);
  --c1: #e8423f;
  --c2: #7fa3cc;
  --c3: #d9b25f;
  --c4: #5fae98;
  --c5: #a685c2;
  --c6: #8c929c;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-3: 0 24px 64px -16px rgba(0, 0, 0, .7);
  --paper-dot: rgba(255, 255, 255, .045);
}

/* Change colours follow the mainland reading: red = up, green = down. */
:root { --up: #c8102e; --down: #1f8a5b; }
:root[data-theme="dark"] { --up: #ef5a52; --down: #45b584; }

/* Han characters take the regional glyph forms of the UI language */
:root[data-lang="zh-HK"] {
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang HK", "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK HK", "Noto Sans HK", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Songti TC", "Noto Serif CJK HK", "Noto Serif HK", "Source Han Serif HC", "PMingLiU", Georgia, "Times New Roman", serif;
}
:root[data-lang="ja"] {
  --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Noto Sans CJK JP", "Noto Sans JP", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", "Noto Serif JP", "Source Han Serif", Georgia, "Times New Roman", serif;
}

/* ============ base ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 1;
  opacity: 0;
  transition: opacity .25s ease;
}
body.ready { opacity: 1; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft-2); }

.svg-ico { width: 18px; height: 18px; flex: none; display: block; }
.ico { display: inline-flex; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: inline-grid; place-items: center; color: var(--ink-3);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn.sm .svg-ico { width: 15px; height: 15px; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 8px; border-radius: 8px;
  color: var(--ink-3); font-size: 12.5px;
  transition: background .15s, color .15s;
}
.chip-btn .svg-ico { width: 15px; height: 15px; }
.chip-btn:hover, .chip-btn.active { background: var(--surface-3); color: var(--ink); }

.primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 11px;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px;
  transition: transform .15s var(--ease), opacity .15s, background .15s;
}
.primary-btn:hover { background: var(--accent); color: #fff; }
.primary-btn:active { transform: scale(.98); }
.primary-btn:disabled { opacity: .5; cursor: default; }
.primary-btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.primary-btn.sm .svg-ico { width: 15px; height: 15px; }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; text-decoration: none;
}
.ghost-btn:hover { background: var(--surface); color: var(--ink); }
.ghost-btn .svg-ico { width: 15px; height: 15px; color: var(--accent); }

/* ============ app layout ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* ---- sidebar ---- */
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line-2);
  padding: 14px 12px 12px;
  gap: 10px;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; }
.sidebar-close { display: none; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark, .modal-mark, .msg-avatar, .seal {
  display: block; flex: none;
  background:
    url(/img/logo.svg) center / 70% no-repeat,
    var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 4px 10px -4px var(--accent);
}
.brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-serif); font-weight: 700; font-size: 17px; letter-spacing: .01em; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); }

.new-chat {
  display: flex; align-items: center; gap: 9px;
  height: 40px; padding: 0 12px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line);
  font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-1);
  transition: border-color .15s, transform .15s var(--ease);
}
.new-chat:hover { border-color: var(--ink-4); }
.new-chat:active { transform: scale(.99); }
.new-chat .svg-ico { width: 17px; height: 17px; color: var(--accent); }
.new-chat kbd {
  margin-left: auto; font: 11px var(--font-sans); color: var(--ink-4);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}

.conv-search {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px; border-radius: 9px;
  color: var(--ink-4);
}
.conv-search:focus-within { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.conv-search .svg-ico { width: 15px; height: 15px; }
.conv-search input { flex: 1; border: 0; background: none; outline: none; font-size: 13px; min-width: 0; color: var(--ink); }
.conv-search input::placeholder { color: var(--ink-4); }

.conv-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.conv-group + .conv-group { margin-top: 14px; }
.conv-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-4); padding: 4px 10px 6px;
}
.conv-hint { font-weight: 500; letter-spacing: 0; padding: 0 5px; border-radius: 4px; background: var(--surface-3); }
.conv-item {
  position: relative; display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 8px 0 10px; border-radius: 9px;
  text-decoration: none; color: var(--ink-2); font-size: 13.5px;
  transition: background .12s;
}
.conv-item:hover { background: var(--surface-3); }
.conv-item.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.conv-item.active::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 2.5px; border-radius: 2px; background: var(--accent);
}
.conv-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-actions { display: none; gap: 1px; }
.conv-item:hover .conv-actions { display: flex; }
.conv-rename {
  flex: 1; min-width: 0; height: 26px; padding: 0 6px; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--surface); outline: none; font-size: 13px;
}
.conv-empty { color: var(--ink-4); font-size: 13px; padding: 16px 10px; }

.sidebar-foot { position: relative; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.copyright { margin: 0; padding: 0 6px; font-size: 11px; color: var(--ink-4); letter-spacing: .01em; }
.copyright a { text-decoration: none; }
.copyright a:hover { color: var(--ink-3); }
.account { min-width: 0; }
.acct { display: flex; align-items: center; gap: 4px; }
.acct-trigger {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 6px; border-radius: 10px; text-align: left; transition: background .12s;
}
.acct-trigger:hover, .acct-trigger[aria-expanded="true"] { background: var(--surface-3); }
.acct-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.acct-chevron { flex: none; color: var(--ink-4); display: grid; place-items: center; }
.acct-chevron .svg-ico { width: 15px; height: 15px; transform: rotate(-90deg); transition: transform .15s var(--ease); }
.acct-trigger[aria-expanded="true"] .acct-chevron .svg-ico { transform: rotate(90deg); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--ink); color: var(--bg);
}
.avatar.lg { width: 36px; height: 36px; font-size: 15px; }
.avatar.ghost { background: var(--surface-3); color: var(--ink-3); }
.avatar.ghost .svg-ico { width: 16px; height: 16px; }
.acct-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.acct-text b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-text small { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-verify {
  display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 4px; padding: 5px 8px; border-radius: 8px;
  font-size: 11.5px; color: var(--accent-ink); background: var(--accent-soft); text-align: left;
}
.acct-verify:hover { text-decoration: underline; text-underline-offset: 2px; }
.acct-verify .svg-ico { width: 13px; height: 13px; flex: none; }
.acct-cta { flex: none; font-size: 12px; font-weight: 600; color: var(--accent); padding: 4px 9px; border-radius: 6px; background: var(--accent-soft); }
.acct-cta:hover { background: var(--accent-soft-2); }

/* account menu: opens upward from the sidebar account row */
.acct-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 6;
  display: flex; flex-direction: column; padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  animation: pop .14s var(--ease);
  max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px); overflow-y: auto;
}
.acct-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.acct-menu-head[hidden] + .acct-menu-prefs { padding-top: 6px; }
.acct-verified { display: inline-flex; vertical-align: -2px; color: #1f8a5b; }
:root[data-theme="dark"] .acct-verified { color: #45b584; }
.acct-verified .svg-ico { width: 13px; height: 13px; }
.acct-unverified { color: var(--accent-ink); }
.acct-menu-prefs { display: flex; flex-direction: column; gap: 6px; padding: 2px 8px 8px; }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); }
.pref-row .settings-seg { width: 132px; flex: none; }
.pref-row .settings-seg button { height: 26px; font-size: 12px; }
.acct-menu .menu-sep { height: 1px; margin: 4px 2px; background: var(--line-2); flex: none; }
.acct-menu .menu-sep[hidden] { display: none; }
.acct-menu .menu-item { flex: none; text-decoration: none; }
.acct-menu .menu-item:focus-visible, .acct-menu-legal a:focus-visible, .acct-menu .settings-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.acct-menu-legal { display: flex; gap: 6px; padding: 6px 10px; font-size: 12px; color: var(--ink-4); }
.acct-menu-legal a { color: var(--ink-3); text-decoration: none; border-radius: 4px; }
.acct-menu-legal a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }

.settings-seg {
  display: grid; grid-template-columns: 1fr 1fr; padding: 3px;
  border-radius: 10px; background: var(--surface-3);
}
.settings-seg button {
  height: 30px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.settings-seg button:hover { color: var(--ink); }
.settings-seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.settings-seg button .svg-ico { width: 14px; height: 14px; }

/* settings dialog: vertical tabs on the left, panes on the right */
.modal-card.settings-card { max-width: 640px; padding: 24px; }
.settings-card h2 { margin-bottom: 18px; }
.settings-layout { display: grid; grid-template-columns: 160px 1fr; gap: 20px; min-height: 280px; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav [role="tab"] {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--ink-3); text-align: left;
}
.settings-nav [role="tab"]:hover { background: var(--surface-3); color: var(--ink); }
.settings-nav [role="tab"].active { background: var(--accent-soft); color: var(--accent-ink); }
.settings-nav [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.settings-nav .svg-ico { width: 15px; height: 15px; }
.settings-panes { min-width: 0; }
.settings-pane h3 { margin: 4px 0 14px; font-size: 15px; color: var(--ink); }
.settings-pane .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.settings-pane .dialog-actions:not(:has(:not([hidden]))) { display: none; }
.pw-form .form-error { min-height: 0; margin: 0; }
.pw-form .form-error:empty { display: none; }

@media (max-width: 600px) {
  .modal-card.settings-card { padding: 20px 16px; }
  .settings-layout { grid-template-columns: 1fr; gap: 14px; min-height: 0; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .settings-nav [role="tab"] { flex: none; }
}

.scrim { display: none; }

/* ---- main ---- */
.main {
  position: relative; min-width: 0; min-height: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
}
.topbar {
  height: 56px; display: flex; align-items: center; gap: 10px;
  padding: 0 18px; position: relative; z-index: 3;
}
.menu-btn { display: none; }
.topbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.title-text {
  font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 3px 6px; margin-left: -6px; border-radius: 6px; cursor: text; outline: none;
}
.title-text:hover { background: var(--surface-3); }
.title-text[contenteditable="true"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
}
.badge .svg-ico { width: 12px; height: 12px; }
.badge-temp { color: var(--ink-3); background: var(--surface-3); border: 1px dashed var(--line); }
.badge-saved { color: var(--accent); background: var(--accent-soft); }
.topbar-actions { display: flex; gap: 8px; }

.scroller { overflow-y: auto; overflow-x: hidden; scroll-behavior: auto; position: relative; }
.is-home .scroller {
  background:
    radial-gradient(1200px 380px at 50% -140px, var(--accent-soft), transparent 70%),
    radial-gradient(var(--paper-dot) 1px, transparent 1.2px) 0 0 / 22px 22px;
}
.is-home .thread { display: none; }
.app:not(.is-home) .home { display: none; }
.is-home .main { grid-template-rows: minmax(0, 1fr); }
.is-home .topbar, .is-home .composer-wrap { display: none; }

/* ============ home ============ */
.home { max-width: 1040px; margin: 0 auto; padding: 36px 28px 40px; }
.hero { text-align: center; padding: clamp(40px, 8vh + 44px, 132px) 0 34px; animation: rise .6s var(--ease) both; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
  padding: 5px 12px 5px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.seal { width: 22px; height: 22px; border-radius: 5px; }
.hero-title {
  font-family: var(--font-serif); font-weight: 700; letter-spacing: -.01em;
  font-size: clamp(32px, 4.6vw, 50px); line-height: 1.15; margin: 20px 0 14px;
}
.hero-title em {
  font-style: normal; color: var(--accent);
  background: linear-gradient(transparent 68%, var(--accent-soft-2) 0);
  padding: 0 .06em;
}
.hero-sub { max-width: 640px; margin: 0 auto; color: var(--ink-3); font-size: 15px; line-height: 1.75; }

.panel { margin-top: 26px; animation: rise .6s .08s var(--ease) both; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 12px; }
.panel-head h2 {
  margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px;
}
.panel-head h2::before { content: ""; width: 14px; height: 2px; background: var(--accent); border-radius: 2px; }
.panel-head span { font-size: 12px; color: var(--ink-4); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative; text-align: left; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 0; min-height: 138px; box-shadow: var(--shadow-1);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
  animation: rise .5s calc(var(--i) * 40ms + 120ms) var(--ease) both;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--ink-4); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.tile-name { font-size: 12.5px; color: var(--ink-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-period { font-size: 11px; color: var(--ink-4); flex: none; margin-left: auto; font-variant-numeric: tabular-nums; }
.tile-value { display: flex; align-items: baseline; gap: 1px; margin-top: 4px; }
.tile-value .v { font-size: 28px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile-value .u { font-size: 14px; color: var(--ink-3); font-weight: 500; }
.tile-foot { display: flex; align-items: center; gap: 6px; font-size: 12px; min-height: 18px; }
.tile-delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-vs { color: var(--ink-4); }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--ink-3); }
.tile-spark { height: 40px; margin: 6px -16px 0; position: relative; }
.tile-spark svg, .series-spark svg { display: block; overflow: visible; }
.spark-dot { position: absolute; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; pointer-events: none; }

.hero-composer { max-width: 720px; margin: 28px auto 0; text-align: left; }
.hero-composer .composer { max-width: none; border-radius: 22px; padding: 10px; }
.hero-composer .composer textarea { min-height: 64px; font-size: 16px; padding: 6px 8px; }
.hero-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 720px; margin: 16px auto 0; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 14px 0 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 500;
  transition: border-color .15s, color .15s, transform .15s var(--ease);
  animation: rise .5s calc(var(--i) * 40ms + 160ms) var(--ease) both;
}
.hero-chip .svg-ico { width: 15px; height: 15px; color: var(--accent); }
.hero-chip:hover { border-color: var(--ink-4); color: var(--ink); transform: translateY(-1px); }
.hero-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ thread ============ */
.thread { max-width: var(--thread-w); margin: 0 auto; padding: 18px 28px 40px; display: flex; flex-direction: column; gap: 28px; }
.msg { animation: rise .35s var(--ease) both; }
.msg-user { align-self: flex-end; max-width: min(82%, 640px); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-user .bubble {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px 18px 5px 18px; padding: 10px 16px; font-size: 15px; line-height: 1.65;
  box-shadow: var(--shadow-1); white-space: normal; word-break: break-word;
}
.msg-atts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.msg-user-actions { display: flex; opacity: 0; transition: opacity .15s; }
.msg-user:hover .msg-user-actions, .msg-user:focus-within .msg-user-actions { opacity: 1; }
@media (hover: none) { .msg-user-actions { opacity: 1; } }
.msg-user:not([data-id]) .msg-user-actions, .is-streaming .msg-user-actions, .msg-user.editing .msg-user-actions { display: none; }
.msg-user.editing { width: min(82vw, 640px); align-self: flex-end; }
.msg-edit { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.msg-edit textarea {
  width: 100%; min-height: 72px; max-height: 320px; resize: vertical; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; line-height: 1.65; box-shadow: var(--shadow-1);
}
.msg-edit textarea:focus { outline: 2px solid var(--accent-soft-2); border-color: var(--accent); }
.msg-edit-bar { display: flex; justify-content: flex-end; gap: 6px; }
.msg-edit-bar .primary-btn { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

.msg-ai { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; }
.msg-avatar { width: 30px; height: 30px; border-radius: 8px; margin-top: 2px; }
.msg-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13.5px; height: 30px; }
.thinking-text {
  background: linear-gradient(90deg, var(--ink-3) 0%, var(--ink) 50%, var(--ink-3) 100%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 1.6s linear infinite;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent-soft-2); animation: pulse 1.4s ease-out infinite; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-4); animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }

/* tools timeline */
.tools { align-self: flex-start; max-width: 100%; }
.tools summary {
  list-style: none; display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  height: 30px; padding: 0 12px 0 10px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-3); font-size: 12.5px;
  box-shadow: var(--shadow-1); user-select: none;
}
.tools summary::-webkit-details-marker { display: none; }
.tools summary .svg-ico { width: 14px; height: 14px; color: var(--accent); }
.tools summary .chev { color: var(--ink-4); transition: transform .2s; }
.tools[open] summary .chev { transform: rotate(90deg); }
.tools summary .step-detail { color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-steps {
  list-style: none; margin: 8px 0 0; padding: 8px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12.5px;
}
.step { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--ink-2); min-width: 0; }
.step .svg-ico { width: 14px; height: 14px; color: var(--c4); flex: none; }
.step-running .svg-ico { color: var(--accent); }
.step-error .svg-ico { color: var(--down); }
.step-name { font-weight: 600; flex: none; }
.step-detail { color: var(--ink-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-ms { margin-left: auto; color: var(--ink-4); font-variant-numeric: tabular-nums; flex: none; }
.step-code { padding: 0 0 4px 22px; }
.step-code summary { color: var(--ink-3); cursor: pointer; font-size: 12px; }
.step-code pre {
  margin: 4px 0 0; padding: 8px 10px; max-height: 240px; overflow: auto; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line-2); font-size: 12px; line-height: 1.5; white-space: pre-wrap;
}

/* ============ markdown ============ */
.msg-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.md { font-size: 15.5px; line-height: 1.8; color: var(--ink-2); word-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: .65em 0; }
.md strong { color: var(--ink); font-weight: 650; }
.msg-body > .md-seg:first-child > p:first-child {
  font-family: var(--font-serif); font-size: 18px; line-height: 1.7; color: var(--ink);
  padding: 2px 0 2px 16px; border-left: 3px solid var(--accent); margin-bottom: 1em;
}
.msg-body > .md-seg:first-child > p:first-child strong { font-weight: 700; }
.md h1, .md h2, .md h3, .md h4 {
  font-family: var(--font-serif); color: var(--ink); line-height: 1.4; font-weight: 700;
  margin: 1.5em 0 .5em;
}
.md h1 { font-size: 21px; }
.md h2 { font-size: 19px; }
.md h3 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.md h3::before { content: ""; width: 4px; height: 15px; border-radius: 2px; background: var(--accent); flex: none; }
.md h4 { font-size: 15.5px; }
.md ul, .md ol { padding-left: 1.3em; margin: .6em 0; }
.md li { margin: .3em 0; padding-left: .2em; }
.md li::marker { color: var(--ink-4); }
.md ol li::marker { font-variant-numeric: tabular-nums; font-weight: 600; }
.md a { color: var(--accent-ink); text-decoration: underline; text-decoration-color: var(--accent-soft-2); text-underline-offset: 3px; }
.md a:hover { text-decoration-color: currentColor; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.md code { font-family: var(--font-mono); font-size: .86em; padding: .12em .38em; border-radius: 5px; background: var(--surface-3); color: var(--ink); }
.code-block { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 1em 0; background: var(--surface-2); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 14px; font-size: 11.5px; color: var(--ink-3); border-bottom: 1px solid var(--line-2); }
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 13px; line-height: 1.6; }
.code-block code { background: none; padding: 0; font-size: inherit; }

/* tables */
.table-wrap {
  position: relative; overflow-x: auto; margin: 1em 0;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.table-tools { position: absolute; top: 4px; right: 4px; opacity: 0; transition: opacity .15s; }
.table-wrap:hover .table-tools { opacity: 1; }
.table-tools .chip-btn { background: var(--surface); }
.md table, .chart-data table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.md th, .chart-data th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-3); letter-spacing: .02em;
  padding: 10px 14px 8px; border-bottom: 1.5px solid var(--ink-2); white-space: nowrap; background: var(--surface-2);
}
.md td, .chart-data td { padding: 8px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); vertical-align: top; }
.md tr:last-child td, .chart-data tr:last-child td { border-bottom: 0; }
.md tbody tr:hover td, .chart-data tbody tr:hover td { background: var(--surface-2); }
.md td:first-child { color: var(--ink); font-weight: 500; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.md td.num { color: var(--ink); font-weight: 500; }
.md td.num.up { color: var(--up); }
.md td.num.down { color: var(--down); }

/* kpi strip */
.kpi-strip { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 10px; margin: 1em 0 1.2em; }
.kpi {
  padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-1); min-width: 0; position: relative; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); opacity: .7; }
.kpi-label {
  font-size: 12px; color: var(--ink-3); line-height: 1.4; min-height: 2.8em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kpi-value { font-size: 23px; font-weight: 650; color: var(--ink); letter-spacing: -.015em; line-height: 1.35; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 11.5px; line-height: 1.5; }
.kpi-delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-delta.up { color: var(--up); }
.kpi-delta.down { color: var(--down); }
.kpi-period { color: var(--ink-4); }

/* callouts */
.md blockquote { margin: 1em 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--line); color: var(--ink-3); }
.md blockquote.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--c2); border-radius: 0 12px 12px 0;
  background: var(--surface-2); padding: 10px 16px; font-size: 13.5px; line-height: 1.7; color: var(--ink-2);
}
.md blockquote.callout-risk { border-left-color: var(--accent); background: var(--accent-soft); }
.md blockquote.callout p { margin: .3em 0; }
.callout-title { display: inline-block; font-size: 12px; letter-spacing: .06em; color: var(--c2) !important; margin-right: 4px; }
.callout-risk .callout-title { color: var(--accent) !important; }

/* citations */
.cites { display: inline-flex; gap: 2px; margin: 0 1px 0 2px; vertical-align: 1px; }
.cite {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 5px; font-size: 10.5px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  background: var(--accent-soft); color: var(--accent-ink);
  transition: background .12s, color .12s, transform .12s;
}
.cite:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.cite.pending { opacity: .45; }

/* streaming caret */
.msg-ai.streaming .msg-body > .md-seg:last-child > p:last-child::after,
.msg-ai.streaming .msg-body > .md-seg:last-child > ul:last-child > li:last-child::after,
.msg-ai.streaming .msg-body > .md-seg:last-child > ol:last-child > li:last-child::after,
.msg-ai.streaming .msg-body > .md-seg:last-child > :is(h3, h4):last-child::after {
  content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 3px; vertical-align: -2px;
  background: var(--accent); border-radius: 1px; animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ============ charts ============ */
.chart-card {
  margin: 4px 0; padding: 14px 16px 10px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  animation: rise .4s var(--ease) both;
}
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.chart-title { font-family: var(--font-serif); font-weight: 700; font-size: 15.5px; color: var(--ink); line-height: 1.4; }
.chart-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.chart-tools { display: flex; gap: 2px; opacity: .6; transition: opacity .15s; }
.chart-card:hover .chart-tools { opacity: 1; }
.chart-tools .chip-btn { width: 28px; padding: 0; justify-content: center; }
.chart-body { width: 100%; }
.chart-error { margin: 0; padding: 24px 0; text-align: center; color: var(--ink-3); font-size: 13px; }
.chart-data { margin-top: 8px; max-height: 320px; overflow: auto; border-radius: 10px; border: 1px solid var(--line-2); }
.chart-data .table-wrap { margin: 0; border: 0; border-radius: 0; }
.chart-foot {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--ink-3);
}
.chart-skeleton { border-radius: 16px; border: 1px solid var(--line); padding: 16px; background: var(--surface); }
.sk-line, .sk-body {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.sk-line { height: 14px; width: 40%; margin-bottom: 14px; }
.sk-body { height: 240px; }
.tt-head { font-weight: 600; margin-bottom: 4px; font-size: 12px; color: var(--ink-3); }
.tt-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; line-height: 1.7; }
.tt-row span { color: var(--ink-2); }
.tt-row b { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }

/* ============ sources ============ */
.sources { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.sources-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.sources-head .svg-ico { width: 14px; height: 14px; }
.sources-head .count { font-weight: 600; padding: 0 6px; border-radius: 999px; background: var(--surface-3); letter-spacing: 0; }
.src-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.src {
  display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line-2); transition: border-color .15s, box-shadow .2s;
}
.src:hover { border-color: var(--line); box-shadow: var(--shadow-1); }
.src.flash { animation: flash 1.4s var(--ease); }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent-soft-2); border-color: var(--accent); } }
.src-n {
  flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 700;
}
.src-body { min-width: 0; flex: 1; }
.src-title { font-size: 13px; line-height: 1.5; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.src-title a { text-decoration: none; }
.src-title a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.src-title .src-ext { display: inline-flex; vertical-align: -2px; margin-left: 4px; color: var(--ink-4); }
.src-title .src-ext:hover { color: var(--accent-ink); }
.src-title .src-ext .svg-ico { width: 13px; height: 13px; }
.src-kind {
  display: inline-flex; align-items: center; gap: 3px; margin-right: 6px; vertical-align: 1px;
  font-size: 10.5px; font-weight: 700; color: var(--ink-3); padding: 0 5px; border-radius: 4px; background: var(--surface-3);
}
.src-kind .svg-ico { width: 11px; height: 11px; }
.src-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-meta .sep { margin: 0 5px; color: var(--ink-4); }
.src-links { margin-top: 4px; font-size: 11.5px; }
.src-links summary { color: var(--ink-3); cursor: pointer; }
.src-links div { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.src-links a { color: var(--accent-ink); text-decoration: none; font-variant-numeric: tabular-nums; }
.src-more { margin-top: 8px; }
.src-more > summary { font-size: 12px; color: var(--ink-3); cursor: pointer; padding: 4px 0; }
.src-more .src-list { margin-top: 6px; }

.msg-actions { display: flex; gap: 4px; margin-left: -8px; }
.msg-ai:not(:last-child) [data-act="regen"], .is-streaming [data-act="regen"] { display: none; }
.fb-btn { width: 28px; padding: 0; justify-content: center; }
.fb-btn.active { color: var(--accent-ink); background: var(--accent-soft); }
.fb-form { display: flex; flex-direction: column; gap: 8px; max-width: 520px; }
.fb-form textarea {
  width: 100%; resize: vertical; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; line-height: 1.6;
}
.fb-form textarea:focus { outline: 2px solid var(--accent-soft-2); border-color: var(--accent); }
.fb-form-bar { display: flex; justify-content: flex-end; gap: 6px; }
.fb-form-bar .primary-btn { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.msg-error {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 13.5px;
}

/* popover */
.popover {
  position: fixed; z-index: 60; width: 340px; max-width: calc(100vw - 16px);
  padding: 12px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-3); font-size: 12.5px;
  animation: pop .14s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.pop-kind { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.pop-kind .svg-ico { width: 13px; height: 13px; color: var(--accent); }
.pop-n { margin-left: auto; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); border-radius: 5px; padding: 0 6px; }
.pop-title { font-weight: 600; font-size: 13.5px; color: var(--ink); line-height: 1.5; margin-top: 6px; }
.pop-meta { color: var(--ink-3); margin-top: 3px; }
.pop-snippet { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-2); color: var(--ink-2); line-height: 1.65; max-height: 132px; overflow: hidden; }
.pop-links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pop-links:empty { display: none; }
.pop-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.pop-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.pop-link .svg-ico { width: 13px; height: 13px; }

/* ============ composer ============ */
.composer-wrap { padding: 8px 28px 14px; position: relative; z-index: 2; }
.composer-wrap::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 36px; pointer-events: none;
  background: linear-gradient(transparent, var(--bg));
}
.composer {
  max-width: var(--thread-w); margin: 0 auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 8px;
  box-shadow: var(--shadow-2); transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--ink-4); box-shadow: var(--shadow-2), 0 0 0 4px var(--accent-soft); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea {
  flex: 1; border: 0; outline: none; resize: none; background: none;
  font-size: 15px; line-height: 1.6; padding: 7px 4px; max-height: 220px; min-height: 38px;
}
.composer textarea::placeholder { color: var(--ink-4); }
.attach-btn { width: 38px; height: 38px; border-radius: 12px; }
.send-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--ink); color: var(--bg); transition: background .15s, transform .15s var(--ease), opacity .15s;
}
.send-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.send-btn:active:not(:disabled) { transform: scale(.94); }
.send-btn:disabled { opacity: .25; cursor: default; }
.send-btn.stop { background: var(--accent); color: #fff; }
.composer-hint { max-width: var(--thread-w); margin: 7px auto 0; text-align: center; font-size: 11.5px; color: var(--ink-4); }
.composer-hint .dot { margin: 0 6px; }
.composer-hint a { color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; }
.composer-hint a:hover { color: var(--accent); }

.attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 8px; }

/* ============ answer options (features.js) ============ */
.feat-btn { position: relative; width: 38px; height: 38px; border-radius: 12px; }
.feat-btn.active { color: var(--accent-ink); background: var(--accent-soft); }
.feat-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--ink); }
.feat-lock {
  position: absolute; right: 4px; bottom: 4px; width: 14px; height: 14px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--ink-3); box-shadow: 0 0 0 1px var(--line);
}
.feat-lock .svg-ico { width: 9px; height: 9px; stroke-width: 2.4; }

.feat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 6px; }
.feat-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 4px 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface-2);
}
.feat-chip > .svg-ico { width: 13px; height: 13px; }
.feat-chip.on { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent-soft-2); }
.feat-chip.off { color: var(--ink-3); }
.feat-chip.off > span { text-decoration: line-through; text-decoration-color: var(--ink-4); }
.feat-chip-x { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: inherit; opacity: .7; }
.feat-chip-x:hover, .feat-chip-x:focus-visible { opacity: 1; background: var(--surface-3); outline: none; }
.feat-chip-x .svg-ico { width: 11px; height: 11px; stroke-width: 2.2; }

.feat-panel {
  position: fixed; z-index: 66; width: 360px; max-width: calc(100vw - 16px); padding: 6px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-3);
  animation: pop .14s var(--ease);
}
.feat-head { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 8px; }
.feat-head b { font-size: 13.5px; color: var(--ink); }
.feat-head small { font-size: 12px; color: var(--ink-3); }
.feat-rows { display: flex; flex-direction: column; }
.feat-row {
  display: grid; grid-template-columns: 32px 1fr auto auto; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 11px; cursor: pointer; transition: background .12s;
}
.feat-row:hover { background: var(--surface-3); }
.feat-row:focus-within { background: var(--surface-3); }
.feat-ico {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-2);
}
.feat-ico .svg-ico { width: 16px; height: 16px; }
.feat-row:hover .feat-ico { background: var(--surface); }
.feat-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.feat-text b { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.feat-text small { font-size: 12px; line-height: 1.45; color: var(--ink-3); }
.feat-badge {
  font-size: 9.5px; font-weight: 800; letter-spacing: .06em; padding: 1px 5px; border-radius: 5px;
  color: var(--accent-ink); background: var(--accent-soft-2);
}
.feat-row-lock { color: var(--ink-4); display: grid; }
.feat-row-lock .svg-ico { width: 14px; height: 14px; }
.feat-row.disabled .feat-ico, .feat-row.disabled .feat-text { opacity: .55; }
.feat-panel.locked .feat-row.disabled .feat-ico, .feat-panel.locked .feat-row.disabled .feat-text { opacity: .75; }
.feat-panel:not(.locked) .feat-row.disabled { cursor: default; }
.feat-panel:not(.locked) .feat-row.disabled:hover { background: none; }

/* iOS-style switch on a native checkbox (keeps keyboard and screen-reader semantics) */
.switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0; cursor: inherit;
  width: 34px; height: 20px; border-radius: 999px; background: var(--line); transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .18s var(--ease);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.feat-panel.locked .switch, .switch:disabled { opacity: .5; }

.feat-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; padding: 10px 12px 8px; border-top: 1px solid var(--line-2); }
.feat-foot small { font-size: 11.5px; color: var(--ink-3); }
.feat-foot.plain { justify-content: flex-end; padding: 6px 6px 2px; }

.feat-hint {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: var(--thread-w); margin: -6px auto 18px;
  padding: 9px 12px; border-radius: 12px; border: 1px dashed var(--line); color: var(--ink-2); font-size: 13px;
}
.feat-hint > .svg-ico { width: 16px; height: 16px; color: var(--accent); flex: none; }
.feat-hint > span { flex: 1; min-width: 180px; }
.file-chip {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 7px; max-width: 280px;
  height: 32px; padding: 0 6px 0 10px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px;
}
.file-chip.static { padding-right: 10px; background: var(--surface); }
.file-chip .svg-ico { width: 15px; height: 15px; color: var(--accent); }
.file-chip.error { border-color: var(--accent); background: var(--accent-soft); }
.fc-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.fc-status { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }
.fc-x { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; color: var(--ink-4); }
.fc-x:hover { background: var(--surface-3); color: var(--ink); }
.fc-x .svg-ico { width: 13px; height: 13px; }
.fc-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); transition: width .2s; }

.dropzone {
  position: absolute; inset: 10px; z-index: 20; display: grid; place-items: center;
  border: 2px dashed var(--accent); border-radius: 22px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .15s;
  text-align: center; color: var(--ink-2);
}
.dropzone.show { opacity: 1; }
.dropzone .svg-ico { width: 34px; height: 34px; margin: 0 auto 8px; color: var(--accent); }
.dropzone p { margin: 0; font-weight: 600; font-size: 16px; }
.dropzone small { color: var(--ink-3); }

/* ============ modal ============ */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg-2) 55%, transparent); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .18s;
}
.modal.open { opacity: 1; }
.modal-card {
  position: relative; width: 100%; max-width: 400px; padding: 28px 28px 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-3);
  transform: translateY(8px) scale(.98); transition: transform .22s var(--ease);
}
.modal.open .modal-card { transform: none; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.modal-mark { width: 40px; height: 40px; border-radius: 11px; margin-bottom: 14px; }
.modal-card h2 { font-family: var(--font-serif); margin: 0; font-size: 22px; }
.modal-sub { margin: 6px 0 18px; color: var(--ink-3); font-size: 13.5px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 11px; background: var(--surface-3); margin-bottom: 16px; }
.tab { height: 32px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 5px; }
.field input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); outline: none; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--ink-4); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.consent { display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 8px; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); cursor: pointer; }
.consent input { flex: none; width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--accent); }
.consent a { color: var(--ink-2); text-underline-offset: 2px; }
.consent a:hover { color: var(--accent-ink); }
.form-error { min-height: 18px; margin: 2px 0 10px; font-size: 12.5px; color: var(--accent-ink); }
#authSubmit { width: 100%; }
.form-note { margin: 2px 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.55; background: var(--accent-soft); color: var(--ink-2); }
.auth-links { display: flex; justify-content: center; margin-top: 12px; font-size: 13px; }
.auth-links:not(:has(a:not([hidden]))) { display: none; }
.auth-links a { color: var(--ink-3); text-decoration: none; }
.auth-links a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }

/* ============ toasts ============ */
.toasts { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-2);
  opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--accent); color: #fff; }

/* ============ responsive ============ */
.demo-foot { display: flex; align-items: center; gap: 8px; padding: 2px 4px 2px 6px; }
.demo-badge { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--accent-ink); background: var(--accent-soft); border-radius: 5px; padding: 1px 7px; }
.demo-note { flex: 1; min-width: 0; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============ module nav & pages ============ */
.module-nav { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2); }
.module-nav a {
  position: relative; display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px; border-radius: 9px;
  color: var(--ink-2); font-size: 13.5px; font-weight: 500; text-decoration: none;
}
.module-nav a:hover { background: var(--surface-3); color: var(--ink); }
.module-nav a.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.module-nav a.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--accent); }
.module-nav .svg-ico { width: 17px; height: 17px; color: var(--ink-3); }
.module-nav a.active .svg-ico { color: var(--accent); }

.page { display: none; }
.is-page .page { display: block; }
.is-page .thread, .is-page .composer-wrap { display: none; }
.is-page .main { grid-template-rows: auto minmax(0, 1fr); }
.is-page .scroller { background: radial-gradient(var(--paper-dot) 1px, transparent 1.2px) 0 0 / 22px 22px; }

.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--ink-2); font-weight: 600; text-decoration: none; padding: 3px 6px; margin-left: -6px; border-radius: 6px; }
.crumbs a:hover { background: var(--surface-3); color: var(--ink); }
.crumbs .svg-ico { width: 15px; height: 15px; color: var(--accent); }
.crumb-sep { color: var(--ink-4); }
.crumb-cur { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.ghost-btn { text-decoration: none; }

/* ============ library ============ */
.lib { max-width: 1120px; margin: 0 auto; padding: 18px 28px 64px; }
.lib-head { padding: 26px 0 22px; animation: rise .5s var(--ease) both; }
.lib-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--accent-ink); }
.lib-title { font-family: var(--font-serif); font-weight: 700; font-size: clamp(26px, 3vw, 34px); line-height: 1.25; margin: 12px 0 8px; letter-spacing: .01em; }
.lib-sub { margin: 0; color: var(--ink-3); font-size: 14px; line-height: 1.7; }
.lib-sub b { color: var(--ink); font-weight: 650; }
.lib-search {
  display: flex; align-items: center; gap: 10px; margin-top: 20px; max-width: 720px;
  height: 50px; padding: 0 7px 0 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .15s;
}
.lib-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.lib-search > .svg-ico { color: var(--ink-4); }
.lib-search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 15px; }
.lib-search input::placeholder { color: var(--ink-4); }
.lib-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.lib-quick button { font-size: 12.5px; color: var(--ink-3); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }
.lib-quick button:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }

.lib-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.lib-facets { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 18px; }
.facet-group h4 { margin: 0 0 6px; padding: 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; color: var(--ink-3); }
.facet {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 5px 8px; border-radius: 7px; font-size: 13px; color: var(--ink-2); text-align: left;
}
.facet span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facet b { font-weight: 500; font-size: 11.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.facet:hover { background: var(--surface-3); color: var(--ink); }
.facet.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.facet.on b { color: var(--accent-ink); }
.facet-more { padding: 4px 8px; font-size: 12px; color: var(--accent-ink); }
.facet-more:hover { text-decoration: underline; text-underline-offset: 2px; }

.lib-results { min-width: 0; transition: opacity .15s; }
.lib-list-page.loading .lib-results { opacity: .55; }
.lib-years { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 8px; box-shadow: var(--shadow-1); }
.lib-years-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.lib-years-head small { font-weight: 400; color: var(--ink-4); }
.yr-bars { display: flex; align-items: flex-end; gap: 6px; height: 74px; margin-top: 8px; }
.yr { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.yr i { display: block; width: 100%; max-width: 34px; border-radius: 4px 4px 1px 1px; background: var(--accent-soft-2); transition: background .15s, transform .15s var(--ease); transform-origin: bottom; }
.yr span { font-size: 10.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.yr:hover:not(:disabled) i { background: var(--accent); opacity: .7; }
.yr.on i { background: var(--accent); }
.yr.on span { color: var(--accent-ink); font-weight: 700; }
.yr:disabled { cursor: default; }
.yr:disabled i { background: var(--line); }

.lib-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 16px 0 10px; }
.lib-count { font-size: 13px; color: var(--ink-3); }
.lib-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.lib-active { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.lib-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 6px 2px 10px; border-radius: 999px; }
.lib-chip .svg-ico { width: 12px; height: 12px; }
.lib-chip:hover { background: var(--accent-soft-2); }
.lib-chip-reset, .link-btn { font-size: 12px; color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; }
.link-btn { font-size: inherit; color: var(--accent-ink); }
.lib-sort { width: auto; margin-left: auto; }
.lib-sort button { height: 26px; padding: 0 10px; font-size: 12px; }
.lib-sort button:disabled { opacity: .45; cursor: default; }

.lib-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lib-card { animation: rise .4s calc(var(--i) * 30ms) var(--ease) both; }
.lib-card a {
  display: block; text-decoration: none; padding: 16px 18px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .2s var(--ease), transform .2s var(--ease);
}
.lib-card a:hover { border-color: var(--ink-4); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.lib-card a:hover h3 { color: var(--accent-ink); }
.lib-card-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.lib-card-top time { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-4); }
.lib-card h3 { margin: 8px 0 4px; font-family: var(--font-serif); font-size: 17px; font-weight: 700; line-height: 1.5; color: var(--ink); transition: color .15s; }
.lib-card-meta { font-size: 12.5px; color: var(--ink-3); }
.lib-card-meta .sep { margin: 0 6px; color: var(--ink-4); }
.lib-card-ex { margin: 8px 0 0; font-size: 13.5px; line-height: 1.75; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lib mark, .reader mark { background: none; color: inherit; }
.lib-card-ex mark, .reader mark.hl { background: var(--gold-soft); color: var(--ink); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 2px; padding: 0 1px; }
.reader mark.pt { color: var(--accent-ink); font-weight: 600; background: linear-gradient(transparent 70%, var(--accent-soft-2) 0); }
.lib-card-topics { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 10px; font-size: 12px; color: var(--ink-4); }

.lib-tag { display: inline-flex; align-items: center; flex: none; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 5px; letter-spacing: .02em; border: 1px solid transparent; }
.lib-tag-policy { color: #fff; background: var(--accent); }
.lib-tag-interpretation { color: var(--accent-ink); background: var(--accent-soft); border-color: var(--accent-soft-2); }
.lib-tag-draft { color: var(--ink-2); border-color: var(--line); border-style: dashed; }
.lib-tag-news { color: var(--c2); background: color-mix(in srgb, var(--c2) 10%, transparent); }
.lib-tag-report { color: var(--c4); background: color-mix(in srgb, var(--c4) 12%, transparent); }
.lib-tag-demo { color: var(--gold); background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 35%, transparent); border-style: dashed; }
.lib-card-place { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lib-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 56px 20px; color: var(--ink-3); }
.lib-empty > .svg-ico { width: 28px; height: 28px; color: var(--ink-4); }
.lib-empty p { margin: 0; }
.lib-pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: 22px; }
.pg { min-width: 34px; height: 32px; padding: 0 10px; border-radius: 8px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pg:hover:not(:disabled) { background: var(--surface-3); }
.pg.on { background: var(--accent); color: #fff; font-weight: 600; }
.pg:disabled { opacity: .4; cursor: default; }

/* ---- reader ---- */
.reader { max-width: 1120px; }
.reader-back { display: inline-flex; align-items: center; gap: 2px; margin-top: 6px; font-size: 13px; color: var(--ink-3); text-decoration: none; }
.reader-back .svg-ico { width: 15px; height: 15px; transform: rotate(180deg); }
.reader-back:hover { color: var(--accent-ink); }
.reader-head { padding: 18px 0 18px; border-bottom: 2px solid var(--accent); animation: rise .5s var(--ease) both; }
.reader-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 12.5px; }
.reader-tags a { color: var(--ink-3); text-decoration: none; }
.reader-tags a:hover { color: var(--accent-ink); }
.reader-head h1 { font-family: var(--font-serif); font-size: clamp(24px, 2.8vw, 32px); line-height: 1.4; font-weight: 700; margin: 12px 0 16px; letter-spacing: .01em; }
.reader-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 24px; margin: 0; }
.reader-meta div { min-width: 0; }
.reader-meta dt { font-size: 11.5px; color: var(--ink-4); letter-spacing: .06em; }
.reader-meta dd { margin: 2px 0 0; font-size: 13.5px; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.reader-note { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 0; padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.7; color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line-2); }
.reader-note .svg-ico { width: 16px; height: 16px; margin-top: 3px; color: var(--ink-4); }
.reader-note a { color: var(--accent-ink); }
.reader-note.demo { color: var(--ink-2); background: var(--gold-soft); border: 1px dashed color-mix(in srgb, var(--gold) 50%, transparent); }
.reader-note.demo .svg-ico { color: var(--gold); }
.reader-note.demo b { color: var(--gold); }

.reader-layout { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 40px; align-items: start; margin-top: 24px; }
.reader-doc {
  min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px clamp(20px, 4vw, 48px) 40px; box-shadow: var(--shadow-1); animation: rise .5s .06s var(--ease) both;
}
.reader-doc .md { font-size: 15.5px; line-height: 1.95; color: var(--ink); }
.reader-doc .md p { margin: .55em 0; text-align: justify; }
.reader-summary { margin-bottom: 22px; padding: 14px 18px; border-left: 3px solid var(--gold); background: var(--gold-soft); border-radius: 0 10px 10px 0; }
.reader-summary h2 { margin: 0 0 4px; font-size: 12px; letter-spacing: .14em; color: var(--gold); }
.reader-summary p { margin: 0; font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.reader-sec { scroll-margin-top: 16px; }
.reader-sec + .reader-sec { margin-top: 22px; }
.reader-sec h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-family: var(--font-serif); font-size: 18.5px; font-weight: 700; line-height: 1.5; color: var(--ink); }
.reader-sec h2 span { flex: 1; }
.sec-ask { display: inline-flex; align-items: center; gap: 4px; flex: none; font: 600 12px var(--font-sans); color: var(--accent-ink); padding: 3px 8px; border-radius: 6px; opacity: 0; transition: opacity .15s; }
.sec-ask .svg-ico { width: 13px; height: 13px; }
.reader-sec:hover .sec-ask, .sec-ask:focus-visible { opacity: 1; }
.sec-ask:hover { background: var(--accent-soft); }
@media (hover: none) { .sec-ask { opacity: 1; } }

.reader-rail { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 22px; max-height: calc(100dvh - 90px); overflow-y: auto; scrollbar-width: thin; padding-bottom: 8px; }
.reader-rail h4 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; color: var(--ink-3); }
.reader-toc { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.reader-toc h4 { padding-left: 12px; }
.reader-toc a {
  position: relative; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 2px solid transparent;
  font-size: 13px; line-height: 1.5; color: var(--ink-3); text-decoration: none;
}
.reader-toc a:hover { color: var(--ink); }
.reader-toc a.on { color: var(--accent-ink); font-weight: 600; border-left-color: var(--accent); }
.rail-group { display: flex; flex-direction: column; gap: 8px; }
.mini-doc {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s;
}
.mini-doc:hover { border-color: var(--ink-4); box-shadow: var(--shadow-1); }
.mini-top { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-4); }
.mini-top time { margin-left: auto; font-variant-numeric: tabular-nums; }
.mini-top .lib-tag { font-size: 10.5px; padding: 0 6px; }
.mini-title { font-size: 13px; line-height: 1.5; font-weight: 600; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-doc:hover .mini-title { color: var(--accent-ink); }
.mini-meta { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-skel { display: flex; flex-direction: column; gap: 14px; padding-top: 40px; }
.reader-skel i { display: block; height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface), var(--surface-3)) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
.reader-skel i:first-child { height: 34px; width: 70%; }
.reader-skel i:nth-child(3) { width: 85%; }
.reader-skel i:last-child { width: 55%; }

/* ============ home module cards ============ */
.mod-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mod-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 14px; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); color: var(--ink); text-decoration: none;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; animation: rise .5s calc(var(--i) * 60ms + .1s) var(--ease) both;
}
.mod-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--accent-soft-2); }
.mod-ico { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--accent); background: var(--accent-soft); margin-bottom: 4px; }
.mod-ico .svg-ico { width: 19px; height: 19px; }
.mod-title { display: flex; align-items: center; gap: 4px; font-family: var(--font-serif); font-size: 17px; font-weight: 700; }
.mod-title .svg-ico { width: 15px; height: 15px; color: var(--ink-4); transition: transform .2s, color .2s; }
.mod-card:hover .mod-title .svg-ico { transform: translateX(3px); color: var(--accent); }
.mod-desc { font-size: 12.5px; line-height: 1.65; color: var(--ink-3); }
.mod-stat { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.mod-stat b { color: var(--ink); font-weight: 650; }
.mod-stat b.hot { color: var(--accent); }
.mod-tower { color: #e9e6df; border-color: #1d2533; background: radial-gradient(ellipse 80% 70% at 85% 0%, rgba(232, 66, 63, .3), transparent 60%), linear-gradient(160deg, #1a2231, #0d121b); }
.mod-tower::after {
  content: ""; position: absolute; right: -40px; top: -30px; width: 190px; height: 190px; border-radius: 50%; pointer-events: none; opacity: .55;
  background: repeating-radial-gradient(circle, transparent 0 17px, rgba(160, 185, 225, .22) 17px 18px);
  mask-image: radial-gradient(circle, #000 35%, transparent 70%);
}
.mod-tower:hover { border-color: rgba(232, 66, 63, .5); }
.mod-tower .mod-ico { color: #fff; background: rgba(232, 66, 63, .85); }
.mod-tower .mod-desc, .mod-tower .mod-stat { color: #9aa6b8; }
.mod-tower .mod-stat b { color: #fff; }
.mod-tower .mod-stat b.hot { color: #ff6b5f; }

/* ============ equity tower ============ */
.tw { padding: 6px 20px 24px; }
.tw-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 14px 4px 16px; animation: rise .5s var(--ease) both; }
.tw-head .lib-title { margin: 8px 0 4px; font-size: clamp(22px, 2.4vw, 28px); }
.tw-head .lib-sub { max-width: 720px; }
.tw-find {
  display: flex; align-items: center; gap: 8px; flex: none; width: 280px; height: 40px; padding: 0 12px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); color: var(--ink-4);
}
.tw-find:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tw-find input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 14px; color: var(--ink); }

.tw-stage {
  --tw-ink: #e9e6df; --tw-ink-2: #aeb6c4; --tw-ink-3: #7c8697; --tw-line: rgba(255, 255, 255, .09); --tw-glass: rgba(12, 17, 26, .78);
  position: relative; height: clamp(560px, calc(100dvh - 200px), 940px); border-radius: 18px; overflow: hidden; color: var(--tw-ink);
  background:
    radial-gradient(ellipse 70% 55% at 42% 18%, rgba(232, 66, 63, .16), transparent 70%),
    radial-gradient(ellipse 90% 80% at 50% 40%, #182131 0%, #0b0f17 72%);
  box-shadow: var(--shadow-2), inset 0 0 0 1px rgba(255, 255, 255, .05);
}
.tw-stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px) 0 0 / 100% 36px, linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px) 0 0 / 36px 100%;
  mask-image: radial-gradient(ellipse at 50% 60%, #000 30%, transparent 80%);
}
.tw-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--tw-ink-2); font-size: 14px; }
.tw-loading .svg-ico { width: 26px; height: 26px; color: #ff6b5f; }
.tw-canvas, .tw-canvas canvas, .tw-labels { position: absolute; inset: 0; width: 100%; height: 100%; }
.tw-canvas { isolation: isolate; }
.tw-canvas canvas { display: block; outline: none; touch-action: none; }
.tw-labels { pointer-events: none; }

.tw-toolbar { position: absolute; top: 14px; left: 14px; right: 384px; display: flex; flex-wrap: wrap; gap: 8px; z-index: 2; pointer-events: none; }
.tw-chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--tw-glass); border: 1px solid var(--tw-line); backdrop-filter: blur(10px); pointer-events: auto; }
.tw-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; color: var(--tw-ink-2); }
.tw-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.tw-chip .svg-ico { width: 14px; height: 14px; }
.tw-chip:hover { background: rgba(255, 255, 255, .07); color: var(--tw-ink); }
.tw-chip.active { background: rgba(232, 66, 63, .22); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 107, 95, .45); }

.tw-panel {
  position: absolute; top: 14px; right: 14px; bottom: 86px; width: 356px; z-index: 2; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 16px 18px; border-radius: 14px; background: var(--tw-glass); border: 1px solid var(--tw-line); backdrop-filter: blur(14px);
  font-size: 13px; line-height: 1.6; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent;
}
.tw-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.tw-panel-head h3 { margin: 2px 0 0; font-family: var(--font-serif); font-size: 17px; line-height: 1.4; color: #fff; }
.tw-panel-head p { margin: 4px 0 0; color: var(--tw-ink-3); font-size: 12.5px; }
.tw-panel .icon-btn { color: var(--tw-ink-3); flex: none; }
.tw-panel .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.tw-kicker { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--tw-ink-3); }
.tw-kicker i, .tw-rule-body li i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c); box-shadow: 0 0 6px var(--c); }

.sev { display: inline-flex; align-items: center; flex: none; height: 19px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 650; letter-spacing: .04em; }
.sev-red { color: #ff8b85; background: rgba(255, 77, 79, .16); box-shadow: inset 0 0 0 1px rgba(255, 77, 79, .35); }
.sev-orange { color: #ffb672; background: rgba(255, 159, 67, .14); box-shadow: inset 0 0 0 1px rgba(255, 159, 67, .32); }
.sev-yellow { color: #f5d257; background: rgba(245, 210, 87, .12); box-shadow: inset 0 0 0 1px rgba(245, 210, 87, .3); }
.sev-info { color: #9cc3ff; background: rgba(127, 178, 255, .12); box-shadow: inset 0 0 0 1px rgba(127, 178, 255, .3); }

.tw-rules { display: flex; flex-direction: column; gap: 6px; }
.tw-rule { border-radius: 10px; border: 1px solid var(--tw-line); background: rgba(255, 255, 255, .025); }
.tw-rule-head { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; text-align: left; color: var(--tw-ink); border-radius: 10px; }
.tw-rule-head:hover:not(:disabled) { background: rgba(255, 255, 255, .05); }
.tw-rule-head:disabled { opacity: .45; cursor: default; }
.tw-rule-name { flex: 1; font-weight: 600; }
.tw-rule-n { font-variant-numeric: tabular-nums; font-weight: 700; color: #fff; }
.tw-rule-head > .svg-ico { width: 14px; height: 14px; color: var(--tw-ink-3); transition: transform .2s; }
.tw-rule.open .tw-rule-head > .svg-ico { transform: rotate(90deg); }
.tw-rule-body { display: none; padding: 0 10px 10px; }
.tw-rule.open .tw-rule-body { display: block; }
.tw-rule-body p { margin: 0 0 8px; color: var(--tw-ink-2); font-size: 12.5px; }
.tw-rule-body ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.tw-rule-body li button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border-radius: 6px; text-align: left; color: var(--tw-ink); font-size: 12.5px; }
.tw-rule-body li button:hover { background: rgba(255, 255, 255, .07); }
.tw-rule-body li small { margin-left: auto; color: var(--tw-ink-3); flex: none; }
.tw-note { display: flex; gap: 7px; margin: 14px 0 0; color: var(--tw-ink-3); font-size: 11.5px; line-height: 1.6; }
.tw-note .svg-ico { width: 14px; height: 14px; flex: none; margin-top: 2px; color: #d9b25f; }

.tw-closed { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .05); color: var(--tw-ink-2); font-size: 12.5px; }
.tw-closed .svg-ico { width: 15px; height: 15px; color: #d9b25f; }
.tw-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0 0 14px; border-radius: 10px; overflow: hidden; background: var(--tw-line); }
.tw-facts div { padding: 7px 10px; background: rgba(14, 19, 28, .9); }
.tw-facts dt { color: var(--tw-ink-3); font-size: 11.5px; }
.tw-facts dd { margin: 1px 0 0; color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.tw-sec { margin-top: 14px; }
.tw-sec h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 11.5px; letter-spacing: .12em; color: var(--tw-ink-3); }
.tw-sec h4 span { color: #ff8b85; }
.tw-find-item { padding: 10px 11px; border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px solid var(--tw-line); border-left: 3px solid var(--tw-ink-3); }
.tw-find-item + .tw-find-item { margin-top: 8px; }
.tw-find-item.lv-red { border-left-color: #ff4d4f; background: rgba(255, 77, 79, .05); }
.tw-find-item.lv-orange { border-left-color: #ff9f43; background: rgba(255, 159, 67, .04); }
.tw-find-item.lv-yellow { border-left-color: #f5d257; background: rgba(245, 210, 87, .035); }
.tw-find-item.lv-info { border-left-color: #7fb2ff; background: rgba(127, 178, 255, .04); }
.tw-find-head { display: flex; align-items: center; gap: 8px; }
.tw-find-head b { color: #fff; }
.tw-find-item p { margin: 6px 0 8px; color: var(--tw-ink-2); font-size: 12.5px; }
.tw-basis-list { display: flex; flex-direction: column; gap: 6px; }
.tw-basis { display: block; padding: 7px 9px; border-radius: 8px; background: rgba(0, 0, 0, .25); text-decoration: none; color: var(--tw-ink-2); transition: background .15s; }
.tw-basis:hover { background: rgba(232, 66, 63, .14); }
.tw-basis-label { display: flex; align-items: center; gap: 6px; color: #f0c987; font-size: 12px; font-weight: 600; }
.tw-basis-label .svg-ico { width: 13px; height: 13px; flex: none; }
.tw-basis q { display: block; margin-top: 3px; font-family: var(--font-serif); font-size: 12.5px; line-height: 1.65; color: var(--tw-ink-2); }
.tw-basis q::before { content: "“"; }
.tw-basis q::after { content: "”"; }
.tw-ok { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 10px; background: rgba(79, 179, 154, .1); color: #8fd8c3; font-size: 12.5px; }
.tw-ok .svg-ico { width: 15px; height: 15px; }
.tw-chain { list-style: none; margin: 0; padding: 0; position: relative; }
.tw-chain::before { content: ""; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 1px; background: linear-gradient(var(--tw-line), rgba(255, 107, 95, .5)); }
.tw-chain button { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 9px; width: 100%; padding: 5px 6px 5px 0; text-align: left; border-radius: 7px; color: var(--tw-ink); }
.tw-chain button:hover { background: rgba(255, 255, 255, .05); }
.tw-chain button[aria-current] .tw-chain-name { color: #fff; font-weight: 700; }
.tw-chain-lv { grid-row: span 2; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 700; background: #1b2330; border: 1px solid rgba(255, 255, 255, .16); color: var(--tw-ink-2); }
.tw-chain button[aria-current] .tw-chain-lv { background: #e8423f; border-color: #ff8b85; color: #fff; }
.tw-chain-name { font-size: 12.5px; line-height: 1.5; }
.tw-chain small { color: var(--tw-ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tw-holders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tw-holders li { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 7px; background: rgba(255, 255, 255, .03); font-size: 12.5px; }
.tw-holders li > button, .tw-holders li > span { flex: 1; min-width: 0; text-align: left; color: var(--tw-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-holders li > button:hover { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.tw-holders b { flex: none; font-variant-numeric: tabular-nums; color: #fff; }
.tag-red { flex: none; font-style: normal; font-size: 11px; padding: 0 6px; border-radius: 4px; color: #ff8b85; background: rgba(255, 77, 79, .14); }
.tw-remark { margin: 12px 0 0; padding: 9px 11px; border-radius: 8px; background: rgba(217, 178, 95, .08); color: #e9cf96; font-size: 12.5px; }
.tw-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tw-actions .ghost-btn { color: var(--tw-ink-2); border-color: var(--tw-line); background: rgba(255, 255, 255, .04); }
.tw-actions .ghost-btn:hover { color: #fff; background: rgba(255, 255, 255, .09); }

.tw-legend { position: absolute; left: 14px; bottom: 86px; z-index: 1; display: flex; flex-wrap: wrap; gap: 4px 14px; max-width: calc(100% - 400px); font-size: 11.5px; color: var(--tw-ink-3); pointer-events: none; }
.tw-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tw-legend i { display: inline-block; flex: none; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; background: #6f9bd1; }
.lg-dia { width: 8px; height: 8px; background: #a685c2; transform: rotate(45deg); }
.lg-tri { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid #d9b25f; }
.lg-ring { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #9aa3b5; }
.lg-glow { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px 2px var(--c); }
.lg-line { width: 16px; height: 2px; background: #ff4d4f; border-radius: 1px; }

.tw-time {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 2; display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 16px 0 10px;
  border-radius: 14px; background: var(--tw-glass); border: 1px solid var(--tw-line); backdrop-filter: blur(14px);
}
.tw-play { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #c8102e; box-shadow: 0 0 0 4px rgba(200, 16, 46, .2), 0 6px 16px -4px rgba(200, 16, 46, .7); }
.tw-play:hover { background: #e2223f; }
.tw-play .svg-ico { width: 16px; height: 16px; }
.tw-range { flex: 1; min-width: 0; padding-top: 10px; }
.tw-range input { width: 100%; accent-color: #e8423f; margin: 0; }
.tw-ticks { display: flex; justify-content: space-between; padding: 0 2px; font-size: 10.5px; color: var(--tw-ink-3); }
.tw-ticks span { width: 0; display: flex; justify-content: center; white-space: nowrap; }
.tw-stats { display: flex; align-items: baseline; gap: 16px; flex: none; font-size: 12.5px; color: var(--tw-ink-3); }
.tw-stats b { color: #fff; font-weight: 650; font-size: 13px; min-width: 92px; }
.tw-stats strong { font-size: 18px; color: #fff; font-variant-numeric: tabular-nums; margin: 0 2px; }
.tw-stats strong.over { color: #ff6b5f; }

.tw-tip {
  position: absolute; left: 0; top: 0; z-index: 3; max-width: 300px; padding: 8px 11px; border-radius: 10px; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--tw-ink-2);
  background: rgba(8, 12, 19, .92); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .7);
}
.tw-tip[hidden] { display: none; }
.tw-tip b { color: #fff; font-size: 13px; }
.tw-tip .sev { align-self: flex-start; margin-top: 4px; height: auto; padding: 2px 7px; }

.tw-name { display: flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 5px; font-size: 12px; white-space: nowrap; color: #fff; background: rgba(9, 13, 20, .72); border-left: 3px solid var(--c, #e8423f); transform: translateY(-50%); transition: opacity .2s; }
.tw-name span { color: #9aa6b8; font-size: 11px; }
.tw-name.dim { opacity: .25; }
.tw-name-hq { font-size: 13.5px; padding: 4px 10px; font-family: var(--font-serif); border-left-color: #d9b25f; background: rgba(120, 14, 24, .7); }
.tw-name-sel { color: #fff; font-weight: 600; background: rgba(200, 16, 46, .85); border-left-color: #ffd6d2; }
.tw-floor { font-size: 11px; letter-spacing: .1em; color: rgba(170, 190, 220, .6); white-space: nowrap; }
.tw-floor em, .tw-person em { font-style: normal; margin-left: 5px; padding: 0 5px; border-radius: 4px; }
.tw-floor.over { color: rgba(255, 140, 130, .85); }
.tw-floor em { color: #fff; background: rgba(255, 77, 79, .5); }
.tw-redline { padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; color: #ff8b85; border: 1px dashed rgba(255, 77, 79, .7); background: rgba(40, 8, 10, .6); white-space: nowrap; }
.tw-person { font-size: 11.5px; color: #ffc857; white-space: nowrap; }
.tw-person em { color: #1a1206; background: #ffc857; font-weight: 600; }

/* ============ map ============ */
.no-time .tw-panel { bottom: 14px; }
.no-time .tw-legend { bottom: 14px; align-items: center; }
.mp-ramp { display: inline-flex; align-items: center; gap: 6px; }
.mp-ramp i { width: 96px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--a), var(--b)); }
.mp-ramp em { font-style: normal; font-variant-numeric: tabular-nums; }
.mp-lg-pillar { width: 5px; height: 12px; border-radius: 2px; background: #e3b45f; box-shadow: 0 0 6px #e3b45f; }
.mp-lg-dash { width: 16px; height: 0; border-top: 2px dashed #ff6b5f; }
.mp-label { display: flex; align-items: baseline; gap: 4px; font-size: 11px; color: rgba(205, 215, 232, .55); white-space: nowrap; text-shadow: 0 1px 3px #000; transform: translateY(-50%); }
.mp-label.has { color: #e3e8f0; font-size: 11.5px; }
.mp-label b { font-size: 12.5px; color: #fff; font-variant-numeric: tabular-nums; }
.mp-sea { font-size: 10.5px; letter-spacing: .2em; color: rgba(184, 203, 232, .6); }
.mp-label.sel { padding: 2px 8px; border-radius: 5px; color: #fff; background: rgba(200, 16, 46, .85); text-shadow: none; }
.mp-sub { display: flex; flex-direction: column; padding: 2px 8px; border-radius: 5px; font-size: 11.5px; line-height: 1.35; color: #fff; white-space: nowrap; background: rgba(9, 13, 20, .72); border-left: 3px solid var(--c, #e8423f); transform: translateY(-100%); }
.mp-sub span { font-size: 10.5px; color: #9aa6b8; }
.mp-hq { font-family: var(--font-serif); font-size: 13px; border-left-color: #d9b25f; background: rgba(120, 14, 24, .78); }
.mp-case { display: flex; align-items: center; gap: 6px; padding: 2px 8px 2px 3px; border-radius: 999px; font-size: 11.5px; white-space: nowrap; color: #ffd6d2; background: rgba(40, 8, 12, .82); border: 1px solid rgba(255, 77, 79, .55); transform: translateY(-100%); pointer-events: auto; cursor: pointer; }
.mp-case b { padding: 0 6px; border-radius: 999px; font-size: 11px; color: #fff; background: #e5484d; }
.mp-case.s-ok { border-color: rgba(69, 181, 132, .55); color: #bfe8d6; }
.mp-case.s-ok b { background: #2f9b6c; }
.mp-case:hover { border-color: #fff; }
.mp-total { display: flex; align-items: baseline; gap: 8px; margin: -2px 0 4px; }
.mp-total b { font-size: 30px; line-height: 1.2; color: #fff; font-variant-numeric: tabular-nums; }
.mp-total span { color: var(--tw-ink-3); font-size: 12.5px; }
.mp-rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.mp-rank button { display: grid; grid-template-columns: 18px 92px minmax(0, 1fr) 32px; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border-radius: 6px; text-align: left; color: var(--tw-ink); font-size: 12.5px; }
.mp-rank button:hover { background: rgba(255, 255, 255, .07); }
.mp-rank-i { color: var(--tw-ink-3); font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.mp-rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-rank-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.mp-rank-bar i { display: block; height: 100%; border-radius: 3px; background: var(--c); box-shadow: 0 0 8px var(--c); }
.mp-rank b { text-align: right; color: #fff; font-variant-numeric: tabular-nums; }
.mp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.mp-list a { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 6px; color: var(--tw-ink); text-decoration: none; font-size: 12.5px; }
.mp-list a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.mp-list a > i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c); box-shadow: 0 0 6px var(--c); }
.mp-list a > .svg-ico { width: 14px; height: 14px; flex: none; color: #f0c987; }
.mp-list-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-list small { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tw-ink-3); font-size: 11.5px; }
.mp-more { margin: 6px 0 0; color: var(--tw-ink-3); font-size: 12px; }

/* ============ knowledge graph ============ */
.tw-chip small { font-size: 11px; color: var(--tw-ink-3); font-variant-numeric: tabular-nums; }
.gk-label { padding: 1px 7px; border-radius: 4px; font-size: 11.5px; white-space: nowrap; color: #e3e8f0; background: rgba(9, 13, 20, .62); transform: translateY(-50%); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.gk-label.t-topic { font-size: 13px; font-weight: 600; color: #bdf0e0; background: none; text-shadow: 0 1px 4px #000; }
.gk-label.t-rule, .gk-label.t-case, .gk-label.t-org { border-left: 3px solid var(--c); }
.gk-label.t-case { color: #ffd6d2; }
.gk-label.t-doc, .gk-label.t-publisher, .gk-label.t-region { font-size: 11px; color: #c3cad6; }
.gk-label.near { background: rgba(9, 13, 20, .85); }
.gk-label.sel { font-size: 13px; font-weight: 650; color: #fff; background: rgba(200, 16, 46, .88); border-left-color: #ffd6d2; max-width: 320px; }
.gk-types { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border-radius: 10px; overflow: hidden; background: var(--tw-line); }
.gk-types div { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: rgba(14, 19, 28, .9); font-size: 12.5px; color: var(--tw-ink-2); }
.gk-types i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c); box-shadow: 0 0 6px var(--c); }
.gk-types b { margin-left: auto; color: #fff; font-variant-numeric: tabular-nums; }
.gk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gk-chips button { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; color: #bdf0e0; background: rgba(79, 179, 154, .12); box-shadow: inset 0 0 0 1px rgba(79, 179, 154, .3); }
.gk-chips button:hover { background: rgba(79, 179, 154, .25); color: #fff; }
.gk-chips small { font-size: 11px; color: rgba(189, 240, 224, .6); font-variant-numeric: tabular-nums; }
.gk-desc { margin: 0; color: var(--tw-ink-2); font-size: 12.5px; line-height: 1.7; }
button.tw-basis { width: 100%; text-align: left; }
.mp-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px; border-radius: 6px; text-align: left; color: var(--tw-ink); font-size: 12.5px; }
.mp-list button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.mp-list button > i { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c); box-shadow: 0 0 6px var(--c); }
.tw-kicker .sev { margin-left: 4px; }

/* ============ look-through sandbox ============ */
.sb { padding: 6px 20px 32px; }
.sb-presets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.sb-preset {
  display: flex; flex-direction: column; gap: 4px; padding: 11px 13px; border-radius: 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.sb-preset b { font-size: 13.5px; color: var(--ink); }
.sb-preset span { font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.sb-preset:hover { border-color: var(--accent); transform: translateY(-1px); }
.sb-preset.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-1); }
.sb-preset.active b { color: var(--accent-ink); }

.sb-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
.sb-board { display: flex; flex-direction: column; min-width: 0; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); overflow: hidden; }
.sb-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line-2); }
.sb-bar-title { display: flex; flex-direction: column; min-width: 0; }
.sb-bar-title b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-bar-title span { font-size: 12px; color: var(--ink-3); }
.sb-bar-actions { display: flex; gap: 6px; flex: none; }
.sb-bar-actions .ghost-btn:disabled { opacity: .45; cursor: default; }
.sb-chart { position: relative; min-height: 460px; padding: 12px; background: radial-gradient(var(--paper-dot) 1px, transparent 1.2px) 0 0 / 18px 18px; }
.sb-chart { display: flex; overflow: auto; }
.sb-svg { margin: auto; flex: none; user-select: none; }
.sb-node { cursor: pointer; transition: transform .45s var(--ease); }
.sb-node .box { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; transition: stroke .2s; }
.sb-node:hover .box { stroke: var(--ink-4); }
.sb-node text { text-anchor: middle; pointer-events: none; }
.sb-node .nm { font-size: 13px; font-weight: 600; fill: var(--ink); }
.sb-node .tg { font-size: 11px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.sb-node.k-minority .box { stroke-dasharray: 5 3; }
.sb-node.k-external .box, .sb-node.k-person .box { fill: var(--surface-3); stroke-dasharray: 5 3; }
.sb-node.k-person .box { stroke: var(--gold); }
.sb-node.root .box { fill: var(--accent); stroke: var(--accent); }
.sb-node.root .nm, .sb-node.root .tg { fill: #fff; }
.sb-node.s-red .box { stroke: #e5484d; stroke-width: 2; }
.sb-node.s-orange .box { stroke: #f08c2e; stroke-width: 2; }
.sb-node.s-yellow .box { stroke: #d6a923; stroke-width: 2; }
.sb-node.s-red .tg { fill: #e5484d; }
.sb-node.s-orange .tg { fill: #d9761a; }
.sb-node.s-yellow .tg { fill: #b08a12; }
.sb-node.s-red .dot { fill: #e5484d; }
.sb-node.s-orange .dot { fill: #f08c2e; }
.sb-node.s-yellow .dot { fill: #d6a923; }
.sb-node.s-red .box { filter: drop-shadow(0 0 6px rgba(229, 72, 77, .35)); }
.sb-node.sel .box { stroke: var(--accent); stroke-width: 2.6; filter: drop-shadow(0 0 8px var(--accent-soft-2)); }
.sb-edges { opacity: 0; }
.sb-edges.in { animation: sb-edges .3s .3s var(--ease) forwards; }
@keyframes sb-edges { to { opacity: 1; } }
.sb-edge { fill: none; stroke: var(--ink-4); stroke-width: 1.4; }
.ctl .sb-edge { stroke: var(--ink-3); stroke-width: 1.7; }
.minor .sb-edge { stroke-dasharray: 5 4; }
.cyc .sb-edge { stroke: #e5484d; stroke-width: 1.8; }
.nom .sb-edge { stroke: var(--gold); }
.sb-arrow { fill: var(--ink-3); }
.sb-arrow.red { fill: #e5484d; }
.sb-arrow.gold { fill: var(--gold); }
.sb-pct rect { fill: var(--surface); stroke: var(--line); }
.sb-pct text { font-size: 11px; font-weight: 600; text-anchor: middle; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.cyc .sb-pct text { fill: #e5484d; }
.cyc .sb-pct rect { stroke: rgba(229, 72, 77, .5); }
.nom .sb-pct text { fill: var(--gold); }
.sb-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--ink-3); font-size: 13.5px; }
.sb-loading .svg-ico { width: 24px; height: 24px; color: var(--accent); }
.sb-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 9px 16px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-3); }
.sb-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sb-legend i { display: inline-block; flex: none; }
.sl-box { width: 16px; height: 10px; border-radius: 3px; border: 1px solid var(--ink-4); background: var(--surface); }
.sl-dia { width: 16px; height: 10px; background: var(--surface); border: 1px solid var(--ink-4); clip-path: polygon(15% 0, 85% 0, 100% 50%, 85% 100%, 15% 100%, 0 50%); }
.sl-ext { width: 16px; height: 10px; border-radius: 3px; border: 1px dashed var(--ink-4); background: var(--surface-3); }
.sl-line, .sl-dash, .sl-red { width: 18px; height: 0; border-top: 2px solid var(--ink-3); }
.sl-dash { border-top-style: dashed; border-top-color: var(--ink-4); }
.sl-red { border-top-color: #e5484d; }
.sb-hint { margin-left: auto; color: var(--ink-4); }

.sb-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sb-card { padding: 14px 15px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); font-size: 13px; }
.sb-card h4 { margin: 0 0 10px; font-size: 11.5px; letter-spacing: .12em; color: var(--ink-3); }
.sb-status { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; }
.sb-status > .svg-ico { width: 22px; height: 22px; flex: none; }
.sb-status div { display: flex; flex-direction: column; }
.sb-status b { font-size: 14.5px; }
.sb-status span { font-size: 12px; color: var(--ink-3); }
.sb-status.ok { background: rgba(31, 138, 91, .08); color: var(--down); }
.sb-status.bad { background: var(--accent-soft); color: var(--accent-ink); }
.sb-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.sb-kpis div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line-2); }
.sb-kpis span { font-size: 11.5px; color: var(--ink-3); }
.sb-kpis b { font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.sb-kpis b small { font-size: 12px; font-weight: 500; margin-left: 2px; color: var(--ink-3); }
.sb-kpis b.over { color: var(--accent); }

.sev-pill { display: inline-flex; align-items: center; flex: none; height: 19px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 650; letter-spacing: .04em; }
.sev-pill-red { color: #c4232b; background: rgba(229, 72, 77, .12); }
.sev-pill-orange { color: #b45d0c; background: rgba(240, 140, 46, .14); }
.sev-pill-yellow { color: #8c6a00; background: rgba(214, 169, 35, .16); }
.sev-pill-info { color: #2f63ad; background: rgba(76, 134, 214, .12); }
:root[data-theme="dark"] .sev-pill-red { color: #ff8b85; }
:root[data-theme="dark"] .sev-pill-orange { color: #ffb672; }
:root[data-theme="dark"] .sev-pill-yellow { color: #f5d257; }
:root[data-theme="dark"] .sev-pill-info { color: #9cc3ff; }

.sb-findings { display: flex; flex-direction: column; gap: 8px; }
.sb-finding { padding: 10px 11px; border-radius: 10px; border: 1px solid var(--line-2); border-left: 3px solid var(--ink-4); background: var(--surface-2); }
.sb-finding.lv-red { border-left-color: #e5484d; }
.sb-finding.lv-orange { border-left-color: #f08c2e; }
.sb-finding.lv-yellow { border-left-color: #d6a923; }
.sb-finding.lv-info { border-left-color: #4c86d6; }
.sb-finding-head { display: flex; align-items: center; gap: 8px; }
.sb-entity { display: block; margin-top: 5px; text-align: left; font-weight: 600; color: var(--ink); font-size: 13px; }
.sb-entity:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.sb-finding p { margin: 3px 0 6px; color: var(--ink-2); font-size: 12.5px; line-height: 1.6; }
.sb-finding details summary { cursor: pointer; font-size: 12px; color: var(--ink-3); width: max-content; }
.sb-finding details summary:hover { color: var(--accent-ink); }
.sb-basis { display: block; margin-top: 6px; padding: 7px 9px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-2); text-decoration: none; color: var(--ink-2); }
.sb-basis:hover { border-color: var(--accent); }
.sb-basis span { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--gold); }
.sb-basis span .svg-ico { width: 13px; height: 13px; }
.sb-basis q { display: block; margin-top: 2px; font-family: var(--font-serif); font-size: 12.5px; line-height: 1.6; }
.sb-fix {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; height: 28px; padding: 0 11px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); border: 1px solid var(--accent-soft-2);
}
.sb-fix:hover { background: var(--accent); color: #fff; }
.sb-fix .svg-ico { width: 14px; height: 14px; }

.sb-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sb-table th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--ink-3); padding: 0 6px 6px; border-bottom: 1px solid var(--line); }
.sb-table td { padding: 6px; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.sb-table td:first-child { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-table th:not(:first-child), .sb-table td:not(:first-child) { text-align: right; white-space: nowrap; }
.sb-table tbody tr { cursor: pointer; }
.sb-table tbody tr:hover, .sb-table tbody tr.on { background: var(--accent-soft); }
.sb-foot { margin: 8px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--ink-4); }
.sb-log { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.sb-actions { display: flex; justify-content: flex-end; }

.sb-editor { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-1); }
.sb-editor-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -4px 6px 0; }
.sb-editor-head h4 { margin: 0; }
.sb-field { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }
.sb-field input, .sb-field select, .sb-holder input, .sb-holder select {
  height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 13px; min-width: 0;
}
.sb-field input:focus, .sb-field select:focus, .sb-holder input:focus, .sb-holder select:focus { outline: none; border-color: var(--accent); }
.sb-checks { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 0 52px; font-size: 12.5px; color: var(--ink-2); }
.sb-checks label { display: inline-flex; align-items: center; gap: 6px; }
.sb-checks input { accent-color: var(--accent); }
.sb-holders { margin-top: 12px; }
.sb-sub { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 4px; }
.sb-sub .warn { color: var(--accent); }
.sb-holder { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 12.5px; color: var(--ink-3); }
.sb-holder > span { flex: 1; min-width: 0; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-holder input[type="number"] { width: 72px; flex: none; text-align: right; }
.sb-holder select { flex: 1; }
.sb-holder .icon-btn { width: 28px; height: 28px; flex: none; }
.sb-editor-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ghost-btn.danger:hover { color: var(--accent); border-color: var(--accent); }

/* ============ fund flow ============ */
.fl { padding: 6px 20px 32px; }
.fl-kpis { display: flex; flex: none; gap: 4px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.fl-kpis > div { display: flex; flex-direction: column; min-width: 104px; padding: 4px 12px; }
.fl-kpis > div + div { border-left: 1px solid var(--line-2); }
.fl-kpis span { font-size: 11.5px; color: var(--ink-3); }
.fl-kpis b { font-size: 22px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.fl-kpis b.hot { color: var(--accent); }
.fl-kpis small { margin-left: 3px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.fl-kpis em { font-style: normal; font-size: 11.5px; color: var(--ink-4); }

.fl-cases { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.fl-case {
  position: relative; display: flex; flex-direction: column; gap: 7px; padding: 11px 13px 11px 16px; border-radius: 12px; text-align: left; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.fl-case::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ink-4); }
.fl-case.lv-red::before { background: #e5484d; }
.fl-case.lv-orange::before { background: #f08c2e; }
.fl-case.lv-yellow::before { background: #d6a923; }
.fl-case:hover { transform: translateY(-1px); border-color: var(--ink-4); }
.fl-case.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-1); }
.fl-case-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.fl-case > b { font-size: 13.5px; line-height: 1.45; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fl-case.active > b { color: var(--accent-ink); }
.fl-case-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: auto; font-size: 12px; color: var(--ink-3); }
.fl-case-meta strong { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fl-status { flex: none; padding: 0 7px; border-radius: 999px; border: 1px solid currentColor; font-size: 11px; font-weight: 600; line-height: 17px; }
.fl-status.s-red { color: #d4343b; }
.fl-status.s-orange { color: #c46a12; }
.fl-status.s-ok { color: var(--down); }
:root[data-theme="dark"] .fl-status.s-red { color: #ff8b85; }
:root[data-theme="dark"] .fl-status.s-orange { color: #ffb672; }

.fl-left { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.fl-chart { min-height: 420px; }
.fl-svg { margin: auto; flex: none; overflow: visible; }
.fl-e { --s: var(--ink-3); transition: opacity .35s; }
.fl-e.group { --s: var(--gold); }
.fl-e.alert { --s: #e5484d; }
.fl-line, .fl-run { fill: none; stroke: var(--s); stroke-width: var(--w); stroke-linecap: round; }
.fl-line { stroke-opacity: .28; transition: stroke-opacity .3s; }
.fl-run { stroke-dasharray: 5 13; animation: fl-run 1.1s linear infinite; }
.fl-e.on .fl-line { stroke-opacity: .6; }
.fl-e.on .fl-run { animation-duration: .4s; }
.fl-e.pending, .fl-tag.pending { opacity: .12; }
@keyframes fl-run { to { stroke-dashoffset: -18; } }
.fl-arrow { fill: var(--ink-3); }
.fl-arrow.group { fill: var(--gold); }
.fl-arrow.alert { fill: #e5484d; }
.fl-tag { display: flex; align-items: center; justify-content: center; height: 100%; transition: opacity .35s; }
.fl-tag span {
  padding: 1px 8px; border-radius: 999px; white-space: nowrap; font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums;
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: border-color .2s, color .2s;
}
.fl-tag small { margin-left: 5px; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.fl-tag.back span { color: #d4343b; border-color: rgba(229, 72, 77, .45); }
.fl-tag.on span { color: var(--accent-ink); border-color: var(--accent); }
.fl-node {
  box-sizing: border-box; height: 100%; display: flex; flex-direction: column; gap: 2px; padding: 7px 11px 8px; overflow: hidden; cursor: pointer;
  border-radius: 11px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--c); box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s;
}
.fl-node:hover { border-color: var(--ink-4); border-top-color: var(--c); }
.fl-node.root { box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-1); }
.fl-node.sel { border-color: var(--accent); border-top-color: var(--c); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.fl-node.k-company { background: var(--surface-2); border-style: dashed; border-top-style: solid; }
.fl-node.k-person, .fl-node.k-unknown, .fl-node.k-account { background: color-mix(in srgb, #e5484d 7%, var(--surface)); border-color: rgba(229, 72, 77, .5); border-style: dashed; border-top-style: solid; }
.fl-node-kind { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-node-kind i { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--c); }
.fl-node > b { font-size: 12.5px; line-height: 1.4; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fl-node-sum { display: flex; gap: 8px; margin-top: auto; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fl-node-sum .in { color: var(--ink-2); }
.fl-token { fill: var(--gold); opacity: 0; filter: drop-shadow(0 0 5px var(--gold)); pointer-events: none; }
.fl-token.alert { fill: #e5484d; filter: drop-shadow(0 0 5px #e5484d); }
.fll-box { width: 14px; height: 10px; border-radius: 3px; border: 1.5px solid var(--ink-4); border-top: 3px solid var(--gold); }
.fll-box.a { border-top-color: var(--ink-3); }
.fll-box.x { border-style: dashed; border-top: 3px solid var(--ink-4); }
.fll-box.r { border-style: dashed; border-color: #e5484d; border-top: 3px solid #e5484d; }
.fll-arc { width: 16px; height: 8px; border: 2px solid #e5484d; border-top: 0; border-radius: 0 0 9px 9px; }
.fl-step { margin-left: 10px; color: var(--accent-ink); font-weight: 650; }

.fl-ledger-scroll { position: relative; max-height: 292px; overflow: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.fl-table th { position: sticky; top: 0; z-index: 1; padding-top: 2px; background: var(--surface); }
.sb-table.fl-table th:not(:first-child), .sb-table.fl-table td:not(:first-child) { text-align: left; }
.sb-table.fl-table th:nth-child(5), .sb-table.fl-table td:nth-child(5) { text-align: right; }
.fl-table td:first-child { width: 24px; color: var(--ink-4); }
.fl-table td:nth-child(3), .fl-table td:nth-child(4) { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-table td small { display: block; font-size: 11px; color: var(--ink-4); }
.fl-table td small.dup { color: #d4343b; font-weight: 600; }
.fl-table tr.pending { opacity: .35; }

.fl-brief { border-top: 3px solid var(--ink-4); }
.fl-brief.lv-red { border-top-color: #e5484d; }
.fl-brief.lv-orange { border-top-color: #f08c2e; }
.fl-brief.lv-yellow { border-top-color: #d6a923; }
.fl-brief-head { display: flex; align-items: center; gap: 8px; }
.fl-brief-head b { flex: 1; font-size: 13px; }
.fl-brief h3, .fl-party h3 { margin: 10px 0 6px; font-family: var(--font-serif); font-size: 17px; line-height: 1.45; }
.fl-brief p { margin: 0; color: var(--ink-2); line-height: 1.7; }
.fl-party .fl-node-kind { font-size: 12px; }
.fl-findings { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); line-height: 1.65; }
.fl-findings li::marker { color: var(--accent); font-weight: 700; }
.fl-rule-desc { margin: 0 0 4px; color: var(--ink-2); font-size: 12.5px; line-height: 1.65; }
.fl-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fl-others tbody tr { cursor: default; }
.fl-others td.in { color: var(--down); }
.fl-others td.out { color: var(--accent-ink); }
.fl-empty { margin: 0; color: var(--ink-3); font-size: 12.5px; }

/* ============ data coverage ============ */
.cv { padding: 6px 20px 32px; }
.cv-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cv-chips { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); flex: none; }
.cv-chip { height: 26px; padding: 0 11px; border-radius: 7px; font-size: 12.5px; color: var(--ink-3); }
.cv-chip:hover { color: var(--ink); }
.cv-chip.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.cv-map { position: relative; min-height: 420px; padding: 18px; display: flex; justify-content: center; background: radial-gradient(var(--paper-dot) 1px, transparent 1.2px) 0 0 / 18px 18px; }
.cv-tiles { display: grid; grid-template-columns: repeat(9, 68px); grid-auto-rows: 52px; gap: 5px; }
.cv-tile {
  --t: color-mix(in srgb, var(--accent) 6%, var(--surface));
  position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 6px 7px; border-radius: 8px;
  background: var(--t); border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line)); text-align: left; color: var(--ink);
  transition: transform .15s var(--ease), box-shadow .15s;
}
.cv-tile b { font-size: 12px; font-weight: 600; line-height: 1.2; }
.cv-tile strong { font-size: 17px; line-height: 1; font-variant-numeric: tabular-nums; }
.cv-tile i { position: absolute; top: 5px; right: 5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 4px; font-style: normal; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; color: var(--gold); background: var(--surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 45%, transparent); }
button.cv-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); z-index: 1; }
.cv-tile.l1 { --t: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.cv-tile.l2 { --t: color-mix(in srgb, var(--accent) 34%, var(--surface)); }
.cv-tile.l3 { --t: color-mix(in srgb, var(--accent) 58%, var(--surface)); color: #fff; }
.cv-tile.l4 { --t: var(--accent); color: #fff; }
.cv-tile.l0 { color: var(--ink-3); }
.cv-tile.gap { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 5px, var(--accent-soft-2) 5px, var(--accent-soft-2) 7px); border: 1px dashed var(--accent); color: var(--accent-ink); }
.cv-tile.central { border-width: 2px; border-color: var(--gold); }
.cv-tile.on { outline: 2px solid var(--ink); outline-offset: 2px; z-index: 2; }
.cv-tile.out { background: var(--surface-3); border: 1px dashed var(--line); color: var(--ink-4); }
.cv-tile.out span { font-size: 11px; }
.cv-sw { width: 14px; height: 10px; border-radius: 3px; border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line)); }
.cv-sw.l0 { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.cv-sw.l1 { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.cv-sw.l2 { background: color-mix(in srgb, var(--accent) 34%, var(--surface)); }
.cv-sw.l3 { background: color-mix(in srgb, var(--accent) 58%, var(--surface)); }
.cv-sw.l4 { background: var(--accent); }
.cv-sw.gap { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 2px, var(--accent-soft-2) 2px, var(--accent-soft-2) 4px); border: 1px dashed var(--accent); }
.cv-sw.out { background: var(--surface-3); border: 1px dashed var(--line); }
.cv-sw.md { background: color-mix(in srgb, var(--ink-4) 45%, var(--surface)); border-color: var(--line); }

.cv-mx { display: grid; grid-template-columns: 112px repeat(var(--n), minmax(14px, 1fr)); gap: 3px; align-items: center; overflow-x: auto; padding-bottom: 2px; }
.cv-mx-col { writing-mode: vertical-rl; font-size: 11px; color: var(--ink-3); padding: 2px 0 4px; justify-self: center; letter-spacing: .05em; }
.cv-mx-col:hover, .cv-mx-col.on { color: var(--accent-ink); font-weight: 650; }
.cv-mx-row { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }
.cv-mx-cell { display: inline-block; height: 16px; min-width: 12px; border-radius: 3px; cursor: pointer; }
.cv-mx-cell.done { background: var(--c4); }
.cv-mx-cell.part { background: color-mix(in srgb, var(--gold) 70%, var(--surface)); }
.cv-mx-cell.todo { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); }
.cv-mx-legend { padding: 10px 0 0; border: 0; }
.cv-mx-legend .cv-mx-cell { width: 14px; height: 12px; cursor: default; }

.cv-meta-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.cv-meta-head h4 { margin: 0; }
.cv-search { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-3); }
.cv-search .svg-ico { width: 14px; height: 14px; }
.cv-search input { width: 180px; border: 0; outline: 0; background: none; font-size: 12.5px; color: var(--ink); }
.cv-meta-table tbody tr { cursor: default; }
.cv-meta-table td { vertical-align: top; }
.cv-meta-table td:first-child { max-width: 360px; white-space: normal; }
.cv-meta-table td small { display: block; font-size: 11px; color: var(--ink-4); }
.cv-meta-table td:nth-child(3) { white-space: normal; text-align: left; }
.cv-meta-table th:nth-child(3) { text-align: left; }
.cv-meta-table a { color: var(--c2); text-decoration: none; }
.cv-meta-table a:hover { text-decoration: underline; }
.cv-untitled { color: var(--ink-4); }
.cv-reason { display: inline-block; margin: 0 4px 3px 0; padding: 0 6px; border-radius: 5px; font-size: 11px; line-height: 18px; color: var(--ink-3); background: var(--surface-3); }
.cv-meta-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--ink-3); }

.cv-central { border-top: 3px solid var(--accent); }
.cv-central-head { display: flex; align-items: center; gap: 8px; color: var(--accent-ink); font-size: 12.5px; }
.cv-central-head .svg-ico { width: 16px; height: 16px; flex: none; }
.cv-central h3, .cv-region h3 { margin: 10px 0 6px; font-family: var(--font-serif); font-size: 16.5px; line-height: 1.5; }
.cv-central p { margin: 0 0 8px; color: var(--ink-2); line-height: 1.7; }
.cv-gaps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.cv-gaps li { padding: 8px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); }
.cv-gaps b { display: block; margin-top: 3px; font-size: 13px; line-height: 1.5; }
.cv-gaps p { margin: 3px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.cv-gap-region { font-size: 11px; font-weight: 650; letter-spacing: .06em; color: var(--accent-ink); }
.cv-types { display: flex; flex-direction: column; gap: 7px; }
.cv-type { display: grid; grid-template-columns: 116px minmax(0, 1fr) 44px; align-items: center; gap: 8px; font-size: 12px; }
.cv-type > span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-bar { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: var(--surface-3); }
.cv-bar .ft { background: color-mix(in srgb, var(--accent) 58%, var(--surface)); }
.cv-bar .md { background: color-mix(in srgb, var(--ink-4) 45%, var(--surface)); }
.cv-type em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.cv-type em small { margin-left: 2px; color: var(--ink-4); font-size: 11px; }
.cv-type-legend { padding: 10px 0 0; border: 0; }
.cv-split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cv-split > div { padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line-2); }
.cv-split .real { background: color-mix(in srgb, var(--c4) 7%, var(--surface)); }
.cv-split .demo { background: var(--gold-soft); border-style: dashed; border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.cv-split b { font-size: 12.5px; }
.cv-split ul { margin: 6px 0 0; padding-left: 16px; font-size: 12px; line-height: 1.65; color: var(--ink-2); }
.cv-region-head { display: flex; align-items: center; justify-content: space-between; }
.cv-region-head h3 { margin: 0; font-size: 20px; }
.cv-note { margin: 10px 0; font-size: 12.5px; line-height: 1.65; color: var(--ink-2); }
.cv-note b { color: var(--accent-ink); margin-right: 4px; }
.cv-sub { margin: 14px 0 8px !important; }
.cv-depts, .cv-cities { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.cv-depts li { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.cv-depts .cv-mx-cell { width: 12px; height: 12px; flex: none; cursor: default; }
.cv-cities li { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 7px 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-2); }
.cv-cities b { font-size: 13px; }
.cv-cities span { font-size: 12px; color: var(--ink-3); text-align: right; }
.cv-cities span.hit { color: var(--c4); font-weight: 600; }
.cv-cities small { grid-column: 1 / -1; font-size: 11.5px; line-height: 1.55; color: var(--ink-4); }

/* ============ case theatre & self-check ============ */
.cs { padding: 6px 20px 32px; }
.cs-tabs { align-self: flex-end; flex: none; }
.cs-tabs .cv-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; }
.cs-tabs .svg-ico { width: 14px; height: 14px; }
.cs-body { position: relative; min-height: 240px; }
.cs-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cs-card::before { background: var(--c); }
.cs-card.on { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent), var(--shadow-1); }
.cs-area { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--c, var(--accent-ink)); }
.cs-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--c); }
.cs-sub { display: inline-flex; align-items: center; font-size: 12px; color: var(--ink-3); }
.cs-demo { margin-left: auto; padding: 0 7px; border-radius: 999px; border: 1px dashed color-mix(in srgb, var(--gold) 55%, transparent); font-size: 11px; font-weight: 650; color: var(--gold); }
.cs-mini { flex: none; font-size: 11px; font-weight: 650; color: var(--ink-4); }
.cs-mini.ok { color: var(--down); }
.cs-mini.mid { color: #c46a12; }
.cs-mini.bad { color: #d4343b; }
.cs-stage { border-top: 3px solid var(--c); }
.cs-scene { padding: 16px 18px 4px; }
.cs-scene-head { display: flex; align-items: center; gap: 10px; }
.cs-scene h2 { margin: 8px 0 10px; font-family: var(--font-serif); font-size: 18px; line-height: 1.45; }
.cs-scene .fl-findings { margin-bottom: 4px; }
.cs-dossier { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 2px; }
.cs-ev { min-width: 0; padding: 10px 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line-2); overflow: hidden; }
.cs-ev h5 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 11.5px; letter-spacing: .12em; color: var(--ink-3); }
.cs-ev h5 .svg-ico { width: 13px; height: 13px; }
.cs-ev p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }
.cs-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cs-rows li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1px 8px; align-items: baseline; font-size: 12.5px; line-height: 1.45; }
.cs-rows span { color: var(--ink-4); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-rows b { grid-column: 1 / -1; min-width: 0; font-weight: 600; }
.cs-rows em { justify-self: end; font-style: normal; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-question { padding: 4px 18px 16px; }
.cs-question h3 { margin: 12px 0 10px; font-family: var(--font-serif); font-size: 17px; line-height: 1.45; }
.cs-options { display: flex; flex-direction: column; gap: 8px; }
.cs-opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; text-align: left; background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, background .15s; }
.cs-opt:hover:not(:disabled) { border-color: var(--accent); }
.cs-opt b { flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-3); font-size: 12px; line-height: 22px; text-align: center; color: var(--ink-2); }
.cs-opt span { font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.cs-opt.dim { opacity: .45; }
.cs-opt.answer { border-color: var(--down); }
.cs-opt.picked.ok { border-color: var(--down); background: color-mix(in srgb, var(--down) 8%, var(--surface)); }
.cs-opt.picked.mid { border-color: #d6a923; background: color-mix(in srgb, #d6a923 10%, var(--surface)); }
.cs-opt.picked.bad { border-color: #e5484d; background: color-mix(in srgb, #e5484d 8%, var(--surface)); }
.cs-opt:disabled { cursor: default; }
.cs-verdict { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); }
.cs-verdict.ok { border-color: color-mix(in srgb, var(--down) 40%, var(--line)); background: color-mix(in srgb, var(--down) 8%, var(--surface)); }
.cs-verdict.mid { border-color: color-mix(in srgb, #d6a923 45%, var(--line)); background: color-mix(in srgb, #d6a923 10%, var(--surface)); }
.cs-verdict.bad { border-color: color-mix(in srgb, #e5484d 40%, var(--line)); background: color-mix(in srgb, #e5484d 8%, var(--surface)); }
.cs-verdict-head { display: flex; align-items: center; gap: 8px; }
.cs-verdict-head .svg-ico { width: 16px; height: 16px; }
.cs-verdict.ok .cs-verdict-head { color: var(--down); }
.cs-verdict.mid .cs-verdict-head { color: #a37b08; }
.cs-verdict.bad .cs-verdict-head { color: #d4343b; }
.cs-verdict-head span { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.cs-verdict p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.cs-analysis { margin-top: 12px; }
.cs-analysis h4 { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .12em; color: var(--ink-3); }
.cs-analysis ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; line-height: 1.65; color: var(--ink-2); }
.cs-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-4); }
.cs-basis { display: flex; flex-direction: column; gap: 6px; }
.cs-locked { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-3); font-size: 12.5px; }
.cs-locked .svg-ico { width: 15px; height: 15px; }
.cs .fl-actions .ghost-btn, .cs .fl-actions .primary-btn { max-width: 100%; height: auto; min-height: 32px; white-space: normal; text-align: left; }
.cs-progress { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-3); }
.cs-progress b { color: var(--ink); font-variant-numeric: tabular-nums; }
.cs-progress b.ok { color: var(--down); }
.cs-note { margin-top: 4px; }
.cs-check { display: flex; flex-direction: column; gap: 12px; }
.cs-group h4 { letter-spacing: .08em; }
.cs-item { padding: 10px 0; border-top: 1px solid var(--line-2); }
.cs-item-q { display: flex; gap: 8px; align-items: baseline; }
.cs-item-id { flex: none; font-size: 11px; font-weight: 700; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.cs-item-q p { margin: 0; font-size: 13.5px; line-height: 1.6; }
.cs-seg { display: flex; gap: 4px; margin: 8px 0 0 28px; }
.cs-seg button { height: 26px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); background: var(--surface); }
.cs-seg button.on { font-weight: 650; }
.cs-seg .yes.on { color: var(--down); border-color: var(--down); background: color-mix(in srgb, var(--down) 10%, var(--surface)); }
.cs-seg .part.on { color: #a37b08; border-color: #d6a923; background: color-mix(in srgb, #d6a923 14%, var(--surface)); }
.cs-seg .no.on, .cs-seg .unknown.on { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.cs-why { margin: 6px 0 0 28px; font-size: 12px; color: var(--ink-3); }
.cs-why summary { cursor: pointer; width: max-content; }
.cs-why .sb-basis { margin-top: 6px; }
.cs-check-foot { display: flex; justify-content: flex-end; }
.cs-score { display: flex; align-items: center; gap: 14px; }
.cs-ring { position: relative; width: 84px; height: 84px; flex: none; }
.cs-ring svg { width: 84px; height: 84px; transform: rotate(-90deg); }
.cs-ring circle { fill: none; stroke: var(--surface-3); stroke-width: 7; }
.cs-ring circle.v { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .4s var(--ease); }
.cs-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; font-variant-numeric: tabular-nums; }
.cs-ring small { margin-left: 1px; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.cs-score-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cs-score-text span { font-size: 12px; line-height: 1.6; color: var(--ink-3); }
.cs-area-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 28px; align-items: center; gap: 8px; margin-top: 7px; font-size: 12px; }
.cs-area-row span { color: var(--ink-2); }
.cs-area-row em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; }
.cs-todo ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 12px; }
.cs-todo li { font-size: 13px; line-height: 1.6; }
.cs-todo li b { font-weight: 600; }
.cs-todo li p { margin: 3px 0; color: var(--ink-2); }
.cs-ans { margin-left: 6px; font-size: 11px; font-weight: 650; color: var(--accent-ink); }
.cs-ans.part { color: #a37b08; }
.cs-todo details { margin-top: 4px; }
.cs-todo summary { cursor: pointer; font-size: 12px; color: var(--ink-3); width: max-content; }

@media (max-width: 1180px) {
  .fl-cases { display: flex; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; }
  .fl-case { flex: none; width: 236px; }
  .sb-grid { grid-template-columns: minmax(0, 1fr); }
  .sb-presets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tw-legend { display: none; }
}
@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reader-layout { grid-template-columns: minmax(0, 1fr); }
  .reader-rail { position: static; max-height: none; order: -1; }
  .reader-toc { display: none; }
  .reader-rail .rail-group { display: none; }
}
@media (max-width: 900px) {
  .lib { padding: 8px 16px 48px; }
  .lib-body { grid-template-columns: minmax(0, 1fr); }
  .lib-facets { position: static; flex-direction: row; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
  .facet-group { flex: none; display: flex; gap: 6px; }
  .facet-group .facet { display: none; }
  .facet-group h4 { display: none; }
  .lib-facets .facet.on, .lib-facets .facet-group:first-child .facet { display: flex; width: auto; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; gap: 6px; }
  .lib-facets .facet-more { display: none; }
  .reader-doc { padding: 22px 18px 28px; }
  .mod-grid { grid-template-columns: minmax(0, 1fr); }
  .tw, .sb, .fl, .cv, .cs { padding: 4px 12px 24px; }
  .cs-tabs { align-self: stretch; }
  .cs-tabs .cv-chip { flex: 1; justify-content: center; }
  .cs-strip { display: flex; overflow-x: auto; }
  .cs-card { flex: none; width: 210px; }
  .cs-dossier { grid-template-columns: minmax(0, 1fr); }
  .cv-map { overflow-x: auto; justify-content: flex-start; padding: 12px; }
  .cv-tiles { grid-template-columns: repeat(9, 52px); grid-auto-rows: 44px; gap: 4px; }
  .cv-tile strong { font-size: 14px; }
  .cv-meta-head { flex-wrap: wrap; }
  .cv-meta-table td:nth-child(4), .cv-meta-table th:nth-child(4) { display: none; }
  .fl-kpis { overflow-x: auto; }
  .fl-kpis > div { min-width: 0; flex: 1; }
  .tw-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .tw-find { width: auto; }
  .tw-stage { height: auto; display: flex; flex-direction: column; }
  .tw-canvas { position: relative; height: 62vh; min-height: 380px; flex: none; }
  .tw-toolbar { right: 10px; left: 10px; top: 10px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tw-chips { flex-wrap: nowrap; flex: none; }
  .tw-time { position: relative; inset: auto; margin: 0 10px; flex-wrap: wrap; height: auto; padding: 10px 12px; row-gap: 6px; }
  .tw-stats { width: 100%; justify-content: space-between; gap: 8px; }
  .tw-stats b { min-width: 0; }
  .tw-panel { position: relative; inset: auto; width: auto; margin: 10px; max-height: none; }
  .sb-presets { display: flex; overflow-x: auto; scrollbar-width: none; }
  .sb-preset { flex: none; width: 200px; }
  .sb-bar { flex-wrap: wrap; }
  .sb-bar-actions .ghost-btn span { display: none; }
  .sb-hint { display: none; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(86vw, var(--sidebar-w)); z-index: 40;
    transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-3);
  }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-close { display: inline-grid; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .28); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 10px; }
  .is-home .topbar { display: flex; position: absolute; top: 10px; left: 10px; height: auto; padding: 0; z-index: 5; }
  .is-home .menu-btn { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
  .thread { padding: 12px 16px 32px; }
  .home { padding: 16px 16px 32px; }
  .composer-wrap { padding: 6px 12px 10px; }
  .src-list { grid-template-columns: minmax(0, 1fr); }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-actions .primary-btn span, .topbar-actions .ghost-btn span { display: none; }
}
@media (max-width: 560px) {
  .hero-sub { font-size: 14px; }
  .hero-composer { margin-top: 20px; }
  .msg-ai { grid-template-columns: minmax(0, 1fr); }
  .msg-avatar { display: none; }
  .composer-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* share links (1.6) */
.is-share .composer-wrap, .is-share .msg-user-actions { display: none; }
.title-static { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-banner, .share-gone {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px;
  background: var(--surface-3); color: var(--ink-2); font-size: 13px;
}
.share-banner .svg-ico, .share-gone .svg-ico { width: 15px; height: 15px; color: var(--accent); }
.share-gone { margin-top: 60px; justify-content: center; font-size: 14px; }
.share-foot { display: flex; justify-content: center; padding: 8px 0 24px; }
.share-link { display: flex; gap: 8px; }
.share-link input {
  flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: 9px; font-size: 13px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); outline: none;
}
.share-link .primary-btn { height: 36px; flex: none; }
.share-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); }
#shareModal .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.ghost-btn.danger { color: var(--accent-ink); }
.ghost-btn.danger:hover { border-color: var(--accent); background: var(--accent-soft); }
.share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.share-list .share-text { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 4px 2px; }
.share-list .share-text a { padding: 0; font-weight: 600; }
.share-list small { font-size: 11.5px; color: var(--ink-4); }
.share-list li { display: flex; align-items: center; gap: 4px; }
.share-list a { flex: 1; min-width: 0; font-size: 12.5px; padding: 4px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; color: var(--ink-2); }
.share-list a:hover { color: var(--accent-ink); text-decoration: underline; }
.session-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.session-list li { display: flex; align-items: center; gap: 6px; padding: 4px 2px; }
.session-list .sess-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.session-list b { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-list small { font-size: 11.5px; color: var(--ink-4); overflow-wrap: anywhere; }
.session-list .badge-saved { font-size: 10.5px; padding: 1px 6px; }
.settings-note { font-size: 12px; line-height: 1.5; color: var(--ink-3); margin: 0 2px 6px; }
.ghost-btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }

/* language picker (langpicker.js): trigger row in the account menu, admin bar button, popover */
.pref-row.pref-lang {
  width: calc(100% + 12px); margin: 0 -6px; padding: 5px 6px; border-radius: 8px; text-align: left; font: inherit; font-size: 13px;
}
.pref-row.pref-lang:hover, .pref-row.pref-lang[aria-expanded="true"] { background: var(--surface-3); color: var(--ink); }
.pref-row.pref-lang:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pref-label, .pref-value { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.pref-label .svg-ico { width: 14px; height: 14px; color: var(--ink-3); }
.pref-value { color: var(--ink); font-weight: 600; font-size: 12.5px; }
.pref-value > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pref-value .svg-ico { width: 13px; height: 13px; color: var(--ink-4); flex: none; transition: transform .15s var(--ease); }
.pref-lang[aria-expanded="true"] .pref-value .svg-ico { transform: translateX(2px); color: var(--ink-2); }

.lang-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 8px 0 9px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.lang-btn:hover, .lang-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--ink); }
.lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lang-btn .svg-ico { width: 16px; height: 16px; }
.lang-btn .lang-btn-chev { width: 12px; height: 12px; color: var(--ink-4); transform: rotate(90deg); transition: transform .15s var(--ease); }
.lang-btn[aria-expanded="true"] .lang-btn-chev { transform: rotate(-90deg); }

.lang-menu {
  position: fixed; z-index: 70; width: 248px; max-width: calc(100vw - 16px); padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; gap: 2px; animation: pop .14s var(--ease);
}
.lang-menu-head {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
}
.lang-menu-head .svg-ico { width: 13px; height: 13px; color: var(--accent); }
.lang-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 9px;
  text-align: left; color: var(--ink-2);
}
.lang-opt:hover, .lang-opt:focus-visible { background: var(--surface-3); color: var(--ink); outline: none; }
.lang-opt:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.lang-badge {
  flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--surface-3); border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 700; color: var(--ink-2);
}
.lang-opt.active .lang-badge { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.lang-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.lang-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.lang-sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-check { flex: none; width: 16px; height: 16px; color: var(--accent); }
.lang-check .svg-ico { width: 16px; height: 16px; }
.lang-menu-note { margin: 4px 0 0; padding: 7px 8px 4px; border-top: 1px solid var(--line-2); font-size: 11.5px; line-height: 1.45; color: var(--ink-3); }

/* dropdown menu (dom.js openMenu) */
.menu {
  position: fixed; z-index: 65; min-width: 180px; padding: 5px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; animation: pop .14s var(--ease);
}
.menu-item {
  display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 10px; border-radius: 8px;
  font-size: 13px; color: var(--ink-2); text-align: left; white-space: nowrap;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); color: var(--ink); outline: none; }
.menu-item .svg-ico { width: 15px; height: 15px; color: var(--ink-3); }

/* Print / Save as PDF (1.4): conversation only, light theme (app.js), charts and sources kept. */
@media print {
  @page { margin: 16mm 14mm; }
  .sidebar, .scrim, .composer-wrap, .topbar-actions, .menu-btn, .badge, .msg-actions, .msg-user-actions, .fb-form,
  .chart-tools, .chart-data, .table-tools, .tools, .share-foot, .share-banner, .thinking, .popover, .toasts, .dropzone, .menu, .lang-menu, .modal, .feat-panel, .feat-hint { display: none !important; }
  .app { display: block; height: auto; }
  .main, .scroller { display: block; overflow: visible; height: auto; }
  body { background: #fff; opacity: 1; font-size: 12.5px; }
  .topbar { height: auto; padding: 0 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
  .title-text { font-size: 18px; font-family: var(--font-serif); white-space: normal; }
  .thread { max-width: none; padding: 0; gap: 18px; }
  .msg-ai { break-inside: auto; grid-template-columns: minmax(0, 1fr); }
  .msg-avatar { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .chart-card, .src, .table-wrap, .msg-user { break-inside: avoid; box-shadow: none; animation: none; }
  .chart-body { height: auto !important; }
  .chart-body > div { width: 100% !important; height: auto !important; }
  .chart-body canvas { position: static !important; width: 100% !important; height: auto !important; }
  .src-list { grid-template-columns: minmax(0, 1fr); }
  .src-title { -webkit-line-clamp: unset; display: block; }
  .src-title a[href^="http"]::after { content: " " attr(href); color: var(--ink-3); font-size: 10.5px; word-break: break-all; }
  .src-more > summary { display: none; }
  .src-more .src-list { display: grid; }
}
