/* GENERATED by infrastructure/app/emit-chassis-css.js from
   src/styles/presence-tokens.js + src/views/chassis/{tokens,feedback,rail}.js
   — do not hand-edit. The same CSS the PWA injects at runtime, for pages
   the PWA does not render. */

/* ---- presence tokens ---- */
:root {
  /* PWA base (the permanent-white ground) */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #e4e7ec;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #98a2b3;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --ok-line: #a6f4c5;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --warn-line: #fedf89;
  --bad: #b42318;
  --bad-bg: #fef3f2;
  --bad-line: #fecdca;
  --info: #175cd3;
  --info-bg: #eff8ff;
  --info-ink: #1449a8;
  --gray-50: #f6f7f9;
  --gray-100: #eef1f5;
  --gray-200: #e4e7ec;
  --gray-300: #d0d5dd;
  --gray-400: #98a2b3;
  --gray-500: #667085;
  --gray-600: #475467;
  --gray-700: #344054;
  --gray-800: #1d2939;
  --gray-900: #101828;
  --white: #ffffff;
  --app-bg: #f6f7f9;
  /* presence neutral accent family (tokens.json :: neutral) */
  --accent: #101828;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(16, 24, 40, 0.12);
  --accent-hover: #0E1522;
  --decor: #101828;
  --focus: #101828;
}

/* dukan */
[data-brand="dukan"] {
  --ref-primary: #1A1A2E;
  --ref-secondary: #E63E6D;
  --ref-accent: #FFC93C;
  --ref-neutral: #F5F3F7;
  --ref-ink-accent: #7F641E;
  --accent: #1A1A2E;
  --accent-ink: #F5F3F7;
  --accent-soft: rgba(26, 26, 46, 0.12);
  --accent-hover: #161628;
  --decor: #FFC93C;
  --focus: #1A1A2E;
}

/* elpanero (accent shaded from #C9962E for the white ground) */
[data-brand="elpanero"] {
  --ref-primary: #0E0E0E;
  --ref-secondary: #C9962E;
  --ref-accent: #1F6F5C;
  --ref-neutral: #F4ECDD;
  --ref-highlight: #E8C77A;
  --accent: #956F22;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(149, 111, 34, 0.12);
  --accent-hover: #805F1D;
  --decor: #E8C77A;
  --focus: #956F22;
}

/* ember */
[data-brand="ember"] {
  --ref-primary: #1A1715;
  --ref-secondary: #E8743B;
  --ref-accent: #C9A227;
  --ref-neutral: #F6F3EE;
  --accent: #1A1715;
  --accent-ink: #F6F3EE;
  --accent-soft: rgba(26, 23, 21, 0.12);
  --accent-hover: #161412;
  --decor: #C9A227;
  --focus: #1A1715;
}

/* isnad */
[data-brand="isnad"] {
  --ref-primary: #1A4A8E;
  --ref-accent: #EFAE2C;
  --ref-neutral: #F7F7F5;
  --accent: #1A4A8E;
  --accent-ink: #F7F7F5;
  --accent-soft: rgba(26, 74, 142, 0.12);
  --accent-hover: #16407A;
  --decor: #1A4A8E;
  --focus: #1A4A8E;
}

/* matin */
[data-brand="matin"] {
  --ref-primary: #34495E;
  --ref-secondary: #2E8B7A;
  --ref-accent: #4A6FA5;
  --ref-neutral: #EEF1F3;
  --accent: #34495E;
  --accent-ink: #EEF1F3;
  --accent-soft: rgba(52, 73, 94, 0.12);
  --accent-hover: #2D3F51;
  --decor: #4A6FA5;
  --focus: #34495E;
}

/* metha */
[data-brand="metha"] {
  --ref-primary: #6B7A3A;
  --ref-secondary: #C9912E;
  --ref-accent: #8A5A2B;
  --ref-neutral: #F4F1E8;
  --ref-ink-primary: #5A6731;
  --accent: #657337;
  --accent-ink: #F4F1E8;
  --accent-soft: rgba(101, 115, 55, 0.12);
  --accent-hover: #57632F;
  --decor: #8A5A2B;
  --focus: #657337;
}

/* naya */
[data-brand="naya"] {
  --ref-primary: #3FA3A0;
  --ref-secondary: #9DBF8E;
  --ref-accent: #E9B7A0;
  --ref-neutral: #F7F5F1;
  --ref-ink-primary: #2F7A78;
  --accent: #2F7976;
  --accent-ink: #F7F5F1;
  --accent-soft: rgba(47, 121, 118, 0.12);
  --accent-hover: #286865;
  --decor: #E9B7A0;
  --focus: #2F7976;
}

/* pylon */
[data-brand="pylon"] {
  --ref-primary: #101418;
  --ref-secondary: #5B6CFF;
  --ref-accent: #00D1B2;
  --ref-neutral: #F4F5F7;
  --ref-ink-accent: #4D5BD8;
  --accent: #101418;
  --accent-ink: #F4F5F7;
  --accent-soft: rgba(16, 20, 24, 0.12);
  --accent-hover: #0E1115;
  --decor: #00D1B2;
  --focus: #101418;
}

/* rukn */
[data-brand="rukn"] {
  --ref-primary: #005A37;
  --ref-accent: #00215A;
  --ref-neutral: #F7F7F5;
  --accent: #005A37;
  --accent-ink: #F7F7F5;
  --accent-soft: rgba(0, 90, 55, 0.12);
  --accent-hover: #004D2F;
  --decor: #005A37;
  --focus: #005A37;
}

/* tondro */
[data-brand="tondro"] {
  --ref-primary: #003366;
  --ref-secondary: #5A6B7B;
  --ref-accent: #E8A33D;
  --ref-neutral: #F2F1ED;
  --ref-ink-accent: #8B6124;
  --accent: #003366;
  --accent-ink: #F2F1ED;
  --accent-soft: rgba(0, 51, 102, 0.12);
  --accent-hover: #002C58;
  --decor: #E8A33D;
  --focus: #003366;
}

/* wasl */
[data-brand="wasl"] {
  --ref-primary: #15485E;
  --ref-secondary: #2E7D8A;
  --ref-accent: #D4A537;
  --ref-neutral: #EEF2F3;
  --ref-ink-accent: #7E6120;
  --accent: #15485E;
  --accent-ink: #EEF2F3;
  --accent-soft: rgba(21, 72, 94, 0.12);
  --accent-hover: #123E51;
  --decor: #D4A537;
  --focus: #15485E;
}

/* ---- data-plt-tokens ---- */
/* COLORS LIVE IN styles/presence-tokens.js (generated from the ONE presence
   token tree, runtime/templates/presence/tokens.json) — injected first via
   styles/index.js. This :root carries only the NON-color scale plus the
   one legacy alias the views still read. A company page sets
   <html data-brand="<co>"> (views/chassis/index.js) and --accent resolves
   to that brand's accent. */
:root {
  --accent-contrast: var(--accent-ink);
  --t-title: 1.125rem; --t-card: 1rem; --t-body: 0.9375rem;
  --t-meta: 0.8125rem; --t-micro: 0.72rem;
  --r-card: 14px; --r-btn: 10px; --r-pill: 999px;
  --sh-card: 0 1px 2px rgba(16,24,40,.05);
  --sh-pop: 0 8px 24px rgba(16,24,40,.14);
  --speed: 120ms;
  /* z-index SCALE (D12, consolidation 2026-08-08): five named layers — a
     bare number in view CSS is drift; pick the layer by MEANING. */
  --z-raised: 10;      /* raised in-flow elements (sticky strips, fab) */
  --z-nav: 100;        /* navigation drawers / layer-nav */
  --z-overlay: 1000;   /* modals, sheets, scrim */
  --z-toast: 2000;     /* transient toasts above modals */
  --z-critical: 3000;  /* connection-lost / crash veil — always wins */
  --font-body: 'Inter', 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* DARK MODE REMOVED — PERMANENT WHITE (founder-directed 2026-08-27:
   "make the pwa permanently white mode"). The token flip lived here
   2026-08-24 → 2026-08-27; the guard test now asserts NO
   prefers-color-scheme block exists in either sheet. Re-adding dark is a
   founder decision, not a cleanup. */

/* ── focus ring (one token; keyboards + accessibility) ── */
.btn:focus-visible, .chip:focus-visible, .iconbtn:focus-visible,
.input:focus-visible, a:focus-visible {
  outline: 2px solid var(--info); outline-offset: 2px;
}

/* ── THE BUTTON ── */
[dir="rtl"] body, [dir="rtl"] .app-body, [lang="ar"] { line-height: 1.65; }
/* Arabic NEVER takes letter-spacing — tracking disconnects cursive joining
   (the broken-marquee class). Applies to every element inside RTL scope. */
[dir="rtl"] *, [lang="ar"], [lang="ar"] * { letter-spacing: 0 !important; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px; border-radius: var(--r-btn);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: var(--t-body); font-weight: 600; font-family: inherit; cursor: pointer;
  line-height: 1; transition: filter var(--speed), background var(--speed), opacity var(--speed);
  text-transform: capitalize;
}
.btn:hover { background: var(--gray-100); }
.btn:active { transform: translateY(0.5px); }
.btn--primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn--primary:hover { filter: brightness(1.35); background: var(--accent); }
.btn--success { background: var(--ok); color: var(--white); border-color: var(--ok); }
.btn--success:hover { filter: brightness(1.1); background: var(--ok); }
.btn--danger { background: var(--bad); color: var(--white); border-color: var(--bad); }
.btn--danger:hover { filter: brightness(1.1); background: var(--bad); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--gray-100); }
.btn--sm { min-height: 38px; padding: 7px 12px; font-size: var(--t-meta); }
.btn--lg { min-height: 48px; padding: 12px 20px; font-size: 1rem; flex: 1 1 auto; }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { flex-shrink: 0; }

/* ── THE CHIP (interactive pill) + THE TAG (passive label) ── */
.chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 6px 13px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: var(--t-meta); font-weight: 600; cursor: pointer;
  font-family: inherit; line-height: 1; transition: background var(--speed);
  text-transform: capitalize; text-decoration: none;
}
.chip:hover { background: var(--gray-100); }
.chip.on, .chip.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.chip--nav { min-height: 40px; padding: 8px 16px; font-size: var(--t-body); }
.chip--count::after { content: attr(data-n); font-weight: 800; opacity: .65; margin-inline-start: 2px; }
.tag {
  display: inline-flex; align-items: center; min-height: 22px; padding: 2px 9px;
  border-radius: var(--r-pill); font-size: var(--t-micro); font-weight: 700; border: 0;
  text-transform: capitalize;
}
.tag--ok { background: var(--ok-bg); color: var(--ok); }
.tag--warn { background: var(--warn-bg); color: var(--warn); }
.tag--bad { background: var(--bad-bg); color: var(--bad); }
.tag--info { background: var(--info-bg); color: var(--info-ink); }  /* own AA-passing text; --info is overridden to a lighter blue elsewhere + also drives focus outlines */
.tag--mute { background: var(--gray-100); color: var(--ink-2); }

/* ══ THE SIX-ZONE CARD ANATOMY (founder-approved from the HTML mock,
   2026-08-11: 'these cards will be the essence of our work') ══
   EVERY card-at-a-time surface renders these zones IN ORDER; an empty
   zone is omitted with no orphan spacing. NO element inside a zone
   declares its own vertical margins — THE ZONE OWNS THE GAP:
     Z1 .cz-identity  handle chip + at most ONE status tag
     Z2 .cz-title     the headline (+8px after Z1)
     Z3 .cz-quals     ONE wrapping row of ALL qualifiers (+6px after Z2)
                      — unit, cadence, time, season, repeat-count, age,
                      sender, company — one .qchip anatomy, tint-only
                      variants (gray descriptive / warn attention /
                      bad load)
     Z4 .cz-content   blocks 10px apart (+14px after Z3)
     Z5 .cz-status    transient state line
     Z6 .cz-actions   verb row, hairline above (+14px)
   Locked by probe T6 (zone gaps + qchip computed-equality cross-deck)
   and the frontend inventory card_anatomy law.

   ONE AUTHORITY OWNS THE ZONE GAP (founder spacing pass 2026-08-12):
   .card is display:flex with gap:9px, so a zone's own margin USED TO
   STACK on that gap and every boundary rendered 9px too wide — measured
   live at 430px: title->content 23px (law 14), quals->content 23px,
   title->quals 15px (law 6), content->actions 17.8px (law 14). The
   board's .cb-row was accidentally correct only because it is
   display:block. A card that CARRIES the anatomy therefore drops the
   flex row-gap to 0 and lets the zone margins be the single authority
   (:has() is already used elsewhere in this codebase). Cards with no
   zone children keep the 9px DNA gap untouched. */
.card:has(> .cz-title), .card:has(> .cz-content),
.card:has(> .cz-quals), .card:has(> .cz-identity) { row-gap: 0; }
.cz-identity { display: flex; align-items: center; gap: 8px; }
/* Z1 is the first zone: a card whose anatomy starts at Z2/Z3 (title-first
   or quals-first) still opens flush against the card padding. */
.cz-identity:first-child, .cz-title:first-child, .cz-quals:first-child { margin-top: 0; }
.cz-hdl { display: inline-block; background: var(--accent); color: var(--accent-contrast);
  border-radius: 6px; padding: 2px 9px; font-weight: 700; font-size: var(--t-meta); }
.cz-title { margin: 8px 0 0; font-size: var(--t-card); font-weight: 700; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-align: start; }
.cz-quals { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.qchip { display: inline-flex; align-items: center; height: 24px; padding: 2px 9px;
  border-radius: var(--r-pill); font-size: var(--t-micro); font-weight: 600;
  background: var(--gray-100); color: var(--gray-600); border: 1px solid transparent; }
.qchip--warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.qchip--bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); font-weight: 700; }
.cz-content { margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
.cz-content > * { margin: 0; }   /* the zone owns the gap — no self-margins */
.cz-status { margin: 10px 0 0; font-size: var(--t-micro); }
.cz-actions { display: flex; gap: 8px; margin: 14px 0 0; padding-top: 14px;
  border-top: 1px solid var(--gray-100); }

/* ── icon button (header/refresh/sign-out) ── */
.iconbtn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer; transition: background var(--speed);
}
.iconbtn:hover { background: var(--gray-100); }

/* ── THE CARD DNA ── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--sh-card); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 9px;
}
.card--accent { border-inline-start: 3px solid var(--accent); }
.card-overline {
  font-size: var(--t-micro); font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-3); display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.card-title { font-size: var(--t-card); font-weight: 700; margin: 0; color: var(--ink); word-break: break-word; }
.card-meta { font-size: var(--t-meta); color: var(--ink-2); }
.well {
  background: var(--gray-50); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: var(--t-body); line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
/* the label (<b>REC / Agent Draft / Sent) is a block HEADER on every
   well — inline it ran into the body text ('RECarchive' class) */
.well > b {
  display: block; font-size: var(--t-micro); text-transform: uppercase;
  /* --ink-2, not --ink-3: a micro-size bold label needs AA 4.5:1 — gray-400
     on the gray-50 well was 2.46:1 (axe L10, fd-deck REC label). The header
     hierarchy survives via size+caps, not lightness. */
  letter-spacing: .05em; color: var(--ink-2); margin-bottom: 3px;
}
.well--draft { background: var(--ok-bg); border-color: var(--ok-line); }
.well--draft > b { color: var(--ok); }
.well.rtl { direction: rtl; text-align: right; }

/* ── THE INPUT ── */
.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: var(--r-btn);
  font-family: inherit; background: var(--surface); box-sizing: border-box;
  color: var(--ink); resize: vertical;
}
.input:focus { outline: none; border-color: var(--accent); }
.input--err, .input.err { border-color: var(--bad); }

/* ── THE SKELETON ── */
.sk, .skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--bg) 50%, var(--gray-100) 75%);
  background-size: 200% 100%; animation: sk-shimmer 1.4s infinite; border-radius: 8px;
}
@keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* toast: ONE implementation — .plt-toast in chassis/feedback.js (the second
   .toast that lived here retired in W2; showToast() in views/utils.js now
   delegates to feedback.toast()). */

/* ── shared PIN gate card ── */
.pin-card {
  max-width: 380px; margin: 12vh auto 0; text-align: center;
}
.pin-card .card-title { font-size: 1.1rem; }
.pin-card .input { text-align: center; letter-spacing: 8px; font-size: 22px; }

/* ── deck advance motion (120ms) ── */
@keyframes card-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
[dir="rtl"] .card--enter { animation: card-in-rtl var(--speed) ease-out; }
.card--enter { animation: card-in var(--speed) ease-out; }
@keyframes card-in-rtl { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card--enter { animation: none; } }

/* layout helpers */
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ch-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }

/* ---- data-plt-feedback ---- */
.plt-spinner { display: inline-block; width: 20px; height: 20px;
  border: 2.5px solid var(--gray-200); border-top-color: var(--accent);
  border-radius: 50%; animation: plt-spin .7s linear infinite; }
.plt-spinner--lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes plt-spin { to { transform: rotate(360deg); } }

.plt-toast { position: fixed; bottom: 18px; inset-inline-start: 50%;
  transform: translateX(-50%); max-width: min(92vw, 480px);
  background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: var(--r-btn); font-size: var(--t-body);
  box-shadow: var(--sh-pop); z-index: var(--z-toast);
  opacity: 0; transition: opacity var(--speed); }
[dir="rtl"] .plt-toast { transform: translateX(50%); }
.plt-toast.on { opacity: 1; }
.plt-toast--ok   { background: var(--ok); }
.plt-toast--warn { background: var(--warn); }
.plt-toast--bad  { background: var(--bad); }

.plt-ask-scrim { position: fixed; inset: 0; background: rgba(16,24,40,.45);
  z-index: var(--z-overlay); display: flex; align-items: center;
  justify-content: center; padding: 16px; }
.plt-ask { background: #fff; border-radius: var(--r-card); width: 100%;
  max-width: 420px; padding: 1.1rem; box-shadow: var(--sh-pop); }
.plt-ask h3 { margin: 0 0 .6rem; font-size: var(--t-title); color: var(--ink); }
.plt-ask p { margin: 0 0 .4rem; font-size: var(--t-body); color: var(--ink-2); line-height: 1.5; }
.plt-ask textarea, .plt-ask input { width: 100%; min-height: 3rem;
  font-size: 1rem; padding: .75rem 1rem; border-radius: .5rem;
  border: 1px solid var(--gray-300); background: var(--gray-50);
  box-sizing: border-box; font-family: inherit; }
.plt-ask-row { display: flex; gap: 8px; margin-top: .8rem; justify-content: flex-end; }

/* ---- data-rail-styles ---- */
/* ── the ONE tab geometry (S1) ── */
.tab-rail { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tab-rail::-webkit-scrollbar { display: none; }
.tab-rail--fill .tab-item { flex: 1 1 0; }   /* the form-tabs mode */
.tab-item { flex: 0 0 auto; min-height: 40px; padding: 8px 14px;
  border-radius: var(--r-btn, 10px); border: 1px solid var(--line, #e4e7ec);
  background: var(--surface, #fff); color: var(--ink, #101828);
  font-size: var(--t-body, 0.95rem); font-weight: 600; line-height: 1.2;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab-item.is-on { background: var(--accent, #101828);
  color: var(--accent-contrast, #fff); border-color: var(--accent, #101828); }
.tab-item:disabled, .tab-item.is-disabled { opacity: 0.45; cursor: default; }
.tab-badge { font-size: var(--t-micro, 0.72rem); font-weight: 700;
  padding: 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, currentColor 16%, transparent); }

/* ── the ONE state block (S2) ── */
/* BIDI: TEXT IS RESOLVED (§1). A state block carries a full SENTENCE (and
   often a raw server error) under the RTL root; isolate — the dir
   inheritance default — isolates the run without resolving its own base
   direction, so an English message's trailing neutral migrates to the RTL
   edge. plaintext resolves per run by first-strong-character, so an
   English and an Arabic message each read correctly in the same block. */
.state-block { text-align: center; padding: 34px 16px;
  color: var(--gray-600, #475467); font-size: var(--t-body, 0.95rem);
  unicode-bidi: plaintext; }
.state-block--error { color: var(--gray-700, #344054); }
.state-block .btn { margin-top: 12px; }
.state-block-spin { display: flex; justify-content: center; padding: 6px 0 10px; }
