:root {
  --bg: #0b0d12; --bg2: #0f1218; --surface: #13161e; --raised: #191d27; --hover: #1f2430;
  --line: rgba(255,255,255,.07); --line2: rgba(255,255,255,.12);
  --text: #e8eaf0; --muted: #8d94a6; --faint: #5d6476;
  --accent: #7c8cff; --accent2: #b06bff; --accent-soft: rgba(124,140,255,.14);
  --green: #3ecf8e; --red: #f2555a; --amber: #f5a524; --cyan: #38bdf8; --violet: #a78bfa; --pink: #f472b6;
  --green-soft: rgba(62,207,142,.13); --red-soft: rgba(242,85,90,.13); --amber-soft: rgba(245,165,36,.13);
  --r: 14px; --r-sm: 10px; --r-lg: 20px;
  --shadow: 0 10px 30px -12px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.25);
  --ease: cubic-bezier(.2,.8,.2,1); --spring: cubic-bezier(.34,1.56,.64,1);
  --side: 248px; --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent-soft); }
.mono { font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.hidden { display: none !important; }
.spacer { flex: 1; } .mt { margin-top: 14px; } .show-m { display: none !important; }
.skel.tall { height: 180px; } .chart-wrap .skel { height: 100%; }
.lg-t { background: #7c8cff; } .lg-j { background: #3ecf8e; } .lg-l { background: #f2555a; } .dot-r { background: #f2555a; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- boot ---------- */
.boot { height: 100vh; display: grid; place-items: center; }
.boot-mark { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--accent2));
  animation: pulse 1.1s var(--ease) infinite alternate; }
@keyframes pulse { from { transform: scale(.85); opacity: .5 } to { transform: scale(1); opacity: 1 } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 18px 14px; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg2), var(--bg)); display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand img { width: 34px; height: 34px; border-radius: 10px; }
.brand b { display: block; font-size: 14px; letter-spacing: .2px; }
.brand span { font-size: 11.5px; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--muted);
  font-weight: 500; position: relative; transition: background .2s, color .2s; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--text); }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(var(--accent), var(--accent2)); animation: grow .35s var(--spring); }
@keyframes grow { from { transform: scaleY(0) } }
.side-foot { margin-top: auto; padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; } .side-foot .who b { display: block; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.avatar-txt { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; flex: none; }

.main { min-width: 0; padding: 26px clamp(16px, 3vw, 40px) 60px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 24px; margin: 0; letter-spacing: -.3px; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.page { animation: pageIn .45s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px) } }

.tabs-m { display: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: var(--r-sm);
  border: 1px solid var(--line2); background: var(--raised); cursor: pointer; font-weight: 550; white-space: nowrap;
  transition: transform .12s, background .2s, border-color .2s, opacity .2s; }
.btn:hover { background: var(--hover); border-color: rgba(255,255,255,.18); }
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { border: 0; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  box-shadow: 0 6px 20px -8px rgba(124,140,255,.7); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--red-soft); border-color: rgba(242,85,90,.35); color: #ff9a9d; }
.btn.danger:hover { background: rgba(242,85,90,.22); }
.btn.success { background: var(--green-soft); border-color: rgba(62,207,142,.35); color: #7fe7b9; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 38px; padding: 0; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.loading { pointer-events: none; color: transparent !important; position: relative; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

.input, .select, textarea.input { width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line2);
  background: var(--bg2); outline: none; transition: border-color .2s, box-shadow .2s; }
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.search svg { position: absolute; left: 12px; top: 11px; width: 17px; height: 17px; color: var(--faint); }
.search .input { padding-left: 38px; }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--bg2); border: 1px solid var(--line); position: relative; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted);
  font-weight: 550; font-size: 13px; position: relative; z-index: 1; transition: color .2s; }
.seg button.on { color: var(--text); }
.seg .pill { position: absolute; top: 3px; bottom: 3px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line2);
  transition: left .3s var(--ease), width .3s var(--ease); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line2); background: transparent; border-radius: 999px; padding: 5px 11px; font-size: 12.5px; cursor: pointer;
  color: var(--muted); font-weight: 550; transition: all .2s; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { color: var(--text); border-color: rgba(255,255,255,.2); }
.chip.on { background: var(--accent-soft); color: var(--text); border-color: rgba(124,140,255,.45); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- cards / kpis ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.card h3 { margin: 0 0 4px; font-size: 15px; } .card .hint { color: var(--muted); font-size: 12.5px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 14px; }
.kpi { position: relative; overflow: hidden; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line);
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); transition: transform .25s var(--ease), border-color .25s; }
.kpi:hover { transform: translateY(-2px); border-color: var(--line2); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(var(--glow, var(--accent-soft)), transparent 70%); }
.kpi .lbl { color: var(--muted); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 7px; }
.kpi .lbl svg { width: 15px; height: 15px; }
.kpi .val { font-size: 28px; font-weight: 700; letter-spacing: -.6px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; margin-top: 2px; color: var(--muted); }
.kpi.g { --glow: rgba(62,207,142,.18); } .kpi.g .val { color: #7fe7b9; }
.kpi.r { --glow: rgba(242,85,90,.18); } .kpi.r .val { color: #ff9a9d; }
.kpi.a { --glow: rgba(245,165,36,.16); }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98) } }

.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* ---------- chart ---------- */
.chart-wrap { position: relative; height: 320px; touch-action: pan-y; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.tip { position: absolute; pointer-events: none; background: rgba(17,20,28,.96); border: 1px solid var(--line2); border-radius: 10px;
  padding: 9px 11px; font-size: 12.5px; box-shadow: var(--shadow); min-width: 140px; transition: opacity .15s; z-index: 3; backdrop-filter: blur(6px); }
.tip b { display: block; margin-bottom: 4px; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.legend button { background: none; border: 0; color: var(--muted); cursor: pointer; display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 2px; }
.legend button.off { opacity: .4; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- lists ---------- */
.list { display: grid; gap: 2px; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; border: 1px solid transparent;
  transition: background .18s, border-color .18s, transform .18s var(--ease); animation: rise .4s var(--ease) both;
  animation-delay: calc(min(var(--i, 0), 14) * 22ms); }
.row-item:hover { background: var(--raised); border-color: var(--line); }
.row-item:active { transform: scale(.995); }
.av { width: 38px; height: 38px; border-radius: 50%; flex: none; background: var(--raised); object-fit: cover; }
.av.lg { width: 64px; height: 64px; border: 3px solid var(--surface); }
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.row-main span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.row-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.row-time { color: var(--faint); font-size: 12px; min-width: 64px; text-align: right; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--raised); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag.g { background: var(--green-soft); color: #7fe7b9; border-color: rgba(62,207,142,.25); }
.tag.r { background: var(--red-soft); color: #ff9a9d; border-color: rgba(242,85,90,.28); }
.tag.a { background: var(--amber-soft); color: #ffc46b; border-color: rgba(245,165,36,.25); }
.tag.v { background: rgba(167,139,250,.13); color: #c7b6ff; border-color: rgba(167,139,250,.28); }
.tag.c { background: rgba(56,189,248,.12); color: #8bd6fb; border-color: rgba(56,189,248,.26); }
.tag.b { background: var(--accent-soft); color: #b5beff; border-color: rgba(124,140,255,.3); }
.count { min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--amber-soft); color: #ffc46b; }

.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; color: var(--faint); margin-bottom: 10px; }
.skel { border-radius: 12px; height: 58px; margin-bottom: 4px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--raised) 45%, var(--surface) 65%); background-size: 300% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { from { background-position: 100% 0 } to { background-position: -100% 0 } }
.more { display: flex; justify-content: center; padding: 16px; }

/* ---------- activity ---------- */
.act { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 11px 12px; border-radius: 12px;
  animation: rise .35s var(--ease) both; animation-delay: calc(min(var(--i, 0), 14) * 18ms); }
.act:hover { background: var(--raised); }
.act .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--raised); }
.act .ico svg { width: 16px; height: 16px; }
.act .ico.scope { color: var(--violet); background: rgba(167,139,250,.12); }
.act .ico.vc { color: var(--cyan); background: rgba(56,189,248,.11); }
.act .ico.mod { color: var(--accent); background: var(--accent-soft); }
.act .ico.err { color: var(--red); background: var(--red-soft); }
.act .t { font-weight: 600; } .act .d { color: var(--muted); font-size: 12.5px; word-break: break-word; margin-top: 2px; }
.act .d.mono { font-size: 12px; }
.act .when { color: var(--faint); font-size: 12px; white-space: nowrap; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(62,207,142,.6); animation: ping 1.6s infinite; }
.live.off i { background: var(--faint); animation: none; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px rgba(62,207,142,0) } 100% { box-shadow: 0 0 0 0 rgba(62,207,142,0) } }

/* ---------- drawer (conviction card) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(5,6,10,.6); backdrop-filter: blur(3px); z-index: 40; opacity: 0; transition: opacity .3s; }
.scrim.in { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--bg2); border-left: 1px solid var(--line2);
  z-index: 41; transform: translateX(100%); transition: transform .42s var(--ease); display: flex; flex-direction: column; box-shadow: -30px 0 60px -20px rgba(0,0,0,.6); }
.drawer.in { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-head .grab { display: none; }
.drawer-body { overflow-y: auto; padding: 18px; flex: 1; overscroll-behavior: contain; }

.embed { position: relative; background: #2b2d31; border-radius: 6px; border-left: 4px solid var(--bar, var(--green)); padding: 14px 16px 16px;
  margin-bottom: 16px; animation: rise .45s var(--ease) both; }
.embed-top { display: flex; gap: 14px; align-items: center; }
.embed-top h2 { margin: 0; font-size: 18px; letter-spacing: -.2px; }
.embed-top .id { color: #b5bac1; font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.copy { background: none; border: 0; color: #b5bac1; cursor: pointer; padding: 2px; border-radius: 4px; display: inline-flex; }
.copy:hover { color: #fff; background: rgba(255,255,255,.08); } .copy svg { width: 13px; height: 13px; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; margin-top: 14px; }
.fields .f b { display: block; font-size: 12px; color: #f2f3f5; font-weight: 700; margin-bottom: 2px; }
.fields .f span { color: #dbdee1; font-size: 13.5px; }
.fields .wide { grid-column: 1 / -1; }
.embed-foot { margin-top: 14px; color: #949ba4; font-size: 11.5px; display: flex; gap: 8px; align-items: center; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.section-t { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: 13px; color: var(--muted); font-weight: 650;
  text-transform: uppercase; letter-spacing: .6px; }
.section-t .spacer { flex: 1; }
.notes { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; color: #d5d8e0; }

.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line2); border-radius: 2px; }
.tl { position: relative; margin-bottom: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  animation: rise .4s var(--ease) both; animation-delay: calc(min(var(--i, 0), 12) * 35ms); }
.tl::before { content: ""; position: absolute; left: -20px; top: 16px; width: 12px; height: 12px; border-radius: 50%; background: var(--k, var(--muted));
  box-shadow: 0 0 0 4px var(--bg2); }
.tl.ev { background: transparent; border-style: dashed; padding: 8px 12px; color: var(--muted); font-size: 12.5px; }
.tl.ev::before { width: 8px; height: 8px; left: -18px; top: 13px; }
.tl.removed { opacity: .5; } .tl.removed .tl-r { text-decoration: line-through; }
.tl-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-h .spacer { flex: 1; }
.tl-r { margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.tl-e { margin-top: 6px; font-size: 12.5px; word-break: break-all; }
.tl-m { color: var(--faint); font-size: 12px; }
.k-warn { --k: var(--amber); } .k-mute { --k: var(--pink); } .k-timeout { --k: var(--cyan); } .k-kick { --k: #fb923c; }
.k-ban { --k: var(--red); } .k-unban { --k: var(--green); } .k-note { --k: var(--accent); }
.k-join { --k: var(--green); } .k-leave { --k: var(--faint); }

.kind-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.kind-pick button { border: 1px solid var(--line2); background: var(--bg2); border-radius: 10px; padding: 7px 12px; cursor: pointer; color: var(--muted);
  font-weight: 600; font-size: 12.5px; display: inline-flex; align-items: center; gap: 7px; transition: all .18s; }
.kind-pick button i { width: 8px; height: 8px; border-radius: 50%; background: var(--k); }
.kind-pick button.on { color: var(--text); border-color: var(--k); background: color-mix(in srgb, var(--k) 14%, transparent); }

.inline-form { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--r); padding: 14px; margin-bottom: 16px;
  animation: rise .3s var(--ease) both; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(5,6,10,.62);
  backdrop-filter: blur(4px); animation: fade .2s both; }
.modal { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line2); border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--shadow); animation: pop .3s var(--spring) both; }
.modal h3 { margin: 0 0 6px; font-size: 17px; } .modal p { color: var(--muted); margin: 0 0 16px; }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px) } }

/* ---------- toasts ---------- */
#toasts { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: grid; gap: 8px; }
.toast { background: var(--raised); border: 1px solid var(--line2); border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow);
  display: flex; gap: 10px; align-items: center; animation: toastIn .35s var(--spring) both; max-width: 360px; }
.toast.out { animation: toastOut .25s var(--ease) both; }
.toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.toast.err i { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96) } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) } }

/* ---------- tables (admin) ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }
.status { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.status:last-child { border-bottom: 0; }
.status .s-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.status .s-dot.ok { background: var(--green); box-shadow: 0 0 10px rgba(62,207,142,.6); }
.status .s-dot.bad { background: var(--red); box-shadow: 0 0 10px rgba(242,85,90,.5); }
.status .s-main { flex: 1; min-width: 0; } .status .s-main span { display: block; color: var(--muted); font-size: 12.5px; word-break: break-word; }
pre.sql { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; overflow-x: auto; font-size: 12px; margin: 6px 0 0; color: #c6cad6; }
.linkbox { display: flex; gap: 8px; margin-top: 12px; }
.linkbox .input { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: drift 18s ease-in-out infinite alternate; }
.blob.b1 { width: 420px; height: 420px; background: #4f5bff; top: -120px; left: -100px; }
.blob.b2 { width: 380px; height: 380px; background: #9b4dff; bottom: -140px; right: -80px; animation-delay: -6s; }
.blob.b3 { width: 260px; height: 260px; background: #1fb6ff; top: 40%; left: 55%; opacity: .25; animation-delay: -11s; }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.12) } }
.auth-card { position: relative; width: min(410px, 100%); padding: 28px; border-radius: 24px; background: rgba(19,22,30,.78);
  border: 1px solid var(--line2); backdrop-filter: blur(18px); box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); animation: pop .5s var(--spring) both; }
.auth-card .brand { padding: 0 0 18px; }
.auth-card h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.3px; }
.auth-card .lead { color: var(--muted); margin: 0 0 20px; }
.auth-card .btn.primary { width: 100%; height: 44px; margin-top: 4px; }
.step { animation: stepIn .4s var(--ease) both; }
@keyframes stepIn { from { opacity: 0; transform: translateX(18px) } }
.otp { display: flex; gap: 8px; justify-content: space-between; margin: 6px 0 16px; }
.otp input { width: 100%; max-width: 50px; aspect-ratio: 5/6; text-align: center; font-size: 22px; font-weight: 700; border-radius: 12px;
  border: 1px solid var(--line2); background: var(--bg2); outline: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.otp input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); transform: translateY(-2px); }
.otp.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px) } 40%, 80% { transform: translateX(7px) } }
.qr { display: grid; place-items: center; background: #fff; border-radius: 16px; padding: 10px; width: 188px; margin: 4px auto 12px; }
.qr img { width: 168px; height: 168px; display: block; }
.secret { text-align: center; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 16px; }
.codes span { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 7px; text-align: center; letter-spacing: .5px; }
.linkish { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-weight: 550; }
.err-msg { color: #ff9a9d; font-size: 13px; min-height: 18px; margin: -6px 0 10px; }
.lock-note { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--faint); font-size: 12px; margin-top: 18px; }
.lock-note svg { width: 13px; height: 13px; }

/* ---------- mobile ---------- */
@media (max-width: 1080px) { .two { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 16px 14px calc(var(--tab-h) + var(--safe-b) + 24px); }
  .topbar { margin-bottom: 14px; } .topbar h1 { font-size: 21px; }
  .tabs-m { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + var(--safe-b));
    padding-bottom: var(--safe-b); background: rgba(13,15,21,.92); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .tabs-m a { flex: 1; display: grid; place-items: center; align-content: center; gap: 3px; color: var(--faint); font-size: 11px; font-weight: 600;
    transition: color .2s; position: relative; }
  .tabs-m a svg { width: 22px; height: 22px; transition: transform .25s var(--spring); }
  .tabs-m a.on { color: var(--text); } .tabs-m a.on svg { transform: translateY(-2px) scale(1.08); color: var(--accent); }
  .tabs-m a.on::after { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent2)); animation: grow .3s var(--spring); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px; } .kpi .val { font-size: 23px; }
  .chart-wrap { height: 250px; }
  .card { padding: 14px; border-radius: 16px; }
  .search { max-width: none; min-width: 100%; order: -1; }
  .row-time { display: none; }
  .drawer { top: auto; left: 0; width: 100%; height: 94vh; height: 94dvh; border-left: 0; border-top: 1px solid var(--line2);
    border-radius: 22px 22px 0 0; transform: translateY(100%); }
  .drawer-head .grab { display: block; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; border-radius: 4px;
    background: var(--line2); transform: translateX(-50%); }
  .drawer-head { position: relative; padding-top: 16px; }
  .drawer-body { padding: 14px 14px calc(24px + var(--safe-b)); }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #toasts { left: 14px; right: 14px; bottom: calc(var(--tab-h) + var(--safe-b) + 12px); }
  .toast { max-width: none; }
  .act { grid-template-columns: auto 1fr; } .act .when { grid-column: 2; margin-top: -4px; }
  .hide-m { display: none !important; }
  .show-m { display: inline-flex !important; }
  .topbar .seg { order: 3; width: 100%; } .topbar .seg button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

.demo-bar { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 90; padding: 5px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: rgba(245,165,36,.16); color: #ffc46b; border: 1px solid rgba(245,165,36,.35); backdrop-filter: blur(8px); pointer-events: none; white-space: nowrap; }
details.status { display: block; } details.status summary { cursor: pointer; list-style: none; } details.status summary::-webkit-details-marker { display: none; }
.embed-foot svg { width: 14px; height: 14px; flex: none; }
.embed-top .id { flex-wrap: wrap; row-gap: 2px; } .embed-top .id .mono { word-break: break-all; }
.embed-top > div { min-width: 0; }
.auth-card .secret { margin-top: 14px; }
.auth-card .qr + .secret { margin-top: 0; }
@media (max-width: 900px) { .demo-bar { top: auto; bottom: calc(var(--tab-h) + var(--safe-b) + 10px); font-size: 11px; } }
