:root {
  --bg: #0b0f14;
  --card: #131a22;
  --ink: #e6edf3;
  --muted: #8b98a5;
  --accent: #4493f8;
  --ok: #2ea043;
  --err: #f85149;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.screen {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
}
.hidden { display: none !important; }
.card {
  width: 100%; max-width: 420px; background: var(--card);
  border: 1px solid #20293433; border-radius: 16px; padding: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.25rem; margin: 0 0 4px; }
.muted { color: var(--muted); margin: 0 0 16px; }
.small { font-size: .8rem; }
input {
  width: 100%; padding: 14px 16px; margin: 8px 0;
  background: #0b0f14; border: 1px solid #2b3640; border-radius: 10px;
  color: var(--ink); font-size: 1rem;
}
input:focus { outline: none; border-color: var(--accent); }
button {
  width: 100%; padding: 14px 16px; margin-top: 10px;
  background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
button:active { transform: translateY(1px); }
button.ghost { background: transparent; border: 1px solid #2b3640; color: var(--ink); }
button.link {
  background: none; color: var(--accent); width: auto; padding: 8px 0;
  font-weight: 500; margin-top: 14px;
}
.err { color: var(--err); min-height: 1.2em; margin: 8px 0 0; font-size: .9rem; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
}
.topbar .link { margin: 0; }

/* QR screen */
.qrwrap { width: 100%; max-width: 480px; text-align: center; }
#qrbox {
  background: #fff; border-radius: 18px; padding: 16px; margin: 10px auto 0;
  width: min(80vw, 70vh); aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  transition: opacity .2s;
}
#qrbox img { width: 100%; height: 100%; image-rendering: pixelated; }
#qrbox.done { background: #0d2417; border: 2px solid var(--ok); }
.status { font-size: 1.05rem; margin: 18px 0 6px; color: var(--muted); }
.status.ok { color: var(--ok); font-weight: 600; }
.qractions { display: flex; gap: 10px; max-width: 360px; margin: 8px auto 0; }
.qractions button { margin-top: 0; }
.checkmark { font-size: 4rem; color: var(--ok); }

/* app toggle */
.seg { display: flex; gap: 6px; background: #0b0f14; border: 1px solid #2b3640;
  border-radius: 10px; padding: 4px; margin: 4px 0 10px; }
.seg-opt { flex: 1; margin: 0; padding: 10px; background: transparent; color: var(--muted);
  font-weight: 600; border-radius: 7px; }
.seg-opt span { font-weight: 400; opacity: .7; font-size: .8em; }
.seg-opt.active { background: var(--accent); color: #fff; }

/* iTAK credentials panel */
.creds { max-width: 360px; margin: 14px auto 0; text-align: left;
  background: #131a22; border: 1px solid #2b3640; border-radius: 12px; padding: 12px 16px; }
.credlabel { color: var(--muted); margin: 0 0 8px; font-size: .85rem; }
.credrow { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.credrow span { color: var(--muted); font-size: .9rem; }
.credrow code { color: #7ee787; font-size: 1.05rem; user-select: all; -webkit-user-select: all; }
