/* ============================================================================
   Neural ICE client portal design system (site-v17 skin)
   Premium sovereign SaaS. Dark, trustworthy, Swiss-precise.
   Vanilla CSS only (no build step). Fonts are self-hosted; icons are inline SVG.
   ========================================================================== */

@font-face {
  font-family: 'Inter var';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/inter-var-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-var-latin.woff2') format('woff2');
}

/* ---------------------------------------------------------------- Tokens -- */
/* Skin aligned to neural-ice.ch site-v17 (77db636): flat gold CTA, 8px buttons,
   18px cards/tables/fields, filet --line, no glow / glass / purple gradients. */
:root {
  /* Brand */
  --ice: #7DD4F0;
  --ice-soft: #A9E1F4;
  --ice-dim: #3A8BAF;
  --ice-deep: #1c4a5f;
  --ice-rgb: 125, 212, 240;
  /* Soft washes only (hero ambient). Never used as button/card box-shadow. */
  --ice-glow: rgba(125, 212, 240, .09);
  --ice-glow-soft: rgba(125, 212, 240, .06);

  /* Warm accent: private-banking gold, flat primary CTA */
  --gold: #CDB577;
  --gold-soft: #EADFB8;
  --gold-deep: #9C854E;
  --gold-rgb: 205, 181, 119;
  --gold-glow: transparent;

  /* Backgrounds: warmed charcoal (site-v17) */
  --bg: #0B0D12;
  --bg-2: #0f1219;
  --bg-rgb: 11, 13, 18;
  --surface: #141824;
  --surface-2: #1a1f2e;
  --surface-3: #202741;

  /* Lines (site --line / --line-2) */
  --line: #232838;
  --line-2: #313850;
  --border: var(--line);
  --border-soft: #1a2030;
  --border-strong: var(--line-2);

  /* Text */
  --white: #F1EFEA;
  --text: #F1EFEA;
  --muted: #9EA0AA;
  --grey-light: #9EA0AA;
  --grey: #6b6f7e;
  --faint: #7B7E94;

  /* Status */
  --ok: #7BD8A6;
  --ok-bg: rgba(123, 216, 166, .12);
  --warn: #F0C36B;
  --warn-bg: rgba(240, 195, 107, .12);
  --danger: #F08A8A;
  --danger-bg: rgba(240, 138, 138, .12);

  /* Legacy aliases */
  --black: #141824;

  /* Typography */
  --font-display: 'Inter var', Inter, system-ui, sans-serif;
  --font-body: 'Inter var', Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Inter var', Inter, system-ui, sans-serif;
  --body: 'Inter var', Inter, system-ui, -apple-system, sans-serif;
  --sans: 'Inter var', Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --fs-xs: .74rem;
  --fs-sm: .82rem;
  --fs-md: .9rem;
  --fs-base: .95rem;
  --fs-lg: 1.1rem;
  --fs-xl: 1.4rem;
  --fs-2xl: 1.9rem;
  --fs-3xl: 2.5rem;

  /* Spacing scale */
  --sp-1: .25rem;
  --sp-2: .5rem;
  --sp-3: .75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;

  /* Radius: buttons 8px; cards / images / tables / fields 18px (site-v17) */
  --r-btn: 8px;
  --r-card: 18px;
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 18px;
  --r-lg: 18px;
  --r-full: 999px;

  /* No diffuse shadows / glows on chrome */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --glow: none;

  --sidebar-w: 256px;
  --topbar-h: 66px;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ------------------------------------------------------------------ Base -- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  letter-spacing: -.01em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient background glow, applied to full-page (non-app) layouts */
body.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  background:
    radial-gradient(56% 44% at 68% 20%, rgba(var(--ice-rgb), .07), transparent 62%),
    radial-gradient(48% 52% at 20% 80%, rgba(var(--gold-rgb), .05), transparent 60%),
    var(--bg);
}

a { color: var(--ice); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: #a6e4f6; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; }

::selection { background: rgba(var(--gold-rgb), .28); color: #fff; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ice); outline-offset: 3px;
}


:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 3px;
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }

/* --------------------------------------------------------------- Wordmark -- */
.wordmark {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: .04em;
  color: var(--white);
  display: inline-flex;
  align-items: center;
  gap: .5ch;
}
.wordmark .ice, .ice { color: var(--ice); }

/* NI rail — the primary signature shared with neural-ice.ch. */
.brand-logo { height: 34px; width: auto; display: block; }
.sidebar .brand .brand-logo { height: 32px; }
.brand-panel .top .brand-logo { height: 52px; }

.logo-mark {
  width: 30px; height: 30px; flex: none;
}

/* --------------------------------------------------------------- Buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .72rem 1.3rem;
  padding-top: calc(.72rem + 1px);
  min-height: 44px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .9rem;
  line-height: 1;
  border-radius: var(--r-btn);
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
  color: var(--text);
  background: var(--surface-3);
  box-shadow: none;
}
.btn:active { transform: none; }
.btn svg { width: 17px; height: 17px; flex: none; }

/* Primary CTA: flat gold, same object as site .btn-gold */
.btn-primary {
  background: var(--gold);
  color: #1a160c;
  box-shadow: none;
  border-radius: var(--r-btn);
}
.btn-primary:hover { background: var(--gold-soft); box-shadow: none; transform: none; filter: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--ice); color: var(--text); background: rgba(var(--ice-rgb), .06); }

.btn-sm { padding: .42rem .9rem; padding-top: calc(.42rem + 1px); font-size: var(--fs-sm); min-height: 36px; border-radius: var(--r-btn); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Arrow on primary CTAs that opt in (site pattern: "… →") */
.btn-primary.btn-arrow::after { content: "→"; font-weight: 700; margin-left: .15rem; }

/* Bare form button: flat gold primary, not ice gradient */
main button:not(.btn):not(.ghost) {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .72rem 1.3rem; padding-top: calc(.72rem + 1px); min-height: 44px;
  border: none; border-radius: var(--r-btn); line-height: 1; box-sizing: border-box;
  font-family: var(--font-display); font-weight: 600; font-size: .9rem; cursor: pointer;
  background: var(--gold); color: #1a160c; box-shadow: none;
  transition: background .2s var(--ease);
}
main button:not(.btn):not(.ghost):hover { background: var(--gold-soft); filter: none; }
main button:active { transform: none; }
button.ghost {
  background: transparent; border: 1px solid var(--line-2); color: var(--text);
  padding: .72rem 1.3rem; padding-top: calc(.72rem + 1px); min-height: 44px;
  border-radius: var(--r-btn); line-height: 1; box-sizing: border-box;
  font-family: var(--font-display); font-weight: 600; font-size: .9rem; cursor: pointer;
}
button.ghost:hover { border-color: var(--ice); color: var(--text); background: rgba(var(--ice-rgb), .06); }

/* ---------------------------------------------------------------- Badges -- */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .26rem .6rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: .01em;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active   { color: var(--ok);     background: var(--ok-bg);     border-color: rgba(110, 231, 168, .25); }
.badge-suspended,
.badge-expired,
.badge-offline  { color: var(--danger); background: var(--danger-bg); border-color: rgba(240, 138, 138, .25); }
.badge-online   { color: var(--ok);     background: var(--ok-bg);     border-color: rgba(110, 231, 168, .25); }
.badge-warn,
.badge-pending  { color: var(--warn);   background: var(--warn-bg);   border-color: rgba(240, 195, 107, .25); }
.badge-neutral  { color: var(--muted);  background: rgba(138, 155, 176, .1); border-color: var(--border); }

/* Legacy status text spans still used in some copy */
.status-active { color: var(--ok); }
.status-suspended, .status-expired { color: var(--danger); }

/* ----------------------------------------------------------------- Cards -- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  box-shadow: none;
}
.card + .card { margin-top: var(--sp-4); }
.card h2 { font-size: var(--fs-lg); color: var(--white); font-weight: 700; margin-bottom: var(--sp-3); }
.card h2 .ice { color: var(--ice); }

/* No glassmorphism: same skin as .card */
.card-glass {
  background: var(--surface);
  backdrop-filter: none;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: none;
}

/* ---------------------------------------------------------------- Fields -- */
.field { margin-bottom: var(--sp-4); }
label {
  display: block; font-size: var(--fs-sm); font-weight: 500;
  color: var(--muted); margin-bottom: var(--sp-2); letter-spacing: .01em;
}
input[type=email], input[type=text], input[type=password],
input[type=tel], input[type=number], input:not([type]),
select, textarea {
  width: 100%;
  padding: .8rem .95rem;
  border-radius: var(--r-card);
  border: 1px solid var(--line-2);
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.4;
  transition: border-color .18s var(--ease), background .18s var(--ease);
  box-shadow: none;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=password] { letter-spacing: .12em; }
input[type=password]::placeholder { letter-spacing: normal; }
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--ice-dim); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ice);
  background: var(--bg);
  box-shadow: none;
}
/* Keep browser autofill on-theme (Chrome/Safari force a white box otherwise). */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--white);
  caret-color: var(--white);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  box-shadow: 0 0 0 1000px var(--bg) inset;
  transition: background-color 9999s ease-in-out 0s;
}
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  box-shadow: 0 0 0 1000px var(--bg) inset;
}
.code-in { letter-spacing: .35em; text-align: center; font-family: var(--mono); font-size: 1.15rem; }

/* Password field with a reveal (eye) toggle — single-field, password-manager friendly */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.8rem; }
.pw-toggle {
  position: absolute; top: 0; right: 0; height: 100%; width: 2.6rem;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; cursor: pointer; color: var(--faint);
  transition: color .15s var(--ease);
}
.pw-toggle:hover { color: var(--ice); }
.pw-toggle:focus-visible { outline: none; color: var(--ice); }
.pw-toggle svg { width: 18px; height: 18px; }

/* Serial / key display */
.key {
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px dashed var(--ice-dim);
  border-radius: var(--r-sm);
  padding: .85rem 1rem;
  word-break: break-all;
  font-size: var(--fs-md);
  color: var(--ice);
  line-height: 1.5;
}

/* Copyable serial row */
.serial {
  display: flex; align-items: center; gap: var(--sp-2);
  font-family: var(--mono); font-size: var(--fs-md); color: var(--ice);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: .6rem .5rem .6rem .85rem;
  word-break: break-all;
}
.serial .serial-val { flex: 1; }
.copy-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r-xs);
  background: transparent; border: 1px solid var(--border-strong); color: var(--muted);
  cursor: pointer; transition: all .15s var(--ease);
}
.copy-btn:hover { color: var(--ice); border-color: var(--ice-dim); background: var(--ice-glow-soft); }
.copy-btn svg { width: 15px; height: 15px; }

.msg { margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--ice); min-height: 1.2em; }
.msg.err { color: var(--danger); }
.muted { color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.mono { font-family: var(--mono); }

/* ----------------------------------------------------------------- Stats -- */
.stat-grid {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: var(--sp-5);
}
.stat {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: none;
}
.stat::after { content: none; }
.stat-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--r-sm);
  background: var(--ice-glow-soft); color: var(--ice); margin-bottom: var(--sp-3);
  border: 1px solid var(--border);
}
.stat-ico svg { width: 19px; height: 19px; }
.stat-value { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-2xl); color: var(--white); line-height: 1.1; }
.stat-label { font-size: var(--fs-sm); color: var(--muted); margin-top: var(--sp-1); }

/* ------------------------------------------------------------- App shell -- */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  padding: var(--sp-5) var(--sp-4);
  z-index: 40;
}
.sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: 0 .3rem var(--sp-5); }
.sidebar .brand .wordmark { font-size: 1.05rem; }
.sidebar-context {
  margin: calc(-1 * var(--sp-3)) .45rem var(--sp-5);
  color: var(--gold); font-family: var(--mono); font-size: .64rem;
  letter-spacing: .14em; text-transform: uppercase;
}

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .7rem;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: var(--fs-md); font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: color .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active {
  color: var(--ice); background: var(--ice-glow-soft);
  border-color: var(--border); font-weight: 600;
}
.nav-item.active svg { filter: none; }
.nav-sep { height: 1px; background: var(--border); margin: var(--sp-3) .3rem; }
.nav-signout { color: var(--muted); }
.nav-signout:hover { color: var(--danger); background: var(--danger-bg); }
.sidebar-foot { padding: var(--sp-4) .5rem 0; font-size: var(--fs-xs); color: var(--faint); line-height: 1.5; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-6);
  background: rgba(var(--bg-rgb), .92);
  backdrop-filter: none;
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: var(--fs-lg); font-weight: 700; color: var(--white); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-4); }
.user-chip {
  display: flex; align-items: center; gap: .55rem;
  font-size: var(--fs-sm); color: var(--muted);
  padding: .35rem .35rem .35rem .8rem; border-radius: var(--r-btn);
  border: 1px solid var(--line);
}
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ice-deep);
  color: var(--ice); font-family: var(--font-display); font-weight: 700; font-size: .8rem;
}

.content { padding: var(--sp-6); max-width: 1080px; width: 100%; margin: 0 auto; }
.panel { animation: fade-up .35s var(--ease) both; }
.panel[hidden] { display: none; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-head { margin-bottom: var(--sp-5); }
.section-head h2 { font-size: var(--fs-xl); color: var(--white); }
.section-head p { color: var(--muted); font-size: var(--fs-md); margin-top: var(--sp-2); max-width: 62ch; }
.greeting { font-size: var(--fs-2xl); font-weight: 800; color: var(--white); letter-spacing: -.02em; }
.greeting .ice { color: var(--ice); }

/* Mobile sidebar controls */
.menu-btn, .scrim { display: none; }

/* ------------------------------------------------------- Licence / rows -- */
.lic { }
.lic-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.lic-head .title { font-size: var(--fs-lg); font-weight: 700; color: var(--white); text-transform: capitalize; }
.lic-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin: var(--sp-3) 0 var(--sp-4); }
.lic-meta .item { font-size: var(--fs-sm); }
.lic-meta .item .k { color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-size: var(--fs-xs); display: block; margin-bottom: 2px; }
.lic-meta .item .v { color: var(--text); font-weight: 500; }

.slot {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0; border-top: 1px solid var(--border-soft);
  font-size: var(--fs-sm);
}
.slot .slot-ico {
  width: 34px; height: 34px; flex: none; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.slot .slot-ico svg { width: 17px; height: 17px; }
.slot .slot-body { min-width: 0; flex: 1; }
.slot .slot-name { color: var(--white); font-weight: 600; }
.slot .slot-sub { color: var(--faint); font-size: var(--fs-xs); font-family: var(--mono); margin-top: 2px; word-break: break-all; }
.slot .slot-act { margin-left: auto; }

/* Installer / download rows */
.row-list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) 0; border-top: 1px solid var(--border-soft);
}
.list-row:first-child { border-top: none; }
.list-row .l-ico {
  width: 42px; height: 42px; flex: none; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ice-glow-soft); border: 1px solid var(--border); color: var(--ice);
}
.list-row .l-ico svg { width: 20px; height: 20px; }
.list-row .l-body { min-width: 0; flex: 1; }
.list-row .l-title { color: var(--white); font-weight: 600; font-size: var(--fs-md); }
.list-row .l-sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.list-row .l-act { margin-left: auto; }

/* Quick actions */
.actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

/* --------------------------------------------------------- Empty states -- */
.empty {
  text-align: center; padding: var(--sp-7) var(--sp-5);
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--surface);
}
.empty .e-ico {
  width: 56px; height: 56px; margin: 0 auto var(--sp-4);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); background: var(--ice-glow-soft); color: var(--ice);
  border: 1px solid var(--border);
}
.empty .e-ico svg { width: 26px; height: 26px; }
.empty h3 { font-size: var(--fs-lg); color: var(--white); margin-bottom: var(--sp-2); }
.empty p { color: var(--muted); font-size: var(--fs-md); max-width: 46ch; margin: 0 auto var(--sp-5); }

.hint {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  border: 1px solid var(--border); border-left: 3px solid var(--ice-dim);
  border-radius: var(--r-sm); padding: var(--sp-3) var(--sp-4);
  background: var(--ice-glow-soft); color: var(--muted); font-size: var(--fs-sm); line-height: 1.6;
  margin-top: var(--sp-4);
}
.hint svg { width: 18px; height: 18px; flex: none; color: var(--ice); margin-top: 2px; }
.hint strong { color: var(--text); }

.warn-box {
  border: 1px solid rgba(240, 138, 138, .3); border-radius: var(--r-sm);
  background: var(--danger-bg); padding: var(--sp-4);
  color: #f3c6c6; font-size: var(--fs-sm); line-height: 1.6;
}
.warn-box strong { color: #ffdede; }

/* ---------------------------------------------------------------- Toasts -- */
.toast-wrap {
  position: fixed; bottom: var(--sp-5); right: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-2);
  z-index: 200; max-width: min(360px, 90vw);
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--surface-3); border: 1px solid var(--line-2);
  border-radius: var(--r-btn); padding: .75rem 1rem;
  box-shadow: none; color: var(--text); font-size: var(--fs-sm);
  animation: toast-in .28s var(--ease) both;
}
.toast.out { animation: toast-out .25s var(--ease) forwards; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.ok svg { color: var(--ok); }
.toast.err svg { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* --------------------------------------------------------- Auth split -- */
.split {
  width: 100%; min-height: 100vh;
  display: grid; grid-template-columns: 1.05fr .95fr;
}
.brand-panel {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--sp-8) var(--sp-7);
  background:
    radial-gradient(56% 44% at 68% 30%, rgba(var(--ice-rgb), .09), transparent 62%),
    radial-gradient(48% 52% at 28% 72%, rgba(var(--gold-rgb), .07), transparent 60%),
    var(--bg);
  border-right: 1px solid var(--line);
}
.brand-panel::before {
  /* The flake/brain remains a secondary inference motif, never the logo. */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .055;
  background: url('/activity-motif-v1.svg') no-repeat 86% 22% / min(62%, 520px) auto;
}
.brand-panel > * { position: relative; z-index: 1; }
.brand-panel .top { display: flex; align-items: center; gap: .6rem; }
.brand-hero { max-width: 37rem; }
.brand-hero .eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); margin-bottom: var(--sp-4);
}
.brand-hero .eyebrow::before { content: ''; width: 22px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.brand-hero h1 { font-size: clamp(2.25rem, 4.25vw, 4rem); line-height: 1.02; color: var(--white); font-weight: 780; letter-spacing: -.055em; }
.brand-hero h1 .ice { color: var(--ice); }
.brand-hero p { color: var(--muted); font-size: var(--fs-lg); line-height: 1.65; margin-top: var(--sp-5); max-width: 46ch; }
.brand-feats { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-6); }
.brand-feat { display: flex; align-items: center; gap: .7rem; color: var(--grey-light); font-size: var(--fs-md); }
.brand-feat svg { width: 18px; height: 18px; color: var(--ice); flex: none; }
.brand-foot { color: var(--faint); font-family: var(--mono); font-size: .67rem; letter-spacing: .04em; }

.auth-panel {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-6);
  background: var(--bg);
}
.auth-card { width: min(400px, 100%); }
.auth-mobile-brand { display: none; }
.auth-kicker {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--gold); font-family: var(--mono); font-size: .68rem;
  letter-spacing: .14em; text-transform: uppercase; margin: var(--sp-2) 0 var(--sp-2);
}
.auth-kicker::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.auth-heading { font-size: var(--fs-2xl); color: var(--white); margin-bottom: var(--sp-4); letter-spacing: -.03em; }
.auth-card .eyebrow { font-size: var(--fs-sm); color: var(--muted); }
.auth-card h2 { font-size: var(--fs-2xl); color: var(--white); margin: var(--sp-2) 0 var(--sp-2); }
.auth-card > p { color: var(--muted); font-size: var(--fs-md); line-height: 1.6; margin-bottom: var(--sp-5); }

/* Subtle staggered entrance — each direct child of the auth card fades up in turn. */
.auth-card > * { animation: auth-in .5s var(--ease) both; }
.auth-card > .auth-top { animation-delay: .02s; }
.auth-card > .seg      { animation-delay: .06s; }
.auth-card > p         { animation-delay: .10s; }
.auth-card > form      { animation-delay: .14s; }
.auth-card > .auth-toggles { animation-delay: .20s; }
.auth-card > .auth-alt { animation-delay: .24s; }
@keyframes auth-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Brand side drifts in from the left, hero content settles after it. */
.brand-panel { animation: brand-in .6s var(--ease) both; }
.brand-panel .top   { animation: auth-in .6s var(--ease) .05s both; }
.brand-hero         { animation: auth-in .7s var(--ease) .12s both; }
.brand-foot         { animation: auth-in .7s var(--ease) .30s both; }
@keyframes brand-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.auth-alt { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--muted); line-height: 1.6; }
.devlink {
  margin-top: var(--sp-3); font-family: var(--mono); font-size: var(--fs-xs);
  word-break: break-all; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: .6rem .7rem; display: none;
}
.devlink.show { display: block; }
.devlink a { color: var(--ice); }

/* Caps-lock hint + password strength (register) */
.pw-hint { display: none; align-items: center; gap: .4rem; font-size: var(--fs-xs); color: var(--warn); margin-top: .4rem; }
.pw-hint.show { display: inline-flex; }
.pw-hint svg { width: 13px; height: 13px; flex: none; }
.pw-meter { display: none; height: 3px; border-radius: 2px; background: var(--surface-3); margin-top: .55rem; overflow: hidden; }
.pw-meter.show { display: block; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: 2px; transition: width .3s var(--ease), background .3s var(--ease); }
.pw-meter-label { display: none; font-size: var(--fs-xs); color: var(--faint); margin-top: .3rem; }
.pw-meter-label.show { display: block; }

/* Auth header row: back-link + language switcher */
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }

/* Language switcher (globe + native-name select) */
.lang-switch { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); }
.lang-globe { width: 15px; height: 15px; flex: none; }
.lang-select {
  appearance: none; -webkit-appearance: none;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  font-family: var(--font-body); font-size: var(--fs-sm); font-weight: 500;
  padding: .25rem 1.4rem .25rem .4rem; border-radius: var(--r-sm); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238FA3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .35rem center;
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.lang-select:hover { color: var(--text); border-color: var(--border-strong); background-color: var(--surface-2); }
.lang-select:focus { outline: none; color: var(--text); border-color: var(--ice-dim); }
.lang-select option { background: var(--surface-2); color: var(--text); }
/* Switcher pinned top-right on the centered page-style layouts */
.page-lang { position: absolute; top: var(--sp-5); right: var(--sp-5); }

/* Segmented login / register control */
.seg {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r-card); padding: 4px; margin: var(--sp-2) 0 var(--sp-4);
}
.seg-btn {
  position: relative; z-index: 1; appearance: none; background: transparent; border: 0;
  font-family: var(--font-body); font-size: var(--fs-md); font-weight: 600; cursor: pointer;
  color: var(--muted); padding: .55rem .5rem; border-radius: calc(var(--r-card) - 4px);
  transition: color .2s var(--ease);
}
.seg-btn.active { color: var(--white); }
.seg-btn:hover:not(.active) { color: var(--grey-light); }
.seg-thumb {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  background: var(--surface-3);
  border: 1px solid var(--line-2); border-radius: calc(var(--r-card) - 4px);
  box-shadow: none;
  transition: transform .28s var(--ease);
}
.seg-thumb.right { transform: translateX(100%); }
.auth-card > .seg { animation-delay: .04s; }

/* ------------------------------------------------------------ Centered -- */
.shell { width: min(560px, 92vw); margin: var(--sp-7) auto var(--sp-8); flex: 1; }
.shell.narrow { width: min(460px, 92vw); }
.page-head { position: relative; text-align: center; padding: var(--sp-7) var(--sp-4) 0; }
.page-head .brand-line { display: inline-flex; align-items: center; gap: .55rem; margin-bottom: var(--sp-4); }
.page-head h1 { font-size: var(--fs-xl); color: var(--white); }
.page-head .sub { color: var(--muted); font-size: var(--fs-md); margin-top: var(--sp-2); }
.back-link { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--fs-sm); color: var(--muted); }
.back-link:hover { color: var(--ice); }
.back-link svg { width: 15px; height: 15px; }

/* --------------------------------------------------------------- Stepper -- */
.stepper { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.step-pill { display: flex; align-items: center; gap: .55rem; font-size: var(--fs-sm); color: var(--faint); }
.step-pill .n {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); font-size: var(--fs-sm); font-weight: 700;
  background: var(--surface-2); transition: all .2s var(--ease);
}
.step-pill.on { color: var(--ice); }
.step-pill.on .n { background: var(--ice); color: #04212e; border-color: var(--ice); box-shadow: none; }
.step-pill.done .n { background: var(--ok-bg); color: var(--ok); border-color: rgba(110, 231, 168, .4); }
.step-line { flex: 1; height: 1px; background: var(--border); }

.recommend {
  display: flex; gap: .7rem; align-items: flex-start;
  border: 1px solid var(--ice-dim); border-radius: var(--r-sm);
  padding: .8rem 1rem; margin: var(--sp-2) 0 var(--sp-4);
  color: var(--ice); font-size: var(--fs-sm); line-height: 1.55; background: var(--ice-glow-soft);
}
.recommend svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.recommend strong { color: #cdeefb; }

/* QR frame */
#qr {
  background: #fff; padding: 14px; border-radius: var(--r-md);
  width: max-content; margin: var(--sp-4) auto;
  box-shadow: none;
}
#qr svg { display: block; width: 190px; height: 190px; }

.row { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }
.hidden { display: none !important; }

.disclaimer {
  border: 1px solid rgba(240, 138, 138, .35); border-radius: var(--r-sm);
  padding: var(--sp-4); margin-top: var(--sp-4);
  background: var(--danger-bg); color: #f3c8c8; font-size: var(--fs-sm); line-height: 1.6; display: none;
}
.disclaimer strong { color: #ffdede; }

/* Success celebratory flourish */
.celebrate .badge-hero {
  width: 66px; height: 66px; margin: 0 auto var(--sp-4);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--ok-bg); color: var(--ok);
  border: 1px solid rgba(123, 216, 166, .35); box-shadow: none;
  animation: pop .4s var(--ease) both;
}
.celebrate .badge-hero svg { width: 32px; height: 32px; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* ---------------------------------------------------------- Public shell -- */
/* Used by docs.html / faq.html — brand topbar + centered content column */
.public-nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-5);
  width: min(100%, 884px);
  padding: var(--sp-4) var(--sp-6);
  background: rgba(var(--bg-rgb), .92);
  backdrop-filter: none;
  border-bottom: 1px solid var(--line);
}
.public-nav .brand { display: flex; align-items: center; gap: .55rem; }
.public-nav .brand picture { display: flex; align-items: center; }
.public-nav .links { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }
.public-nav .links a {
  font-size: var(--fs-sm); color: var(--muted); padding: .4rem .8rem; border-radius: var(--r-full);
  transition: all .15s var(--ease);
}
.public-nav .links a:hover { color: var(--text); background: var(--surface); }
.public-nav .links a.on { color: var(--ice); background: var(--ice-glow-soft); }

.doc-wrap { width: min(820px, 92vw); margin: var(--sp-6) auto var(--sp-8); }
.lead { color: var(--muted); font-size: var(--fs-lg); line-height: 1.6; margin-bottom: var(--sp-6); max-width: 66ch; }

.toc { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-6); }
.toc a {
  font-size: var(--fs-sm); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--r-full); padding: .4rem 1rem;
}
.toc a:hover { color: var(--ice); border-color: var(--ice-dim); background: var(--ice-glow-soft); }

.doc-card { margin-bottom: var(--sp-5); scroll-margin-top: 90px; }
.doc-card p { color: var(--grey-light); font-size: var(--fs-md); line-height: 1.7; margin-top: var(--sp-3); }
.doc-card p:first-of-type { margin-top: 0; }
.doc-card ol, .doc-card ul { color: var(--grey-light); font-size: var(--fs-md); line-height: 1.7; margin: var(--sp-3) 0 0 1.2rem; }
.doc-card li { margin-top: var(--sp-2); }
.doc-card strong { color: var(--white); }
code, .inline-key {
  font-family: var(--mono); color: var(--ice); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--r-xs);
  padding: .08em .45em; font-size: .85em;
}
.deep { display: inline-block; margin-top: var(--sp-4); font-size: var(--fs-sm); color: var(--ice-dim); }
.deep:hover { color: var(--ice); }
.note {
  border: 1px solid var(--border); border-left: 3px solid var(--ice-dim);
  border-radius: var(--r-sm); padding: var(--sp-3) var(--sp-4); margin-top: var(--sp-4);
  color: var(--grey-light); font-size: var(--fs-sm); line-height: 1.6; background: var(--ice-glow-soft);
}
.note strong { color: var(--white); }

/* FAQ accordion */
.faq { margin-bottom: var(--sp-3); }
.faq summary {
  cursor: pointer; list-style: none;
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); color: var(--white);
  padding: 1.05rem 1.3rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.faq summary:hover { border-color: var(--border-strong); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--ice); font-weight: 400; font-size: 1.3rem; line-height: 1; transition: transform .2s var(--ease); }
.faq[open] summary { border-radius: var(--r-md) var(--r-md) 0 0; border-color: var(--border-strong); background: var(--surface-2); }
.faq[open] summary::after { content: '–'; }
.faq .body {
  background: var(--surface); border: 1px solid var(--border-strong); border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md); padding: 0 1.3rem 1.2rem;
}
.faq .body p { color: var(--grey-light); font-size: var(--fs-md); line-height: 1.7; margin-top: var(--sp-3); }
.faq .body ul { color: var(--grey-light); font-size: var(--fs-md); line-height: 1.7; margin: var(--sp-2) 0 0 1.1rem; }
.faq .body li { margin-top: var(--sp-1); }
.faq .body strong { color: var(--white); }

/* ------------------------------------------------------------- Skeleton -- */
.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-line { height: 14px; margin: .5rem 0; }

/* -------------------------------------------------------------- Footer -- */
.page-foot { padding: var(--sp-6) var(--sp-4); color: var(--faint); font-size: var(--fs-xs); text-align: center; }
.dot-sep { color: var(--border-strong); margin: 0 .5rem; }

/* --------------------------------------------------------- Responsive -- */
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .auth-panel { min-height: 100vh; padding-top: 7.5rem; }
  .auth-mobile-brand {
    position: absolute; top: var(--sp-5); left: var(--sp-5); right: var(--sp-5);
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  }
  .auth-mobile-brand img { height: 34px; width: auto; max-width: 62vw; }
  .auth-mobile-brand span { color: var(--faint); font-family: var(--mono); font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }

  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; width: min(280px, 84vw); height: 100vh;
    transform: translateX(-102%); transition: transform .28s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 35;
    background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
  }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--r-sm);
    background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer;
  }
  .menu-btn svg { width: 20px; height: 20px; }
  .topbar { padding: 0 var(--sp-4); }
  .content { padding: var(--sp-5) var(--sp-4); }
  .user-chip .email-text { display: none; }
}

@media (max-width: 560px) {
  .greeting { font-size: var(--fs-xl); }
  .stat-value { font-size: var(--fs-xl); }
  .public-nav { padding: var(--sp-3) var(--sp-4); gap: var(--sp-3); }
  .public-nav .brand-logo { width: 34px; height: 34px; }
  .public-nav .links a { padding: .35rem .6rem; }
  .lic-head .badge { align-self: flex-start; }
  .auth-panel { align-items: flex-start; padding: 6.8rem var(--sp-5) var(--sp-6); }
  .auth-mobile-brand { left: var(--sp-5); right: var(--sp-5); }
  .auth-mobile-brand span { display: none; }
  .auth-heading { font-size: var(--fs-xl); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* sign-in mode toggles (login / register / magic-link) */
.auth-toggles{display:flex;align-items:center;gap:.6rem;margin-top:1rem;font-size:.85rem;flex-wrap:wrap}
.auth-toggles a{color:var(--ice);text-decoration:none}
.auth-toggles a:hover{text-decoration:underline}
.auth-toggles .sep{color:var(--faint)}

.invite-banner{font-size:.82rem;color:var(--muted);background:rgba(125,142,163,.08);border:1px solid var(--line,#1d2836);border-radius:8px;padding:.5rem .7rem;margin:.2rem 0 .6rem}


/* --------------------------------------------------------------- Tables -- */
/* Sheet language from site-v17: filet, 18px, full width, no horizontal scroll on desktop */
.table-wrap, .data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}
@media (min-width: 900px) {
  .table-wrap, .data-table-wrap { overflow-x: visible; }
}
table.data, table.cmp, .data-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .86rem;
}
table.data th, table.data td,
table.cmp th, table.cmp td,
.data-table th, .data-table td {
  text-align: left;
  padding: .85rem .7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  word-break: break-word;
}
table.data thead th, table.cmp thead th, .data-table thead th {
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: -.01em;
  text-transform: none;
  color: var(--muted);
  font-weight: 600;
  background: var(--bg-2);
}
table.data thead th:first-child, table.cmp thead th:first-child { border-radius: 17px 0 0 0; }
table.data thead th:last-child, table.cmp thead th:last-child { border-radius: 0 17px 0 0; }
table.data tbody tr:last-child td, table.cmp tbody tr:last-child td,
table.data tbody tr:last-child th, table.cmp tbody tr:last-child th { border-bottom: 0; }
table.data tbody tr:hover, table.cmp tbody tr:hover { background: rgba(255, 255, 255, .02); }
