/* =============================================================================
   ATLAS OS — PUBLIC DEMO STYLESHEET
   site/assets/styles.css
   Source of truth: docs/ia-spec.md §5 (Design system) + §2 (layout regions).
   Verified against ref/real-atlas-os-shell.html (live shell markup+CSS) and
   ref/branding-and-portal.txt (live operator portal) wherever both existed —
   every hex/radius/shadow/breakpoint below that appears in those reference
   files matches them exactly. No invented color values.
   Offline-safe: no @import, no external @font-face, no network requests.
   ========================================================================== */

/* -----------------------------------------------------------------------
   0. A NOTE ON assets/atlas-theme.css (judgment call — see report)
   -----------------------------------------------------------------------
   atlas-theme.css is a DIFFERENT design system: a "fusion skin" meant to be
   dropped into Odoo/Nextcloud/WordPress custom-CSS slots so those foreign
   admin UIs borrow Atlas colors. Its own header claims "/os/ shell → already
   themed; import for parity" but that is not what ref/real-atlas-os-shell.html
   actually does: the real shell's embedded <style> block hardcodes hex values
   that match ia-spec.md §5.1 (e.g. #141d33 cards, #0ea5ff accent, #2a3a5e
   borders, 1.1s pulse, radius 11/8/12) and does NOT reference any
   --atlas-* custom property. atlas-theme.css also carries guardrails that
   directly contradict §5 of the demo spec: "no purple/gradients", "no
   skeleton pulses", "no glassmorphism/glows", "radius never > 4px", "accent
   NEVER used for status" — but §5.1/§5.5/§5.6 require exactly those things
   (--purple accent, pulse skeletons, a glow elevation token, radii to 20px,
   color-as-status on nodes/pills). Given the real shell verifiably follows
   §5.1 and not atlas-theme.css, §5.1 is treated as authoritative here. A
   compatibility block below re-declares atlas-theme.css's --atlas-* names
   aliased to the closest §5.1 token, purely so nothing breaks if a page
   accidentally references the old names — it is not the primary token set.
   ========================================================================== */

/* =============================================================================
   1. RESET & BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--blue); color: var(--bg-deep); }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-xs); }
*::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* =============================================================================
   2. DESIGN TOKENS — §5.1 color · §5.2 type · §5.3 spacing · §5.4 radii ·
      §5.5 elevation · §5.6 motion
   ========================================================================== */
:root {
  /* --- 5.1 Color tokens (match real shell exactly) --- */
  --bg:            #0b1020; /* app background / desktop base */
  --bg-deep:       #070B16; /* boot, login, status bars */
  --surface:       #141d33; /* windows, cards, icon blocks */
  --surface-2:     #0f1730; /* inner cards, list rows */
  --surface-3:     #11182b; /* topbar, taskbar, status bar */
  --titlebar:      #1b2742; /* window titlebars, chips */
  --border:        #2a3a5e; /* default border */
  --border-2:      #233252; /* chrome separators */
  --border-hover:  #3c5286; /* hover border */
  --text:          #e8edf7; /* primary text */
  --text-2:        #cfd9ee; /* secondary text / icon labels */
  --muted:         #7e8db0; /* meta text */
  --muted-2:       #9fb0cc; /* tertiary text, close icons */
  --muted-3:       #828eab; /* category headers — D1: raised from #6c7a9c for 4.5:1 on bg/surface/surface-2/surface-3/titlebar (recomputed WCAG, worst case titlebar 4.53:1) */
  --faint:         #808ead; /* taskbar text — D1: raised from #5e6e92 for 4.5:1 on bg/surface/surface-2/surface-3/titlebar (worst case titlebar 4.51:1) */
  --blue:          #0ea5ff; /* primary accent, focus, active */
  --info:          #4a9fe2; /* secondary/info accent */
  --green:         #4ec98a; /* success / online */
  --gold:          #e0a234; /* warning / attention / brand watermark */
  --purple:        #9b8cf0; /* AI / proposals */
  --red:           #e2655f; /* error / offline / destructive */
  --project-green: #3fb950; /* project/code accent */
  --panel:         rgba(15,23,42,.82);   /* translucent card */
  --panel-2:       rgba(20,30,52,.6);    /* translucent secondary */
  --border-soft:   rgba(59,130,246,.18); /* soft brand border */

  /* --- 5.2 Typography --- */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --fs-boot-logo:  clamp(18px, 1rem + 1.1vw, 26px);
  --fs-login-clock: clamp(30px, 1.6rem + 3vw, 46px);
  --fs-h1:         clamp(19px, 1.1rem + 1.2vw, 28px);
  --fs-h2:         15px; /* window title / H2, spec range 13-16 */
  --fs-body:       13px;
  --fs-card-label: 11px;
  --fs-kpi-value:  clamp(17px, 1rem + 0.5vw, 21px);
  --fs-cathead:    10px;
  --fs-icon-label: 11px;
  --fs-meta:       12px;
  --lh-ui: 1.3;
  --lh-prose: 1.6;

  /* --- 5.3 Spacing (4px base) --- */
  --sp-1: 4px;  --sp-2: 6px;  --sp-3: 8px;  --sp-4: 10px;
  --sp-5: 12px; --sp-6: 14px; --sp-7: 16px; --sp-8: 18px;
  --sp-9: 20px; --sp-10: 24px; --sp-11: 28px; --sp-12: 40px;

  /* --- 5.4 Radii --- */
  --radius-xs:   6px;  /* menu items / small chips */
  --radius-sm:   7px;  /* buttons / inputs */
  --radius-md:   8px;  /* cards */
  --radius-lg:   9px;  /* tiles / menus */
  --radius-xl:   11px; /* windows / palette */
  --radius-2xl:  12px; /* icon blocks */
  --radius-pill: 20px; /* pills */
  --radius-round: 50%; /* avatars / dots */

  /* --- 5.5 Elevation --- */
  --elev-0:  none;
  --elev-1:  0 8px 30px rgba(0,0,0,.4);   /* windows, toasts */
  --elev-2:  0 12px 40px rgba(0,0,0,.55); /* command palette */
  --elev-3:  0 24px 80px rgba(0,0,0,.6);  /* palette (portal variant) */
  --glow:    0 0 8px rgba(14,165,255,.5); /* selected node / online dot */
  --blur-sm: blur(8px);
  --blur-lg: blur(14px);

  /* --- 5.6 Motion --- */
  --dur-fast: 120ms;
  --dur-base: 280ms;
  --dur-boot: 420ms;
  --dur-pulse: 1.1s;
  --dur-dash: 6s;
  --ease: ease;
  --lift:  translateY(-2px);
  --press: scale(.94);

  /* --- safe-area passthrough (real shell parity) --- */
  --safe-t: env(safe-area-inset-top);
  --safe-b: env(safe-area-inset-bottom);
  --safe-l: env(safe-area-inset-left);
  --safe-r: env(safe-area-inset-right);
}

/* --- Compatibility shim for assets/atlas-theme.css names (see §0 above).
   Aliased to the nearest §5.1 value; NOT used by this stylesheet's own
   rules below. Safe to delete once nothing references --atlas-*. --- */
:root {
  --atlas-bg-0: var(--bg-deep);
  --atlas-bg-1: var(--bg);
  --atlas-bg-2: var(--surface-2);
  --atlas-bg-3: var(--surface);
  --atlas-border-0: var(--border-2);
  --atlas-border-1: var(--border);
  --atlas-text-0: var(--text);
  --atlas-text-1: var(--muted);
  --atlas-text-2: var(--faint);
  --atlas-accent: var(--blue);
  --atlas-accent-hover: #3ab8ff;
  --atlas-accent-soft: rgba(14,165,255,.12);
  --atlas-ok: var(--green);
  --atlas-ok-soft: rgba(78,201,138,.12);
  --atlas-warn: var(--gold);
  --atlas-warn-soft: rgba(224,162,52,.12);
  --atlas-crit: var(--red);
  --atlas-crit-soft: rgba(226,101,95,.12);
  --atlas-font-ui: var(--font-sans);
  --atlas-font-mono: var(--font-mono);
}

/* =============================================================================
   3. ACCESSIBILITY BASE — §5.8
   ========================================================================== */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Focus ring: 2px solid #0ea5ff, offset 2px, ALWAYS visible. We honour
   "always visible" by never suppressing outline without a :focus-visible
   replacement anywhere in this file (judgment call — see report). */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
a:focus-visible, button:focus-visible, [tabindex]:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* =============================================================================
   4. GLOBAL CHROME — product-law strip, demo chip, brand mark, shared primitives
   ========================================================================== */

/* --- Product-law strip: 4 segments, 26px --- */
.law-strip {
  display: flex;
  align-items: stretch;
  height: 26px;
  background: var(--bg-deep);
  border-bottom: .5px solid var(--border-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .02em;
  color: var(--muted);
  overflow-x: auto;
}
.law-strip--bottom { border-bottom: none; border-top: .5px solid var(--border-2); }
.law-strip__seg {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: 0 var(--sp-4);
  border-right: .5px solid var(--border-2);
  white-space: nowrap;
}
.law-strip__seg:last-child { border-right: none; }
.law-strip__seg::before { content: "\203A"; color: var(--border-hover); }
.law-strip__seg:first-child::before { content: none; }
.law-strip__seg.is-active {
  color: var(--blue);
  background: rgba(14,165,255,.08);
  font-weight: 600;
}
.law-strip__full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* --- Demo chip: "Demo · synthetische data" --- */
.demo-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 22px;
  padding: 0 var(--sp-4);
  border: .5px solid var(--gold);
  border-radius: var(--radius-pill);
  background: rgba(224,162,52,.1);
  color: var(--gold);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
}
.demo-chip::before {
  content: "";
  width: 6px; height: 6px; border-radius: var(--radius-round);
  background: var(--gold);
}
.demo-chip__tip {
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  width: 220px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: .5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-1);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 400;
  line-height: var(--lh-prose);
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
  z-index: 50;
}
.demo-chip:hover .demo-chip__tip,
.demo-chip:focus-within .demo-chip__tip {
  opacity: 1; visibility: visible; transform: translateY(0);
}

/* --- Brand mark --- */
.brand { display: flex; align-items: center; gap: var(--sp-4); }
.brand__mark { width: 17px; height: 17px; flex: 0 0 auto; }
.brand__mark--lg { width: 68px; height: 68px; }
.brand__name { font-size: 13px; font-weight: 500; color: var(--text); }
.watermark {
  position: absolute; pointer-events: none; opacity: .04; z-index: 0;
  background: url('atlas-logo.svg') no-repeat center / contain;
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 38px;
  padding: var(--sp-3) var(--sp-9);
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  transition: filter var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn:active { transform: var(--press); }
.btn--primary { background: var(--blue); color: var(--bg); }
.btn--primary:hover { filter: brightness(1.08); text-decoration: none; }
.btn--secondary {
  background: transparent; color: var(--text-2);
  border: .5px solid var(--border);
}
.btn--secondary:hover { border-color: var(--border-hover); background: var(--surface); text-decoration: none; }
.btn--ghost { background: none; color: var(--muted-2); padding: var(--sp-2) var(--sp-4); min-height: 32px; }
.btn--ghost:hover { color: var(--text); background: var(--titlebar); text-decoration: none; }
.btn--danger { background: var(--red); color: #fff; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; pointer-events: none; }

/* --- Generic card primitive (reused by Portal + OS windows) --- */
.card {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-6);
}
.card__label { font-size: var(--fs-card-label); color: var(--muted); }
.card__value { font-size: var(--fs-kpi-value); font-weight: 500; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.card__title { font-size: 13px; font-weight: 500; color: var(--text); }

/* --- Status rule: never colour-only. Dot + icon + text label. --- */
.status {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: 11px; font-weight: 500;
}
.status__dot { width: 7px; height: 7px; border-radius: var(--radius-round); flex: 0 0 auto; }
.status--online  .status__dot { background: var(--green); box-shadow: 0 0 5px var(--green); }
.status--online  { color: var(--green); }
.status--degraded .status__dot { background: var(--gold); box-shadow: 0 0 5px var(--gold); }
.status--degraded { color: var(--gold); }
.status--offline .status__dot { background: var(--red); box-shadow: 0 0 5px var(--red); }
.status--offline { color: var(--red); }
.status--idle .status__dot { background: var(--faint); }
.status--idle { color: var(--faint); }

/* Icon sizing (icons.js SVGs use stroke="currentColor", 24x24 viewBox) */
.icon { width: 16px; height: 16px; color: currentColor; flex: 0 0 auto; }
.icon--sm { width: 13px; height: 13px; }
.icon--lg { width: 23px; height: 23px; }

/* =============================================================================
   5. SHARED STATES — loading skeleton, empty, selected, degraded, offline
   ========================================================================== */
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.skel { display: flex; flex-direction: column; gap: var(--sp-3); }
.skel > div, .skel-block {
  border-radius: var(--radius-md);
  background: var(--surface-2);
  animation: pulse var(--dur-pulse) ease-in-out infinite;
}
.skel-line { height: 12px; border-radius: var(--radius-xs); }
.skel-tile { height: 64px; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); padding: var(--sp-12) var(--sp-6);
  color: var(--muted); text-align: center; font-size: 13px;
}
.empty-state .icon { width: 28px; height: 28px; --muted-3: #6c7a9c; color: var(--muted-3); } /* D1 carve-out: icon-only, needs only 3:1, keep original hue */

.empty-state--preview { gap: var(--sp-5); padding: var(--sp-12) var(--sp-8); }
/* ds-r1-styles-css-4: .empty-state--preview .icon / __name / __desc / __headline
   removed — renderPreview() in app.js (owned elsewhere) never emits those
   classes (icon has no extraClass, name/desc/synthetic are raw inline-styled
   divs), so they matched nothing. .empty-state--preview itself and
   .empty-state__badge below ARE emitted and stay. */
.empty-state__badge {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted-2); background: var(--surface-2); border: .5px solid var(--border);
  border-radius: var(--radius-pill); padding: var(--sp-1) var(--sp-4);
}

.is-selected { border-color: var(--blue) !important; box-shadow: var(--glow); }
.is-dimmed   { opacity: .35; transition: opacity var(--dur-base) var(--ease); }
.is-hover    { border-color: var(--border-hover); transform: var(--lift); }

.is-degraded { border-color: var(--gold) !important; }
.is-degraded::after {
  content: "";
  position: absolute; inset: -3px;
  border-radius: inherit;
  border: 1px solid rgba(224,162,52,.5);
  animation: pulse 1.6s ease-in-out infinite;
  pointer-events: none;
}
.is-offline { border-color: var(--red) !important; opacity: .6; filter: grayscale(.3); }

.banner-offline {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-6);
  background: var(--surface-3);
  border-bottom: .5px solid var(--border-2);
  color: var(--muted-2); font-size: 12px;
}
.banner-offline .status__dot { background: var(--red); }

/* =============================================================================
   6. PORTAL SURFACE — index.html (§2.1)
   ========================================================================== */
.portal { min-height: 100%; background: var(--bg); }

/* 6.1 Topbar */
.portal-topbar {
  display: flex; align-items: center; gap: var(--sp-6);
  height: 50px;
  padding: 0 calc(var(--sp-6) + var(--safe-r)) 0 calc(var(--sp-6) + var(--safe-l));
  padding-top: var(--safe-t);
  background: var(--surface-3);
  border-bottom: .5px solid var(--border-2);
  position: sticky; top: 0; z-index: 100;
}
.portal-topbar__spacer { flex: 1 1 auto; }
.portal-topbar__date { font-size: 12px; color: var(--muted); }
.portal-topbar__clock { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.acct-btn {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
}
.acct-btn:hover { background: var(--titlebar); }
.acct-avatar {
  width: 26px; height: 26px; border-radius: var(--radius-round);
  background: var(--titlebar); border: .5px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: var(--blue);
}

/* 6.2 Alert banner (34px, collapsible) */
.alert-banner {
  display: flex; align-items: center; gap: var(--sp-4);
  height: 34px;
  padding: 0 var(--sp-6);
  background: rgba(224,162,52,.08);
  border-bottom: .5px solid rgba(224,162,52,.25);
  font-size: 12px; color: var(--text-2);
  cursor: pointer;
}
.alert-banner--crit { background: rgba(226,101,95,.08); border-bottom-color: rgba(226,101,95,.25); }
.alert-banner__dot {
  width: 8px; height: 8px; border-radius: var(--radius-round);
  background: var(--gold); flex: 0 0 auto;
  animation: pulse 1.5s ease-in-out infinite;
}
.alert-banner--crit .alert-banner__dot { background: var(--red); }
.alert-banner__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 var(--sp-2);
  border-radius: var(--radius-pill);
  background: var(--gold); color: var(--bg-deep);
  font-size: 10px; font-weight: 700;
}
.alert-banner__msg { flex: 1 1 auto; }
.alert-banner__action { color: var(--blue); font-weight: 500; flex: 0 0 auto; }
.alert-detail {
  padding: var(--sp-6);
  background: var(--surface-2);
  border-bottom: .5px solid var(--border-2);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-6);
  font-size: 12px;
}
.alert-detail dt { color: var(--muted); margin-bottom: var(--sp-1); }
.alert-detail dd { color: var(--text); margin: 0; }

/* 6.3 Hero / login zone */
.hero-wrap { max-width: 1180px; margin: 0 auto; padding: var(--sp-12) var(--sp-9); overflow: hidden; }
.hero {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: var(--sp-12);
  align-items: center;
}
.hero__eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--info); margin-bottom: var(--sp-4); }
.hero__title { font-size: var(--fs-h1); font-weight: 600; line-height: 1.25; margin-bottom: var(--sp-4); color: var(--text); }
.hero__sub { font-size: 14px; color: var(--muted); line-height: var(--lh-prose); margin-bottom: var(--sp-9); max-width: 46ch; }
.hero__actions { display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; }
.hero__link { font-size: 13px; color: var(--text-2); }

.login-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: var(--sp-10);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  box-shadow: var(--elev-1);
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-5); text-align: center;
}
.login-card__avatar {
  width: 66px; height: 66px; border-radius: var(--radius-round);
  background: var(--titlebar); border: .5px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; font-weight: 500; color: var(--blue);
}
.login-card__meta { font-size: 13px; color: var(--muted); }
.login-card__sso {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 12px; color: var(--muted);
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  width: 100%;
  justify-content: center;
}
.login-card__status { margin-top: var(--sp-2); }

/* 6.4 Situation overview (12-col grid) */
.overview { max-width: 1180px; margin: 0 auto; padding: 0 var(--sp-9) var(--sp-12); }
.overview.is-loading .card, .overview.is-loading .kpi-tile { position: relative; }
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--sp-6); }

/* 6.5 KPI tile row (6 tiles) */
.kpi-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--sp-6); margin-bottom: var(--sp-9); }
.kpi-tile {
  position: relative;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--border);
  padding: var(--sp-5) var(--sp-6);
  min-height: 44px;
}
.kpi-tile--ok   { border-left-color: var(--green); }
.kpi-tile--info { border-left-color: var(--blue); }
.kpi-tile--warn { border-left-color: var(--gold); }
.kpi-tile__label { font-size: var(--fs-card-label); color: var(--muted); margin-bottom: var(--sp-2); }
.kpi-tile__value {
  font-family: var(--font-mono); font-size: var(--fs-kpi-value); font-weight: 500;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.kpi-tile__value .unit { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: var(--sp-1); }

/* 6.6 Vandaag / Signalen / Kassa / Voorstellen cards */
.overview-card { grid-column: span 6; }
.overview-card--wide { grid-column: span 12; }
@media (min-width: 1200px) { .overview-card { grid-column: span 3; } }

.timeline { display: flex; flex-direction: column; }
.timeline__item {
  display: flex; gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: .5px solid var(--border-2);
  font-size: 12px;
}
.timeline__item:last-child { border-bottom: none; }
.timeline__time { font-family: var(--font-mono); color: var(--muted); flex: 0 0 42px; }
.timeline__dot { width: 6px; height: 6px; border-radius: var(--radius-round); background: var(--blue); margin-top: 5px; flex: 0 0 auto; }
.timeline__text { color: var(--text-2); }

.signal-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.signal-item {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface); border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer;
}
.signal-item:hover { border: .5px solid var(--border-hover); }
.signal-item .icon { color: var(--gold); }
.signal-item--crit .icon { color: var(--red); }

.venue-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: .5px solid var(--border-2);
  font-size: 12px;
}
.venue-row:last-child { border-bottom: none; }
.venue-row__name { color: var(--text-2); flex: 1 1 auto; }
.venue-row__meta { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.sparkline { width: 64px; height: 22px; overflow: visible; }
.sparkline path { fill: none; stroke: var(--blue); stroke-width: 1.5; }
.sparkline .fill { fill: rgba(14,165,255,.12); stroke: none; }

.proposal-card__count {
  font-family: var(--font-mono); font-size: 28px; font-weight: 500; color: var(--purple);
}
.proposal-card__label { font-size: 12px; color: var(--muted-2); margin-top: var(--sp-1); }
.proposal-card__link { display: inline-block; margin-top: var(--sp-4); font-size: 12px; font-weight: 500; }

/* 6.7 CTA band */
.cta-band {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-6);
  padding: var(--sp-12) var(--sp-9);
  flex-wrap: wrap;
}

/* 6.8 Footer */
.site-footer {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-6) var(--sp-9);
  border-top: .5px solid var(--border-2);
  font-size: 11px; color: var(--faint);
  flex-wrap: wrap;
}

/* =============================================================================
   7. REACH SURFACE — reach.html / Reach window (§2.2, §4)
   ========================================================================== */
.reach { position: relative; height: 100%; min-height: 100%; background: var(--bg); overflow: hidden; display: flex; flex-direction: column; }

/* 7.1 Header strip */
.reach-header {
  display: flex; align-items: center; gap: var(--sp-6);
  padding: var(--sp-4) var(--sp-6);
  background: var(--surface-3);
  border-bottom: .5px solid var(--border-2);
  flex: 0 0 auto;
}
.reach-header__title { font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: .02em; }
.reach-header__sub { font-size: 12px; color: var(--muted); }
.reach-header__time { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); margin-left: auto; }
.reach-header__time.is-scanning::after { content: "\2026"; animation: pulse 1s ease-in-out infinite; }

/* 7.2 Canvas area */
.reach-body { position: relative; flex: 1 1 auto; display: flex; overflow: hidden; }
.canvas-wrap {
  position: relative; flex: 1 1 auto; overflow: hidden;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 40px 40px;
  cursor: grab;
}
.canvas-wrap:active { cursor: grabbing; }
.reach-canvas { width: 100%; height: 100%; touch-action: none; }
.cluster-hull { fill: var(--panel-2); stroke: var(--border-soft); stroke-width: 1; opacity: .6; }
.cluster-label { fill: var(--muted-3); font: 600 10px var(--font-mono); letter-spacing: .09em; text-transform: uppercase; }

/* 7.3 Filter chips */
.filter-chips {
  position: absolute; top: var(--sp-5); left: var(--sp-5);
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
  max-width: calc(100% - 40px);
  z-index: 5;
}
.chip {
  display: inline-flex; align-items: center; height: 30px; min-height: 30px;
  padding: 0 var(--sp-6);
  border-radius: var(--radius-pill);
  border: .5px solid var(--border);
  background: var(--panel);
  backdrop-filter: var(--blur-sm);
  color: var(--text-2);
  font-size: 12px;
}
.chip:hover { border-color: var(--border-hover); }
.chip[aria-pressed="true"] { border-color: var(--blue); color: #fff; background: rgba(14,165,255,.14); }

/* 7.4 Detail panel (340-400px slide-in) */
.detail-panel {
  width: 380px; max-width: 92vw; flex: 0 0 auto;
  background: var(--surface);
  border-left: .5px solid var(--border);
  box-shadow: var(--elev-1);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--dur-base) var(--ease);
}
.detail-panel.is-open { transform: translateX(0); }
.detail-panel__header {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-6);
  border-bottom: .5px solid var(--border-2);
}
.detail-panel__name { font-size: 15px; font-weight: 500; color: var(--text); }
.detail-panel__since { font-size: 11px; color: var(--muted); margin-left: auto; }
.detail-panel__close { color: var(--muted-2); font-size: 18px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-xs); }
.detail-panel__close:hover { color: #fff; background: var(--red); }
.detail-panel__section { padding: var(--sp-6); border-bottom: .5px solid var(--border-2); }
.detail-panel__section:last-child { border-bottom: none; }
.detail-panel__label { font-size: var(--fs-card-label); color: var(--muted); margin-bottom: var(--sp-2); }
.detail-panel__value { font-family: var(--font-mono); font-size: var(--fs-kpi-value); font-weight: 500; color: var(--text); }
.detail-panel__delta { font-size: 11px; margin-left: var(--sp-2); }
.detail-panel__delta.is-up { color: var(--green); }
.detail-panel__delta.is-down { color: var(--red); }
.flow-row { display: flex; justify-content: space-between; padding: var(--sp-2) 0; font-size: 12px; border-bottom: .5px solid var(--border-2); }
.flow-row:last-child { border-bottom: none; }
.flow-row__vol { font-family: var(--font-mono); color: var(--muted); }
.governance-note {
  display: flex; gap: var(--sp-2); align-items: flex-start;
  font-size: 11px; color: var(--purple);
  background: rgba(155,140,240,.08);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
}
.detail-panel__actions { display: flex; gap: var(--sp-3); }

/* 7.5 Legend (bottom-left, collapsible) */
.legend {
  position: absolute; bottom: var(--sp-5); left: var(--sp-5);
  background: var(--panel);
  border: .5px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  backdrop-filter: var(--blur-sm);
  font-size: 11px; color: var(--text-2);
  z-index: 5;
  max-width: 260px;
}
.legend__toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); cursor: pointer; min-height: 24px; }
.legend__body { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.legend__row { display: flex; align-items: center; gap: var(--sp-3); }
.legend__swatch { width: 18px; height: 2px; flex: 0 0 auto; }
.legend__swatch--id   { border-top: 2px dotted var(--info); }
.legend__swatch--data { border-top: 2px solid var(--blue); }
.legend__swatch--ai   { border-top: 2px dashed var(--purple); }
.legend__swatch--mon  { border-top: 2px solid var(--green); opacity: .5; }
.legend__dot { width: 8px; height: 8px; border-radius: var(--radius-round); flex: 0 0 auto; }

/* 7.6 Node visual */
.node { cursor: pointer; }
.node__tile {
  width: 44px; height: 44px;
  border-radius: var(--radius-2xl);
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: .5;
  transition: transform var(--dur-fast) var(--ease), stroke var(--dur-fast) var(--ease);
}
.node:hover .node__tile { stroke: var(--border-hover); }
.node.is-selected .node__tile { stroke: var(--blue); filter: drop-shadow(var(--glow)); }
.node.is-dim { opacity: .35; }
.node__icon { color: var(--node-accent, var(--info)); }
.node__label { font-size: 11px; fill: var(--text-2); text-anchor: middle; }
.node__led { r: 4; stroke: var(--surface); stroke-width: 2; }
.node__led.is-online   { fill: var(--green); }
.node__led.is-degraded { fill: var(--gold); }
.node__led.is-offline  { fill: var(--red); }
.node__led.is-idle     { fill: var(--faint); }
.node-tooltip {
  position: absolute; pointer-events: none;
  background: var(--titlebar); border: .5px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--sp-2) var(--sp-4);
  font-size: 11px; color: var(--text-2); box-shadow: var(--elev-1);
  white-space: nowrap; z-index: 20;
}

/* 7.7 Edge visual */
.edge { fill: none; }
.edge--id   { stroke: var(--info); stroke-width: 1; stroke-dasharray: 2 3; }
.edge--data { stroke: var(--border); stroke-width: 1; }
.edge--data-dash {
  stroke: var(--blue); stroke-width: 1; fill: none;
  stroke-dasharray: 6 10;
  animation: edge-dash var(--dur-dash) linear infinite;
}
@keyframes edge-dash { to { stroke-dashoffset: -160; } }
.edge--ai   { stroke: var(--purple); stroke-width: 1; stroke-dasharray: 5 4; }
.edge--mon  { stroke: var(--green); stroke-width: 1; opacity: .4; }
.edge.is-degraded { stroke: var(--gold) !important; }
.edge.is-active   { opacity: 1; stroke-width: 1.5; }
.edge.is-dim      { opacity: .2; }
.edge-label {
  font-size: 10px; fill: var(--text-2);
  paint-order: stroke; stroke: var(--bg); stroke-width: 3;
}
.edge-popover {
  position: absolute; background: var(--titlebar); border: .5px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4);
  font-size: 11px; color: var(--text-2); box-shadow: var(--elev-1); z-index: 20;
}

/* =============================================================================
   8. ATLAS OS DESKTOP SHELL — os.html (§2.3, §2.4)
   ========================================================================== */
.os { position: fixed; inset: 0; overflow: hidden; user-select: none; }

/* 8.1 Boot / login (parity with real shell) */
.boot, .login {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--sp-8);
  background: var(--bg-deep); z-index: 2000;
}
.boot__title { font-size: var(--fs-boot-logo); font-weight: 500; letter-spacing: 2px; color: var(--text); }
.boot-bar { width: 220px; height: 4px; background: var(--border-2); border-radius: var(--radius-md); overflow: hidden; }
.boot-bar__fill { width: 0; height: 100%; background: var(--blue); transition: width var(--dur-boot); }
.boot__msg { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.login__clock { font-size: var(--fs-login-clock); font-weight: 500; color: var(--text); }
.login__date { font-size: 13px; color: var(--muted-2); margin-bottom: var(--sp-2); }
.login__avatar {
  width: 66px; height: 66px; border-radius: var(--radius-round);
  background: var(--titlebar); border: .5px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; font-weight: 500; color: var(--blue);
}
.login__name { font-size: 16px; font-weight: 500; color: var(--text); }
.login__sso { font-size: 12px; color: var(--muted); }

/* 8.2 Desktop wallpaper layer */
.desktop {
  position: fixed; inset: 0; display: none; opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
  background: url('atlas-wallpaper.svg') center / cover no-repeat, var(--bg);
}
.desktop.is-in { display: block; opacity: 1; }
.desktop.is-loading { display: block; }

/* 8.3 Topbar */
.os-topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: calc(38px + var(--safe-t));
  padding-top: var(--safe-t);
  padding-left: calc(var(--sp-6) + var(--safe-l));
  padding-right: calc(var(--sp-6) + var(--safe-r));
  background: var(--surface-3);
  border-bottom: .5px solid var(--border-2);
  display: flex; align-items: center; gap: var(--sp-4);
  z-index: 1000;
}
.os-topbar__home { display: flex; align-items: center; gap: var(--sp-4); padding: 2px 4px; border-radius: var(--radius-sm); transition: background var(--dur-fast); }
.os-topbar__home:hover { background: var(--titlebar); }
.os-topbar__spacer { flex: 1 1 auto; }
.os-topbar .icon { font-size: 15px; }
.os-topbar__clock { font-size: 12px; color: var(--text-2); font-family: var(--font-mono); }

/* 8.4 Left rail — grouped icon grid */
.icon-rail {
  position: fixed;
  top: calc(54px + var(--safe-t));
  left: calc(var(--sp-6) + var(--safe-l));
  display: flex; flex-direction: column; gap: var(--sp-8);
  z-index: 10;
  max-height: calc(100vh - 120px);
  max-height: calc(100svh - 120px);
  overflow-y: auto; overflow-x: hidden;
  width: 188px;
}
.cathead {
  font-size: var(--fs-cathead); font-weight: 600; color: var(--muted-3);
  text-transform: uppercase; letter-spacing: .09em;
  padding-left: 3px; margin-bottom: var(--sp-2);
}
.catgrid { display: grid; grid-template-columns: repeat(2, 80px); gap: var(--sp-5); }
.ico {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  width: 80px; border-radius: var(--radius-2xl); padding: var(--sp-1) 0;
}
.ico__tile {
  width: 48px; height: 48px; border-radius: var(--radius-2xl);
  background: var(--surface); border: .5px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 23px;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.ico span { font-size: var(--fs-icon-label); color: var(--text-2); }
.ico:hover .ico__tile { transform: var(--lift); border-color: var(--border-hover); background: #19243f; }
.ico:active .ico__tile { transform: var(--press); }
.ico .status__dot { position: absolute; }

/* 8.5 Windows */
.win {
  position: fixed; width: 330px;
  background: var(--surface); border: .5px solid var(--border);
  border-radius: var(--radius-xl); overflow: hidden; z-index: 20;
  box-shadow: var(--elev-1);
  transition: box-shadow var(--dur-fast) var(--ease); /* ds-r1-styles-css-5: on the base rule too, so the ring animates off, not just on */
}
.win--rich { width: 640px; }
.win--xl { width: 900px; }
.win.max { left: 0 !important; top: calc(38px + var(--safe-t)) !important; width: 100vw !important; height: calc(100vh - 69px) !important; height: calc(100svh - 69px) !important; border-radius: 0; }
.win.is-focused {
  border-color: var(--border-hover);
  box-shadow: var(--elev-1), 0 0 0 1px rgba(14,165,255,.45);
}
.win.min { display: none; }
.tb {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--titlebar); cursor: move; touch-action: none;
}
.tb[data-accent] { box-shadow: inset 0 -2px 0 var(--win-accent, var(--blue)); }
.tb .icon:first-child { font-size: 15px; }
.tb span.tb__title { font-size: 13px; font-weight: 500; flex: 1 1 auto; }
.wbtn { min-width: 22px; min-height: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0 var(--sp-2); color: var(--muted-2); font-size: 13px; line-height: 1; border-radius: var(--radius-xs); }
.wbtn:hover { color: #fff; }
.tb .x { cursor: pointer; color: var(--muted-2); font-size: 16px; border-radius: var(--radius-xs); min-width: 22px; min-height: 22px; display: flex; align-items: center; justify-content: center; transition: color var(--dur-fast), background var(--dur-fast); }
.tb .x:hover { color: #fff; background: var(--red); }
.tb .r { cursor: pointer; color: var(--muted-2); font-size: 15px; border-radius: var(--radius-xs); min-width: 22px; min-height: 22px; display: flex; align-items: center; justify-content: center; transition: color var(--dur-fast), background var(--dur-fast); }
.tb .r:hover { color: #fff; background: var(--border); }
.win .body {
  padding: var(--sp-5); max-height: 60vh; max-height: 60svh; overflow: auto;
  font-size: 13px; user-select: text; touch-action: pan-y pinch-zoom;
  container-type: inline-size;
}
.win .row { display: flex; justify-content: space-between; padding: var(--sp-3) var(--sp-1); border-bottom: .5px solid var(--titlebar); font-size: 12px; }

/* 8.6 Taskbar */
.taskbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(30px + var(--safe-b));
  padding-bottom: var(--safe-b);
  padding-left: calc(var(--sp-5) + var(--safe-l));
  padding-right: calc(var(--sp-5) + var(--safe-r));
  background: var(--surface-3);
  border-top: .5px solid var(--border-2);
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: 11px; color: var(--faint);
  z-index: 1000;
}
.taskbar__tag { flex: 0 0 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }
.taskbar__wins { flex: 1 1 auto; display: flex; align-items: center; gap: var(--sp-3); overflow-x: auto; overflow-y: hidden; white-space: nowrap; }
.taskbar__wins::-webkit-scrollbar { height: 0; }
.tbchip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--titlebar); border: .5px solid var(--border); color: var(--text-2);
  font-size: 11px; padding: var(--sp-1) var(--sp-5); border-radius: var(--radius-sm);
  line-height: 1.4; min-height: 24px;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.tbchip:hover { border-color: var(--border-hover); background: #19243f; }
.tbchip.active { border-color: var(--blue); color: #fff; }
.taskbar__law { flex: 0 0 auto; font-family: var(--font-mono); }

/* 8.7 Account menu */
.acctmenu {
  position: fixed; top: calc(46px + var(--safe-t)); right: calc(var(--sp-6) + var(--safe-r));
  background: var(--surface); border: .5px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--elev-1); overflow: hidden; z-index: 1001; min-width: 150px;
}
.acctmenu button {
  display: flex; align-items: center; gap: var(--sp-4); width: 100%;
  color: var(--text-2); font-size: 13px; text-align: left;
  padding: var(--sp-4) var(--sp-6); min-height: 44px;
}
.acctmenu button:hover { background: var(--titlebar); }
.acctmenu .icon { color: var(--muted-2); }

/* 8.8 Ctrl+K command palette */
.cmdk-scrim {
  position: fixed; inset: 0; z-index: 1900;
  background: rgba(3,6,14,.6);
  backdrop-filter: var(--blur-sm); -webkit-backdrop-filter: var(--blur-sm);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14vh;
  padding-top: 14svh;
}
.cmdk-box {
  width: 560px; max-width: 92vw;
  background: rgba(13,20,38,.97);
  border: 1px solid var(--blue);
  border-radius: var(--radius-xl);
  box-shadow: var(--elev-2), 0 0 0 1px rgba(59,130,246,.2);
  overflow: hidden;
}
.cmdk-input {
  width: 100%; background: none; border: none;
  padding: var(--sp-6); font-size: 15px; color: var(--text);
  border-bottom: .5px solid var(--border-2);
}
.cmdk-input::placeholder { color: var(--muted); }
.cmdk-results { max-height: 340px; overflow-y: auto; padding: var(--sp-3); }
.cmdk-item {
  display: flex; align-items: center; gap: var(--sp-5);
  padding: var(--sp-4) var(--sp-5); border-radius: var(--radius-lg);
  cursor: pointer; font-size: 13px; color: var(--text-2); min-height: 44px;
}
.cmdk-item.is-active, .cmdk-item:hover { background: var(--titlebar); color: var(--text); }
.cmdk-item .icon { color: var(--muted-2); }
.cmdk-footer {
  display: flex; align-items: center; gap: var(--sp-5);
  padding: var(--sp-4) var(--sp-6);
  border-top: .5px solid var(--border-2);
  font-size: 11px; color: var(--muted);
}
.cmdk-hint { font-family: var(--font-mono); border: .5px solid var(--border); border-radius: var(--radius-xs); padding: 1px var(--sp-2); }

/* 8.9 Toasts */
.toasts { position: fixed; top: calc(46px + var(--safe-t)); right: calc(var(--sp-6) + var(--safe-r)); z-index: 3000; display: flex; flex-direction: column; gap: var(--sp-3); pointer-events: none; }
.toast {
  background: var(--titlebar); border: .5px solid var(--border); border-left: 3px solid var(--blue);
  border-radius: var(--radius-md); padding: var(--sp-4) var(--sp-6);
  font-size: 12px; color: var(--text-2); box-shadow: var(--elev-1); max-width: 320px;
  animation: toast-in var(--dur-base) var(--ease);
}
.toast--ok { border-left-color: var(--green); }
.toast--warn { border-left-color: var(--gold); }
.toast--crit { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }

/* 8.10 AI-reply module (Gedeelde inbox) — §2.4, 3-pane */
.inbox { display: grid; grid-template-columns: 220px 1fr 280px; height: 100%; min-height: 0; }
.inbox__list { border-right: .5px solid var(--border-2); overflow-y: auto; }
.inbox__tabs { display: flex; gap: var(--sp-2); padding: var(--sp-3); border-bottom: .5px solid var(--border-2); }
.inbox__tab { font-size: 11px; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-xs); color: var(--muted); min-height: 28px; }
.inbox__tab[aria-selected="true"] { background: var(--titlebar); color: var(--text); }
.conv-row {
  display: flex; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5);
  border-bottom: .5px solid var(--border-2); cursor: pointer; position: relative;
}
.conv-row:hover, .conv-row.is-active { background: var(--titlebar); }
/* D1: --red/--muted text fails 4.5:1 on --titlebar (4.42/4.47) though both pass
   on every other surface — scope a lighter same-hue value to every container
   whose own background is --titlebar, per the directive's titlebar-scoped carve-out. */
.acct-btn:hover, .os-topbar__home:hover, .win .tb,
.cmdk-item.is-active, .cmdk-item:hover,
.inbox__tab[aria-selected="true"],
.conv-row:hover, .conv-row.is-active,
.acctmenu button:hover, .btn--ghost:hover {
  --red: #e36862;   /* 4.54:1 on --titlebar (was #e2655f, 4.42:1) */
  --muted: #7f8eb0; /* 4.52:1 on --titlebar (was #7e8db0, 4.47:1) */
}
.conv-row__icon.channel--whatsapp { color: var(--green); }
.conv-row__icon.channel--mail { color: var(--info); }
.conv-row__name { font-size: 12px; font-weight: 500; color: var(--text); }
.conv-row__venue { font-size: 10px; color: var(--muted-3); }
.conv-row__snippet { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-row__unread { width: 7px; height: 7px; border-radius: var(--radius-round); background: var(--blue); position: absolute; top: var(--sp-4); right: var(--sp-4); }
.conv-row__wait { font-size: 10px; color: var(--gold); background: rgba(224,162,52,.12); border-radius: var(--radius-pill); padding: 1px var(--sp-2); }

.thread { display: flex; flex-direction: column; min-height: 0; }
.thread__header { padding: var(--sp-4) var(--sp-6); border-bottom: .5px solid var(--border-2); font-size: 12px; color: var(--muted); }
.thread__context-chip { display: inline-block; font-size: 10px; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-pill); padding: 1px var(--sp-3); margin-right: var(--sp-2); }
.thread__body { flex: 1 1 auto; overflow-y: auto; padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.thread__empty { margin: auto; color: var(--muted); font-size: 13px; }
.bubble { max-width: 70%; padding: var(--sp-4) var(--sp-5); border-radius: var(--radius-lg); font-size: 13px; line-height: var(--lh-prose); }
.bubble--customer { align-self: flex-start; background: var(--surface-2); color: var(--text-2); border-bottom-left-radius: var(--radius-xs); }
.bubble--business { align-self: flex-end; background: rgba(14,165,255,.14); color: var(--text); border-bottom-right-radius: var(--radius-xs); }

.ai-panel { border-left: .5px solid var(--border-2); padding: var(--sp-6); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-5); }
.ai-badge {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  align-self: flex-start;
  font-size: 11px; font-weight: 600; color: var(--purple);
  background: rgba(155,140,240,.12); border-radius: var(--radius-pill);
  padding: var(--sp-1) var(--sp-4);
}
.ai-badge.is-drafting { animation: pulse 1.6s ease-in-out infinite; }
.ai-textarea {
  width: 100%; min-height: 110px; resize: vertical;
  background: var(--surface-2); border: .5px solid var(--border); border-radius: var(--radius-md);
  padding: var(--sp-4); font-size: 13px; color: var(--text); line-height: var(--lh-prose);
}
.ai-textarea:focus { border-color: var(--blue); }
.sources-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.sources-list li { font-size: 11px; color: var(--muted); }
.confidence-meter { display: flex; align-items: center; gap: var(--sp-3); }
.confidence-meter__bar { flex: 1 1 auto; height: 5px; border-radius: var(--radius-xs); background: var(--surface-2); overflow: hidden; }
.confidence-meter__fill { height: 100%; background: var(--purple); border-radius: var(--radius-xs); transition: width var(--dur-base); }
.confidence-meter__label { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.ai-actions { display: flex; flex-direction: column; gap: var(--sp-3); }
.ai-actions .btn { width: 100%; }
.ai-governance { font-size: 10px; color: var(--muted); text-align: center; }
.reject-reason { display: flex; flex-direction: column; gap: var(--sp-2); }
.reject-reason select { background: var(--surface-2); border: .5px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-3); }

/* =============================================================================
   9. RESPONSIVE — §5.7 (Portal / Reach / OS)
   ========================================================================== */

/* 900–1199px */
@media (max-width: 1199px) {
  .hero { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-12 { grid-template-columns: repeat(6, 1fr); }
  .overview-card { grid-column: span 3; }
  .overview-card--wide { grid-column: span 6; }
  .detail-panel { position: absolute; inset: 0 0 0 auto; z-index: 30; }
  .icon-rail { width: 160px; }
  .win { width: 96vw !important; }
}

/* 561–900px + phones: shared touch-tier chrome. The dock geometry itself
   lives in the range-scoped block below so ≤560 never has to reverse it. */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-12, .overview-card, .overview-card--wide { grid-column: span 6 !important; }
  .taskbar { z-index: 1500; }
  .tb { min-height: 42px; padding: var(--sp-4) var(--sp-5); }
  .detail-panel {
    width: 100%; max-width: none; transform: translateY(100%); position: fixed;
    inset: auto 0 0 0; height: 70vh; height: 70svh; border-left: none;
    border-top: .5px solid var(--border); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  .detail-panel.is-open { transform: translateY(0); }
  .detail-panel::before {
    content: ""; position: absolute; top: var(--sp-3); left: 50%; margin-left: -18px;
    width: 36px; height: 4px; border-radius: var(--radius-pill); background: var(--border-hover);
  }
  /* ds-r1-styles-css-1: .inbox__list and .ai-panel used to both become
     position:fixed inset:0 z-index:40 overlays with nothing to toggle which
     one shows (app.js sets no such class) — the later-painted .ai-panel
     permanently hid the conversation list, with no way back. Stack the three
     panes in normal flow instead: nothing overlays anything, so the list is
     always reachable by scrolling the window body. This matches the already-
     correct narrow-window behavior below (line ~1154's @container query),
     which never used the overlay approach in the first place. */
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox__list { border-right: none; border-bottom: .5px solid var(--border-2); }
  .thread { border-bottom: .5px solid var(--border-2); }
  .ai-panel { border-left: none; }
}

/* 561–900px only: rail becomes a floating horizontal dock above the taskbar,
   z-index'd over windows like a taskbar; window height budgets around it.
   Range-scoped (not plain ≤900) so the ≤560 vertical list below never has
   to un-flatten cathead/catgrid or reset a dock height. */
@media (min-width: 561px) and (max-width: 900px) {
  .icon-rail {
    position: fixed; top: auto; bottom: calc(44px + var(--safe-b));
    left: 0; right: 0; width: auto; height: 96px; max-height: none;
    flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden;
    padding: var(--sp-3) var(--sp-6); gap: var(--sp-6);
    background: var(--surface-3); border-top: .5px solid var(--border-2);
    z-index: 1500;
  }
  .icon-rail > div { display: contents; }
  .cathead { display: none; }
  .catgrid { display: contents; }
  .ico { width: 64px; }
  .ico--more .ico__tile { border-style: dashed; }
  .ico__tile { width: 52px; height: 52px; font-size: 26px; }
  .win {
    left: 2vw !important; top: 46px !important; width: 96vw !important;
    height: calc(100vh - 186px) !important; height: calc(100svh - 186px) !important;
    border-radius: var(--radius-xl);
  }
  .win.max { top: calc(38px + var(--safe-t)) !important; height: calc(100vh - 82px) !important; height: calc(100svh - 82px) !important; }
}

/* ≤560px */
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-wrap, .overview { padding-left: var(--sp-5); padding-right: var(--sp-5); }
  .icon-rail {
    position: static; display: flex; flex-direction: column; gap: var(--sp-7);
    padding: calc(54px + var(--safe-t)) calc(var(--sp-6) + var(--safe-r)) var(--sp-6) calc(var(--sp-6) + var(--safe-l));
    width: 100%; max-height: none; overflow: visible;
  }
  .ico { width: auto; }
  .catgrid { grid-template-columns: repeat(4, 1fr); }
  .win {
    left: 0 !important; right: 0 !important; width: auto !important;
    top: calc(38px + var(--safe-t)) !important;
    height: auto !important;
    bottom: calc(30px + var(--safe-b)) !important;
    border-radius: 0; border-left: none; border-right: none;
    display: flex; flex-direction: column;
  }
  .win .body { max-height: none; flex: 1 1 auto; min-height: 0; }
  .taskbar { font-size: 10px; }
  .taskbar__tag { display: none; }
  .tb .x, .tb .r { font-size: 20px; padding: var(--sp-2); min-width: 44px; min-height: 44px; }
  .filter-chips { top: var(--sp-3); left: var(--sp-3); }
  .chip { height: 44px; }
  .legend { left: var(--sp-3); bottom: var(--sp-3); max-width: calc(100% - 24px); }
  .law-strip { font-size: 9px; }
  .cathead { padding-left: 0; }
  /* reach-header (reach.html + reachmap.html): title/toggle/demo-chip/Legenda
     row has no room at this width and was clipping/character-wrapping.
     The title+sub block is an unclassed inline-styled div (first child, both
     pages) — targeted structurally since it has no class to hook. */
  .reach-header { flex-wrap: wrap; }
  .reach-header > div:first-child { flex: 1 1 100%; }
  .reach-header__time { margin-left: 0; }
  /* os-topbar: #acctBtn ran off-edge, unreachable — drop least items. */
  #liveIndicator, .os-topbar>.icon, .os-topbar__clock { display: none; }
  .os-topbar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* 9.5 Super-responsive layer — design-logic.md §7. Window-scoped container
   queries: a 330px window on a 1920px screen must still collapse narrow. */
.detail-panel, .inbox { container-type: inline-size; }
@container (max-width: 560px) { .inbox { grid-template-columns: 1fr; } }
@container (max-width: 420px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .row { flex-wrap: wrap; }
}

/* Touch input: no hover affordance to reveal — gate on focus/open instead. */
@media (hover: none) {
  .ico:hover .ico__tile { transform: none; }
  .demo-chip:hover .demo-chip__tip { opacity: 0; visibility: hidden; transform: translateY(-4px); }
  .demo-chip.is-open .demo-chip__tip, .demo-chip:focus-within .demo-chip__tip {
    opacity: 1; visibility: visible; transform: translateY(0);
  }
}

/* Narrow phones (≤400px): portal-topbar (fixed 50px, no wrap) clips the
   demo-chip / account button off the right edge with date+clock both
   shown — drop the least essential items first. */
@media (max-width: 400px) {
  .portal-topbar__date, .portal-topbar__clock { display: none; }
}

/* Touch targets ≥44x44px on touch layouts */
@media (pointer: coarse) {
  .btn, .chip, .tbchip, .cmdk-item, .acctmenu button,
  .wbtn, .tb .x, .tb .r, .detail-panel__close, .ico,
  .legend__toggle, .os-topbar__home, .acct-btn, .alert-banner {
    min-height: 44px;
  }
  .ico__tile, .wbtn, .os-topbar__home, .acct-btn { min-width: 44px; }
}

/* =============================================================================
   10. REDUCED MOTION — §5.6, kills all animation/pulse/dash
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .edge--data-dash { stroke-dasharray: none; animation: none !important; }
  .skel > div, .skel-block, .demo-chip::before, .alert-banner__dot,
  .status__dot, .ai-badge.is-drafting, .is-degraded::after,
  .reach-header__time.is-scanning::after {
    animation: none !important;
  }
  .ico:hover .ico__tile, .node:hover .node__tile { transform: none; }
}
