/* FAT — shared design system. One palette, light + dark via [data-theme].
   Blue accent; green is reserved for "live / go / timer" semantics.
   "Display" panels (timer, camera, audio monitor, log) stay dark in both
   themes for outdoor contrast. */

:root {
  --bg: #0b0f14;
  --bg-grad: radial-gradient(1100px 700px at 50% -12%, #141c2b, #0b0f14);
  --surface: #141b24;
  --surface-2: #0e141c;
  --border: #243042;
  --text: #e6e9ef;
  --muted: #8b95a4;
  --accent: #2f6bff;
  --accent-press: #2a5fe0;
  --on-accent: #ffffff;
  --green: #25d366;
  --amber: #ffb020;
  --red: #ff4d4d;
  --display-bg: #0a0e13;
  --display-fg: #25d366;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.02);
}
[data-theme="light"] {
  --bg: #eef1f6;
  --bg-grad: radial-gradient(1100px 700px at 50% -12%, #ffffff, #e8ecf3);
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --border: #e1e6ee;
  --text: #17212e;
  --muted: #5c6675;
  --accent: #2f6bff;
  --accent-press: #2a5fe0;
  --on-accent: #ffffff;
  /* displays stay dark for the green readout to pop */
  --display-bg: #0d1117;
  --display-fg: #25d366;
  --shadow: 0 1px 3px rgba(16,24,40,.10), 0 1px 2px rgba(16,24,40,.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-grad); background-color: var(--bg); color: var(--text);
  min-height: 100vh;
  padding: env(safe-area-inset-top) 12px calc(env(safe-area-inset-bottom) + 16px);
}
.wrap { max-width: 560px; margin: 0 auto; }
h1 { font-size: 20px; text-align: center; margin: 16px 0 2px; letter-spacing: .3px; font-weight: 800; }
.subtitle { color: var(--muted); text-align: center; font-size: 13px; margin: 0 0 14px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 0 0 12px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; color: var(--text); }
input, select, textarea {
  width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2); color: var(--text); font-family: inherit;
}
input[type=range] { padding: 0; background: transparent; accent-color: var(--accent); }
textarea { min-height: 110px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

button {
  font-family: inherit; font-size: 15px; font-weight: 700; border: none; border-radius: 12px;
  padding: 13px; min-height: 48px; width: 100%; cursor: pointer; color: var(--on-accent); background: var(--accent);
}
button:active { background: var(--accent-press); }
button:disabled { opacity: .4; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-green, .btn-arm, .btn-send { background: var(--green); color: #06371b; }
.btn-amber, .btn-disarm { background: var(--amber); color: #3a2c00; }
.btn-red, .btn-manual { background: var(--red); color: #fff; }
.btn-teal { background: var(--accent); color: var(--on-accent); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > button { flex: 1; }

.status-row { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 0; }
.status-row .val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--muted); opacity: .45; flex: none; }
.dot.ok { background: var(--green); opacity: 1; }
.dot.warn { background: var(--amber); opacity: 1; }
.dot.bad { background: var(--red); opacity: 1; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.log { background: var(--display-bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px; height: 130px; overflow-y: auto; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #9aa7b4; }
.log div { padding: 1px 0; } .log .t { color: #5b6b7a; }

/* top-of-page controls — scroll away so they never cover a button */
.theme-toggle {
  position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 12px; z-index: 60;
  width: auto; min-height: 0; padding: 7px 11px; font-size: 15px; border-radius: 999px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.home-btn {
  position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 12px; z-index: 60;
  text-decoration: none; min-height: 0; padding: 7px 12px; font-size: 14px; font-weight: 700;
  border-radius: 999px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
