/* RadiusNest - design system
   Style: calm, data-first SaaS dashboard. Tokens first; components never use raw colors. */

:root {
  /* surfaces */
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #eef2f6;
  --border: #dfe4ea;
  --border-strong: #c9d1db;
  --input-border: #848e9e;
  /* text */
  --text: #0f172a;
  --text-2: #3f4b5c;
  --muted: #5a6677;
  /* brand + semantic (all >= 4.5:1 on --surface) */
  --primary: #0e7490;
  --primary-hover: #155e75;
  --primary-soft: #e3f3f7;
  --on-primary: #ffffff;
  --success: #047857;
  --success-soft: #e3f5ee;
  --warning: #a4520a;
  --warning-soft: #fdf1e2;
  --danger: #b91c1c;
  --danger-soft: #fdeceb;
  --info: #3548c9;
  --info-soft: #eceffe;
  /* sidebar */
  --side-bg: #0b1324;
  --side-text: #c3ccd9;
  --side-muted: #8390a5;
  --side-hover: rgba(255, 255, 255, .06);
  --side-active: rgba(34, 211, 238, .14);
  --side-accent: #22d3ee;
  /* shape + depth */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-2: 0 8px 24px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .06);
  --shadow-3: 0 24px 60px rgba(15, 23, 42, .25);
  --ring: 0 0 0 3px rgba(14, 116, 144, .35);
  /* type */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
  /* motion */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  /* layout */
  --side-w: 248px;
  --bottom-nav-h: 64px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1a;
    --surface: #111827;
    --surface-2: #151d2c;
    --surface-3: #1b2436;
    --border: #243045;
    --border-strong: #33415a;
    --input-border: #65748e;
    --text: #e8edf5;
    --text-2: #b9c3d2;
    --muted: #97a3b6;
    --primary: #2dd4ef;
    --primary-hover: #67e3f5;
    --primary-soft: #0f2c36;
    --on-primary: #04161c;
    --success: #4ade80;
    --success-soft: #0f2a1b;
    --warning: #fbbf24;
    --warning-soft: #2e230b;
    --danger: #f87171;
    --danger-soft: #331515;
    --info: #a5b4fc;
    --info-soft: #1d2242;
    --side-bg: #070b14;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, .5);
    --shadow-3: 0 24px 60px rgba(0, 0, 0, .7);
    --ring: 0 0 0 3px rgba(45, 212, 239, .4);
  }
}

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

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.break { overflow-wrap: anywhere; }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--surface); color: var(--text);
  padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-2); transition: top var(--dur);
}
.skip-link:focus { top: 12px; }

svg.i { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i-sm { width: 16px; height: 16px; }

/* ---------- boot + progress ---------- */
.boot { min-height: 100dvh; display: grid; place-items: center; color: var(--muted); }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
#progress {
  position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 90; pointer-events: none;
  background: linear-gradient(90deg, var(--primary), var(--side-accent));
  transform-origin: left; transform: scaleX(0); opacity: 0;
  transition: transform 400ms var(--ease-out), opacity 300ms;
}
#progress.active { opacity: 1; transform: scaleX(.7); transition: transform 8s cubic-bezier(.1, .7, .2, 1), opacity 100ms; }
#progress.done { opacity: 0; transform: scaleX(1); transition: transform 150ms, opacity 300ms 150ms; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; display: inline-block; flex: 0 0 auto;
}
.spinner.lg { width: 28px; height: 28px; border-width: 3px; color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- brand ---------- */
.logo { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 16px; letter-spacing: -.01em; }
.logo img { width: 32px; height: 32px; border-radius: 9px; }
.logo small { display: block; font-weight: 500; font-size: 11.5px; letter-spacing: .02em; opacity: .7; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100dvh; }
.side {
  width: var(--side-w); flex: 0 0 var(--side-w); background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; z-index: 40;
}
.side .logo { color: #fff; padding: 20px 20px 16px; }
.tenant-chip {
  margin: 0 12px 8px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .05);
  font-size: 13px; color: #fff; display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.tenant-chip span { color: var(--side-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.tenant-chip strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { padding: 8px 12px; overflow-y: auto; flex: 1; }
.nav-label { color: var(--side-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 6px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px;
  color: var(--side-text); font-weight: 550; font-size: 14.5px; margin-bottom: 2px;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-accent);
}
.nav a[aria-current="page"] svg { color: var(--side-accent); }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .07); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  background: linear-gradient(135deg, #0e7490, #3548c9); color: #fff; font-weight: 700; font-size: 14px;
}
.who { min-width: 0; flex: 1; }
.who strong { display: block; color: #fff; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { display: block; color: var(--side-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .icon-btn { color: var(--side-text); }
.side-foot .icon-btn:hover { background: var(--side-hover); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.banner {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 32px; font-size: 14px; border-bottom: 1px solid var(--border);
  background: var(--warning-soft); color: var(--warning);
}
.banner.info { background: var(--info-soft); color: var(--info); }
.banner .row { gap: 8px; }
.content { padding: 28px 32px 48px; max-width: 1320px; width: 100%; margin: 0 auto; }
.content:focus { box-shadow: none; }
.bottom-nav { display: none; }
.scrim { display: none; }

@media (max-width: 1023px) {
  .side {
    position: fixed; left: 0; top: 0; height: 100dvh; transform: translateX(-100%);
    transition: transform 240ms var(--ease-out);
  }
  .side.open { transform: none; box-shadow: var(--shadow-3); }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: 35; animation: fade var(--dur) var(--ease-out); }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; background: var(--side-bg); color: #fff;
    position: sticky; top: 0; z-index: 30;
  }
  .topbar .logo { font-size: 15px; min-width: 0; }
  .topbar .logo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .icon-btn { color: #fff; }
  .content { padding: 20px 16px calc(var(--bottom-nav-h) + 28px + env(safe-area-inset-bottom, 0px)); }
  .banner { padding: 10px 16px; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bottom-nav a, .bottom-nav button {
    min-height: var(--bottom-nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 600; background: none; border: 0; cursor: pointer;
  }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav [aria-current="page"] { color: var(--primary); }
  .bottom-nav svg.i { width: 22px; height: 22px; }
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page { animation: rise 220ms var(--ease-out); }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.page-head .titles .row { gap: 10px; }
.page-title:focus, .page-title:focus-visible { box-shadow: none; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; min-height: 32px; }
.crumb:hover { color: var(--primary); text-decoration: none; }

/* ---------- layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.spacer { flex: 1; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); min-width: 0; }
.card-pad { padding: 20px; }
.card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--border); min-height: 56px;
}
.card-head .sub { color: var(--muted); font-size: 13px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); }

/* stats */
a.stat, a.stat:hover { color: inherit; text-decoration: none; }
.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast); }
a.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
a.stat:active { transform: scale(.99); }
.stat .ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; background: var(--primary-soft); color: var(--primary); }
.stat .ic.success { background: var(--success-soft); color: var(--success); }
.stat .ic.warning { background: var(--warning-soft); color: var(--warning); }
.stat .ic.danger { background: var(--danger-soft); color: var(--danger); }
.stat .ic.info { background: var(--info-soft); color: var(--info); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 550; }
.stat .value { font-size: 28px; font-weight: 750; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .hint { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* quick actions */
.quick { display: flex; gap: 10px; flex-wrap: wrap; }

/* steps */
.onboard { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); margin-top: 14px; }
.onboard a {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 10px; border: 1px solid var(--border);
  color: var(--text); background: var(--surface-2); transition: border-color var(--dur-fast);
}
.onboard a:hover { border-color: var(--primary); text-decoration: none; }
.onboard b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-size: 13px; flex: 0 0 auto; }
.onboard span { color: var(--muted); font-size: 13px; display: block; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; position: relative;
  min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; user-select: none; touch-action: manipulation;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform 80ms;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg.i { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(.95); background: var(--danger); }
@media (prefers-color-scheme: dark) { .btn-danger-solid { color: #1b0606; } }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--muted); border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn-primary.is-loading::after { border-color: var(--on-primary); border-right-color: transparent; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0;
  background: transparent; color: var(--text-2); cursor: pointer; flex: 0 0 auto; touch-action: manipulation;
}
.icon-btn:hover { background: var(--surface-3); }

@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding: 0 12px; }
  .icon-btn { width: 44px; height: 44px; }
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap; line-height: 1.4;
  background: var(--surface-3); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #16a34a; margin-right: 8px; box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); vertical-align: 1px; }

/* ---------- tables (become cards on phones) ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); white-space: nowrap; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--dur-fast); }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn + .btn { margin-left: 6px; }
td.cell-check, th.cell-check { width: 48px; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 12.5px; }

@media (max-width: 720px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { padding: 12px 16px; border-bottom: 1px solid var(--border); position: relative; }
  table.responsive tbody tr:last-child { border-bottom: 0; }
  table.responsive td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; min-height: 28px; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; flex: 0 0 auto; }
  table.responsive td.primary-cell { justify-content: flex-start; text-align: left; font-size: 15px; padding-bottom: 6px; }
  table.responsive td.primary-cell::before, table.responsive td.cell-check::before, table.responsive td.actions::before { display: none; }
  table.responsive td.cell-check { position: absolute; right: 12px; top: 10px; width: auto; padding: 0; }
  table.responsive td.actions { justify-content: flex-start; padding-top: 10px; }
  table.responsive td[data-label=""]::before { display: none; }
  table.responsive td > * { max-width: 70%; }
  table.responsive td.primary-cell > * { max-width: 100%; }
}

/* empty + error states */
.empty { padding: 44px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.empty .ic svg.i { width: 26px; height: 26px; }
.empty strong { color: var(--text); font-size: 15px; }
.error-state { padding: 44px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.error-state .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); }

/* skeletons */
.sk { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-title { height: 30px; width: 220px; }
.sk-line { height: 14px; }
.sk-stat { height: 96px; border-radius: var(--radius); }
.sk-row { display: flex; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.sk-row:last-child { border-bottom: 0; }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-weight: 600; font-size: 13.5px; color: var(--text); }
.field .req { color: var(--danger); margin-left: 2px; }
.field .help { color: var(--muted); font-size: 12.5px; }
.field .err { color: var(--danger); font-size: 12.5px; font-weight: 550; }
.field.full, .form-section { grid-column: 1 / -1; }
.form-section { padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; }
.form-section h3 { padding-top: 12px; }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--text); background: var(--surface); border: 1px solid var(--input-border);
  border-radius: var(--radius-sm); padding: 8px 12px; width: 100%; min-height: 40px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
select { padding-right: 32px; }
textarea { min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:hover, select:hover, textarea:hover { border-color: var(--text-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--primary); box-shadow: var(--ring); border-radius: var(--radius-sm); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--primary); cursor: pointer; }
input[type=search] { padding-left: 38px; }
@media (max-width: 1023px) { input, select, textarea { font-size: 16px; min-height: 44px; } }
.check { display: flex; align-items: center; gap: 10px; font-weight: 550; cursor: pointer; min-height: 32px; }
.input-group { display: flex; gap: 8px; }
.input-group > input { flex: 1; min-width: 0; }
.input-group > select.unit { flex: 0 0 auto; width: auto; }
.input-wrap { position: relative; display: flex; }
.input-wrap > input { padding-right: 46px; }
.input-wrap .icon-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; }
.search { position: relative; flex: 1 1 240px; max-width: 340px; }
.search svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.toolbar select { width: auto; min-width: 150px; }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 20px; background: var(--primary-soft); border-bottom: 1px solid var(--border); }
@media (max-width: 720px) {
  .toolbar { padding: 12px 16px; }
  .search { max-width: none; flex-basis: 100%; }
  .toolbar select { flex: 1 1 140px; }
}

/* segmented tabs */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 10px; margin-bottom: 4px; overflow-x: auto; max-width: 100%; }
.tabs a { padding: 0 14px; min-height: 36px; display: inline-flex; align-items: center; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.tabs a:hover { text-decoration: none; }
@media (hover: hover) { .tabs a:hover { color: var(--text); } }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* key/value */
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 12px 20px; margin: 16px 0 0; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; } }

/* usage bar */
.meter { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width 400ms var(--ease-out); }
.bar.warning > i { background: #d97706; }
.bar.danger > i { background: #dc2626; }

/* script */
pre.script {
  background: #0b1220; color: #d8e1ee; border-radius: 10px; padding: 16px; margin: 0; border: 1px solid #1f2a3d;
  max-height: 440px; overflow: auto; font: 12.5px/1.6 var(--mono); white-space: pre;
}
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; color: var(--text-2); }
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-size: 13.5px; align-items: flex-start; }
.callout.warning { background: var(--warning-soft); color: var(--warning); }
.callout.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .55); display: flex; align-items: flex-start; justify-content: center;
  padding: 7vh 16px 16px; z-index: 60; overflow-y: auto; animation: fade var(--dur) var(--ease-out);
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 560px; box-shadow: var(--shadow-3);
  border: 1px solid var(--border); animation: pop 220ms var(--ease-out);
}
.modal.wide { max-width: 820px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 14px 24px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 20px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@media (max-width: 640px) {
  .modal-back { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { max-width: none; border-radius: 18px 18px 0 0; max-height: 92dvh; display: flex; flex-direction: column; animation: sheet 260ms var(--ease-out); }
  .modal-body { overflow-y: auto; padding: 18px 16px; }
  .modal-head { padding: 14px 12px 12px 16px; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-radius: 0; }
  .modal-foot .btn { flex: 1; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ---------- toasts ---------- */
#toasts {
  position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80;
  width: min(420px, calc(100vw - 32px));
}
@media (max-width: 1023px) { #toasts { right: 16px; bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom, 0px)); } }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: 12px;
  background: #0f172a; color: #f1f5f9; box-shadow: var(--shadow-2); animation: rise 200ms var(--ease-out);
  border-left: 4px solid var(--side-accent);
}
.toast.success { border-left-color: #22c55e; }
.toast.error { border-left-color: #ef4444; }
.toast .msg { flex: 1; font-size: 14px; padding-top: 1px; }
.toast .icon-btn { width: 28px; height: 28px; color: #cbd5e1; border-radius: 6px; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, .1); }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero {
  background: radial-gradient(1200px 600px at 0% 0%, #155e75 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #3548c9 0%, transparent 55%), #0b1324;
  color: #e2e8f0; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.auth-hero .logo { color: #fff; font-size: 18px; }
.auth-hero h2 { color: #fff; font-size: 34px; line-height: 1.15; letter-spacing: -.02em; max-width: 480px; }
.auth-hero p { color: #b8c4d6; max-width: 460px; margin-top: 12px; font-size: 16px; }
.auth-points { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; color: #cbd5e1; }
.auth-points svg.i { color: var(--side-accent); margin-top: 2px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo { display: none; margin-bottom: 24px; justify-content: center; color: var(--text); }
.auth-card h1 { font-size: 26px; }
.auth-card .sub { color: var(--muted); margin: 6px 0 24px; }
.auth-foot { text-align: center; margin-top: 20px; color: var(--muted); }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-card .logo { display: flex; }
}

/* auth extras: divider, Google button, OTP boxes */
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.gbtn { min-height: 44px; display: flex; justify-content: center; }
.gbtn:empty { display: none; }
.gbtn + .divider { margin-top: 18px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: -4px; font-size: 13.5px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; font-weight: 600; min-height: 32px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
.link-btn:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp input {
  text-align: center; font: 700 22px/1 var(--mono); padding: 0; min-height: 56px; border-radius: 10px;
  caret-color: var(--primary); letter-spacing: 0;
}
.otp input:not(:placeholder-shown) { border-color: var(--text-2); }
.otp.invalid input { border-color: var(--danger); }
@media (max-width: 380px) { .otp { gap: 6px; } .otp input { min-height: 50px; font-size: 20px; } }
.sent-to { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--primary-soft); color: var(--text); font-size: 14px; margin-bottom: 18px; }
.sent-to svg.i { color: var(--primary); margin-top: 1px; }
.pw-rules { color: var(--muted); font-size: 12.5px; }

/* ---------- billing ---------- */
.plan-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); align-items: stretch; }
.plan {
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-1);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.plan:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.plan.popular { border: 2px solid var(--primary); padding: 21px; }
.plan.current { background: linear-gradient(180deg, var(--primary-soft), var(--surface) 55%); }
.plan .ribbon { position: absolute; top: -12px; left: 20px; background: var(--primary); color: var(--on-primary); font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 99px; letter-spacing: .02em; }
.plan h3 { font-size: 17px; }
.plan .desc { color: var(--muted); font-size: 13.5px; min-height: 20px; }
.price { display: flex; align-items: baseline; gap: 4px; }
.price b { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price span { color: var(--muted); font-size: 14px; }
.price-local { color: var(--muted); font-size: 12.5px; margin-top: -10px; }
.feat { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; flex: 1; align-content: start; }
.feat li { display: flex; gap: 8px; align-items: flex-start; }
.feat svg.i { width: 18px; height: 18px; color: var(--success); margin-top: 1px; }
.plan .btn { width: 100%; }

.current-plan { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; }
@media (max-width: 800px) { .current-plan { grid-template-columns: 1fr; } }
.current-plan .big { font-size: 24px; font-weight: 750; letter-spacing: -.01em; }
.usage { display: grid; gap: 14px; }
.usage .row { justify-content: space-between; font-size: 13.5px; }

.choice-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr)); }
.choice {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--input-border); background: var(--surface); cursor: pointer; min-height: 44px;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.choice:hover { border-color: var(--text-2); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice strong { font-size: 14px; }
.choice small { color: var(--muted); font-size: 12px; }
.choice:has(input:checked) { border: 2px solid var(--primary); padding: 9px 11px; background: var(--primary-soft); }
.choice:has(input:focus-visible) { box-shadow: var(--ring); }
.method-grid { display: grid; gap: 8px; }
.method-details { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; font-size: 14px; background: var(--surface-2); }
.copy-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.copy-row .mono { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.summary { display: grid; gap: 6px; padding: 14px; border-radius: 10px; background: var(--surface-3); font-size: 14px; }
.summary .row { justify-content: space-between; }
.summary .total { font-size: 18px; font-weight: 800; }
.extra-users { margin-top: 4px; }
.drop {
  display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px dashed var(--input-border); border-radius: 10px;
  background: var(--surface); cursor: pointer; min-height: 64px;
}
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.drop img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.drop .ic { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: 0 0 auto; }
.proof-img { max-width: 100%; max-height: 60vh; display: block; margin: 0 auto; border-radius: 10px; border: 1px solid var(--border); }
.nav a .count { margin-left: auto; background: var(--side-accent); color: #04161c; font-size: 11.5px; font-weight: 800; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; }
.stack.tight { gap: 10px; }
.kv + .field { margin-top: 18px; }
.stack.xs { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.text-strong { color: var(--text); }
.field .otp + .err, .field .err { min-height: 0; }
input[type=file]:focus-visible + .drop { box-shadow: var(--ring); border-color: var(--primary); }

/* crypto payment */
.crypto-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 560px) { .crypto-grid { grid-template-columns: 1fr; justify-items: stretch; } .qr-box { justify-self: center; } }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--border); }
svg.qr { display: block; width: 176px; height: 176px; }
.copy-block { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.copy-row .big-amount, .big-amount { font-size: 26px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.big-amount .unit { font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 6px; font-family: var(--font); }
.crypto-actions { border-top: 1px solid var(--border); padding-top: 14px; }
@media (max-width: 640px) { .crypto-actions .btn { flex: 1 1 auto; } .crypto-actions .spacer { display: none; } }
.state-box { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 24px 8px; }
.state-box .ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.state-box .ic svg.i { width: 28px; height: 28px; }
.state-box.success .ic { background: var(--success-soft); color: var(--success); }
.state-box h3 { font-size: 18px; }
.node-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.node-list li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input.mono { font-family: var(--mono); font-size: 14px; }
.form-grid > .span-all { grid-column: 1 / -1; }
.row.wrap { flex-wrap: wrap; }
.coin {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  font: 800 15px/1 var(--font); color: #fff; background: #64748b;
}
.coin-btc { background: #b45309; }
.coin-eth { background: #4f5bd5; }
.coin-usdt { background: #0f7a5c; }
.coin-usdc { background: #1d5fbf; }
.coin-sol { background: #6d3fc8; }
.coin-bnb { background: #a16207; }
.coin-trx { background: #b91c1c; }
.coin-ltc { background: #475569; }
.choice.has-icon { flex-direction: row; align-items: center; gap: 10px; }
.choice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice-grid:has(.has-icon) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.watch { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--primary-soft); border: 1px solid var(--border); }
.watch .spinner { color: var(--primary); flex: 0 0 auto; }
details.claim { border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; }
details.claim[open] { padding-bottom: 14px; }
details.claim > summary { list-style: none; cursor: pointer; display: flex; align-items: center; min-height: 36px; }
details.claim > summary::-webkit-details-marker { display: none; }
details.claim > summary::before { content: "+"; font-weight: 800; margin-right: 8px; color: var(--primary); }
details.claim[open] > summary::before { content: "−"; }
.confirm-meter { width: min(320px, 100%); display: grid; gap: 6px; }
.meter-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter-bar > span { display: block; height: 100%; background: var(--primary); transition: width var(--dur-fast); }
.dep-card { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
label.dep-card { cursor: pointer; }
label.dep-card:has(input:checked) { border: 2px solid var(--primary); padding: 9px 11px; background: var(--primary-soft); }
.warn-text { color: var(--warning); font-weight: 600; }
.dep-card input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); }
.meter-bar > .w-0 { width: 0%; }
.meter-bar > .w-5 { width: 5%; }
.meter-bar > .w-10 { width: 10%; }
.meter-bar > .w-15 { width: 15%; }
.meter-bar > .w-20 { width: 20%; }
.meter-bar > .w-25 { width: 25%; }
.meter-bar > .w-30 { width: 30%; }
.meter-bar > .w-35 { width: 35%; }
.meter-bar > .w-40 { width: 40%; }
.meter-bar > .w-45 { width: 45%; }
.meter-bar > .w-50 { width: 50%; }
.meter-bar > .w-55 { width: 55%; }
.meter-bar > .w-60 { width: 60%; }
.meter-bar > .w-65 { width: 65%; }
.meter-bar > .w-70 { width: 70%; }
.meter-bar > .w-75 { width: 75%; }
.meter-bar > .w-80 { width: 80%; }
.meter-bar > .w-85 { width: 85%; }
.meter-bar > .w-90 { width: 90%; }
.meter-bar > .w-95 { width: 95%; }
.meter-bar > .w-100 { width: 100%; }

/* ---------- vouchers ---------- */
.vouchers { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.voucher { border: 1.5px dashed #94a3b8; border-radius: 10px; padding: 12px 14px; background: #fff; color: #0f172a; break-inside: avoid; position: relative; }
.voucher .v-isp { font-weight: 750; font-size: 12.5px; padding-right: 60px; }
.voucher .v-pkg { font-size: 11px; color: #475569; margin-top: 2px; }
.voucher .v-code { font: 700 20px/1.3 var(--mono); letter-spacing: 1.5px; margin: 8px 0 2px; }
.voucher .v-pass { font: 12px var(--mono); color: #334155; }
.voucher .v-price { position: absolute; right: 12px; top: 10px; font-weight: 750; font-size: 12.5px; background: #e3f3f7; color: #0e7490; padding: 1px 8px; border-radius: 99px; }
.voucher .v-brand { font-size: 9.5px; color: #64748b; margin-top: 6px; text-transform: uppercase; letter-spacing: .08em; }
@media print {
  .side, .topbar, .banner, .bottom-nav, .no-print, #toasts, #progress, .skip-link { display: none !important; }
  body, .content { background: #fff; padding: 0 !important; margin: 0; max-width: none; }
  .page { animation: none; }
  .vouchers { grid-template-columns: repeat(4, 1fr); gap: 4mm; }
}
