/* ==========================================================================
   NoGate — Design System
   --------------------------------------------------------------------------
   Dark-first, boutique fintech aesthetic. One decorative accent (aurum gold),
   semantic status colors, a single corner-radius scale, tinted shadows, and a
   restrained grain texture. No AI-slop: no purple glow, no Inter default, no
   generic identical card grid.
   Type system: Space Grotesk (UI/display) + JetBrains Mono (numeric/labels).
   ========================================================================== */

/* ---- Fonts (self-hosted, variable) -------------------------------------- */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/public/fonts/space-grotesk-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/public/fonts/jetbrains-mono-latin.woff2") format("woff2");
}

/* ---- Tokens ------------------------------------------------------------- */
:root {
  /* surfaces — deep charcoal with a faint cool cast, never pure #000 */
  --bg:        #0a0b0f;
  --bg-1:      #0f1117;
  --bg-2:      #14161f;
  --bg-3:      #1a1d28;
  --bg-inset:  #0c0d12;

  /* hairlines */
  --line:      rgba(255, 255, 255, 0.07);
  --line-2:    rgba(255, 255, 255, 0.12);
  --line-3:    rgba(255, 255, 255, 0.20);

  /* text */
  --text:      #eef0f4;
  --text-1:    #bcc0cc;
  --text-2:    #848b9c;
  --text-3:    #5a6072;

  /* brand — aurum gold (the only decorative accent) */
  --accent:      #e5a03a;
  --accent-hi:   #f4b654;
  --accent-lo:   #c9852a;
  --accent-dim:  rgba(229, 160, 58, 0.13);
  --accent-line: rgba(229, 160, 58, 0.34);
  --on-accent:   #1a1206;

  /* semantic status */
  --ok:      #3fbf8e;
  --ok-dim:  rgba(63, 191, 142, 0.13);
  --info:    #5a9cf8;
  --info-dim:rgba(90, 156, 248, 0.13);
  --warn:    #e0a83e;
  --warn-dim:rgba(224, 168, 62, 0.13);
  --danger:  #e5646e;
  --danger-dim: rgba(229, 100, 110, 0.13);
  --muted:   #7d8494;
  --muted-dim: rgba(125, 132, 148, 0.13);

  /* radii — single documented scale
     badges/chips: r1 · inputs+buttons: r2 · cards+panels: r3 · pills: r-pill */
  --r1: 7px;
  --r2: 10px;
  --r3: 15px;
  --r-pill: 999px;

  /* elevation — shadows tinted toward the background hue, never pure black */
  --shadow-1: 0 1px 2px rgba(4, 5, 8, 0.5);
  --shadow-2: 0 8px 24px -8px rgba(4, 5, 8, 0.7);
  --shadow-3: 0 24px 60px -16px rgba(3, 4, 7, 0.82);

  /* type */
  --font-ui: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* metrics */
  --sidebar-w: 256px;
  --topbar-h: 64px;
  --content-max: 1240px;

  --focus: 0 0 0 3px var(--accent-dim), 0 0 0 1px var(--accent-line);
}

/* ---- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  /* restrained grain: a faint radial vignette + noise via layered gradients */
  background-image:
    radial-gradient(1200px 800px at 82% -8%, rgba(229, 160, 58, 0.05), transparent 60%),
    radial-gradient(900px 700px at -6% 108%, rgba(90, 156, 248, 0.045), transparent 55%);
  background-attachment: fixed;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r2); }
::selection { background: var(--accent-dim); color: var(--text); }

/* faint film grain overlay — very low opacity so it reads as texture, not noise */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Scrollbars --------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: var(--r-pill); border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: padding-box; }

/* ---- Typographic helpers ------------------------------------------------ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-2);
}
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.tnum { font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.h-display { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 2.9rem); letter-spacing: -0.035em; }
.text-2 { color: var(--text-2); }
.text-1 { color: var(--text-1); }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: linear-gradient(180deg, var(--bg-1), var(--bg));
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 6px;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: radial-gradient(120% 120% at 30% 20%, var(--accent-hi), var(--accent-lo));
  color: var(--on-accent);
  box-shadow: 0 6px 18px -6px rgba(229, 160, 58, 0.55), inset 0 1px 0 rgba(255,255,255,0.35);
  flex: none;
}
.brand__name { font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.brand__name b { color: var(--accent); font-weight: 600; }
.brand__env {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em;
  color: var(--text-3); text-transform: uppercase; margin-top: 1px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__label { padding: 16px 10px 6px; }
.nav__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r2);
  color: var(--text-2); font-weight: 500; font-size: 14px;
  cursor: pointer; position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav__item svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav__item:hover { background: var(--bg-2); color: var(--text-1); }
.nav__item.is-active { background: var(--bg-2); color: var(--text); }
.nav__item.is-active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav__item.is-active svg { opacity: 1; color: var(--accent); }
.nav__badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  background: var(--bg-3); color: var(--text-1); padding: 1px 7px; border-radius: var(--r-pill);
  border: 1px solid var(--line);
}
.sidebar__foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }

.mode-chip {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 10px 11px; border-radius: var(--r2);
  background: var(--bg-2); border: 1px solid var(--line);
  cursor: pointer; text-align: left;
  transition: border-color 0.15s ease;
}
.mode-chip:hover { border-color: var(--line-2); }
.mode-chip__dot { width: 8px; height: 8px; border-radius: var(--r-pill); flex: none; background: var(--muted); }
.mode-chip__dot.is-on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-dim); }
.mode-chip__dot.is-off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-dim); }
.mode-chip__meta { min-width: 0; }
.mode-chip__title { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-chip__sub { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; }

/* ---- Main column -------------------------------------------------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 clamp(16px, 3vw, 34px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar__title { display: flex; flex-direction: column; }
.topbar__title h1 { font-size: 18px; }
.topbar__crumb { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.topbar__spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r2);
  display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-1);
  cursor: pointer; transition: border-color 0.15s, color 0.15s, transform 0.08s;
}
.icon-btn:hover { border-color: var(--line-2); color: var(--text); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 18px; height: 18px; }

.menu-toggle { display: none; }

.content {
  padding: clamp(20px, 3vw, 34px);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  flex: 1;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head__intro { max-width: 60ch; }
.page-head h2 { font-size: clamp(1.4rem, 1rem + 1.3vw, 1.9rem); }
.page-head p { color: var(--text-2); margin-top: 6px; font-size: 14px; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 15px; height: 40px; border-radius: var(--r2);
  font-weight: 500; font-size: 14px; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.07s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--accent); color: var(--on-accent); font-weight: 600; box-shadow: 0 6px 20px -8px rgba(229,160,58,0.6); }
.btn--primary:hover { background: var(--accent-hi); }
.btn--ghost { background: var(--bg-2); border-color: var(--line); color: var(--text-1); }
.btn--ghost:hover { border-color: var(--line-2); color: var(--text); }
.btn--quiet { background: transparent; color: var(--text-2); }
.btn--quiet:hover { color: var(--text); background: var(--bg-2); }
.btn--danger { background: var(--danger-dim); border-color: rgba(229,100,110,0.4); color: var(--danger); }
.btn--danger:hover { background: rgba(229,100,110,0.2); }
.btn--sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--r1); }
.btn--lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ==========================================================================
   Cards / panels
   ========================================================================== */
.panel {
  background: linear-gradient(180deg, var(--bg-2), color-mix(in srgb, var(--bg-2) 82%, var(--bg)));
  border: 1px solid var(--line);
  border-radius: var(--r3);
  box-shadow: var(--shadow-1);
}
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel__head h3 { font-size: 15px; }
.panel__head p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.panel__body { padding: 18px; }
.panel__body--flush { padding: 0; }

/* stat cards — deliberately NOT identical; primary stat spans wider */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat {
  position: relative; overflow: hidden;
  padding: 18px; border-radius: var(--r3);
  background: var(--bg-2); border: 1px solid var(--line);
}
.stat--feature {
  grid-column: span 2;
  background:
    radial-gradient(120% 140% at 100% 0%, var(--accent-dim), transparent 62%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-color: var(--accent-line);
}
.stat__label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-2); }
.stat__value { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.stat--feature .stat__value { font-size: 38px; }
.stat__value small { font-size: 15px; color: var(--text-2); font-weight: 500; margin-left: 2px; }
.stat__delta { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; font-size: 12.5px; font-family: var(--font-mono); }
.stat__delta.up { color: var(--ok); }
.stat__delta.down { color: var(--danger); }
.stat__delta.flat { color: var(--text-2); }
.stat__spark { position: absolute; right: 16px; bottom: 14px; opacity: 0.9; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data thead th {
  text-align: left; font-family: var(--font-mono); font-weight: 500;
  font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--text-3);
  padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; background: var(--bg-2);
}
.data tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data tbody tr { transition: background 0.12s; cursor: pointer; }
.data tbody tr:hover { background: var(--bg-3); }
.data tbody tr:last-child td { border-bottom: none; }
.data .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.cell-strong { font-weight: 500; color: var(--text); }
.cell-sub { color: var(--text-3); font-size: 11.5px; font-family: var(--font-mono); }

/* ==========================================================================
   Badges / status pills
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 500; font-family: var(--font-mono);
  letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: var(--r-pill); background: currentColor; }
.badge--paid    { color: var(--ok);    background: var(--ok-dim);    border-color: rgba(63,191,142,0.28); }
.badge--pending { color: var(--warn);  background: var(--warn-dim);  border-color: rgba(224,168,62,0.28); }
.badge--expired { color: var(--muted); background: var(--muted-dim); border-color: rgba(125,132,148,0.25); }
.badge--failed, .badge--cancelled  { color: var(--danger); background: var(--danger-dim); border-color: rgba(229,100,110,0.28); }
.badge--info    { color: var(--info);  background: var(--info-dim);  border-color: rgba(90,156,248,0.28); }
.badge--plain   { color: var(--text-1); background: var(--bg-3); border-color: var(--line); }
.badge--plain::before { display: none; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field__label { font-size: 13px; font-weight: 500; color: var(--text-1); }
.field__label .req { color: var(--accent); }
.field__hint { font-size: 12px; color: var(--text-3); }
.field__error { font-size: 12px; color: var(--danger); display: none; }
.field.has-error .field__error { display: block; }
.field.has-error .input, .field.has-error .select, .field.has-error textarea { border-color: rgba(229,100,110,0.5); }

.input, .select, textarea.input {
  width: 100%; height: 42px; padding: 0 13px;
  background: var(--bg-inset); border: 1px solid var(--line-2);
  border-radius: var(--r2); color: var(--text); font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
textarea.input { height: auto; padding: 11px 13px; resize: vertical; min-height: 84px; line-height: 1.6; }
.input::placeholder, textarea.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent-line); box-shadow: var(--focus); background: var(--bg); }
.input:hover:not(:focus), .select:hover:not(:focus) { border-color: var(--line-3); }
.input.mono { font-family: var(--font-mono); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23848b9c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px;
}
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--r2) 0 0 var(--r2); }
.input-group .btn { border-radius: 0 var(--r2) var(--r2) 0; border: 1px solid var(--line-2); border-left: none; }
.input-affix { display: flex; align-items: center; padding: 0 12px; background: var(--bg-3); border: 1px solid var(--line-2); color: var(--text-2); font-family: var(--font-mono); font-size: 13px; }
.input-affix--pre { border-right: none; border-radius: var(--r2) 0 0 var(--r2); }
.input-group .input.has-pre { border-radius: 0 var(--r2) var(--r2) 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }

/* toggle */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track { width: 42px; height: 24px; border-radius: var(--r-pill); background: var(--bg-3); border: 1px solid var(--line-2); position: relative; transition: background 0.18s, border-color 0.18s; }
.toggle__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: var(--r-pill); background: var(--text-2); transition: transform 0.18s, background 0.18s; }
.toggle input:checked + .toggle__track { background: var(--accent-dim); border-color: var(--accent-line); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); background: var(--accent); }
.toggle input:focus-visible + .toggle__track { box-shadow: var(--focus); }

/* segmented control */
.segment { display: inline-flex; background: var(--bg-inset); border: 1px solid var(--line); border-radius: var(--r2); padding: 3px; gap: 3px; }
.segment button { padding: 7px 14px; border-radius: var(--r1); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: background 0.15s, color 0.15s; }
.segment button.is-active { background: var(--bg-3); color: var(--text); box-shadow: var(--shadow-1); }

/* filter bar */
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.search .input { padding-left: 38px; }

/* ==========================================================================
   Toast / notifications
   ========================================================================== */
.toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 9998; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r2);
  background: var(--bg-3); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-2); animation: toast-in 0.28s cubic-bezier(0.2,0.8,0.2,1);
}
.toast.leaving { animation: toast-out 0.22s ease forwards; }
.toast__icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast--ok .toast__icon { color: var(--ok); }
.toast--error .toast__icon { color: var(--danger); }
.toast--info .toast__icon { color: var(--info); }
.toast__title { font-size: 13.5px; font-weight: 500; }
.toast__msg { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ==========================================================================
   Modal / drawer
   ========================================================================== */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(6,7,11,0.66); backdrop-filter: blur(4px); display: grid; animation: fade 0.18s ease; }
.overlay.center { place-items: center; padding: 20px; }
.overlay.right { justify-content: end; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 520px; background: var(--bg-1);
  border: 1px solid var(--line-2); border-radius: var(--r3);
  box-shadow: var(--shadow-3); overflow: hidden; animation: modal-in 0.24s cubic-bezier(0.2,0.8,0.2,1);
  max-height: calc(100dvh - 40px); display: flex; flex-direction: column;
}
.modal--wide { max-width: 720px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
.drawer { width: min(480px, 100vw); height: 100dvh; background: var(--bg-1); border-left: 1px solid var(--line-2); box-shadow: var(--shadow-3); animation: drawer-in 0.26s cubic-bezier(0.2,0.8,0.2,1); display: flex; flex-direction: column; }
@keyframes drawer-in { from { transform: translateX(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal__head, .drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal__head h3, .drawer__head h3 { font-size: 16px; }
.modal__head p, .drawer__head p { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.modal__body, .drawer__body { padding: 20px; overflow-y: auto; }
.modal__foot, .drawer__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--line); background: var(--bg); }

/* ==========================================================================
   Misc utilities
   ========================================================================== */
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.stack { display: flex; flex-direction: column; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.center { text-align: center; }
.divider { height: 1px; background: var(--line); border: none; margin: 18px 0; }
.kbd { font-family: var(--font-mono); font-size: 11px; background: var(--bg-3); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--text-1); }
.hidden { display: none !important; }
.amount-lg { font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.copy-inline { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 13px; background: var(--bg-inset); border: 1px solid var(--line); border-radius: var(--r1); padding: 5px 9px; cursor: pointer; transition: border-color 0.15s; }
.copy-inline:hover { border-color: var(--line-2); }
.copy-inline svg { width: 14px; height: 14px; color: var(--text-3); }

/* two-column detail layout */
.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.detail-list { display: flex; flex-direction: column; }
.detail-list__row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.detail-list__row:last-child { border-bottom: none; }
.detail-list__row dt { color: var(--text-2); }
.detail-list__row dd { color: var(--text); font-weight: 500; text-align: right; }

/* progress / meter */
.meter { height: 7px; background: var(--bg-inset); border-radius: var(--r-pill); overflow: hidden; border: 1px solid var(--line); }
.meter__fill { height: 100%; background: linear-gradient(90deg, var(--accent-lo), var(--accent-hi)); border-radius: var(--r-pill); transition: width 0.5s cubic-bezier(0.2,0.8,0.2,1); }

/* empty + skeleton */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 46px 20px; color: var(--text-2); }
.empty__icon { width: 52px; height: 52px; border-radius: var(--r3); display: grid; place-items: center; background: var(--bg-3); border: 1px solid var(--line); color: var(--text-2); }
.empty h4 { font-size: 15px; color: var(--text); }
.empty p { font-size: 13px; max-width: 42ch; }
.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 37%, var(--bg-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r1); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.skel-row { height: 48px; margin: 0 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.skel-line { height: 12px; border-radius: 4px; }

/* code block */
pre.code { background: var(--bg-inset); border: 1px solid var(--line); border-radius: var(--r2); padding: 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; color: var(--text-1); position: relative; }
pre.code .tok-key { color: var(--info); } pre.code .tok-str { color: var(--ok); } pre.code .tok-com { color: var(--text-3); font-style: italic; } pre.code .tok-num { color: var(--accent-hi); }
.code-copy { position: absolute; top: 10px; right: 10px; }

/* loader dot */
.dots span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: currentColor; animation: dot 1.1s infinite ease-in-out both; }
.dots span:nth-child(2) { animation-delay: 0.16s; } .dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes dot { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* view fade transition */
.view-enter { animation: viewfade 0.32s cubic-bezier(0.2,0.8,0.2,1); }
@keyframes viewfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 940px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 280px;
    transform: translateX(-100%); transition: transform 0.28s cubic-bezier(0.2,0.8,0.2,1);
  }
  .app-shell.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 39; background: rgba(6,7,11,0.6); backdrop-filter: blur(2px); display: none; }
  .app-shell.nav-open .scrim { display: block; }
  .menu-toggle { display: grid; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat--feature { grid-column: span 2; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat--feature { grid-column: span 1; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
  .toast-host { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

/* ==========================================================================
   Documentation (rendered markdown)
   ========================================================================== */
.doc-content { font-size: 14.5px; line-height: 1.75; color: var(--text-1); max-width: 74ch; }
.doc-content h1 { font-size: 1.7rem; margin: 4px 0 14px; color: var(--text); letter-spacing: -0.03em; }
.doc-content h2 { font-size: 1.28rem; margin: 30px 0 12px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--text); }
.doc-content h3 { font-size: 1.05rem; margin: 22px 0 8px; color: var(--text); }
.doc-content h4 { font-size: 0.95rem; margin: 18px 0 6px; color: var(--text-1); }
.doc-content p { margin: 10px 0; }
.doc-content a { color: var(--accent); border-bottom: 1px solid var(--accent-line); }
.doc-content a:hover { color: var(--accent-hi); }
.doc-content strong { color: var(--text); font-weight: 600; }
.doc-content code { font-family: var(--font-mono); font-size: 0.86em; background: var(--bg-inset); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--accent-hi); }
.doc-content pre.code { margin: 14px 0; }
.doc-content pre.code code { background: none; border: none; padding: 0; color: inherit; }
.doc-content ul.md-ul, .doc-content ol.md-ol { margin: 10px 0 10px 4px; padding-left: 20px; }
.doc-content ul.md-ul { list-style: none; }
.doc-content ul.md-ul li { position: relative; padding-left: 18px; margin: 6px 0; }
.doc-content ul.md-ul li::before { content: ""; position: absolute; left: 0; top: 10px; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.doc-content ol.md-ol { list-style: decimal; }
.doc-content ol.md-ol li { margin: 6px 0; padding-left: 4px; }
.doc-content ol.md-ol li::marker { color: var(--accent); font-family: var(--font-mono); font-size: 0.85em; }
.doc-content blockquote { border-left: 3px solid var(--accent-line); background: var(--accent-dim); padding: 10px 16px; margin: 14px 0; border-radius: 0 var(--r2) var(--r2) 0; color: var(--text-1); }
.doc-content hr { border: none; border-top: 1px solid var(--line); margin: 22px 0; }
.md-table-wrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: var(--r2); }
table.md-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.md-table th { text-align: left; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
table.md-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.md-table tr:last-child td { border-bottom: none; }
table.md-table code { font-size: 0.82em; }

@media (max-width: 760px) {
  .docs-layout { grid-template-columns: 1fr !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
