/* Airbnb-inspired tokens (DESIGN.md) */
:root {
  --rausch:      #ff385c;
  --rausch-act:  #e00b41;
  --rausch-tint: #ffd1da;
  --canvas:      #ffffff;
  --soft:        #f7f7f7;
  --strong:      #f2f2f2;
  --ink:         #222222;
  --body:        #3f3f3f;
  --muted:       #6a6a6a;
  --line:        #ebebeb;
  --error:       #c13515;
  --success:     #008a05;
  --link-blue:   #428bff;
  --shadow:
    rgba(0,0,0,0.02) 0 0 0 1px,
    rgba(0,0,0,0.04) 0 2px 6px,
    rgba(0,0,0,0.10) 0 4px 8px;
  --r-btn: 8px;
  --r-card: 14px;
  --r-pill: 9999px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Cereal", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 20px; color: var(--rausch);
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--rausch);
  display: inline-block;
}
.tabs { display: flex; gap: 8px; }
.tab {
  padding: 10px 18px; border-radius: var(--r-pill);
  font-weight: 500; color: var(--body); cursor: pointer; border: none; background: transparent;
  font-size: 15px;
}
.tab:hover { background: var(--strong); }
.tab.active { background: var(--ink); color: #fff; }
.tab-badge {
  display: inline-block; margin-left: 8px;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: #fff4e5; color: #c2410c; border: 1px solid #fed7aa;
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; vertical-align: 1px;
}
.tab.active .tab-badge { background: #fff; border-color: #fff; }
.user-pod {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  font-size: 14px; color: var(--body);
}
.avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--ink); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
}
.btn-link {
  background: none; border: none; cursor: pointer; color: var(--body);
  font: inherit; text-decoration: underline;
}

/* ---------- Layout ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 32px 24px 64px; }
.section + .section { margin-top: 48px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.h1 { font-size: 28px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.h2 { font-size: 22px; font-weight: 600; margin: 0 0 16px; letter-spacing: -0.01em; }
.h3 { font-size: 17px; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.005em; }
.muted { color: var(--muted); }
.body { color: var(--body); }
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- Cards ---------- */
.card {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px 22px;
  /* 极淡的默认 shadow — 让卡片在 page bg 上略浮起来 */
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}
.card.hover { cursor: pointer; }
.card:hover, .card.hover:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.08);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
/* 卡片内部的小标题（如候选池里的"最近变化"）保留 inline 风格不要 border */
.card-header.no-divider { padding-bottom: 0; border-bottom: none; margin-bottom: 12px; }

/* ---------- Mode badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-paper { background: #fff4e5; color: #c2410c; border: 1px solid #fed7aa; }
.badge-live  { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* ---------- KPI grid ---------- */
.kpi-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1128px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .kpi-grid { grid-template-columns: 1fr; } }
.kpi {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px;
}
.kpi-label { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.015em; }
.kpi-sub { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.kpi-value.pos { color: var(--success); }
.kpi-value.neg { color: var(--error); }

/* ---------- Quota strip (Anthropic /usage progress bars) ---------- */
.quota-strip { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
@media (max-width: 600px) { .quota-strip { grid-template-columns: 1fr; } }
.quota-strip:empty { display: none; }
.quota-row { background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; }
.quota-row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; gap: 12px; }
.quota-row-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.quota-row-value { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.quota-row-bar { height: 6px; border-radius: 9999px; background: var(--strong); overflow: hidden; }
.quota-row-bar > i { display: block; height: 100%; background: var(--success); transition: width .4s ease-out; }
.quota-row-bar.warn > i { background: #d97706; }
.quota-row-bar.neg > i { background: var(--error); }
.quota-row-sub { font-size: 12px; color: var(--muted); margin-top: 8px; }
.quota-row-error { font-size: 12px; color: var(--error); }

/* ---------- Two-col layout for big sections ---------- */
.split { display: grid; gap: 24px; grid-template-columns: 1.6fr 1fr; }
@media (max-width: 1024px) { .split { grid-template-columns: 1fr; } }

/* ---------- Strategy overview cards (3 列统一布局 · 2026-05-13 v2) ---------- */
.strategy-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1200px) { .strategy-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px)  { .strategy-grid { grid-template-columns: 1fr; } }

.strategy-card {
  display: flex; flex-direction: column; gap: 18px;
  background: var(--canvas); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 22px;
  transition: border-color .2s, box-shadow .2s;
}
.strategy-card:hover { border-color: var(--ink-soft, #cbd5e1); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

.sc-head { display: flex; flex-direction: column; gap: 6px; }
.sc-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-title h2 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.sc-sub { font-size: 12.5px; line-height: 1.4; margin: 0; }

.sc-hero {
  padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.sc-hero-label { font-size: 12px; font-weight: 500; }
.sc-hero-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.sc-hero-value.pos { color: var(--success); }
.sc-hero-value.neg { color: var(--error); }
.sc-hero-sub { font-size: 12px; }

.sc-mini-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.sc-mini { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sc-mini-label { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.sc-mini-val { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; word-break: break-word; }
.sc-mini-val.pos { color: var(--success); }
.sc-mini-val.neg { color: var(--error); }
.sc-mini-sub { font-size: 11px; color: var(--muted); }

.sc-foot { margin-top: auto; display: flex; justify-content: flex-end; }
.sc-foot .btn { font-size: 12.5px; padding: 6px 12px; }

/* ---------- Time range pills ---------- */
.pill-group {
  display: inline-flex; padding: 3px;
  background: var(--strong); border-radius: var(--r-pill);
}
.pill {
  padding: 5px 12px; border-radius: var(--r-pill); border: none; background: transparent;
  font-size: 12.5px; font-weight: 500; color: var(--body); cursor: pointer;
  transition: color 0.15s;
}
.pill:hover { color: var(--ink); }
.pill.active {
  background: var(--canvas); color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.select, .input {
  height: 34px; padding: 0 11px; border-radius: var(--r-btn);
  border: 1px solid var(--line); background: var(--canvas);
  font: inherit; font-size: 13.5px; color: var(--ink);
  transition: border-color 0.15s;
}
.select:focus, .input:focus {
  outline: none; border-color: var(--ink); border-width: 2px; padding: 0 10px;
}

/* ---------- Buttons ---------- */
.btn {
  height: 34px; padding: 0 14px; border-radius: var(--r-btn);
  font-weight: 500; font-size: 13.5px; cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn-primary { background: var(--rausch); color: #fff; }
.btn-primary:hover { background: var(--rausch-act); }
.btn-primary:disabled { background: var(--rausch-tint); cursor: not-allowed; }
.btn-secondary {
  background: var(--canvas); color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { background: var(--soft); border-color: var(--ink); }
.btn-secondary:disabled { color: var(--muted); border-color: var(--line); cursor: not-allowed; }

/* ---------- Tables ---------- */
.table-wrap {
  border: 1px solid var(--line); border-radius: var(--r-card);
  overflow-x: auto; background: var(--canvas);
}
table {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
  font-variant-numeric: tabular-nums;  /* 数字等宽对齐 */
}
thead { background: var(--soft); }
thead th { border-bottom: 1px solid var(--line); }
/* 注：暂不做 sticky thead — .table-wrap overflow:hidden（圆角需要）会破坏 sticky；
 * 后续若需要 sticky thead，要先把圆角放到 thead 自己上再去掉 overflow:hidden */
th, td {
  text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}
th {
  font-weight: 600; font-size: 12.5px; color: var(--muted);
  /* 取消 uppercase + letter-spacing — 中文页 uppercase 无效，间距却撑稀疏 */
}
tbody td { color: var(--body); }
/* 斑马纹 — 浅到几乎看不出但能在长表里区分行 */
tbody tr:nth-child(even) td { background: rgba(0,0,0,0.018); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(66,139,255,0.06); }
td.right, th.right { text-align: right; }
.mono { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: 13px; font-variant-numeric: tabular-nums; }
.pos { color: var(--success); font-weight: 500; }
.neg { color: var(--error); font-weight: 500; }
.tag {
  display: inline-block; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500; background: var(--strong); color: var(--body);
  letter-spacing: 0;
}
.tag-open  { background: #dcfce7; color: #166534; }
.tag-closed{ background: #f3f4f6; color: #374151; }
.tag-up    { background: #dcfce7; color: #166534; }
.tag-down  { background: #fee2e2; color: #b91c1c; }
.tag-buy   { background: #e0f2fe; color: #075985; }
.tag-sell  { background: #fee2e2; color: #b91c1c; }

/* Settled-fill PnL row tints — same hue family as tag-up/tag-down. 用 td
 * 级 specificity 覆盖斑马纹（nth-child even 也在 td 上）。 */
tbody tr.row-win  td { background: #f0fdf4; }
tbody tr.row-loss td { background: #fef2f2; }
tbody tr.row-win:hover  td { background: #dcfce7; }
tbody tr.row-loss:hover td { background: #fee2e2; }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; width: 100%; height: 320px; }

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--canvas);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.login-sub { color: var(--muted); margin: 0 0 20px; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--body); font-weight: 500; }
.field .input { height: 38px; padding: 0 12px; font-size: 14px; }
.error-msg { color: var(--error); font-size: 13px; margin-top: 6px; min-height: 18px; }

/* ---------- Live indicator ---------- */
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600;
  color: var(--success); background: #ecfdf5;
  border: 1px solid #a7f3d0;
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.live-pill:hover { filter: brightness(0.97); }
.live-pill.paused {
  color: var(--muted); background: var(--strong); border-color: var(--line);
}
.live-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: live-pulse 1.6s infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0,138,5,0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(0,138,5,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,138,5,0); }
}
.live-pill.paused .live-dot { animation: none; box-shadow: none; }

/* US Stock market status pill */
.market-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600;
  border: 1px solid; transition: all 0.15s;
}
.market-pill .market-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: currentColor;
}
.market-pill[data-state="open"] {
  color: var(--success); background: #ecfdf5; border-color: #a7f3d0;
}
.market-pill[data-state="open"] .market-dot {
  box-shadow: 0 0 0 0 currentColor;
  animation: live-pulse 1.6s infinite;
}
.market-pill[data-state="pre_market"] {
  color: #b45309; background: #fffbeb; border-color: #fde68a;
}
.market-pill[data-state="after_hours"] {
  color: #7c3aed; background: #f5f3ff; border-color: #ddd6fe;
}
.market-pill[data-state="closed"] {
  color: var(--muted); background: var(--strong); border-color: var(--line);
}

/* New row flash on live update */
@keyframes row-flash {
  0%   { background: var(--rausch-tint); }
  100% { background: transparent; }
}
@keyframes row-slide-in {
  0%   { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}
tbody tr.row-new {
  animation: row-flash 2.4s ease-out, row-slide-in 0.3s ease-out;
}

/* KPI value updated flash */
@keyframes value-tick {
  0%   { color: var(--rausch); }
  100% { color: inherit; }
}
.kpi-value.tick { animation: value-tick 0.6s ease-out; }

/* ---------- Pager ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 4px 0; flex-wrap: wrap;
}
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }

/* ---------- Empty states ---------- */
.empty { padding: 32px; text-align: center; color: var(--muted); font-size: 14px; }

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* 自定义滚动条 — 比浏览器默认更细更柔和 */
.scroll-x::-webkit-scrollbar { height: 8px; }
.scroll-x::-webkit-scrollbar-track { background: transparent; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.scroll-x::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.hidden { display: none !important; }
.spacer-8 { height: 8px; } .spacer-16 { height: 16px; } .spacer-24 { height: 24px; } .spacer-32 { height: 32px; }

/* ============== 术语 tooltip 系统 ============== */
.term-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 3px;
  border-radius: 9999px; background: var(--strong); color: var(--muted);
  font-size: 9px; font-weight: 700; cursor: help;
  vertical-align: middle; line-height: 1;
  position: relative; user-select: none;
  transition: background .12s, color .12s;
}
.term-help:hover { background: var(--ink); color: #fff; z-index: 100; }
/* tooltip 浮层 — JS 驱动 position:fixed 挂到 body，逃出 .table-wrap / .scroll-x 的 overflow 裁剪 */
.term-tip-floating {
  position: fixed; display: none;
  background: var(--ink); color: #fff;
  padding: 10px 12px; border-radius: 8px;
  font-size: 12px; line-height: 1.5; font-weight: 400;
  white-space: pre-wrap; text-align: left;
  width: 260px; max-width: 320px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  z-index: 10000; pointer-events: none;
}
.term-tip-floating::after {
  content: ""; position: absolute;
  left: 50%; transform: translateX(-50%);
  border: 6px solid transparent;
}
.term-tip-floating[data-flip="up"]::after {
  bottom: -12px; border-top-color: var(--ink);
}
.term-tip-floating[data-flip="down"]::after {
  top: -12px; border-bottom-color: var(--ink);
}

/* 术语表模态 */
.glossary-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.glossary-overlay.hidden { display: none; }
.glossary-modal {
  background: var(--canvas); border-radius: 14px;
  width: 100%; max-width: 720px; max-height: 80vh;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.glossary-head {
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.glossary-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.glossary-head .close-btn {
  width: 32px; height: 32px; border-radius: 9999px;
  border: 1px solid var(--line); background: var(--canvas);
  cursor: pointer; font-size: 18px; color: var(--muted);
}
.glossary-head .close-btn:hover { background: var(--soft); color: var(--ink); }
.glossary-body { padding: 16px 24px; overflow-y: auto; flex: 1; }
.glossary-search {
  width: 100%; height: 40px; padding: 0 14px; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; outline: none;
}
.glossary-search:focus { border-color: var(--ink); border-width: 2px; padding: 0 13px; }
.glossary-cat { font-size: 12px; color: var(--muted); font-weight: 600;
                text-transform: uppercase; letter-spacing: 0.05em;
                margin: 16px 0 6px; }
.glossary-cat:first-child { margin-top: 0; }
.glossary-item {
  padding: 10px 0; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: start;
}
.glossary-item:last-child { border-bottom: none; }
.glossary-term { font-weight: 600; color: var(--ink); font-size: 14px; }
.glossary-def  { font-size: 13px; color: var(--body); line-height: 1.55; }

/* 顶部 nav 加术语表入口 */
.glossary-trigger {
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--muted); padding: 4px 8px;
  border-radius: 6px; display: inline-flex; align-items: center; gap: 4px;
}
.glossary-trigger:hover { background: var(--soft); color: var(--ink); }

/* ============== 分区分隔符 ============== */
.section-head {
  display: flex; align-items: center; gap: 14px;
  margin: 32px 0 16px;
}
.section-head:first-of-type { margin-top: 0; }
.section-head .icon { font-size: 18px; line-height: 1; }
.section-head .label {
  font-size: 13px; font-weight: 600;
  color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase;
}
.section-head .rule {
  flex: 1; height: 1px; background: var(--line);
}
.section-head .hint { font-size: 12px; color: var(--muted); }

/* ============== 告警/风控顶部摘要条（折叠卡片） ============== */
.status-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px; border-radius: var(--r-card);
  background: var(--soft); border: 1px solid var(--line);
  font-size: 13px;
}
.status-bar.tone-ok   { background: rgba(0,138,5,0.06); border-color: rgba(0,138,5,0.18); }
.status-bar.tone-warn { background: rgba(255,56,92,0.06); border-color: rgba(255,56,92,0.20); }
.status-bar.tone-err  { background: rgba(193,53,21,0.06); border-color: rgba(193,53,21,0.30); }
.status-bar .icon { font-size: 16px; }
.status-bar .body { flex: 1; color: var(--ink); }
.status-bar .body b { font-weight: 600; }
.status-bar .ctas { display: flex; gap: 8px; }
.status-bar .anchor-link {
  color: var(--rausch); font-size: 12px; font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.status-bar .anchor-link:hover { text-decoration: underline; }

/* ============== SmartTable widget ============== */
.smart-table-wrap { display: flex; flex-direction: column; gap: 8px; }
.smart-table-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px;
}
.smart-table-toolbar .filter-input {
  flex: 1; min-width: 160px; max-width: 320px;
  height: 30px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--r-btn);
  font-size: 12.5px; background: var(--canvas);
  outline: none; transition: border-color .15s;
}
.smart-table-toolbar .filter-input:focus { border-color: var(--ink); border-width: 2px; padding: 0 10px; }
.smart-table-toolbar .meta { color: var(--muted); margin-left: auto; }
/* btn-sm 沿用全局尺寸（30px） */

.smart-table th.sortable { cursor: pointer; user-select: none; position: relative; padding-right: 18px; }
.smart-table th.sortable:hover { background: var(--soft); }
.smart-table th.sortable::after {
  content: "⇅"; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted); opacity: 0.4;
}
.smart-table th.sort-asc::after  { content: "▲"; opacity: 1; color: var(--rausch); }
.smart-table th.sort-desc::after { content: "▼"; opacity: 1; color: var(--rausch); }
.smart-table tbody tr:hover td { background: var(--soft); }

.smart-pager {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.smart-pager .page-info { font-variant-numeric: tabular-nums; min-width: 90px; text-align: center; }

/* ============== Insight box（解读 + 建议） ============== */
.insight {
  display: flex; gap: 14px; align-items: flex-start;
  margin-top: 14px; padding: 14px 16px;
  border-radius: var(--r-btn);
  background: var(--soft);
  font-size: 13.5px; line-height: 1.65;
}
.insight.tone-pos  { background: rgba(0,138,5,0.06);   border-left: 3px solid var(--success); }
.insight.tone-neg  { background: rgba(193,53,21,0.06); border-left: 3px solid var(--error); }
.insight.tone-warn { background: rgba(255,56,92,0.06); border-left: 3px solid var(--rausch); }
.insight.tone-info { background: var(--soft); border-left: 3px solid var(--muted); }
.insight-icon { font-size: 18px; line-height: 1.4; flex-shrink: 0; }
.insight-body { flex: 1; min-width: 0; }
.insight-summary {
  color: var(--ink); font-weight: 600;
  font-size: 14px; line-height: 1.5;
  margin-bottom: 6px;
}
.insight-advice  { color: var(--body); }
.insight-advice b { color: var(--ink); font-weight: 600; }

/* Multiple insights stacked */
.insight + .insight { margin-top: 10px; }

/* Jump link inside insight advice — 点击跳转到对应 card */
.jump-link {
  color: var(--link-blue);
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s, background 0.15s;
  padding: 0 1px;
}
.jump-link:hover {
  border-bottom-color: var(--link-blue);
  background: rgba(66,139,255,0.08);
}
/* 跳转目标短暂高亮 */
.jump-target-flash {
  animation: jump-flash 1.6s ease-out;
}
@keyframes jump-flash {
  0%   { box-shadow: 0 0 0 3px rgba(66,139,255,0.0); }
  20%  { box-shadow: 0 0 0 3px rgba(66,139,255,0.45); }
  100% { box-shadow: 0 0 0 3px rgba(66,139,255,0.0); }
}

/* Three-tier timeline comparison in KPI card */
.timeline-stack {
  display: flex; flex-direction: column; gap: 6px;
  margin: 8px 0 4px;
}
.timeline-row {
  display: grid; grid-template-columns: 88px 1fr 56px;
  align-items: center; gap: 8px;
  font-size: 12px;
}
.timeline-row .t-label { color: var(--muted); }
.timeline-row .t-bar {
  height: 8px; border-radius: 9999px; background: var(--strong);
}
.timeline-row .t-bar.t-serial    { background: #d1d1d1; width: 100%; }
.timeline-row .t-bar.t-realistic { background: var(--rausch); }
.timeline-row .t-bar.t-optimal   { background: var(--success); }
.timeline-row .t-date { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

/* ============== Mobile (<744px) ============== */
@media (max-width: 744px) {
  /* Layout */
  .container { padding: 20px 16px 56px; }
  .section + .section { margin-top: 32px; }
  .spacer-32 { height: 24px; }
  .spacer-24 { height: 16px; }

  /* Type scale */
  .h1 { font-size: 22px; }
  .h2 { font-size: 18px; }
  .h3 { font-size: 15px; }

  /* Top nav: brand + user on row 1, tabs on row 2 (horizontally scrollable) */
  .nav-inner {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 10px 12px;
  }
  .brand { font-size: 17px; gap: 8px; }
  .brand .brand-mark { width: 24px; height: 24px; }

  .tabs {
    order: 99;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    gap: 6px;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 14px;
  }

  .user-pod {
    padding: 4px 12px 4px 14px;
    gap: 10px;
    font-size: 13px;
  }
  #username-label { display: none; }
  .avatar { width: 28px; height: 28px; font-size: 13px; }

  /* Page header rows */
  .row { gap: 12px; align-items: flex-start; }

  /* Cards & KPI */
  .card { padding: 16px; border-radius: 12px; }
  .card-header { margin-bottom: 12px; flex-wrap: wrap; align-items: flex-start; }
  .kpi-grid { gap: 12px; }
  .kpi { padding: 14px; border-radius: 12px; }
  .kpi-label { font-size: 12px; margin-bottom: 4px; }
  .kpi-value { font-size: 19px; }
  .kpi-sub { font-size: 12px; margin-top: 4px; }

  /* Pills (time range) */
  .pill-group {
    overflow-x: auto;
    flex-wrap: nowrap;
    max-width: 100%;
    scrollbar-width: none;
  }
  .pill-group::-webkit-scrollbar { display: none; }
  .pill { padding: 6px 12px; font-size: 13px; flex-shrink: 0; }

  /* Filters in card-header */
  .card-header .row-tight {
    width: 100%;
    flex-wrap: wrap;
  }
  .select, .input { height: 38px; font-size: 14px; flex: 1 1 130px; min-width: 0; }

  /* Tables: tighter cells, smaller font */
  table { font-size: 13px; }
  th, td { padding: 8px 10px; }
  th { font-size: 11px; letter-spacing: 0.03em; }
  .tag { font-size: 11px; padding: 2px 7px; }
  .badge { font-size: 11px; padding: 3px 8px; }

  /* Buttons */
  .btn { height: 40px; padding: 0 16px; font-size: 14px; }

  /* Gantt: keep horizontal scroll but restore min-width so bars don't collapse */
  .gantt { min-width: 700px; }

  /* Roadmap phases */
  .phase-head { flex-wrap: wrap; gap: 4px 12px; }
  .phase-title { font-size: 16px; }
  .phase-progress { margin-left: 0; }

  /* Milestones: stack on mobile */
  .milestone-item {
    grid-template-columns: 24px 1fr;
    gap: 6px 10px;
  }
  .milestone-target,
  .milestone-days,
  .milestone-kpi {
    grid-column: 2;
    text-align: left;
  }
  .milestone-days { min-width: 0; }
  .milestone-kpi { max-width: none; white-space: normal; }

  /* Decisions: wrap */
  .decision-item { flex-wrap: wrap; gap: 4px 12px; }
  .decision-date { min-width: auto; }

  /* Current state cards */
  .cs-item { flex-wrap: wrap; gap: 4px 8px; }
  .cs-item .cs-name { white-space: normal; }

  /* Milestone rows */
  .milestone-row { flex-wrap: wrap; gap: 4px 8px; }
  .milestone-row .m-name { white-space: normal; }

  /* Subnav: realign with container's tighter padding (20px 16px) so底边线贯通 */
  .subnav { margin: -20px -16px 24px; padding: 0 16px; }

  /* Charts */
  .chart-wrap { height: 240px; }

  /* Login */
  .login-shell { padding: 16px; }
  .login-card { padding: 20px; }
  .login-title { font-size: 18px; }
  .field .input { height: 38px; font-size: 14px; }
}

/* Phones <480px: hide brand text and trim further */
@media (max-width: 480px) {
  .brand span:not(.brand-mark) { display: none; }
  .h1 { font-size: 20px; }
  .container { padding: 16px 12px 48px; }
  .card { padding: 14px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 18px; }
  th, td { padding: 7px 8px; }
  .chart-wrap { height: 220px; }
  /* in card-header overview cards, keep title + button on same row */
  .card-header .btn { padding: 0 12px; height: 36px; font-size: 13px; }

  /* Subnav: realign with container padding (16px 12px) at 480 */
  .subnav { margin: -16px -12px 20px; padding: 0 12px; }

  /* Long KPI values (e.g. "+$1,234.56") wrap instead of overflowing */
  .kpi-value { overflow-wrap: anywhere; word-break: break-word; }

  /* Roadmap: tighter on small phones */
  .phase-title { font-size: 15px; }
  .phase-bar { width: 80px; }
  .gantt { min-width: 600px; }
  .milestone-item { padding: 8px 10px; font-size: 12px; }
  .milestones-list { padding: 8px 8px; }
  .decisions-list { padding: 8px 8px; }
}

/* ---------- Sub-nav (二级导航) ----------
   Airbnb listing-detail 风格:纯文本 + ink 下划线指示;不与顶级 pill tab 视觉
   重复。下边线贯通到 container 两端,与顶部 nav 形成视觉延续。 */
.subnav {
  display: flex; gap: 0;
  margin: -32px -24px 28px;   /* 抵消 .container 的 padding,让下边线贯通 */
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }

.subtab {
  position: relative;
  padding: 16px 0;
  margin-right: 28px;
  border: none; background: transparent;
  font-weight: 500; font-size: 15px;
  color: var(--muted); cursor: pointer;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.subtab:hover { color: var(--ink); }
.subtab.active {
  color: var(--ink); font-weight: 600;
}
.subtab.active::after {
  content: ""; position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--ink);
  border-radius: 2px 2px 0 0;
}
