/* ============ Raqeeb — design tokens ============ */
:root {
  --bg: #07080d;
  --bg-2: #0b0d14;
  --surface: rgba(255, 255, 255, 0.028);
  --surface-2: rgba(255, 255, 255, 0.045);
  --surface-solid: #0e1018;
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);
  --text: #eceef6;
  --text-2: #b3b8cc;
  --muted: #7d8399;
  --faint: #4f5468;
  --grid: rgba(255, 255, 255, 0.05);

  --violet: #a78bfa;
  --violet-2: #7c3aed;
  --cyan: #22d3ee;
  --amber: #fbbf24;
  --emerald: #34d399;
  --blue: #60a5fa;
  --pink: #f472b6;
  --ok: #22c55e;
  --warn: #f59e0b;
  --crit: #f43f5e;
  --info: #60a5fa;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 50px -24px rgba(0,0,0,0.7);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --sidebar: 248px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f6fa;
  --bg-2: #eef0f6;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-2: rgba(15, 23, 42, 0.035);
  --surface-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --border-2: rgba(15, 23, 42, 0.14);
  --text: #0f1222;
  --text-2: #3a4058;
  --muted: #6b7189;
  --faint: #a3a8bb;
  --grid: rgba(15, 23, 42, 0.06);
  --violet: #7c3aed;
  --cyan: #0891b2;
  --amber: #d97706;
  --emerald: #059669;
  --blue: #2563eb;
  --pink: #db2777;
  --shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 12px 40px -20px rgba(15,23,42,0.25);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: 'cv11', 'ss01', 'tnum';
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-feature-settings: normal; }
.num { font-variant-numeric: tabular-nums; }
::selection { background: rgba(167, 139, 250, 0.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ambient background */
.bg-glow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-glow span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.32; }
.bg-glow span:nth-child(1) { width: 620px; height: 620px; left: -180px; top: -260px; background: radial-gradient(circle, #6d28d9, transparent 65%); }
.bg-glow span:nth-child(2) { width: 560px; height: 560px; right: -200px; top: -200px; background: radial-gradient(circle, #0e7490, transparent 65%); opacity: 0.26; }
.bg-glow span:nth-child(3) { width: 700px; height: 500px; left: 30%; bottom: -380px; background: radial-gradient(circle, #1e3a8a, transparent 65%); opacity: 0.18; }
.bg-glow::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 56px 56px; mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%); opacity: 0.5; }
:root[data-theme="light"] .bg-glow span { opacity: 0.12; }

/* ============ Login ============ */
.login { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 400px; padding: 36px 32px 28px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow);
  backdrop-filter: blur(18px); animation: rise .6s cubic-bezier(.2,.8,.2,1);
}
.login-card h1 { font-size: 26px; letter-spacing: -0.03em; margin: 26px 0 4px; }
.login-card p { margin: 0 0 22px; }
.login-foot { text-align: center; color: var(--faint); font-size: 12px; margin: 18px 0 0 !important; }

/* ============ Brand ============ */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.brand .logo { width: 30px; height: 30px; filter: drop-shadow(0 6px 16px rgba(124, 58, 237, 0.45)); }
.brand-lg { font-size: 22px; }
.brand-lg .logo { width: 38px; height: 38px; }

/* ============ Shell ============ */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 22px 14px 16px;
  display: flex; flex-direction: column; gap: 26px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(10,11,18,0.75), rgba(8,9,14,0.6));
  backdrop-filter: blur(20px); z-index: 30;
}
:root[data-theme="light"] .sidebar { background: rgba(255,255,255,0.7); }
.sidebar .brand { padding: 0 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
  color: var(--muted); font-weight: 500; transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--text); background: linear-gradient(90deg, rgba(167,139,250,0.16), rgba(34,211,238,0.06)); }
.nav a.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(var(--violet), var(--cyan)); }
.nav a.active svg { color: var(--violet); }
.nav-badge { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; background: var(--crit); color: #fff; }
.nav-badge.warn { background: var(--warn); color: #1a1200; }
.side-foot { margin-top: auto; }
.agent-card { padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.agent-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.agent-stats { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 4px 8px; align-items: baseline; margin-top: 8px; }
.agent-stats b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.agent-stats span { color: var(--faint); font-size: 11px; }
.scrim { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 16px 32px; background: linear-gradient(180deg, var(--bg) 30%, transparent);
  backdrop-filter: blur(6px);
}
.crumbs { display: flex; align-items: center; gap: 14px; min-width: 0; }
.crumbs h2 { margin: 0; font-size: 20px; letter-spacing: -0.025em; font-weight: 700; white-space: nowrap; }
.host-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 500; min-width: 0; }
.host-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--emerald); background: rgba(52, 211, 153, 0.09); border: 1px solid rgba(52, 211, 153, 0.18); }
.live-pill.off { color: var(--muted); background: var(--surface); border-color: var(--border); }
.live-pill.off .dot { background: var(--faint); box-shadow: none; animation: none; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; transition: all .2s; }
.icon-btn:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }
.menu-btn { display: none; }

.view { padding: 8px 32px 48px; max-width: 1600px; }
.view > * { animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.view > *:nth-child(2) { animation-delay: .04s; }
.view > *:nth-child(3) { animation-delay: .08s; }
.view > *:nth-child(4) { animation-delay: .12s; }
.view > *:nth-child(5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ Dots ============ */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; display: inline-block; }
.dot-live { background: var(--emerald); box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 2s infinite; }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }
.dot.off { background: var(--faint); }
.dot.info { background: var(--info); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.55); } 70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
.dot.crit.pulse { animation: pulseRed 1.6s infinite; }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(244,63,94,.6); } 70% { box-shadow: 0 0 0 8px rgba(244,63,94,0); } 100% { box-shadow: 0 0 0 0 rgba(244,63,94,0); } }

/* ============ Layout ============ */
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.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-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.card {
  position: relative; border-radius: var(--radius); padding: 20px 22px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 0;
  backdrop-filter: blur(14px);
}
.card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent 40%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
:root[data-theme="light"] .card::before { display: none; }
.view > .card { margin-bottom: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; min-height: 28px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); }
.card-icon svg { width: 16px; height: 16px; }
.section-title { display: flex; align-items: center; gap: 12px; margin: 30px 0 14px; }
.section-title h3 { margin: 0; font-size: 15px; font-weight: 600; }
.section-title .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ============ Hero ============ */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 26px; padding: 26px 28px; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -120px; top: -160px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(34,197,94,0.16), transparent 65%); pointer-events: none; }
.hero.degraded::after { background: radial-gradient(circle, rgba(245,158,11,0.18), transparent 65%); }
.hero.down::after { background: radial-gradient(circle, rgba(244,63,94,0.2), transparent 65%); }
.status-badge { display: inline-flex; align-items: center; gap: 9px; padding: 6px 13px 6px 10px; border-radius: 999px; font-weight: 600; font-size: 12.5px; background: rgba(34,197,94,0.1); color: #4ade80; border: 1px solid rgba(34,197,94,0.22); }
.status-badge .icon { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: #22c55e; color: #052e14; }
.status-badge .icon svg { width: 12px; height: 12px; }
.status-badge.warn { background: rgba(245,158,11,0.1); color: #fbbf24; border-color: rgba(245,158,11,0.25); }
.status-badge.warn .icon { background: #f59e0b; color: #241500; }
.status-badge.crit { background: rgba(244,63,94,0.1); color: #fb7185; border-color: rgba(244,63,94,0.25); }
.status-badge.crit .icon { background: #f43f5e; color: #2a0510; }
:root[data-theme="light"] .status-badge { color: #15803d; }
:root[data-theme="light"] .status-badge.warn { color: #b45309; }
:root[data-theme="light"] .status-badge.crit { color: #be123c; }
.hero h1 { margin: 16px 0 6px; font-size: 34px; line-height: 1.1; letter-spacing: -0.035em; font-weight: 800; word-break: break-word; }
.hero h1 .grad { background: linear-gradient(90deg, var(--text) 0%, var(--text) 40%, var(--violet) 75%, var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta svg { width: 14px; height: 14px; }
.hero-kpis { display: flex; flex-wrap: wrap; gap: 28px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.hero-right { display: flex; flex-direction: column; justify-content: center; gap: 12px; position: relative; z-index: 1; }
.hero-right .row { display: flex; align-items: baseline; justify-content: space-between; }
.hero-right .big { font-size: 40px; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }

/* uptime strip */
.bars { display: flex; gap: 3px; height: 38px; align-items: stretch; }
.bars i { flex: 1; border-radius: 3px; background: var(--ok); opacity: 0.85; transition: transform .15s, opacity .15s; cursor: default; min-width: 2px; }
.bars i:hover { transform: scaleY(1.12); opacity: 1; }
.bars i.minor { background: var(--warn); }
.bars i.major { background: var(--crit); }
.bars i.none { background: var(--surface-2); border: 1px solid var(--border); opacity: 1; }
.bars-legend { display: flex; justify-content: space-between; color: var(--faint); font-size: 11.5px; }
.bars.sm { height: 26px; gap: 2px; }

/* ============ Gauges ============ */
.gauge-card { display: flex; flex-direction: column; gap: 14px; }
.gauge-top { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 104px; height: 104px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-2); }
.ring .val { transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.2,1), stroke .4s; }
.ring .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .center b { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.ring .center b small { font-size: 13px; color: var(--muted); font-weight: 600; }
.ring .center span { font-size: 11px; color: var(--muted); margin-top: 4px; }
.gauge-info { min-width: 0; flex: 1; }
.gauge-info .title { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 8px; }
.gauge-info .title svg { width: 16px; height: 16px; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 3px 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(14px, 1fr)); gap: 3px; height: 30px; align-items: end; }
.cores i { display: block; border-radius: 2px; background: linear-gradient(180deg, var(--violet), rgba(124,58,237,0.35)); min-height: 2px; transition: height .6s cubic-bezier(.2,.8,.2,1); position: relative; }
.cores-wrap { height: 30px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; align-items: end; padding-top: 4px; border-top: 1px dashed var(--border); }
.cores-wrap i { display: block; border-radius: 2px 2px 1px 1px; background: linear-gradient(180deg, var(--violet), rgba(124,58,237,0.3)); min-height: 2px; transition: height .6s cubic-bezier(.2,.8,.2,1); }
.mem-bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.mem-bar i { display: block; height: 100%; transition: width .6s; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* ============ Stat tiles ============ */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { padding: 13px 14px; border-radius: 13px; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.tile .label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.tile .label svg { width: 13px; height: 13px; }
.tile .value { font-size: 21px; font-weight: 700; letter-spacing: -0.025em; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.tile .hint { color: var(--faint); font-size: 11.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-row .tile { padding: 16px 18px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border-radius: 16px; }

/* ============ Charts ============ */
.chart { position: relative; width: 100%; height: 220px; }
.chart.sm { height: 150px; }
.chart.lg { height: 280px; }
.chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 13px; }
.tooltip {
  position: fixed; z-index: 100; pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity .12s, transform .12s; padding: 10px 12px; border-radius: 11px; min-width: 150px;
  background: rgba(14, 16, 26, 0.94); border: 1px solid var(--border-2); box-shadow: 0 16px 40px -12px rgba(0,0,0,0.6);
  font-size: 12px; backdrop-filter: blur(10px); color: #eceef6;
}
:root[data-theme="light"] .tooltip { background: rgba(255,255,255,0.97); color: var(--text); }
.tooltip.show { opacity: 1; transform: none; }
.tooltip .t { color: #8b91a7; margin-bottom: 6px; font-weight: 500; }
.tooltip .r { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 1px 0; }
.tooltip .r span { display: inline-flex; align-items: center; gap: 7px; color: #b3b8cc; }
:root[data-theme="light"] .tooltip .r span { color: var(--text-2); }
.tooltip .r i { width: 8px; height: 8px; border-radius: 50%; }
.tooltip .r b { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ============ Segmented / tabs ============ */
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .2s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 0 0 1px var(--border-2); }

/* ============ Forms & buttons ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; transition: all .2s; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { border: 0; color: #fff; background: linear-gradient(135deg, #8b5cf6, #6d28d9 55%, #0891b2); box-shadow: 0 8px 24px -10px rgba(124,58,237,0.8), inset 0 1px 0 rgba(255,255,255,0.2); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger { color: #fb7185; border-color: rgba(244,63,94,0.3); background: rgba(244,63,94,0.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; height: 44px; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--faint); font-size: 12px; }
.input, .field input, .field select, .search input {
  height: 42px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--border-2);
  background: rgba(0,0,0,0.25); outline: none; transition: border-color .2s, box-shadow .2s; width: 100%;
}
:root[data-theme="light"] .field input, :root[data-theme="light"] .field select, :root[data-theme="light"] .search input { background: #fff; }
.field input:focus, .field select:focus, .search input:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(167,139,250,0.15); }
.field select option { background: var(--surface-solid); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-error { color: #fb7185; font-size: 13px; min-height: 18px; margin: -4px 0 12px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.check input { width: 18px; height: 18px; accent-color: #8b5cf6; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.search input { padding-left: 36px; height: 36px; min-width: 220px; font-size: 13px; }
.slider-row { display: grid; grid-template-columns: 1fr 70px; gap: 12px; align-items: center; }
input[type=range] { width: 100%; accent-color: #8b5cf6; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; margin: 0 -22px -20px; padding: 0 0 6px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: default; user-select: none; }
.tbl th.sort { cursor: pointer; }
.tbl th.sort:hover { color: var(--text-2); }
.tbl th.sorted { color: var(--violet); }
.tbl th:first-child, .tbl td:first-child { padding-left: 22px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 22px; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .r { text-align: right; }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .cmd { color: var(--muted); font-family: var(--mono); font-size: 11.5px; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .name { font-weight: 600; }
.mini-bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; white-space: nowrap; }
.mini-bar .track { width: 60px; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.mini-bar .track i { display: block; height: 100%; border-radius: 3px; }
.app-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; flex: none; text-transform: uppercase; }
.cell-flex { display: flex; align-items: center; gap: 11px; min-width: 0; }

/* ============ Pills ============ */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.pill.ok { color: #4ade80; background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.2); }
.pill.warn { color: #fbbf24; background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.22); }
.pill.crit { color: #fb7185; background: rgba(244,63,94,0.1); border-color: rgba(244,63,94,0.24); }
.pill.info { color: #93c5fd; background: rgba(96,165,250,0.1); border-color: rgba(96,165,250,0.22); }
:root[data-theme="light"] .pill.ok { color: #15803d; }
:root[data-theme="light"] .pill.warn { color: #b45309; }
:root[data-theme="light"] .pill.crit { color: #be123c; }
:root[data-theme="light"] .pill.info { color: #1d4ed8; }
.pill .dot { width: 6px; height: 6px; }

/* ============ Incidents ============ */
.inc-list { display: flex; flex-direction: column; }
.inc { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--border); }
.inc:last-child { border-bottom: 0; padding-bottom: 2px; }
.inc:first-child { padding-top: 2px; }
.inc-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; }
.inc-icon svg { width: 17px; height: 17px; }
.inc-icon.crit { background: rgba(244,63,94,0.12); color: #fb7185; }
.inc-icon.warn { background: rgba(245,158,11,0.12); color: #fbbf24; }
.inc-icon.info { background: rgba(96,165,250,0.12); color: #93c5fd; }
.inc-icon.ok { background: rgba(34,197,94,0.12); color: #4ade80; }
.inc h4 { margin: 0 0 2px; font-size: 13.5px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inc p { margin: 0; color: var(--muted); font-size: 12.5px; word-break: break-word; }
.inc .when { text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; }
.inc .when b { display: block; color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty .em-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: rgba(34,197,94,0.1); color: #4ade80; }
.empty .em-icon svg { width: 24px; height: 24px; }
.empty h4 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.empty p { margin: 0; font-size: 13px; }

/* ============ Monitors ============ */
.mon { display: flex; flex-direction: column; gap: 14px; }
.mon-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mon-head .t { min-width: 0; flex: 1; }
.mon-head h4 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mon-head .url { color: var(--muted); font-size: 12px; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mon-status { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.mon-status.up { background: rgba(34,197,94,0.12); color: #4ade80; }
.mon-status.down { background: rgba(244,63,94,0.14); color: #fb7185; }
.mon-status.pending, .mon-status.paused { background: var(--surface-2); color: var(--muted); }
.mon-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mon-stats div { padding: 9px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.mon-stats span { display: block; color: var(--faint); font-size: 11px; }
.mon-stats b { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mon-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.mon-row:last-child { border-bottom: 0; }
.mon-row .name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mon-row .lat { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ============ Disks ============ */
.disk { display: flex; flex-direction: column; gap: 12px; }
.disk-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.disk-top h4 { margin: 0; font-size: 16px; font-family: var(--mono); font-weight: 600; }
.disk-top .pct { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.bar { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; transition: width .8s cubic-bezier(.2,.8,.2,1); }

/* ============ Network ============ */
.iface { display: flex; flex-direction: column; gap: 12px; }
.iface-rates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rate { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.rate span { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.rate b { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ============ Toasts / modal ============ */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 13px; background: var(--surface-solid); border: 1px solid var(--border-2); box-shadow: 0 20px 50px -20px rgba(0,0,0,0.7); font-size: 13px; font-weight: 500; animation: rise .3s; max-width: 380px; }
.toast.err { border-color: rgba(244,63,94,0.4); }
.toast svg { width: 16px; height: 16px; }
.toast.ok svg { color: var(--ok); }
.toast.err svg { color: var(--crit); }
.modal-wrap { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: rgba(3,4,8,0.6); backdrop-filter: blur(6px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; padding: 26px; border-radius: 22px; background: var(--surface-solid); border: 1px solid var(--border-2); box-shadow: 0 40px 100px -30px rgba(0,0,0,0.8); animation: rise .3s cubic-bezier(.2,.8,.2,1); }
.modal h3 { margin: 0 0 4px; font-size: 19px; letter-spacing: -0.02em; }
.modal .lead { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.modal-actions .left { margin-right: auto; }
.test-result { font-size: 12.5px; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.test-result.ok { background: rgba(34,197,94,0.1); color: #4ade80; }
.test-result.err { background: rgba(244,63,94,0.1); color: #fb7185; }

.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.note { padding: 12px 14px; border-radius: 12px; background: rgba(96,165,250,0.07); border: 1px solid rgba(96,165,250,0.18); color: var(--text-2); font-size: 12.5px; }
.about { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
code.inline { font-family: var(--mono); font-size: 12px; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }

/* ============ Responsive ============ */
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .g-2-1, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); background: var(--bg-2); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,0.5); }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { padding: 12px 16px; }
  .view { padding: 4px 16px 40px; }
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .host-chip { display: none; }
}
@media (max-width: 640px) {
  .g-4 { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: 26px; }
  .card { padding: 18px 16px; }
  .table-wrap { margin: 0 -16px -18px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
  .tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .mon-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-pill #liveText { display: none; }
  .search input { min-width: 0; }
  .crumbs h2 { font-size: 18px; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
