:root {
  --bg: #0b1020;
  --bg2: #141b30;
  --card: #161e36;
  --line: #243150;
  --text: #e8edf7;
  --muted: #8b97b3;
  --ok: #34d399;
  --warn: #fbbf24;
  --error: #f87171;
  --unconfigured: #64748b;
  --accent: #8b5cf6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #1b2540 0%, var(--bg) 60%) var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: max(14px, env(safe-area-inset-top)) 14px calc(28px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
#app { max-width: 560px; margin: 0 auto; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand.small { gap: 8px; }
.brand .logo { font-size: 1.6rem; }
.brand h1 { font-size: 1.35rem; margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.fineprint { color: var(--muted); font-size: .8rem; margin-top: 18px; line-height: 1.5; }
code { background: #0e1426; padding: 1px 5px; border-radius: 5px; font-size: .82em; color: #c7d2fe; }

/* Setup */
#setup form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
#setup label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
#setup input {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none;
}
#setup input:focus { border-color: var(--accent); }
#setup button, .topbar button {
  cursor: pointer; border: none; color: #fff; font-weight: 700;
}
#setup button {
  background: var(--accent); border-radius: 12px; padding: 13px; font-size: 1rem; margin-top: 4px;
}
.error { color: var(--error); }

/* Dashboard */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.topbar-actions { display: flex; gap: 8px; }
.topbar button {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  width: 40px; height: 40px; border-radius: 12px; font-size: 1.1rem; line-height: 1;
}
.topbar button:active { background: var(--bg2); }
#refresh.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.overall {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); margin-bottom: 14px; font-size: 1.05rem;
}
.overall.ok { border-color: rgba(52,211,153,.45); }
.overall.warn { border-color: rgba(251,191,36,.5); }
.overall.error { border-color: rgba(248,113,113,.5); }

.cards { display: grid; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 1rem; margin: 0; flex: 1; }
.card-icon { font-size: 1.1rem; }
.badge {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; background: var(--bg2); color: var(--muted);
}
.card.ok .badge { color: var(--ok); }
.card.warn .badge { color: var(--warn); }
.card.error .badge { color: var(--error); }
.card-body { padding: 6px 14px 12px; }
.row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }
.row:last-child { border-bottom: none; }
.row span { color: var(--muted); font-size: .9rem; }
.row b { font-variant-numeric: tabular-nums; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--unconfigured); }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(52,211,153,.6); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px rgba(251,191,36,.6); }
.dot.error { background: var(--error); box-shadow: 0 0 8px rgba(248,113,113,.6); }

.updated { text-align: center; font-size: .78rem; margin-top: 14px; }

/* Lock screen + biometric */
#lock form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
#lock label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
#lock input {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; text-align: center; letter-spacing: .3em;
}
#lock input:focus { border-color: var(--accent); }
#lock button[type="submit"] {
  background: var(--accent); border: none; color: #fff; font-weight: 700;
  border-radius: 12px; padding: 13px; font-size: 1rem; cursor: pointer;
}
#bio-unlock {
  width: 100%; margin-top: 18px; background: var(--bg2); border: 1px solid var(--line);
  color: var(--text); font-weight: 600; border-radius: 12px; padding: 13px; font-size: 1rem; cursor: pointer;
}
.linkbtn {
  background: none; border: none; color: var(--muted); text-decoration: underline;
  cursor: pointer; font-size: .82rem; margin-top: 20px; padding: 0;
}

[hidden] { display: none !important; }
