/* =====================================================================================
   Sales HQ — design system (matches blakeryan.co: near-black, emerald, hairlines)
   Sections: fonts · tokens · base · background · layout/shell · sidebar · topbar ·
   page · typography · cards · kpi · buttons · forms · segmented · chips/badges ·
   tables · tabs · popovers/menus · period picker · modal/drawer/sheet · toasts ·
   skeleton · empty · tooltip · progress · avatar · charts · auth · activity ·
   utilities · responsive · reduced motion
   ===================================================================================== */

/* ---------- fonts (self-hosted, latin, variable) ---------- */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/space-grotesk-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(/assets/fonts/jetbrains-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #08090B;
  --surface: #0D0F12;
  --raised: #111418;
  --raised-2: #161A1F;
  --glass: #0E1013;
  --card: hsl(220 11% 6%);
  --input-bg: #0A0C0F;
  --input-border: hsl(220 10% 14%);
  --line: rgba(255, 255, 255, .06);
  --line-strong: rgba(255, 255, 255, .1);
  --line-hover: rgba(255, 255, 255, .16);

  --text: #fff;
  --text-2: hsl(220 9% 74%);
  --muted: hsl(0 0% 55%);
  --faint: hsl(0 0% 50%); /* small text on #0D0F12 stays >= 4.5:1 (WCAG AA) */
  --faint-ui: hsl(0 0% 38%); /* dots, rules, icons */

  --accent: #34D399;
  --accent-deep: #10B981;
  --accent-seafoam: #7CF5B0;
  --on-accent: #06231a;
  --accent-a08: rgba(52, 211, 153, .08);
  --accent-a14: rgba(52, 211, 153, .14);
  --accent-a25: rgba(52, 211, 153, .25);
  --accent-a40: rgba(52, 211, 153, .4);
  --accent-grad: linear-gradient(180deg, #7CF5B0 0%, #34D399 48%, #10B981 100%);

  --danger: #F87171;
  --danger-ink: #fca5a5;
  --warn: #fbbf24;
  --warn-soft: #FFD466;
  --info: #4F9DFF;
  --violet: #A78BFA;
  --orange: #FB923C;
  --cyan: #22D3EE;
  --pink: #F472B6;

  --r-card: 14px;
  --r-md: 12px;
  --r-sm: 10px;
  --r-xs: 8px;
  --r-pill: 999px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --t-fast: 140ms;
  --t: 220ms;
  --t-slow: 320ms;

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --shadow-pop: 0 18px 50px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, .035);
  --glow: 0 0 0 1px var(--accent-a25), 0 10px 30px -10px rgba(52, 211, 153, .45);

  --sidebar-w: 248px;
  --sidebar-rail: 72px;
  --topbar-h: 64px;
  --tabbar-h: 64px;
  --page-pad: 32px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  overflow-x: hidden;
}
img, svg { display: block; }
svg { flex-shrink: 0; }
a { color: inherit; text-decoration: none; }
a.link, .link { color: var(--accent); cursor: pointer; }
a.link:hover, .link:hover { color: var(--accent-seafoam); text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
::selection { background: rgba(52, 211, 153, .3); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.18); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- background: faint perspective grid + emerald bloom (static, fixed) ---------- */
body::before, body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
body::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .028) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 18% 0%, #000 0%, rgba(0,0,0,.55) 45%, transparent 85%);
  mask-image: radial-gradient(ellipse 80% 70% at 18% 0%, #000 0%, rgba(0,0,0,.55) 45%, transparent 85%);
}
body::after {
  background:
    radial-gradient(720px 520px at 6% -8%, rgba(52, 211, 153, .13), transparent 62%),
    radial-gradient(520px 420px at 96% -12%, rgba(16, 185, 129, .05), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(52, 211, 153, .035), transparent 60%);
}
#app { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; }

/* ---------- boot splash ---------- */
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
.boot-mark { display: grid; justify-items: center; gap: 18px; animation: fade-in .4s var(--ease) both; }
.boot-mark img { width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 0 40px -6px rgba(52,211,153,.55); }
.boot-bar { width: 120px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; position: relative; }
.boot-bar::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--accent-grad); border-radius: 2px; animation: boot-slide 1.1s var(--ease) infinite; }
@keyframes boot-slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.main { min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; padding: 24px var(--page-pad) 48px; width: 100%; max-width: 1560px; margin: 0 auto; }

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(13, 15, 18, .86), rgba(9, 10, 12, .92));
  border-right: 1px solid var(--line);
  z-index: 30;
}
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; min-height: 72px; }
.sb-brand img { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 0 22px -4px rgba(52, 211, 153, .5); }
.sb-word { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.sb-word b { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.sb-word span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.sb-section { margin-top: 18px; }
.sb-section:first-child { margin-top: 4px; }
.sb-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: hsl(0 0% 52%); padding: 0 12px 8px;
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 12px; margin: 2px 0;
  border-radius: var(--r-sm); border: 1px solid transparent;
  color: var(--muted); font-weight: 500; font-size: 13.5px;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.nav-item svg { width: 18px; height: 18px; color: currentColor; opacity: .9; transition: color var(--t-fast); }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.nav-item.is-active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(52, 211, 153, .12), rgba(52, 211, 153, .04));
  border-color: rgba(52, 211, 153, .32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 0 24px -12px rgba(52, 211, 153, .6);
}
.nav-item.is-active svg { color: var(--accent); }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--accent); color: var(--on-accent);
}
.nav-badge.warn { background: var(--warn); color: #2a1b00; }
.nav-badge.danger { background: var(--danger); color: #2b0707; }
.nav-badge[hidden] { display: none; }
.sb-foot { padding: 12px; border-top: 1px solid var(--line); }
.sb-user {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.sb-user:hover { background: rgba(255, 255, 255, .035); }
.sb-user-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.sb-user-meta { min-width: 0; line-height: 1.25; }
.sb-user-meta b { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-meta span { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.sb-signout { color: var(--muted); }
.sb-scrim { display: none; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--page-pad);
  background: linear-gradient(180deg, rgba(8, 9, 11, .97), rgba(9, 10, 12, .93));
  border-bottom: 1px solid var(--line);
}
.topbar .tb-menu { display: none; }
.tb-brand { display: none; }
.tb-title { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.tb-title h1 { font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title p { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.tb-title p:empty { display: none; }
.tb-actions { display: flex; align-items: center; gap: 10px; }
.tb-bell { position: relative; }
.tb-bell .dot {
  position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--bg), 0 0 10px var(--accent);
}
.tb-bell .dot[hidden] { display: none; }

/* ---------- page + enter motion ---------- */
.page { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.page-enter > * { animation: rise var(--t-slow) var(--ease) both; }
.page-enter > *:nth-child(1) { animation-delay: 0ms; }
.page-enter > *:nth-child(2) { animation-delay: 40ms; }
.page-enter > *:nth-child(3) { animation-delay: 80ms; }
.page-enter > *:nth-child(4) { animation-delay: 120ms; }
.page-enter > *:nth-child(5) { animation-delay: 160ms; }
.page-enter > *:nth-child(6) { animation-delay: 200ms; }
.page-enter > *:nth-child(7) { animation-delay: 240ms; }
.page-enter > *:nth-child(n+8) { animation-delay: 280ms; }
.stagger > * { animation: rise var(--t-slow) var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(n+7) { animation-delay: 240ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
.page-leave { animation: fade-out 120ms var(--ease-in) both; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }

/* ---------- typography helpers ---------- */
.h1 { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -.025em; }
.h2 { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.h3 { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.display-num { font-family: var(--font-display); font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.hero-num { font-family: var(--font-display); font-weight: 600; font-size: clamp(40px, 5vw, 56px); letter-spacing: -.035em; line-height: 1; }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-feature-settings: 'zero' 0; letter-spacing: -.01em; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 600; }
.pos { color: var(--accent); }
.neg { color: var(--danger); }
.warn-text { color: var(--warn); }
.accent { color: var(--accent); }
.gradient-text { background: linear-gradient(90deg, #fff 10%, var(--accent-seafoam) 60%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- cards ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), transform var(--t) var(--ease);
  min-width: 0;
}
.card:hover { border-color: var(--line-strong); }
.card.pad, .card-pad { padding: 20px; }
.card.pad-lg { padding: 24px; }
.card.flush { overflow: hidden; }
.card.interactive { cursor: pointer; }
.card.interactive:hover { border-color: var(--line-hover); background: #0f1115; }
.card.glow { border-color: rgba(52, 211, 153, .22); box-shadow: var(--shadow-card), 0 0 60px -30px rgba(52, 211, 153, .55); }
.card.glow::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px 180px at 0% 0%, rgba(52, 211, 153, .09), transparent 70%);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; min-height: 34px; flex-wrap: wrap; }
.card-head + .card-body { padding-top: 14px; }
.card-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.card-title svg { color: var(--muted); width: 16px; height: 16px; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 16px 20px 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-actions { display: flex; align-items: center; gap: 8px; }
.card-divider { height: 1px; background: var(--line); margin: 0 20px; }

/* grids */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-kpi.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-kpi.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-kpi.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1679px) { .grid-kpi.cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1199px) { .grid-kpi.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid-main-side { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-sm { display: flex; align-items: center; gap: 6px; }
.row.wrap, .row-sm.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.center:not(td):not(th) { display: grid; place-items: center; } /* table cells keep table layout: see .tbl .center */

/* key/value list for drawers */
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.divider-list > * + * { border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; }
.list-row:hover { background: rgba(255, 255, 255, .018); }
.list-row .meta { flex: 1; min-width: 0; }
.list-row .meta b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .meta span { font-size: 12.5px; color: var(--muted); }

/* timeline (payment schedule, audit) */
.timeline { position: relative; display: flex; flex-direction: column; gap: 0; }
.tl-item { position: relative; display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; padding: 8px 0; align-items: start; }
.tl-item::before { content: ''; position: absolute; left: 10px; top: 26px; bottom: -8px; width: 1px; background: var(--line-strong); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 21px; height: 21px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--raised); display: grid; place-items: center; }
.tl-dot svg { width: 12px; height: 12px; }
.tl-item.done .tl-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tl-item.due .tl-dot { border-color: var(--accent-a40); box-shadow: 0 0 0 3px var(--accent-a08); }
.tl-item.overdue .tl-dot { border-color: rgba(248, 113, 113, .6); background: rgba(248, 113, 113, .12); color: var(--danger); }
.tl-title { font-weight: 500; }
.tl-sub { font-size: 12.5px; color: var(--muted); }

/* ---------- KPI tiles ---------- */
.kpi { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 500; min-width: 0; }
.kpi-label > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label .kpi-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted); }
.kpi-label .kpi-ico svg { width: 14px; height: 14px; }
.kpi-value { font-family: var(--font-display); font-weight: 600; font-size: 30px; letter-spacing: -.03em; line-height: 1.05; white-space: nowrap; }
.kpi-value .unit { font-size: .6em; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-height: 32px; }
.kpi-delta-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--muted); min-width: 0; }
.kpi-vs { white-space: nowrap; }
.kpi-spark { width: 96px; height: 32px; flex-shrink: 0; }
.kpi-spark:empty { display: none; }
.kpi-hint { font-size: 12px; color: var(--muted); }
.delta {
  display: inline-flex; align-items: center; gap: 3px; width: max-content;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 2px 7px 2px 5px; border-radius: var(--r-pill);
}
.delta svg { width: 12px; height: 12px; }
.delta.up { color: var(--accent); background: var(--accent-a08); }
.delta.down { color: var(--danger); background: rgba(248, 113, 113, .09); }
.delta.flat { color: var(--muted); background: rgba(255, 255, 255, .04); }
.delta.bad.up { color: var(--danger); background: rgba(248, 113, 113, .09); }
.delta.bad.down { color: var(--accent); background: var(--accent-a08); }

/* ---------- buttons ---------- */
.btn {
  --h: 38px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 16px; border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; white-space: nowrap;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t) var(--ease), filter var(--t-fast), opacity var(--t-fast);
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: rgba(255, 255, 255, .07); border-color: var(--line-hover); }
.btn:active { transform: scale(.975); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .45; pointer-events: none; }
.btn-primary {
  background: var(--accent-grad);
  color: var(--on-accent);
  border-color: rgba(124, 245, 176, .55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(6, 35, 26, .25), 0 8px 24px -10px rgba(52, 211, 153, .75), 0 0 0 1px rgba(16, 185, 129, .25);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-primary:hover { background: var(--accent-grad); border-color: rgba(124, 245, 176, .8); filter: brightness(1.07) saturate(1.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 10px 30px -8px rgba(52, 211, 153, .85), 0 0 0 1px rgba(16, 185, 129, .35); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(.975); }
.btn-secondary { background: var(--raised); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--raised-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(255, 255, 255, .05); border-color: transparent; color: var(--text); }
.btn-danger { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .3); color: var(--danger-ink); }
.btn-danger:hover { background: rgba(248, 113, 113, .14); border-color: rgba(248, 113, 113, .5); }
.btn-danger.solid { background: linear-gradient(180deg, #fb8a8a, #ef5b5b); color: #2b0707; border-color: rgba(252, 165, 165, .6); }
.btn-outline-accent { background: var(--accent-a08); border-color: var(--accent-a40); color: var(--accent-seafoam); }
.btn-outline-accent:hover { background: var(--accent-a14); border-color: var(--accent); }
.btn-sm { --h: 30px; padding: 0 12px; font-size: 12.5px; gap: 6px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { --h: 46px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--h); padding: 0; }
.btn-icon.btn-ghost { color: var(--muted); }
.btn-icon.btn-ghost:hover { color: var(--text); }
.btn .spin { display: none; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading > :not(.spin) { opacity: 0; }
.btn.is-loading .spin { display: block; position: absolute; left: 50%; top: 50%; margin: -8px 0 0 -8px; }
.spinner, .spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--r-sm); color: var(--muted); transition: background var(--t-fast), color var(--t-fast); }
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-label .req { color: var(--accent); margin-left: 2px; }
.field-hint { font-size: 12px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--danger); display: flex; align-items: center; gap: 5px; animation: rise .2s var(--ease) both; }
.field-error:empty { display: none; }
.field-error svg { width: 13px; height: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--r-sm);
  color: var(--text); font-size: 14px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast);
  outline: none;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: hsl(220 9% 20%); }
.input:focus, .select:focus, .textarea:focus, .input-group:focus-within { border-color: rgba(52, 211, 153, .55); box-shadow: 0 0 0 3px rgba(52, 211, 153, .13); background: #0B0E10; }
.input[aria-invalid='true'], .select[aria-invalid='true'], .textarea[aria-invalid='true'], .input-group.is-invalid { border-color: rgba(248, 113, 113, .6); box-shadow: 0 0 0 3px rgba(248, 113, 113, .1); }
.input:disabled, .select:disabled, .textarea:disabled, .input[readonly] { color: var(--text-2); background: rgba(255, 255, 255, .02); }
.input.mono { font-family: var(--font-mono); font-size: 13.5px; }
.input-sm, .select.input-sm { height: 32px; font-size: 13px; }
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select {
  padding-right: 34px; cursor: pointer;
  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='%238c8c8c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select option { background: #111418; color: #fff; }
input[type='date'].input, input[type='datetime-local'].input { font-family: var(--font-mono); font-size: 13px; }
input[type='date']::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }
.input-group {
  display: flex; align-items: center; height: 40px;
  background: var(--input-bg); border: 1px solid var(--input-border); border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input-group .input { border: 0; background: transparent; box-shadow: none; height: 100%; }
.input-group .input:focus { box-shadow: none; background: transparent; }
.input-group .addon { padding: 0 0 0 12px; color: var(--muted); display: flex; align-items: center; font-family: var(--font-mono); font-size: 13.5px; }
.input-group .addon.end { padding: 0 12px 0 0; }
.input-group .addon svg { width: 16px; height: 16px; }
.input-group .icon-btn { width: 32px; height: 32px; margin-right: 4px; }
.search { position: relative; min-width: 220px; }
.search .input { padding-left: 36px; }
.search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.checkbox { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; }
.checkbox input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border-radius: 5px; border: 1px solid var(--line-hover); background: var(--input-bg); display: grid; place-items: center; transition: background var(--t-fast), border-color var(--t-fast); cursor: pointer; }
.checkbox input::after { content: ''; width: 9px; height: 5px; border-left: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent); transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform var(--t-fast) var(--ease); }
.checkbox input:checked { background: var(--accent); border-color: var(--accent); }
.checkbox input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }

/* toggle switch */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track {
  position: relative; width: 38px; height: 22px; border-radius: var(--r-pill); flex-shrink: 0;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--line-strong);
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.toggle .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #cfd3d8; box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  transition: transform var(--t) var(--ease), background var(--t);
}
.toggle input:checked + .track { background: var(--accent-deep); border-color: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(16px); background: #fff; }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle input:disabled + .track { opacity: .5; }
.toggle-text b { display: block; font-weight: 500; font-size: 13.5px; }
.toggle-text span { display: block; font-size: 12.5px; color: var(--muted); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.setting-row + .setting-row { border-top: 1px solid var(--line); }

/* password strength */
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
.strength i { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .08); transition: background var(--t); }
.strength[data-score='1'] i:nth-child(-n+1) { background: var(--danger); }
.strength[data-score='2'] i:nth-child(-n+2) { background: var(--warn); }
.strength[data-score='3'] i:nth-child(-n+3) { background: var(--accent); }
.strength[data-score='4'] i { background: var(--accent-seafoam); }

/* OTP input */
.otp { display: flex; gap: 8px; justify-content: space-between; }
.otp input { width: 100%; max-width: 52px; height: 56px; text-align: center; font-family: var(--font-mono); font-size: 22px; font-weight: 600; padding: 0; }

/* ---------- segmented control (sliding emerald thumb) ---------- */
.seg {
  position: relative; display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line-strong);
  isolation: isolate; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg-thumb {
  position: absolute; top: 3px; left: 0; height: calc(100% - 6px); width: 0; border-radius: var(--r-pill);
  background: var(--accent-grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 14px -4px rgba(52, 211, 153, .6);
  transition: transform var(--t-slow) var(--ease), width var(--t-slow) var(--ease);
  z-index: -1; pointer-events: none;
}
.seg-btn {
  height: 28px; padding: 0 13px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
  transition: color var(--t) var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { color: var(--on-accent); }
.seg-btn svg { width: 14px; height: 14px; }
.seg-btn .count { font-size: 11px; opacity: .75; font-variant-numeric: tabular-nums; }
.seg.seg-sm .seg-btn { height: 24px; padding: 0 10px; font-size: 12px; }
.seg.seg-block { display: flex; }
.seg.seg-block .seg-btn { flex: 1; justify-content: center; }
.seg.no-js .seg-btn.is-active { background: var(--accent-grad); }

/* ---------- tabs (underline) ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; position: relative; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; height: 40px; padding: 0 12px; font-weight: 500; color: var(--muted); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; transition: color var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); }
.tab.is-active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.tab .count { font-size: 11px; font-weight: 600; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); display: inline-grid; place-items: center; background: rgba(255, 255, 255, .06); color: var(--text-2); }
.tab.is-active .count { background: var(--accent-a14); color: var(--accent-seafoam); }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .025);
  font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chip svg { width: 13px; height: 13px; }
button.chip:hover, a.chip:hover { background: rgba(255, 255, 255, .06); color: var(--text); border-color: var(--line-hover); }
.chip.is-active { background: var(--accent-a14); border-color: rgba(52, 211, 153, .45); color: var(--accent-seafoam); }
.chip .count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.is-active .count { color: var(--accent); }
.chip .x { margin-right: -4px; opacity: .6; }
.chip .x:hover { opacity: 1; }
.chip-sm { height: 22px; padding: 0 8px; font-size: 11.5px; gap: 5px; }
.chip .cdot { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--muted)); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- badges / status pills ---------- */
.badge {
  --c: 148 163 184;
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px;
  border-radius: var(--r-pill); white-space: nowrap;
  font-size: 11.5px; font-weight: 600; letter-spacing: .005em; line-height: 1;
  color: rgb(var(--c));
  background: rgb(var(--c) / .1);
  border: 1px solid rgb(var(--c) / .22);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: rgb(var(--c)); flex-shrink: 0; }
.badge.no-dot::before { display: none; }
.badge.pulse::before { animation: dot-pulse 1.8s ease-out infinite; }
@keyframes dot-pulse { 0% { box-shadow: 0 0 0 0 rgb(var(--c) / .55); } 70%, 100% { box-shadow: 0 0 0 6px rgb(var(--c) / 0); } }
.badge.lg { height: 26px; padding: 0 11px 0 10px; font-size: 12.5px; }
.tone-green { --c: 52 211 153; }
.tone-seafoam { --c: 124 245 176; }
.tone-blue { --c: 96 165 250; }
.tone-amber { --c: 251 191 36; }
.tone-orange { --c: 251 146 60; }
.tone-red { --c: 248 113 113; }
.tone-violet { --c: 167 139 250; }
.tone-cyan { --c: 34 211 238; }
.tone-pink { --c: 244 114 182; }
.tone-gray { --c: 148 156 170; }
.badge.tone-gray { color: hsl(220 8% 70%); }
.count-pill { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700; background: rgba(255, 255, 255, .08); color: var(--text-2); font-variant-numeric: tabular-nums; }
.kbd { font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.04); color: var(--text-2); }

/* ---------- tables ---------- */
.table-wrap { position: relative; width: 100%; overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }
.table-wrap.scroll-y { overflow-y: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  padding: 12px 16px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; user-select: none;
}
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl th.center, .tbl td.center { text-align: center; }
.tbl th.sortable { cursor: pointer; transition: color var(--t-fast); }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .sort-ico { display: inline-block; vertical-align: -2px; margin-left: 4px; opacity: 0; transition: opacity var(--t-fast), transform var(--t) var(--ease); width: 12px; height: 12px; }
.tbl th.sortable:hover .sort-ico { opacity: .5; }
.tbl th[aria-sort='ascending'] .sort-ico, .tbl th[aria-sort='descending'] .sort-ico { opacity: 1; color: var(--accent); }
.tbl th[aria-sort='ascending'] .sort-ico { transform: rotate(180deg); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--text); }
.tbl td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; letter-spacing: -.01em; white-space: nowrap; }
.tbl td.muted { color: var(--muted); }
.tbl td.nowrap, .tbl th.nowrap { white-space: nowrap; }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, .022); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.is-selected td { background: rgba(52, 211, 153, .05); }
.tbl tbody tr.is-new td { animation: row-flash 1.6s var(--ease) both; }
@keyframes row-flash { 0% { background: rgba(52, 211, 153, .16); } 100% { background: transparent; } }
.tbl tfoot td { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 600; background: rgba(255, 255, 255, .015); }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-main b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
/* only the sub-line directly under the name (badges/chips nested deeper keep their own styles) */
.cell-main > div > span:not(.avatar) { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.tbl-compact td { padding-top: 9px; padding-bottom: 9px; }
.tbl-empty { padding: 8px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.pager .row-sm { gap: 4px; }

/* ---------- popovers, menus ---------- */
.popover {
  position: fixed; z-index: 95; /* above drawers + modals (80-81), below toasts (100) */ min-width: 200px; max-width: calc(100vw - 16px);
  background: #0F1216; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); padding: 6px;
  animation: pop-in var(--t) var(--ease) both; transform-origin: top right;
}
.popover.closing { animation: pop-out 120ms var(--ease-in) both; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop-out { to { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px;
  border-radius: var(--r-xs); font-size: 13.5px; color: var(--text-2); text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.menu-item svg { width: 16px; height: 16px; color: var(--muted); }
.menu-item:hover { background: rgba(255, 255, 255, .05); color: var(--text); outline: none; }
.menu-item:focus-visible { background: rgba(52, 211, 153, .08); box-shadow: inset 0 0 0 1px rgba(52, 211, 153, .55); color: var(--text); outline: none; }
.menu-item.danger { color: var(--danger-ink); }
.menu-item.danger svg { color: var(--danger); }
.menu-item.is-active { color: var(--text); }
.menu-item .check { margin-left: auto; color: var(--accent); width: 16px; height: 16px; }
.menu-item .hint { margin-left: auto; font-size: 11.5px; color: var(--faint); font-family: var(--font-mono); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-label { padding: 8px 10px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }

/* period picker */
.period-btn { gap: 8px; }
.period-btn .pp-label { font-weight: 600; }
.period-btn .pp-range { color: var(--muted); font-weight: 500; font-family: var(--font-mono); font-size: 12px; }
.period-pop { width: 300px; }
.period-custom { border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 6px 4px; display: grid; gap: 8px; }
.period-custom .row { gap: 8px; }
.period-custom .input { height: 34px; font-size: 12px; padding: 0 6px; flex: 1; min-width: 0; }

/* activity dropdown */
.activity-pop { width: 380px; padding: 0; overflow: hidden; }
.activity-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.activity-list { max-height: min(460px, 70vh); overflow-y: auto; }
.activity-item { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; padding: 12px 16px; align-items: start; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-item.unread { background: rgba(52, 211, 153, .035); }
.activity-item .a-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgb(var(--c, 148 156 170) / .1); color: rgb(var(--c, 148 156 170)); border: 1px solid rgb(var(--c, 148 156 170) / .2); }
.activity-item .a-ico svg { width: 15px; height: 15px; }
.activity-item .a-sum { font-size: 13px; line-height: 1.4; color: var(--text-2); }
.activity-item .a-time { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.activity-item .a-amt { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); white-space: nowrap; }
.activity-empty { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- overlays: modal / drawer / sheet ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(3, 4, 5, .62);
  animation: fade-in var(--t) var(--ease) both;
}
.overlay.closing { animation: fade-out 180ms var(--ease-in) both; }
.modal-wrap { position: fixed; inset: 0; z-index: 81; display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.modal {
  position: relative; width: 100%; max-width: 560px; max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .85), inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: modal-in 260ms var(--ease) both;
}
.modal::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(500px 160px at 0% 0%, rgba(52, 211, 153, .06), transparent 70%); }
.modal.sm { max-width: 420px; }
.modal.lg { max-width: 760px; }
.modal.xl { max-width: 980px; }
.modal.closing { animation: modal-out 160ms var(--ease-in) both; }
@keyframes modal-in { from { opacity: 0; transform: scale(.98) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: scale(.98); } }
.modal-head, .drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 14px; }
.modal-head h3, .drawer-head h3 { font-size: 18px; }
.modal-head .sub, .drawer-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.modal-body, .drawer-body { padding: 4px 22px 20px; overflow-y: auto; min-height: 0; flex: 1; position: relative; }
.modal-foot, .drawer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .left, .drawer-foot .left { margin-right: auto; }
.x-btn { margin: -4px -8px 0 0; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 81;
  width: min(580px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line-strong);
  box-shadow: -30px 0 80px -20px rgba(0, 0, 0, .7);
  animation: drawer-in var(--t-slow) var(--ease) both;
}
.drawer.wide { width: min(760px, 100vw); }
.drawer.closing { animation: drawer-out 200ms var(--ease-in) both; }
.drawer-head { border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.drawer-body { padding-top: 18px; }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawer-out { to { transform: translateX(100%); } }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81;
  max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--surface); border-top: 1px solid var(--line-strong); border-radius: 20px 20px 0 0;
  box-shadow: 0 -30px 80px -20px rgba(0, 0, 0, .7);
  padding-bottom: var(--safe-b);
  animation: sheet-in var(--t-slow) var(--ease) both;
}
.sheet.closing { animation: sheet-out 200ms var(--ease-in) both; }
.sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .18); margin: 10px auto 4px; flex-shrink: 0; }
.sheet .modal-head { padding-top: 10px; }
.sheet-body { overflow-y: auto; padding: 4px 12px 16px; }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { to { transform: translateY(100%); } }
body.no-scroll { overflow: hidden; }

/* stepper (multi-step forms) */
.steps { display: flex; gap: 6px; align-items: center; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .03); transition: all var(--t) var(--ease); }
.step.is-active { color: var(--text); }
.step.is-active .n { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-a08); }
.step.is-done .n { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.step-sep { flex: 1; min-width: 12px; height: 1px; background: var(--line-strong); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; top: calc(var(--topbar-h) + 12px); right: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  --c: 148 156 170;
  position: relative; overflow: hidden; pointer-events: auto;
  display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: start;
  padding: 13px 14px 14px; border-radius: var(--r-md);
  background: #101317; border: 1px solid var(--line-strong);
  box-shadow: 0 20px 50px -14px rgba(0, 0, 0, .8);
  animation: toast-in 360ms var(--ease) both;
}
.toast.closing { animation: toast-out 220ms var(--ease-in) both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast .t-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: rgb(var(--c)); background: rgb(var(--c) / .12); border: 1px solid rgb(var(--c) / .25); }
.toast .t-ico svg { width: 16px; height: 16px; }
.toast .t-title { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.toast .t-msg { font-size: 13px; color: var(--text-2); line-height: 1.4; margin-top: 1px; overflow-wrap: anywhere; }
.toast .t-title + .t-msg { margin-top: 2px; }
.toast .t-amt { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; color: #fff; }
.toast .t-action { margin-top: 8px; }
.toast .t-x { width: 26px; height: 26px; margin: -3px -4px 0 0; }
.toast .t-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: rgb(var(--c) / .6); transform-origin: left; animation: toast-bar linear both; }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.toast:hover .t-bar { animation-play-state: paused; }
.toast.success { --c: 52 211 153; }
.toast.error { --c: 248 113 113; }
.toast.warn { --c: 251 191 36; }
.toast.info { --c: 96 165 250; }
.toast.celebrate { --c: 52 211 153; border-color: rgba(52, 211, 153, .45); background: linear-gradient(135deg, #0f1a16, #0e1114 60%); box-shadow: 0 20px 50px -14px rgba(0, 0, 0, .8), 0 0 40px -12px rgba(52, 211, 153, .55); }
.toast.celebrate::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(124, 245, 176, .16) 45%, rgba(255, 255, 255, .1) 50%, rgba(124, 245, 176, .16) 55%, transparent 70%);
  transform: translateX(-100%); animation: shimmer-sweep 1.4s .25s var(--ease) both;
}
.toast.celebrate .t-ico { background: var(--accent-grad); color: var(--on-accent); border-color: transparent; box-shadow: 0 0 18px -2px rgba(52, 211, 153, .7); }
@keyframes shimmer-sweep { to { transform: translateX(100%); } }

/* ---------- skeleton ---------- */
.skel {
  display: block; border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .035) 0%, rgba(255, 255, 255, .075) 40%, rgba(255, 255, 255, .035) 80%);
  background-size: 250% 100%;
  animation: skel 1.4s ease-in-out infinite;
}
.skel-text { height: 12px; margin: 6px 0; }
.skel-title { height: 20px; width: 40%; }
.skel-num { height: 30px; width: 60%; border-radius: 8px; }
.skel-circle { border-radius: 50%; }
.skel-card { height: 132px; border-radius: var(--r-card); }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.is-refreshing { opacity: .55; transition: opacity var(--t) var(--ease); pointer-events: none; }

/* ---------- empty states ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 24px; gap: 6px; }
.empty.compact { padding: 28px 16px; }
.empty-ico {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 10px;
  color: var(--accent); background: radial-gradient(circle at 50% 30%, rgba(52, 211, 153, .18), rgba(52, 211, 153, .04));
  border: 1px solid rgba(52, 211, 153, .22); box-shadow: 0 0 40px -12px rgba(52, 211, 153, .5);
}
.empty.compact .empty-ico { width: 44px; height: 44px; border-radius: 13px; margin-bottom: 6px; }
.empty-ico svg { width: 24px; height: 24px; }
.empty.compact .empty-ico svg { width: 20px; height: 20px; }
.empty h4 { font-size: 16px; }
.empty p { color: var(--muted); max-width: 380px; font-size: 13.5px; }
.empty .btn { margin-top: 12px; }
.empty.tone-red .empty-ico { color: var(--danger); background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .25); box-shadow: none; }

/* ---------- tooltip ---------- */
.tip {
  position: fixed; z-index: 120; pointer-events: none; max-width: 280px;
  padding: 7px 10px; border-radius: var(--r-xs);
  background: #171B20; border: 1px solid var(--line-strong); color: var(--text);
  font-size: 12px; line-height: 1.4; box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .7);
  opacity: 0; transform: translateY(2px); transition: opacity 120ms var(--ease), transform 120ms var(--ease);
}
.tip.show { opacity: 1; transform: none; }

/* ---------- progress ---------- */
.progress { position: relative; height: 6px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .06); overflow: hidden; min-width: 60px; }
.progress > span {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent) 70%, var(--accent-seafoam));
  transition: width 700ms var(--ease);
}
.progress.sm { height: 4px; }
.progress.lg { height: 10px; }
.progress.warn > span { background: linear-gradient(90deg, #d99a0b, var(--warn)); }
.progress.danger > span { background: linear-gradient(90deg, #dc4a4a, var(--danger)); }
.progress.muted > span { background: rgba(255, 255, 255, .25); }
.progress-row { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.progress-row .progress { flex: 1; }
.progress-row .pct { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); width: 36px; text-align: right; }
.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .ring-value { font-family: var(--font-display); font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.ring .ring-label { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.ring-fill { transition: stroke-dashoffset 1100ms var(--ease); }

/* ---------- avatar ---------- */
.avatar {
  --h: 160; --s: 32px;
  width: var(--s); height: var(--s); border-radius: 50%; flex-shrink: 0;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, hsl(var(--h) 72% 60%), hsl(calc(var(--h) + 40) 70% 36%));
  color: #fff; font-weight: 700; font-size: calc(var(--s) * .38); letter-spacing: .01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 0 0 2px var(--surface);
  user-select: none;
}
.avatar.xs { --s: 20px; font-size: 9px; }
.avatar.sm { --s: 26px; }
.avatar.lg { --s: 44px; }
.avatar.xl { --s: 64px; }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -8px; }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.person .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person.none { color: var(--faint); }
.person-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.person-meta b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-meta .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.chart svg { overflow: visible; }
.chart:focus-visible { outline: none; }
.chart:focus-visible svg { outline: 1px dashed var(--accent-a40); outline-offset: 4px; border-radius: 6px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.chart-legend .lg-item { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.lg-key { display: inline-block; flex-shrink: 0; }
.lg-key.bar { width: 10px; height: 10px; border-radius: 3px; background: var(--k, var(--accent)); }
.lg-key.line { width: 16px; height: 2px; border-radius: 2px; background: var(--k, var(--accent)); }
.lg-key.dash { width: 16px; height: 0; border-top: 2px dashed var(--k, rgba(255, 255, 255, .45)); }
.lg-key.dot { width: 16px; height: 0; border-top: 2px dotted var(--k, rgba(255, 255, 255, .45)); }
.lg-key.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--k); }
.chart-axis text, .chart-tick { font-family: var(--font-mono); font-size: 10.5px; fill: #8a8f98; }
.chart-axis-r text { fill: rgba(124,245,176,.62); }
.chart-raxis-line { stroke: rgba(52,211,153,.28); stroke-width: 1; shape-rendering: crispEdges; }
.chart-grid line { stroke: rgba(255, 255, 255, .05); shape-rendering: crispEdges; }
.chart-baseline { stroke: rgba(255, 255, 255, .12); shape-rendering: crispEdges; }
.chart-cross { stroke: rgba(255, 255, 255, .28); stroke-width: 1; shape-rendering: crispEdges; }
.chart-goal-label rect { fill: #121519; stroke: rgba(255, 255, 255, .14); }
.chart-goal-label text { font-family: var(--font-sans); font-size: 10.5px; font-weight: 600; fill: var(--text-2); }
.chart-bar { transition: opacity var(--t-fast); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.chart-empty span { font-size: 13px; color: var(--muted); padding: 6px 12px; border-radius: var(--r-pill); background: rgba(8, 9, 11, .8); border: 1px solid var(--line); }
.chart-pulse { animation: chart-pulse 2.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes chart-pulse { 0% { opacity: .55; transform: scale(1); } 80%, 100% { opacity: 0; transform: scale(3.2); } }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 190px;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: rgba(16, 19, 23, .97); border: 1px solid var(--line-strong);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .8);
  font-size: 12px; opacity: 0; transition: opacity 120ms var(--ease);
}
.chart-tip.show { opacity: 1; }
.chart-tip .ct-title { font-weight: 600; color: var(--text-2); margin-bottom: 7px; font-size: 11.5px; letter-spacing: .02em; }
.chart-tip .ct-row { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; padding: 2px 0; }
.chart-tip .ct-row b { font-family: var(--font-mono); font-weight: 600; color: #fff; font-size: 12.5px; text-align: right; }
.chart-tip .ct-row span { color: var(--muted); }
.chart-tip .ct-sep { height: 1px; background: var(--line); margin: 6px 0; }
.chart-tip .ct-delta { font-size: 11.5px; font-weight: 600; }
.chart-tip .ct-delta.up { color: var(--accent); }
.chart-tip .ct-delta.down { color: var(--danger); }
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 20px 24px; flex-wrap: wrap; }
.donut { position: relative; flex-shrink: 0; }
.donut path { transition: opacity var(--t-fast), transform var(--t) var(--ease); transform-origin: center; transform-box: view-box; cursor: default; }
.donut.hovering path:not(.is-hover) { opacity: .35; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; padding: 0 16%; }
.donut-center .dc-value { font-family: var(--font-display); font-size: var(--dc-size, 22px); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; white-space: nowrap; }
.donut-center .dc-label { font-size: 11.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend { flex: 1 1 200px; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.donut-legend .dl-row { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: var(--r-xs); font-size: 13px; transition: background var(--t-fast); }
.donut-legend .dl-row:hover, .donut-legend .dl-row.is-hover { background: rgba(255, 255, 255, .04); }
.donut-legend .dl-name { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend .dl-val { font-family: var(--font-mono); font-size: 12.5px; }
.donut-legend .dl-pct { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); width: 42px; text-align: right; }
.barlist { display: flex; flex-direction: column; gap: 4px; }
.bl-row { display: grid; grid-template-columns: 22px auto 1fr auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); transition: background var(--t-fast); }
.bl-row.no-rank { grid-template-columns: auto 1fr auto; }
.bl-row:hover { background: rgba(255, 255, 255, .03); }
.bl-rank { font-family: var(--font-mono); font-size: 12px; color: var(--faint); text-align: center; }
.bl-row:nth-child(1) .bl-rank { color: var(--accent); font-weight: 700; }
.bl-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bl-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.bl-name { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.bl-track { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.bl-fill { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, rgba(16, 185, 129, .55), var(--accent)); transition: width 900ms var(--ease); }
.bl-row:nth-child(1) .bl-fill { background: linear-gradient(90deg, var(--accent-deep), var(--accent-seafoam)); box-shadow: 0 0 12px -2px rgba(52, 211, 153, .6); }
.bl-val { font-family: var(--font-mono); font-size: 13px; font-weight: 600; white-space: nowrap; text-align: right; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-left { display: flex; flex-direction: column; padding: 28px 40px; min-width: 0; }
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 26px -4px rgba(52, 211, 153, .55); }
.auth-brand b { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.auth-brand span { display: block; font-size: 12px; color: var(--muted); line-height: 1.1; }
.auth-center { flex: 1; display: grid; place-items: center; padding: 32px 0; }
.auth-card { width: 100%; max-width: 400px; animation: rise 420ms var(--ease) both; }
.auth-card h1 { font-size: 30px; letter-spacing: -.03em; }
.auth-card .lead { color: var(--muted); margin-top: 8px; font-size: 14.5px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 28px; }
.auth-form .btn-lg { margin-top: 6px; }
.auth-foot { font-size: 12px; color: var(--faint); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--r-sm); font-size: 13px; background: rgba(248, 113, 113, .08); border: 1px solid rgba(248, 113, 113, .25); color: var(--danger-ink); animation: rise .25s var(--ease) both; }
.auth-alert.info { background: rgba(96, 165, 250, .07); border-color: rgba(96, 165, 250, .25); color: #bfdbfe; }
.auth-alert.success { background: var(--accent-a08); border-color: var(--accent-a25); color: var(--accent-seafoam); }
.auth-alert svg { width: 16px; height: 16px; margin-top: 1px; flex-shrink: 0; }
.auth-right {
  position: relative; overflow: hidden; margin: 12px 12px 12px 0; border-radius: 24px;
  background:
    radial-gradient(600px 420px at 70% 20%, rgba(52, 211, 153, .16), transparent 65%),
    radial-gradient(500px 400px at 10% 100%, rgba(16, 185, 129, .1), transparent 60%),
    linear-gradient(180deg, #0B0E10, #080A0C);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between; padding: 44px;
}
.auth-right::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}
.auth-pitch { position: relative; max-width: 480px; }
.auth-pitch h2 { font-size: clamp(28px, 3vw, 40px); letter-spacing: -.035em; line-height: 1.08; }
.auth-pitch p { color: var(--text-2); margin-top: 14px; font-size: 15px; max-width: 420px; }
.auth-chips { position: relative; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.auth-chips .chip { background: rgba(8, 9, 11, .6); }
.auth-visual { position: relative; margin: 20px -44px -44px; height: 56%; min-height: 260px; }
.auth-visual svg { width: 100%; height: 100%; }
.av-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: av-draw 2.4s .3s var(--ease) forwards; }
.av-area { opacity: 0; animation: fade-in 1.4s 1.2s var(--ease) forwards; }
.av-bar { transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); animation: av-bar .9s var(--ease) forwards; }
.av-dot { opacity: 0; animation: fade-in .4s 2.5s var(--ease) forwards; }
.av-halo { opacity: 0; transform-box: fill-box; transform-origin: center; animation: chart-pulse 2.4s 2.7s ease-out infinite; }
@keyframes av-draw { to { stroke-dashoffset: 0; } }
@keyframes av-bar { to { transform: scaleY(1); } }
.av-card {
  position: absolute; padding: 12px 14px; border-radius: 14px; min-width: 170px;
  background: rgba(13, 15, 18, .92); border: 1px solid var(--line-strong); box-shadow: 0 20px 50px -18px rgba(0, 0, 0, .9);
  animation: rise .6s var(--ease) both;
}
.av-card .eyebrow { font-size: 10px; }
.av-card .row { margin-top: 8px; }
.av-card .av-skel { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .08); }
.qr-box { background: #fff; border-radius: 12px; padding: 10px; width: max-content; box-shadow: 0 0 0 1px var(--line-strong), 0 0 40px -10px rgba(52, 211, 153, .5); }
.qr-box svg { width: 180px; height: 180px; }
.secret-box { font-family: var(--font-mono); font-size: 13px; letter-spacing: .08em; padding: 10px 12px; border-radius: var(--r-sm); background: var(--input-bg); border: 1px dashed var(--line-hover); word-break: break-all; }

/* ---------- mobile tab bar ---------- */
.tabbar { display: none; }

/* ---------- utilities ---------- */
.hidden, [hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.mt-0 { margin-top: 0; } .mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.p-0 { padding: 0 !important; }
.show-mobile { display: none !important; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: rgba(255, 255, 255, .025); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.callout svg { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); flex-shrink: 0; }
.callout.accent { background: var(--accent-a08); border-color: var(--accent-a25); }
.callout.accent svg { color: var(--accent); }
.callout.warn { background: rgba(251, 191, 36, .06); border-color: rgba(251, 191, 36, .22); }
.callout.warn svg { color: var(--warn); }
.callout.danger { background: rgba(248, 113, 113, .06); border-color: rgba(248, 113, 113, .22); }
.callout.danger svg { color: var(--danger); }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--font-mono); font-size: 12.5px; }
.proof-thumb { width: 100%; max-height: 360px; object-fit: contain; border-radius: var(--r-md); border: 1px solid var(--line); background: #050607; }
.dropzone { display: grid; place-items: center; gap: 6px; text-align: center; padding: 22px; border-radius: var(--r-md); border: 1px dashed var(--line-hover); background: rgba(255, 255, 255, .015); color: var(--muted); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-a08); color: var(--text-2); }
.dropzone svg { width: 22px; height: 22px; color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 1399px) {
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1199px) {
  :root { --page-pad: 24px; }
  .shell { grid-template-columns: var(--sidebar-rail) minmax(0, 1fr); }
  .sidebar { width: var(--sidebar-rail); transition: width var(--t-slow) var(--ease), box-shadow var(--t-slow); overflow: hidden; }
  .sidebar .sb-word, .sidebar .nav-label, .sidebar .sb-label, .sidebar .sb-user-meta, .sidebar .sb-signout { display: none; }
  .sidebar .sb-brand { padding: 20px 0 18px; justify-content: center; }
  .sidebar .sb-nav { padding: 4px 12px 12px; }
  .sidebar .sb-section { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
  .sidebar .sb-section:first-child { border-top: 0; padding-top: 0; }
  .sidebar .nav-item { justify-content: center; padding: 0; }
  .sidebar .nav-badge { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .sidebar .sb-user { justify-content: center; padding: 6px 0; }
  .sidebar .sb-user-link { flex: 0; }
  .topbar .tb-menu { display: inline-grid; margin-left: -8px; }
  .shell.sb-open .sidebar {
    width: var(--sidebar-w); box-shadow: 30px 0 80px -20px rgba(0, 0, 0, .8);
    background: #0B0D10;
  }
  .shell.sb-open .sidebar .sb-word, .shell.sb-open .sidebar .nav-label, .shell.sb-open .sidebar .sb-label,
  .shell.sb-open .sidebar .sb-user-meta, .shell.sb-open .sidebar .sb-signout { display: revert; }
  .shell.sb-open .sidebar .sb-word { display: flex; }
  .shell.sb-open .sidebar .sb-brand { padding: 20px 20px 18px; justify-content: flex-start; }
  .shell.sb-open .sidebar .sb-section { border-top: 0; padding-top: 0; margin-top: 18px; }
  .shell.sb-open .sidebar .nav-item { justify-content: flex-start; padding: 0 12px; }
  .shell.sb-open .sidebar .nav-badge { position: static; min-width: 20px; height: 20px; font-size: 11px; padding: 0 6px; }
  .shell.sb-open .sidebar .sb-user { justify-content: flex-start; padding: 8px; }
  .shell.sb-open .sidebar .sb-user-link { flex: 1; }
  .shell.sb-open .sb-scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(0, 0, 0, .5); animation: fade-in var(--t) both; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .auth-right { padding: 36px; }
  .auth-visual { margin: 20px -36px -36px; }
}
@media (max-width: 1023px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period-btn .pp-range { display: none; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-right { display: none; }
  .auth-left { padding: 24px; }
}
@media (max-width: 767px) {
  :root { --page-pad: 16px; --topbar-h: 58px; }
  body { font-size: 14px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar .tb-menu { display: none; }
  .tb-brand { display: block; }
  .tb-brand img { width: 28px; height: 28px; border-radius: 8px; box-shadow: 0 0 18px -4px rgba(52, 211, 153, .5); }
  .tb-title h1 { font-size: 17px; }
  .tb-title p { display: none; }
  .tb-actions { gap: 6px; }
  .tb-actions .tb-new { display: none; }
  .period-btn { padding: 0 11px; }
  .period-btn .pp-label-long { display: none; }
  .content { padding: 16px var(--page-pad) calc(var(--tabbar-h) + 28px + var(--safe-b)); }
  .page { gap: 14px; }
  .page-head h2 { font-size: 21px; }
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: minmax(0, 1fr); }
  .grid-kpi, .grid-kpi.cols-3, .grid-kpi.cols-4, .grid-kpi.cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid { gap: 12px; }
  .span-2, .span-3 { grid-column: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 14px 16px 16px; }
  .card.pad, .card-pad { padding: 16px; }
  .kpi { padding: 14px 14px 12px; gap: 8px; }
  .kpi-value { font-size: 23px; }
  .kpi-label { font-size: 12px; }
  .kpi-label .kpi-ico { display: none; }
  .kpi-spark { width: 56px; height: 24px; }
  .kpi-vs { display: none; }
  .kpi-foot { min-height: 26px; }
  .search { min-width: 0; flex: 1; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: revert !important; }
  .toolbar { gap: 8px; }
  .list-row { padding: 12px 16px; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut-legend { flex: 0 0 auto; min-width: 0; }
  .donut { align-self: center; }

  /* tables → stacked cards */
  .tbl.cards thead { display: none; }
  .tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards tbody { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
  .tbl.cards tr { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raised); padding: 12px 14px; position: relative; }
  .tbl.cards tbody tr:hover td { background: transparent; }
  .tbl.cards tr.clickable:active { background: #14181c; }
  .tbl.cards td { border: 0; padding: 4px 0 !important; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: right; min-height: 26px; }
  .tbl.cards td::before { content: attr(data-label); font-family: var(--font-sans); font-size: 12px; color: var(--muted); font-weight: 500; text-align: left; flex-shrink: 0; letter-spacing: 0; }
  .tbl.cards td.primary { padding: 0 0 8px !important; margin-bottom: 4px; border-bottom: 1px solid var(--line); justify-content: flex-start; text-align: left; font-size: 14.5px; }
  .tbl.cards td.primary::before, .tbl.cards td.no-label::before { display: none; }
  .tbl.cards td.hide-m, .tbl.cards td:empty { display: none; }
  .tbl.cards td.num { font-size: 13px; }
  .tbl.cards tfoot { display: block; }
  .tbl.cards tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; margin: 0 12px 12px; background: rgba(255,255,255,.02); }
  .tbl.cards tfoot td { width: auto; }
  .tbl.cards .cell-main b, .tbl.cards .cell-main > div > span:not(.avatar) { max-width: 220px; }
  .pager { padding: 12px 16px; }

  /* overlays → sheets */
  .modal-wrap { place-items: end stretch; padding: 0; }
  .modal, .modal.sm, .modal.lg, .modal.xl {
    max-width: none; border-radius: 20px 20px 0 0; max-height: 94dvh; border-bottom: 0;
    animation: sheet-in var(--t-slow) var(--ease) both; padding-bottom: var(--safe-b);
  }
  .modal.closing { animation: sheet-out 200ms var(--ease-in) both; }
  .modal-head, .drawer-head { padding: 16px 16px 12px; }
  .modal-body, .drawer-body { padding: 4px 16px 16px; }
  .modal-foot, .drawer-foot { padding: 12px 16px calc(12px + var(--safe-b)); }
  .modal-foot .btn, .drawer-foot .btn { flex: 1; }
  .modal-foot .left, .drawer-foot .left { flex: 0 0 auto; }
  .drawer, .drawer.wide { width: 100vw; border-left: 0; animation: sheet-in var(--t-slow) var(--ease) both; }
  .drawer.closing { animation: sheet-out 200ms var(--ease-in) both; }
  .drawer-head { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .kv { grid-template-columns: minmax(96px, 42%) 1fr; }

  .toasts { top: auto; bottom: calc(var(--tabbar-h) + 12px + var(--safe-b)); right: 12px; left: 12px; width: auto; }
  .toast { animation-name: toast-in-m; }
  .toast.closing { animation-name: toast-out-m; }
  @keyframes toast-in-m { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  @keyframes toast-out-m { to { opacity: 0; transform: translateY(16px); } }

  .popover.period-pop, .popover.activity-pop { left: 8px !important; right: 8px !important; width: auto; }

  /* bottom tab bar */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: rgba(9, 10, 12, .97); border-top: 1px solid var(--line);
  }
  .tab-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%;
    font-size: 10.5px; font-weight: 600; color: var(--faint); position: relative; -webkit-tap-highlight-color: transparent;
  }
  .tab-item svg { width: 21px; height: 21px; }
  .tab-item.is-active { color: var(--text); }
  .tab-item.is-active svg { color: var(--accent); filter: drop-shadow(0 0 6px rgba(52, 211, 153, .6)); }
  .tab-item .nav-badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .tab-new { display: grid; place-items: center; }
  .tab-new span {
    width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; margin-top: -14px;
    background: var(--accent-grad); color: var(--on-accent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 10px 28px -6px rgba(52, 211, 153, .75), 0 0 0 4px var(--bg);
    transition: transform var(--t-fast) var(--ease);
  }
  .tab-new:active span { transform: scale(.94); }
  .tab-new svg { width: 22px; height: 22px; }
  .more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .more-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: var(--r-md); background: rgba(255, 255, 255, .03); border: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--text-2); position: relative; }
  .more-item svg { width: 20px; height: 20px; color: var(--accent); }
  .more-item.is-active { border-color: rgba(52, 211, 153, .4); background: var(--accent-a08); color: var(--text); }
  .more-item .nav-badge { position: absolute; top: 8px; right: 8px; }

  .auth-card h1 { font-size: 26px; }
  .otp input { height: 52px; font-size: 20px; }
}
@media (min-width: 768px) {
  .sheet { left: 50%; right: auto; width: 480px; transform: translateX(-50%); bottom: 16px; border-radius: 20px; border: 1px solid var(--line-strong); animation: fade-in var(--t) var(--ease) both; }
  .sheet.closing { animation: fade-out 160ms var(--ease-in) both; }
}
@media (hover: none) {
  .card:hover { border-color: var(--line); }
  .btn-primary:hover { transform: none; }
}

/* ---------- print ---------- */
@media print {
  body::before, body::after, .sidebar, .topbar, .tabbar, .toasts { display: none !important; }
  .shell { display: block; }
  .card { break-inside: avoid; border-color: #ccc; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important;
  }
  .skel { animation: none; }
  .chart-pulse, .av-halo, .badge.pulse::before { animation: none !important; opacity: 0; }
  .av-line { stroke-dashoffset: 0; }
}

/* period picker: calendar months */
.period-months { padding: 4px 4px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: grid; gap: 8px; }
.period-month-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.period-month-grid .chip.is-active { background: rgba(52, 211, 153, .14); border-color: rgba(52, 211, 153, .45); color: #7CF5B0; }

/* every sale must be marked: banner under the top bar */
.mark-banner { display: flex; align-items: center; gap: 12px; margin: 0 28px 4px; padding: 10px 16px; border-radius: 12px; color: #fde68a; text-decoration: none;
  background: linear-gradient(90deg, rgba(251,191,36,.12), rgba(251,191,36,.04)); border: 1px solid rgba(251,191,36,.32); font-size: 13.5px; }
.mark-banner[hidden] { display: none; }
.mark-banner:hover { border-color: rgba(251,191,36,.55); }
.mark-banner b { color: #fff; }
.mark-banner .grow { min-width: 0; }
.mark-banner-ico { display: grid; place-items: center; color: #fbbf24; flex: none; }
.mark-banner-cta { display: inline-flex; align-items: center; gap: 6px; flex: none; font-weight: 600; color: #fbbf24; white-space: nowrap; }
@media (max-width: 767px) { .mark-banner { margin: 0 12px 4px; font-size: 12.5px; align-items: flex-start; } }
.mark-banner { margin-top: 12px; }
