/* ==========================================================================
   علّام — Design tokens + components
   Arabic-first, RTL, logical properties only.

   PALETTE — the original clay-on-cream identity from the handoff.
   A separate uploaded guide proposed a neon-on-obsidian scheme; it is NOT
   adopted. Its glass-and-glow rules also conflict with the elevation model
   below, which builds depth from surface temperature rather than blur.

   State is carried by colour AND by form together:
     · a filled dot means running, a hollow ring means waiting on you
     · a filled tag is neutral, an outlined tag is asking to be read
   The form layer stays even though colour is back — it is what keeps the
   interface readable in greyscale, on poor screens, and for colour blindness.
   ========================================================================== */

:root {
  /* surfaces — light */
  --canvas: #EAE0CF;
  --surface: #FBF7F0;
  --surface-raised: #FFFFFF;
  --surface-sunken: #F7F1E5;
  --surface-muted: #F3EBDD;
  /* ink */
  --ink: #2B2318;
  --ink-2: #6B5F4C;
  --ink-3: #9A8B74;
  --ink-4: #B0A18A;
  /* lines */
  --line: #E4DAC9;
  --line-soft: #EFE6D6;
  --line-soft-2: #F0E8D9;
  --line-strong: #DDD0BA;
  /* accent — clay */
  --accent: #B4551F;
  --accent-hover: #8E3F13;
  --accent-hover-dark: #C96428;
  --accent-soft: #F6E3D6;
  --accent-text: #8E3F13;
  /* semantic */
  --positive: #4F6B3A;
  --positive-soft: #E5EBD9;
  --positive-on-dark: #8FA872;
  --warn-on-dark: #D98B54;
  /* dark surfaces used inside the light theme */
  --on-dark: #F3EBDD;
  --on-dark-2: #E8DFCD;
  --on-dark-3: #FDF9F3;
  --dark-raised: #3D3324;
  --dark-line: #453A29;
  /* controls */
  --control-off: #DCCFB9;
  --control-ring: #C6B79E;

  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --shadow-frame: 0 18px 44px -28px rgba(58, 44, 26, .35);
}

/* ==========================================================================
   Dark theme — the default.
   Not an inversion: warm near-blacks at low chroma, text held at ~#E8E0D2
   rather than pure white, and the clay accent lifted so it still reads as
   clay instead of going muddy on a dark ground.
   ========================================================================== */
[data-theme="dark"] {
  --canvas: #0E0C08;
  --surface: #16130D;
  --surface-raised: #1E1911;
  --surface-sunken: #191510;
  --surface-muted: #241E15;

  --ink: #E8E0D2;
  --ink-2: #B6AA96;
  --ink-3: #8B8071;
  --ink-4: #6E6558;

  --line: #302819;
  --line-soft: #262013;
  --line-soft-2: #241E13;
  --line-strong: #3A3020;

  /* #B4551F is tuned for cream. On near-black it loses chroma and reads
     muddy brown, so the same clay is lifted here. Never one accent hex
     across both themes. */
  --accent: #E07B3C;
  --accent-hover: #F09250;
  --accent-hover-dark: #F09250;
  --accent-soft: #3A2415;
  --accent-text: #E89A63;

  --positive: #8FA872;
  --positive-soft: #222B18;
  --positive-on-dark: #8FA872;
  --warn-on-dark: #D98B54;

  --on-dark: #E8E0D2;
  --on-dark-2: #C6BBA6;
  --on-dark-3: #FDF9F3;
  --dark-raised: #2A2317;
  --dark-line: #332B1D;

  --control-off: #3A3020;
  --control-ring: #4A4030;

  --shadow-frame: 0 18px 44px -28px rgba(0, 0, 0, .7);
}

/* On dark, the sidebar can no longer be "the dark panel" — it would vanish
   into the page. It steps *up* instead. */
[data-theme="dark"] .sidebar,
[data-theme="dark"] .step-rail,
[data-theme="dark"] .launch-panel,
[data-theme="dark"] .live-banner,
[data-theme="dark"] .kpi.dark {
  background: var(--surface-raised);
  border-inline-start: 1px solid var(--line);
}
[data-theme="dark"] .launch-panel,
[data-theme="dark"] .live-banner,
[data-theme="dark"] .kpi.dark { border-inline-start: none; }
[data-theme="dark"] .live-banner,
[data-theme="dark"] .kpi.dark { border: 1px solid var(--line); }
[data-theme="dark"] .core,
[data-theme="dark"] .brand-mark { background: var(--accent); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  transition: background .18s ease, color .18s ease;
}

/* theme switch — sits in the sidebar / step-rail footer */
.theme-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 9px;
  font-size: 13px; color: var(--ink-4);
  width: 100%; text-align: start;
  transition: background .12s ease, color .12s ease;
}
.theme-toggle:hover { background: rgba(255,255,255,.06); color: var(--on-dark); }

/* Mono runs only — never on Arabic text (breaks glyph joining). */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.track { letter-spacing: .08em; } /* latin/numeric only */

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; color: inherit; }
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- animations ---------- */
@keyframes mdrPulse { 0%, 100% { opacity: .35 } 50% { opacity: 1 } }
@keyframes mdrCaret { 0%, 49% { opacity: 1 } 50%, 100% { opacity: 0 } }
@keyframes mdrFade { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

.pulse { animation: mdrPulse 1.5s ease-in-out infinite; }
.fade-in { animation: mdrFade .2s ease both; }

/* ---------- animated brand mark ----------
   A measuring dial acquiring focus. Every layer turns on its own axis at its
   own rate, so the mark never reads as one rigid spinning wheel.
   All motion is transform-only — no layout, no repaint of the page. */
@keyframes markSpin    { to { transform: rotate(360deg); } }
@keyframes markSpinRev { to { transform: rotate(-360deg); } }
@keyframes markBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(.78); } }
@keyframes markLock    { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.brand-svg { display: block; overflow: visible; }
.brand-svg g, .brand-svg circle { transform-box: fill-box; transform-origin: center; }
.brand-svg .m-ticks { animation: markSpin 42s linear infinite, markLock .6s ease-out both; }
.brand-svg .m-arc   { animation: markSpinRev 16s linear infinite, markLock .5s .06s ease-out both; }
.brand-svg .m-cross { animation: markLock .5s .12s ease-out both; }
.brand-svg .m-core  { animation: markBreathe 3.4s ease-in-out infinite, markLock .5s .18s ease-out both; }

/* hovering the brand pulls the dial into a tighter lock */
.brand:hover .brand-svg .m-ticks { animation-duration: 9s, .6s; }
.brand:hover .brand-svg .m-arc   { animation-duration: 4s, .5s; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   App shell
   ========================================================================== */

.app {
  min-height: 100vh;
  display: flex;
  background: var(--surface);
}

/* -------- sidebar (dark, on the RTL leading edge = right) -------- */
.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--ink);
  color: var(--on-dark);
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--on-dark-3);
  display: grid; place-items: center; font-size: 15px;
}
.brand-name { font-size: 16px; font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 9px;
  font-size: 14px; color: var(--ink-4);
  text-align: start; width: 100%;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { color: var(--on-dark); background: rgba(255,255,255,.04); }
.nav-item.is-active { background: var(--dark-raised); color: var(--on-dark); font-weight: 500; }
.nav-item span { flex: 1; }
.nav-badge {
  background: var(--accent); color: var(--on-dark-3);
  font-family: var(--mono); font-size: 11px;
  padding: 2px 7px; border-radius: 5px;
}

.sidebar-footer { margin-block-start: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 8px; background: var(--dark-raised); }
.sidebar-footer .name { font-size: 13px; }
.sidebar-footer .city { font-size: 11px; color: var(--ink-3); }

/* -------- main / context columns -------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.context-panel {
  width: 330px; flex-shrink: 0;
  background: var(--surface-sunken);
  border-inline-start: 1px solid var(--line);
  padding: 26px 24px;
  display: flex; flex-direction: column; gap: 16px;
}

/* ==========================================================================
   Primitives
   ========================================================================== */

.btn-primary {
  background: var(--accent); color: var(--on-dark-3);
  font-size: 15px; font-weight: 500;
  padding: 13px 22px; border-radius: 11px;
  transition: background .12s ease;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: var(--control-off); color: var(--ink-3); cursor: not-allowed; }
.btn-primary.on-dark:hover { background: var(--accent-hover-dark); }
.btn-primary.lg { font-size: 16px; padding: 15px 26px; }

.btn-secondary {
  background: var(--surface-raised); color: var(--ink);
  border: 1px solid var(--line-strong);
  font-size: 14px; padding: 11px 18px; border-radius: 10px;
  transition: border-color .12s ease, color .12s ease;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  color: var(--ink-2); font-size: 14px; padding: 11px 14px; border-radius: 10px;
  transition: color .12s ease;
}
.btn-ghost:hover { color: var(--accent); }

.card {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 18px;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 18px;
}
/* Tag variants without hue.
   neutral = filled, silent · warn = outlined, asks to be read ·
   pos = filled + a check glyph, confirming something is safe.
   The outline is what makes `warn` louder than `neutral` — a border reads as
   an edge the eye stops at, which is exactly what "check this" should do. */
.tag {
  font-size: 11px; border-radius: 5px; padding: 3px 8px;
  background: var(--surface-sunken); color: var(--ink-2);
  border: 1px solid transparent;
}
.tag.warn {
  background: var(--accent-soft); color: var(--accent-text);
  border-color: var(--accent); font-weight: 500;
}
.tag.pos { background: var(--positive-soft); color: var(--positive); }
.tag.pos::before { content: "✓"; margin-inline-end: 5px; opacity: .75; }

/* Status dots.
   FILLED = running · HOLLOW RING = waiting on you.
   Form, not colour, is the signal — and it survives greyscale printing,
   low-quality screens, and every kind of colour blindness. */
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.hollow {
  background: transparent !important;
  border: 2px solid var(--accent);
  width: 9px; height: 9px;
}

.label { font-size: 12px; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.divider { height: 1px; background: var(--line-soft); }

/* ==========================================================================
   Onboarding wizard (direction 1b)
   ========================================================================== */

.wizard { min-height: 100vh; display: flex; background: var(--surface); }

.step-rail {
  width: 268px; flex-shrink: 0;
  background: var(--ink); color: var(--on-dark);
  padding: 30px 22px;
  display: flex; flex-direction: column; gap: 30px;
}
.rail-steps { display: flex; flex-direction: column; gap: 4px; }
.rail-step {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 9px;
  font-size: 14px; color: var(--ink-4);
  width: 100%; text-align: start;
}
.rail-step.is-current { background: var(--dark-raised); color: var(--on-dark); font-weight: 500; }
.rail-step.is-done { color: var(--on-dark-2); }
.rail-num {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--line-strong); color: var(--ink-4);
}
.rail-step.is-current .rail-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.rail-step.is-done .rail-num { background: var(--dark-raised); border-color: var(--dark-line); color: var(--positive-on-dark); }
.rail-footer { margin-block-start: auto; }
.rail-footer .k { font-size: 12px; color: var(--ink-4); }
.rail-footer .v { font-family: var(--mono); font-size: 18px; color: var(--on-dark); margin-block-start: 4px; }

.wizard-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wizard-head { padding: 34px 40px 0; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.wizard-head h1 { font-size: 27px; font-weight: 600; margin: 0; line-height: 1.25; }
.wizard-head p { font-size: 14px; color: var(--ink-2); margin: 6px 0 0; line-height: 1.8; }
.wizard-content { flex: 1; padding: 26px 40px 0; overflow: auto; }
.wizard-footer {
  padding: 20px 40px 26px;
  border-block-start: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px;
  margin-block-start: 20px;
}
.wizard-footer .spacer { flex: 1; }

/* -------- form (B1) -------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; max-width: 720px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field input[type="text"], .field select {
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 13px 15px; font-size: 15px;
  width: 100%;
}
.field.emphasized input[type="text"] { border: 1.5px solid var(--accent); font-size: 16px; }
.field select { appearance: none; background-image: none; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: "▾"; position: absolute; inset-inline-end: 14px; top: 50%;
  transform: translateY(-50%); color: var(--ink-3); pointer-events: none; font-size: 12px;
}

.slider-card { display: flex; flex-direction: column; gap: 10px; }
.slider-value { font-family: var(--mono); font-size: 22px; color: var(--ink); }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; border-radius: 4px; background: var(--line-soft);
  direction: ltr;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface-raised);
  box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--surface-raised);
  background: var(--accent); cursor: pointer;
}
.range-ends { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

/* -------- insight panel (B1) -------- */
.insight-panel {
  width: 320px; flex-shrink: 0;
  background: var(--surface-sunken);
  border-inline-start: 1px solid var(--line);
  padding: 30px 26px;
  display: flex; flex-direction: column; gap: 16px;
}
.insight-block + .insight-block { margin-block-start: 16px; }
.insight-block .k { font-size: 12px; color: var(--ink-3); margin-block-end: 5px; }
.insight-block .v { font-size: 14px; line-height: 1.75; color: var(--ink); }
.agent-row {
  background: var(--surface-raised); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px;
  display: flex; align-items: center; gap: 9px; font-size: 13px;
}
.agent-row.dashed { border-style: dashed; color: var(--ink-3); background: transparent; justify-content: center; }

/* -------- agent cards (B2) -------- */
.agent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.agent-card {
  background: var(--surface-raised);
  border: 1.5px solid var(--line);
  border-radius: 14px; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color .12s ease;
  text-align: start;
}
.agent-card.is-on { border-color: var(--accent); }
.agent-card .head { display: flex; align-items: center; gap: 12px; }
.agent-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface-muted); display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  flex-shrink: 0;
}
.agent-card .name { font-size: 16px; font-weight: 600; }
.agent-card .role { font-size: 12px; color: var(--ink-3); margin-block-start: 2px; }
.agent-card .desc { font-size: 13px; line-height: 1.8; color: var(--ink-2); }

.toggle {
  width: 38px; height: 22px; border-radius: 11px; padding: 3px;
  background: var(--control-off); flex-shrink: 0;
  transition: background .15s ease;
  display: flex; align-items: center;
}
.toggle.is-on { background: var(--accent); }
.toggle .knob {
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .15s ease;
}
/* RTL: knob starts at the inline-start (right) and slides toward the left */
.toggle.is-on .knob { transform: translateX(-16px); }

.agent-card.custom {
  border: 1.5px dashed var(--line-strong);
  background: transparent;
  justify-content: center; gap: 8px;
}

/* -------- integrations (B3) -------- */
.integration-group + .integration-group { margin-block-start: 26px; }
.group-label { font-size: 13px; font-weight: 500; margin-block-end: 12px; }
.integration-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.integration-tile {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  text-align: start; width: 100%;
  transition: border-color .12s ease;
}
.integration-tile:hover { border-color: var(--accent); }
.integration-tile.is-connected { border: 1.5px solid var(--positive); }
.integration-tile.is-required { border: 1.5px solid var(--accent); }
.int-logo {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px;
  background: var(--surface-muted); color: var(--ink-3);
}
.integration-tile.is-connected .int-logo { background: var(--positive-soft); color: var(--positive); }
.int-body { flex: 1; min-width: 0; }
.int-title { font-size: 15px; font-weight: 500; }
.int-status { font-size: 12px; color: var(--ink-3); margin-block-start: 3px; line-height: 1.5; }
.integration-tile.is-connected .int-status { color: var(--positive); }
.integration-tile.is-required .int-status { color: var(--accent-text); }
.int-action { font-size: 13px; color: var(--accent); flex-shrink: 0; }
.integration-tile.is-connected .int-action { color: var(--positive); }
.integration-tile.compact { padding: 13px 15px; }
.integration-tile.compact .int-logo { width: 28px; height: 28px; border-radius: 7px; }

/* -------- permissions matrix (B4) -------- */
.matrix {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
}
.matrix-row {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr;
  align-items: center;
}
.matrix-row + .matrix-row { border-block-start: 1px solid var(--line-soft-2); }
.matrix-head { background: var(--surface-sunken); font-size: 13px; font-weight: 500; color: var(--ink-2); }
.matrix-cell { padding: 16px 18px; display: flex; align-items: center; justify-content: center; }
.matrix-cell:first-child { justify-content: flex-start; flex-direction: column; align-items: flex-start; gap: 3px; }
.matrix-cell .agent-name { font-size: 15px; font-weight: 500; }
.matrix-cell .scope { font-size: 12px; color: var(--ink-3); }

.radio {
  width: 15px; height: 15px; border-radius: 50%;
  border: 1.5px solid var(--control-ring); background: var(--surface-raised);
  transition: border .12s ease;
}
.radio.is-on { border: 4px solid var(--accent); }

.spend-cap {
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 20px; margin-block-start: 14px;
  display: flex; align-items: center; gap: 18px;
}
.spend-cap p { margin: 0; font-size: 14px; line-height: 1.75; color: var(--ink-2); flex: 1; }
.spend-cap input {
  font-family: var(--mono); font-size: 16px; width: 110px; text-align: center;
  background: var(--surface-raised); border: 1px solid var(--line-strong);
  border-radius: 9px; padding: 10px 8px;
}

/* -------- launch panel (B4) -------- */
.launch-panel {
  width: 400px; flex-shrink: 0;
  background: var(--ink); color: var(--on-dark);
  padding: 32px 28px;
  display: flex; flex-direction: column; gap: 24px;
}
.readiness-pct { font-family: var(--mono); font-size: 42px; line-height: 1; }
.bar { height: 6px; border-radius: 3px; background: var(--dark-line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .25s ease; }
.check-list { display: flex; flex-direction: column; gap: 11px; }
.check { display: flex; gap: 10px; font-size: 13px; line-height: 1.7; }
.check .m { flex-shrink: 0; }
.check.ok .m { color: var(--positive-on-dark); }
.check.warn .m { color: var(--warn-on-dark); }
.check.warn { color: var(--ink-4); }
.first48 { display: flex; flex-direction: column; gap: 10px; }
.first48 .row { display: flex; gap: 12px; font-size: 13px; line-height: 1.7; color: var(--on-dark-2); }
.first48 .n { font-family: var(--mono); font-size: 12px; color: var(--accent); flex-shrink: 0; }

/* ==========================================================================
   C1 — dashboard
   ========================================================================== */

.topbar {
  padding: 24px 32px;
  border-block-end: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 32px; flex-wrap: wrap;
}
.topbar .goal .k { font-size: 12px; color: var(--ink-3); }
.topbar .goal .v { font-size: 20px; font-weight: 600; margin-block-start: 3px; }
.progress-block { flex: 1; max-width: 380px; min-width: 220px; }
.progress-block .top { display: flex; align-items: baseline; gap: 10px; margin-block-end: 8px; }
.progress-block .pct { font-family: var(--mono); font-size: 18px; color: var(--positive); }
.progress-block .cap { font-size: 12px; color: var(--ink-3); }
.track-bar { height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.track-bar > i { display: block; height: 100%; border-radius: 4px; background: var(--positive); }

.page { padding: 24px 32px 34px; display: flex; flex-direction: column; gap: 22px; overflow: auto; }

.live-banner {
  background: var(--ink); color: var(--on-dark-2);
  border-radius: 14px; padding: 20px 24px;
  display: flex; align-items: center; gap: 14px;
}
.live-banner .lbl { font-size: 13px; color: var(--on-dark); font-weight: 500; flex-shrink: 0; }
.live-banner .txt { flex: 1; font-size: 15px; line-height: 1.7; }
.live-banner .at { font-family: var(--mono); font-size: 12px; color: var(--ink-3); flex-shrink: 0; }

.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.status-card { display: flex; flex-direction: column; gap: 10px; }
.status-card .head { display: flex; align-items: center; gap: 8px; }
.status-card .name { font-size: 15px; font-weight: 600; flex: 1; }
.status-card .state { font-size: 12px; }
.status-card .activity { font-size: 13px; line-height: 1.75; color: var(--ink-2); }
.status-card .metric { display: flex; align-items: baseline; gap: 8px; margin-block-start: auto; padding-block-start: 4px; }
.status-card .metric .n { font-family: var(--mono); font-size: 22px; }
.status-card .metric .c { font-size: 12px; color: var(--ink-3); }
.status-card.disabled {
  border-style: dashed; background: transparent;
  display: flex; flex-direction: column; gap: 8px; justify-content: center;
}

.summary-card { background: var(--surface-raised); border-radius: 12px; padding: 16px 18px; }
.summary-card .k { font-size: 12px; font-weight: 600; margin-block-end: 6px; }
.summary-card .v { font-size: 13px; line-height: 1.8; color: var(--ink-2); }

/* ==========================================================================
   C2 — approvals
   ========================================================================== */

.approvals { display: flex; flex: 1; min-height: 0; }
.approval-list {
  width: 400px; flex-shrink: 0;
  border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: auto;
}
.approval-list .head {
  padding: 24px 26px 16px; display: flex; align-items: center; gap: 10px;
}
.approval-list .head .t { font-size: 17px; font-weight: 600; flex: 1; }
.count-chip {
  background: var(--accent-soft); color: var(--accent-text);
  font-family: var(--mono); font-size: 12px; padding: 3px 9px; border-radius: 6px;
}
.approval-row {
  padding: 16px 26px; text-align: start; width: 100%;
  border-block-start: 1px solid var(--line-soft-2);
  border-inline-start: 3px solid transparent;
  display: flex; flex-direction: column; gap: 6px;
  transition: background .12s ease;
}
.approval-row:hover { background: var(--surface-sunken); }
.approval-row.is-selected { background: var(--surface-sunken); border-inline-start-color: var(--accent); }
.approval-row .meta { display: flex; align-items: baseline; gap: 8px; }
.approval-row .agent { font-size: 12px; color: var(--ink-3); }
.approval-row .at { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-inline-start: auto; }
.approval-row .title { font-size: 15px; font-weight: 500; line-height: 1.6; }
.approval-row .reason { font-size: 13px; color: var(--ink-2); line-height: 1.6; }

.auto-log { margin-block-start: auto; padding: 22px 26px; background: var(--surface-sunken); border-block-start: 1px solid var(--line); }
.auto-log .k { font-size: 13px; font-weight: 500; margin-block-end: 10px; }
.auto-log li { font-size: 13px; color: var(--ink-2); line-height: 1.9; }
.auto-log ul { margin: 0; padding-inline-start: 18px; }

.approval-detail { flex: 1; min-width: 0; padding: 30px 36px 36px; display: flex; flex-direction: column; gap: 24px; overflow: auto; }
.approval-detail h1 { font-size: 26px; font-weight: 600; margin: 0; line-height: 1.4; }
.rationale { background: var(--surface-raised); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; }
.rationale .body { font-size: 16px; line-height: 1.85; margin-block: 8px 20px; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-block-start: 18px; border-block-start: 1px solid var(--line-soft); }
.metric-row .k { font-size: 12px; color: var(--ink-3); margin-block-end: 6px; }
.metric-row .n { font-family: var(--mono); font-size: 24px; }
.metric-row .n.down { color: var(--accent-text); }
.metric-row .u { font-size: 13px; color: var(--ink-3); margin-inline-start: 5px; }
.side-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.side-card { background: var(--surface-sunken); border-radius: 12px; padding: 18px 20px; }
.side-card .k { font-size: 13px; font-weight: 500; margin-block-end: 8px; }
.side-card .v { font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.action-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-block-start: 20px; border-block-start: 1px solid var(--line-soft);
}
.action-row .hint { font-size: 13px; color: var(--ink-3); margin-inline-start: auto; }

.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--ink-3); text-align: center; padding: 60px;
}

.undo-bar {
  position: fixed; inset-block-end: 24px; inset-inline-start: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: var(--on-dark);
  border-radius: 12px; padding: 14px 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-frame); z-index: 50; font-size: 14px;
}
.undo-bar button { color: var(--accent-hover-dark); font-size: 14px; font-weight: 500; }

/* ==========================================================================
   C3 — weekly report
   ========================================================================== */

.report {
  background: var(--surface-raised); border: 1px solid var(--line);
  border-radius: 18px; padding: 36px 40px 40px;
  display: flex; flex-direction: column; gap: 28px;
  max-width: 1060px;
}
.report-head { display: flex; align-items: flex-start; gap: 20px; }
.report-head h1 { font-size: 30px; font-weight: 600; margin: 8px 0 0; line-height: 1.35; max-width: 640px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { background: var(--surface-sunken); border-radius: 13px; padding: 18px 20px; }
.kpi .k { font-size: 13px; color: var(--ink-3); }
.kpi .n { font-family: var(--mono); font-size: 32px; margin-block: 8px 6px; }
.kpi .d { font-size: 13px; color: var(--ink-2); }
.kpi.dark { background: var(--ink); color: var(--on-dark); }
.kpi.dark .k { color: var(--ink-4); }
.kpi.dark .d { color: var(--positive-on-dark); }
.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.list-block .k { font-size: 14px; font-weight: 600; margin-block-end: 12px; }
.list-block .row { display: flex; gap: 12px; font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.list-block .row + .row { margin-block-start: 10px; }
.list-block .n { font-family: var(--mono); font-size: 12px; color: var(--ink-3); flex-shrink: 0; padding-block-start: 4px; }
.reco { background: var(--surface-sunken); border-radius: 14px; padding: 22px 26px; display: flex; gap: 26px; align-items: center; }
.reco .body { flex: 1; }
.reco .t { font-size: 15px; font-weight: 600; margin-block-end: 8px; }
.reco .v { font-size: 15px; line-height: 1.85; color: var(--ink-2); }
.reco .cta { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }

/* ==========================================================================
   Responsive — not designed; graceful degradation only.
   ========================================================================== */
@media (max-width: 1360px) {
  .context-panel, .insight-panel { display: none; }
}
@media (max-width: 1080px) {
  .agent-grid, .status-grid { grid-template-columns: repeat(2, 1fr); }
  .integration-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .launch-panel { width: 320px; }
}
@media (max-width: 860px) {
  .agent-grid, .status-grid, .integration-grid, .kpi-row, .lists, .side-cards, .form-grid { grid-template-columns: 1fr; }
  .sidebar, .step-rail { width: 72px; padding: 20px 12px; }
  .sidebar .brand-name, .nav-item span, .rail-step span, .sidebar-footer .name,
  .sidebar-footer .city, .rail-footer { display: none; }
  .approvals { flex-direction: column; }
  .approval-list { width: 100%; }
  .launch-panel { display: none; }
}
