/* Boss dashboard — black-gold business tokens, fixed layout, no Bento. */
:root {
  --accent: #c9a227;
  --accent-ink: #7a5b00;
  --brand-50: color-mix(in srgb, var(--accent) 14%, transparent);
  --bg-page: #f4f0e8;
  --bg-sidebar: rgba(255, 252, 246, .72);
  --bg-card: rgba(255, 252, 246, .78);
  --bg-card-solid: #fffaf0;
  --bg-card-soft: rgba(255, 252, 246, .58);
  --text-1: #1b1a17;
  --text-2: #5a554b;
  --text-3: #6f6759;
  --border-soft: rgba(120, 100, 60, .16);
  --border-strong: rgba(60, 50, 30, .24);
  --c-green-ink: #15803d;
  --c-red-ink: #b91c1c;
  --c-orange-ink: #b45309;
  --radius: 8px;
  --radius-card: 12px;
  --shadow: 0 1px 2px rgba(72, 62, 46, .05), 0 8px 24px rgba(72, 62, 46, .06);
  --font-ui: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
[data-theme="dark"] {
  --accent: #d4af37;
  --accent-ink: #e6c65c;
  --bg-page: #0b0b0c;
  --bg-sidebar: rgba(255, 255, 255, .06);
  --bg-card: rgba(255, 255, 255, .08);
  --bg-card-solid: #171614;
  --bg-card-soft: rgba(255, 255, 255, .06);
  --text-1: #f2ead7;
  --text-2: #c9c0ae;
  --text-3: #a39a88;
  --border-soft: rgba(255, 255, 255, .14);
  --border-strong: rgba(212, 175, 55, .35);
  --c-green-ink: #6ee7a8;
  --c-red-ink: #fca5a5;
  --c-orange-ink: #fcd34d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .24);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg-page); color: var(--text-1); font-family: var(--font-ui); font-size: 13px; line-height: 1.5; }
button, input, select { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent); }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }

.app-shell {
  min-height: 100vh; display: grid; grid-template-columns: 220px 1fr;
  grid-template-rows: 48px 1fr; grid-template-areas: "titlebar titlebar" "sidebar workspace";
}
.titlebar { grid-area: titlebar; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.brand-mark { width: 24px; height: 24px; border-radius: 7px; background: var(--accent); color: #111; display: grid; place-items: center; font-size: 12px; }
.brand-badge { margin-left: 4px; }
.titlebar-actions { display: flex; align-items: center; gap: 8px; }
.sidebar {
  grid-area: sidebar; margin: 0 0 16px 16px; padding: 12px;
  background: var(--bg-sidebar); border: 1px solid var(--border-soft);
  border-radius: var(--radius-card); box-shadow: var(--shadow); backdrop-filter: blur(18px);
}
.nav-label { margin: 16px 8px 6px; color: var(--text-3); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--text-2);
  text-align: left; cursor: pointer; text-decoration: none; font-size: 12px;
}
.nav-item:hover:not(:disabled) { background: var(--bg-card-soft); }
.nav-item.is-active { background: var(--brand-50); color: var(--accent-ink); font-weight: 600; }
.nav-item:disabled { opacity: .42; cursor: not-allowed; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .65; }
.workspace { grid-area: workspace; padding: 0 16px 24px; min-width: 0; }
.boss-main { overflow-x: auto; }
.gate { max-width: 460px; margin: 10vh auto; padding: 28px; background: var(--bg-card-solid); border: 1px solid var(--border-soft); border-top: 3px solid var(--accent); box-shadow: var(--shadow); }
.gate h1 { margin: 4px 0 8px; font-size: 28px; }
.gate .btn { margin-top: 18px; display: inline-block; }

.eyebrow { margin-bottom: 4px; color: var(--accent-ink); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.badge { display: inline-block; padding: 3px 8px; border: 1px solid var(--border-soft); border-radius: 999px; color: var(--text-3); background: var(--bg-card-soft); font-size: 10px; white-space: nowrap; }
.badge.danger { color: var(--c-red-ink); border-color: color-mix(in srgb, var(--c-red-ink) 32%, transparent); }
.badge.warn { color: var(--c-orange-ink); border-color: color-mix(in srgb, var(--c-orange-ink) 32%, transparent); }
.muted { color: var(--text-3); font-size: 11px; line-height: 1.6; }
.btn { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--bg-card-solid); color: var(--text-1); padding: 7px 12px; cursor: pointer; }
.btn:hover { border-color: var(--border-strong); }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 700; }
.btn.small { padding: 4px 9px; font-size: 11px; }

.boss-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 10px; }
.boss-head h1 { font-size: 26px; line-height: 1.15; }
.boss-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.range-tabs { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--border-soft); border-radius: 999px; background: var(--bg-card-soft); }
.range-tab { padding: 4px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--text-3); font-size: 10px; cursor: pointer; }
.range-tab.is-active { background: var(--bg-card-solid); color: var(--accent-ink); font-weight: 600; }
.sync-status { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 10px; white-space: nowrap; }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-green-ink); }
.scope-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; color: var(--text-3); font-size: 10px; }
.scope-chip { padding: 4px 9px; border: 1px solid var(--border-soft); border-radius: 999px; background: var(--bg-card-soft); color: var(--text-2); font-size: 10px; cursor: pointer; }
.scope-chip.is-active { border-color: var(--border-strong); background: var(--brand-50); color: var(--accent-ink); font-weight: 600; }
.scope-chip:disabled { opacity: .42; cursor: not-allowed; }
.scope-note { margin-left: auto; }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.card { padding: 12px 14px; background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-card); box-shadow: var(--shadow); }
.kpi span { display: block; color: var(--text-3); font-size: 10px; }
.kpi strong { display: block; margin: 2px 0; font-size: 18px; line-height: 1.25; }
.kpi small { color: var(--text-3); font-size: 9px; line-height: 1.45; }
.kpi.warning strong { color: var(--c-red-ink); }
.boss-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.stack { display: grid; gap: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.section-head h2 { font-size: 13px; font-weight: 600; }
.bar-chart { display: flex; align-items: flex-end; gap: 7px; height: 150px; padding: 8px 4px 0; border-bottom: 1px solid var(--border-soft); }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; min-width: 18px; }
.bar { width: 100%; max-width: 34px; height: var(--h); border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--accent) 32%, var(--bg-card-soft)); border: 1px solid var(--border-soft); }
.bar.current { background: var(--accent); border-color: var(--accent); }
.bar-col small { color: var(--text-3); font-size: 9px; white-space: nowrap; }
.bar-value { color: var(--text-2); font-size: 9px; font-weight: 600; white-space: nowrap; margin-bottom: 2px; }
.bar-chart.is-dense .bar-value { display: none; }
.source-note { margin: 6px 0 0; color: var(--text-3); font-size: 9px; line-height: 1.5; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.boss-table th, .boss-table td { padding: 8px 6px; border-bottom: 1px solid var(--border-soft); font-size: 11px; text-align: left; white-space: nowrap; }
.boss-table th { color: var(--text-3); font-weight: 600; font-size: 10px; }
.mentor-row { cursor: pointer; }
.mentor-row:hover { background: var(--brand-50); }
.anomaly-list { border-top: 1px solid var(--border-soft); }
.anomaly-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.anomaly-row:last-child { border-bottom: 0; }
.anomaly-row strong { font-size: 11px; }
.anomaly-row p { margin: 1px 0 0; color: var(--text-3); font-size: 9px; line-height: 1.4; }
.anomaly-row > span:last-child { color: var(--text-3); font-size: 9px; white-space: nowrap; }
.ranking { display: block; }
.ranking-tabs { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--border-soft); border-radius: 999px; background: var(--bg-card-soft); }
.ranking-tab { padding: 3px 8px; border: 0; border-radius: 999px; background: transparent; color: var(--text-3); font-size: 10px; cursor: pointer; }
.ranking-tab.is-active { background: var(--bg-card-solid); color: var(--accent-ink); font-weight: 600; }
.ranking-bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding: 8px 4px 0; border-bottom: 1px solid var(--border-soft); overflow-x: auto; }
.rank-bar-col { flex: 1; min-width: 54px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.rank-bar-value { color: var(--text-2); font-size: 9px; font-weight: 600; white-space: nowrap; }
.rank-bar { width: 72%; max-width: 46px; height: var(--h); max-height: 112px; border-radius: 4px 4px 2px 2px; background: color-mix(in srgb, var(--accent) 30%, var(--bg-card-soft)); border: 1px solid var(--border-soft); }
.rank-bar-col:first-child .rank-bar { background: var(--accent); border-color: var(--accent); }
.rank-bar-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: 9px; }
.rank-bar-sub { color: var(--text-3); font-size: 8px; white-space: nowrap; }
.analysis-fact, .analysis-cause, .analysis-gap { margin-top: 6px; padding: 7px 9px; border-left: 2px solid var(--c-green-ink); background: var(--bg-card-soft); }
.analysis-cause { border-left-color: var(--c-orange-ink); }
.analysis-gap { border-left-color: var(--border-strong); }
.analysis-fact strong, .analysis-cause strong, .analysis-gap strong { display: block; font-size: 10px; }
.analysis-fact p, .analysis-cause p, .analysis-gap p { margin: 2px 0 0; color: var(--text-3); font-size: 10px; line-height: 1.5; }
.proto-note { margin: 12px 0 0; color: var(--text-3); font-size: 9px; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(17, 17, 17, .48); display: flex; justify-content: flex-end; }
.mentor-drawer { width: min(440px, 94vw); height: 100%; overflow: auto; background: var(--bg-card-solid); border-left: 1px solid var(--border-soft); padding: 18px; box-shadow: -20px 0 50px rgba(0, 0, 0, .18); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.drawer-head h2 { font-size: 20px; }
.icon-btn { border: 1px solid var(--border-soft); background: transparent; color: var(--text-2); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.drawer-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.drawer-meta div { padding: 8px; background: var(--bg-card-soft); border: 1px solid var(--border-soft); border-radius: var(--radius); }
.drawer-meta span { display: block; color: var(--text-3); font-size: 9px; }
.drawer-meta strong { display: block; margin-top: 2px; font-size: 13px; }
.mentor-drawer h3 { margin: 12px 0 5px; font-size: 11px; color: var(--text-2); }
.drawer-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.drawer-list strong { font-size: 11px; }
.drawer-list span { color: var(--text-3); font-size: 9px; }
.drawer-actions { display: flex; justify-content: flex-end; margin-top: 16px; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .boss-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: 48px auto 1fr; grid-template-areas: "titlebar" "sidebar" "workspace"; }
  .sidebar { margin: 0 12px 8px; display: flex; gap: 4px; overflow-x: auto; align-items: center; padding: 8px; }
  .nav-label, .nav-item:disabled { display: none; }
  .nav-item { width: auto; white-space: nowrap; }
  .workspace { padding: 0 12px 18px; }
  .boss-head { flex-direction: column; }
  .boss-actions { justify-content: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scope-note { margin-left: 0; }
  .boss-table { min-width: 760px; }
}
