:root {
  --bg: #0b0e12;
  --surface: #12171d;
  --surface-raised: #181f27;
  --line: #2a333e;
  --text: #edf2f7;
  --muted: #98a5b3;
  --accent: #69d6a6;
  --accent-ink: #07130e;
  --danger: #ff8b8b;
  --warning: #f2c76e;
  --radius: 10px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, ui-sans-serif, system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button, summary, select, input[type="file"] { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.5rem, 2vw, 2rem); letter-spacing: -0.03em; }
h2 { margin-bottom: 0; font-size: 1.2rem; }
h3 { margin-bottom: 3px; font-size: 1rem; }

.topbar { min-height: 86px; display: flex; justify-content: space-between; align-items: center; padding: 18px clamp(20px, 5vw, 72px); border-bottom: 1px solid var(--line); }
.page-shell { width: min(1380px, calc(100% - 40px)); margin: 30px auto 80px; }
.eyebrow { margin-bottom: 4px; color: var(--accent); font-size: .72rem; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { margin-bottom: 0; font-size: .82rem; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.summary article { min-height: 94px; display: flex; flex-direction: column; justify-content: center; padding: 18px 22px; background: var(--surface); border-right: 1px solid var(--line); }
.summary article:last-child { border-right: 0; }
.summary strong { font-size: 1.65rem; letter-spacing: -.03em; }
.summary span { color: var(--muted); font-size: .8rem; }

.section { margin-top: 28px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 13px; }
.pending-section { padding: 20px; border: 1px solid color-mix(in srgb, var(--warning), transparent 55%); border-radius: var(--radius); background: color-mix(in srgb, var(--warning), transparent 94%); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.device-card { display: flex; justify-content: space-between; align-items: end; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pair-code { margin: 10px 0 3px; font: 700 1.35rem/1 ui-monospace, monospace; letter-spacing: .08em; }

.device-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.device-row { display: grid; grid-template-columns: minmax(190px, 1.3fr) minmax(130px, .75fr) minmax(150px, .9fr) minmax(240px, 1.25fr) auto auto; gap: 18px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.device-row:last-child { border-bottom: 0; }
.device-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.status-dot.online { background: var(--accent); }
.device-meta { display: flex; flex-direction: column; font-size: .8rem; }
.device-meta span { color: var(--muted); }
.device-meta strong { font-weight: 600; }
.sync-ok { color: var(--accent); }
.sync-error { color: var(--danger); }
.inline-form { display: flex; gap: 8px; }

.split-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.compact-list { border-top: 1px solid var(--line); }
.compact-list article { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.form-drawer { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.form-drawer summary { padding: 14px 16px; font-weight: 700; }
.form-drawer[open] summary { border-bottom: 1px solid var(--line); }
.form-drawer form { padding: 18px; }

.stack { display: grid; gap: 14px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: var(--bg); color: var(--text); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
fieldset { display: grid; gap: 12px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
legend { padding: 0 7px; color: var(--text); font-size: .78rem; font-weight: 700; }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check-row input { width: 17px; min-height: 17px; }

button { min-height: 38px; padding: 8px 13px; border: 1px solid transparent; border-radius: 7px; font-weight: 720; }
button.primary { background: var(--accent); color: var(--accent-ink); }
button.quiet { border-color: var(--line); background: transparent; color: var(--text); }
button.danger { padding-inline: 8px; background: transparent; color: var(--danger); }
button:hover { filter: brightness(1.08); }
.badge { padding: 4px 8px; border-radius: 999px; background: var(--surface-raised); color: var(--muted); font-size: .7rem; font-weight: 700; }
.badge.warning { color: var(--warning); }

.empty-state { padding: 38px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--text); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: clamp(18px, 4vw, 52px); background: radial-gradient(circle at 12% 18%, #203126 0, transparent 34%), radial-gradient(circle at 88% 84%, #21272f 0, transparent 32%), #090c0f; }
.login-layout { width: min(980px, 100%); min-height: 620px; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(360px, .88fr); overflow: hidden; border: 1px solid #303942; border-radius: 18px; background: #11161b; box-shadow: 0 32px 90px #0008; }
.login-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 620px; padding: clamp(32px, 5vw, 58px); overflow: hidden; background: linear-gradient(145deg, #151d1a 0%, #10161a 62%, #18212a 100%); }
.login-story::after { content: ""; position: absolute; right: -120px; bottom: -170px; width: 430px; height: 430px; border: 1px solid #69d6a630; border-radius: 50%; box-shadow: 0 0 0 54px #69d6a610, 0 0 0 108px #69d6a608; pointer-events: none; }
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.login-brand span { width: 42px; height: 42px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 900; letter-spacing: -.06em; }
.login-brand strong { font-size: .95rem; letter-spacing: -.01em; }
.login-story-copy { position: relative; z-index: 1; max-width: 510px; margin: 70px 0 58px; }
.login-story-copy h1 { margin: 12px 0 24px; font-size: clamp(2.65rem, 5.3vw, 4.85rem); line-height: .92; letter-spacing: -.065em; }
.login-story-copy h1 em { color: var(--accent); font-style: normal; }
.login-story-copy > p:last-child { max-width: 430px; margin: 0; color: #a7b3be; font-size: 1rem; }
.login-features { position: relative; z-index: 1; display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; color: #bac4cd; font-size: .79rem; }
.login-features li { display: flex; align-items: center; gap: 12px; }
.login-features span { color: var(--accent); font: 700 .65rem ui-monospace, monospace; letter-spacing: .08em; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 5vw, 58px); background: #12171d; }
.login-panel header { margin-bottom: 28px; }
.login-panel header h2 { margin: 8px 0 10px; font-size: clamp(1.7rem, 3vw, 2.25rem); letter-spacing: -.045em; }
.login-panel header > p:last-child { margin: 0; color: var(--muted); font-size: .9rem; }
.login-panel label { color: #aeb8c1; }
.login-panel input { min-height: 48px; padding-inline: 14px; background: #0d1115; }
.login-panel button.primary { min-height: 48px; display: flex; justify-content: space-between; align-items: center; padding-inline: 16px; }
.google-button { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 11px; border: 1px solid #3b4651; border-radius: 7px; background: #f4f6f8; color: #15191d; font-weight: 750; text-decoration: none; }
.google-button:hover { background: #fff; }
.google-button span { color: #4285f4; font: 850 1.05rem Arial, sans-serif; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #727e89; font-size: .72rem; }
.login-divider::before, .login-divider::after { content: ""; height: 1px; flex: 1; background: #2b343d; }
.login-divider span { white-space: nowrap; }
.login-footnote { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 26px 0 0; color: #71808d; font-size: .72rem; }
.login-footnote span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #69d6a615; }
.alert { padding: 10px 12px; border: 1px solid var(--danger); border-radius: 7px; color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1050px) {
  .device-row { grid-template-columns: 1fr 1fr; }
  .device-main, .inline-form { grid-column: span 2; }
}
@media (max-width: 760px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .summary article:nth-child(2) { border-right: 0; }
  .summary article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .split-layout { grid-template-columns: 1fr; }
  .two-columns { grid-template-columns: 1fr; }
  .page-shell { width: min(100% - 24px, 1380px); margin-top: 18px; }
  .login-shell { padding: 0; place-items: stretch; }
  .login-layout { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .login-story { min-height: auto; padding: 28px 24px 32px; }
  .login-story-copy { margin: 46px 0 0; }
  .login-story-copy h1 { font-size: clamp(2.5rem, 13vw, 4rem); }
  .login-story-copy > p:last-child, .login-features { display: none; }
  .login-panel { padding: 38px 24px 48px; }
}
