/* =============================================================================
   Better KPIs — Design system
   All colors flow from CSS variables so the platform is white-label ready.
   Light + dark themes via [data-theme]. Brand color injected by app.js.
   ============================================================================= */

:root {
  --brand: #4f46e5;
  --accent: #0ea5a4;

  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --border: #e3e7f0;
  --text: #161b2e;
  --text-2: #5b6478;
  --muted: #8a93a8;

  --good: #16a34a;
  --good-bg: #e7f6ec;
  --bad: #e11d48;
  --bad-bg: #fde8ec;
  --warn: #d97706;
  --warn-bg: #fdf0dd;
  --hl-bg: #fff0b3;
  --hl-text: #5c4a03;

  /* chart palette */
  --c1: var(--brand);
  --c2: var(--accent);
  --c3: #f59e0b;
  --c4: #ec4899;
  --c5: #8b5cf6;
  --c6: #06b6d4;
  --c7: #22c55e;
  --c8: #64748b;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 27, 46, 0.04), 0 6px 20px rgba(20, 27, 46, 0.06);
  --shadow-sm: 0 1px 2px rgba(20, 27, 46, 0.05);
  --sidebar-w: 274px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0e1118;
  --surface: #161b27;
  --surface-2: #1f2535;
  --border: #283044;
  --text: #eef1f7;
  --text-2: #aab2c5;
  --muted: #7c869c;
  --good-bg: #14241b;
  --bad-bg: #2a1620;
  --warn-bg: #2a2113;
  --hl-bg: rgba(250, 204, 21, 0.24);
  --hl-text: #f7e8a0;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }
.ta-right { text-align: right; }
.ta-center { text-align: center; }

/* ---- App layout ---- */
#app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; transition: grid-template-columns 0.5s cubic-bezier(0.4, 1.12, 0.5, 1); }

/* ---- Sidebar ---- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px; border-bottom: 1px solid var(--border); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; font-weight: 800; font-size: 15px;
  display: grid; place-items: center; letter-spacing: -0.02em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; overflow: hidden; max-width: 200px; transition: max-width 0.45s ease, opacity 0.32s ease; }
.brand-text strong { font-size: 15px; }
.brand-text span { font-size: 11px; color: var(--muted); }

.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav-group { margin-bottom: 14px; }
.nav-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); padding: 4px 10px 6px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8.5px 10px; border-radius: 10px; cursor: pointer;
  color: var(--text-2); font-weight: 550; font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.nav-ic { width: 18px; text-align: center; font-size: 14px; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 7px;
  border-radius: 99px; background: var(--surface-2); color: var(--text-2);
  overflow: hidden; max-width: 80px; transition: max-width 0.45s ease, opacity 0.32s ease, padding 0.3s ease;
}
.nav-item.active .nav-badge { background: var(--brand); color: #fff; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.foot-info { flex: 1; min-width: 0; overflow: hidden; }
.company-chip { font-weight: 700; font-size: 13px; }

/* ---- Main / topbar ---- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 26px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.range-label { font-weight: 700; font-size: 15px; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.segctl { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg {
  border: 0; background: transparent; cursor: pointer; font: inherit;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  padding: 6px 11px; border-radius: 8px;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.custom-range { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.custom-range input {
  font: inherit; font-size: 12px; padding: 5px 8px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text);
}
.role-switch {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px 4px 10px;
}
.role-ic { color: var(--accent); font-size: 13px; }
.role-switch select { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; outline: none; }
.icon-btn {
  width: 36px; height: 34px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; cursor: pointer; font-size: 15px; color: var(--text-2);
}
.icon-btn:hover { color: var(--text); }

/* ---- View / page ---- */
.view { padding: 24px 26px 60px; overflow-y: auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 23px; }
.page-sub { margin: 5px 0 0; color: var(--text-2); font-size: 13.5px; max-width: 70ch; }
.page-head-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 13px; }
.section-title h2 { font-size: 15.5px; }
.section-title span { color: var(--muted); font-size: 12.5px; }

/* ---- Stat cards ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px 14px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.stat-icon {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 14px;
  background: color-mix(in srgb, var(--ic) 14%, transparent); color: var(--ic);
}
.stat-value { font-size: 26px; font-weight: 720; margin: 8px 0 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; min-height: 18px; position: relative; z-index: 1; }
.stat-value, .stat-top { position: relative; z-index: 1; }
.stat .spark { position: absolute; right: 0; bottom: 0; left: 0; width: 100%; opacity: 0.5; pointer-events: none; }
.stat.locked { background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 10px, var(--surface-2) 10px, var(--surface-2) 20px); }
.blur { filter: blur(7px); user-select: none; }

.delta { font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }
.delta-up { color: var(--good); }
.delta-down { color: var(--bad); }

/* ---- 12-col grid + cards ---- */
.grid12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-top: 4px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-head h3 { font-size: 14.5px; }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.card-body { padding: 16px 18px 18px; }
.span-1{grid-column:span 1}.span-2{grid-column:span 2}.span-3{grid-column:span 3}.span-4{grid-column:span 4}
.span-5{grid-column:span 5}.span-6{grid-column:span 6}.span-7{grid-column:span 7}.span-8{grid-column:span 8}
.span-9{grid-column:span 9}.span-10{grid-column:span 10}.span-11{grid-column:span 11}.span-12{grid-column:span 12}

/* ---- Charts ---- */
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }
.chart .axis.val { fill: var(--text-2); font-weight: 600; }
.donut-num { fill: var(--text); font-size: 22px; font-weight: 720; font-family: var(--font); }
.donut-sub { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.donut { display: block; margin: 0 auto; }
.legend { display: flex; flex-wrap: wrap; gap: 12px 16px; margin-top: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; }
.progress { background: var(--surface-2); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width 0.4s; }

/* ---- Sub-tabs ---- */
.subtabs { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 11px; margin-bottom: 4px; }
.subtab { border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 13px; color: var(--text-2); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.subtab:hover { color: var(--text); }
.subtab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
/* size to content so columns sit close together instead of stretching full width */
.data-table { width: auto; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 700; padding: 8px 14px; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; text-align: left; }
/* every column left-justified — header + value share the same left edge so each
   column reads as a clean, organized line. */
.data-table th.ta-right, .data-table td.ta-right { text-align: left; }
.data-table th.ta-center, .data-table td.ta-center { text-align: left; }
.data-table th.ta-left, .data-table td.ta-left { text-align: left; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }

/* ---- Badges / pills / notes ---- */
.badge, .pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 7px; }
.pill { border-radius: 99px; padding: 3px 11px; }
.badge-neutral, .pill-neutral { background: var(--surface-2); color: var(--text-2); }
.badge-good, .pill-good { background: var(--good-bg); color: var(--good); }
.badge-bad, .pill-bad { background: var(--bad-bg); color: var(--bad); }
.badge-warn, .pill-warn { background: var(--warn-bg); color: var(--warn); }
.badge-brand, .pill-brand { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }

.note { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; line-height: 1.5; border: 1px solid transparent; }
.note-info { background: color-mix(in srgb, var(--brand) 7%, transparent); border-color: color-mix(in srgb, var(--brand) 20%, transparent); color: var(--text); }
.note-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.note b { color: var(--brand); }

.lock-ic { color: var(--muted); vertical-align: middle; }
.locked-panel { display: flex; gap: 14px; align-items: center; padding: 22px; background: var(--surface-2); border-radius: var(--radius); color: var(--text-2); }
.locked-panel p { margin: 4px 0 0; font-size: 12.5px; }

.empty { padding: 60px; text-align: center; color: var(--muted); }

/* ---- Hero figures (C-suite top-line) ---- */
.mega-card { display: flex; flex-direction: column; gap: 8px; padding: 24px; min-height: 150px; justify-content: center; }
.mega-card.primary { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--surface)), var(--surface)); }
.mega-label { color: var(--text-2); font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.mega-value { font-size: 44px; font-weight: 760; letter-spacing: -0.025em; line-height: 1.02; font-variant-numeric: tabular-nums; }
.mega-card.primary .mega-value { font-size: 50px; }
.mega-sub { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.mega-card.locked { background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 10px, var(--surface-2) 10px, var(--surface-2) 20px); }
.demo-pill { background: var(--warn-bg); color: var(--warn); font-weight: 700; font-size: 11px; padding: 3px 10px; border-radius: 99px; }
.lob-share { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.lob-share > i { display: block; height: 100%; border-radius: 99px; }
.rev-split { display: flex; align-items: baseline; gap: 22px; flex-wrap: wrap; }
.rev-pending-val { font-size: 28px; font-weight: 740; color: var(--warn); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* KPI helper rows */
.kpi-inline { display: flex; align-items: baseline; gap: 8px; }
.kpi-inline .big { font-size: 22px; font-weight: 720; font-variant-numeric: tabular-nums; }
.metric-list { display: flex; flex-direction: column; gap: 14px; }
.metric-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-row .lbl { color: var(--text-2); font-size: 13px; }
.metric-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-track { flex: 1; }

/* ===== v4: department/LOB tree, collapsible sidebar, centered column ===== */
.brand { position: relative; }
.sidebar-toggle { margin-left: auto; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 15px; width: 28px; height: 28px; border-radius: 7px; flex: none; }
.sidebar-toggle:hover { background: var(--surface-2); color: var(--text); }

.nav-group { margin-bottom: 1px; }
.nav-dept { display: flex; align-items: center; gap: 0; border-radius: 10px; }
.nav-dept.active { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.nav-caret { border: 0; background: transparent; cursor: pointer; color: var(--muted); width: 22px; height: 32px; font-size: 10px; flex: none; transition: transform 0.15s; }
.nav-group.open .nav-caret { transform: rotate(90deg); }
.nav-caret-spacer { width: 22px; flex: none; display: inline-block; }
.nav-dept-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 2px; flex: 1; min-width: 0; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.nav-dept-link:hover { color: var(--text); }
.nav-dept.active .nav-dept-link { color: var(--brand); }
.nav-ic { width: 20px; text-align: center; font-size: 14px; flex: none; }
.nav-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; transition: max-width 0.45s ease, opacity 0.32s ease; }
.nav-subs { max-height: 0; overflow: hidden; transition: max-height 0.22s ease; }
.nav-group.open .nav-subs { max-height: 320px; }
.nav-sub { display: flex; align-items: center; gap: 9px; padding: 6px 10px 6px 34px; margin: 1px 0; border-radius: 8px; color: var(--text-2); font-size: 13px; cursor: pointer; }
.nav-sub:hover { background: var(--surface-2); color: var(--text); }
.nav-sub.active { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-weight: 600; }

/* disabled (not-yet-live) nav items — visible but greyed + not clickable */
.nav-dept-link.disabled, .nav-sub.disabled { opacity: 0.45; cursor: not-allowed; }
.nav-dept-link.disabled:hover, .nav-sub.disabled:hover { background: transparent; color: var(--text-2); }
.nav-dept-link.disabled .nav-lbl, .nav-sub.disabled .nav-lbl { color: var(--text-2); }
.nav-soon { margin-left: auto; flex: none; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--surface-2); padding: 2px 6px; border-radius: 99px; }
.sidebar-collapsed .nav-soon { display: none; }

/* collapsed rail */
#app.sidebar-collapsed { grid-template-columns: 66px 1fr; }
.sidebar-collapsed .nav-caret,
.sidebar-collapsed .nav-caret-spacer,
.sidebar-collapsed .nav-subs,
.sidebar-collapsed .foot-info { display: none; }
/* fade + collapse labels/badges smoothly instead of snapping */
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-lbl,
.sidebar-collapsed .nav-badge { opacity: 0; max-width: 0; padding-left: 0; padding-right: 0; }
.sidebar-collapsed .brand { justify-content: center; padding: 18px 0; gap: 0; }
.sidebar-collapsed .brand-mark { width: 44px; height: 44px; border-radius: 13px; font-size: 17px; }
.sidebar-collapsed .sidebar-foot { justify-content: center; padding: 12px 0; }
.sidebar-collapsed .nav { padding: 12px 0; }
/* uniform, centered icon buttons in the rail (icon + active box concentric) */
.sidebar-collapsed .nav-dept { justify-content: center; }
.sidebar-collapsed .nav-dept-link { flex: none; width: 46px; height: 46px; padding: 0; margin: 3px auto; border-radius: 13px; display: flex; align-items: center; justify-content: center; gap: 0; }
.sidebar-collapsed .nav-lbl { height: 0; }
.sidebar-collapsed .nav-dept.active { background: transparent; }
.sidebar-collapsed .nav-dept.active .nav-dept-link { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.sidebar-collapsed .nav-dept-link:hover { background: var(--surface-2); }
.sidebar-collapsed .nav-ic { width: 46px; text-align: center; font-size: 23px; }
/* When collapsed, use more of the freed space but stay centered + capped so
   content doesn't sprawl into big empty gaps. */
#app.sidebar-collapsed .view-inner { max-width: 1720px; padding: 0 40px; }

/* hide the "Sample data" pill when demo mode is off */
#app.demo-off .demo-pill { display: none; }

/* centered content column — generous so it fills wide screens (tables size to
   their own content, so widening the column doesn't make them sprawl). */
.view { padding: 22px 0 64px; }
.view-inner { max-width: 1560px; margin: 0 auto; padding: 0 32px; }

/* topbar breadcrumb */
.crumb { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.crumb-sep { color: var(--muted); margin: 0 3px; }

/* collapsible content section */
.csec { margin: 0 0 12px; }
.csec-head { display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; border: 0; cursor: pointer; padding: 9px 2px; text-align: left; color: var(--text); border-bottom: 1px solid transparent; }
.csec-head:hover { color: var(--brand); }
.csec-caret { color: var(--muted); font-size: 11px; transition: transform 0.15s; flex: none; }
.csec.open .csec-caret { transform: rotate(90deg); }
.csec-head h2 { font-size: 15px; }
.csec-sub { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.csec-right { margin-left: auto; }
.csec-body { padding-top: 8px; }

/* cadence badge + lob chip + empty state */
.cadence-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--warn); background: var(--warn-bg); padding: 2px 8px; border-radius: 99px; }
.lob-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.lob-ic { font-size: 14px; }
.empty-state { display: flex; align-items: center; gap: 14px; padding: 26px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-2); }
.empty-ic { font-size: 26px; color: var(--muted); flex: none; }
.empty-state strong { font-size: 14px; color: var(--text); }
.empty-state p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }

/* ===== BetterTasks board ===== */
.bt-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1000px) { .bt-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .bt-board { grid-template-columns: 1fr; } }
.bt-col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-width: 0; }
.bt-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; padding: 0 2px; }
.bt-col-count { color: var(--muted); font-weight: 700; font-size: 12px; }
.bt-col-body { display: flex; flex-direction: column; gap: 9px; }
.bt-col-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 16px 0; }
.bt-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; box-shadow: var(--shadow-sm); }
.bt-card.is-blocked { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.bt-card-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 7px; }
.bt-lob { font-size: 12px; }
.bt-title { font-weight: 650; font-size: 13.5px; line-height: 1.32; }
.bt-desc { color: var(--text-2); font-size: 12px; margin-top: 4px; }
.bt-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 9px; font-size: 11.5px; color: var(--muted); }
.bt-assignee { font-weight: 600; color: var(--text-2); }
.bt-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 11px; }
.bt-actions { display: flex; gap: 4px; }
.bt-btn { border: 1px solid var(--border); background: var(--surface); width: 26px; height: 26px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-size: 12px; line-height: 1; }
.bt-btn:hover { color: var(--text); background: var(--surface-2); }
.bt-btn.on-bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); background: var(--bad-bg); }
.bt-btn.on-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: var(--warn-bg); }
.bt-input { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: 100%; }
.bt-input.sm { font-size: 12px; padding: 5px 8px; width: auto; }
select.bt-input { cursor: pointer; }
.bt-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px; }
.bt-form { display: flex; flex-direction: column; gap: 10px; max-width: 780px; }
.bt-form-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 760px) { .bt-form-row { grid-template-columns: 1fr 1fr; } }
.bt-form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.btn-primary { background: var(--brand); color: #fff; border: 0; border-radius: 9px; padding: 9px 16px; font: inherit; font-weight: 650; font-size: 13px; cursor: pointer; }
.btn-primary:hover { filter: brightness(1.07); }
.bt-wins { display: flex; flex-direction: column; gap: 8px; }
.bt-win { display: flex; align-items: center; gap: 8px; padding: 8px 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; font-size: 13px; }

/* ===== Yellow highlight + Action Items ===== */
.hl { background: var(--hl-bg); color: var(--hl-text); padding: 1px 6px; border-radius: 4px; font-weight: 650; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.action-list { display: flex; flex-direction: column; gap: 10px; }
.action-item { display: flex; gap: 14px; padding: 15px 16px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--warn); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.action-item.is-now { border-left-color: var(--bad); }
.action-num { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--hl-bg); color: var(--hl-text); font-weight: 800; display: grid; place-items: center; font-size: 14px; }
.action-body { flex: 1; min-width: 0; }
.action-title { font-size: 14.5px; font-weight: 600; line-height: 1.5; }
.action-detail { color: var(--text-2); font-size: 13px; margin-top: 7px; line-height: 1.55; }
.action-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.action-done-list { display: flex; flex-direction: column; gap: 2px; }
.action-done { display: flex; gap: 10px; align-items: center; padding: 7px 4px; font-size: 13px; color: var(--text-2); }
.action-done .check { color: var(--good); font-weight: 800; flex: none; }

/* ===== Motion: gentle view transition + smooth nav, respects reduce-motion ===== */
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.view-inner { animation: viewIn 0.44s cubic-bezier(0.22, 1, 0.36, 1) both; }
.nav-dept-link, .nav-sub { transition: background 0.15s ease, color 0.15s ease, padding 0.25s ease; }
.seg, .subtab, .stat, .card, .bt-card, .action-item { transition: background 0.15s ease, box-shadow 0.18s ease, transform 0.18s ease, color 0.15s ease; }
.stat:hover, .action-item:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- Responsive ---- */
@media (max-width: 1080px) {
  .grid12 > .card { grid-column: span 12 !important; }
}
@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; flex-direction: row; flex-wrap: wrap; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-group { margin: 0; }
}
