/* Zestify BackAdmin — design system. Tailwind (CDN) supplies utilities; this file owns tokens & components. */

:root {
  --violet: #7C3AED; --violet-2: #8B5CF6; --cyan: #06B6D4; --pink: #FE2C55; --green: #10B981; --amber: #F59E0B;
  --grad: linear-gradient(120deg, #7C3AED 0%, #6D5CF6 45%, #06B6D4 100%);
  --radius: 18px; --radius-sm: 12px;
  --sidebar-w: 264px; --sidebar-w-c: 78px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-body: Inter, system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", Inter, sans-serif;
  --font-brand: Sora, Inter, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* light */
  --bg: #F6F6FB; --bg-2: #FFFFFF; --text: #0B1020; --text-2: #2A3248; --muted: #626C85; --faint: #98A1B6;
  --glass: rgba(255, 255, 255, .72); --glass-strong: rgba(255, 255, 255, .9); --glass-border: rgba(16, 24, 48, .08);
  --line: rgba(16, 24, 48, .08); --line-2: rgba(16, 24, 48, .14);
  --input: rgba(255, 255, 255, .85); --hover: rgba(124, 58, 237, .06);
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 10px 30px -12px rgba(30, 27, 75, .18), 0 2px 6px -2px rgba(30, 27, 75, .08);
  --shadow-lg: 0 30px 60px -24px rgba(30, 27, 75, .35);
  --mesh-a: rgba(124, 58, 237, .20); --mesh-b: rgba(6, 182, 212, .18); --mesh-c: rgba(254, 44, 85, .10);
  --ok-bg: rgba(16, 185, 129, .12); --ok-fg: #047857; --bad-bg: rgba(254, 44, 85, .12); --bad-fg: #D3123C;
  --warn-bg: rgba(245, 158, 11, .14); --warn-fg: #B45309; --info-bg: rgba(6, 182, 212, .12); --info-fg: #0E7490;
  --muted-bg: rgba(100, 116, 139, .12); --muted-fg: #475569;
  --skeleton: rgba(16, 24, 48, .06); --skeleton-hi: rgba(16, 24, 48, .12);
  color-scheme: light;
}
html.dark {
  --bg: #060913; --bg-2: #0B1020; --text: #E9EBF8; --text-2: #C3C8DD; --muted: #8C95B4; --faint: #5E6787;
  --glass: rgba(16, 21, 40, .58); --glass-strong: rgba(18, 24, 46, .86); --glass-border: rgba(150, 160, 255, .11);
  --line: rgba(150, 160, 255, .09); --line-2: rgba(150, 160, 255, .16);
  --input: rgba(8, 11, 24, .65); --hover: rgba(124, 58, 237, .10);
  --shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 20px 40px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(124, 58, 237, .02);
  --shadow-lg: 0 40px 80px -30px rgba(0, 0, 0, .8);
  --mesh-a: rgba(124, 58, 237, .32); --mesh-b: rgba(6, 182, 212, .20); --mesh-c: rgba(254, 44, 85, .12);
  --ok-bg: rgba(16, 185, 129, .14); --ok-fg: #34D399; --bad-bg: rgba(254, 44, 85, .15); --bad-fg: #FF6B88;
  --warn-bg: rgba(245, 158, 11, .14); --warn-fg: #FBBF24; --info-bg: rgba(6, 182, 212, .14); --info-fg: #22D3EE;
  --muted-bg: rgba(140, 149, 180, .14); --muted-fg: #A3ABC6;
  --skeleton: rgba(150, 160, 255, .06); --skeleton-hi: rgba(150, 160, 255, .13);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
body.zba { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
html.theme-anim, html.theme-anim * { transition: background-color .45s var(--ease), border-color .45s var(--ease), color .3s var(--ease), fill .3s, box-shadow .45s var(--ease) !important; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.015em; margin: 0; }
code, .mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }
code { font-size: .86em; background: var(--hover); padding: .1em .4em; border-radius: 6px; }
.icon { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .text-bad { color: var(--bad-fg) !important; }
.h2 { font-size: 17px; font-weight: 600; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; } .skip-link:focus { left: 8px; background: var(--bg-2); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--violet-2); outline-offset: 2px; border-radius: 8px; }
::selection { background: rgba(124, 58, 237, .3); }

/* ---------- animated mesh background ---------- */
.mesh { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.mesh span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(70px); opacity: .9; animation: drift 26s var(--ease) infinite alternate; }
.mesh span:nth-child(1) { background: radial-gradient(circle, var(--mesh-a), transparent 65%); top: -25vmax; left: -15vmax; }
.mesh span:nth-child(2) { background: radial-gradient(circle, var(--mesh-b), transparent 65%); top: -10vmax; right: -25vmax; animation-duration: 32s; animation-delay: -8s; }
.mesh span:nth-child(3) { background: radial-gradient(circle, var(--mesh-c), transparent 65%); bottom: -35vmax; left: 25vw; animation-duration: 38s; animation-delay: -14s; }
@keyframes drift { 0% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(6vw, 4vh, 0) scale(1.12); } 100% { transform: translate3d(-4vw, 8vh, 0) scale(.95); } }

/* ---------- glass surfaces ---------- */
.glass { background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }
.card { border-radius: var(--radius); padding: 22px; position: relative; }
.card + .card, section.card { margin-bottom: 18px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-head p { margin: 3px 0 0; font-size: 13px; }

/* ---------- layout shell ---------- */
.sidebar { position: fixed; z-index: 40; top: 12px; bottom: 12px; left: 12px; width: var(--sidebar-w); display: flex; flex-direction: column; border-radius: 22px; padding: 14px; background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); transition: width .35s var(--ease), transform .35s var(--ease); }
.shell { position: relative; z-index: 1; margin-left: calc(var(--sidebar-w) + 24px); min-height: 100vh; transition: margin-left .35s var(--ease); display: flex; flex-direction: column; }
html.sb-collapsed .sidebar { width: var(--sidebar-w-c); }
html.sb-collapsed .shell { margin-left: calc(var(--sidebar-w-c) + 24px); }
html.sb-collapsed .nav-label, html.sb-collapsed .brand-text { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
html.sb-collapsed .sb-collapse { transform: rotate(180deg); }
html.sb-collapsed .sidebar-head { flex-direction: column; gap: 10px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 16px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 6px 14px rgba(124, 58, 237, .45)); }
.brand-mark.lg svg { width: 48px; height: 48px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; white-space: nowrap; transition: opacity .2s; }
.brand-z { font: 800 17px var(--font-brand); letter-spacing: -.02em; }
.brand-b { font: 600 11px var(--font-brand); letter-spacing: .14em; text-transform: uppercase; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; transition: background .2s, color .2s; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.is-active { color: var(--text); background: linear-gradient(90deg, rgba(124, 58, 237, .18), rgba(6, 182, 212, .06)); }
.nav-item.is-active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); box-shadow: 0 0 12px var(--violet); }
.nav-item.is-active .icon { color: var(--violet-2); }
html.sb-collapsed .nav-item { justify-content: center; }
html.sb-collapsed .nav-item:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 14px); background: var(--glass-strong); border: 1px solid var(--glass-border); padding: 6px 10px; border-radius: 8px; color: var(--text); font-size: 12.5px; box-shadow: var(--shadow); }
.nav-label { transition: opacity .2s; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.token-pill { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; background: var(--muted-bg); color: var(--muted-fg); white-space: nowrap; }
.token-pill.tone-ok { background: var(--ok-bg); color: var(--ok-fg); } .token-pill.tone-bad { background: var(--bad-bg); color: var(--bad-fg); }
.token-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); flex: none; }
html.sb-collapsed .token-pill { justify-content: center; padding: 10px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font: 700 14px var(--font-brand); color: #fff; background: var(--grad); flex: none; }
.me-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.me-text strong { font-size: 13px; } .me-text small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.sb-collapsed .me { justify-content: center; }
.sb-scrim { display: none; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 18px 28px 14px 4px; }
.topbar::before { content: ""; position: absolute; inset: 0 0 -18px -24px; z-index: -1; background: linear-gradient(var(--bg) 40%, transparent); opacity: .92; pointer-events: none; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 24px; font-weight: 700; }
.topbar-title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 4px 28px 48px 4px; flex: 1; }
.md-hidden { display: none !important; }

.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--glass-border); background: var(--glass); color: var(--text-2); cursor: pointer; transition: background .2s, transform .2s var(--ease), color .2s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.theme-toggle .i-sun { display: none; } html.dark .theme-toggle .i-sun { display: grid; } html.dark .theme-toggle .i-moon { display: none; }
.theme-toggle span { display: grid; place-items: center; animation: spin-in .45s var(--ease); }
@keyframes spin-in { from { transform: rotate(-90deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.floating-toggle { position: fixed; top: 18px; right: 18px; z-index: 20; }

/* ---------- buttons, inputs ---------- */
.btn { --b: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--b); font: 600 14px var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .2s, opacity .2s; user-select: none; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn[disabled], .btn.is-loading { opacity: .5; pointer-events: none; }
.btn-primary { color: #fff; background: var(--grad); background-size: 160% 100%; box-shadow: 0 8px 22px -10px rgba(124, 58, 237, .8), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-primary:hover { background-position: 100% 0; box-shadow: 0 12px 30px -10px rgba(124, 58, 237, .95), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-danger { color: #fff; background: linear-gradient(120deg, #FE2C55, #E11D74); box-shadow: 0 8px 22px -10px rgba(254, 44, 85, .8); }
.btn-ghost { --b: var(--line-2); color: var(--text-2); background: var(--glass); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 10px; } .btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { height: 48px; font-size: 15px; border-radius: 14px; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.w-full { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span { font-weight: 500; }
.input { width: 100%; min-height: 42px; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--input); color: var(--text); font: 14px var(--font-body); transition: border-color .2s, box-shadow .2s; }
.input.mono, textarea.input { font-family: var(--font-mono); font-size: 13px; }
.input:focus { outline: none; border-color: var(--violet-2); box-shadow: 0 0 0 4px rgba(124, 58, 237, .18); }
.input::placeholder { color: var(--faint); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C95B4' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.input-otp { font: 600 22px var(--font-mono); letter-spacing: .35em; text-align: center; }
.input-sm { min-height: 34px; padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.check-field { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--text-2); align-self: end; padding-bottom: 10px; }
.check-field input, .chip-check input, .cb { accent-color: var(--violet); width: 16px; height: 16px; margin-top: 2px; flex: none; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-grid .full, .kv .full, .settings-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 10px; margin-top: 10px; }
.copy-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--input); }
.copy-row code { flex: 1; background: none; padding: 0; overflow-wrap: anywhere; color: var(--text-2); font-size: 12.5px; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--muted-bg); border: 1px solid var(--line-2); cursor: pointer; transition: background .25s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .3); transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--grad); border-color: transparent; }
.switch input:checked + span::before { transform: translateX(16px); }
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--input); color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.chip-check:has(input:checked) { border-color: var(--violet-2); background: rgba(124, 58, 237, .1); }
.chip-check code { font-size: 10.5px; opacity: .7; }
.disclosure { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.disclosure summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; }
.disclosure summary:hover { color: var(--text); }

/* ---------- badges / chips / alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-ok { background: var(--ok-bg); color: var(--ok-fg); } .tone-bad { background: var(--bad-bg); color: var(--bad-fg); }
.tone-warn { background: var(--warn-bg); color: var(--warn-fg); } .tone-info { background: var(--info-bg); color: var(--info-fg); }
.tone-muted { background: var(--muted-bg); color: var(--muted-fg); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600; background: var(--hover); color: var(--text-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.role-ADMIN { color: var(--bad-fg); } .chip.role-OPERATOR { color: var(--warn-fg); } .chip.role-ANALYST { color: var(--info-fg); }
.alert, .banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
.banner { margin-bottom: 18px; } .banner > div { flex: 1; display: flex; flex-direction: column; } .banner span { color: var(--text-2); font-size: 13px; }
.banner strong { color: var(--text); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 35%, transparent); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; z-index: 1; text-align: left; font: 600 11px var(--font-body); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 11px 12px; background: var(--glass-strong); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th[data-sort] { cursor: pointer; user-select: none; } .table th[data-sort]:hover { color: var(--text); }
.table th.sorted-asc::after { content: " ↑"; color: var(--violet-2); } .table th.sorted-desc::after { content: " ↓"; color: var(--violet-2); }
.table td { padding: 10px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-selected { background: rgba(124, 58, 237, .09); }
.table tr.is-dim { opacity: .55; }
.table tr.clickable { cursor: pointer; }
.table .num { text-align: right; font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; }
.table .id { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); }
.table .cbcell { width: 36px; }
.cell-name { font-weight: 500; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { font-size: 11.5px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 320px; }
.chips > span { white-space: nowrap; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.search { position: relative; } .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 38px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager .btn-row { margin: 0; }
.selbar { position: sticky; bottom: 16px; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-radius: 16px; margin-top: 16px; animation: rise .35s var(--ease); flex-wrap: wrap; }
.selbar strong { font-family: var(--font-mono); }
.selbar .spacer { flex: 1; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; perspective: 1200px; }
.kpi { border-radius: var(--radius); padding: 18px 18px 16px; position: relative; overflow: hidden; transform-style: preserve-3d; transition: transform .5s var(--ease), box-shadow .4s var(--ease); will-change: transform; }
.kpi::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(140deg, rgba(124, 58, 237, .5), transparent 40%, transparent 60%, rgba(6, 182, 212, .45)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; opacity: .7; }
.kpi::after { content: ""; position: absolute; inset: 0; background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .12), transparent 45%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.kpi:hover { box-shadow: var(--shadow-lg); } .kpi:hover::after { opacity: 1; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; transform: translateZ(20px); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; }
.kpi-icon .icon { width: 17px; height: 17px; }
.kpi-value { font: 700 30px/1.1 var(--font-display); letter-spacing: -.02em; transform: translateZ(34px); font-variant-numeric: tabular-nums; }
.kpi-value small { font: 500 13px var(--font-mono); color: var(--muted); margin-left: 4px; }
.kpi-foot { margin-top: 8px; font-size: 12px; color: var(--muted); transform: translateZ(14px); min-height: 18px; }
.kpi-icon.v { background: rgba(124, 58, 237, .14); color: var(--violet-2); } .kpi-icon.c { background: rgba(6, 182, 212, .14); color: var(--cyan); }
.kpi-icon.p { background: rgba(254, 44, 85, .14); color: var(--pink); } .kpi-icon.g { background: rgba(16, 185, 129, .14); color: var(--green); }

.susp-strip { display: grid; grid-template-columns: auto repeat(4, 1fr); gap: 1px; border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.susp-strip > div { padding: 14px 18px; background: var(--glass); }
.susp-strip .lead { display: flex; align-items: center; gap: 12px; font-weight: 600; font-family: var(--font-display); }
.susp-strip .lead .kpi-icon { width: 30px; height: 30px; }
.susp-strip .n { font: 700 22px var(--font-display); color: var(--bad-fg); font-variant-numeric: tabular-nums; }
.susp-strip .l { font-size: 12px; color: var(--muted); }

/* ---------- dashboard ---------- */
.hero { position: relative; border-radius: 24px; overflow: hidden; padding: 22px 24px; margin-bottom: 18px; min-height: 132px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.hero .scene3d { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.scene3d { opacity: 0; transition: opacity 1.2s var(--ease); } .scene3d.is-ready { opacity: .95; }
@media (max-width: 700px) { .hero .scene3d.is-ready { opacity: .35; } .scene3d-full.is-ready { opacity: .6; } }
.hero > :not(canvas) { position: relative; z-index: 1; }
.hero-title { font: 700 26px var(--font-display); }
.hero-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.hero-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--input); border: 1px solid var(--line-2); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--muted); font: 600 12.5px var(--font-body); padding: 6px 11px; border-radius: 9px; cursor: pointer; transition: background .2s, color .2s; }
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--grad); color: #fff; box-shadow: 0 4px 12px -4px rgba(124, 58, 237, .7); }
.date-custom { display: none; gap: 8px; align-items: center; } .date-custom.is-on { display: flex; }
.date-custom .input { min-height: 34px; padding: 5px 10px; font-size: 13px; width: 150px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-2 > .card { margin: 0; min-width: 0; }
.grid-eq { grid-template-columns: 1fr 1fr; }
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 240px; }
.legend-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.legend-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 110px; gap: 12px; align-items: center; font-size: 13px; }
.bar-list .bar-row { grid-template-columns: minmax(0, 1.25fr) minmax(60px, 1fr) auto; }
.bar-label { min-width: 0; overflow: hidden; }
.bar-row .num { font-size: 12.5px; white-space: nowrap; text-align: right; }
.bar-row.clickable { cursor: pointer; border-radius: 10px; padding: 4px 6px; margin: -4px -6px; transition: background .15s; }
.bar-row.clickable:hover, .bar-row.clickable:focus-visible { background: var(--hover); outline: none; }
.bar-track, .bar-fill { display: block; }
.bar-track { height: 8px; border-radius: 99px; background: var(--skeleton); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--grad); transform-origin: left; animation: grow .9s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.mini-note { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------- skeletons, empty states ---------- */
.skel { position: relative; overflow: hidden; background: var(--skeleton); border-radius: 8px; color: transparent !important; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--skeleton-hi), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-line { height: 12px; margin: 8px 0; } .skel-block { height: 100%; min-height: 120px; border-radius: 14px; }
.skel-row td { padding: 14px 12px; } .skel-row td::before { content: ""; display: block; height: 10px; border-radius: 6px; background: var(--skeleton); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.empty-state { text-align: center; padding: 36px 20px; }
.empty-state.small { padding: 18px; }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; }
.empty-icon .icon { width: 24px; height: 24px; }

/* ---------- key-value ---------- */
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.kv-wide { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kv dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 3px; }
.kv dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }

/* ---------- settings ---------- */
.subnav { display: flex; gap: 4px; padding: 5px; border-radius: 14px; margin-bottom: 18px; overflow-x: auto; position: sticky; top: 78px; z-index: 20; }
.subnav a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.subnav a:hover { background: var(--hover); color: var(--text); }
.subnav .icon { width: 16px; height: 16px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.settings-grid > .card { margin: 0; }
.totp-setup { display: grid; grid-template-columns: 172px 1fr; gap: 18px; align-items: start; }
.qr { width: 172px; height: 172px; padding: 10px; border-radius: 14px; background: #fff; display: grid; place-items: center; }
.qr img, .qr canvas { width: 152px !important; height: 152px !important; }
.totp-key { display: block; padding: 10px 12px; border-radius: 10px; font-size: 13px; letter-spacing: .08em; word-break: break-all; }

/* ---------- auth ---------- */
body.bare { display: grid; place-items: center; padding: 24px 16px; }
.bare-main { position: relative; z-index: 2; width: 100%; display: grid; place-items: center; }
.scene3d-full { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 1; pointer-events: none; }
.auth-card { width: 100%; max-width: 420px; border-radius: 26px; padding: 32px 30px 24px; animation: rise .6s var(--ease); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.auth-eyebrow { margin: 0; font: 600 11px var(--font-brand); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.auth-title { font: 700 25px var(--font-brand); letter-spacing: -.03em; }
.auth-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.auth-card .alert { margin-bottom: 16px; }
.auth-foot { margin: 20px 0 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--faint); }
.auth-foot .icon { width: 14px; height: 14px; }
.auth-foot a { color: var(--muted); }

/* ---------- toasts, modal, drawer ---------- */
.toasts { position: fixed; z-index: 90; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 36px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: 14px; background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow-lg); backdrop-filter: blur(18px); animation: toast-in .45s var(--ease); font-size: 13.5px; }
.toast.out { animation: toast-out .3s var(--ease) forwards; }
.toast .t-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.toast .t-ic .icon { width: 15px; height: 15px; }
.toast .t-body { flex: 1; padding-top: 4px; overflow-wrap: anywhere; }
@keyframes toast-in { from { transform: translateY(16px) scale(.96); opacity: 0; } }
@keyframes toast-out { to { transform: translateX(30px); opacity: 0; } }
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(4, 6, 14, .55); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(500px, 100%); border-radius: 22px; padding: 24px; animation: pop .35s var(--ease); max-height: calc(100vh - 32px); overflow: auto; }
@keyframes pop { from { transform: scale(.94) translateY(10px); opacity: 0; } }
.modal h3 { font-size: 19px; margin-bottom: 8px; }
.modal p { color: var(--text-2); margin: 0 0 12px; }
.modal .btn-row { justify-content: flex-end; margin-top: 20px; }
.modal-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 14px; }
.confirm-box { padding: 12px 14px; border-radius: 12px; background: var(--hover); border: 1px solid var(--line); margin: 12px 0; font-size: 13.5px; }
.confirm-box b { font-weight: 700; color: var(--text); }
.drawer-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(4, 6, 14, .45); backdrop-filter: blur(3px); animation: fade .25s; }
.drawer { position: absolute; top: 10px; right: 10px; bottom: 10px; width: min(560px, calc(100vw - 20px)); border-radius: 22px; padding: 22px; overflow-y: auto; animation: slide .4s var(--ease); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.drawer-head h3 { font-size: 20px; }
.drawer section { margin-top: 20px; }
.drawer h4 { font: 600 12px var(--font-body); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line-2); display: flex; flex-direction: column; gap: 12px; }
.timeline li { position: relative; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--violet-2); }
.timeline li.bad::before { border-color: var(--pink); background: var(--pink); }
.timeline time { display: block; font-size: 11.5px; color: var(--muted); }
.spark { width: 100%; height: 110px; display: block; }
.spark rect { fill: var(--violet-2); opacity: .85; transition: opacity .15s; }
.spark rect:hover { opacity: 1; fill: var(--cyan); }
.spark-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 4px; font-family: var(--font-mono); }

/* ---------- jobs / progress ---------- */
.progress { height: 10px; border-radius: 99px; background: var(--skeleton); overflow: hidden; position: relative; }
.progress > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--grad); transition: width .5s var(--ease); box-shadow: 0 0 18px rgba(124, 58, 237, .7); }
.progress > i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); animation: shimmer 1.6s infinite; transform: translateX(-100%); }
.progress.is-done > i::after { display: none; }
.progress > b { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #FE2C55, #E11D74); border-radius: inherit; }
.job-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.job-stat { padding: 12px 14px; border-radius: 14px; background: var(--hover); border: 1px solid var(--line); }
.job-stat .n { font: 700 22px var(--font-display); font-variant-numeric: tabular-nums; }
.job-stat .l { font-size: 12px; color: var(--muted); }
.result-list { max-height: 420px; overflow: auto; }
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.text-ok { color: var(--ok-fg); }
.steps { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.step b { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--hover); border: 1px solid var(--line-2); font: 700 12px var(--font-mono); }
.step.is-on { color: var(--text); } .step.is-on b { background: var(--grad); color: #fff; border-color: transparent; }
.step-sep { width: 22px; height: 1px; background: var(--line-2); }
.panel-grid { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
.panel-grid > .card { margin: 0; }
.panel-grid.partners-grid { grid-template-columns: 320px minmax(0, 1fr); }
.sticky-panel { position: sticky; top: 90px; }
.paste-box { min-height: 110px; resize: vertical; }
.partner-list { display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow: auto; }
.partner-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; text-align: left; background: none; color: inherit; font: inherit; width: 100%; transition: background .2s, border-color .2s; }
.partner-item:hover { background: var(--hover); }
.partner-item.is-active { border-color: var(--violet-2); background: rgba(124, 58, 237, .1); }
.partner-item .pi-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--hover); font: 700 13px var(--font-brand); flex: none; }
.partner-item .pi-main { flex: 1; min-width: 0; }
.partner-item .pi-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.partner-item .pi-count { font: 600 13px var(--font-mono); color: var(--muted); }
.details-json { font: 12px var(--font-mono); white-space: pre-wrap; word-break: break-all; color: var(--text-2); background: var(--hover); padding: 10px; border-radius: 10px; margin: 6px 0 0; max-height: 260px; overflow: auto; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .panel-grid, .panel-grid.partners-grid { grid-template-columns: 1fr; } .sticky-panel { position: static; } }
@media (max-width: 1080px) { .grid-2, .grid-eq { grid-template-columns: 1fr; } .settings-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .sidebar { transform: translateX(calc(-100% - 20px)); width: var(--sidebar-w) !important; }
  html.sb-open .sidebar { transform: none; }
  html.sb-open .sb-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(4, 6, 14, .5); backdrop-filter: blur(3px); }
  html.sb-collapsed .nav-label, html.sb-collapsed .brand-text { opacity: 1; width: auto; pointer-events: auto; }
  .sb-collapse { display: none; }
  .shell, html.sb-collapsed .shell { margin-left: 0; }
  .md-hidden { display: inline-grid !important; }
  .topbar { padding: 12px 16px 10px; } .topbar::before { inset: 0 0 -14px 0; }
  .topbar-title h1 { font-size: 20px; } .topbar-title p { display: none; }
  .content { padding: 4px 16px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi-value { font-size: 24px; }
  .susp-strip { grid-template-columns: repeat(2, 1fr); } .susp-strip .lead { grid-column: 1 / -1; }
  .job-stats { grid-template-columns: repeat(2, 1fr); }
  .totp-setup { grid-template-columns: 1fr; justify-items: center; }
  .kv { grid-template-columns: 1fr; }
  .hero { padding: 18px; } .hero-title { font-size: 21px; }
  .bar-row { grid-template-columns: 80px 1fr 90px; }
  .subnav { top: 64px; }
  .card { padding: 18px; }
}
@media (max-width: 480px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi-value { font-size: 21px; } .kpi { padding: 14px; } .inline-form { flex-direction: column; } .selbar { bottom: 10px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .mesh span { animation: none; }
}
@media print { .sidebar, .topbar-actions, .mesh, .scene3d, .toasts { display: none !important; } .shell { margin: 0 !important; } }
