/* LeadFlow UI — glass, gradients and motion. All pages share these classes. */

@view-transition { navigation: auto; }

:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f3f5fb; --bg-2: #e9edf8;
  --panel: rgba(255, 255, 255, .78); --panel-solid: #ffffff; --panel-hover: #ffffff;
  --text: #0f172a; --muted: #5b6478; --line: rgba(15, 23, 42, .08); --line-strong: rgba(15, 23, 42, .14);
  --accent: #4361ee; --accent-2: #7c3aed; --accent-3: #f59e0b; --accent-4: #06b6d4;
  --accent-soft: rgba(67, 97, 238, .1); --accent-glow: rgba(67, 97, 238, .35);
  --grad: linear-gradient(135deg, #4361ee 0%, #7c3aed 55%, #c026d3 100%);
  --grad-warm: linear-gradient(135deg, #f59e0b, #ef4444);
  --ok: #059669; --ok-soft: rgba(5, 150, 105, .12); --warn: #b45309; --warn-soft: rgba(245, 158, 11, .16);
  --bad: #dc2626; --bad-soft: rgba(220, 38, 38, .1); --info: #4361ee; --info-soft: rgba(67, 97, 238, .1);
  --muted-soft: rgba(15, 23, 42, .05);
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 2px 4px rgba(15, 23, 42, .04), 0 24px 48px -16px rgba(67, 97, 238, .28);
  --side: #0b1230; --side-text: #c7cdea; --side-muted: #7880a8; --side-hover: rgba(255, 255, 255, .06);
  --aurora-1: rgba(67, 97, 238, .22); --aurora-2: rgba(124, 58, 237, .16); --aurora-3: rgba(245, 158, 11, .14);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070b1a; --bg-2: #0b1126;
    --panel: rgba(19, 26, 52, .66); --panel-solid: #121a36; --panel-hover: rgba(26, 35, 68, .8);
    --text: #e8ebf7; --muted: #8f98bd; --line: rgba(255, 255, 255, .08); --line-strong: rgba(255, 255, 255, .14);
    --accent: #7b93ff; --accent-soft: rgba(123, 147, 255, .14); --accent-glow: rgba(123, 147, 255, .4);
    --ok: #34d399; --ok-soft: rgba(52, 211, 153, .14); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .14);
    --bad: #f87171; --bad-soft: rgba(248, 113, 113, .14); --info: #7b93ff; --info-soft: rgba(123, 147, 255, .14);
    --muted-soft: rgba(255, 255, 255, .05);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 56px -16px rgba(123, 147, 255, .35);
    --side: #050818; --aurora-1: rgba(67, 97, 238, .28); --aurora-2: rgba(124, 58, 237, .22); --aurora-3: rgba(245, 158, 11, .1);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070b1a; --bg-2: #0b1126;
  --panel: rgba(19, 26, 52, .66); --panel-solid: #121a36; --panel-hover: rgba(26, 35, 68, .8);
  --text: #e8ebf7; --muted: #8f98bd; --line: rgba(255, 255, 255, .08); --line-strong: rgba(255, 255, 255, .14);
  --accent: #7b93ff; --accent-soft: rgba(123, 147, 255, .14); --accent-glow: rgba(123, 147, 255, .4);
  --ok: #34d399; --ok-soft: rgba(52, 211, 153, .14); --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .14);
  --bad: #f87171; --bad-soft: rgba(248, 113, 113, .14); --info: #7b93ff; --info-soft: rgba(123, 147, 255, .14);
  --muted-soft: rgba(255, 255, 255, .05);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 56px -16px rgba(123, 147, 255, .35);
  --side: #050818; --aurora-1: rgba(67, 97, 238, .28); --aurora-2: rgba(124, 58, 237, .22); --aurora-3: rgba(245, 158, 11, .1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; font: 14px/1.55 var(--font); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden;
}
::selection { background: var(--accent-glow); }
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-2); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- ambient aurora background ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: linear-gradient(180deg, var(--bg), var(--bg-2)); }
.aurora span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; will-change: transform; }
.aurora span:nth-child(1) { background: radial-gradient(circle, var(--aurora-1), transparent 62%); top: -25vmax; right: -15vmax; animation: drift1 26s ease-in-out infinite alternate; }
.aurora span:nth-child(2) { background: radial-gradient(circle, var(--aurora-2), transparent 62%); bottom: -30vmax; left: 5vmax; animation: drift2 32s ease-in-out infinite alternate; }
.aurora span:nth-child(3) { background: radial-gradient(circle, var(--aurora-3), transparent 60%); top: 30%; left: 40%; width: 40vmax; height: 40vmax; animation: drift3 22s ease-in-out infinite alternate; }
.aurora::after { content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000, transparent 70%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%); }
@keyframes drift1 { to { transform: translate(-12vmax, 10vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(14vmax, -8vmax) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-10vmax, -12vmax) scale(.85); } }

/* ---------- top loading bar ---------- */
#nprogress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100; background: var(--grad);
  box-shadow: 0 0 12px var(--accent-glow); opacity: 0; transition: width .4s var(--ease), opacity .3s; }
#nprogress.run { opacity: 1; width: 75%; transition: width 6s cubic-bezier(.1, .7, .1, 1), opacity .2s; }

/* ---------- layout + sidebar ---------- */
.layout { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
nav.side {
  view-transition-name: sidebar;
  background: var(--side); color: var(--side-text); padding: 18px 14px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 2px;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .06); isolation: isolate;
}
nav.side::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 40% at 0% 0%, rgba(67, 97, 238, .35), transparent 60%),
              radial-gradient(100% 30% at 100% 100%, rgba(124, 58, 237, .28), transparent 60%); }
nav.side::-webkit-scrollbar { display: none; }
nav.side .brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; color: #fff; text-decoration: none; }
nav.side .brand:hover { color: #fff; }
.logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--grad); position: relative;
  box-shadow: 0 8px 24px -6px rgba(124, 58, 237, .7); flex: none; }
.logo svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.logo::after { content: ""; position: absolute; inset: -3px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .25);
  animation: logoPulse 3.2s ease-out infinite; }
@keyframes logoPulse { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.02em; line-height: 1.1; }
.brand-name small { display: block; font-weight: 600; font-size: 11px; color: var(--side-muted); letter-spacing: .02em; }
.brand-name b { background: linear-gradient(90deg, #8ea2ff, #f0abfc, #fcd34d, #8ea2ff); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite; }
@keyframes shine { to { background-position: 300% 0; } }

nav.side a.nav { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px;
  color: var(--side-text); font-weight: 550; transition: background .25s, color .25s, transform .25s var(--ease); }
nav.side a.nav svg.i { opacity: .75; transition: transform .35s var(--ease), opacity .25s; }
nav.side a.nav:hover { background: var(--side-hover); color: #fff; transform: translateX(3px); }
nav.side a.nav:hover svg.i { opacity: 1; transform: scale(1.12) rotate(-6deg); }
nav.side a.nav.active { color: #fff; background: linear-gradient(90deg, rgba(67, 97, 238, .38), rgba(124, 58, 237, .12)); }
nav.side a.nav.active svg.i { opacity: 1; color: #a5b4fc; }
nav.side a.nav.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--grad); box-shadow: 0 0 14px rgba(124, 58, 237, .9); }
nav.side .label-text { flex: 1; }
nav.side .group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--side-muted); margin: 18px 12px 6px; font-weight: 700; }
nav.side .count { background: var(--grad-warm); color: #fff; border-radius: 20px; padding: 0 8px; font-size: 11px; font-weight: 700; line-height: 19px;
  box-shadow: 0 4px 12px -2px rgba(239, 68, 68, .55); animation: pop .5s var(--ease); }
nav.side .count:empty, nav.side .count[data-zero] { display: none; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.side-foot { margin-top: auto; padding-top: 16px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .07); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none;
  background: var(--grad); font-size: 14px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .12); }
.me .who { flex: 1; min-width: 0; line-height: 1.25; }
.me .who a { color: #fff; font-weight: 650; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who span { color: var(--side-muted); font-size: 11.5px; text-transform: capitalize; }
.me button { background: none; border: 0; color: var(--side-muted); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; transition: .2s; }
.me button:hover { color: #fff; background: rgba(239, 68, 68, .25); }

/* ---------- top bar ---------- */
.topbar { view-transition-name: topbar; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1; max-width: 460px; }
.search svg.i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; pointer-events: none; }
.search input[type=search] { padding: 9px 44px 9px 40px; border-radius: 12px; background: var(--panel); }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
kbd { font: 600 11px var(--font); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--muted); background: var(--muted-soft); }
.topbar .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 30px; font-size: 12.5px; font-weight: 650;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); cursor: pointer; transition: transform .3s var(--ease), box-shadow .3s; }
.icon-btn:hover { transform: rotate(20deg) scale(1.06); box-shadow: 0 6px 18px -6px var(--accent-glow); }
.icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .moon { display: block; }
}

/* ---------- main + page enter motion ---------- */
.content { min-width: 0; }
main { padding: 26px 28px 70px; max-width: 1440px; width: 100%; view-transition-name: main; }
main > * { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
::view-transition-old(main) { animation: vtOut .18s ease-in both; }
::view-transition-new(main) { animation: vtIn .35s var(--ease) both; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(10px); } }

header.page { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
header.page h1 { font-size: 26px; margin: 0; font-weight: 800; letter-spacing: -.03em;
  background: linear-gradient(90deg, var(--text) 30%, var(--accent) 70%, var(--accent-2)); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; }
h1 { letter-spacing: -.02em; }
h2 { font-size: 15px; margin: 0 0 14px; font-weight: 750; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 11.5px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-weight: 700; }

/* ---------- cards ---------- */
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); margin-bottom: 18px; isolation: isolate;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}
.card::before { /* cursor spotlight, positioned by app.js */
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; opacity: 0; transition: opacity .4s; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 45%);
}
.card:hover::before { opacity: 1; }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.grid { display: grid; gap: 18px; }
.grid > .card { margin-bottom: 0; }
main > .grid, form > .grid:has(> .card) { margin-bottom: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* KPI tiles */
.kpi { overflow: hidden; }
.kpi:hover { transform: translateY(-4px); }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; padding-right: 52px; min-height: 36px; }
.kpi .value { display: inline-block; font-size: 32px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 6px 0 2px; line-height: 1.15; }
.kpi a.value, .kpi .value a { color: var(--text); }
.kpi a.value:hover, .kpi .value a:hover { color: var(--accent); }
.kpi .ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; position: absolute; right: 16px; top: 16px;
  background: var(--tone, var(--grad)); box-shadow: 0 10px 20px -8px var(--tone-glow, var(--accent-glow)); transition: transform .5s var(--ease); }
.kpi:hover .ico { transform: rotate(-10deg) scale(1.1); }
.kpi .ico svg.i { width: 20px; height: 20px; }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--tone, var(--grad));
  transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease); }
.kpi:hover::after { transform: scaleX(1); }
.t-blue { --tone: linear-gradient(135deg, #4361ee, #4cc9f0); --tone-glow: rgba(67, 97, 238, .55); }
.t-violet { --tone: linear-gradient(135deg, #7c3aed, #c026d3); --tone-glow: rgba(124, 58, 237, .55); }
.t-green { --tone: linear-gradient(135deg, #059669, #34d399); --tone-glow: rgba(5, 150, 105, .5); }
.t-amber { --tone: linear-gradient(135deg, #f59e0b, #f97316); --tone-glow: rgba(245, 158, 11, .55); }
.t-rose { --tone: linear-gradient(135deg, #e11d48, #fb7185); --tone-glow: rgba(225, 29, 72, .5); }
.t-cyan { --tone: linear-gradient(135deg, #0891b2, #22d3ee); --tone-glow: rgba(8, 145, 178, .5); }
.t-indigo { --tone: linear-gradient(135deg, #4338ca, #818cf8); --tone-glow: rgba(67, 56, 202, .5); }
.t-slate { --tone: linear-gradient(135deg, #334155, #64748b); --tone-glow: rgba(51, 65, 85, .45); }

/* hero (dashboard) */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 26px 28px; margin-bottom: 20px; color: #fff;
  background: linear-gradient(120deg, #1e2a78 0%, #4361ee 45%, #7c3aed 80%, #c026d3 110%); background-size: 160% 160%;
  animation: rise .6s var(--ease) both, heroShift 14s ease-in-out infinite alternate; box-shadow: 0 24px 48px -20px rgba(67, 97, 238, .65); }
@keyframes heroShift { to { background-position: 100% 50%; } }
.hero h1 { margin: 0 0 4px; font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.hero p { margin: 0; opacity: .85; }
.hero .actions { margin-top: 18px; }
.hero .seg { display: inline-flex; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, .14); backdrop-filter: blur(6px); gap: 2px; }
.hero .seg a { color: #fff; padding: 6px 14px; border-radius: 10px; font-weight: 650; font-size: 13px; opacity: .85; transition: .25s; }
.hero .seg a:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.hero .seg a.on { background: #fff; color: #3730a3; opacity: 1; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .35); }
.hero .orb { position: absolute; border-radius: 50%; pointer-events: none; background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 65%); }
.hero .orb.a { width: 220px; height: 220px; right: -40px; top: -70px; animation: float 9s ease-in-out infinite; }
.hero .orb.b { width: 120px; height: 120px; right: 210px; bottom: -60px; animation: float 11s ease-in-out infinite reverse; opacity: .7; }
.hero .orb.c { width: 60px; height: 60px; right: 140px; top: 24px; animation: float 7s ease-in-out infinite; opacity: .6; }
@keyframes float { 50% { transform: translate(-14px, 16px); } }
.hero .live-chip { position: absolute; right: 26px; top: 24px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; color: var(--muted); font-weight: 750; white-space: nowrap; text-transform: uppercase; letter-spacing: .07em; }
tr:last-child td { border-bottom: 0; }
tbody tr, table tr { transition: background .2s; }
tr:has(td):hover { background: var(--accent-soft); }
tr:has(td):hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tr.rv { animation: rowIn .5s var(--ease) both; animation-delay: calc(var(--r, 0) * 28ms); }
@keyframes rowIn { from { opacity: 0; transform: translateX(-8px); } }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 6px 8px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
  white-space: nowrap; background: var(--muted-soft); color: var(--muted); text-transform: capitalize; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.info { background: var(--info-soft); color: var(--info); }
.badge.bad::before, .badge.warn::before { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

.muted { color: var(--muted); } .small { font-size: 12.5px; }

/* ---------- flash + toast ---------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; margin-bottom: 14px; border: 1px solid transparent;
  font-weight: 600; animation: flashIn .6s var(--ease) both; box-shadow: var(--shadow); }
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 20%, transparent); }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.flash.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-12px) scale(.98); } }
.toast { position: fixed; right: 22px; bottom: 22px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 18px 16px 16px; box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .35); max-width: 380px; z-index: 60; overflow: hidden;
  animation: toastIn .6s var(--ease) both; display: flex; gap: 12px; }
.toast .ico { width: 36px; height: 36px; border-radius: 11px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; animation: pop .6s var(--ease); }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--grad); transform-origin: left; animation: toastTimer 9s linear forwards; }
.toast.out { animation: toastOut .4s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }
@keyframes toastTimer { to { transform: scaleX(0); } }

/* ---------- forms ---------- */
form.inline { display: inline; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 700; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--panel-solid);
  color: var(--text); font: inherit; transition: border-color .2s, box-shadow .25s, background .2s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled { opacity: .65; cursor: not-allowed; }
textarea { min-height: 90px; resize: vertical; }
textarea.tall { min-height: 260px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.field { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text); font-weight: 500; margin-bottom: 9px; cursor: pointer; }

/* ---------- buttons ---------- */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 16px;
  border-radius: 11px; border: 1px solid var(--line-strong); background: var(--panel-solid); color: var(--text); font: inherit; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: transform .25s var(--ease), box-shadow .25s, background .2s, border-color .2s; isolation: isolate; }
.btn:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 8px 18px -10px var(--accent-glow); }
.btn:active { transform: translateY(0) scale(.97); }
.btn.primary { background: var(--grad); background-size: 140% 140%; border-color: transparent; color: #fff; box-shadow: 0 8px 22px -10px rgba(124, 58, 237, .8); }
.btn.primary:hover { color: #fff; background-position: 100% 50%; box-shadow: 0 12px 28px -10px rgba(124, 58, 237, .9); }
.btn.primary::after { content: ""; position: absolute; inset: 0; z-index: -1; transform: translateX(-120%) skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); }
.btn.primary:hover::after { transition: transform .8s var(--ease); transform: translateX(120%) skewX(-20deg); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 8px 18px -10px var(--bad); }
.btn.sm { padding: 4px 11px; font-size: 12.5px; border-radius: 9px; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; transform: scale(0); background: currentColor; opacity: .25; animation: ripple .65s ease-out forwards; }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; padding: 12px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card .filters, .filters .filters { padding: 0; background: none; border: 0; box-shadow: none; }
.filters > * { width: auto; }
.filters input[type=search] { min-width: 260px; flex: 1; }

/* ---------- misc blocks ---------- */
dl.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 12px; font-weight: 700; padding-top: 2px; }
dl.kv dd { margin: 0; word-break: break-word; }
pre.msg { white-space: pre-wrap; font: inherit; background: var(--muted-soft); padding: 14px; border-radius: 12px; margin: 0; max-height: 420px; overflow: auto; border: 1px solid var(--line); }
.bar { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; margin-bottom: 9px; font-size: 13px; }
.bar .track { background: var(--muted-soft); border-radius: 20px; height: 10px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 20px; background: var(--grad); transform-origin: left; animation: grow 1.1s var(--ease) both;
  animation-delay: calc(.25s + var(--b, 0) * 70ms); box-shadow: 0 0 12px -2px var(--accent-glow); }
.card:nth-child(3n+2) .bar .fill { background: linear-gradient(90deg, #06b6d4, #4361ee); }
.card:nth-child(3n) .bar .fill { background: linear-gradient(90deg, #f59e0b, #ef4444); }
@keyframes grow { from { transform: scaleX(0); } }
.bar .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.bar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.reasons { margin: 0; padding-left: 18px; color: var(--warn); }
.fact { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
details summary { cursor: pointer; font-weight: 700; transition: color .2s; }
details summary:hover { color: var(--accent); }
details[open] > *:not(summary) { animation: rise .4s var(--ease) both; }
hr { border: 0; height: 1px; background: var(--line); margin: 16px 0; }

.empty { text-align: center; padding: 34px 10px !important; }
.empty::before { content: ""; display: block; width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; animation: float 5s ease-in-out infinite;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b93ff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z'/%3E%3Cpath d='M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z'/%3E%3C/svg%3E") center / 28px no-repeat; }
tr:has(td.empty):hover { background: none; }
tr:has(td.empty):hover td:first-child { box-shadow: none; }

/* live indicator */
.live-dot { position: relative; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.live-dot.on { background: #10b981; }
.live-dot.on::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #10b981; animation: ping 1.8s cubic-bezier(0, 0, .2, 1) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2.8); opacity: 0; } }
.live-label::after { content: "Connecting…"; }
.live-dot.on + .live-label::after { content: "Live"; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, #0b1230 0%, #1e2a78 40%, #4361ee 75%, #7c3aed 100%); background-size: 200% 200%; animation: heroShift 16s ease-in-out infinite alternate; }
.auth-art .brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; position: relative; z-index: 1; }
.auth-art h1 { font-size: clamp(30px, 3.6vw, 48px); line-height: 1.08; margin: 0 0 14px; letter-spacing: -.04em; position: relative; z-index: 1; }
.auth-art h1 span { background: linear-gradient(90deg, #fcd34d, #f0abfc, #a5b4fc, #fcd34d); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite; }
.auth-art p { opacity: .8; max-width: 440px; font-size: 15px; position: relative; z-index: 1; }
.flow { position: relative; z-index: 1; display: grid; gap: 10px; max-width: 420px; }
.flow div { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(8px); font-weight: 600; animation: rise .7s var(--ease) both; }
.flow div:nth-child(1) { animation-delay: .3s; } .flow div:nth-child(2) { animation-delay: .45s; margin-left: 24px; }
.flow div:nth-child(3) { animation-delay: .6s; margin-left: 48px; } .flow div:nth-child(4) { animation-delay: .75s; margin-left: 24px; }
.flow svg.i { color: #fcd34d; }
.grid-lines { position: absolute; inset: 0; opacity: .25;
  background-image: linear-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .12) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(circle at 70% 40%, #000, transparent 70%); -webkit-mask-image: radial-gradient(circle at 70% 40%, #000, transparent 70%);
  animation: gridMove 20s linear infinite; }
@keyframes gridMove { to { background-position: 44px 44px; } }
.blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55; }
.blob.a { width: 340px; height: 340px; right: -80px; top: 18%; background: radial-gradient(circle at 30% 30%, #f0abfc, transparent 65%); animation: float 10s ease-in-out infinite; }
.blob.b { width: 260px; height: 260px; left: 30%; bottom: -90px; background: radial-gradient(circle at 30% 30%, #fcd34d, transparent 65%); animation: float 13s ease-in-out infinite reverse; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.login { width: 100%; max-width: 400px; margin: 12vh auto; }
.auth-form .login { margin: 0; padding: 32px 30px; border-radius: 22px; animation: rise .7s var(--ease) .15s both; }
.auth-form h2 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.03em; font-weight: 800; display: block; }
.auth-form .btn.primary { width: 100%; padding: 12px; font-size: 15px; margin-top: 6px; }
.auth-form .field input { padding: 11px 14px; }

/* ---------- reduced motion + small screens ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  @view-transition { navigation: none; }
}
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  nav.side { position: sticky; z-index: 30; height: auto; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding: 10px 12px; }
  nav.side .group, nav.side .brand, nav.side .side-foot { display: none; }
  nav.side a.nav { white-space: nowrap; padding: 8px 12px; }
  nav.side a.nav:hover { transform: none; }
  nav.side a.nav.active::before { display: none; }
  .topbar { position: static; padding: 10px 16px; }
  .topbar .pill { display: none; }
  main { padding: 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 22px; min-height: 260px; }
  .flow { display: none; }
  .hero .live-chip { display: none; }
  .filters input[type=search] { min-width: 0; }
}
