:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  background: #090b10;
  color: #f4f6fa;
  --panel: #141820;
  --muted: #9199a8;
  --line: #282e39;
  --green: #53d27a;
  --blue: #4b95ff;
  --danger: #ec6a5c;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #17202d 0, #090b10 42%); }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.shell { width: min(920px, 100%); margin: auto; padding: max(20px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom)); }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h1 { margin: 2px 0 0; font-size: clamp(25px, 6vw, 38px); }
h2 { margin: 0 0 10px; font-size: 18px; }
p { color: var(--muted); line-height: 1.55; }
.eyebrow { margin: 0; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.panel { background: #141820; background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 14px 40px #0005; }
.login { padding: 20px; }
label { display: block; margin-bottom: 8px; color: #cdd3de; font-size: 13px; }
.login-row { display: flex; gap: 8px; }
input { min-width: 0; flex: 1; padding: 13px 14px; color: #fff; background: #090c12; border: 1px solid #343b49; border-radius: 10px; outline: none; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #4b95ff22; }
button { min-height: 42px; padding: 9px 13px; color: #f3f6fa; background: #262c37; border: 1px solid #343b48; border-radius: 10px; }
button:active { transform: translateY(1px); }
.primary { color: #07120a; background: var(--green); border-color: var(--green); font-weight: 750; }
.secondary { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.text-button { min-height: 30px; padding: 4px 8px; color: var(--muted); background: transparent; border: 0; }
.state { flex: none; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.state.offline { color: #b6bdc9; background: #262b34; }
.state.connecting { color: #cfe2ff; background: #234975; }
.state.online { color: #bdf5cc; background: #174b2a; }
.error { min-height: 20px; margin: 8px 0 0; color: #ff8e84; font-size: 13px; }
.hidden { display: none !important; }
.summary-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.summary-row > div { display: flex; align-items: baseline; gap: 7px; margin-right: auto; }
.summary-row span { font-size: 26px; font-weight: 800; }
small { color: var(--muted); }
.device-list { display: grid; gap: 14px; }
.device-card { padding: 16px; }
.device-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.device-heading > div { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 8px; }
.device-heading small { grid-column: 2; margin-top: 3px; }
.online-dot { width: 8px; height: 8px; background: var(--green); border-radius: 50%; box-shadow: 0 0 10px var(--green); }
.last-update { color: var(--muted); font-size: 11px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.metrics > div { display: flex; flex-direction: column; gap: 5px; padding: 11px; background: #0d1118; border-radius: 10px; }
.metrics strong { font-size: 17px; }
.account-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 10px; }
.account-tabs button.active { color: #07120a; background: var(--green); border-color: var(--green); font-weight: 750; }
.button-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.preview-panel { margin: 12px 0; padding: 12px; background: #0d1118; border: 1px solid var(--line); border-radius: 12px; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.preview-heading > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.preview-heading > div:last-child { display: flex; gap: 6px; }
.preview-heading button { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.preview-stage { display: grid; place-items: center; min-height: 180px; overflow: hidden; background: #030507; border-radius: 9px; }
.preview-stage > * { grid-area: 1 / 1; }
.preview-placeholder { padding: 20px; text-align: center; font-size: 13px; }
.preview-image { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; cursor: crosshair; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.preview-help { margin: 8px 0 0; font-size: 11px; }
.device-note { min-height: 20px; margin: 11px 0 0; font-size: 12px; }
.log-panel { margin-top: 14px; padding: 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; }
.event-log { margin: 0; padding: 0; list-style: none; max-height: 220px; overflow: auto; }
.event-log li { padding: 8px 0; color: #c8ced8; border-top: 1px solid var(--line); font-size: 12px; }
.event-log time { margin-right: 8px; color: var(--muted); }
@media (max-width: 650px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .button-grid { grid-template-columns: repeat(2, 1fr); }
  .login-row { flex-direction: column; }
}
