/* ديوان الوكلاء — Arabic-first command center (spec 2026-08-30).
   Logical properties only (inline-start/end): the same sheet renders RTL Arabic and
   LTR English purely from the html[dir] attribute. Fonts are self-hosted — the CSP
   allows font-src 'self' only, by design. */

:root {
  color-scheme: dark;
  --ink: #0d0e0a;
  --rail: #0a0b08;
  --panel: #15160f;
  --panel-2: #1b1c13;
  --panel-3: #22231a;
  --line: rgba(238, 226, 199, 0.10);
  --line-strong: rgba(238, 226, 199, 0.22);
  --text: #f2ecdd;
  --text-soft: #cfc7b4;
  --muted: #a49d8a;
  --gold: #d8ad68;
  --gold-bright: #f0ca80;
  --gold-dim: rgba(216, 173, 104, 0.14);
  --ok: #83b58d;
  --ok-soft: #a5cfae;
  --warn: #d9a34a;
  --warn-soft: #ecc27c;
  --danger: #e0705e;
  --danger-soft: #f0a294;
  --sky: #7ea7b5;
  --radius: 14px;
  --radius-sm: 9px;
  --display: "Amiri", "Iowan Old Style", Georgia, serif;
  --ui: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

.accent-sand { --department-accent: #cbb995; }
.accent-gold { --department-accent: var(--gold); }
.accent-coral { --department-accent: #d47d67; }
.accent-rose { --department-accent: #c97f8a; }
.accent-sage { --department-accent: #89a887; }
.accent-sky { --department-accent: var(--sky); }
.accent-slate { --department-accent: #8993a3; }

* { box-sizing: border-box; }

/* The hidden attribute must always win: several containers set their own display
   (grid/flex), which would otherwise override the UA's [hidden] rule. */
[hidden] { display: none !important; }

html {
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 500px at 85% -5%, rgba(216, 173, 104, 0.05), transparent 60%),
    var(--ink);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.9;
  text-rendering: optimizeLegibility;
}

.num { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

a { color: inherit; }

.skip-link {
  position: absolute;
  inset-inline-start: -999px;
  top: 8px;
  z-index: 200;
  background: var(--gold);
  color: #201704;
  font-weight: 700;
  border-radius: 8px;
  padding: 8px 18px;
  text-decoration: none;
}
.skip-link:focus-visible { inset-inline-start: 8px; }

/* ————— shell ————— */
.app-shell { display: grid; grid-template-columns: 262px 1fr; min-height: 100vh; }

.command-rail {
  background: var(--rail);
  border-inline-end: 1px solid var(--line);
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand { display: flex; align-items: center; gap: 12px; margin-block-end: 18px; text-decoration: none; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: linear-gradient(150deg, #2a2416, #171207);
  border: 1px solid rgba(216, 173, 104, 0.4);
  color: var(--gold-bright);
  font-family: var(--display); font-size: 25px; font-weight: 700;
  display: grid; place-items: center;
}
.brand strong { display: block; font-size: 16px; font-weight: 700; line-height: 1.4; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; }

.nav-link, .department-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-soft); text-decoration: none; font-size: 14.5px; font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease;
}
.nav-link:hover, .department-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link[aria-current="page"], .department-link[aria-current="page"] {
  background: var(--gold-dim); color: var(--gold-bright); border-color: rgba(216, 173, 104, 0.25);
}
.nav-link .glyph { width: 20px; text-align: center; flex: none; opacity: 0.9; }
.nav-badge {
  margin-inline-start: auto; background: var(--gold); color: #1c1503;
  font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 0 8px; line-height: 20px;
}

.rail-label {
  color: var(--muted); font-size: 11px; letter-spacing: 0.08em;
  margin: 16px 12px 6px; text-transform: uppercase;
}
.department-nav { display: flex; flex-direction: column; gap: 2px; }
.department-link { font-size: 13.5px; padding: 7px 12px; }
.department-link .count { margin-inline-start: auto; color: var(--muted); font-size: 11px; }
.department-link.is-planned { color: var(--muted); }
.department-link::before {
  content: ""; width: 8px; height: 8px; border-radius: 3px; flex: none;
  background: var(--department-accent, var(--line-strong));
  opacity: 0.9;
}
.unit-link {
  display: flex; align-items: center; gap: 8px;
  margin-inline-start: 26px; padding: 4px 12px;
  border-inline-start: 1px solid var(--line-strong);
  color: var(--muted); font-size: 12.5px; text-decoration: none;
}
.unit-link:hover { color: var(--text-soft); }
.unit-link .sdot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.unit-link .sdot.off { background: var(--line-strong); }

.rail-foot {
  margin-block-start: auto; padding-block-start: 14px;
  color: var(--muted); font-size: 12px;
  display: flex; gap: 8px; align-items: center;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 4px rgba(131, 181, 141, 0.15); flex: none;
}

/* ————— header & surface ————— */
.command-surface { min-width: 0; display: flex; flex-direction: column; }

.command-header {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 26px clamp(18px, 4vw, 46px) 0;
  flex-wrap: wrap;
}
.eyebrow { color: var(--muted); font-size: 12.5px; letter-spacing: 0.04em; margin: 0 0 4px; }
.command-header h1 {
  font-family: var(--display); font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 700; margin: 0; line-height: 1.3;
}
.identity-cluster { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.identity-copy { text-align: start; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.identity-copy strong { display: block; color: var(--text-soft); font-size: 13.5px; }

.pill-button, .quiet-button {
  font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
  background: var(--panel-2); color: var(--text-soft);
  border: 1px solid var(--line-strong); border-radius: 99px;
  padding: 5px 16px; line-height: 1.6; min-height: 32px;
}
.pill-button:hover, .quiet-button:hover { color: var(--gold-bright); border-color: rgba(216, 173, 104, 0.4); }

.global-error {
  margin: 14px clamp(18px, 4vw, 46px) 0;
  background: rgba(224, 112, 94, 0.12);
  border: 1px solid rgba(224, 112, 94, 0.4);
  color: var(--danger-soft);
  border-radius: 10px; padding: 10px 16px; font-size: 14px;
}

main { padding: 10px clamp(18px, 4vw, 46px) 110px; max-width: 1120px; width: 100%; }
main:focus { outline: none; }

section { margin-block-end: 38px; }

.view-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-block-end: 14px; flex-wrap: wrap; }
.view-heading h2 { font-family: var(--display); font-size: 25px; font-weight: 700; margin: 0; }
.view-heading p { margin: 0; color: var(--muted); font-size: 13.5px; }

.section-link { color: var(--gold); font-size: 13px; text-decoration: none; font-weight: 600; white-space: nowrap; }
.section-link:hover { color: var(--gold-bright); text-decoration: underline; }

/* ————— chips & pills ————— */
.status-pill, .mode-pill, .chip {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 600;
  border-radius: 99px; padding: 2px 11px; line-height: 20px; white-space: nowrap;
  background: var(--panel-3); color: var(--text-soft); border: 1px solid var(--line);
}
.status-live { background: rgba(131, 181, 141, 0.12); color: var(--ok-soft); border-color: rgba(131, 181, 141, 0.3); }
.status-needs_attention { background: rgba(224, 112, 94, 0.14); color: var(--danger-soft); border-color: rgba(224, 112, 94, 0.35); }
.status-stale { background: rgba(217, 163, 74, 0.13); color: var(--warn-soft); border-color: rgba(217, 163, 74, 0.35); }
.status-planned, .status-paused { color: var(--muted); }
.severity { text-transform: none; }
.severity-high { background: rgba(224, 112, 94, 0.14); color: var(--danger-soft); border-color: rgba(224, 112, 94, 0.35); }
.severity-warn { background: rgba(217, 163, 74, 0.13); color: var(--warn-soft); border-color: rgba(217, 163, 74, 0.35); }
.severity-info { color: var(--muted); }
.chip-gold { background: var(--gold-dim); color: var(--gold-bright); border-color: rgba(216, 173, 104, 0.3); }

/* ————— overview hero ————— */
.overview-hero {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-block-end: 18px;
}
.hero-main {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 26px 28px;
}
.hero-main h2 {
  font-family: var(--display); font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 8px; line-height: 1.35; font-weight: 700;
}
.hero-main h2 .accented { color: var(--gold-bright); }
.hero-main p { margin: 0; color: var(--text-soft); font-size: 14.5px; max-width: 46ch; }
.hero-money {
  background: var(--panel);
  border: 1px solid rgba(216, 173, 104, 0.35); border-radius: var(--radius);
  padding: 22px 24px; display: flex; flex-direction: column; justify-content: center; gap: 14px;
}
.money-line { display: flex; flex-direction: column; gap: 2px; }
.money-line .amount {
  font-family: var(--display); font-weight: 700; font-size: 30px;
  line-height: 1.2; color: var(--gold-bright);
}
.money-line .amount .cur { font-size: 15px; color: var(--gold); font-family: var(--ui); font-weight: 500; }
.money-line .cap { color: var(--muted); font-size: 12.5px; }
.money-line.held { border-block-start: 1px solid var(--line); padding-block-start: 12px; }
.money-line.held .amount { color: var(--text-soft); font-size: 22px; }

/* ————— act-now cards ————— */
.act-card, .finding-card {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 20px 22px; margin-block-end: 14px; position: relative; overflow: hidden;
}
.act-card::before, .finding-card::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px;
  background: var(--edge, var(--line-strong));
}
.sev-high { --edge: var(--danger); }
.sev-warn { --edge: var(--warn); }
.sev-info { --edge: var(--line-strong); }
.finding-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-block-end: 6px; }
.finding-head h3 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.55; max-width: 38ch; }
.finding-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-block-end: 4px; color: var(--muted); font-size: 12px; }
.finding-money {
  font-family: var(--display); font-size: 25px; font-weight: 700;
  color: var(--gold-bright); white-space: nowrap;
}
.evidence-list {
  margin: 0 0 14px; padding: 0; list-style: none;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
}
.evidence-list li { padding: 8px 14px; font-size: 13.5px; background: var(--panel-2); }
.evidence-list li:nth-child(even) { background: var(--panel); }
.proposal {
  background: var(--gold-dim); border: 1px solid rgba(216, 173, 104, 0.25);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13.5px; margin-block-end: 14px;
}
.proposal span { color: var(--gold-bright); font-weight: 700; display: block; font-size: 12px; margin-block-end: 2px; }
.proposal p { margin: 0; }

.decision-note {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text); font-family: inherit;
  font-size: 13.5px; padding: 9px 12px; margin-block-end: 12px; resize: vertical;
}
.decision-note::placeholder { color: var(--muted); }
.decision-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.decision-button {
  font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  border-radius: 11px; padding: 11px 26px; border: 1px solid transparent;
  line-height: 1.5; min-height: 46px; transition: filter 0.15s ease;
}
.decision-button:hover { filter: brightness(1.1); }
.decision-button:disabled { opacity: 0.5; cursor: default; }
.decision-approve { background: var(--gold); color: #201704; }
.decision-reject { background: none; border-color: rgba(224, 112, 94, 0.5); color: var(--danger-soft); }
.decision-comment { background: none; border-color: var(--line-strong); color: var(--text-soft); }
.decision-guard { color: var(--muted); font-size: 11.5px; margin-inline-start: auto; }
.decision-guidance { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }
.decision-conflict { color: var(--danger-soft); font-size: 13px; margin: 0 0 10px; }
.decision-history { margin-block-end: 12px; color: var(--text-soft); font-size: 13px; }
.decision-history summary { cursor: pointer; color: var(--muted); }
.decision-history ul { margin: 8px 0 0; padding-inline-start: 20px; }
.decision-history .frozen { color: var(--gold-bright); font-weight: 600; }

.conflict-recovery {
  background: rgba(126, 167, 181, 0.08); border: 1px dashed rgba(126, 167, 181, 0.45);
  border-radius: var(--radius-sm); padding: 14px 18px; margin-block-end: 16px;
}
.conflict-recovery strong { color: #a9c6d1; }
.conflict-recovery p { margin: 4px 0 10px; font-size: 13.5px; }

/* ————— metric & department cards ————— */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.metric-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
}
.metric-card span { color: var(--muted); font-size: 12px; }
.metric-card strong { font-family: var(--display); font-size: 24px; font-weight: 700; line-height: 1.3; }
.metric-card small { color: var(--muted); font-size: 11.5px; }

.department-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.department-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; text-decoration: none; display: flex; flex-direction: column; gap: 8px;
  position: relative; overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.department-card::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px;
  background: var(--department-accent, var(--line-strong));
}
.department-card:hover { border-color: rgba(216, 173, 104, 0.4); transform: translateY(-2px); }
.department-card h3 { margin: 0; font-family: var(--display); font-size: 18px; font-weight: 700; }
.department-card .dept-note { margin: 0; color: var(--muted); font-size: 12.5px; }
.department-card .unit-rows { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-soft); }
.department-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-block-start: auto; padding-block-start: 8px; border-block-start: 1px solid var(--line); }
.department-card-footer .status-stack { display: flex; gap: 6px; flex-wrap: wrap; }

/* ————— unit blocks & agent cards ————— */
.unit-block {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-block-end: 18px;
}
.unit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-block-end: 4px; }
.unit-head h3 { margin: 0; font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--gold-bright); }
.unit-head .ucap { color: var(--muted); font-size: 12.5px; }
.unit-stats { display: flex; gap: 22px; flex-wrap: wrap; margin: 10px 0 14px; }
.unit-stat strong { font-family: var(--display); font-size: 20px; font-weight: 700; display: block; line-height: 1.3; }
.unit-stat span { color: var(--muted); font-size: 11.5px; }

.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.agent-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
}
.agent-card::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px;
  background: var(--line);
}
.agent-card[data-status="live"]::before { background: var(--ok); }
.agent-card[data-status="needs_attention"]::before { background: var(--danger); }
.agent-card[data-status="stale"]::before { background: var(--warn); }
.agent-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.agent-card h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.agent-link { text-decoration: none; }
.agent-link:hover { color: var(--gold-bright); }
.agent-card .purpose { margin: 0; color: var(--text-soft); font-size: 13px; line-height: 1.65; }
.latest-report { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; }
.latest-report strong { font-weight: 600; }
.latest-report span { color: var(--muted); font-size: 12px; }
.agent-card-bottom {
  display: flex; justify-content: space-between; gap: 10px; color: var(--muted);
  font-size: 12px; border-block-start: 1px solid var(--line); padding-block-start: 9px;
  margin-block-start: auto;
}

/* ————— timeline ————— */
.timeline { position: relative; padding-inline-start: 26px; display: flex; flex-direction: column; gap: 14px; }
.timeline::before {
  content: ""; position: absolute; inset-inline-start: 8px; top: 8px; bottom: 8px; width: 1px;
  background: linear-gradient(var(--line-strong), transparent);
}
.tl-item { position: relative; }
.tl-item::before {
  content: ""; position: absolute; inset-inline-start: -23px; top: 14px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--dot, var(--muted)); box-shadow: 0 0 0 3px var(--ink);
}
.tl-report { --dot: var(--ok); }
.tl-finding { --dot: var(--danger); }
.tl-decision { --dot: var(--gold); }
.tl-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 16px;
}
.tl-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-block-end: 3px; color: var(--muted); font-size: 12px; }
.tl-meta .who { color: var(--text-soft); font-weight: 600; }
.tl-lead { font-weight: 700; font-size: 15.5px; margin: 0; line-height: 1.7; }
.tl-lead a { text-decoration: none; }
.tl-lead a:hover { color: var(--gold-bright); }
.tl-lead .amt { color: var(--gold-bright); }
.tl-detail { color: var(--text-soft); font-size: 13.5px; margin: 2px 0 0; }

/* ————— reports ————— */
.report-list, .priority-list { display: flex; flex-direction: column; gap: 10px; }
.report-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; display: flex; justify-content: space-between; gap: 14px; align-items: flex-start;
  position: relative; overflow: hidden;
}
.report-row::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px;
  background: var(--department-accent, var(--line-strong));
}
.report-row h3 { margin: 0 0 2px; font-size: 15.5px; font-weight: 700; }
.report-row h3 a { text-decoration: none; }
.report-row h3 a:hover { color: var(--gold-bright); }
.report-row p { margin: 0 0 6px; color: var(--text-soft); font-size: 13.5px; }
.report-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }

.takeaway {
  background: var(--gold-dim); border: 1px solid rgba(216, 173, 104, 0.3);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 15px; font-weight: 600;
  margin-block-end: 16px; line-height: 1.8;
}
.takeaway .tk-label { color: var(--gold-bright); font-family: var(--display); font-weight: 700; margin-inline-end: 6px; }

.report-hero, .detail-hero, .department-hero, .decision-hero {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 22px 26px; margin-block-end: 18px;
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  position: relative; overflow: hidden;
}
.report-hero::before, .detail-hero::before, .department-hero::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px;
  background: var(--department-accent, var(--line-strong));
}
.report-hero h2, .detail-hero h2, .department-hero h2, .decision-hero h2 {
  font-family: var(--display); font-size: clamp(22px, 3vw, 30px); font-weight: 700; margin: 0 0 6px; line-height: 1.4;
}
.report-hero p, .detail-hero p, .department-hero p, .decision-hero p { margin: 0; color: var(--text-soft); font-size: 14px; max-width: 56ch; }
.hero-signal { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; justify-content: center; }
.hero-signal strong { font-family: var(--display); font-size: 34px; font-weight: 700; color: var(--gold-bright); line-height: 1.2; }
.hero-signal span { color: var(--muted); font-size: 12.5px; }
.report-stamp { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; justify-content: center; }
.report-stamp strong { font-size: 15px; }
.report-stamp span { color: var(--muted); font-size: 12px; }
.health-callout { display: flex; flex-direction: column; gap: 2px; justify-content: center; max-width: 32ch; }
.health-callout span { color: var(--muted); font-size: 12px; }
.health-callout strong { font-size: 16px; }
.health-callout p { font-size: 13px; }
.detail-status { display: flex; gap: 8px; margin-block-end: 8px; flex-wrap: wrap; }

.breadcrumb { color: var(--muted); font-size: 13px; text-decoration: none; display: inline-block; margin-block-end: 8px; }
.breadcrumb:hover { color: var(--gold-bright); }

.report-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-block-end: 18px; }
.report-metric {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
}
.report-metric span { color: var(--muted); font-size: 12px; }
.report-metric strong { font-family: var(--display); font-size: 24px; font-weight: 700; line-height: 1.3; }
.report-metric small { color: var(--muted); font-size: 11px; }
.report-metric[data-direction="up_bad"] strong, .report-metric[data-direction="down_good"] strong { color: var(--danger-soft); }
.report-metric[data-direction="up_good"] strong { color: var(--ok-soft); }

.report-sections { display: flex; flex-direction: column; gap: 12px; margin-block-end: 18px; }
.report-section {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px;
}
.report-section h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: var(--gold-bright); }
.report-section ul { margin: 0; padding-inline-start: 20px; font-size: 13.5px; color: var(--text-soft); }
.report-section li { margin-block-end: 4px; }

.source-links { display: flex; flex-direction: column; gap: 6px; margin-block-end: 18px; font-size: 13px; }
.source-link { color: var(--sky); text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.source-path { color: var(--muted); }

.metadata-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.metadata-item {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 2px;
}
.metadata-item span { color: var(--muted); font-size: 11.5px; }
.metadata-item strong { font-size: 14px; font-weight: 600; }

/* ————— decisions workspace ————— */
.decision-hero strong.queue-count { font-family: var(--display); font-size: 40px; color: var(--gold-bright); }
.queue-filter-shell {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-block-end: 16px;
}
.queue-filter-shell summary {
  cursor: pointer; padding: 10px 16px; color: var(--muted); font-size: 13px; font-weight: 600;
  list-style: none;
}
.queue-filter-shell summary::-webkit-details-marker { display: none; }
.queue-filters { display: flex; gap: 12px; flex-wrap: wrap; padding: 4px 16px 14px; }
.queue-filter { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.queue-filter select {
  background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--text);
  font-family: inherit; font-size: 13px; border-radius: 8px; padding: 6px 10px; min-height: 36px;
}
.mine-filter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); align-self: flex-end; padding-block-end: 6px; }
.mine-filter input { width: 18px; height: 18px; accent-color: var(--gold); }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-block-end: 14px; }
.filter-button {
  font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: var(--panel-2); color: var(--text-soft);
  border: 1px solid var(--line); border-radius: 99px; padding: 4px 14px; min-height: 32px;
}
.filter-button[aria-pressed="true"] { background: var(--gold-dim); color: var(--gold-bright); border-color: rgba(216, 173, 104, 0.35); }

/* ————— login ————— */
.login-stage { display: grid; place-items: center; min-height: 80vh; padding: 30px 0; }
.login-card {
  width: min(430px, 92vw);
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-strong); border-radius: 18px; padding: 34px 32px;
}
.login-brand {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(150deg, #2a2416, #171207);
  border: 1px solid rgba(216, 173, 104, 0.4);
  color: var(--gold-bright); font-family: var(--display); font-size: 30px; font-weight: 700;
  display: grid; place-items: center; margin-block-end: 16px;
}
.login-card h1 { font-family: var(--display); font-size: 30px; font-weight: 700; margin: 4px 0 6px; line-height: 1.35; }
.login-intro { color: var(--text-soft); font-size: 14px; margin: 0 0 20px; }
.login-card label { display: block; color: var(--muted); font-size: 12.5px; margin: 12px 0 4px; }
.login-card input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line-strong);
  color: var(--text); font-family: inherit; font-size: 15px;
  border-radius: 10px; padding: 11px 14px;
}
.primary-button {
  width: 100%; margin-block-start: 20px;
  background: var(--gold); color: #201704; border: none; border-radius: 11px;
  font-family: inherit; font-size: 15.5px; font-weight: 700; padding: 13px; min-height: 48px; cursor: pointer;
  transition: filter 0.15s ease;
}
.primary-button:hover { filter: brightness(1.08); }
.primary-button:disabled { opacity: 0.6; cursor: default; }
.form-error { color: var(--danger-soft); font-size: 13.5px; min-height: 20px; margin: 10px 0 0; }

/* ————— states ————— */
.loading-state, .data-error, .empty-state {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px 28px; text-align: center; color: var(--muted); font-size: 14px;
}
.data-error h2 { font-family: var(--display); font-size: 22px; color: var(--text-soft); margin: 4px 0 8px; }
.data-error p, .empty-state p { margin: 0 0 6px; }
.loading-mark {
  width: 34px; height: 34px; margin: 0 auto 10px; border-radius: 50%;
  border: 3px solid var(--line-strong); border-block-start-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ————— bottom navigation (mobile) ————— */
.bottom-nav { display: none; }

/* ————— focus & motion ————— */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .department-card:hover { transform: none; }
}

/* ————— responsive ————— */
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .command-rail { display: none; }
  .overview-hero { grid-template-columns: 1fr; }
  main { padding-block-end: 130px; }
  body.authenticated .bottom-nav {
    display: grid; grid-template-columns: repeat(3, 1fr);
    position: fixed; bottom: 0; inset-inline: 0; z-index: 50;
    background: rgba(10, 11, 8, 0.96); backdrop-filter: blur(10px);
    border-block-start: 1px solid var(--line-strong);
    padding: 8px 6px calc(10px + env(safe-area-inset-bottom));
  }
  .bnav-link {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
    padding: 6px 2px; border-radius: 10px; min-height: 48px; justify-content: center;
    position: relative;
  }
  .bnav-link .glyph { font-size: 19px; line-height: 1.1; }
  .bnav-link[aria-current="page"] { color: var(--gold-bright); }
  .bnav-dot {
    position: absolute; top: 4px; inset-inline-end: 18%;
    background: var(--gold); color: #1c1503; font-size: 10px; font-weight: 700;
    border-radius: 99px; min-width: 16px; line-height: 16px; padding: 0 4px; text-align: center;
  }
}

@media (max-width: 640px) {
  .command-header { padding-block-start: 18px; }
  .identity-copy { display: none; }
  .finding-head h3 { font-size: 15.5px; }
  .decision-actions .decision-button { flex: 1 1 40%; }
  .hero-signal { align-items: flex-start; }
  .report-hero, .detail-hero, .department-hero, .decision-hero { flex-direction: column; }
  .report-stamp { align-items: flex-start; }
}
