:root {
  --bg: #070b14;
  --bg-grad: radial-gradient(1200px 700px at 8% -10%, rgba(0, 212, 126, .14), transparent 55%),
             radial-gradient(900px 600px at 100% 0%, rgba(56, 189, 248, .12), transparent 50%),
             #070b14;
  --panel: rgba(16, 25, 42, .78);
  --panel-solid: #0e1728;
  --panel-2: rgba(25, 37, 58, .72);
  --border: rgba(148, 163, 184, .14);
  --border-strong: rgba(148, 163, 184, .26);
  --text: #e9eff9;
  --text-2: #c2cede;
  --muted: #8294ad;
  --accent: #00d47e;
  --accent-soft: rgba(0, 212, 126, .13);
  --accent-2: #38bdf8;
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, .12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --purple: #a78bfa;
  --shadow: 0 18px 50px rgba(2, 6, 18, .45);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 246px;
  --font: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html[data-theme="light"] {
  --bg: #f3f6fb;
  --bg-grad: radial-gradient(1100px 600px at 5% -10%, rgba(0, 180, 110, .10), transparent 55%),
             radial-gradient(900px 500px at 100% 0%, rgba(56, 189, 248, .10), transparent 50%),
             #f3f6fb;
  --panel: rgba(255, 255, 255, .88);
  --panel-solid: #ffffff;
  --panel-2: #f7f9fc;
  --border: rgba(15, 23, 42, .09);
  --border-strong: rgba(15, 23, 42, .16);
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #00a866;
  --accent-soft: rgba(0, 168, 102, .10);
  --accent-2: #0284c7;
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, .08);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, .09);
  --purple: #7c3aed;
  --shadow: 0 16px 40px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- boot ---------- */
.boot-screen {
  min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px;
  color: var(--muted);
}
.boot-logo {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-content: center;
  background: linear-gradient(140deg, var(--accent), #0ea5e9);
  color: #041016; font-size: 32px; font-weight: 800; box-shadow: 0 12px 40px rgba(0, 212, 126, .35);
}
.boot-bar { width: 180px; height: 4px; border-radius: 99px; background: var(--border); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 40%; border-radius: 99px; background: var(--accent); animation: boot 1.1s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-100%);} 100% { transform: translateX(260%);} }

/* ---------- login ---------- */
.login-page {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr;
}
.login-visual {
  position: relative; overflow: hidden; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(700px 500px at 20% 20%, rgba(0, 212, 126, .22), transparent 60%),
    radial-gradient(600px 500px at 80% 80%, rgba(56, 189, 248, .16), transparent 55%),
    linear-gradient(160deg, #071120, #060a13);
  color: #eaf2ff;
}
.login-visual::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 38px 38px; mask-image: radial-gradient(circle at 50% 40%, #000 10%, transparent 75%);
}
.login-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; letter-spacing: .4px; z-index: 1; }
.login-brand .logo-mark { width: 40px; height: 40px; border-radius: 12px; }
.logo-mark {
  display: grid; place-content: center; background: linear-gradient(140deg, var(--accent), #0ea5e9);
  color: #03130b; font-weight: 800; font-size: 20px; border-radius: 12px; width: 36px; height: 36px;
  box-shadow: 0 6px 18px rgba(0, 212, 126, .22); flex: none;
}
.login-headline { z-index: 1; max-width: 520px; }
.login-headline h1 { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.15; margin: 0 0 18px; letter-spacing: -.5px; }
.login-headline p { color: #9fb2cc; font-size: 15px; margin: 0; max-width: 460px; }
.login-points { z-index: 1; display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0,1fr)); max-width: 560px; }
.login-point { border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); border-radius: 14px; padding: 14px; backdrop-filter: blur(6px); }
.login-point b { display: block; font-size: 14px; margin-bottom: 2px; }
.login-point span { color: #8ea3bd; font-size: 12px; }
.login-form-wrap { display: grid; place-content: center; padding: 40px 24px; background: var(--bg); }
.login-card { width: min(400px, 92vw); }
.setup-card { width: min(620px, 94vw); }
.setup-card .form-grid { gap: 10px 14px; }
.login-card h2 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.3px; }
.login-card > p { color: var(--muted); margin: 0 0 26px; }
.login-card .field { margin-bottom: 16px; }
.login-foot { margin-top: 22px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

/* ---------- shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px; border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11, 18, 31, .92), rgba(7, 12, 21, .78));
  backdrop-filter: blur(18px); z-index: 40;
}
html[data-theme="light"] .sidebar { background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(248,250,253,.86)); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.sidebar-brand .name { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.sidebar-brand .ver { color: var(--muted); font-size: 11px; border: 1px solid var(--border); border-radius: 6px; padding: 0 5px; margin-left: 2px; }
.nav-group { padding: 8px 10px 4px; color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border-radius: 11px;
  color: var(--text-2); border: 1px solid transparent; background: transparent; cursor: pointer; text-align: left;
  transition: background .16s ease, color .16s ease, border-color .16s ease; font-size: 13.5px;
}
.nav-item svg { width: 18px; height: 18px; opacity: .8; flex: none; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); border-color: rgba(0, 212, 126, .22); color: var(--text); }
.nav-item.active svg { color: var(--accent); opacity: 1; }
.nav-item .nav-dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.sidebar-foot { margin-top: auto; padding: 14px 6px 0; border-top: 1px solid var(--border); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.side-user .avatar { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(140deg, var(--accent), #0ea5e9); color: #041016; display: grid; place-content: center; font-weight: 700; flex: none; }
.side-user .meta { min-width: 0; }
.side-user .meta b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .meta span { color: var(--muted); font-size: 11px; }
.side-actions { display: flex; gap: 6px; padding: 8px 4px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; border-bottom: 1px solid var(--border);
  background: rgba(7, 12, 21, .72); backdrop-filter: blur(16px);
}
html[data-theme="light"] .topbar { background: rgba(243, 246, 251, .8); }
.topbar h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: -.2px; white-space: nowrap; }
.topbar .crumb { color: var(--muted); font-size: 12px; margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.content { padding: 24px 28px 48px; width: 100%; max-width: 1560px; margin: 0 auto; }
.mobile-toggle { display: none; }
.scrim { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 13px; font-weight: 550;
  transition: transform .12s ease, background .16s ease, border-color .16s ease, opacity .16s; white-space: nowrap;
}
.btn:hover { background: var(--panel-solid); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #0ea5a0); border-color: transparent; color: #032016; font-weight: 650; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); border-color: rgba(251, 113, 133, .3); background: var(--danger-soft); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 8px; width: 36px; height: 36px; }
.btn.icon.sm { width: 30px; height: 30px; padding: 5px; }
.btn.block { width: 100%; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field > label { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: rgba(8, 14, 25, .55); color: var(--text); outline: none; transition: border-color .16s, box-shadow .16s;
  font-size: 13px;
}
html[data-theme="light"] .input, html[data-theme="light"] .select, html[data-theme="light"] .textarea { background: #fff; }
.textarea { resize: vertical; min-height: 92px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.015); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; }
.check b { display: block; font-size: 13px; font-weight: 550; }
.check span { color: var(--muted); font-size: 11.5px; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); border: none; cursor: pointer; transition: background .18s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .18s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- cards & layout ---------- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.cols-2 { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel);
  box-shadow: var(--shadow); backdrop-filter: blur(14px); overflow: hidden;
}
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 0; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .1px; }
.card-head .sub { color: var(--muted); font-size: 12px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px 18px; }
.card-body.flush { padding: 0; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: auto -40% -60% auto; width: 200px; height: 200px; background: radial-gradient(circle, var(--accent-soft), transparent 70%); pointer-events: none; }
.kpi .label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi .foot { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; }
.delta.up { color: var(--accent); background: var(--accent-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.flat { color: var(--muted); background: var(--panel-2); }

/* ---------- chart ---------- */
.chart-wrap { position: relative; width: 100%; height: 280px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-legend { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.chart-tip {
  position: fixed; z-index: 80; pointer-events: none; padding: 8px 10px; border-radius: 10px;
  background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-size: 12px; min-width: 140px;
}
.chart-tip b { display: block; margin-bottom: 4px; font-size: 11px; color: var(--muted); font-weight: 500; }
.chart-tip .row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tip .row span { color: var(--muted); }
.chart-tip .row strong { font-variant-numeric: tabular-nums; }

/* ---------- live strip ---------- */
.live-strip { display: flex; align-items: center; gap: 18px; padding: 10px 16px; flex-wrap: wrap; }
.live-state { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.live-state b { font-size: 13px; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(0, 212, 126, .45); animation: livePulse 2s infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 212, 126, .45); }
  70% { box-shadow: 0 0 0 7px rgba(0, 212, 126, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 212, 126, 0); }
}
.live-metrics { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.live-metrics b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .live-strip { gap: 8px 14px; padding: 10px 14px; }
  .live-metrics { gap: 6px 14px; }
  .live-state { flex: 1 1 100%; justify-content: space-between; }
}

/* ---------- site plugin editor ---------- */
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.plugin-card {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--border); border-radius: 12px;
  background: rgba(148, 163, 184, .04); padding: 14px;
}
.plugin-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--text); }
.plugin-card .field { margin: 0; }
.plugin-card .field > label { font-size: 12px; }
.plugin-card .textarea { resize: vertical; min-height: 46px; font-family: var(--mono, ui-monospace, monospace); font-size: 11px; }
.plugin-card .check span span { font-size: 11px; }
.plugin-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 640px) { .plugin-inline { grid-template-columns: 1fr; } }

/* ---------- status donut ---------- */
.status-layout { display: grid; grid-template-columns: minmax(130px, 150px) minmax(0, 1fr); gap: 20px; align-items: center; }
.status-donut { width: 100%; height: 150px; min-width: 0; }
.status-donut canvas { width: 100%; height: 100%; display: block; }
.status-legend { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.status-legend-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; white-space: nowrap; }
.status-legend-name { display: inline-flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.status-legend-name i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
@media (max-width: 640px) {
  .status-layout { grid-template-columns: 1fr; justify-items: center; gap: 10px; }
  .status-donut { width: 150px; }
  .status-legend { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
}

/* ---------- upload ---------- */
.upload-zone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 18px;
  border: 1.5px dashed var(--border-strong); border-radius: 14px; background: rgba(255,255,255,.012);
  color: var(--muted); cursor: pointer; text-align: center; transition: border-color .16s, background .16s;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone input { display: none; }
.upload-zone b { color: var(--text); font-size: 13px; }
.upload-zone span { font-size: 11.5px; }
.tips { line-height: 1.7; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }

/* ---------- modules ---------- */
.module-list { display: flex; flex-direction: column; }
.module-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.module-row:last-child { border-bottom: none; }
.module-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.module-info b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.module-info span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.module-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.module-action { flex: none; display: flex; align-items: center; justify-content: flex-end; min-width: 38px; }
@media (max-width: 640px) {
  .module-row { flex-wrap: wrap; gap: 8px 12px; }
  .module-info { flex: 1 1 100%; }
  .module-meta { justify-content: flex-start; }
  .module-action { margin-left: auto; }
}

/* ---------- geo ---------- */
.geo-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr); gap: 18px; align-items: stretch; }
.geo-map-wrap {
  position: relative; height: 340px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border);
  background: radial-gradient(600px 300px at 50% 45%, rgba(56, 189, 248, .06), transparent 70%), rgba(255, 255, 255, .012);
}
.geo-map-wrap canvas { width: 100%; height: 100%; display: block; }
.geo-map-wrap.dimmed canvas { opacity: .28; filter: grayscale(.5); }
.geo-map-label {
  position: absolute; left: 12px; bottom: 10px; padding: 2px 8px; border-radius: 6px;
  background: var(--panel-solid); border: 1px solid var(--border); color: var(--muted); font-size: 11px;
}
.geo-ranking { min-width: 0; }
.geo-rank-head {
  display: flex; justify-content: space-between; color: var(--muted); font-size: 11px;
  padding: 0 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.geo-rank-list { display: flex; flex-direction: column; gap: 9px; max-height: 292px; overflow: auto; padding-right: 4px; }
.geo-rank-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 64px; gap: 9px; align-items: center; font-size: 12px; }
.geo-rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-rank-bar { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.geo-rank-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.geo-rank-val { display: flex; justify-content: flex-end; gap: 6px; font-variant-numeric: tabular-nums; }
.geo-rank-val b { font-weight: 600; }
.geo-rank-val span { color: var(--muted); font-size: 11px; }
@media (max-width: 900px) {
  .geo-layout { grid-template-columns: 1fr; }
  .geo-map-wrap { height: 280px; }
  .geo-rank-list { max-height: none; }
}

/* ---------- lists ---------- */
.bar-list { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.bar-row .name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { grid-column: 1 / -1; height: 5px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .85; }
.empty { padding: 26px 12px; text-align: center; color: var(--muted); font-size: 12.5px; }
.empty svg { width: 30px; height: 30px; opacity: .4; margin-bottom: 6px; }

/* ---------- tables ---------- */
.table-wrap { width: 100%; overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; font-weight: 550; color: var(--muted); padding: 10px 14px; white-space: nowrap;
  border-bottom: 1px solid var(--border); background: rgba(255,255,255,.015); position: sticky; top: 0; z-index: 1;
  backdrop-filter: blur(8px); font-size: 11.5px; letter-spacing: .03em;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:hover td { background: rgba(255,255,255,.02); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .mono { font-family: var(--mono); font-size: 12px; }
table.data .truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
table.data .actions { display: flex; gap: 4px; justify-content: flex-end; }
table.data th.right, table.data td.right { text-align: right; }
.row-click { cursor: pointer; }

/* ---------- badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 550; border: 1px solid transparent; white-space: nowrap; }
.badge.green { color: var(--accent); background: var(--accent-soft); border-color: rgba(0, 212, 126, .2); }
.badge.blue { color: var(--accent-2); background: rgba(56, 189, 248, .1); border-color: rgba(56, 189, 248, .2); }
.badge.red { color: var(--danger); background: var(--danger-soft); border-color: rgba(251, 113, 133, .2); }
.badge.amber { color: var(--warn); background: var(--warn-soft); border-color: rgba(251, 191, 36, .2); }
.badge.purple { color: var(--purple); background: rgba(167, 139, 250, .1); border-color: rgba(167, 139, 250, .2); }
.badge.gray { color: var(--muted); background: var(--panel-2); border-color: var(--border); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(255,255,255,.04); }
.status-code { font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.status-code.s2 { color: var(--accent); }
.status-code.s3 { color: var(--accent-2); }
.status-code.s4 { color: var(--warn); }
.status-code.s5 { color: var(--danger); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); flex: none; }
.seg button { border: none; background: transparent; color: var(--muted); padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.seg button.active { background: var(--panel-solid); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.input-icon .input, .input-icon .select { padding-left: 32px; }
.ov-site-filter { min-width: 170px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 18px; overflow-x: auto; }
.tabs button { border: none; background: transparent; color: var(--muted); padding: 12px 12px; cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- misc ---------- */
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2); font-size: 12px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.progress { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.progress.warn i { background: var(--warn); }
.progress.danger i { background: var(--danger); }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.metric { padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,.015); }
.metric .k { color: var(--muted); font-size: 11px; }
.metric .v { font-size: 19px; font-weight: 650; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.metric .v small { font-size: 11px; color: var(--muted); font-weight: 400; }

/* ---------- modal ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(3, 7, 14, .62); backdrop-filter: blur(4px); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 4vh; overflow: auto; animation: fade .15s ease; }
.modal { width: min(680px, 96vw); border-radius: 18px; border: 1px solid var(--border-strong); background: var(--panel-solid); box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: pop .18s ease; }
.modal.wide { width: min(920px, 96vw); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .sub { color: var(--muted); font-size: 12px; }
.modal-body { padding: 20px; max-height: 68vh; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.modal-close { margin-left: auto; background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- toast ---------- */
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: grid; gap: 8px; max-width: 380px; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--panel-solid); box-shadow: var(--shadow); animation: slide .18s ease; font-size: 12.5px; }
.toast.success { border-left: 3px solid var(--accent); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent-2); }
.toast b { display: block; font-size: 12.5px; }
.toast span { color: var(--muted); font-size: 11.5px; white-space: pre-wrap; word-break: break-word; }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- config editor ---------- */
.editor-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.file-list { max-height: 560px; overflow: auto; }
.file-item { display: flex; flex-direction: column; gap: 1px; padding: 9px 12px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.file-item:hover { background: var(--panel-2); }
.file-item.active { background: var(--accent-soft); border-color: rgba(0, 212, 126, .25); }
.file-item .fname { font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fmeta { color: var(--muted); font-size: 10.5px; }
.editor { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #060b14; }
html[data-theme="light"] .editor { background: #0f172a; }
.editor pre.lines { margin: 0; padding: 12px 8px; color: #4b6179; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; text-align: right; overflow: hidden; border-right: 1px solid rgba(255,255,255,.06); user-select: none; }
.editor textarea { border: none; border-radius: 0; background: transparent; color: #d8e3f2; padding: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; min-height: 460px; resize: vertical; outline: none; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.editor textarea:focus { box-shadow: none; }
pre.config { margin: 0; padding: 14px; border-radius: 12px; background: #060b14; color: #cfe0f5; font-family: var(--mono); font-size: 12px; line-height: 1.65; overflow: auto; max-height: 60vh; }

/* ---------- login responsive ---------- */
@media (max-width: 1020px) {
  .login-page { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-form-wrap { min-height: 100vh; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-102%); transition: transform .22s ease; }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.5); }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(2,6,14,.55); z-index: 35; }
  .mobile-toggle { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .login-visual { padding: 28px; }
}
@media (max-width: 1280px) {
  table.data .hide-md { display: none; }
  table.data th, table.data td { padding: 9px 10px; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; padding: 10px 14px; }
  .topbar-actions { width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .topbar-actions .input-icon { min-width: 120px; }
  .ov-site-filter { min-width: 120px; }
  .topbar-actions .seg [data-range="30d"], .topbar-actions .seg [data-range="90d"] { display: none; }
  .topbar-actions .seg button { padding: 5px 7px; }
  .content { padding: 14px 14px 40px; }
  .card-head { flex-wrap: wrap; row-gap: 6px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 24px; }
  .chart-wrap { height: 200px; }
  #ov-refresh { display: none; }
  .kpi .foot > span:not(.delta):not([id]) { display: none; }
  .modal-mask { padding: 2vh 8px; }
  .modal-body { max-height: 74vh; }
  .toolbar { gap: 8px; }
  .login-points { grid-template-columns: 1fr; }
}
