:root {
  --bg: #0a0f1c; --surface: #111827; --surface-2: #0f1626; --raised: #172036;
  --border: #1f2a40; --border-strong: #2a3753;
  --text: #e6ebf5; --text-2: #b4bed3; --muted: #7a87a3;
  --accent: #3b82f6; --accent-soft: rgba(59,130,246,.14); --accent-text: #fff;
  --teal: #14b8a6; --violet: #8b5cf6; --amber: #f59e0b;
  --ok: #22c55e; --ok-soft: rgba(34,197,94,.13);
  --warn: #f59e0b; --warn-soft: rgba(245,158,11,.14);
  --danger: #ef4444; --danger-soft: rgba(239,68,68,.13);
  --sidebar: #070b15; --sidebar-text: #9aa6c0; --sidebar-active: #fff;
  --row-hover: rgba(255,255,255,.025); --flash: rgba(59,130,246,.18);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f8fafc; --raised: #ffffff;
  --border: #e3e8ef; --border-strong: #cfd7e3;
  --text: #0f172a; --text-2: #334155; --muted: #64748b;
  --accent-soft: rgba(59,130,246,.10);
  --ok-soft: rgba(34,197,94,.12); --warn-soft: rgba(245,158,11,.14); --danger-soft: rgba(239,68,68,.10);
  --sidebar: #0b1222; --row-hover: rgba(15,23,42,.025); --flash: rgba(59,130,246,.12);
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px rgba(15,23,42,.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 "Inter", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.error-text { color: var(--danger); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ------------------------------------------------ buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid transparent; background: var(--accent); color: var(--accent-text);
  font-family: inherit; font-weight: 500; font-size: 13.5px; line-height: 1; cursor: pointer; white-space: nowrap; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--raised); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); filter: none; }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--row-hover); color: var(--text); filter: none; }
.btn.danger { background: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn.sm.icon { width: 28px; }
.btn svg.i { width: 16px; height: 16px; }

input, select, textarea { font: inherit; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface-2); color: var(--text); width: 100%; outline: none;
  transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; padding: 10px 11px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field small { color: var(--muted); font-size: 11.5px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ------------------------------------------------ login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: radial-gradient(1200px 600px at 10% 10%, #1d3a8a 0%, transparent 60%),
  radial-gradient(900px 500px at 90% 90%, #0f766e 0%, transparent 55%), #070b15;
  color: #e6ebf5; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero h1 { font-size: 40px; line-height: 1.15; margin: 0 0 16px; letter-spacing: -.02em; max-width: 520px; }
.login-hero p { color: #b4bed3; font-size: 16px; max-width: 460px; margin: 0; }
.login-hero ul { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.login-hero li { display: flex; gap: 12px; align-items: center; color: #cfd7e8; }
.login-hero li span { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(255,255,255,.08); }
.login-form-wrap { display: grid; place-items: center; padding: 32px 16px; background: var(--bg); }
.login-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.login-form h2 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.login-form .btn { height: 42px; justify-content: center; font-size: 14.5px; }

.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #14b8a6); box-shadow: 0 4px 14px rgba(59,130,246,.35); }
.brand-mark svg.i { width: 19px; height: 19px; stroke-width: 2.4; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--sidebar-text); letter-spacing: .02em; }

/* ------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; border-right: 1px solid rgba(255,255,255,.04); }
.sidebar .brand { padding: 20px 20px 18px; color: #fff; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-group { font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: #56627d; padding: 18px 10px 7px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--sidebar-text); font-weight: 500; font-size: 13.5px; margin-bottom: 1px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.04); }
.nav a.active { color: var(--sidebar-active); background: linear-gradient(90deg, rgba(59,130,246,.22), rgba(59,130,246,.06));
  box-shadow: inset 2px 0 0 var(--accent); }
.nav a .live-dot { margin-left: auto; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.05); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600;
  font-size: 13px; color: #fff; background: linear-gradient(135deg, #6366f1, #3b82f6); flex-shrink: 0; }
.sidebar-foot .who { flex: 1; min-width: 0; line-height: 1.3; }
.sidebar-foot .who b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: 11.5px; text-transform: capitalize; }
.sidebar-foot .btn.ghost { color: var(--sidebar-text); }
.sidebar-foot .btn.ghost:hover { color: #fff; background: rgba(255,255,255,.06); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 14px; padding: 0 28px;
  border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.topbar .crumb { color: var(--muted); font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.menu-btn { display: none; }
main { padding: 24px 28px 40px; max-width: 1600px; width: 100%; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(34,197,94,.6);
  animation: pulse 1.8s infinite; flex-shrink: 0; }
.live-dot.off { background: var(--muted); animation: none; }
.live-dot.warn { background: var(--warn); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* ------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-h .sub { color: var(--muted); font-size: 12px; }
.card-h .spacer { flex: 1; }
.card-b { padding: 16px 18px 18px; }
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-31 { grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr); }
.mb { margin-bottom: 16px; }

.kpi { padding: 18px; display: flex; gap: 14px; align-items: flex-start; position: relative; overflow: hidden; }
.kpi-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-icon svg.i { width: 20px; height: 20px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.kpi .foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi > div:not(.kpi-icon) { position: relative; z-index: 1; min-width: 0; }
.kpi .spark { position: absolute; right: 0; bottom: 0; width: 34%; height: 38px; opacity: .45; }
.c-blue { background: rgba(59,130,246,.14); color: #60a5fa; }
.c-teal { background: rgba(20,184,166,.14); color: #2dd4bf; }
.c-violet { background: rgba(139,92,246,.15); color: #a78bfa; }
.c-amber { background: rgba(245,158,11,.15); color: #fbbf24; }

.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); }
.mini-stats div { padding: 12px 18px; border-right: 1px solid var(--border); }
.mini-stats div:last-child { border-right: 0; }
.mini-stats b { display: block; font-size: 15px; }
.mini-stats span { color: var(--muted); font-size: 11.5px; }

/* ------------------------------------------------ charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10.5px; }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; pointer-events: none; background: var(--raised); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; transform: translate(-50%, -110%); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.bar-list { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; }
.bar-row .track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--teal)); }

/* ------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--text-2); }
tbody tr:hover td { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; word-break: break-word; min-width: 280px; }
td.strong, td b { color: var(--text); font-weight: 600; }
tr.flash td { animation: flash 2.2s ease-out; }
@keyframes flash { from { background: var(--flash); } to { background: transparent; } }
tr.clickable { cursor: pointer; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty svg.i { width: 34px; height: 34px; opacity: .5; margin-bottom: 8px; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.b-accent { background: var(--accent-soft); color: #60a5fa; }
.user-link { color: var(--text); font-weight: 600; cursor: pointer; }
.user-link:hover { color: var(--accent); }
.ip { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.port { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ------------------------------------------------ toolbar / filters */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); font-family: inherit; font-weight: 500; font-size: 12.5px;
  height: 28px; padding: 0 11px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--raised); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
:root[data-theme="light"] .seg button.on { background: #fff; color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 18px; }
.tabs button { border: 0; background: none; color: var(--muted); font-family: inherit; font-weight: 600; font-size: 13.5px;
  padding: 14px 6px 12px; margin-right: 18px; cursor: pointer; border-bottom: 2px solid transparent; display: flex; gap: 8px; align-items: center; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.filters .actions { display: flex; gap: 8px; align-items: flex-end; }
.result-meta { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.result-meta b { color: var(--text); }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted); }
.pager .spacer { flex: 1; }

/* ------------------------------------------------ trace */
.trace-form { display: grid; grid-template-columns: 1.4fr .8fr 1.3fr .7fr auto; gap: 12px; align-items: end; padding: 18px; }
.trace-form .btn { height: 40px; }
.trace-form input { height: 40px; }
.identity { display: grid; grid-template-columns: auto 1fr; gap: 20px; padding: 22px; align-items: center; }
.identity .big-avatar { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(135deg, #3b82f6, #14b8a6); color: #fff; font-size: 24px; font-weight: 700; }
.identity h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 24px; padding: 0 22px 22px; }
.kv div span { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.kv div b { font-weight: 600; font-family: var(--mono); font-size: 13.5px; }
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--accent-soft);
  border: 1px solid rgba(59,130,246,.25); color: var(--text-2); font-size: 13px; }
.notice.warn { background: var(--warn-soft); border-color: rgba(245,158,11,.3); }

/* ------------------------------------------------ live */
.live-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rate { display: flex; flex-direction: column; padding: 0 16px; border-left: 1px solid var(--border); }
.rate b { font-size: 18px; }
.rate span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.feed { max-height: calc(100vh - 290px); overflow-y: auto; }
.event-list { list-style: none; margin: 0; padding: 4px 0; }
.event-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.event-list li:last-child { border-bottom: 0; }

/* ------------------------------------------------ routers */
.router-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.router-card .top { display: flex; align-items: center; gap: 12px; }
.router-card .top .kpi-icon { width: 40px; height: 40px; }
.router-card h4 { margin: 0; font-size: 15px; }
.router-card .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 12.5px; }
.router-card .meta span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

/* ------------------------------------------------ progress */
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; min-width: 140px; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--teal)); transition: width .4s; }
.progress.indet div { width: 35% !important; animation: indet 1.2s infinite ease-in-out; }
@keyframes indet { from { margin-left: -35%; } to { margin-left: 100%; } }

/* ------------------------------------------------ code */
.step { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 18px; border-bottom: 1px solid var(--border); }
.step:last-child { border-bottom: 0; }
.step-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--accent-soft); color: #60a5fa; }
.step h4 { margin: 4px 0 6px; font-size: 14.5px; }
.step p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.code { position: relative; }
.code pre { margin: 0; background: #060a14; color: #d5def0; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; font: 12.5px/1.6 var(--mono); }
.code .btn { position: absolute; top: 8px; right: 8px; }

/* ------------------------------------------------ modal / toast */
.modal-bg { position: fixed; inset: 0; background: rgba(3,6,14,.65); backdrop-filter: blur(3px); display: grid;
  place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-h { display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-h h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-b { padding: 20px; display: grid; gap: 14px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { background: var(--raised); border: 1px solid var(--border-strong); border-left: 3px solid var(--ok); border-radius: 10px;
  padding: 12px 16px; box-shadow: var(--shadow); font-size: 13px; max-width: 360px; animation: slide .2s; }
.toast.err { border-left-color: var(--danger); }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--raised), var(--surface-2)); background-size: 200% 100%;
  animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ------------------------------------------------ print (trace report) */
@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  main { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; background: #fff; }
  .print-only { display: block !important; }
  td, th { color: #000 !important; background: #fff !important; }
}
.print-only { display: none; }

/* ------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-21, .g-31, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .trace-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.5); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .topbar .hide-sm { display: none; }
  main { padding: 16px; }
  .g-4, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .trace-form { grid-template-columns: 1fr; }
  .identity { grid-template-columns: 1fr; }
}

/* ================================================================ polish layer (v2) */
:root { --radius: 14px; --sidebar-border: rgba(255,255,255,.05); --sidebar-group: #56627d;
  --sidebar-hover: rgba(255,255,255,.05); --sidebar-active-bg: linear-gradient(90deg, rgba(59,130,246,.22), rgba(59,130,246,.06));
  --sidebar-title: #fff; --ring: 0 0 0 3px var(--accent-soft); }
:root[data-theme="light"] {
  --bg: #f5f7fb; --surface: #ffffff; --surface-2: #f8fafc; --raised: #ffffff;
  --border: #e6e9f0; --border-strong: #d6dbe4; --text: #0b1220; --text-2: #3b465a; --muted: #6b7489;
  --accent: #2563eb; --accent-soft: rgba(37,99,235,.10);
  --sidebar: #ffffff; --sidebar-text: #4b5568; --sidebar-active: #1d4ed8; --sidebar-border: #e6e9f0;
  --sidebar-group: #98a1b3; --sidebar-hover: #f3f5f9; --sidebar-active-bg: #eef3ff; --sidebar-title: #0b1220;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
}
body { font-feature-settings: "cv11", "ss01"; letter-spacing: -.003em; }
.mono, .ip, .port, td { font-variant-numeric: tabular-nums; }

/* sidebar (theme aware) */
.sidebar { background: var(--sidebar); border-right: 1px solid var(--sidebar-border); }
.sidebar .brand { color: var(--sidebar-title); }
.brand small { color: var(--muted); }
.nav-group { color: var(--sidebar-group); padding: 20px 12px 6px; }
.nav a { color: var(--sidebar-text); padding: 8px 12px; gap: 12px; }
.nav a svg.i { opacity: .8; }
.nav a:hover { color: var(--sidebar-title); background: var(--sidebar-hover); }
.nav a.active { color: var(--sidebar-active); background: var(--sidebar-active-bg); box-shadow: none; font-weight: 600; }
.nav a.active svg.i { opacity: 1; }
:root:not([data-theme="light"]) .nav a.active { box-shadow: inset 2px 0 0 var(--accent); }
.sidebar-foot { border-top: 1px solid var(--sidebar-border); }
.sidebar-foot .who b { color: var(--sidebar-title); }
.sidebar-foot .btn.ghost { color: var(--sidebar-text); }
.sidebar-foot .btn.ghost:hover { color: var(--sidebar-title); background: var(--sidebar-hover); }

/* topbar */
.topbar { height: 68px; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: saturate(180%) blur(10px); }
.page-head h1 { font-size: 17px; line-height: 1.2; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.qsearch { position: relative; display: flex; align-items: center; width: 320px; }
.qsearch svg.i { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--muted); }
.qsearch input { padding-left: 34px; padding-right: 34px; height: 36px; border-radius: 10px; background: var(--surface-2); }
.qsearch kbd { position: absolute; right: 9px; font: 600 11px/1 var(--mono); color: var(--muted); border: 1px solid var(--border-strong);
  border-radius: 5px; padding: 3px 6px; background: var(--surface); }
.qsearch input:focus + kbd { display: none; }
.pill { height: 32px; border-radius: 10px; }

/* cards & layout */
.card { border-radius: var(--radius); }
.card-h { padding: 18px 20px 0; }
.card-h h3 { font-size: 14.5px; letter-spacing: -.01em; }
.card-b { padding: 16px 20px 20px; }
.grid { gap: 18px; }
.mb { margin-bottom: 18px; }
main { padding: 26px 30px 48px; }
.g-21 { align-items: stretch; }
.flex-card { display: flex; flex-direction: column; min-height: 0; }
.flex-card .card-b { flex: 1; }
.flex-card .mini-stats { margin-top: auto; }
.scroll-y { overflow-y: auto; max-height: 360px; }

/* KPI v2 */
.kpi2 { padding: 18px 20px 0; display: flex; flex-direction: column; overflow: hidden; }
.kpi2-head { display: flex; align-items: center; gap: 10px; }
.kpi-icon.sm { width: 30px; height: 30px; border-radius: 8px; }
.kpi-icon.sm svg.i { width: 16px; height: 16px; }
.kpi2 .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi2 .value { font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-top: 14px; line-height: 1.1; }
.kpi2 .foot { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.kpi2 .foot b { color: var(--text); font-weight: 600; }
.kpi2-spark { height: 44px; margin: 12px -20px 0; }
.kpi2-spark svg { width: 100%; height: 100%; display: block; position: static; opacity: 1; }
.c-blue { background: rgba(59,130,246,.12); color: #3b82f6; }
.c-teal { background: rgba(20,184,166,.12); color: #0d9488; }
.c-violet { background: rgba(139,92,246,.12); color: #7c3aed; }
.c-amber { background: rgba(245,158,11,.14); color: #d97706; }
:root:not([data-theme="light"]) .c-teal { color: #2dd4bf; }
:root:not([data-theme="light"]) .c-violet { color: #a78bfa; }
:root:not([data-theme="light"]) .c-amber { color: #fbbf24; }
:root:not([data-theme="light"]) .c-blue { color: #60a5fa; }

/* tables */
th { font-size: 11px; letter-spacing: .06em; padding: 11px 16px; }
td { padding: 11px 16px; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
tbody tr:hover td { background: var(--accent-soft); }
.t-date { color: var(--muted); font: 12px var(--mono); }
.t-time { color: var(--text); font: 600 12.5px var(--mono); }
.router-name { font-weight: 500; color: var(--text-2); white-space: nowrap; }
.user-link { font-weight: 600; }
.badge { height: 22px; border-radius: 7px; }
.badge.plain.b-muted { font-family: var(--mono); font-size: 11px; }
.result-meta { padding: 12px 20px; }
.pager { padding: 12px 20px; }

/* filters / tabs */
.tabs { padding: 0 20px; }
.tabs button { padding: 16px 4px 14px; }
.filters { padding: 18px 20px; gap: 14px 16px; }
.field > span { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.toolbar { padding: 14px 20px; }
input, select { border-radius: 9px; }
.btn { border-radius: 9px; }
.btn:not(.secondary):not(.ghost):not(.danger) { box-shadow: 0 1px 2px rgba(37,99,235,.25), inset 0 1px 0 rgba(255,255,255,.12); }

/* router cards v2 */
.router-card2 { padding: 18px 20px 0; display: flex; flex-direction: column; gap: 14px; transition: box-shadow .15s, transform .15s; }
.router-card2:hover { box-shadow: 0 8px 24px rgba(16,24,40,.08); transform: translateY(-1px); }
.rc-head { display: flex; align-items: center; gap: 12px; }
.rc-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.rc-icon.ok { background: rgba(34,197,94,.12); color: var(--ok); }
.rc-icon.warn { background: var(--warn-soft); color: var(--warn); }
.rc-icon.bad { background: var(--danger-soft); color: var(--danger); }
.rc-title { flex: 1; min-width: 0; }
.rc-title h4 { margin: 0; font-size: 15.5px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px;
  font-weight: 500; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.chip svg.i { width: 12px; height: 12px; }
.chip.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.rc-meters { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.meter-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.meter-top b { color: var(--text); font-variant-numeric: tabular-nums; }
.meter-bar { height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.meter-bar div { height: 100%; background: var(--ok); border-radius: 3px; }
.meter-bar div.warm { background: var(--warn); }
.meter-bar div.hot { background: var(--danger); }
.rc-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; }
.rc-stats:empty { display: none; }
.rstat { background: var(--surface); padding: 10px 12px; }
.rstat span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rstat b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rc-foot { display: flex; align-items: center; gap: 8px; margin: auto -20px 0; padding: 10px 14px 10px 20px; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.rc-flags { display: flex; gap: 12px; flex: 1; flex-wrap: wrap; }
.flag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.flag svg.i { width: 13px; height: 13px; }
.flag.ok { color: var(--ok); }
.flag.bad { color: var(--danger); }
.rc-actions { display: flex; gap: 2px; }

/* empty states */
.empty svg.i { width: 22px; height: 22px; opacity: 1; margin: 0; }
.empty::before { content: none; }
.empty > svg.i { display: block; box-sizing: content-box; padding: 14px; margin: 0 auto 12px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }

/* login (light) */
:root[data-theme="light"] .login-form-wrap { background: #fff; }

@media (max-width: 1200px) { .qsearch { width: 240px; } }
@media (max-width: 860px) { .page-sub { display: none; } }

.rstat:last-child:nth-child(odd) { grid-column: span 2; }

/* ================================================================ dark theme v2 */
:root[data-theme="dark"] {
  --bg: #0b0e14; --surface: #121620; --surface-2: #181d29; --raised: #1c2230;
  --border: #242b3a; --border-strong: #303949;
  --text: #e9edf5; --text-2: #bcc4d3; --muted: #8b95aa;
  --accent: #4f8cff; --accent-soft: rgba(79,140,255,.14);
  --ok: #34d399; --ok-soft: rgba(52,211,153,.12);
  --warn: #fbbf24; --warn-soft: rgba(251,191,36,.10);
  --danger: #f87171; --danger-soft: rgba(248,113,113,.12);
  --sidebar: #0e121a; --sidebar-border: #1d2330; --sidebar-text: #a3adc0; --sidebar-title: #f1f4f9;
  --sidebar-group: #5f6a80; --sidebar-hover: rgba(255,255,255,.04);
  --sidebar-active-bg: rgba(79,140,255,.14); --sidebar-active: #ffffff;
  --row-hover: rgba(79,140,255,.07); --flash: rgba(79,140,255,.20);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 1px 2px rgba(0,0,0,.4);
  --input-bg: #0f131c;
}
:root[data-theme="light"] { --input-bg: #ffffff; }
input, select, textarea { background: var(--input-bg); }
.qsearch input { background: var(--input-bg); }

:root[data-theme="dark"] .card { border-color: var(--border); }
:root[data-theme="dark"] th { background: var(--surface-2); color: #9aa4b8; border-bottom-color: var(--border); }
:root[data-theme="dark"] td { border-bottom-color: #1c2230; }
:root[data-theme="dark"] tbody tr:nth-child(even) td { background: rgba(255,255,255,.015); }
:root[data-theme="dark"] tbody tr:hover td { background: var(--row-hover); }
:root[data-theme="dark"] .field > span { color: #9aa4b8; }
:root[data-theme="dark"] .filters { background: var(--surface); border-bottom-color: var(--border); }
:root[data-theme="dark"] .toolbar, :root[data-theme="dark"] .tabs { border-bottom-color: var(--border); }
:root[data-theme="dark"] .seg { background: var(--input-bg); }
:root[data-theme="dark"] .seg button.on { background: var(--raised); color: #fff; box-shadow: 0 0 0 1px var(--border-strong); }
:root[data-theme="dark"] .btn.secondary { background: var(--surface-2); border-color: var(--border-strong); }
:root[data-theme="dark"] .btn.secondary:hover { background: var(--raised); }
:root[data-theme="dark"] .nav a.active { box-shadow: inset 2px 0 0 var(--accent); }
:root[data-theme="dark"] .topbar { background: rgba(14,18,26,.85); border-bottom-color: var(--border); }
:root[data-theme="dark"] .pill { background: var(--surface); border-color: var(--border); }
:root[data-theme="dark"] .t-time { color: #f1f4f9; }

/* status colours: readable on dark */
:root[data-theme="dark"] .b-ok { color: #34d399; }
:root[data-theme="dark"] .b-warn { color: #fbbf24; }
:root[data-theme="dark"] .b-danger { color: #fca5a5; }
:root[data-theme="dark"] .b-accent { color: #93b4ff; }
:root[data-theme="dark"] .chip { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
:root[data-theme="dark"] .chip.accent { background: var(--accent-soft); color: #93b4ff; }

/* notices */
.notice { border-radius: 12px; }
:root[data-theme="dark"] .notice { background: rgba(79,140,255,.08); border-color: rgba(79,140,255,.25); color: var(--text-2); }
:root[data-theme="dark"] .notice.warn { background: rgba(251,191,36,.07); border-color: rgba(251,191,36,.28); }
:root[data-theme="dark"] .notice.warn svg.i { color: var(--warn); }
:root[data-theme="dark"] .notice svg.i { color: var(--accent); }

/* meters, stats, code */
.meter-bar { background: var(--border); border: 0; }
:root[data-theme="dark"] .rstat { background: var(--surface); }
:root[data-theme="dark"] .rc-stats { background: var(--border); border-color: var(--border); }
:root[data-theme="dark"] .rc-foot { background: rgba(255,255,255,.02); border-top-color: var(--border); }
:root[data-theme="dark"] .code pre { background: #0a0d13; border-color: var(--border); color: #d6deec; }
:root[data-theme="dark"] .mini-stats, :root[data-theme="dark"] .mini-stats div { border-color: var(--border); }
:root[data-theme="dark"] .modal-f { background: var(--surface-2); border-top-color: var(--border); }
:root[data-theme="dark"] .modal-h { border-bottom-color: var(--border); }
:root[data-theme="dark"] .empty > svg.i { background: var(--surface-2); border-color: var(--border); }
:root[data-theme="dark"] .chart .grid-line { stroke: #222938; }
:root[data-theme="dark"] .bar-row .track { background: var(--surface-2); }
:root[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.8); }

/* live stream: keep long names and badges inside the card */
.event-list li { grid-template-columns: auto minmax(0, 1fr) auto; }
.event-list li > div:nth-child(2) { min-width: 0; }
.event-list li > div:nth-child(2) .user-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-list li > div:last-child { white-space: nowrap; }
.g-31 > .card { min-width: 0; overflow: hidden; }
:root[data-theme="dark"] .btn:not(.secondary):not(.ghost):not(.danger) { background: #2f6fed; color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.10); }
:root[data-theme="dark"] .btn:not(.secondary):not(.ghost):not(.danger):hover { background: #3b7af5; filter: none; }

/* health checks */
.hc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hc-list li { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.hc-list li:last-child { border-bottom: 0; }
.hc-list b { font-size: 13.5px; }
.hc-detail { font-size: 12.5px; color: var(--text-2); margin-top: 2px; word-break: break-word; }
.hc-action { font-size: 12.5px; color: var(--accent); margin-top: 3px; }
.hc-dot { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; }
.hc-dot svg.i { width: 14px; height: 14px; }
.hc-dot.ok { background: var(--ok-soft); color: var(--ok); }
.hc-dot.warn { background: var(--warn-soft); color: var(--warn); }
.hc-dot.fail { background: var(--danger-soft); color: var(--danger); }
.hc-banner.warn { border-color: rgba(245,158,11,.45); }
.hc-banner.fail { border-color: rgba(239,68,68,.5); }

/* notification bell */
.notif-wrap { position: relative; }
.notif-badge { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  font: 700 10.5px/17px inherit; font-family: inherit; color: #fff; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.notif-badge.warn { background: #f59e0b; }
.notif-badge.fail { background: #ef4444; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 420px; max-width: calc(100vw - 32px); z-index: 30;
  box-shadow: 0 16px 40px rgba(0,0,0,.25); overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-body { max-height: 420px; overflow-y: auto; padding: 4px 12px; }
.notif-body .empty { padding: 28px 8px; }
.notif-foot { display: block; padding: 11px 16px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 500; background: var(--surface-2); }

/* ================================================================ login v2 (animated) */
.login { position: relative; overflow: hidden; }
.login.leaving { animation: lgOut .38s ease forwards; }
@keyframes lgOut { to { opacity: 0; transform: scale(.985); filter: blur(2px); } }
.shell-in { animation: shIn .45s ease both; }
@keyframes shIn { from { opacity: 0; transform: translateY(6px); } }
.login-hero { position: relative; overflow: hidden; isolation: isolate; background: #060a14; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; z-index: -1; }
.orb.o1 { width: 520px; height: 520px; left: -140px; top: -160px; background: #1d4ed8; animation: drift1 18s ease-in-out infinite alternate; }
.orb.o2 { width: 440px; height: 440px; right: -160px; bottom: -140px; background: #0d9488; animation: drift2 22s ease-in-out infinite alternate; }
.orb.o3 { width: 300px; height: 300px; left: 40%; top: 45%; background: #7c3aed; opacity: .28; animation: drift3 26s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(120px, 90px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-110px, -70px) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-140px, 60px) scale(.85); } }
.lh-mid { display: flex; flex-direction: column; }
.login-net { width: 100%; max-width: 460px; margin: 0 0 18px -10px; }
.ln-path { fill: none; stroke: rgba(148,163,184,.22); stroke-width: 1.5; stroke-dasharray: 4 6; animation: dash 1.6s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -20; } }
.ln-dot { fill: #60a5fa; filter: drop-shadow(0 0 5px #3b82f6); }
.ln-dot.b { fill: #2dd4bf; filter: drop-shadow(0 0 5px #14b8a6); }
.ln-node rect { fill: rgba(15,23,42,.9); stroke: rgba(148,163,184,.35); }
.ln-node line { stroke: #94a3b8; stroke-width: 2; stroke-linecap: round; }
.ln-node { transform-box: fill-box; transform-origin: center; animation: nodeIn .6s cubic-bezier(.2,.8,.2,1.2) both; }
@keyframes nodeIn { from { opacity: 0; transform: scale(.6); } }
.ln-core { filter: drop-shadow(0 0 18px rgba(59,130,246,.6)); }
.ln-ring { fill: none; stroke: #3b82f6; stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ring 2.8s ease-out infinite; }
.ln-ring.r2 { animation-delay: 1.4s; }
@keyframes ring { from { opacity: .7; transform: scale(.8); } to { opacity: 0; transform: scale(1.9); } }
.ln-pulse { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; animation: beat 2.2s ease-in-out infinite; }
@keyframes beat { 0% { stroke-dashoffset: 60; } 45%, 70% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -60; } }
.login-hero h1 .grad { background: linear-gradient(90deg, #60a5fa, #2dd4bf, #a78bfa, #60a5fa); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 8s linear infinite; }
@keyframes shine { to { background-position: 300% 0; } }
.lh-foot { display: flex; align-items: center; gap: 8px; color: #7b88a6; font-size: 12px; }
.lh-in, .lf-in { animation: upIn .7s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d, 0s); }
@keyframes upIn { from { opacity: 0; transform: translateY(14px); } }
.login-form-wrap { position: relative; }
.login-form { position: relative; }
.lf-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 18px;
  background: var(--accent-soft); color: var(--accent); }
.lf-mark svg.i { width: 22px; height: 22px; }
.in-wrap { position: relative; display: flex; align-items: center; }
.in-wrap > svg.i { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); transition: color .2s; pointer-events: none; }
.in-wrap input { padding-left: 38px; height: 44px; border-radius: 10px; transition: border-color .2s, box-shadow .2s, background .2s; }
.in-wrap input[type=password], .in-wrap input[name=password] { padding-right: 42px; }
.in-wrap:focus-within > svg.i { color: var(--accent); }
.in-wrap input:focus { box-shadow: 0 0 0 4px var(--accent-soft); }
.in-eye { position: absolute; right: 6px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; }
.in-eye:hover { color: var(--text); background: var(--surface-2); }
.in-eye svg.i { width: 16px; height: 16px; }
.caps { color: var(--warn); }
.login-btn { position: relative; height: 46px !important; justify-content: center; font-size: 15px; overflow: hidden; transition: transform .15s, box-shadow .2s, filter .2s; }
.login-btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(37,99,235,.35) !important; }
.login-btn:not(:disabled):active { transform: translateY(0); }
.login-btn svg.i { transition: transform .2s; }
.login-btn:hover svg.i { transform: translateX(3px); }
.login-btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.25) 50%, transparent 70%);
  transform: translateX(-100%); }
.login-btn:not(:disabled):hover::after { animation: sweep .9s ease; }
@keyframes sweep { to { transform: translateX(100%); } }
.login-btn .spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; }
.login-btn.loading .spinner { display: block; }
.login-btn.loading .lb-text, .login-btn.loading svg.i { display: none; }
.login-btn.done { background: var(--ok) !important; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-error { min-height: 20px; font-size: 13px; color: var(--danger); text-align: center; }
.login-form.shake { animation: shake .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 15%, 85% { transform: translateX(-2px); } 30%, 70% { transform: translateX(5px); } 45%, 55% { transform: translateX(-7px); } }
@media (prefers-reduced-motion: reduce) {
  .orb, .ln-path, .ln-ring, .ln-pulse, .login-hero h1 .grad, .lh-in, .lf-in, .ln-node, .shell-in, .login.leaving { animation: none !important; }
  .ln-dot { display: none; }
}

/* login v3: less text, centred visual, glass card */
.login-hero { justify-content: space-between; }
.lh-mid { align-items: flex-start; }
.login-net { max-width: 560px; margin: 0 0 26px -16px; }
.login-hero h1 { font-size: 44px; }
.login-form-wrap { background:
    radial-gradient(600px 400px at 70% 20%, var(--accent-soft), transparent 70%),
    linear-gradient(var(--bg), var(--bg)); }
.login-form-wrap::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px; opacity: .45;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%); mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%); }
.login-card { max-width: 420px; padding: 34px 32px 26px; border-radius: 18px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 24px 60px rgba(2,6,23,.25); }
:root[data-theme="light"] .login-card { box-shadow: 0 24px 60px rgba(15,23,42,.10); }
.remember { font-size: 13px; color: var(--text-2); margin-top: -4px; }
@media (max-width: 860px) { .login-card { padding: 26px 20px; border: 0; box-shadow: none; background: transparent; backdrop-filter: none; } }
td.right { text-align: right; }
.btn.ghost.danger-text { color: var(--danger); }
.btn.ghost.danger-text svg { stroke: currentColor; }
