/* Akshaya — FriendLoan brand design system (Bright Azure + Coral + Lime + Soft Gold; Plus Jakarta Sans / Inter).
   Layout: a quiet white sidebar with grouped navigation, slate canvas, content cards. One loud element per page
   (the target track on the Command Center); everything else stays disciplined. */
:root {
  --bg: #F6F8FB; --surface: #FFFFFF; --surface-2: #F1F5F9; --surface-3: #E9EEF5;
  --line: #E2E8F0; --line-2: #EDF1F6;
  --ink: #111827; --ink-2: #374151; --muted: #6B7280; --faint: #94A3B8;
  --blue: #0066FF; --blue-d: #0044AA; --blue-dd: #002D70; --blue-50: #EFF6FF; --blue-100: #CCE0FF; --blue-300: #4D94FF;
  --coral: #FF6154; --coral-d: #CC4E43; --coral-50: #FFE8E6;
  --lime: #A3E635; --lime-d: #65A30D; --lime-50: #ECFCCB;
  --gold: #FFD166; --gold-d: #CC9E00; --gold-50: #FFF3CC;
  --ok: #3F6212; --ok-bg: #ECFCCB; --warn: #8A5A00; --warn-bg: #FFF3CC; --bad: #B42318; --bad-bg: #FFE8E6;
  --info: #0044AA; --info-bg: #EFF6FF; --mute: #475569; --mute-bg: #EEF2F6;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(0, 102, 255, .10);
  --shadow-lg: 0 16px 40px rgba(0, 45, 112, .16);
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --side-w: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1222; --surface: #131C2E; --surface-2: #1A2438; --surface-3: #223049; --line: #26324A; --line-2: #1F2A3F;
    --ink: #F1F5F9; --ink-2: #CBD5E1; --muted: #94A3B8; --faint: #64748B;
    --blue: #4D94FF; --blue-d: #80B3FF; --blue-50: #13284D; --blue-100: #1C3A6E;
    --coral: #FF8A82; --coral-d: #FF8A82; --coral-50: #3A1D1F; --lime: #BEF264; --lime-d: #BEF264; --lime-50: #1E2E12;
    --gold: #FFD166; --gold-50: #3A3016;
    --ok: #BEF264; --ok-bg: #1E2E12; --warn: #FFD166; --warn-bg: #3A3016; --bad: #FF8A82; --bad-bg: #3A1D1F;
    --info: #80B3FF; --info-bg: #13284D; --mute: #94A3B8; --mute-bg: #1F2A3F;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 4px 14px rgba(0,0,0,.35); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1222; --surface: #131C2E; --surface-2: #1A2438; --surface-3: #223049; --line: #26324A; --line-2: #1F2A3F;
  --ink: #F1F5F9; --ink-2: #CBD5E1; --muted: #94A3B8; --faint: #64748B;
  --blue: #4D94FF; --blue-d: #80B3FF; --blue-50: #13284D; --blue-100: #1C3A6E;
  --coral: #FF8A82; --coral-d: #FF8A82; --coral-50: #3A1D1F; --lime: #BEF264; --lime-d: #BEF264; --lime-50: #1E2E12;
  --gold: #FFD166; --gold-50: #3A3016;
  --ok: #BEF264; --ok-bg: #1E2E12; --warn: #FFD166; --warn-bg: #3A3016; --bad: #FF8A82; --bad-bg: #3A1D1F;
  --info: #80B3FF; --info-bg: #13284D; --mute: #94A3B8; --mute-bg: #1F2A3F;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 4px 14px rgba(0,0,0,.35); --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14.5px/1.55 var(--font); font-feature-settings: "cv11", "ss01"; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; color: var(--ink); }
p { margin: 0; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: .92em; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.ic { flex: none; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line);
  padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 14px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand b { font: 800 17px/1.1 var(--display); letter-spacing: -.02em; display: block; }
.brand small { font-size: 12px; color: var(--muted); }
.nav h6 { margin: 14px 10px 4px; font: 600 12px/1.4 var(--font); color: var(--faint); letter-spacing: .01em; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.nav a .ic { color: var(--faint); }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.on { background: var(--blue-50); color: var(--blue-d); font-weight: 600; }
.nav a.on .ic { color: var(--blue); }
.nav a .count { margin-left: auto; background: var(--coral); color: #fff; font-size: 11.5px; font-weight: 700; padding: 0 7px; border-radius: 99px; line-height: 19px; }
.side-foot { margin-top: auto; padding: 12px 6px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me .who { min-width: 0; }
.me .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who > span { font-size: 12px; color: var(--muted); }
.side-tools { display: flex; gap: 6px; }
.status-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 6px 8px; border-radius: 8px; background: var(--surface-2); }
.status-chip.killed { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.main { min-width: 0; padding: 26px 36px 72px; }
.topbar { display: none; }
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-h h1 { font: 700 27px/1.15 var(--display); letter-spacing: -.025em; }
.page-h .sub { color: var(--muted); font-size: 14.5px; max-width: 76ch; margin-top: 6px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- layout helpers */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; } .span-all { grid-column: 1 / -1; }
.stack { display: grid; gap: 16px; align-content: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; }

/* ---------- cards & tiles */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-h { padding: 16px 20px 0; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.card-h h2 { font: 650 15.5px/1.3 var(--display); letter-spacing: -.01em; }
.card-h .hint { font-size: 12.5px; color: var(--muted); }
.tile { display: flex; flex-direction: column; gap: 4px; }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tile .v { font: 750 28px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.tile .v a { color: inherit; }
.tile .v small { font: 600 14px var(--font); color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.tile .s { font-size: 12.5px; color: var(--muted); }
a.count-link { color: inherit; border-bottom: 1px dashed transparent; }
a.count-link:hover { text-decoration: none; border-bottom-color: currentColor; }
.tile-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.tile-strip > div { padding: 2px 16px; border-left: 1px solid var(--line-2); }
.tile-strip > div:first-child { padding-left: 0; border-left: 0; }
.tile-strip.s6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* ---------- the target track (the one loud element) */
.target { position: relative; overflow: hidden; background: linear-gradient(135deg, #0066FF 0%, #0044AA 55%, #002D70 100%); color: #fff; border: 0; }
.target::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, .28), rgba(255, 209, 102, 0) 65%); pointer-events: none; }
.target .k { color: rgba(255,255,255,.78); }
.target .big { font: 800 44px/1 var(--display); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.target .of { font: 600 16px var(--font); color: rgba(255,255,255,.75); margin-left: 6px; letter-spacing: 0; }
.track { position: relative; height: 12px; background: rgba(255,255,255,.18); border-radius: 99px; margin: 30px 0 10px; }
.track > i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, #A3E635, #BEF264); }
.track > b { position: absolute; top: -6px; bottom: -6px; width: 2px; background: #FFD166; border-radius: 2px; }
.track > b::after { content: attr(data-label); position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font: 600 11.5px var(--font); color: #FFD166; white-space: nowrap; }
.target-foot { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: rgba(255,255,255,.82); }
.target-foot b { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--blue); }
.bar.ok > i { background: var(--lime-d); } .bar.warn > i { background: var(--gold-d); } .bar.bad > i { background: var(--coral); }

/* ---------- funnel */
.funnel { display: grid; gap: 7px; }
.f-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 70px 54px; align-items: center; gap: 12px; font-size: 13.5px; }
.f-row .lbl { color: var(--ink-2); font-weight: 500; }
.f-row .fb { height: 26px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.f-row .fb i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--blue), var(--blue-300)); min-width: 3px; }
.f-row:last-child .fb i { background: linear-gradient(90deg, var(--lime-d), var(--lime)); }
.f-row .n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.f-row .cv { text-align: right; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------- pills, dots */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font: 600 12px/1.5 var(--font); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.info { background: var(--info-bg); color: var(--info); }
.pill.mute { background: var(--mute-bg); color: var(--mute); }
.grade { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; font: 700 12px var(--display); }
.grade.gAp { background: var(--lime-50); color: var(--ok); } .grade.gA { background: var(--blue-50); color: var(--info); }
.grade.gB { background: var(--gold-50); color: var(--warn); } .grade.gC, .grade.gD { background: var(--mute-bg); color: var(--mute); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--lime-d); box-shadow: 0 0 0 3px var(--ok-bg); } .dot.warn { background: var(--gold-d); box-shadow: 0 0 0 3px var(--warn-bg); }
.dot.bad { background: var(--coral); box-shadow: 0 0 0 3px var(--bad-bg); } .dot.mute { background: var(--faint); }
.av { display: inline-grid; place-items: center; border-radius: 50%; background: var(--av-bg); color: var(--av-fg); font-family: var(--display); font-weight: 750; flex: none; letter-spacing: -.02em; }
:root[data-theme="dark"] .av { filter: saturate(.9) brightness(1.05); }

/* ---------- tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl th.num { text-align: right; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.wrap { white-space: normal; min-width: 220px; }
.tbl .name { font-weight: 600; color: var(--ink); }
.tbl tr.edited td { background: color-mix(in srgb, var(--gold-50) 60%, transparent); }
.tbl tr.dropped td { opacity: .55; text-decoration: line-through; text-decoration-color: var(--faint); }
.tbl tr.dropped td.keep { text-decoration: none; opacity: 1; }
.card.flush .tbl th:first-child, .card.flush .tbl td:first-child { padding-left: 20px; }
.card.flush .tbl th:last-child, .card.flush .tbl td:last-child { padding-right: 20px; }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px;
  font: 600 13.5px/1 var(--font); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(0, 102, 255, .28); }
.btn.primary:hover { background: #0052D9; }
.btn.ok { background: #3F7F0B; border-color: #3F7F0B; color: #fff; }
.btn.ok:hover { background: #356B09; }
.btn.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.coral { background: var(--coral); border-color: var(--coral); color: #fff; box-shadow: 0 4px 14px rgba(255, 97, 84, .3); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { width: 34px; padding: 0; }
.btn[disabled], .btn.busy { opacity: .55; cursor: progress; pointer-events: none; }
.in, select.in, textarea.in { height: 36px; border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 0 10px; background: var(--surface);
  color: var(--ink); font: 400 14px var(--font); min-width: 0; }
textarea.in { height: auto; padding: 9px 10px; line-height: 1.5; resize: vertical; width: 100%; }
.in:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 102, 255, .14); }
.in.sm { height: 30px; font-size: 13px; padding: 0 8px; }
.in.err { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(255, 97, 84, .14); }
label.f { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; border: 1px solid var(--line-2); }
.seg a, .seg button { padding: 5px 12px; border-radius: 8px; font: 500 13px var(--font); color: var(--muted); background: transparent; border: 0; cursor: pointer; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600; }
.switch input { position: absolute; opacity: 0; }
.switch .tr { width: 40px; height: 22px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .2s; }
.switch .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + .tr { background: var(--coral); }
.switch input:checked + .tr::after { transform: translateX(18px); }
.switch input:focus-visible + .tr { outline: 3px solid var(--blue); outline-offset: 2px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 550; font-size: 14px; white-space: nowrap; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--blue); border-bottom-color: var(--blue); }
.tabs a .c { font-size: 12px; color: var(--faint); margin-left: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.chip:hover { text-decoration: none; border-color: var(--blue-100); }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip .c { color: var(--faint); font-variant-numeric: tabular-nums; }
.chip.on .c { color: inherit; opacity: .7; }

/* ---------- empty states, notes, callouts */
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .em-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); }
.empty b { color: var(--ink); font-family: var(--display); font-size: 15px; }
.empty p { max-width: 46ch; font-size: 13.5px; }
.note { background: var(--surface-2); border-radius: var(--r); padding: 12px 14px; font-size: 13.5px; color: var(--ink-2); }
.callout { border-left: 3px solid var(--coral); background: var(--coral-50); border-radius: 0 var(--r) var(--r) 0; padding: 12px 14px; font-size: 13.5px; color: var(--ink); }
.callout.blue { border-color: var(--blue); background: var(--blue-50); }
.callout.lime { border-color: var(--lime-d); background: var(--lime-50); }
.advice { white-space: pre-line; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.list { display: grid; }
.list > .li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.list > .li:last-child { border-bottom: 0; }
.li .body { min-width: 0; flex: 1; }
.li .meta { font-size: 12.5px; color: var(--muted); }
.feed .li .body p { font-size: 13.5px; color: var(--ink-2); }
.md { font-size: 14px; line-height: 1.65; color: var(--ink-2); max-width: 82ch; }
.md h1 { font-size: 21px; margin: 0 0 10px; } .md h2 { font-size: 16px; margin: 20px 0 8px; } .md ul { padding-left: 20px; } .md li { margin: 4px 0; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.spec-editor { width: 100%; min-height: 460px; font: 13px/1.6 "JetBrains Mono", ui-monospace, Menlo, monospace; }

/* ---------- health strip */
.strip { display: grid; grid-template-columns: repeat(24, minmax(3px, 1fr)); gap: 2px; min-width: 140px; }
.strip i { height: 16px; border-radius: 3px; background: color-mix(in srgb, var(--lime-d) 55%, var(--surface-2)); }
.strip i.amber { background: var(--gold); } .strip i.red { background: var(--coral); }

/* ---------- kanban */
.board { display: grid; grid-template-columns: repeat(6, minmax(168px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border-radius: 14px; padding: 10px; min-width: 0; }
.col-h { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font: 650 13.5px var(--display); }
.col-h .c { font: 700 12.5px var(--font); background: var(--surface); padding: 1px 8px; border-radius: 99px; color: var(--ink-2); }
.kcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; margin-bottom: 8px; color: var(--ink); box-shadow: var(--shadow-sm); }
.kcard:hover { text-decoration: none; border-color: var(--blue-100); }
.kcard .t { font-weight: 600; font-size: 13.5px; gap: 6px; }
.ell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .m { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.kcard.late { border-left: 3px solid var(--coral); } .kcard.aging { border-left: 3px solid var(--gold); }

/* ---------- transcripts */
.turns { display: grid; gap: 8px; }
.turn { max-width: 78%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.55; }
.turn .who { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.turn.agent { background: var(--blue-50); border-bottom-left-radius: 4px; }
.turn.customer { background: var(--surface-2); margin-left: auto; border-bottom-right-radius: 4px; }

/* ---------- org chart */
.org { display: grid; justify-items: center; gap: 0; }
.org-node { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow-sm); min-width: 260px; color: var(--ink); }
.org-node:hover { text-decoration: none; border-color: var(--blue-100); box-shadow: var(--shadow-md); }
.org-node b { display: block; font-family: var(--display); font-size: 14.5px; }
.org-node > div > span { display: block; font-size: 12.5px; color: var(--muted); }
.org-node.human { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.org-node.human > div > span { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.org-link { width: 2px; height: 22px; background: var(--line); }
.org-teams { display: grid; grid-template-columns: repeat(5, minmax(180px, 1fr)); gap: 14px; width: 100%; position: relative; padding-top: 22px; }
.org-teams::before { content: ""; position: absolute; top: 0; left: 10%; right: 10%; height: 2px; background: var(--line); }
.org-team { background: var(--surface-2); border-radius: 14px; padding: 12px; position: relative; }
.org-team::before { content: ""; position: absolute; top: -22px; left: 50%; width: 2px; height: 22px; background: var(--line); }
.org-team h3 { font-size: 13.5px; margin: 2px 4px 10px; color: var(--ink-2); }
.org-agent { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; margin-bottom: 8px; color: var(--ink); }
.org-agent:hover { text-decoration: none; border-color: var(--blue-100); }
.org-agent b { font-size: 13.5px; display: block; } .org-agent > div > span { font-size: 12px; color: var(--muted); display: block; line-height: 1.4; }
.org-agent.sub { margin-left: 18px; position: relative; }
.org-agent.sub::before { content: ""; position: absolute; left: -12px; top: -8px; bottom: 50%; width: 10px; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); border-bottom-left-radius: 6px; }

/* ---------- toast & dialogs */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--surface); padding: 11px 16px;
  border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: min(560px, calc(100vw - 32px)); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--bad); color: #fff; }
dialog.dlg { border: 0; border-radius: var(--r-lg); padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.dlg::backdrop { background: rgba(15, 23, 42, .45); }
.dlg-b { padding: 20px; display: grid; gap: 12px; }
.dlg-b h3 { font-size: 17px; }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; }

/* ---------- approvals */
.batch-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.batch-sum { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 6px; }
.batch-sum div { font-size: 12.5px; color: var(--muted); }
.batch-sum b { display: block; font: 750 20px var(--display); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.decide-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); position: sticky; bottom: 0; z-index: 2; }
.decide-bar .grow { flex: 1; min-width: 200px; }
.edit-in { width: 108px; text-align: right; font-variant-numeric: tabular-nums; }
.edit-in.tenor { width: 62px; }
.was { display: block; font-size: 11.5px; color: var(--muted); text-decoration: line-through; }
.streak { display: flex; align-items: center; gap: 12px; }
.streak .bar { flex: 1; }
.thread { display: grid; gap: 8px; margin-top: 10px; }
.msg { padding: 9px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; }
.msg.agent { background: var(--blue-50); }
.msg .from { font-size: 11.5px; font-weight: 600; color: var(--muted); }

/* ---------- misc */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 180px; }
.gate { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.gate:last-child { border-bottom: 0; }
.hour { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); min-height: 46px; }
.hour .h { font: 650 13px var(--display); color: var(--muted); padding-top: 6px; }
.hour.now .h { color: var(--blue); }
.cb { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; flex-wrap: wrap; }
.cb.over { background: var(--bad-bg); }
.pager { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 20px; font-size: 13px; color: var(--muted); }
.json { font: 12.5px/1.5 "JetBrains Mono", ui-monospace, monospace; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.err-page { max-width: 520px; margin: 12vh auto; text-align: center; display: grid; gap: 14px; justify-items: center; }

/* ---------- responsive */
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .org-teams { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
}
@media (max-width: 1100px) {
  .g-main, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .tile-strip, .tile-strip.s6 { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 16px; }
  .tile-strip > div:nth-child(4) { padding-left: 0; border-left: 0; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 40; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .main { padding: 18px 16px 64px; }
  .page-h h1 { font-size: 23px; }
  .g-2, .g-4, .span-2 { grid-template-columns: minmax(0, 1fr); grid-column: auto; }
  .tile-strip, .tile-strip.s6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-strip > div { padding-left: 0 !important; border-left: 0 !important; padding-right: 8px; }
  .org-teams { grid-template-columns: minmax(0, 1fr); }
  .org-teams::before, .org-team::before { display: none; }
  .f-row { grid-template-columns: 86px minmax(0, 1fr) 56px 44px; gap: 8px; }
  .target .big { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print { .side, .topbar, .page-actions { display: none !important; } .shell { display: block; } }

/* ---------- phone pages (/m) */
.m-body { background: var(--bg); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.m-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.m-top .brand { padding: 0; } .m-top .brand b { font-size: 16px; }
.m-main { padding: 16px; display: grid; gap: 14px; max-width: 640px; margin: 0 auto; }
.m-main h1 { font: 750 22px/1.2 var(--display); letter-spacing: -.02em; }
.m-main .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.m-tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr); background: var(--surface);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.m-tabs a { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; border-radius: 10px; min-height: 44px; align-content: center; }
.m-tabs a.on { color: var(--blue); background: var(--blue-50); }
.m-tabs a:hover { text-decoration: none; }
.m-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.m-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.m-row:last-child { border-bottom: 0; }
.m-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-kpis .tile .v { font-size: 24px; }
.m-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.m-btns .btn { height: 44px; font-size: 14.5px; }
.m-btns .btn.wide { grid-column: 1 / -1; }
