:root {
  color-scheme: dark;
  --bg: #0d1115;
  --panel: #151b21;
  --panel-strong: #1b232b;
  --line: #2a343d;
  --text: #f3f5f6;
  --muted: #9ca8b2;
  --accent: #f0b35b;
  --accent-strong: #ffc976;
  --green: #6dd39a;
  --red: #ef7b79;
  --blue: #82b9e8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 90% -10%, #25313b 0, transparent 35%), var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 24px; }
.topbar, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.topbar { align-items: center; margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: .78rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -.045em; line-height: 1; }
h2 { margin-bottom: 0; font-size: 1.25rem; letter-spacing: -.02em; }
.status-badge { display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.status-badge.online { border-color: rgba(109, 211, 154, .45); color: var(--green); }
.status-badge.error { border-color: rgba(239, 123, 121, .45); color: var(--red); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 15%, transparent); }
.connect-card, .summary-card, .device-section { border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 92%, transparent); border-radius: 18px; }
.connect-card { padding: 22px; }
.connect-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: end; margin-top: 21px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: .9rem; }
.field-hint { color: var(--muted); font-size: .78rem; line-height: 1.35; }
input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 11px; padding: 0 13px; background: #0f1419; color: var(--text); outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,179,91,.15); }
.primary, .quiet-button, .device-action { min-height: 44px; border-radius: 11px; padding: 0 17px; border: 1px solid transparent; font-weight: 750; }
.primary { background: var(--accent); color: #1b160d; }
.primary:hover { background: var(--accent-strong); }
.quiet-button { border-color: var(--line); background: transparent; color: var(--text); }
.quiet-button:disabled { cursor: not-allowed; opacity: .45; }
.message { min-height: 22px; margin: 14px 0 0; color: var(--muted); font-size: .9rem; }
.message.error { color: var(--red); }
.message.success { color: var(--green); }
.muted { color: var(--muted); font-size: .84rem; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 14px 0 28px; }
.summary-card { padding: 18px 20px; }
.summary-label, .summary-note { display: block; color: var(--muted); font-size: .85rem; }
.summary-card strong { display: block; margin: 5px 0 1px; font-size: 1.75rem; letter-spacing: -.04em; }
.device-section { padding: 22px; }
.device-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin-top: 19px; }
.device-group { min-width: 0; border: 1px solid var(--line); border-radius: 15px; background: rgba(12,16,20,.6); overflow: hidden; }
.group-heading { display: flex; align-items: center; justify-content: space-between; padding: 14px 15px 12px; border-bottom: 1px solid var(--line); }
.group-heading h3 { margin: 0; font-size: 1rem; }
.group-count { color: var(--muted); font-size: .8rem; }
.device-list { display: grid; gap: 1px; }
.device-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 13px 15px; background: rgba(21,27,33,.65); }
.device-info { min-width: 0; }
.device-name { display: block; overflow: hidden; color: var(--text); font-size: .95rem; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.device-state { display: inline-flex; align-items: center; gap: 7px; margin-top: 5px; color: var(--muted); font-size: .82rem; }
.state-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.state-mark.on { background: var(--green); }
.state-mark.warn { background: var(--accent); }
.device-action { min-height: 36px; padding: 0 12px; border-color: var(--line); background: var(--panel-strong); color: var(--text); font-size: .84rem; }
.device-action:hover { border-color: var(--accent); color: var(--accent-strong); }
.device-action:disabled { cursor: wait; opacity: .6; }
.empty-state { padding: 34px 18px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }
footer { padding: 22px 2px 0; color: var(--muted); font-size: .8rem; text-align: center; }
@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 600px); padding-top: 24px; }
  .topbar, .section-heading { align-items: flex-start; flex-direction: column; }
  .topbar { gap: 15px; }
  .connect-grid, .summary-grid, .device-groups { grid-template-columns: 1fr; }
  .connect-grid .primary { width: 100%; }
  .device-section, .connect-card { padding: 17px; }
}
