/* Typography-first editorial console. Loaded after the interaction layer. */
:root {
  --bg: #f2f1ed;
  --surface: #fbfaf7;
  --surface-2: #eeece7;
  --surface-3: #e2e0da;
  --text: #4a5359;
  --text-strong: #171d21;
  --text-muted: #7d8589;
  --border: #d8d6d0;
  --border-strong: #b9b8b2;
  --input-bg: #faf9f6;
  --input-text: #1d252a;
  --panel: var(--surface);
  --panel-soft: var(--surface-2);
  --ink: var(--text);
  --ink-soft: #596268;
  --muted: var(--text-muted);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --accent: #27353e;
  --primary: var(--accent);
  --accent-dark: #101a20;
  --accent-soft: rgba(39, 53, 62, .09);
  --on-primary: #f7f5f0;
  --primary-bg: var(--accent-soft);
  --focus-ring: rgba(39, 53, 62, .2);
  --bullish: #b65b62;
  --bullish-bg: rgba(182, 91, 98, .1);
  --bearish: #3f806b;
  --bearish-bg: rgba(63, 128, 107, .1);
  --uncertain: #9a7a4d;
  --uncertain-bg: rgba(154, 122, 77, .11);
  --neutral: #778187;
  --neutral-bg: rgba(119, 129, 135, .1);
  --low-relevance: #778187;
  --low-relevance-bg: rgba(119, 129, 135, .1);
  --mixed: #766b91;
  --mixed-bg: rgba(118, 107, 145, .1);
  --shadow: 0 1px 2px rgba(21, 27, 31, .04), 0 12px 28px rgba(21, 27, 31, .045);
  --shadow-hover: 0 2px 4px rgba(21, 27, 31, .06), 0 18px 36px rgba(21, 27, 31, .08);
  --radius: 10px;
  --radius-sm: 6px;
}

[data-theme="dark"] {
  --bg: #0d0f11;
  --surface: #131619;
  --surface-2: #181c20;
  --surface-3: #22272b;
  --text: #c7ccd0;
  --text-strong: #f0eee9;
  --text-muted: #8d959a;
  --border: #2b3034;
  --border-strong: #3d4449;
  --input-bg: #111417;
  --input-text: #f0eee9;
  --panel: var(--surface);
  --panel-soft: var(--surface-2);
  --ink: var(--text);
  --ink-soft: #b3babd;
  --muted: var(--text-muted);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --accent: #e5e0d6;
  --primary: var(--accent);
  --accent-dark: #ffffff;
  --accent-soft: rgba(229, 224, 214, .085);
  --on-primary: #17191a;
  --primary-bg: var(--accent-soft);
  --focus-ring: rgba(229, 224, 214, .2);
  --bullish: #dd7a80;
  --bullish-bg: rgba(221, 122, 128, .1);
  --bearish: #6bb99d;
  --bearish-bg: rgba(107, 185, 157, .1);
  --uncertain: #c2a276;
  --uncertain-bg: rgba(194, 162, 118, .1);
  --neutral: #a0a8ad;
  --neutral-bg: rgba(160, 168, 173, .1);
  --low-relevance: #a0a8ad;
  --low-relevance-bg: rgba(160, 168, 173, .1);
  --mixed: #afa6c4;
  --mixed-bg: rgba(175, 166, 196, .1);
  --shadow: 0 1px 2px rgba(0, 0, 0, .26), 0 14px 32px rgba(0, 0, 0, .16);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .32), 0 20px 42px rgba(0, 0, 0, .24);
}

html { color-scheme: light; background: var(--bg); }
[data-theme="dark"] { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
.button,
.ghost-button {
  min-height: 38px;
  border-radius: var(--radius-sm);
  font-weight: 650;
  box-shadow: none;
}

button:hover,
.button:hover { box-shadow: none; }
button:focus-visible, .button:focus-visible, .ghost-button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input, select, textarea { border-color: var(--border-strong); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--input-text); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

.site-header { height: 62px; border-bottom-color: var(--border); background: color-mix(in srgb, var(--bg) 90%, transparent); box-shadow: none; backdrop-filter: blur(18px) saturate(110%); }
.site-header__inner { min-height: 62px; width: min(1640px, calc(100% - 40px)); gap: 18px; }
.site-title { gap: 9px; color: var(--text-strong); font-size: 14px; font-weight: 700; }
.site-title__copy { gap: 2px; }
.site-title__copy strong { font-size: 14px; letter-spacing: -.01em; }
.site-title__copy small { color: var(--text-muted); font-size: 10px; }
.brand-logo-wrap { width: 32px; height: 32px; border-color: var(--border-strong); background: var(--surface-2); }
.brand-logo { width: 26px; height: 26px; }
.user-avatar { width: 27px; height: 27px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface-2); color: var(--text-strong); }
.admin-menu__toggle { min-height: 38px; border-radius: var(--radius-sm); padding: 5px 8px; }
.admin-menu__toggle:hover, .admin-menu__toggle[aria-expanded="true"] { border-color: var(--border); background: var(--surface-2); color: var(--text-strong); box-shadow: none; }
.admin-menu__panel { min-width: 194px; border-color: var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-hover); }
.theme-switch { min-height: 38px; border-color: var(--border); background: var(--surface-2); }
.theme-switch:hover { border-color: var(--border-strong); background: var(--surface-3); box-shadow: none; }
.theme-switch__thumb { background: var(--surface); color: var(--text-strong); }

.page { width: min(1640px, calc(100% - 40px)); padding: 24px 0 54px; }
.workbench-shell { grid-template-columns: 214px minmax(0, 1fr) 286px; gap: 24px; }
.workbench-sidebar { top: 78px; min-height: calc(100dvh - 106px); border-right: 1px solid var(--border); padding-right: 18px; }
.nav-panel, .watchlist-overview-panel { border: 0; border-radius: 0; background: transparent; box-shadow: none; padding: 0; }
.nav-panel { padding-bottom: 13px; border-bottom: 1px solid var(--border); }
.workbench-nav { gap: 1px; }
.workbench-nav a, .workbench-nav span { min-height: 39px; border-radius: var(--radius-sm); padding: 0 11px 0 13px; color: var(--ink-soft); font-size: 13px; }
.workbench-nav a:hover { background: var(--surface-2); color: var(--text-strong); }
.workbench-nav .is-active { background: var(--accent-soft); color: var(--text-strong); box-shadow: inset 2px 0 0 var(--accent); }
.watchlist-overview-panel { padding-top: 16px; }
.watchlist-overview__list { gap: 0; max-height: min(62vh, 640px); }
.watchlist-overview__item { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; padding: 10px 6px; }
.watchlist-overview__item:hover, .watchlist-overview__item.is-selected { border-color: var(--border); border-radius: 0; background: var(--surface-2); }
.watchlist-overview__item.is-selected { box-shadow: inset 2px 0 0 var(--accent); }
.watchlist-overview__stats span { background: transparent; padding: 0; }

.dashboard-head--panel, .front-panel, .admin-title { min-height: 84px; margin: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; box-shadow: none; padding: 6px 0 15px; }
.dashboard-head--panel h1, .admin-title h1, .front-panel h1 { font-size: 23px; line-height: 1.2; font-weight: 700; letter-spacing: -.018em; }
.dashboard-context { color: var(--text-muted); font-size: 11px; font-weight: 650; letter-spacing: .01em; }
.live-dot { min-height: 28px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-muted); font-size: 11px; font-weight: 650; }
.live-dot::before { width: 6px; height: 6px; box-shadow: none; background: var(--bearish); }

.metric-strip--terminal { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; margin-top: 18px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: none; }
.metric-strip--terminal article { min-height: 80px; border-right: 1px solid var(--border); background: transparent; padding: 13px 14px; text-align: left; }
.metric-strip--terminal article:last-child { border-right: 0; }
.metric-strip--terminal .metric-primary { background: transparent; padding-left: 14px; }
.metric-strip--terminal span { color: var(--text-muted); font-size: 11px; font-weight: 600; }
.metric-strip--terminal strong, .metric-strip--terminal .metric-primary strong { color: var(--text-strong); font-size: 22px; line-height: 1.1; font-weight: 700; }
.metric-strip--terminal small { color: var(--text-muted); font-size: 10px; }
.metric-strip--terminal .metric-bullish { color: var(--bullish) !important; }
.metric-strip--terminal .metric-bearish { color: var(--bearish) !important; }
.metric-strip--terminal .metric-uncertain { color: var(--uncertain) !important; }

.event-workspace--panel { margin-top: 20px; border: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 0; background: var(--surface); box-shadow: none; }
.filter-bar--dense { grid-template-columns: 120px 132px 116px 116px 116px minmax(220px, 1fr) 70px; gap: 8px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: var(--surface-2); padding: 12px 0; }
.filter-bar--dense label span { color: var(--text-muted); font-size: 10px; font-weight: 650; }
.filter-bar--dense select, .filter-bar--dense input { min-height: 36px; background: var(--surface); }
.filter-actions .ghost-button { width: 70px; min-width: 70px; }

.event-table--terminal { overflow: visible; background: var(--surface); }
.event-table--terminal .event-table__head { display: none; }
.event-row--terminal { position: relative; grid-template-columns: 72px 172px minmax(0, 1fr) 78px 62px 62px 70px; gap: 14px; min-height: 102px; border-bottom: 1px solid var(--border); background: transparent; padding: 15px 0; }
.event-row--terminal:hover { border-color: var(--border); background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.event-row--terminal .event-main h2, .event-row--terminal .event-main h2 a, .event-row--featured .event-main h2 a { font-size: 16px; line-height: 1.45; font-weight: 650; letter-spacing: -.006em; }
.event-row--terminal .event-main p, .event-row--featured .event-main p { max-width: 72ch; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.event-row--featured { min-height: 102px; border-color: var(--border); background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.event-row--featured .event-main h2 a { font-size: 16px; }
.event-time strong, .event-company strong { color: var(--text-strong); font-size: 13px; font-weight: 650; }
.event-time span, .event-company small, .event-meta-line { color: var(--text-muted); font-size: 11px; }
.ticker-chip, .translation-tag, .impact-pill, .provider-state { border-radius: 4px; }
.ticker-chip { min-height: 22px; border: 1px solid var(--border-strong); background: transparent; color: var(--text-strong); padding: 2px 6px; font-size: 11px; }
.translation-tag { border: 0; background: transparent; color: var(--text-muted); padding: 0; font-size: 11px; }
.impact-pill { min-height: 24px; border: 0; background: transparent; padding: 0; color: var(--text-muted); font-size: 12px; font-weight: 650; }
.impact-bullish .impact-pill { color: var(--bullish); }
.impact-bearish .impact-pill { color: var(--bearish); }
.impact-uncertain .impact-pill { color: var(--uncertain); }
.score { color: var(--text-strong); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.score-hot { color: var(--text-strong); }
.source-badge { width: 25px; height: 25px; border: 1px solid var(--border-strong); background: var(--surface-2) !important; color: var(--text-muted); box-shadow: none; }
.source-link--text { min-width: 34px; height: 26px; border: 1px solid var(--border-strong); border-radius: 4px; background: transparent; color: var(--text-muted); padding: 0 6px; font-size: 10px; }
.source-link--text:hover { background: var(--surface-2); color: var(--text-strong); }

.status-rail--terminal { top: 78px; gap: 0; border-left: 1px solid var(--border); padding-left: 18px; }
.status-rail--terminal .rail-panel, .status-rail--terminal .rail-panel:first-child { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; box-shadow: none; padding: 0 0 15px; margin-bottom: 15px; }
.status-rail--terminal .rail-panel:last-child { border-bottom: 0; }
.rail-title h2 { color: var(--text-strong); font-size: 12px; font-weight: 700; }
.rail-title a { color: var(--text-muted); font-size: 11px; }
.status-rail--terminal .provider-list li { border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; padding: 9px 0; }
.status-rail--terminal .provider-list li:last-child { border-bottom: 0; }
.health-stack div { min-height: 44px; border-radius: 0; padding: 8px 0; }
.alert-list li { border-radius: 0; padding: 8px 0; }
.upcoming-list { gap: 0; }
.upcoming-list a, .upcoming-empty { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; padding: 10px 0; }
.upcoming-list a:hover { border-color: var(--border); background: var(--surface-2); transform: none; }

.panel, .detail-card, .data-source-card, .calendar-board, .login-panel { border-color: var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.admin-nav { top: 78px; border: 0; border-right: 1px solid var(--border); border-radius: 0; background: transparent; box-shadow: none; padding: 4px 18px 22px 0; }
.admin-nav a { min-height: 39px; border-radius: var(--radius-sm); padding-left: 12px; }
.admin-nav a.is-active { background: var(--accent-soft); color: var(--text-strong); box-shadow: inset 2px 0 0 var(--accent); }

.login-body { background: var(--bg); }
.login-panel { border-radius: 12px; box-shadow: var(--shadow-hover); }
.login-panel h1 { font-size: 28px; }
.login-panel > button[type="submit"] { background: var(--accent); border-color: var(--accent); color: var(--on-primary); }
.login-panel > button[type="submit"]:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

@media (max-width: 1280px) {
  .event-row--terminal { grid-template-columns: 68px 154px minmax(0, 1fr) 72px 60px 60px 68px; }
}

@media (max-width: 760px) {
  .metric-strip--terminal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-strip--terminal .metric-primary { grid-column: 1 / -1; }
  .event-row--terminal, .event-row--featured { grid-template-columns: 1fr 1fr; min-height: 0; padding: 13px 0; }
  .event-row--terminal .event-main { grid-column: 1 / -1; grid-row: 1; }
  .event-time, .event-company { grid-row: 2; }
}

@media (max-width: 520px) {
  .filter-bar--dense { grid-template-columns: 1fr; }
  .filter-search, .filter-actions { grid-column: auto; }
  .event-row--terminal, .event-row--featured { grid-template-columns: 1fr; }
  .event-time, .event-company { grid-row: auto; }
}
