/* Bảng thực chiến của Leo — trắng đen tối giản · SF Pro · mobile-first.
   Light only. Màu chỉ ở nơi cần chú ý (stop warning, ACTIVE/ENTERED, freshness STALE). */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #000000;
  --text-2: #555555;
  --text-3: #888888;
  --line: #e5e5e5;
  --line-strong: #000000;
  --good: #15803d;
  --bad: #b91c1c;
  --warn: #b45309;
  --info: #1d4ed8;
  --accent: #000000;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-width: 320px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 600; line-height: 1.25; letter-spacing: -.01em; margin: 0; }
a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.stale-banner {
  display: none; position: fixed; inset: 0 0 auto; z-index: 99;
  background: var(--bad); color: #fff; padding: 12px 20px;
  font-size: 15px; font-weight: 700; text-align: center;
}
body.build-stale .stale-banner { display: block; }

/* ── Trang ─────────────────────────────────────────────── */
.page-shell { min-height: 100vh; padding-bottom: 80px; }
.site-header, .dashboard-main, .site-footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.site-header { padding: 32px 0 24px; padding-top: max(32px, calc(22px + env(safe-area-inset-top))); }
.site-header .kicker { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.site-header h1 { font-size: clamp(28px, 4vw, 40px); margin: 0 0 6px; }
.site-header .meta { font-size: 14px; color: var(--text-2); margin-top: 6px; }
.page-nav { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 20px; font-size: 15px; }
.page-nav a { text-decoration: none; color: var(--text-2); padding-bottom: 2px; border-bottom: 1px solid transparent; }
.page-nav a:hover { color: var(--text); border-bottom-color: var(--text); }
.page-nav a.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.page-subtitle { color: var(--text-2); margin: 4px 0 0; max-width: 720px; font-size: 15px; }

.freshness-line { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 14px; font-size: 13px; color: var(--text-2); }
.freshness-chip { white-space: nowrap; }
.freshness-fresh { color: var(--good); }
.freshness-stale, .freshness-conflicting { color: var(--bad); font-weight: 600; }
.freshness-unknown, .freshness-partial { color: var(--warn); font-weight: 600; }
.freshness-empty { color: var(--text-3); }

.header-snapshot { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 14px; color: var(--text-2); }
.snapshot-chip { }
.snapshot-chip .lbl { color: var(--text-3); margin-right: 4px; }
.snapshot-chip .val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.quick-links { margin-top: 16px; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.quick-links .ql-k { color: var(--text); font-weight: 600; margin-right: 6px; }
.quick-links a { color: var(--text-2); text-decoration: none; }
.quick-links a:hover { color: var(--text); text-decoration: underline; }
.quick-links .group + .group { margin-top: 6px; }

.page-asof { color: var(--text-3); font-size: 13px; margin-top: 12px; }
#gen-time, #commit-line, #stale-countdown, #diff-summary { white-space: pre; }

/* ── Sections ─────────────────────────────────────────── */
.dashboard-main { display: flex; flex-direction: column; gap: 36px; }
.dashboard-section { min-width: 0; padding: 0; }
.dashboard-section + .dashboard-section { border-top: 1px solid var(--line); padding-top: 28px; }
.section-primary { }
.section-kicker { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; font-size: 18px; font-weight: 600; }
.section-kicker .sec-tag { color: var(--text-2); font-size: 13px; font-weight: 400; }
.sec-freshness { font-weight: 600; }
.sec-freshness-fresh, .sec-freshness-full { color: var(--good); }
.sec-freshness-stale, .sec-freshness-conflicting { color: var(--bad); }
.sec-freshness-unknown, .sec-freshness-partial, .sec-freshness-empty { color: var(--text-3); }
.section-stale { border-left: 3px solid var(--bad); padding-left: 16px; margin-left: -19px; }
.stale-summary { width: 100%; margin-top: 6px; padding: 6px 0 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--warn); font-weight: 600; }

/* ── Card-style cơ bản ────────────────────────────────── */
.feed-card { min-width: 0; margin-bottom: 14px; padding: 0; }
.feed-card:last-child { margin-bottom: 0; }
.feed-card .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; color: var(--text-2); font-size: 13px; }
.feed-card .meta .author { color: var(--text); font-weight: 600; }
.feed-card .topic { margin-bottom: 4px; color: var(--text); font-size: 15px; font-weight: 600; }
.feed-card .summary { color: var(--text); font-size: 15px; line-height: 1.6; }
.feed-card .summary.warn, .summary.warn { color: var(--warn); }

.holding-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.holding-head .ticker { font-size: 21px; font-weight: 700; letter-spacing: .02em; }
.holding-head .qty { color: var(--text-2); font-size: 13px; }

.kv { display: grid; grid-template-columns: minmax(110px, 160px) minmax(0, 1fr); gap: 8px 14px; padding: 4px 0; font-size: 14px; }
.kv .kv-k { color: var(--text-2); min-width: 0; padding-top: 1px; }
.kv .kv-v { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.kv.warn, .kv.warn .kv-v, .kv.warn .kv-k { color: var(--warn); }

.sub-topic { padding: 14px 0 4px; color: var(--text); font-size: 14px; font-weight: 600; }
.tk-core { font-weight: 600; }
.tk-link { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.tk-link:hover { text-decoration-thickness: 2px; }

.sector-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sector-row:last-of-type { border-bottom: 0; }
.sector-name { color: var(--text); }
.sector-codes { color: var(--text-2); overflow-wrap: anywhere; }

/* ── Grid cho nhiều card ───────────────────────────────── */
#portfolio-content, #alerts-content, #case-board-content, #watchlist-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
#portfolio-content .feed-card, #alerts-content .feed-card, #case-board-content .feed-card, #watchlist-content .feed-card { margin: 0; }

/* ── Watchlist status ──────────────────────────────────── */
.wl-status { font-size: 12px; font-weight: 600; }
.wl-active { color: var(--good); }
.wl-entered { color: var(--info); }

/* ── Loading skeleton (CSS-only) ────────────────────────── */
@keyframes loader-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.dashboard-section > div:empty:not(.empty)::before {
  content: 'đang tải…';
  display: block;
  color: var(--text-3);
  font-size: 13px;
  font-style: italic;
  padding: 8px 0;
}
.dashboard-section .feed-card:empty {
  min-height: 32px;
  background: linear-gradient(90deg, var(--line) 0%, #f5f5f5 50%, var(--line) 100%);
  background-size: 200% 100%;
  animation: loader-shimmer 1.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .dashboard-section .feed-card:empty { animation: none; background: var(--line); }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Macro / Bối cảnh thị trường — 2 cột sections khi ≥640px ── */
.macro-sections { display: grid; gap: 16px 28px; grid-template-columns: 1fr; }
.macro-section { min-width: 0; }
.macro-section > .topic { margin-bottom: 6px; font-weight: 600; }
@media (min-width: 640px) {
  .macro-sections { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 390px) {
  .macro-section { padding-bottom: 4px; border-bottom: 1px solid var(--line); }
  .macro-section:last-child { border-bottom: 0; padding-bottom: 0; }
}

#strategy-content { padding: 0; }
.strategy-subhead { margin: 14px 0 6px; color: var(--text); font-size: 14px; font-weight: 600; }
.strategy-list { margin: 0 0 10px; padding-left: 22px; }
.strategy-item { margin-bottom: 6px; color: var(--text); font-size: 14px; line-height: 1.6; }
.strategy-decision { margin: 4px 0; color: var(--good); font-size: 14px; }
.strategy-meta { margin-top: 10px; color: var(--text-2); font-size: 13px; }
.inline-code { padding: 1px 5px; background: var(--line); color: var(--text); font-size: 13px; }

/* ── Provenance ───────────────────────────────────────── */
.prov { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.prov a { color: var(--text-2); text-decoration: none; border-bottom: 1px dotted var(--text-3); }
.prov a:hover { color: var(--text); border-bottom-color: var(--text); }
.prov-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.badge { font-size: 13px; white-space: nowrap; font-weight: 600; }
.badge-fresh { color: var(--good); }
.badge-stale { color: var(--bad); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 360px; border-collapse: collapse; font-size: 14px; width: 100%; }
.table-scroll th { padding: 8px 6px; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 12px; font-weight: 600; text-align: left; }
.table-scroll td { padding: 9px 6px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: top; }
.align-center { text-align: center !important; }
.table-ticker { color: var(--text) !important; font-weight: 600; }
.changed-chip { color: var(--warn); font-size: 12px; font-weight: 600; margin-left: 6px; }
.empty { padding: 8px 0; color: var(--text-2); font-size: 14px; font-style: italic; }
.empty::before { content: '— '; color: var(--text-3); font-style: normal; }
.site-footer { margin-top: 40px; color: var(--text-3); font-size: 13px; text-align: left; padding-top: 20px; border-top: 1px solid var(--line); }

/* ── Overview / ───────────────────────────────────────────── */
.domain-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.domain-card { min-width: 0; display: block; padding: 0; color: var(--text); text-decoration: none; }
.domain-card:hover { color: var(--text); text-decoration: none; }
.domain-card .dc-name { font-size: 18px; font-weight: 600; }
.domain-card .dc-desc { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.domain-card .dc-status { margin-top: 12px; font-size: 12px; font-weight: 600; }
.domain-card .dc-status.live { color: var(--good); }
.domain-card .dc-status.shell { color: var(--text-3); }
.domain-card .dc-meta { margin-top: 4px; color: var(--text-3); font-size: 12px; }

/* ── Shell pages ───────────────────────────────────────── */
.shell-block { padding: 20px 0; }
.shell-block .shell-icon { font-size: 32px; margin-bottom: 8px; }
.shell-block .shell-title { font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.shell-block .shell-note { color: var(--text-2); font-size: 14px; margin: 0 0 16px; }
.shell-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Foreign flow — 2 cột ticker + pct ─────────────────── */
.ff-grid { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .ff-grid { grid-template-columns: 1fr; } }
.ff-col-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.ff-row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ff-row:last-child { border-bottom: 0; }
.ff-ticker { font-weight: 600; font-size: 15px; }
.ff-up .ff-pct { color: var(--good); font-weight: 600; font-variant-numeric: tabular-nums; }
.ff-down .ff-pct { color: var(--bad); font-weight: 600; font-variant-numeric: tabular-nums; }
.ff-note { margin-top: 12px; font-size: 13px; color: var(--text-2); font-style: italic; }

/* ── Pre-entry checklist ────────────────────────────────── */
.pre-entry-card { padding: 0; }
.pre-entry-intro { font-size: 14px; color: var(--text-2); margin-bottom: 12px; }
.pre-entry-list { margin: 0; padding-left: 22px; color: var(--text); }
.pre-entry-q { margin-bottom: 10px; font-size: 14px; line-height: 1.55; }
.pre-entry-q-title { font-weight: 600; }
.pre-entry-q-detail { margin-top: 2px; color: var(--text-2); font-size: 13px; }
.pre-entry-q-blank { margin-top: 2px; color: var(--text-3); font-style: italic; font-size: 13px; }

/* ── Lessons learned ─────────────────────────────────────── */
.lessons-list { margin: 0; padding-left: 22px; color: var(--text); }
.lesson-item { margin-bottom: 14px; }
.lesson-title { font-weight: 600; font-size: 15px; }
.lesson-insight { margin-top: 2px; color: var(--text-2); font-size: 14px; line-height: 1.6; }

/* ── Defense plan ───────────────────────────────────────── */
.defense-card { padding: 0; }
.defense-explain { font-size: 14px; color: var(--text-2); margin: 6px 0 10px; }
.defense-status { font-size: 13px; font-weight: 600; }
.defense-ok { color: var(--good); }
.defense-alert { color: var(--warn); }
.defense-warn { color: var(--bad); }

/* ── Alerts ─────────────────────────────────────────────── */
.suppressed-section { margin-top: 16px; }
.sub-head { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.alert-material { font-size: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.alert-material:last-child { border-bottom: 0; }
.alert-suppressed { font-size: 13px; color: var(--text-2); padding: 6px 0; border-bottom: 1px solid var(--line); }
.alert-suppressed:last-child { border-bottom: 0; }

/* ── Money flow snapshot ────────────────────────────────── */
.mf-list { display: flex; flex-direction: column; }
.mf-row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mf-row:last-child { border-bottom: 0; }
.mf-ticker { font-weight: 600; font-size: 15px; }
.mf-meta { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mf-notes { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.mf-note { font-size: 13px; color: var(--text-2); margin-bottom: 6px; line-height: 1.6; }

/* ── Mobile breakpoints ─────────────────────────────────── */
@media (max-width: 720px) {
  .site-header, .dashboard-main, .site-footer { width: calc(100% - 24px); }
  .site-header { padding-top: 16px; }
  .page-title { font-size: 26px; }
  .dashboard-main { gap: 28px; }
  .dashboard-section + .dashboard-section { padding-top: 24px; }
  .section-kicker { font-size: 16px; }
  .sector-row { grid-template-columns: 130px minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 390px) {
  .site-header, .dashboard-main, .site-footer { width: calc(100% - 20px); }
  .kv { grid-template-columns: 100px minmax(0, 1fr); gap: 6px 10px; font-size: 14px; }
  .summary { font-size: 15px; }
  .header-snapshot { gap: 4px 12px; font-size: 13px; }
  .sub-topic { font-size: 13px; }
  .prov { font-size: 12px; }
  body { font-size: 16px; }
}

/* Daily Rank — gộp 5 mục Leo theo dõi sát (round 5) */
.daily-rank-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.rank-block { min-width: 0; }
.rank-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rank-title { font-weight: 600; font-size: 15px; }
.rank-count { font-size: 13px; color: var(--text-2); }
.rank-fresh { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-left: auto; }
.rank-fresh-fresh, .rank-fresh-full { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.rank-fresh-stale, .rank-fresh-conflicting { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.rank-fresh-unknown, .rank-fresh-partial, .rank-fresh-empty { background: color-mix(in srgb, var(--text-3) 22%, transparent); color: var(--text-3); }
.rank-body { display: flex; flex-direction: column; gap: 4px; }
.rank-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); flex-wrap: wrap; }
.rank-row:last-child { border-bottom: 0; }
.rank-ticker { font-weight: 600; font-size: 14px; }
.rank-meta { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rank-q-num { font-weight: 600; min-width: 18px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rank-q-title { font-size: 13px; line-height: 1.5; }

/* Proposals note khi fallback tuần trước */
.proposals-note { padding: 8px 0 12px; color: var(--warn); font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 12px; }

/* Tiến độ team — Leo muốn cuối trang, ít nổi bật */
.dashboard-section-foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); opacity: 0.85; font-size: 14px; }
.dashboard-section-foot .section-kicker { font-size: 14px; }

@media (max-width: 390px) {
  .daily-rank-grid { grid-template-columns: 1fr; }
}

/* Round 8 — Daily Rank feed liên tục chỉ có Team đang để ý */
.rank-asof { font-size: 12px; color: var(--text-2); font-weight: 400; margin-left: auto; }
.rank-reason { width: 100%; margin-top: 4px; font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* ── A0 Team OS workflow map ─────────────────────────────── */
.wf-source-line { margin: 12px 0 0; font-size: 13px; color: var(--text-2); max-width: 720px; }
.wf-state-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.wf-state-tile { min-width: 0; padding-bottom: 4px; }
.wf-state-k { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; text-transform: uppercase; }
.wf-state-v { margin-top: 6px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.wf-unknown { color: var(--warn); }
.wf-state-who { margin-top: 8px; font-size: 13px; color: var(--text); }
.wf-state-hint { margin-top: 4px; font-size: 13px; color: var(--text-3); line-height: 1.5; }
.wf-unknown-note { margin: 16px 0 0; font-size: 13px; color: var(--warn); font-weight: 600; }

.wf-org { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.wf-org-item { padding: 16px 0 16px 20px; border-left: 1px solid var(--line); }
.wf-org-item.wf-org-top { border-left-color: var(--text); }
.wf-org-item + .wf-org-item { border-top: 1px solid var(--line); }
.wf-org-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; }
.wf-org-role { font-size: 15px; font-weight: 600; }
.wf-org-who { font-size: 15px; color: var(--text-2); }
.wf-org-may { margin-top: 6px; font-size: 14px; color: var(--text); }
.wf-org-not { margin-top: 2px; font-size: 13px; color: var(--text-3); }

.wf-surfaces { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wf-surface-name { font-size: 16px; font-weight: 600; }
.wf-surface-role { margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.wf-surface-use { margin-top: 8px; font-size: 14px; color: var(--text); line-height: 1.55; }
.wf-filter { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.wf-filter-k { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.wf-filter-p { margin: 0 0 6px; font-size: 14px; color: var(--text-2); }

.wf-cycle { list-style: none; margin: 0; padding: 0; }
.wf-cycle-item { display: flex; gap: 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wf-cycle-item:last-child { border-bottom: 0; }
.wf-cycle-n { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; color: var(--text-3); min-width: 2ch; }
.wf-cycle-t { font-size: 15px; }
.wf-cycle-sum { margin: 16px 0 0; font-size: 13px; color: var(--text-2); max-width: 720px; }

.wf-routing { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wf-route-home { font-size: 16px; font-weight: 600; }
.wf-route-for { margin-top: 4px; font-size: 14px; color: var(--text-2); }
.wf-route-rule { margin: 16px 0 0; font-size: 14px; color: var(--text); }

.wf-guard { margin: 0; padding-left: 22px; }
.wf-guard-item { margin-bottom: 10px; font-size: 14px; line-height: 1.5; }

.wf-hub-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.wf-hub-card { display: block; text-decoration: none; color: var(--text); padding-bottom: 4px; }
.wf-hub-card:hover { text-decoration: none; }
.wf-hub-id { font-size: 13px; font-weight: 600; color: var(--text-2); }
.wf-hub-title { margin-top: 4px; font-size: 16px; font-weight: 600; }
.wf-planned { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.wf-planned-row { display: grid; grid-template-columns: 40px minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.wf-planned-row:last-child { border-bottom: 0; }
.wf-planned-id { font-weight: 600; }
.wf-planned-path { color: var(--text-2); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wf-planned-st { color: var(--text-3); font-size: 12px; font-weight: 600; }

@media (max-width: 720px) {
  .wf-surfaces, .wf-routing { grid-template-columns: 1fr; }
  .wf-planned-row { grid-template-columns: 36px 1fr; }
  .wf-planned-title, .wf-planned-st { grid-column: 2; }
}
@media (max-width: 390px) {
  .wf-state-v { font-size: 18px; }
  .wf-org-item { padding-left: 14px; }
}

/* ── A1 Top Rank ───────────────────────────────────────── */
.tr-strip { display: grid; gap: 20px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tr-strip-name { font-size: 15px; font-weight: 600; }
.tr-strip-st { margin-top: 4px; font-size: 13px; font-weight: 600; }
.tr-strip-empty { margin-top: 8px; font-size: 13px; color: var(--text-3); line-height: 1.45; }
.tr-strip-list { list-style: none; margin: 10px 0 0; padding: 0; }
.tr-strip-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.tr-strip-row:last-child { border-bottom: 0; }
.tr-strip-tk { font-weight: 600; }
.tr-strip-sc { font-variant-numeric: tabular-nums; color: var(--text-2); }

.tr-toolbar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin-bottom: 12px; }
.tr-tabs { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.tr-tab {
  appearance: none; background: none; border: 0; border-bottom: 1px solid transparent;
  padding: 4px 0; margin: 0; font: inherit; font-size: 14px; color: var(--text-2); cursor: pointer;
}
.tr-tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.tr-search {
  min-width: 140px; flex: 1 1 160px; max-width: 240px;
  border: 0; border-bottom: 1px solid var(--line); padding: 6px 0;
  font: inherit; font-size: 14px; color: var(--text); background: transparent;
}
.tr-search:focus { outline: none; border-bottom-color: var(--text); }
.tr-board-status { margin: 0 0 12px; font-size: 14px; color: var(--text-2); }
.tr-board-reason { color: var(--text-3); }
.tr-sort {
  appearance: none; background: none; border: 0; padding: 0; margin: 0;
  font: inherit; font-size: 12px; font-weight: 600; color: inherit; cursor: pointer;
}
.tr-table td.tr-num { font-variant-numeric: tabular-nums; }
.tr-row-on td { font-weight: 600; }
.tr-table tbody tr { cursor: pointer; }
.tr-table tbody tr:hover td { background: transparent; }

.tr-drill { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.tr-drill-k { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.tr-drill-grid { display: grid; gap: 12px 20px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tr-drill-ik { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .02em; }
.tr-drill-iv { margin-top: 2px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tr-comp { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }

.tr-map { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tr-map-name { font-size: 16px; font-weight: 600; }
.tr-map-q { margin-top: 6px; font-size: 14px; }
.tr-map-w { margin-top: 8px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tr-map-not { margin-top: 4px; font-size: 13px; color: var(--text-3); }

@media (max-width: 720px) {
  .tr-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 390px) {
  .tr-strip { grid-template-columns: 1fr; }
  .tr-search { max-width: none; }
}

/* ── UI v2 — Map / Worker Hub / CK cockpit (Leo mockup 19/08) ─ */
body.ui-v2 {
  --bg: #eef3f9;
  --text: #12203a;
  --text-2: #5b6b86;
  --text-3: #8b97ad;
  --line: #e3eaf3;
  --line-strong: #12203a;
  --card: #ffffff;
  --shadow: 0 10px 32px rgba(18, 32, 58, .07);
  --radius: 22px;
  --good: #0f9f6e;
  --bad: #e11d48;
  --warn: #d97706;
  --info: #2563eb;
  --accent: #2563eb;
  --gpt: #0f9f6e;
  --claude: #7c3aed;
  --dsh: #2563eb;
  --mini: #ea580c;
}
body.ui-v2 {
  background:
    radial-gradient(1200px 420px at 8% -10%, #dbe7ff 0%, transparent 55%),
    radial-gradient(900px 380px at 100% 0%, #e8fbf3 0%, transparent 50%),
    var(--bg);
  color: var(--text);
}
body.ui-v2 .site-header, body.ui-v2 .dashboard-main, body.ui-v2 .site-footer {
  width: min(1240px, calc(100% - 32px));
}
body.ui-v2 .site-header h1 { font-size: clamp(28px, 4.2vw, 42px); letter-spacing: -.03em; }
body.ui-v2 .page-nav {
  gap: 6px;
  padding: 6px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}
body.ui-v2 .page-nav a {
  padding: 8px 12px;
  border-bottom: 0;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
body.ui-v2 .page-nav a:hover { background: #fff; color: var(--text); }
body.ui-v2 .page-nav a.active { background: #12203a; color: #fff; border-bottom-color: transparent; }
body.ui-v2 .dashboard-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px 22px;
  box-shadow: var(--shadow);
  border: 1px solid #fff;
}
body.ui-v2 .dashboard-section + .dashboard-section { border-top: 0; padding-top: 20px; }
body.ui-v2 .section-kicker { margin-bottom: 14px; }

.kpi-row { display: grid; gap: 12px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-tile {
  background: var(--card);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 1px solid #fff;
  min-width: 0;
}
.kpi-k { font-size: 12px; font-weight: 600; color: var(--text-2); }
.kpi-v { margin-top: 6px; font-size: 22px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-h { margin-top: 2px; font-size: 12px; color: var(--text-3); line-height: 1.4; }
.kpi-unknown .kpi-v { color: var(--warn); font-size: 18px; }

.map-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}
.map-hero, .role-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid #fff;
  min-width: 0;
}
.map-hero { grid-row: span 2; border: 1px solid #c7d7ff; box-shadow: 0 12px 40px rgba(37, 99, 235, .12); }
.map-hero-k { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.map-num {
  width: 32px; height: 32px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--info); color: #fff; font-weight: 700; font-size: 14px;
}
.star-pill {
  font-size: 12px; font-weight: 600; color: var(--info);
  background: #eef4ff; border-radius: 999px; padding: 4px 10px;
}
.map-hero h2 { margin: 10px 0 16px; font-size: 22px; }
.hero-split { display: grid; gap: 14px; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
.hero-box { background: #f7f9fd; border-radius: 16px; padding: 14px; }
.hero-box .lbl { font-size: 12px; color: var(--text-2); font-weight: 600; }
.hero-stack { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 14px; }
.role-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.role-name { font-size: 16px; font-weight: 700; }
.role-list { list-style: none; margin: 12px 0 0; padding: 0; }
.role-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.role-list li:last-child { border-bottom: 0; }
.role-live { margin-top: 12px; font-size: 12px; font-weight: 700; }
.tone-gpt { --role: var(--gpt); }
.tone-claude { --role: var(--claude); }
.tone-dsh-book { --role: var(--dsh); }
.tone-dsh-mini { --role: var(--mini); }
.role-card { border-top: 3px solid var(--role, var(--info)); }
.tone-pill {
  font-size: 11px; font-weight: 700; color: var(--role, var(--info));
  background: color-mix(in srgb, var(--role, var(--info)) 12%, #fff);
  border-radius: 999px; padding: 3px 8px;
}

.wh-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .9fr); }
.worker-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.worker-card {
  background: #f8fafc; border-radius: 16px; padding: 14px 16px; min-width: 0;
  border: 1px solid var(--line);
}
.worker-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.worker-name { font-weight: 700; }
.worker-lane { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.worker-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); display: inline-block; margin-right: 6px; }
.side-card { background: #f8fafc; border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.side-k { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.side-li { font-size: 13px; color: var(--text-2); padding: 6px 0; border-bottom: 1px solid var(--line); }

.ck-cockpit { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr) minmax(0, .9fr); margin-bottom: 8px; }
.ck-panel {
  background: var(--card); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); border: 1px solid #fff; min-width: 0;
}
.ck-panel h3 { font-size: 16px; margin-bottom: 12px; }
body.ui-v2 a.ck-panel { text-decoration: none; color: inherit; display: block; }
.rank-mini { list-style: none; margin: 0; padding: 0; }
.rank-mini li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px;
  align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.rank-n {
  width: 24px; height: 24px; border-radius: 8px; background: #eef4ff; color: var(--info);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.entry-row { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.entry-row:last-child { border-bottom: 0; }
.pipe-footer {
  text-align: center; color: var(--text-2); font-size: 13px;
  background: rgba(255,255,255,.7); border-radius: 999px; padding: 12px 18px; margin-top: 12px;
}
.map-note { font-size: 12px; color: var(--text-3); margin-top: 12px; }

@media (max-width: 960px) {
  .map-grid, .ck-cockpit, .wh-layout, .kpi-row { grid-template-columns: 1fr 1fr; }
  .map-hero { grid-column: 1 / -1; grid-row: auto; }
}
@media (max-width: 720px) {
  .map-grid, .ck-cockpit, .wh-layout, .kpi-row, .hero-split, .hero-stack, .worker-grid {
    grid-template-columns: 1fr;
  }
  body.ui-v2 .page-nav { border-radius: 16px; }
}

/* ── Team OS sidebar ───────────────────────────────────── */
body.os-app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  min-width: 320px;
}
body.os-app > .stale-banner { grid-column: 1 / -1; }
.os-side {
  position: sticky; top: 0; align-self: start; height: 100vh;
  padding: 22px 16px 24px; overflow: auto;
  background: rgba(255,255,255,.72);
  border-right: 1px solid var(--line);
}
.os-brand { display: block; text-decoration: none; color: inherit; margin-bottom: 22px; }
.os-brand-k { font-size: 13px; font-weight: 800; letter-spacing: .04em; }
.os-brand-t { margin-top: 4px; font-size: 12px; color: var(--text-3); line-height: 1.4; }
.os-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; }
.os-group { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; margin: 12px 4px 6px; }
.os-link {
  display: block; text-decoration: none; color: var(--text-2);
  font-size: 14px; font-weight: 600; padding: 8px 10px; border-radius: 10px;
}
.os-link:hover { background: #fff; color: var(--text); text-decoration: none; }
.os-link.active { background: #eef4ff; color: var(--info); }
.os-status {
  margin-top: auto; background: #fff; border-radius: 16px; padding: 12px 14px;
  border: 1px solid var(--line); font-size: 12px;
}
.os-status-k { font-weight: 700; margin-bottom: 6px; }
body.os-app .os-main.page-shell, body.os-app .os-main {
  width: auto; max-width: none;
  padding-left: 28px; padding-right: 28px;
}
body.os-app .site-header, body.os-app .dashboard-main, body.os-app .site-footer {
  width: min(1120px, 100%);
}

.os-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.os-table th { text-align: left; font-size: 12px; color: var(--text-2); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.os-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sev-p0 { color: var(--bad); font-weight: 700; }
.sev-p1 { color: var(--warn); font-weight: 600; }
.hub-list { display: flex; flex-direction: column; gap: 12px; }
.hub-item {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px;
  align-items: center; background: var(--card); border-radius: 18px;
  padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit;
}
.hub-item:hover { text-decoration: none; }
.hub-ico {
  width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; background: var(--info);
}
.hub-item h3 { font-size: 16px; }
.dsh-machine {
  display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, .7fr));
  gap: 12px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line);
}
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.filter-btn {
  appearance: none; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.kn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.flow-strip { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.flow-card { flex: 1 1 140px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.flow-n { width: 24px; height: 24px; border-radius: 50%; background: #12203a; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.flow-name { font-weight: 700; margin-top: 8px; }
.flow-who { color: var(--muted); font-size: 12px; margin: 4px 0; }
.flow-arrow { align-self: center; color: var(--muted); font-weight: 700; }

@media (max-width: 960px) {
  body.os-app { display: block; }
  .os-side { display: none; }
  body.os-app .os-main { padding-left: 0; padding-right: 0; }
  .hub-item, .dsh-machine { grid-template-columns: 44px minmax(0, 1fr); }
}



