:root {
  color-scheme: dark;
  --bg: #101716;
  --panel: #192321;
  --panel-2: #202c29;
  --line: #344440;
  --text: #f3f7f5;
  --muted: #a7b8b1;
  --mint: #a8e3ca;
  --mint-deep: #14392d;
  --amber: #f0c978;
  --red: #ffaaa3;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 50% -20%, #294238 0, var(--bg) 44rem); }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(100% - 28px, 680px); min-height: 100vh; margin: 0 auto; padding: env(safe-area-inset-top) 0 calc(24px + env(safe-area-inset-bottom)); }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #293632; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; font-size: 17px; font-weight: 650; letter-spacing: .01em; }
.brand-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #122b22; background: var(--mint); font-size: 23px; line-height: 1; }
.login-view { width: min(100%, 420px); margin: 9vh auto 0; padding: 32px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, #1d2a27, #151e1c); box-shadow: 0 22px 70px #0005; }
.intro-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: var(--mint); color: #122b22; font-size: 34px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-size: clamp(26px, 5vw, 34px); line-height: 1.14; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 19px; line-height: 1.25; letter-spacing: -.015em; }
.eyebrow { margin: 0 0 7px; color: var(--mint); font-size: 11px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.muted, .card-note, .ack-note { color: var(--muted); line-height: 1.5; }
.muted { margin-bottom: 22px; }
.login-form { display: grid; gap: 9px; }
.login-form label { margin-top: 7px; color: #dce7e2; font-size: 13px; font-weight: 600; }
.login-form input { min-height: 48px; width: 100%; padding: 0 13px; border: 1px solid #51645d; border-radius: 12px; outline: none; color: var(--text); background: #111a18; }
.login-form input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px #a8e3ca24; }
.primary-button, .secondary-button, .ack-button, .quiet-button { min-height: 50px; border-radius: 13px; padding: 0 16px; font-weight: 700; transition: transform .08s ease, filter .15s ease; }
button:active { transform: scale(.985); }
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.primary-button { border: 1px solid var(--mint); color: #11271f; background: var(--mint); }
.primary-button:hover { filter: brightness(1.04); }
.secondary-button { border: 1px solid #52615b; color: var(--text); background: #222d2a; }
.secondary-button:hover { background: #2b3834; }
.login-submit { margin-top: 12px; }
.form-error { min-height: 1.2em; margin: 1px 0 0; color: var(--red); font-size: 13px; }
.login-footnote { margin: 21px 0 0; color: #94a59e; font-size: 12px; text-align: center; }
.control-view { padding: 24px 0; }
.welcome-row { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 7px 2px 22px; }
.welcome-row h1 { margin-bottom: 0; }
.connection-state { display: inline-flex; align-items: center; gap: 7px; padding-bottom: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px currentColor; }
.dot.online { background: #83d6af; }
.dot.offline { background: var(--red); }
.alarm-card { margin: 14px 0; padding: 21px; border: 1px solid var(--line); border-radius: 21px; background: linear-gradient(145deg, var(--panel-2), var(--panel)); box-shadow: 0 8px 25px #0002; }
.card-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.card-heading .eyebrow { margin-bottom: 4px; }
.card-icon { flex: 0 0 48px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; font-size: 26px; font-weight: 750; }
.perimeter-icon { color: var(--mint); background: #173b30; }
.unknown-icon { color: var(--amber); background: #403720; }
.status-line { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px; border: 1px solid #33423e; border-radius: 12px; color: #d4dfda; background: #121a18a8; font-size: 14px; }
.status-pill { padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.status-pill.on { color: #ffd4c6; background: #592d27; }
.status-pill.off { color: #b8f0d5; background: #1d4736; }
.status-pill.unknown { color: #f4d796; background: #423921; }
.card-note { min-height: 22px; margin: 10px 2px 15px; font-size: 13px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ack-button { width: 100%; margin-top: 12px; border: 1px solid #677567; color: #e8eee9; background: transparent; }
.ack-button span { margin-right: 5px; color: var(--mint); font-size: 18px; }
.ack-button:hover { background: #ffffff0a; }
.ack-note { margin: 7px 2px 0; font-size: 12px; text-align: center; }
.notice { margin: 12px 0; padding: 12px 14px; border: 1px solid #48665a; border-radius: 12px; color: #d9eee4; background: #17372b; font-size: 14px; }
.notice.error { border-color: #7b4641; color: #ffd2cd; background: #422622; }
.page-footer { padding: 13px 2px; color: #87968f; font-size: 12px; text-align: center; }
.demo-banner { margin-bottom: 15px; padding: 12px 14px; border: 1px solid #92773d; border-radius: 12px; color: #f8dfaa; background: #443819; font-size: 13px; }
.confirm-dialog { width: min(calc(100% - 28px), 430px); padding: 0; border: 1px solid #566a61; border-radius: 21px; color: var(--text); background: #1b2724; box-shadow: 0 22px 80px #000a; }
.confirm-dialog::backdrop { background: #06100dd9; backdrop-filter: blur(4px); }
.confirm-content { padding: 24px; }
.confirm-content h2 { margin-bottom: 10px; font-size: 23px; }
.confirm-content .muted { margin-bottom: 21px; }
.confirm-content .actions { grid-template-columns: 1fr 1fr; }
.quiet-button { min-height: 40px; border: 1px solid #52615b; color: var(--muted); background: transparent; font-size: 13px; }
.hidden { display: none !important; }
@media (max-width: 440px) {
  .shell { width: min(100% - 20px, 680px); }
  .login-view { margin-top: 5vh; padding: 25px 20px; }
  .control-view { padding-top: 18px; }
  .alarm-card { padding: 17px; border-radius: 18px; }
  .card-heading { margin-bottom: 14px; }
  .card-icon { flex-basis: 42px; width: 42px; height: 42px; border-radius: 14px; }
  h2 { font-size: 17px; }
  .welcome-row { align-items: start; flex-direction: column; gap: 10px; }
  .connection-state { padding: 0; }
  .primary-button, .secondary-button { min-height: 48px; }
}
