/* Operational Systems Design — ops app.
   Standard SaaS shell: fixed left sidebar, scannable tables, one right detail
   panel. Warm-paper brand palette kept, applied with app usability discipline
   (high contrast, clear hierarchy, real navigation). */

:root {
  --paper:     #f4efe3;   /* app canvas */
  --surface:   #faf6ec;   /* cards / panels (lighter than canvas) */
  --sidebar:   #ece5d4;   /* sidebar */
  --hover:     #efe9da;
  --ink:       #1a2438;   /* primary text */
  --ink-2:     #4a5266;   /* secondary text */
  --ink-3:     #7c8295;   /* muted / labels */
  --line:      rgba(26,36,56,0.12);
  --line-2:    rgba(26,36,56,0.07);
  --line-strong: rgba(26,36,56,0.22);
  --teal:      #1f5759;
  --teal-2:    #2c7a73;
  --teal-soft: rgba(31,87,89,0.10);
  --rust:      #b8412a;
  --rust-soft: rgba(184,65,42,0.10);
  --gold:      #9a6a16;
  --green:     #2f7d4f;
  --SIDEBAR_W: 230px;
  --PANEL_W:   480px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.mono { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
.num { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
a { color: inherit; }
button { font-family: inherit; }

/* ---- App shell ---- */
.app { display: grid; grid-template-columns: var(--SIDEBAR_W) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.brand { padding: 18px 18px 14px; border-bottom: 1px solid var(--line-2); }
.brand .name { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; }
.brand .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  padding: 8px 12px; border-radius: 6px; font-size: 13.5px; color: var(--ink-2);
  border-left: 2px solid transparent; transition: background 80ms ease;
}
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.active { background: var(--surface); color: var(--ink); font-weight: 600;
  border-left-color: var(--teal); }
.nav a .badge { margin-left: auto; font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  color: var(--paper); background: var(--rust); border-radius: 10px; padding: 1px 7px; }
.nav a.active .badge, .nav a:hover .badge { }
.nav .divider { height: 1px; background: var(--line-2); margin: 10px 12px; }
.nav .group-label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3); padding: 6px 12px 4px; }

.sidebar-foot { border-top: 1px solid var(--line-2); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.hub-stat { display: flex; gap: 14px; padding: 4px 6px; }
.hub-stat .v { font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 14px; }
.hub-stat .l { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---- Main ---- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  padding: 0 24px; gap: 16px; position: sticky; top: 0; background: var(--paper); z-index: 20; }
.page-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.page-sub { font-size: 12.5px; color: var(--ink-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.client-chip { font-size: 12px; color: var(--ink-2); }
.client-chip b { color: var(--ink); }

.content { padding: 24px 28px 60px; max-width: 1120px; width: 100%; }
.content.wide { max-width: 1280px; }

/* ---- Buttons ---- */
.btn { font-size: 12.5px; font-weight: 500; padding: 7px 14px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper); transition: opacity 90ms; }
.btn:hover { opacity: 0.88; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--hover); opacity: 1; }
.btn.sm { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ---- Section headers ---- */
.sec-title { font-size: 13px; font-weight: 600; color: var(--ink); margin: 26px 0 12px;
  display: flex; align-items: baseline; gap: 10px; }
.sec-title:first-child { margin-top: 4px; }
.sec-title .meta { font-size: 12px; font-weight: 400; color: var(--ink-3); }

/* ---- KPI cards ---- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.kpi-card .v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 5px; }
.kpi-card .v .arrow { font-size: 13px; }
.kpi-card .v .arrow.up, .kpi-card .v .arrow.down { color: var(--teal); }
.kpi-card .v .arrow.flat { color: var(--ink-3); }
.kpi-card .l { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.kpi-card .s { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }

/* ---- Tables ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 9px 16px; font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
  border-bottom: 1px solid var(--line); background: var(--surface); }
.table th.r, .table td.r { text-align: right; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.row { cursor: pointer; transition: background 70ms; }
.table tr.row:hover td { background: var(--hover); }
.t-primary { font-weight: 600; }
.t-id { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-3); }
.t-sub { font-size: 12px; color: var(--ink-3); }

/* status pills */
.pill { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 12px; border: 1px solid var(--line-strong);
  color: var(--ink-2); white-space: nowrap; }
.pill.in_progress { color: var(--teal); border-color: rgba(31,87,89,0.35); background: var(--teal-soft); }
.pill.scheduled, .pill.estimating, .pill.sent, .pill.viewed, .pill.draft { color: var(--gold); border-color: rgba(154,106,22,0.35); }
.pill.complete, .pill.signed, .pill.paid, .pill.qualified { color: var(--green); border-color: rgba(47,125,79,0.35); }
.pill.aging, .pill.new { color: var(--rust); border-color: rgba(184,65,42,0.35); background: var(--rust-soft); }

.delta.over { color: var(--rust); }
.delta.under { color: var(--teal); }

/* mini margin bar in tables */
.mbar { display: inline-flex; align-items: center; gap: 8px; }
.mbar .track { width: 64px; height: 5px; background: var(--paper); border: 1px solid var(--line); border-radius: 3px;
  position: relative; overflow: hidden; }
.mbar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--teal); }
.mbar .fill.under { background: var(--rust); }
.mbar .val { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

/* ---- Today: worklist ---- */
.worklist { display: flex; flex-direction: column; }
.need { border-bottom: 1px solid var(--line-2); }
.need:last-child { border-bottom: none; }
.need-main { display: flex; align-items: center; gap: 14px; padding: 13px 16px; }
.need.clickable .need-main { cursor: pointer; }
.need.clickable:hover .need-main { background: var(--hover); }
.need-tag { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 5px; min-width: 70px; text-align: center; border: 1px solid; flex-shrink: 0; }
.need-tag.approve { color: var(--teal); border-color: rgba(31,87,89,0.4); background: var(--teal-soft); }
.need-tag.margin { color: var(--rust); border-color: rgba(184,65,42,0.4); background: var(--rust-soft); }
.need-tag.cash { color: var(--gold); border-color: rgba(154,106,22,0.4); }
.need-tag.lead { color: var(--teal-2); border-color: rgba(44,122,115,0.4); }
.need-body { flex: 1; min-width: 0; }
.need-title { font-weight: 600; font-size: 13.5px; }
.need-detail { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.need-action { font-size: 12.5px; color: var(--teal); white-space: nowrap; }
.need.done { opacity: 0.5; }
.need-exp { padding: 0 16px 16px 100px; display: none; }
.need.open .need-exp { display: block; }

.empty { padding: 28px 16px; color: var(--ink-3); font-style: italic; }

/* ---- Activity feed ---- */
.feed-line { display: grid; grid-template-columns: 86px 130px 1fr; gap: 12px; padding: 9px 16px;
  border-bottom: 1px solid var(--line-2); font-size: 13px; align-items: baseline; }
.feed-line:last-child { border-bottom: none; }
.feed-line.clickable { cursor: pointer; }
.feed-line.clickable:hover { background: var(--hover); }
.feed-line .ev { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--teal); }
.feed-line .src { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-3); }
.feed-line .tx { color: var(--ink-2); }
.feed-line .evsrc { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--ink-3); }

/* ---- Command center (home) ---- */
.cmd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cmd-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.cmd-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.cmd-head .h { font-size: 14px; font-weight: 600; }
.cmd-head a { font-size: 12.5px; color: var(--teal); text-decoration: none; }
.cmd-head a:hover { text-decoration: underline; }
.cmd-body { padding: 0 0 6px; }
.cmd-big { padding: 14px 16px 8px; }
.cmd-big .v { font-size: 27px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cmd-big .l { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.cmd-stat-row { display: flex; gap: 28px; padding: 6px 16px 14px; }
.cmd-stat .v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cmd-stat .l { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.cmd-list-row { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-top: 1px solid var(--line-2); cursor: pointer; font-size: 13.5px; }
.cmd-list-row:hover { background: var(--hover); }
.cmd-list-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-flag { font-size: 12.5px; color: var(--rust); padding: 8px 16px 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.green { background: var(--green); } .dot.red { background: var(--rust); } .dot.gold { background: var(--gold); } .dot.gray { background: var(--ink-3); }

/* ---- Money meter (command center headline) ---- */
.meter { display: flex; align-items: center; gap: 26px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 22px; margin-bottom: 16px; flex-wrap: wrap; }
.meter .risk .v { font-size: 29px; font-weight: 700; color: var(--rust); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.meter .risk .l { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.meter .vline { width: 1px; height: 42px; background: var(--line); }
.meter .month { display: flex; gap: 30px; }
.meter .stat .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meter .stat .v.caught { color: var(--green); }
.meter .stat .l { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.meter .roi { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.meter .roi b { color: var(--green); }
.need-dollars { font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.need-dollars.risk { color: var(--rust); }

/* ---- Marketing ---- */
.leak-banner { background: var(--rust-soft); border: 1px solid rgba(184,65,42,0.3); border-radius: 8px;
  padding: 12px 16px; font-size: 13px; color: var(--ink); margin: 8px 0 0; }
.leak-banner b { color: var(--rust); }

/* ---- Right detail panel (one pattern for every entity) ---- */
.detail-panel { position: fixed; top: 0; right: 0; height: 100vh; width: var(--PANEL_W); max-width: 96vw;
  background: var(--surface); border-left: 1px solid var(--line-strong);
  box-shadow: -16px 0 48px rgba(26,36,56,0.16); transform: translateX(101%); transition: transform 180ms ease;
  z-index: 120; overflow-y: auto; }
.detail-panel.open { transform: translateX(0); }
.dp-head { padding: 16px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface);
  z-index: 2; display: flex; align-items: flex-start; gap: 12px; }
.dp-titleblock { flex: 1; min-width: 0; }
.dp-eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-3); display: flex; justify-content: space-between; }
.dp-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin-top: 4px; }
.dp-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.dp-close { background: none; border: none; font-size: 24px; color: var(--ink-3); cursor: pointer; line-height: 1;
  padding: 0; margin-top: -1px; flex-shrink: 0; }
.dp-close:hover { color: var(--ink); }
.dp-body { padding: 18px 22px 32px; }
.dp-sec { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
  margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; }
.dp-sec:first-child { margin-top: 4px; }
.dp-sec::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

.sources-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.src-chip { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--teal);
  border: 1px solid rgba(31,87,89,0.3); background: var(--teal-soft); border-radius: 5px; padding: 3px 9px; }

/* cost table in panel */
.cost { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.cost-row { display: grid; grid-template-columns: 1fr 84px 84px 84px; gap: 8px; padding: 8px 12px;
  border-top: 1px solid var(--line-2); font-size: 12.5px; align-items: baseline; }
.cost-row:first-child { border-top: none; }
.cost-row.head { background: var(--paper); font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.cost-row.total { font-weight: 600; background: var(--paper); }
.cost-row .n { font-family: 'IBM Plex Mono', monospace; text-align: right; font-variant-numeric: tabular-nums; }
.cost-row .src { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; color: var(--ink-3); }
.margin-line { display: flex; gap: 22px; margin-top: 12px; padding: 12px 14px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 6px; flex-wrap: wrap; }
.margin-line .mv { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.margin-line .mv.bad { color: var(--rust); }
.margin-line .ml { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

.linked { display: flex; flex-direction: column; gap: 6px; }
.lrow { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--paper); }
.lrow-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lrow-id { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 600; }
.lrow-amt { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; font-weight: 600; }
.lrow-desc { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.lrow-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.lrow-src { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--teal); }

.tl { display: flex; flex-direction: column; }
.tl-item { padding: 9px 0 9px 18px; border-left: 2px solid var(--line); position: relative; }
.tl-item::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal); border: 2px solid var(--surface); }
.tl-top { display: flex; align-items: baseline; gap: 8px; }
.tl-ev { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--teal); font-weight: 600; }
.tl-src { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; color: var(--ink-3); border: 1px solid var(--line);
  border-radius: 3px; padding: 1px 6px; }
.tl-text { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }

/* vendor detail (payload + ingest) */
.payload { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; line-height: 1.5; white-space: pre-wrap;
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; color: var(--ink-2);
  max-height: 320px; overflow: auto; }
.payload .k { color: var(--teal); }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.kv .k { color: var(--ink-3); }

/* ---- Diagnostic report ---- */
.report-head { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 8px; }
.report-head h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.report-head p { color: var(--ink-2); margin-top: 8px; max-width: 720px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.gaps { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.gap { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--rust); border-radius: 6px; padding: 13px 15px; }
.gap.important { border-left-color: var(--gold); }
.gap.future { border-left-color: var(--ink-3); }
.gap-h { display: flex; align-items: baseline; gap: 8px; }
.gap-n { font-family: 'IBM Plex Mono', monospace; color: var(--rust); font-weight: 600; }
.gap.important .gap-n { color: var(--gold); } .gap.future .gap-n { color: var(--ink-3); }
.gap-t { font-weight: 600; font-size: 13px; }
.gap-d { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; }
.gap-$ { font-family: 'IBM Plex Mono', monospace; font-weight: 600; color: var(--rust); margin-top: 7px; display: block; }
.outcomes { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.orow { display: grid; grid-template-columns: 1.1fr 1fr 24px 1fr; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line-2); align-items: center; font-size: 13px; }
.orow:first-child { border-top: none; }
.orow .before { color: var(--ink-3); text-decoration: line-through; text-decoration-color: rgba(184,65,42,0.4); }
.orow .arr { color: var(--teal); text-align: center; }
.orow .after { color: var(--teal); font-weight: 600; }

/* ---- Integrations ---- */
.vlist { display: flex; flex-direction: column; }
.vrow { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.vrow:last-child { border-bottom: none; }
.vrow:hover { background: var(--hover); }
.vrow .vname { font-weight: 600; font-size: 13.5px; flex: 1; }
.vrow .vmeta { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--ink-3); }
.chip { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 4px; border: 1px solid var(--line-strong); color: var(--ink-3); white-space: nowrap; }
.chip.hi { color: var(--teal); border-color: rgba(31,87,89,0.4); background: var(--teal-soft); }
.chip.mid { color: var(--gold); border-color: rgba(154,106,22,0.4); }
.chip.api { color: var(--teal); }
.chip.noapi { color: var(--rust); border-style: dashed; border-color: rgba(184,65,42,0.4); }
.chip.parse { color: var(--teal); background: var(--teal-soft); }
.chip.gated { color: var(--gold); border-style: dashed; }

/* ---- Notifications (bell + panel + toasts) ---- */
.notif-wrap { position: relative; }
.notif-bell { position: relative; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--ink); cursor: pointer; transition: background 80ms; }
.notif-bell:hover { background: var(--hover); }
.notif-count { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--rust); color: #fff; font-size: 10.5px; font-weight: 600; display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace; }
.notif-panel { position: absolute; top: 46px; right: 0; width: 364px; max-width: 92vw; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 20px 50px rgba(26,36,56,0.18);
  z-index: 140; display: none; max-height: 72vh; overflow-y: auto; }
.notif-panel.open { display: block; }
.notif-phead { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; position: sticky; top: 0; background: var(--surface); }
.notif-live { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--teal); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.notif-live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); animation: pulse 1.6s ease-in-out infinite; }
.notif-live.paused { color: var(--ink-3); } .notif-live.paused .dot { background: var(--ink-3); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.notif-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: var(--hover); }
.notif-row.handled { opacity: 0.5; }
.notif-body2 { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 500; }
.notif-d { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--rust); margin-top: 2px; }
.notif-empty { padding: 26px 14px; color: var(--ink-3); font-style: italic; text-align: center; }

.toast-stack { position: fixed; top: 64px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; width: 340px; max-width: 90vw; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--paper); border-radius: 10px;
  padding: 11px 14px; box-shadow: 0 10px 30px rgba(8,9,11,0.30); cursor: pointer; animation: slidein 220ms ease; }
.toast.out { opacity: 0; transform: translateX(24px); transition: all 300ms ease; }
.toast-tag { font-family: 'IBM Plex Mono', monospace; font-size: 9px; letter-spacing: 0.06em; padding: 3px 7px;
  border-radius: 5px; background: rgba(255,255,255,0.16); white-space: nowrap; }
.toast-title { flex: 1; font-size: 12.5px; line-height: 1.35; }
.toast-d { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 600; }
@keyframes slidein { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---- Simulator (control arm) ---- */
.simulator { position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 94vw;
  background: var(--surface); border-left: 1px solid var(--line-strong); box-shadow: -16px 0 48px rgba(26,36,56,0.16);
  transform: translateX(101%); transition: transform 180ms ease; z-index: 130; display: flex; flex-direction: column; }
.simulator.open { transform: translateX(0); }
.sim-body { flex: 1; overflow-y: auto; padding: 14px 14px 6px; }
.sim-group-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 14px 0 7px; }
.sim-group-label:first-child { margin-top: 2px; }
.sim-btn { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; margin-bottom: 6px; transition: background 80ms; }
.sim-btn:hover { background: var(--hover); }
.sim-btn:active { transform: translateY(1px); }
.sim-btn:disabled { opacity: 0.5; }
.sim-l { font-weight: 600; font-size: 13px; }
.sim-n { font-size: 11.5px; color: var(--ink-3); }
.sim-log { border-top: 1px solid var(--line); padding: 10px 14px; max-height: 168px; overflow-y: auto; background: var(--paper); }
.sim-log:empty { display: none; }
.sim-log-line { font-size: 12px; color: var(--teal); padding: 3px 0; animation: fade 180ms ease; }
.sim-log-line.err { color: var(--rust); }

/* ---- Conductor drawer ---- */
.conductor { position: fixed; top: 0; right: 0; height: 100vh; width: 430px; max-width: 94vw;
  background: var(--surface); border-left: 1px solid var(--line-strong); box-shadow: -16px 0 48px rgba(26,36,56,0.16);
  transform: translateX(101%); transition: transform 180ms ease; z-index: 130; display: flex; flex-direction: column; }
.conductor.open { transform: translateX(0); }
.cd-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.cd-head .t { font-weight: 600; font-size: 14px; }
.cd-head .s { font-size: 12px; color: var(--ink-3); }
.cd-close { background: none; border: none; font-size: 24px; color: var(--ink-3); cursor: pointer; }
.cd-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 92%; }
.msg.user { align-self: flex-end; }
.msg.assistant { align-self: flex-start; }
.bubble { padding: 11px 14px; border-radius: 10px; font-size: 13px; line-height: 1.55; border: 1px solid var(--line);
  background: var(--paper); white-space: pre-wrap; word-wrap: break-word; }
.bubble strong { font-weight: 600; }
.msg.user .bubble { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cd-trace { font-family: 'IBM Plex Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-3); margin-top: 6px; }
.cd-trace .t { color: var(--teal); }
.cd-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cd-chip { font-size: 12px; border: 1px solid var(--line-strong); border-radius: 14px; padding: 5px 11px; cursor: pointer; color: var(--ink-2); }
.cd-chip:hover { background: var(--hover); color: var(--ink); }
.cd-input { border-top: 1px solid var(--line); padding: 12px; display: flex; gap: 8px; }
.cd-input input { flex: 1; font-family: inherit; font-size: 13px; padding: 9px 12px; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--paper); color: var(--ink); outline: none; }
.cd-thinking { color: var(--ink-3); font-style: italic; }

.loading-screen { padding: 60px 0; text-align: center; color: var(--ink-3); }

.hamburger { display: none; align-items: center; justify-content: center; background: none;
  border: 1px solid var(--line); color: var(--ink); cursor: pointer; width: 38px; height: 38px;
  margin-right: 6px; border-radius: 8px; transition: background 90ms ease; -webkit-tap-highlight-color: transparent; }
.hamburger:hover { background: var(--hover); }
.hamburger:active { background: var(--line-2); }
.hamburger svg { pointer-events: none; }   /* taps land on the button, never the strokes */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(8,9,11,0.42); z-index: 190; display: none; }
.sidebar-backdrop.open { display: block; }

.sidebar-close { display: none; background: none; border: none; cursor: pointer; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: 250px; z-index: 200;
    transform: translateX(-100%); transition: transform 180ms ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 48px rgba(8,9,11,0.35); }
  .sidebar-close { display: flex; align-items: center; justify-content: center; position: absolute;
    top: 11px; left: 10px; width: 32px; height: 32px; font-size: 24px; line-height: 1; color: var(--ink-3); z-index: 2; }
  .sidebar-close:hover { color: var(--ink); }
  .brand { padding-left: 50px; }
  .hamburger { display: inline-flex; align-items: center; }
  .content { padding: 18px 16px 60px; }
  .topbar { padding: 0 14px; }
  .detail-panel, .conductor { width: 100vw; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; } /* drop Type col on narrow */
}
