/* ═══════════════════════════════════════════════════════════════════════════
   @emubrain-studio/auth-ui@0.1.0 — FLEET SHARED AUTH UI
   Design artifact. Presentation only. No auth behaviour is defined here.

   THE VARIATION BUDGET IS NOT MINE TO INVENT — it is already machine-enforced.
   emubrain-auth PR #26, src/fleet-ui-contract.ts, the `branding` block is
   z.object({...}).strict() with exactly six fields:

       logoPath  logoAlt  accentColor  accentForegroundColor  fontToken  theme

   .strict() means a seventh key is a parse error. So the design maps 1:1 onto
   those six and nothing else. Everything below the token line — field order,
   validation placement, focus order, error treatment, copy — is package-owned
   and identical for every product, because the proposal says products "may not
   fork a screen, override security copy, add providers".
   ═══════════════════════════════════════════════════════════════════════════ */

:root{
  /* ── package-owned neutrals. NOT product-variable. ── */
  --bg:#F7F8FA; --card:#FFFFFF; --sunk:#EFF1F5;
  --line:#DDE1E8; --line-2:#C6CCD6;
  --fg:#14171C; --fg-2:#454C58; --fg-3:#646C7A;
  --danger:#A8321E; --danger-bg:#FBEDEA;
  --ok:#1F6B45; --ok-bg:#E7F2EC;
  --warn-fg:#7A4E06; --warn-bg:#FDF2DF;
  --focus:#1B57C4;

  /* ── the six product-variable tokens. Defaults shown; a manifest overrides
        exactly these and nothing else. ── */
  --logo-alt-shown:"Product";
  --accent:#2F5DD8;
  --accent-fg:#FFFFFF;
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,sans-serif;

  --r:10px; --r-lg:16px;
  --t:140ms cubic-bezier(.2,.6,.35,1);
}

/* theme = "dark". Package-owned inversion — a product picks the theme, it does
   not pick the dark values, or dark mode would be 40 different products. */
.dark{
  --bg:#0E1116; --card:#161A21; --sunk:#1D222B;
  --line:#2A303B; --line-2:#3A424F;
  --fg:#EDEFF3; --fg-2:#B4BBC7; --fg-3:#8A93A2;
  --danger:#F0907C; --danger-bg:#2E1712;
  --ok:#79C79E; --ok-bg:#12241B;
  --warn-fg:#E7BE72; --warn-bg:#2B2113;
  --focus:#7FA6F5;
}
/* theme = "system" */
@media (prefers-color-scheme: dark){
  .system{
    --bg:#0E1116; --card:#161A21; --sunk:#1D222B;
    --line:#2A303B; --line-2:#3A424F;
    --fg:#EDEFF3; --fg-2:#B4BBC7; --fg-3:#8A93A2;
    --danger:#F0907C; --danger-bg:#2E1712;
    --ok:#79C79E; --ok-bg:#12241B;
    --warn-fg:#E7BE72; --warn-bg:#2B2113;
    --focus:#7FA6F5;
  }
}

/* the three demonstration brandings — six fields each, nothing more */
.b-greenpen  { --accent:#1F6B45; --accent-fg:#FFFFFF; --font:Georgia,"Times New Roman",serif; }
.b-keystack  { --accent:#2F5DD8; --accent-fg:#FFFFFF; --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,sans-serif; }
.b-conversite{ --accent:#B4471F; --accent-fg:#FFFFFF; --font:"Iowan Old Style",Palatino,Georgia,serif; }

*{box-sizing:border-box} html,body{margin:0}
body{background:var(--bg);color:var(--fg);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,sans-serif;
  -webkit-font-smoothing:antialiased;line-height:1.5}
a{color:inherit}

/* ══ THE AUTH CARD — one structure for every view, every product ══════════ */
.au{width:100%;max-width:400px;min-width:0;background:var(--card);border:1px solid var(--line);
  border-radius:var(--r-lg);padding:28px 28px 24px;font-family:var(--font)}
.au-logo{display:flex;align-items:center;gap:10px;margin-bottom:22px;min-width:0}
.au-logo .mark{width:28px;height:28px;border-radius:7px;background:var(--accent);flex:none}
/* long product names must truncate, never wrap the card or push the mark off */
.au-logo .nm{font-size:15px;font-weight:600;letter-spacing:-.01em;min-width:0;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.au h1{font-size:21px;letter-spacing:-.02em;margin:0 0 6px;font-weight:600;line-height:1.25}
.au .sub{font-size:13.5px;color:var(--fg-2);margin:0 0 20px;line-height:1.55}
.au .sub a{color:var(--accent);text-decoration:underline;text-underline-offset:2px}

/* fields — order and validation placement are package-owned and fixed */
.fld{margin-bottom:14px}
.fld label{display:block;font-size:12.5px;font-weight:600;color:var(--fg-2);margin-bottom:6px}
.fld .in{width:100%;height:42px;border:1px solid var(--line-2);border-radius:var(--r);
  background:var(--card);color:var(--fg);font:inherit;font-size:14.5px;padding:0 12px;
  display:flex;align-items:center}
.fld .in.ph{color:var(--fg-3)}
/* validation sits BELOW its field, always, on every product and every view */
.fld .err{display:flex;gap:7px;align-items:flex-start;font-size:12.5px;color:var(--danger);
  margin-top:6px;line-height:1.45}
.fld .err::before{content:"!";flex:none;width:15px;height:15px;border-radius:50%;
  background:var(--danger);color:var(--card);font-size:10px;font-weight:700;
  display:grid;place-items:center;margin-top:1px}
.fld.bad .in{border-color:var(--danger);border-width:1.5px}
.fld .hint{font-size:12px;color:var(--fg-3);margin-top:6px;line-height:1.45}
.fld .cap{display:flex;justify-content:space-between;align-items:baseline;gap:10px}
.fld .cap a{font-size:12px;color:var(--accent);text-decoration:none}

/* focus is package-owned: same ring, same offset, every product, both themes */
.focusring{outline:2px solid var(--focus);outline-offset:2px}

.btn{width:100%;height:44px;border-radius:var(--r);border:1px solid transparent;
  background:var(--accent);color:var(--accent-fg);font:inherit;font-size:14.5px;
  font-weight:600;cursor:pointer;display:grid;place-items:center;transition:filter var(--t)}
.btn:hover{filter:brightness(1.06)}
.btn.sec{background:transparent;color:var(--fg);border-color:var(--line-2)}
.btn[aria-disabled="true"]{opacity:.55;cursor:default}
.btn .spin{width:15px;height:15px;border-radius:50%;border:2px solid currentColor;
  border-top-color:transparent;animation:sp .7s linear infinite;margin-right:8px}
.btn .row{display:flex;align-items:center}
@keyframes sp{to{transform:rotate(360deg)}}

.au-foot{margin-top:18px;padding-top:16px;border-top:1px solid var(--line);
  font-size:12.5px;color:var(--fg-3);line-height:1.5;text-align:center}
.au-foot a{color:var(--accent);text-decoration:none}

/* shared status blocks — one treatment, reused for every non-field message */
.msg{display:flex;gap:10px;align-items:flex-start;border-radius:var(--r);
  padding:12px 13px;font-size:13px;line-height:1.5;margin-bottom:18px}
.msg .ic{flex:none;width:18px;height:18px;border-radius:50%;display:grid;place-items:center;
  font-size:11px;font-weight:700;margin-top:1px}
.msg.err{background:var(--danger-bg);color:var(--danger)}
.msg.err .ic{background:var(--danger);color:var(--card)}
.msg.ok{background:var(--ok-bg);color:var(--ok)}
.msg.ok .ic{background:var(--ok);color:var(--card)}
.msg.warn{background:var(--warn-bg);color:var(--warn-fg)}
.msg.warn .ic{background:var(--warn-fg);color:var(--card)}
.msg b{font-weight:600;display:block;margin-bottom:2px}

/* the standing icon used by verify/success/unavailable views */
.au-mark{width:46px;height:46px;border-radius:50%;display:grid;place-items:center;
  font-size:19px;margin:0 0 16px;background:var(--sunk);color:var(--fg-2)}
.au-mark.ok{background:var(--ok-bg);color:var(--ok)}
.au-mark.err{background:var(--danger-bg);color:var(--danger)}

/* skeleton loading — no spinner-on-empty-card; the shape is already known */
.sk{background:var(--sunk);border-radius:6px;height:12px;margin-bottom:9px}
.sk.t{height:20px;width:56%;margin-bottom:14px}
.sk.f{height:42px;border-radius:var(--r);margin-bottom:14px}
.sk.b{height:44px;border-radius:var(--r);background:var(--line)}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;
    transition-duration:.01ms !important}
  .btn .spin{animation:none;border-top-color:currentColor;opacity:.5}
}

/* ══ artifact chrome (this document, not the product) ═════════════════════ */
.wrap{max-width:1120px;margin:0 auto;padding:26px 26px 90px}
.hd{display:flex;align-items:baseline;gap:11px;flex-wrap:wrap;margin-bottom:6px}
.hd b{font-size:16px;letter-spacing:-.01em}
.hd .sp{flex:1}
.chip{font-size:10px;letter-spacing:.09em;text-transform:uppercase;color:var(--fg-2);
  border:1px solid var(--line);border-radius:999px;padding:5px 10px;background:var(--card)}
.chip.on{color:var(--accent);border-color:var(--accent)}
.chip.v{font-family:ui-monospace,Menlo,monospace;text-transform:none;letter-spacing:0}
.nav{display:flex;border:1px solid var(--line);border-radius:12px;overflow:hidden;
  background:var(--card);margin:16px 0 26px;flex-wrap:wrap}
.nav a{padding:11px 16px;font-size:13px;color:var(--fg-2);border-right:1px solid var(--line);
  flex:1;min-width:160px;text-decoration:none}
.nav a:last-child{border-right:0}
.nav a b{display:block;font-size:13.5px;color:var(--fg)}
.nav a span{display:block;font-size:11px;color:var(--fg-3);margin-top:2px}
.nav a:hover,.nav a.on{background:var(--sunk)}
.nav a.on b{color:var(--accent)}
h1.pg{font-size:28px;letter-spacing:-.025em;margin:12px 0 12px;font-weight:600;
  max-width:30ch;line-height:1.18}
.lede{font-size:14.5px;color:var(--fg-2);line-height:1.7;max-width:76ch;margin:0 0 12px}
.lede b{color:var(--fg);font-weight:600}
h2{font-size:17px;letter-spacing:-.015em;margin:38px 0 5px;font-weight:600}
h2 .q{font-family:ui-monospace,Menlo,monospace;font-size:11px;color:var(--accent);margin-right:9px}
.sub2{font-size:12.5px;color:var(--fg-3);margin:0 0 14px}
p.d{font-size:14px;color:var(--fg-2);line-height:1.7;max-width:78ch;margin:0 0 12px}
p.d b,li b,td b{color:var(--fg);font-weight:600}
ul.d{font-size:14px;color:var(--fg-2);line-height:1.7;max-width:78ch;margin:0 0 12px;padding-left:21px}
ul.d li{margin-bottom:6px}
code{font-family:ui-monospace,Menlo,monospace;font-size:12px;background:var(--sunk);
  border:1px solid var(--line);border-radius:5px;padding:1px 5px;color:var(--fg-2)}
.note{border-left:3px solid var(--accent);background:var(--card);border-radius:0 10px 10px 0;
  padding:13px 16px;margin:0 0 14px}
.note.warn{border-left-color:var(--warn-fg)}
.note.no{border-left-color:var(--danger)}
.note p{margin:0;max-width:none;font-size:13.5px;color:var(--fg-2);line-height:1.7}
.note b{color:var(--fg)}
table{width:100%;border-collapse:collapse;font-size:12.5px}
th{text-align:left;font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--fg-3);
  font-weight:600;padding:0 12px 9px 0;vertical-align:bottom}
td{border-top:1px solid var(--line);padding:10px 12px 10px 0;color:var(--fg-2);
  vertical-align:top;line-height:1.55}
td:last-child,th:last-child{padding-right:0}
.tw{overflow-x:auto;margin-bottom:14px}

/* state grid — every view at desktop and mobile */
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(330px,1fr));gap:20px;
  margin-bottom:26px}
.cell{min-width:0}
.cell .lab{font-size:10.5px;letter-spacing:.09em;text-transform:uppercase;color:var(--fg-3);
  margin:0 0 8px;font-weight:600}
.cell .lab i{font-style:normal;color:var(--accent)}
/* flex, not `display:grid;place-items:center`. A grid item under
   place-items:center sizes to CONTENT, so the card's width:100% never applied
   and it held 400px inside a 320px column — 46px of overflow at 390. Caught by
   the overflow assertion, not by looking. */
.stage{background:var(--bg);border:1px solid var(--line);border-radius:14px;
  padding:20px;display:flex;justify-content:center;align-items:flex-start}
.stage.mob{max-width:360px}
.stage.mob .au{max-width:100%;padding:22px 18px 20px;border:0;border-radius:12px}
.foot{margin-top:40px;padding-top:17px;border-top:1px solid var(--line);
  font-size:11.5px;color:var(--fg-3);line-height:1.7}
@media(max-width:700px){ .wrap{padding:20px 15px 70px} h1.pg{font-size:22px} }
