:root {
  --bg: #070b16;
  --bg-2: #0a1020;
  --bg-elev: #0d1426;
  --bg-card: #121a30;
  --bg-card-2: #161f38;
  --line: rgba(168, 190, 240, 0.14);
  --line-strong: rgba(168, 190, 240, 0.26);
  --text: #f4f7ff;
  --text-2: #d5dced;
  --muted: #b4bdd4;
  --accent: #6d7cff;
  --accent-2: #4cc4ff;
  --ok: #3ee0a0;
  --warn: #f5c542;
  --danger: #ff5d73;
  --orange: #ff8a4c;
  --purple: #9b7bff;
  --gold: #f0c24b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --radius-sm: 12px;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --display: "Plus Jakarta Sans", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Sans", ui-monospace, Consolas, monospace;
  --nav-w: 248px;
  --top-h: 64px;
}
[data-theme="light"] {
  --bg: #eef1f8;
  --bg-2: #e7ebf5;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-card-2: #f7f8fd;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.18);
  --text: #0f172a;
  --text-2: #1e293b;
  --muted: #475569;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); }
html { font-size: 16px; }
body {
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(109, 124, 255, 0.16), transparent 50%),
    radial-gradient(800px 400px at -10% 110%, rgba(62, 224, 160, 0.08), transparent 45%),
    var(--bg);
}
[data-theme="light"] body {
  background:
    radial-gradient(1000px 420px at 90% -8%, rgba(91, 106, 240, 0.1), transparent 50%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.side {
  background: linear-gradient(180deg, #0b1224 0%, #0a101e 100%);
  border-right: 1px solid var(--line);
  padding: 18px 12px 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
[data-theme="light"] .side {
  background: #ffffff;
  color: var(--text);
  box-shadow: 8px 0 28px rgba(15, 23, 42, 0.04);
}
[data-theme="light"] .brand h1 { color: #0f172a; }
[data-theme="light"] .brand span { color: #475569; }
[data-theme="light"] .nav a { color: #334155; }
[data-theme="light"] .nav a:hover { background: rgba(91, 106, 240, 0.08); color: #0f172a; }
[data-theme="light"] .nav a.active {
  background: linear-gradient(90deg, rgba(91,106,240,0.16), rgba(91,106,240,0.05));
  color: #1e1b4b;
  box-shadow: inset 2px 0 0 #5b6af0;
}
[data-theme="light"] .nav-group { color: #64748b; }
[data-theme="light"] .side-search { background: #f1f5f9; color: #0f172a; border-color: var(--line); }
[data-theme="light"] .side-foot {
  background: linear-gradient(180deg, rgba(16,185,129,0.1), rgba(16,185,129,0.04));
  border-color: rgba(16,185,129,0.22);
  color: #065f46;
}
[data-theme="light"] .side-foot p { color: #047857; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.mark {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 40px;
  background: url("/assets/simles-logo.png") center / cover no-repeat;
  box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.12);
}
.mark:after { content: none; }
.login .mark { width: 56px; height: 56px; border-radius: 16px; flex-basis: 56px; }
.brand h1 { font-family: var(--display); font-size: 16px; margin: 0; letter-spacing: -0.02em; font-weight: 800; color: #fff; }
.brand span { display: block; color: #b8c2db; font-size: 12px; font-weight: 500; margin-top: 1px; }
.side-search { width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; color: #eef2ff; }
.nav { flex: 1; }
.nav-group { color: #9aa6c2; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; padding: 14px 10px 6px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  color: #d7deef; text-decoration: none; padding: 8px 10px;
  border-radius: 10px; font-size: 13.5px; font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.nav a .ico { width: 16px; height: 16px; opacity: 0.85; flex: 0 0 16px; }
.nav a:hover { background: rgba(109, 124, 255, 0.14); color: #fff; transform: translateX(2px); }
.nav a.active {
  background: linear-gradient(90deg, rgba(109,124,255,0.22), rgba(109,124,255,0.08));
  color: #fff;
  box-shadow: inset 2px 0 0 #6d7cff;
}
.nav a.active .ico { opacity: 1; }
.nav-count {
  margin-left: auto; font-size: 10px; font-weight: 700;
  background: #ff5d73; color: #fff; border-radius: 999px; min-width: 18px;
  text-align: center; padding: 1px 6px;
}
.side-foot {
  margin-top: 12px; padding: 12px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(62,224,160,0.12), rgba(62,224,160,0.04));
  border: 1px solid rgba(62,224,160,0.18);
  color: #d7fff0;
}
.side-foot strong { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.side-foot p { margin: 6px 0 0; font-size: 12px; color: #b6ead4; line-height: 1.45; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(62,224,160,0.15); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 22px; min-height: var(--top-h);
  border-bottom: 1px solid var(--line); background: rgba(10, 16, 32, 0.72);
  backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20;
}
[data-theme="light"] .top { background: rgba(255,255,255,0.86); }
.top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn { display: none; }
.top h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-2); font-family: var(--sans); }
.env { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); background: var(--bg-card); font-weight: 600; }
.env.env-local { color: var(--warn); border-color: rgba(245, 197, 66, 0.35); background: rgba(245, 197, 66, 0.1); }
.env.env-prod { color: var(--ok); border-color: rgba(62, 224, 160, 0.35); background: rgba(62, 224, 160, 0.1); }
.top-search { flex: 1; max-width: 520px; margin: 0 18px; }
.top-search input {
  width: 100%; background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 14px 9px 36px;
}
.top-search { position: relative; }
.top-search .ico { position: absolute; left: 12px; top: 10px; width: 16px; height: 16px; color: var(--muted); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.userchip {
  display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg-card);
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #6d7cff, #9b7bff);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff;
}
.userchip .meta { display: flex; flex-direction: column; line-height: 1.15; }
.userchip .meta b { font-size: 12px; }
.userchip .meta span { font-size: 11px; color: var(--muted); }

.badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(245, 197, 66, 0.16); color: var(--warn); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.badge.local::before, .badge.disconnected::before, .badge.connected::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.badge.disconnected { background: rgba(245, 197, 66, 0.16); color: var(--warn); }
.badge.connected { background: rgba(62, 224, 160, 0.16); color: var(--ok); }
.bell { position: relative; }
.bell .nav-count { position: absolute; top: -4px; right: -4px; }

.content { padding: 22px 24px 40px; overflow: auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.kicker { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-2); font-weight: 700; }
.page-head h1 {
  font-family: var(--display); font-size: 28px; margin: 4px 0 6px;
  letter-spacing: -0.04em; font-weight: 800;
}
.lede { margin: 0; color: var(--text-2); font-size: 14px; max-width: 620px; line-height: 1.5; }
.range-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--bg-card);
  border-radius: 12px; padding: 8px 12px; color: var(--text-2); font-size: 12px; white-space: nowrap;
}

.kpis, .dash-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%), var(--bg-card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px 12px; box-shadow: var(--shadow); min-width: 0;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.kpi:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 16px 36px rgba(0,0,0,0.28);
}
.kpi .kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.kpi-ico {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 36px;
}
.kpi-ico .ico { width: 18px; height: 18px; }
.kpi .l { color: var(--text-2); font-size: 12px; font-weight: 600; line-height: 1.3; min-height: 32px; }
.kpi .v { font-family: var(--display); font-size: 26px; font-weight: 800; margin-top: 8px; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.35; }
.kpi .spark { width: 76px; height: 30px; }
.tone-red { background: rgba(255,93,115,0.12); color: var(--danger); }
.tone-purple { background: rgba(155,123,255,0.14); color: var(--purple); }
.tone-orange { background: rgba(255,138,76,0.14); color: var(--orange); }
.tone-gold { background: rgba(240,194,75,0.14); color: var(--gold); }
.tone-green { background: rgba(62,224,160,0.12); color: var(--ok); }
.tone-blue { background: rgba(76,196,255,0.14); color: var(--accent-2); }

.card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px 16px; box-shadow: var(--shadow); margin-bottom: 14px; min-width: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:hover { border-color: var(--line-strong); }
.card h3 { margin: 0; font-size: 15px; font-weight: 700; font-family: var(--display); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 8px; }
.card-head .link { font-size: 13px; color: var(--accent-2); text-decoration: none; font-weight: 600; }
.card-head .link:hover { text-decoration: underline; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.dash-grid-3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; }
.dash-grid-4 { display: grid; grid-template-columns: 1.1fr 1.1fr 1fr 1.1fr; gap: 14px; }
.dash-grid .card, .dash-grid-3 .card, .dash-grid-4 .card { margin-bottom: 0; height: 100%; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--text-2); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; }
tbody tr { transition: background 0.14s ease; }
tbody tr:hover { background: rgba(109,124,255,0.1); }
.mono { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.score {
  display: inline-grid; place-items: center; min-width: 38px; height: 24px; padding: 0 8px;
  border-radius: 8px; font-size: 12px; font-weight: 700;
}
.score.high { background: rgba(255,93,115,0.16); color: var(--danger); }
.score.med { background: rgba(245,197,66,0.16); color: var(--warn); }
.score.low { background: rgba(62,224,160,0.14); color: var(--ok); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; padding: 5px 9px; border-radius: 999px;
  background: rgba(109,124,255,0.16); color: #d7dfff; letter-spacing: 0.01em;
}
.pill.high, .pill.danger { background: rgba(255,93,115,0.16); color: var(--danger); }
.pill.med, .pill.warn { background: rgba(245,197,66,0.16); color: var(--warn); }
.pill.ok { background: rgba(62,224,160,0.14); color: var(--ok); }
.pill.blue { background: rgba(76,196,255,0.14); color: var(--accent-2); }

.btn {
  background: linear-gradient(180deg, #7a88ff, #5b6af0); color: #fff; border: 0;
  border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 600; font-size: 13px;
  transition: filter 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--line-strong); background: rgba(109,124,255,0.08); }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); color: #062015; }
.btn.icon { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border-radius: 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; align-items: center; }
input, select, textarea {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
textarea { width: 100%; }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 400px at 20% 0%, rgba(109,124,255,0.22), transparent 55%),
    radial-gradient(700px 360px at 90% 100%, rgba(76,196,255,0.12), transparent 50%),
    var(--bg);
}
.login {
  width: min(420px, 100%); background: var(--bg-card); padding: 32px 28px;
  border-radius: 22px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.login .brand { padding: 0 0 18px; }
.login h2 { margin: 0 0 6px; font-family: var(--display); font-size: 24px; letter-spacing: -0.03em; }
.login form { display: grid; gap: 10px; margin-top: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--danger); font-size: 13px; }
.graph { height: 280px; width: 100%; background:
  radial-gradient(circle at 50% 48%, rgba(109,124,255,0.16), transparent 42%),
  radial-gradient(circle at 50% 48%, rgba(76,196,255,0.06), transparent 70%),
  var(--bg-2);
  border-radius: 12px; overflow: visible; }
.note { font-size: 13px; color: var(--text-2); line-height: 1.55; }
pre { font-family: var(--mono); font-size: 12px; overflow: auto; background: var(--bg); padding: 12px; border-radius: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.chart { width: 100%; height: 220px; }
.chart.sparkline { height: 28px; width: 72px; }
.chart-bar { fill: var(--accent); }
#loading { min-height: 80px; }
.empty { padding: 36px 16px; color: var(--muted); text-align: center; }
.empty b { display: block; color: var(--text); margin-bottom: 6px; font-size: 14px; }
.empty span, .empty { font-size: 13px; line-height: 1.5; }
.empty-ico {
  width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(109,124,255,0.12); color: var(--accent-2);
}
.empty-ico .ico { width: 20px; height: 20px; }
.sev-high { color: var(--danger); }
.sev-medium { color: var(--warn); }
.sev-low { color: var(--ok); }

.donut-wrap { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: center; }
.donut-center { font-family: var(--display); font-weight: 800; font-size: 22px; }
.hbar { display: grid; grid-template-columns: 96px 1fr 52px; gap: 8px; align-items: center; margin: 8px 0; font-size: 13px; color: var(--text-2); }
.hbar .track { height: 8px; background: rgba(255,255,255,0.06); border-radius: 99px; overflow: hidden; }
[data-theme="light"] .hbar .track { background: rgba(18,24,42,0.08); }
.hbar .fill { height: 100%; border-radius: 99px; }
.meter { height: 10px; background: rgba(255,255,255,0.06); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, #3ee0a0, #4cc4ff); }
.split { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.rule-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.alert-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.alert-item b { display: block; font-size: 13.5px; }
.alert-item span { color: var(--muted); font-size: 12px; }
.skel-grid { display: grid; gap: 12px; }
.skel-grid .skel { height: 92px; border-radius: 16px; background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-2) 45%, var(--bg-card) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border: 1px solid var(--line); }
.skel.wide { height: 220px; }
.orbit { transform-origin: 200px 168px; animation: spin 28s linear infinite; }
.graph-wrap { position: relative; min-height: 300px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes livepulse {
  0% { box-shadow: 0 0 0 0 rgba(62,224,160,0.55); }
  70% { box-shadow: 0 0 0 8px rgba(62,224,160,0); }
  100% { box-shadow: 0 0 0 0 rgba(62,224,160,0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.statrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 220px)); gap: 12px; margin-bottom: 16px; }
.statrow .kpi { min-height: 108px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { min-width: 160px; flex: 1; }
.toolbar input#ghops { flex: 0 0 72px; min-width: 72px; max-width: 80px; width: 72px; }
.policy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.policy-item { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); }
.policy-item:hover { border-color: var(--line-strong); }
.policy-item span { font-weight: 650; color: var(--text); }
.policy-item code { font-size: 11px; color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr); gap: 14px; align-items: start; }
.graph.workspace-graph { height: 460px; border: 1px solid var(--line); cursor: grab; }
.graph.workspace-graph:active { cursor: grabbing; }
.pano { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pano .card { margin-bottom: 0; }
.integ { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.integ .card { margin-bottom: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.ok { background: var(--ok); }
.status-dot.warn { background: var(--warn); }
.status-dot.danger { background: var(--danger); }
.status-dot.blue { background: var(--accent-2); }
.btn.tiny { padding: 5px 8px; font-size: 11px; }
code { font-family: var(--mono); font-size: 12px; }

@media (max-width: 1280px) {
  .kpis, .dash-kpis { grid-template-columns: repeat(3, 1fr); }
  .dash-grid-4 { grid-template-columns: 1fr 1fr; }
  .dash-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side {
    display: none; position: fixed; z-index: 40; width: min(280px, 86vw);
    top: 0; left: 0; height: 100vh; box-shadow: 12px 0 40px rgba(0,0,0,0.35);
  }
  .app.nav-open .side { display: flex; }
  .menu-btn { display: grid; }
  .kpis, .dash-kpis, .dash-grid, .dash-grid-3, .dash-grid-4, .grid2, .donut-wrap, .workspace, .pano, .policy-grid { grid-template-columns: 1fr; }
  .top-search { display: none; }
  .page-head h1 { font-size: 22px; }
  .content { padding: 16px; }
}
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.table-wrap table { margin: 0; }
.table-wrap th {
  position: sticky; top: 0; background: var(--bg-card-2); z-index: 1;
}
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px; margin-bottom: 14px;
  border: 1px solid var(--line); font-size: 13px; line-height: 1.45;
}
.banner.ok { background: rgba(62,224,160,0.1); border-color: rgba(62,224,160,0.28); color: var(--text); }
.banner.warn { background: rgba(245,197,66,0.12); border-color: rgba(245,197,66,0.32); color: var(--text); }
.banner.err { background: rgba(255,93,115,0.12); border-color: rgba(255,93,115,0.32); color: var(--danger); }
.banner b { display: block; margin-bottom: 2px; }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  background: var(--bg-elev); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); border-radius: 12px; padding: 12px 14px;
  font-size: 13px; min-width: 220px;
}
.toast.ok { border-color: rgba(62,224,160,0.4); }
.toast.err { border-color: rgba(255,93,115,0.45); color: var(--danger); }
.graph-workspace { padding: 0 0 12px; overflow: hidden; }
.graph-workspace .toolbar { padding: 14px 14px 0; }
.graph-legend {
  display: flex; gap: 12px; flex-wrap: wrap; padding: 4px 16px 10px;
  font-size: 12px; color: var(--text-2); font-weight: 600;
}
.graph-legend span { display: inline-flex; align-items: center; gap: 6px; }
.graph-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.graph-stage { display: grid; grid-template-columns: minmax(0, 1fr) 280px; min-height: 460px; border-top: 1px solid var(--line); }
.graph-tools { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.invest-panel {
  border-left: 1px solid var(--line); background: var(--bg-2);
  padding: 16px 14px; min-height: 100%;
}
.invest-panel h3 { margin: 0 0 8px; font-size: 14px; }
.invest-panel .node-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  background: var(--bg-card); margin-top: 10px;
}
.invest-panel .node-card b { display: block; font-size: 13px; }
.cluster-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; fill: currentColor; opacity: 0.55; font-weight: 700; }
.callout {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  background: linear-gradient(180deg, rgba(109,124,255,0.08), transparent);
  margin-bottom: 14px; color: var(--text-2); font-size: 13px;
}
[data-theme="light"] .pill { color: #3730a3; background: rgba(91,106,240,0.12); }
[data-theme="light"] .pill.high, [data-theme="light"] .pill.danger { color: #be123c; background: rgba(255,93,115,0.14); }
[data-theme="light"] .pill.ok { color: #047857; background: rgba(16,185,129,0.14); }
[data-theme="light"] .pill.warn, [data-theme="light"] .pill.med { color: #a16207; background: rgba(245,197,66,0.22); }
[data-theme="light"] .pill.blue { color: #0369a1; background: rgba(14,165,233,0.14); }
[data-theme="light"] .kpi { background: #fff; }
[data-theme="light"] .kpi:hover, [data-theme="light"] .card:hover {
  box-shadow: 0 16px 32px rgba(15,23,42,0.08);
}
[data-theme="light"] tbody tr:hover { background: rgba(91,106,240,0.06); }
[data-theme="light"] .empty-ico { background: rgba(91,106,240,0.1); color: #4f46e5; }
[data-theme="light"] .top-search input, [data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea {
  background: #fff; color: #0f172a;
}
[data-theme="light"] .login { box-shadow: 0 24px 60px rgba(15,23,42,0.12); }
[data-theme="light"] .hbar .fill { box-shadow: none; }
.nav-scrim { display: none; }
.studio-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 14px; align-items: start; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; width: 100%; }
.filter-grid input, .filter-grid select { min-width: 0; width: 100%; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 14px 16px; border-left: 1px solid var(--line);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 4px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(109,124,255,0.18);
}
.timeline li b { display: block; font-size: 13px; }
.timeline li span { display: block; font-size: 12px; color: var(--muted); }
tbody tr.is-selected { background: rgba(109,124,255,0.12); }
.policy-item select, .policy-item input { width: 100%; }
.ops-note { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.attest-meter { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; }
.attest-meter .chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 650;
}
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.page-head h1 { color: var(--text); }
.lede, .kpi .l, th { color: var(--text-2); }
.kpi .v { color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media (max-width: 1100px) {
  .graph-stage, .studio-grid { grid-template-columns: 1fr; }
  .invest-panel { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 960px) {
  .nav-scrim { position: fixed; inset: 0; background: rgba(4,8,18,0.55); z-index: 35; }
  .app.nav-open .nav-scrim { display: block; }
}
html, body { max-width: 100%; }
.app, .main, .content, .card, .page-head, .toolbar { min-width: 0; max-width: 100%; }
.main { overflow-x: hidden; }
.integ { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.policy-grid { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.statrow { grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); }
.filter-grid { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); }
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
pre, .chart, svg.graph { max-width: 100%; }
@media (max-width: 960px) {
  body:has(.nav-open) { overflow: hidden; }
  .side {
    width: min(300px, 88vw);
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .nav a { min-height: 44px; padding: 12px 10px; }
  .btn.menu-btn { width: 44px; height: 44px; }
  .top {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .top-left { flex: 1 1 auto; min-width: 0; gap: 8px; }
  .top h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { flex: 1 1 100%; justify-content: flex-end; flex-wrap: wrap; }
  .userchip .meta { display: none; }
  .env { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-head { flex-direction: column; align-items: stretch; }
  .range-chip { white-space: normal; align-self: flex-start; }
  .card-head { flex-wrap: wrap; align-items: flex-start; }
  .kpis, .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .v { font-size: 22px; }
  .hbar { grid-template-columns: minmax(0, 34%) minmax(0, 1fr) auto; }
  .hbar > div:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 14px 12px 28px; overflow-x: hidden; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1 1 100%; }
  .graph-tools { margin-left: 0; flex-wrap: wrap; }
  .table-wrap table { min-width: 560px; }
  .toast { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); min-width: 0; }
  .login-wrap {
    min-height: 100dvh;
    align-items: center;
    justify-items: center;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .login { padding: 22px 16px; }
  .btn, .toolbar input, .toolbar select, .login input { min-height: 44px; }
}
