/* ==========================================================================
   Siphone HQ - design system
   2026 palette: Pantone "Cloud Dancer" (soft white) for light surfaces and
   text on dark, WGSN "Transformative Teal" as the main colour, an acid lime
   accent for the one most important action on a screen (Record), and a warm
   orange-red for losses. Dark theme is the default; light theme follows the
   system, and the user can pick either in the sidebar.
   ========================================================================== */

:root {
  --font-ui: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;

  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 22px;
  --radius-pill: 999px;

  --sidebar-w: 248px;
  --content-max: 1240px;
  --gutter: clamp(16px, 3.4vw, 44px);

  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Dark (default) */
  --bg: #0A1212;
  --bg-2: #0D1717;
  --surface: #101B1B;
  --surface-2: #142222;
  --surface-3: #1A2A2A;
  --line: #1F2F2E;
  --line-2: #2B3E3D;
  --text: #F0EEE9;          /* Cloud Dancer */
  --text-2: #B3BEBB;
  --text-3: #7B8B88;
  --teal: #3CCFBF;          /* Transformative Teal, lifted for dark screens */
  --teal-strong: #5FE0D1;
  --teal-ink: #04201E;
  --teal-soft: rgba(60, 207, 191, .12);
  --teal-line: rgba(60, 207, 191, .35);
  --lime: #D4F24A;
  --lime-strong: #E2FA6E;
  --lime-ink: #182000;
  --lime-soft: rgba(212, 242, 74, .12);
  --lime-text: #D4F24A;
  --up: #62E39A;
  --up-soft: rgba(98, 227, 154, .12);
  --down: #FF7A59;
  --down-soft: rgba(255, 122, 89, .12);
  --warn: #F2C94C;
  --warn-soft: rgba(242, 201, 76, .13);
  --focus: 0 0 0 3px rgba(60, 207, 191, .45);
  --shadow: 0 24px 48px -28px rgba(0, 0, 0, .75);
  --shadow-pop: 0 30px 80px -20px rgba(0, 0, 0, .8);
  --glass: rgba(10, 18, 18, .78);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F0EEE9;          /* Cloud Dancer */
    --bg-2: #E9E6DF;
    --surface: #FBFAF7;
    --surface-2: #F4F2ED;
    --surface-3: #ECE9E2;
    --line: #DEDAD1;
    --line-2: #CCC6BA;
    --text: #13201F;
    --text-2: #475654;
    --text-3: #7A8683;
    --teal: #0E6E6B;        /* Transformative Teal */
    --teal-strong: #0A5957;
    --teal-ink: #F0EEE9;
    --teal-soft: rgba(14, 110, 107, .09);
    --teal-line: rgba(14, 110, 107, .35);
    --lime: #CBEA3C;
    --lime-strong: #BADB27;
    --lime-ink: #1A2200;
    --lime-soft: rgba(150, 180, 20, .14);
    --lime-text: #4E6300;
    --up: #15804A;
    --up-soft: rgba(21, 128, 74, .10);
    --down: #C7431F;
    --down-soft: rgba(199, 67, 31, .09);
    --warn: #A87400;
    --warn-soft: rgba(168, 116, 0, .10);
    --focus: 0 0 0 3px rgba(14, 110, 107, .30);
    --shadow: 0 20px 40px -30px rgba(40, 38, 30, .35);
    --shadow-pop: 0 30px 70px -20px rgba(40, 38, 30, .35);
    --glass: rgba(240, 238, 233, .82);
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #F0EEE9;
  --bg-2: #E9E6DF;
  --surface: #FBFAF7;
  --surface-2: #F4F2ED;
  --surface-3: #ECE9E2;
  --line: #DEDAD1;
  --line-2: #CCC6BA;
  --text: #13201F;
  --text-2: #475654;
  --text-3: #7A8683;
  --teal: #0E6E6B;
  --teal-strong: #0A5957;
  --teal-ink: #F0EEE9;
  --teal-soft: rgba(14, 110, 107, .09);
  --teal-line: rgba(14, 110, 107, .35);
  --lime: #CBEA3C;
  --lime-strong: #BADB27;
  --lime-ink: #1A2200;
  --lime-soft: rgba(150, 180, 20, .14);
  --lime-text: #4E6300;
  --up: #15804A;
  --up-soft: rgba(21, 128, 74, .10);
  --down: #C7431F;
  --down-soft: rgba(199, 67, 31, .09);
  --warn: #A87400;
  --warn-soft: rgba(168, 116, 0, .10);
  --focus: 0 0 0 3px rgba(14, 110, 107, .30);
  --shadow: 0 20px 40px -30px rgba(40, 38, 30, .35);
  --shadow-pop: 0 30px 70px -20px rgba(40, 38, 30, .35);
  --glass: rgba(240, 238, 233, .82);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
::selection { background: var(--teal); color: var(--teal-ink); }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }

.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-display); font-weight: 400; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  color: var(--text-3);
}

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 14px 16px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 6px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: radial-gradient(120% 120% at 20% 10%, var(--teal-strong), var(--teal) 45%, #0E6E6B 100%);
  color: var(--teal-ink);
  box-shadow: 0 0 0 1px var(--teal-line), 0 8px 24px -8px var(--teal);
}
.brand-name { font-family: var(--font-display); font-size: 25px; line-height: 1; letter-spacing: -.01em; }
.brand-sub { display: block; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-3); margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 12px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; font-size: 14.5px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--teal-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--teal-line); }
.nav a.active svg { color: var(--teal); }
.nav .dot { width: 8px; height: 8px; border-radius: 50%; margin: 0 4px; flex: none; }
.nav .nav-count { margin-left: auto; font: 500 11px var(--font-mono); color: var(--text-3); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px;
  color: var(--text); border: 1px solid var(--line); background: var(--surface);
}
.user-chip:hover { text-decoration: none; border-color: var(--line-2); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #0A1212;
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.user-chip .who { min-width: 0; line-height: 1.25; }
.user-chip .who b { display: block; font-weight: 600; font-size: 14px; }
.user-chip .who span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.foot-actions { display: flex; gap: 6px; }
.foot-actions .btn { flex: 1; }

.main { min-width: 0; padding: 30px var(--gutter) 72px; }
.main-inner { max-width: var(--content-max); margin: 0 auto; }

.topbar, .bottomnav { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 30;
    padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
    background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand-name { font-size: 22px; }
  .topbar-actions { display: flex; gap: 6px; }
  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .bottomnav a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 2px; border-radius: 12px;
    color: var(--text-3); font-size: 11px; font-weight: 500;
  }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav a svg { width: 20px; height: 20px; }
  .addr { min-height: 32px; padding: 6px 8px; margin: -6px 0 -6px -8px; }
  .explorer-link { width: 32px; height: 32px; }
  .explorer-link img { width: 16px; height: 16px; }
  .bottomnav a.active { color: var(--text); background: var(--teal-soft); }
  .bottomnav a.active svg { color: var(--teal); }
}

/* ---------- Page header ---------- */
.page { display: flex; flex-direction: column; gap: 22px; animation: page-in .28s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.page-head .title-wrap { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.page-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(36px, 5.4vw, 56px); line-height: .98; letter-spacing: -.015em;
}
.page-sub { color: var(--text-2); max-width: 64ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.card-title { font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--text-2); }
.card-meta { font: 500 12px var(--font-mono); color: var(--text-3); }
.card-body { padding: 20px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); }
.card.flat { box-shadow: none; }
.card.link { transition: border-color .15s var(--ease), transform .15s var(--ease); color: inherit; display: block; }
.card.link:hover { border-color: var(--teal-line); text-decoration: none; transform: translateY(-1px); }

/* The big "total" card */
.hero {
  position: relative; overflow: hidden;
  padding: 26px 30px;
  background:
    radial-gradient(90% 140% at 100% 0%, var(--teal-soft), transparent 60%),
    var(--surface);
}
.hero .eyebrow { margin-bottom: 10px; }
.big-number {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(44px, 7.4vw, 84px); line-height: .95; letter-spacing: -.02em;
  font-variant-numeric: lining-nums;
  word-break: break-all;
}
.big-number .unit { font-family: var(--font-ui); font-size: .24em; letter-spacing: .04em; color: var(--text-2); margin-left: .35em; }
.hero-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-top: 18px; }
.coin-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.coin-chip {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 7px 12px; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--line);
  font: 500 14px var(--font-mono);
}
.coin-chip .sym { font: 600 11px var(--font-ui); letter-spacing: .12em; color: var(--text-3); }
.coin-chip .usd { font-size: 12px; color: var(--text-3); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-2);
  background: transparent; color: var(--text);
  font-weight: 500; font-size: 14.5px; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .08s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); font-weight: 600; }
.btn-primary:hover { background: var(--teal-strong); border-color: var(--teal-strong); }
.btn-accent { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); font-weight: 600; }
.btn-accent:hover { background: var(--lime-strong); border-color: var(--lime-strong); }
.btn-ghost { border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.btn-danger { border-color: var(--down-soft); color: var(--down); }
.btn-danger:hover { background: var(--down-soft); border-color: var(--down); }
.btn-danger.solid { background: var(--down); border-color: var(--down); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.btn.loading { pointer-events: none; opacity: .75; }
.btn.loading::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tabs (segmented) ---------- */
.tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--line);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-pill);
  border: 0; background: transparent; color: var(--text-2);
  font-weight: 500; font-size: 14px; white-space: nowrap; cursor: pointer;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.tab .dot { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- Lists (wallets, records, payments...) ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 16px;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
  transition: background .12s var(--ease);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row.clickable { cursor: pointer; }
.row-title { font-weight: 600; font-size: 15.5px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-sub { font: 400 12.5px var(--font-mono); color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.row-value { text-align: right; font: 500 17px var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-value .unit { font: 500 11px var(--font-ui); letter-spacing: .1em; color: var(--text-3); margin-left: 5px; }
.row-value-sub { text-align: right; font: 400 12.5px var(--font-mono); color: var(--text-3); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ---------- Address + explorer icon ---------- */
.addr {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 2px 6px; margin: -2px -6px;
  border: 0; border-radius: 6px; background: transparent;
  font: 400 12.5px var(--font-mono); color: var(--text-3);
  cursor: copy; text-align: left; min-width: 0;
}
.addr:hover { background: var(--surface-3); color: var(--text); }
.addr .addr-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.addr.copied { color: var(--up); }
.explorer-link {
  display: inline-grid; place-items: center; flex: none;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--surface-3); border: 1px solid var(--line);
  transition: transform .12s var(--ease), border-color .12s var(--ease);
}
.explorer-link:hover { transform: scale(1.08); border-color: var(--teal-line); text-decoration: none; }
.explorer-link img { width: 14px; height: 14px; border-radius: 3px; }
.explorer-link svg { width: 13px; height: 13px; color: var(--text-2); }

.chain-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 7px; border-radius: 6px;
  font: 600 10.5px var(--font-ui); letter-spacing: .1em;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line);
}
.chain-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--chain-color, var(--text-3)); }
.chain-badge[data-chain="sol"] { --chain-color: #9B6BFF; }
.chain-badge[data-chain="eth"] { --chain-color: #8FA4FF; }
.chain-badge[data-chain="bnb"] { --chain-color: #F3BA2F; }

/* ---------- Badges, deltas, timers ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: var(--radius-pill);
  font: 600 11px var(--font-ui); letter-spacing: .06em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line);
}
.badge svg { width: 12px; height: 12px; }
.badge-teal { background: var(--teal-soft); color: var(--teal); border-color: var(--teal-line); }
.badge-lime { background: var(--lime-soft); color: var(--lime-text); border-color: transparent; }
.badge-up { background: var(--up-soft); color: var(--up); border-color: transparent; }
.badge-down { background: var(--down-soft); color: var(--down); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.delta { font: 500 13px var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--text-3); }

.edit-timer {
  display: inline-flex; align-items: center; gap: 5px;
  font: 500 11.5px var(--font-mono); color: var(--warn);
  padding: 2px 8px; border-radius: var(--radius-pill); background: var(--warn-soft);
}
.edit-timer svg { width: 12px; height: 12px; }
.locked .edit-only { display: none !important; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12.5px; color: var(--text-3); }
.field .error-text { font-size: 12.5px; color: var(--down); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.input, .select, .textarea {
  width: 100%; min-width: 0;
  height: 42px; padding: 0 13px;
  border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { height: auto; min-height: 84px; padding: 10px 13px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; }
.input.mono { font-family: var(--font-mono); font-size: 13.5px; }
.input.invalid { border-color: var(--down); }
.select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }

/* Big choice buttons (for example LOS: Start or End) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 18px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.choice:hover { border-color: var(--text-3); }
.choice.selected { border-color: var(--teal); background: var(--teal-soft); box-shadow: var(--focus); }
.choice b { font-size: 16px; }
.choice span { font-size: 13px; color: var(--text-2); }
.choice svg { width: 22px; height: 22px; color: var(--teal); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 12px 16px; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3);
  border-bottom: 1px solid var(--line);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .r { text-align: right; }

/* ---------- Empty, loading, errors ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 44px 22px; color: var(--text-2);
}
.empty svg { width: 30px; height: 30px; color: var(--text-3); }
.empty b { color: var(--text); font-size: 16px; }
.skeleton {
  border-radius: 8px; min-height: 14px;
  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 linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 13.5px;
}
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--text); }
.notice.warn svg { color: var(--warn); }
.notice.err { background: var(--down-soft); border-color: transparent; color: var(--text); }
.notice.err svg { color: var(--down); }
.notice.ok { background: var(--up-soft); border-color: transparent; color: var(--text); }
.notice.ok svg { color: var(--up); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 16px;
  background: rgba(3, 8, 8, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade-in .16s var(--ease);
}
.modal {
  width: min(560px, 100%); max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-l);
  box-shadow: var(--shadow-pop);
  animation: pop-in .2s var(--ease);
}
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 12px; }
.modal-title { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.05; }
.modal-body { padding: 8px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (max-width: 600px) {
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; z-index: 200; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg);
  font-weight: 500; font-size: 14px;
  box-shadow: var(--shadow-pop);
  animation: pop-in .2s var(--ease);
}
.toast svg { width: 17px; height: 17px; flex: none; }
.toast.ok svg { color: var(--up); }
.toast.err { background: var(--down); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s var(--ease); }
@media (max-width: 900px) { .toasts { left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); align-items: stretch; } }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(60% 50% at 85% 10%, var(--teal-soft), transparent 70%),
    radial-gradient(50% 40% at 10% 95%, var(--lime-soft), transparent 70%),
    var(--bg);
}
.login-card { width: min(420px, 100%); padding: 34px 30px; }
.login-card .brand { padding: 0 0 22px; }
.login-title { font-family: var(--font-display); font-weight: 400; font-size: 44px; line-height: 1; margin-bottom: 8px; }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--line); border: 0; margin: 4px 0; }
.kbd { font: 500 11px var(--font-mono); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--text-2); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 0 var(--up); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(98, 227, 154, .5); } 70% { box-shadow: 0 0 0 8px rgba(98, 227, 154, 0); } 100% { box-shadow: 0 0 0 0 rgba(98, 227, 154, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
