:root {
  color-scheme: dark;
  --bg: #070a12;
  --bg-soft: #0a0f1c;
  --panel: #0f172a;
  --panel-2: #111c31;
  --panel-3: #0b1324;
  --line: rgba(148, 163, 184, 0.12);
  --line-strong: rgba(148, 163, 184, 0.22);
  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --dim: #64748b;
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.1);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.1);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.1);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.1);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.1);
  --blue: #60a5fa;
  --radius: 18px;
  --font: "Inter", "Roboto", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sidebar-w: 268px;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.18);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; background:
    radial-gradient(900px 600px at 80% -10%, rgba(34, 211, 238, 0.055), transparent 60%),
    radial-gradient(800px 500px at 10% 100%, rgba(139, 92, 246, 0.05), transparent 60%),
    var(--bg);
  color: var(--text); font-family: var(--font); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(34, 211, 238, 0.28); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #243247; border-radius: 20px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #334155; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column; padding: 20px 16px;
  background: linear-gradient(180deg, #0b1220 0%, #080d17 100%);
  border-right: 1px solid var(--line);
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 11px; font-weight: 800; font-size: 18px; color: #051018;
  background: linear-gradient(135deg, #67e8f9, #22d3ee 45%, #3b82f6);
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.18), 0 0 0 1px rgba(34,211,238,.3);
}
.side-brand-text { display: flex; flex-direction: column; line-height: 1.16; }
.side-brand-text strong { font-size: 15px; font-weight: 750; letter-spacing: -0.02em; }
.side-brand-text span { font-size: 11px; color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.side-close { margin-left: auto; display: none; }
.side-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px;
  border-radius: 11px; font-size: 13px; font-weight: 550; text-align: left;
  transition: background .18s, color .18s, border-color .18s;
}
.nav-item:hover { background: rgba(148, 163, 184, 0.06); color: var(--text-2); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.11), rgba(59, 130, 246, 0.05));
  border-color: rgba(34, 211, 238, 0.15); color: #e0faff;
}
.nav-item.active .nav-icon { color: var(--cyan); }
.nav-icon { width: 22px; display: grid; place-items: center; font-size: 15px; color: #64748b; transition: color .18s; }
.nav-count { margin-left: auto; font-size: 10px; font-weight: 700; background: rgba(148, 163, 184, 0.1); color: var(--muted); border-radius: 999px; min-width: 21px; height: 19px; display: grid; place-items: center; padding: 0 6px; }
.nav-item.active .nav-count { background: rgba(34, 211, 238, 0.12); color: #a5f3fc; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.plan-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  background: linear-gradient(140deg, rgba(34, 211, 238, 0.07), rgba(59, 130, 246, 0.03) 50%, rgba(139, 92, 246, 0.05));
}
.plan-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--dim); font-weight: 700; }
.plan-name { margin-top: 6px; font-size: 14px; font-weight: 700; }
.plan-meta { margin-top: 4px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.plan-card .btn { margin-top: 11px; width: 100%; }
.side-user { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 16px 6px 2px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #1e3a5f, #0e7490); color: #ecfeff; font-weight: 700; font-size: 13px;
  border: 1px solid rgba(34, 211, 238, 0.25);
}
.side-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-user-text strong { font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text span { font-size: 10px; color: var(--dim); text-transform: capitalize; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); transition: background .18s, color .18s; }
.icon-btn:hover { background: rgba(148, 163, 184, 0.08); color: var(--text); }
.side-close { font-size: 22px; border: 0; }

.app-main { margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w)); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 15px clamp(18px, 2.4vw, 34px);
  background: rgba(7, 10, 18, 0.78); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.mobile-menu { display: none; }
.page-heading { min-width: 0; }
.crumb { display: block; font-size: 10px; color: var(--dim); letter-spacing: 0.03em; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-heading h1 { margin: 0; font-size: clamp(18px, 1.8vw, 23px); letter-spacing: -0.035em; font-weight: 720; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mqtt-pill, .sub-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(148, 163, 184, 0.04); font-size: 10.5px; color: var(--muted); white-space: nowrap;
}
.mqtt-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.mqtt-pill.online i { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1); }
.mqtt-pill.offline i { background: var(--red); }
.sub-pill { color: #a5f3fc; border-color: rgba(34, 211, 238, 0.17); background: rgba(34, 211, 238, 0.06); font-weight: 650; }
.sub-pill.expired { color: #fda4af; border-color: rgba(251, 113, 133, 0.22); background: var(--red-soft); }
.top-avatar { width: 34px; height: 34px; }
.main-content { width: 100%; max-width: 1580px; margin: 0 auto; padding: clamp(18px, 2.2vw, 28px) clamp(18px, 2.4vw, 34px) 40px; flex: 1; }
.tab-panel { display: none; animation: fadeUp .32s ease both; }
.tab-panel.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.app-footer { display: flex; align-items: center; gap: 9px; padding: 14px clamp(18px, 2.4vw, 34px); border-top: 1px solid var(--line); color: #475569; font-size: 10px; }
.footer-spacer { flex: 1; }

h2, h3, h4 { letter-spacing: -0.025em; }
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 4px 0 24px; }
.eyebrow { display: inline-block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--cyan); font-weight: 750; margin-bottom: 8px; }
.eyebrow.admin { color: var(--violet); }
.section-title h2 { margin: 0 0 8px; font-size: clamp(24px, 2.4vw, 31px); font-weight: 740; }
.section-title p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.65; max-width: 650px; }
.section-count { border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 10.5px; color: var(--muted); white-space: nowrap; background: rgba(148, 163, 184, 0.04); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 26px 0 14px; }
.section-head.compact { align-items: center; margin-top: 24px; }
.section-head h3 { margin: 0 0 5px; font-size: 16px; }
.section-head p { margin: 0; color: var(--dim); font-size: 11.5px; }
.section-note { color: var(--dim); font-size: 11px; }
.updated-note { display: inline-flex; align-items: center; gap: 7px; color: var(--dim); font-size: 10.5px; }
.updated-note i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: breathe 2s infinite; }
@keyframes breathe { 50% { opacity: .35; } }

.fleet-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.fleet-stat { border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; background: linear-gradient(150deg, rgba(17, 27, 46, 0.72), rgba(10, 16, 29, 0.8)); min-width: 0; }
.fleet-stat span { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 650; }
.fleet-stat strong { display: block; margin: 4px 0 1px; font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fleet-stat strong.mono { font-size: 12px; color: #a5f3fc; }
.fleet-stat small { display: block; font-size: 9.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-manage { align-self: flex-start; font-size: 10px; color: #67e8f9; }
.device-tag { display: inline-block; margin-top: 3px; padding: 2px 6px; border-radius: 5px; background: rgba(34, 211, 238, 0.06); border: 1px solid rgba(34, 211, 238, 0.14); color: #67e8f9; font-size: 8.5px; letter-spacing: .02em; text-transform: none; font-weight: 600; }
.switch-card .device-tag { margin: 0 0 3px; }
.sensor-title .device-tag { display: inline-block; margin-top: 3px; letter-spacing: .02em; }
.device-manager { display: flex; flex-direction: column; gap: 16px; }
.manage-intro { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.device-manage-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow: auto; }
.manage-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(148, 163, 184, 0.03); }
.manage-row.active { border-color: rgba(34, 211, 238, 0.25); background: rgba(34, 211, 238, 0.05); }
.manage-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.manage-info strong { font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.manage-info .mono { font-family: var(--mono); font-size: 9.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-info small { font-size: 10px; color: var(--muted); }
.manage-actions { display: flex; gap: 6px; flex-shrink: 0; }
.manage-title { margin: 4px 0 0; font-size: 13px; }
.manage-form { display: flex; gap: 10px; align-items: flex-end; }
.manage-form .field { flex: 1; margin: 0; }
@media (max-width: 860px) { .fleet-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .manage-form { flex-direction: column; align-items: stretch; } .manage-row { flex-wrap: wrap; } }

.hero-card {
  position: relative; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 22px;
  padding: clamp(20px, 2.6vw, 30px); min-height: 205px;
  background:
    linear-gradient(120deg, rgba(17, 30, 52, 0.96), rgba(11, 22, 40, 0.98) 54%, rgba(8, 15, 28, 0.98));
  box-shadow: var(--shadow);
}
.hero-card::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 38px 38px; mask-image: radial-gradient(ellipse at 85% 40%, #000, transparent 72%); pointer-events: none;
}
.hero-glow { position: absolute; width: 430px; height: 430px; right: -110px; top: -190px; border-radius: 50%; background: radial-gradient(circle, rgba(34, 211, 238, 0.18), transparent 68%); pointer-events: none; transition: background 1s; }
.hero-card.outage .hero-glow { background: radial-gradient(circle, rgba(251, 191, 36, 0.2), transparent 68%); }
.hero-card.sos .hero-glow { background: radial-gradient(circle, rgba(251, 113, 133, 0.24), transparent 68%); }
.hero-main { position: relative; display: flex; align-items: center; gap: 22px; z-index: 1; }
.power-orb {
  width: 82px; height: 82px; flex-shrink: 0; border-radius: 24px; display: grid; place-items: center;
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.18), rgba(59, 130, 246, 0.06));
  border: 1px solid rgba(34, 211, 238, 0.25); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 20px 50px rgba(34, 211, 238, 0.08);
  transition: background .4s, border-color .4s, box-shadow .4s;
}
.power-orb.battery { background: linear-gradient(145deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.05)); border-color: rgba(251, 191, 36, 0.32); box-shadow: 0 20px 50px rgba(251, 191, 36, 0.1); }
.power-orb.critical { background: linear-gradient(145deg, rgba(251, 113, 133, 0.2), rgba(190, 24, 93, 0.05)); border-color: rgba(251, 113, 133, 0.35); animation: alarmPulse 1.4s infinite; }
@keyframes alarmPulse { 50% { box-shadow: 0 0 0 10px rgba(251, 113, 133, 0.06), 0 0 40px rgba(251, 113, 133, 0.18); } }
.power-bolt { font-size: 36px; filter: drop-shadow(0 0 16px rgba(34, 211, 238, 0.5)); }
.power-orb.battery .power-bolt { filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.45)); }
.hero-copy { flex: 1; min-width: 0; }
.eyebrow-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10.5px; font-weight: 550; text-transform: uppercase; letter-spacing: 0.08em; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.live-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1); }
.live-dot.offline { background: var(--red); box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.08); }
.hero-copy h2 { margin: 12px 0 6px; font-size: clamp(23px, 2.5vw, 31px); font-weight: 740; }
.hero-copy > p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; max-width: 560px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px 30px; margin-top: 22px; }
.hero-stats div { display: flex; flex-direction: column; gap: 3px; }
.hero-stats span { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); font-weight: 650; }
.hero-stats strong { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-side { margin-left: auto; align-self: stretch; width: 205px; flex-shrink: 0; display: flex; flex-direction: column; gap: 9px; position: relative; z-index: 2; }
.mini-label { font-size: 9.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 650; }
.hero-temp { font-size: 10.5px; color: var(--dim); margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.hero-temp strong { color: var(--text-2); }
.power-badge {
  position: absolute; top: 22px; right: 24px; z-index: 3; font-size: 9px; font-weight: 800; letter-spacing: 0.12em;
  padding: 6px 9px; border-radius: 7px; background: rgba(52, 211, 153, 0.1); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.22);
}
.power-badge.battery { background: var(--amber-soft); color: #fcd34d; border-color: rgba(251, 191, 36, 0.25); }
.power-badge.critical { background: var(--red-soft); color: #fda4af; border-color: rgba(251, 113, 133, 0.25); }

.alert { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line-strong); background: rgba(148, 163, 184, 0.05); border-radius: 13px; padding: 12px 14px; font-size: 12px; line-height: 1.6; color: var(--text-2); margin-bottom: 18px; }
.alert::before { content: "!"; width: 19px; height: 19px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: rgba(148,163,184,.12); font-weight: 800; font-size: 11px; color: var(--muted); }
.alert-error { border-color: rgba(251, 113, 133, 0.3); background: var(--red-soft); color: #fecdd3; }
.alert-error::before { background: rgba(251,113,133,.18); color: #fda4af; }
.alert-critical { border-color: rgba(251, 113, 133, 0.32); background: linear-gradient(90deg, rgba(251, 113, 133, 0.12), rgba(251, 113, 133, 0.04)); color: #fecdd3; margin: 16px 0 0; }
.alert-critical strong { display: block; color: #fda4af; margin-bottom: 2px; }
.alert-critical span { color: #fecdd3; opacity: .8; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card {
  position: relative; min-width: 0; border: 1px solid var(--line); border-radius: 17px; padding: 16px 16px 13px;
  background: linear-gradient(155deg, rgba(17, 27, 46, 0.9), rgba(10, 16, 29, 0.95));
  box-shadow: var(--shadow-sm); transition: border-color .2s, transform .2s;
}
.metric-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.metric-head { display: flex; align-items: center; gap: 10px; }
.metric-head > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.metric-icon { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 9px; font-size: 11px; font-weight: 800; letter-spacing: -0.03em; border: 1px solid transparent; }
.metric-icon.cyan { background: var(--cyan-soft); color: #67e8f9; border-color: rgba(34,211,238,.18); }
.metric-icon.green { background: var(--green-soft); color: #6ee7b7; border-color: rgba(52,211,153,.18); }
.metric-icon.amber { background: var(--amber-soft); color: #fcd34d; border-color: rgba(251,191,36,.18); }
.metric-icon.violet { background: var(--violet-soft); color: #c4b5fd; border-color: rgba(167,139,250,.18); }
.metric-label { font-size: 11px; color: var(--text-2); font-weight: 600; }
.metric-chip { font-size: 8.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 650; }
.metric-dot { margin-left: auto; width: 5px; height: 5px; border-radius: 50%; background: var(--dim); }
.metric-card.live .metric-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.gauge-wrap { position: relative; margin: 12px auto 2px; max-width: 220px; }
.gauge { width: 100%; display: block; overflow: visible; }
.gauge-track { fill: none; stroke: rgba(148, 163, 184, 0.09); stroke-width: 10; stroke-linecap: round; }
.gauge-fill { fill: none; stroke-width: 10; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .85s cubic-bezier(.2,.8,.2,1), stroke .3s; filter: drop-shadow(0 0 5px rgba(34,211,238,.25)); }
.gauge-fill.cyan { stroke: var(--cyan); }
.gauge-fill.green { stroke: var(--green); filter: drop-shadow(0 0 5px rgba(52,211,153,.22)); }
.gauge-fill.amber { stroke: var(--amber); filter: drop-shadow(0 0 5px rgba(251,191,36,.2)); }
.gauge-fill.violet { stroke: var(--violet); }
.gauge-fill.danger { stroke: var(--red) !important; }
.gauge-value { position: absolute; left: 0; right: 0; bottom: 1px; display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.gauge-value strong { font-size: clamp(24px, 2.2vw, 31px); font-weight: 720; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; line-height: 1; }
.gauge-value span { font-size: 11px; color: var(--dim); font-weight: 600; }
.metric-foot { display: flex; justify-content: space-between; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; font-size: 9px; color: var(--dim); }
.metric-foot strong { font-size: 9.5px; color: var(--muted); font-weight: 600; text-align: right; }
.metric-foot strong.ok { color: var(--green); }
.metric-foot strong.bad { color: var(--red); }
.metric-foot strong.warn { color: var(--amber); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(290px, 0.78fr); gap: 14px; margin-top: 14px; }
.side-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(160deg, rgba(16, 24, 41, 0.94), rgba(9, 14, 26, 0.96)); box-shadow: var(--shadow-sm); padding: 18px; min-width: 0; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { margin: 0 0 4px; font-size: 14px; font-weight: 650; }
.panel-head p { margin: 0; color: var(--dim); font-size: 10.5px; line-height: 1.45; }
.panel-head .link-btn { background: none; border: 0; color: #67e8f9; font-size: 10.5px; font-weight: 600; padding: 2px 0; }
.chart-panel { padding-bottom: 12px; }
.segmented { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(2,6,23,.35); flex-shrink: 0; }
.segmented button { border: 0; background: transparent; color: var(--dim); font-size: 9.5px; padding: 5px 8px; border-radius: 6px; font-weight: 600; }
.segmented button.active { background: rgba(148, 163, 184, 0.12); color: var(--text); }
.chart-legend { display: flex; gap: 15px; flex-wrap: wrap; margin: 2px 0 8px 4px; font-size: 9.5px; color: var(--dim); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
.legend-cyan { background: var(--cyan); }
.legend-green { background: var(--green); }
.legend-amber { background: var(--amber); }
.chart-box { position: relative; height: 255px; }
.chart-box canvas { width: 100%; height: 100%; display: block; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--dim); font-size: 11px; line-height: 1.5; }
.state-pill { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; border-radius: 999px; padding: 5px 8px; background: rgba(148,163,184,.08); color: var(--muted); border: 1px solid var(--line); }
.state-pill.online { background: var(--green-soft); color: #6ee7b7; border-color: rgba(52,211,153,.2); }
.state-pill.offline { background: var(--red-soft); color: #fda4af; border-color: rgba(251,113,133,.18); }
.device-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.device-row:last-child { border-bottom: 0; padding-bottom: 0; }
.device-row span { color: var(--dim); }
.device-row strong { font-weight: 600; color: var(--text-2); font-size: 10.5px; text-align: right; overflow: hidden; text-overflow: ellipsis; max-width: 62%; }
.mono { font-family: var(--mono); font-size: 10px !important; letter-spacing: 0; }
.timeline { display: flex; flex-direction: column; gap: 0; max-height: 216px; overflow: auto; padding-right: 3px; }
.timeline-item { position: relative; display: flex; gap: 10px; padding: 9px 0 9px 2px; border-bottom: 1px solid rgba(148,163,184,.07); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); margin-top: 5px; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(148,163,184,.06); }
.timeline-dot.critical { background: var(--red); box-shadow: 0 0 0 3px rgba(251,113,133,.1); }
.timeline-dot.warning { background: var(--amber); box-shadow: 0 0 0 3px rgba(251,191,36,.08); }
.timeline-dot.success { background: var(--green); box-shadow: 0 0 0 3px rgba(52,211,153,.08); }
.timeline-item div { min-width: 0; }
.timeline-item strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--text-2); line-height: 1.4; }
.timeline-item small { display: block; color: var(--dim); font-size: 9.5px; margin-top: 2px; }
.empty-inline { color: var(--dim); font-size: 11px; padding: 14px 0; }
.quick-panel { flex: 1; }

.split-layout { display: grid; grid-template-columns: 370px minmax(0, 1fr); gap: 16px; align-items: start; }
.form-panel { position: sticky; top: 92px; }
.form-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--cyan); background: var(--cyan-soft); border: 1px solid rgba(34,211,238,.16); border-radius: 8px; font-weight: 700; }
.form-grid { display: flex; flex-direction: column; gap: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 10px; font-weight: 650; color: var(--text-2); letter-spacing: .01em; }
.field small { font-size: 9.5px; color: var(--dim); line-height: 1.45; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input, .select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(2, 6, 23, 0.4);
  color: var(--text); padding: 10px 12px; font-size: 12px; outline: none; transition: border-color .18s, box-shadow .18s, background .18s;
}
.input::placeholder { color: #475569; }
.input:focus, .select:focus { border-color: rgba(34, 211, 238, 0.55); box-shadow: 0 0 0 3px rgba(34,211,238,.08); background: rgba(2,6,23,.6); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.select option { background: #0f172a; color: var(--text); }
.select-sm { width: auto; min-width: 120px; padding: 7px 28px 7px 9px; font-size: 10.5px; border-radius: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; font-size: 11.5px; font-weight: 650; transition: transform .16s, box-shadow .16s, background .16s, border-color .16s; text-decoration: none; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, #22d3ee, #3b82f6 65%, #6366f1); color: #03121f; box-shadow: 0 8px 22px rgba(34, 211, 238, 0.16); font-weight: 750; }
.btn-primary span { margin-left: auto; font-size: 14px; }
.btn-soft { background: rgba(148, 163, 184, 0.07); border-color: var(--line); color: var(--text-2); }
.btn-soft:hover { background: rgba(148, 163, 184, 0.12); }
.btn-sm { padding: 8px 11px; font-size: 10.5px; }
.btn-xs { padding: 6px 9px; font-size: 9.5px; border-radius: 8px; }
.btn-danger-soft { background: var(--red-soft); border-color: rgba(251,113,133,.22); color: #fda4af; }
.btn-danger { background: #e11d48; color: #fff; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--muted); }
.check-row input { width: 15px; height: 15px; accent-color: #22d3ee; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-actions .btn { flex: 1; min-width: 120px; }
.collection-panel { min-width: 0; }
.collection-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.collection-head h3 { margin: 0 0 3px; font-size: 15px; }
.collection-head p { margin: 0; color: var(--dim); font-size: 10.5px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 12px; }
.empty-state { grid-column: 1 / -1; border: 1px dashed var(--line-strong); border-radius: 14px; padding: 34px 20px; text-align: center; color: var(--dim); font-size: 11.5px; line-height: 1.6; background: rgba(148,163,184,.02); }
.switch-card {
  position: relative; border: 1px solid var(--line); border-radius: 15px; padding: 14px;
  background: linear-gradient(155deg, rgba(18, 28, 47, 0.95), rgba(10, 16, 29, 0.98));
  transition: border-color .2s, background .2s, box-shadow .2s; overflow: hidden;
}
.switch-card::after { content: ""; position: absolute; inset: 0; background: radial-gradient(220px 100px at 90% 0%, rgba(34,211,238,.06), transparent 70%); pointer-events: none; opacity: 0; transition: opacity .2s; }
.switch-card.on { border-color: rgba(34, 211, 238, 0.26); background: linear-gradient(155deg, rgba(14, 44, 56, 0.75), rgba(10, 22, 33, 0.98)); }
.switch-card.on::after { opacity: 1; }
.switch-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.switch-icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; background: rgba(148,163,184,.07); color: var(--dim); font-size: 14px; border: 1px solid var(--line); transition: .2s; }
.switch-card.on .switch-icon { background: var(--cyan-soft); color: #67e8f9; border-color: rgba(34,211,238,.22); box-shadow: 0 0 20px rgba(34,211,238,.08); }
.switch-delete { border: 0; background: none; color: #475569; font-size: 15px; padding: 2px 4px; border-radius: 5px; line-height: 1; }
.switch-delete:hover { color: var(--red); background: var(--red-soft); }
.switch-card h4 { margin: 12px 0 3px; font-size: 12.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-meta { font-size: 9px; color: var(--dim); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 15px; }
.switch-state { font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; color: var(--dim); }
.switch-card.on .switch-state { color: var(--green); }
.mini-toggle { position: relative; width: 39px; height: 22px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(2,6,23,.5); padding: 0; transition: background .2s, border-color .2s; }
.mini-toggle::before { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; top: 2px; left: 2px; background: #64748b; transition: transform .22s, background .22s; }
.mini-toggle.on { background: rgba(34, 211, 238, 0.17); border-color: rgba(34,211,238,.45); }
.mini-toggle.on::before { transform: translateX(17px); background: #67e8f9; box-shadow: 0 0 10px rgba(34,211,238,.5); }
.push-btn { border: 1px solid rgba(34, 211, 238, 0.22); background: rgba(34, 211, 238, 0.07); color: #a5f3fc; font-size: 9.5px; font-weight: 650; padding: 6px 10px; border-radius: 8px; }
.push-btn:hover { background: rgba(34,211,238,.13); }
.switch-card.busy { opacity: .7; pointer-events: none; }
.badge-soft { font-size: 8px; padding: 3px 6px; border-radius: 5px; background: rgba(148,163,184,.07); border: 1px solid var(--line); color: var(--dim); }

.sensor-card {
  border: 1px solid var(--line); border-radius: 15px; padding: 14px; background: linear-gradient(155deg, rgba(17,27,45,.95), rgba(9,15,27,.98));
  transition: border-color .2s, transform .2s; overflow: hidden; min-width: 0;
}
.sensor-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.sensor-head { display: flex; align-items: center; gap: 9px; }
.sensor-type-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; font-size: 14px; background: rgba(148,163,184,.07); border: 1px solid var(--line); }
.sensor-title { min-width: 0; }
.sensor-title h4 { margin: 0; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.sensor-title span { font-size: 8.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.sensor-delete { margin-left: auto; border: 0; background: none; color: #475569; font-size: 14px; padding: 2px; }
.sensor-delete:hover { color: var(--red); }
.sensor-reading { display: flex; align-items: baseline; gap: 5px; margin: 15px 0 1px; min-height: 33px; }
.sensor-reading strong { font-size: 27px; line-height: 1; letter-spacing: -0.05em; font-weight: 720; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sensor-reading span { font-size: 10px; color: var(--dim); font-weight: 600; }
.sensor-spark-wrap { height: 38px; margin: 10px 0 6px; }
.sensor-spark { width: 100%; height: 100%; display: block; }
.sensor-foot { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 6px; font-size: 8.5px; color: var(--dim); }
.sensor-foot span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.sensor-state { color: var(--green); }
.sensor-card.offline .sensor-state { color: var(--dim); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.status-light { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.status-light.on { background: var(--green); box-shadow: 0 0 0 4px rgba(52,211,153,.08), 0 0 12px var(--green); }
.tag { font-size: 8.5px; padding: 4px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--dim); background: rgba(148,163,184,.04); font-weight: 650; white-space: nowrap; }
.info-strip { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; margin-top: 13px; font-size: 9px; color: var(--dim); background: rgba(2,6,23,.25); }
.info-strip code { font-family: var(--mono); color: var(--muted); font-size: 8.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 14px; }
.command-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.command-list > div:last-child { border-bottom: 0; }
.command-list code { font-family: var(--mono); color: #a5f3fc; background: var(--cyan-soft); border: 1px solid rgba(34,211,238,.12); border-radius: 5px; padding: 3px 6px; font-size: 9px; }
.command-list span { color: var(--dim); text-align: right; }
.bot-preview { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: rgba(2,6,23,.28); }
.bot-preview-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.bot-avatar { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: rgba(34,211,238,.1); border: 1px solid rgba(34,211,238,.18); color: #67e8f9; font-size: 12px; }
.bot-preview-head strong { display: block; font-size: 10px; }
.bot-preview-head small { display: block; color: var(--dim); font-size: 8.5px; margin-top: 1px; }
.bot-bubble { font-size: 9.5px; line-height: 1.7; color: var(--text-2); background: rgba(30, 41, 59, 0.6); border-radius: 3px 10px 10px 10px; padding: 9px 10px; }
.bot-bubble b { color: #f8fafc; }
.bot-buttons { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; }
.bot-buttons span { font-size: 8px; padding: 5px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); background: rgba(148,163,184,.05); }
.credentials-panel { margin-top: 0; }
.cred-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 13px; }
.cred-toolbar .select { width: auto; min-width: 200px; padding: 8px 30px 8px 10px; font-size: 11px; }
.cred-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cred-item { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: rgba(2,6,23,.26); min-width: 0; }
.cred-item.wide { grid-column: 1 / -1; }
.cred-item span { display: block; font-size: 8.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .09em; font-weight: 650; margin-bottom: 4px; }
.cred-item code { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cred-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.hint-inline { font-size: 9px; color: var(--dim); }
.addr { font-family: var(--mono); font-size: 10px; color: var(--muted); }

.filter-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; margin: 0 -3px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.data-table th { text-align: left; font-size: 8.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 700; padding: 8px 9px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.data-table td { font-size: 10.5px; color: var(--text-2); padding: 10px 9px; border-bottom: 1px solid rgba(148,163,184,.07); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(148,163,184,.025); }
.data-table .empty-cell { text-align: center; color: var(--dim); padding: 26px 10px; font-size: 10.5px; }
.table-wrap.small { margin-top: 14px; }
.table-wrap.small .data-table { min-width: 430px; }
.table-wrap.small .data-table th, .table-wrap.small .data-table td { padding: 8px 7px; font-size: 9.5px; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 9px; color: var(--dim); margin-top: 2px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sev { display: inline-flex; padding: 3px 6px; border-radius: 5px; font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border: 1px solid var(--line); color: var(--dim); background: rgba(148,163,184,.05); white-space: nowrap; }
.sev.critical { color: #fda4af; background: var(--red-soft); border-color: rgba(251,113,133,.18); }
.sev.warning { color: #fcd34d; background: var(--amber-soft); border-color: rgba(251,191,36,.17); }
.sev.success { color: #6ee7b7; background: var(--green-soft); border-color: rgba(52,211,153,.16); }
.type-badge { font-family: var(--mono); font-size: 8.5px; color: var(--muted); }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 16px; }
.plan-option { position: relative; border: 1px solid var(--line); border-radius: 15px; padding: 18px; background: linear-gradient(150deg, rgba(17,27,45,.95), rgba(9,15,27,.98)); overflow: hidden; display: flex; flex-direction: column; }
.plan-option.featured { border-color: rgba(34,211,238,.28); box-shadow: inset 0 1px 0 rgba(34,211,238,.08), 0 14px 38px rgba(34,211,238,.05); }
.plan-option.featured::before { content: "POPULER"; position: absolute; top: 12px; right: 12px; font-size: 7.5px; letter-spacing: .1em; font-weight: 800; padding: 4px 6px; border-radius: 5px; background: rgba(34,211,238,.12); color: #67e8f9; border: 1px solid rgba(34,211,238,.18); }
.plan-option h4 { margin: 0 0 4px; font-size: 15px; }
.plan-desc { color: var(--dim); font-size: 9.5px; }
.price { margin: 15px 0 13px; display: flex; align-items: baseline; gap: 4px; }
.price strong { font-size: 25px; letter-spacing: -.04em; font-weight: 720; }
.price span { font-size: 9.5px; color: var(--dim); }
.plan-features { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.plan-features li { font-size: 9.5px; color: var(--muted); display: flex; gap: 6px; line-height: 1.45; }
.plan-features li::before { content: "✓"; color: var(--green); font-weight: 700; }
.invoice-status { font-size: 8.5px; font-weight: 700; text-transform: uppercase; padding: 4px 7px; border-radius: 5px; letter-spacing: .04em; }
.invoice-status.paid { color: #6ee7b7; background: var(--green-soft); }
.invoice-status.pending { color: #fcd34d; background: var(--amber-soft); }
.invoice-status.expired, .invoice-status.failed { color: #fda4af; background: var(--red-soft); }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 32px 0 16px; padding-top: 24px; border-top: 1px solid var(--line-strong); }
.admin-head h2 { margin: 0; font-size: 23px; }
.admin-head p { margin: 5px 0 0; color: var(--muted); font-size: 11.5px; }
.admin-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 16px; }
.file-drop { position: relative; border: 1px dashed var(--line-strong); border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); font-size: 10.5px; background: rgba(2,6,23,.24); cursor: pointer; }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-drop:hover { border-color: rgba(34,211,238,.4); background: rgba(34,211,238,.03); }

.sidebar-scrim { display: none; }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(2,6,23,.65); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.show { opacity: 1; pointer-events: auto; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 40px)); }
.toast { border: 1px solid var(--line-strong); border-radius: 11px; padding: 11px 13px; background: rgba(15, 23, 42, 0.96); box-shadow: var(--shadow); color: var(--text-2); font-size: 11px; line-height: 1.5; animation: toastIn .25s ease both; display: flex; gap: 9px; align-items: flex-start; backdrop-filter: blur(12px); }
.toast::before { content: "✓"; color: var(--green); font-weight: 800; }
.toast.error::before { content: "!"; color: var(--red); }
.toast.info::before { content: "i"; color: var(--cyan); }
.toast.warn::before { content: "!"; color: var(--amber); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .2s ease both; }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
.modal { width: min(560px, calc(100vw - 28px)); border: 1px solid var(--line-strong); border-radius: 18px; background: #0d1525; color: var(--text); padding: 0; box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.modal::backdrop { background: rgba(2,6,23,.72); backdrop-filter: blur(4px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 18px 19px; font-size: 12px; line-height: 1.65; color: var(--muted); max-height: 65vh; overflow: auto; }
.modal-body strong { color: var(--text); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 19px; border-top: 1px solid var(--line); }
.modal-body .modal-kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.modal-body .modal-kv:last-child { border-bottom: 0; }
.modal-body .modal-kv span { color: var(--dim); }
.modal-body .modal-kv strong { font-weight: 600; text-align: right; }
.qris-box { margin-top: 14px; border: 1px dashed var(--line-strong); border-radius: 12px; padding: 16px; text-align: center; background: rgba(2,6,23,.32); }
.qris-code { display: inline-grid; grid-template-columns: repeat(9, 8px); gap: 2px; padding: 10px; background: #f8fafc; border-radius: 5px; }
.qris-code i { width: 8px; height: 8px; background: #0f172a; }
.qris-code i.white { background: #f8fafc; }
.qris-box code { display: block; margin-top: 10px; font-size: 8.5px; color: var(--dim); word-break: break-all; font-family: var(--mono); }
.modal-note { font-size: 10px; color: var(--amber); background: var(--amber-soft); border: 1px solid rgba(251,191,36,.16); border-radius: 8px; padding: 8px 10px; margin-top: 12px; }
.noscript { position: fixed; inset: 0; z-index: 999; background: #070a12; color: #fff; display: grid; place-items: center; padding: 30px; text-align: center; font-size: 15px; }

@media (max-width: 1280px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-stack { display: grid; grid-template-columns: 1fr 1fr; }
  .plan-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1080px) {
  .split-layout { grid-template-columns: 320px minmax(0, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .hero-side { width: 180px; }
}
@media (max-width: 960px) {
  :root { --sidebar-w: 272px; }
  .sidebar { transform: translateX(-100%); transition: transform .28s ease; box-shadow: 0 0 60px rgba(0,0,0,.5); }
  .sidebar.open { transform: none; }
  .side-close { display: inline-grid; }
  .app-main { margin-left: 0; width: 100%; }
  .mobile-menu { display: inline-grid; }
  .split-layout { grid-template-columns: 1fr; }
  .form-panel { position: static; }
  .plan-grid { grid-template-columns: repeat(3, 1fr); }
  .side-stack { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .crumb { display: none; }
  .page-heading h1 { font-size: 17px; }
  .mqtt-pill { display: none; }
  .sub-pill { font-size: 9px; padding: 6px 8px; }
  .top-avatar { display: none; }
  .main-content { padding: 16px 14px 30px; }
  .hero-card { padding: 18px; border-radius: 18px; }
  .hero-main { flex-wrap: wrap; gap: 15px; }
  .power-orb { width: 61px; height: 61px; border-radius: 18px; }
  .power-bolt { font-size: 28px; }
  .hero-copy h2 { font-size: 22px; }
  .hero-copy > p { font-size: 11.5px; }
  .hero-stats { gap: 12px 22px; margin-top: 17px; }
  .hero-stats strong { font-size: 13px; }
  .hero-side { width: 100%; order: 10; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; margin-top: 2px; }
  .hero-side .mini-label { grid-column: 1 / -1; }
  .hero-side .select { width: 100%; }
  .hero-temp { margin-top: 0; padding: 9px 0 0; border-top: 1px solid var(--line); grid-column: 1 / -1; }
  .power-badge { top: 16px; right: 16px; }
  .section-title { margin-bottom: 17px; }
  .section-title h2 { font-size: 23px; }
  .section-count { display: none; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric-card { padding: 12px 12px 11px; border-radius: 14px; }
  .metric-label { font-size: 10px; }
  .metric-icon { width: 26px; height: 26px; font-size: 9px; }
  .metric-chip { display: none; }
  .gauge-wrap { margin-top: 8px; }
  .gauge-value strong { font-size: 22px; }
  .metric-foot { font-size: 8px; padding-top: 8px; margin-top: 0; }
  .metric-foot strong { font-size: 8px; }
  .side-stack { grid-template-columns: 1fr; }
  .chart-box { height: 220px; }
  .panel { padding: 14px; border-radius: 15px; }
  .panel-head { margin-bottom: 11px; }
  .admin-head { margin-top: 24px; }
  .plan-grid { grid-template-columns: 1fr; }
  .plan-option { padding: 16px; }
  .price strong { font-size: 22px; }
  .cred-grid { grid-template-columns: 1fr; }
  .cred-item.wide { grid-column: auto; }
  .cred-toolbar .select { width: 100%; }
  .cred-toolbar .btn { flex: 1; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid { gap: 10px; }
  .filter-row { width: 100%; }
  .panel-head .filter-row { margin-top: 4px; }
  .section-head { flex-wrap: wrap; }
  .form-actions .btn { min-width: 100px; }
  .app-footer { padding: 12px 16px; font-size: 9px; }
  .toast-stack { right: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
}
@media (max-width: 430px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { padding: 11px 10px; }
  .gauge-value strong { font-size: 20px; }
  .metric-foot span { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .topbar-right { gap: 6px; }
  .sub-pill { display: none; }
  .hero-badge-label { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .modal { width: calc(100vw - 18px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
