:root {
  --navy: #14213d; --teal: #1f7a8c; --teal-d: #176373;
  --bg: #f3f6f8; --card: #ffffff; --ink: #14213d; --muted: #5b6878; --line: #dbe3ea;
  --ok: #1b7f4b; --warn: #a15c00; --bad: #b3261e;
  --ok-bg: #e3f4ea; --warn-bg: #fff1d6; --bad-bg: #fde7e5; --info-bg: #e4f1f4;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1626; --card: #16233b; --ink: #eef3f7; --muted: #9fb0c3; --line: #263653;
    --teal: #3aa6bb; --teal-d: #5bbdd0;
    --ok: #6fd69b; --warn: #f1b95c; --bad: #ff8d84;
    --ok-bg: #16382a; --warn-bg: #3b2e12; --bad-bg: #3d1c1a; --info-bg: #14343c;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.boot { text-align: center; margin-top: 40vh; color: var(--muted); }
.shell { max-width: 640px; margin: 0 auto; padding: 0 16px 96px; }
header.top {
  background: var(--navy); color: #fff;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 14px;
  position: sticky; top: 0; z-index: 5;
}
header.top .in { max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header.top h1 { font-size: 18px; margin: 0; font-weight: 700; }
header.top .sub { font-size: 12px; opacity: .75; }
header.top button.back { background: none; border: 0; color: #fff; font-size: 16px; padding: 6px 0; cursor: pointer; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 24px 0 8px; }
h3 { margin: 0 0 4px; font-size: 17px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.card.tap { cursor: pointer; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--info-bg); color: var(--teal-d); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.gray { background: var(--line); color: var(--muted); }
.banner { background: var(--info-bg); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; font-size: 15px; }
.banner.warn { background: var(--warn-bg); }
button, .btn {
  font: inherit; font-weight: 600; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); padding: 11px 16px; min-height: 44px; cursor: pointer;
}
button.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
button.danger { color: var(--bad); }
button.link { background: none; border: 0; color: var(--teal-d); padding: 8px 0; min-height: 0; }
button:disabled { opacity: .55; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions button { flex: 1 1 auto; }
label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 11px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal) 45%, transparent); outline-offset: 1px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--card); font-weight: 500; margin: 0; min-height: 40px; }
.check input { width: 18px; height: 18px; min-height: 0; margin: 0; }
.stepper { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.stepper .ctl { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 44px; padding: 0; }
.stepper .n { min-width: 22px; text-align: center; font-weight: 700; }
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 6;
}
nav.tabs .in { display: flex; width: 100%; max-width: 640px; }
nav.tabs button { flex: 1; border: 0; border-radius: 0; background: none; padding: 12px 4px; min-height: 52px; color: var(--muted); }
nav.tabs button.on { color: var(--teal-d); }
nav.tabs .dot { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; margin-left: 4px; }
.auth { max-width: 420px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 48px) 20px 40px; }
.auth h1 { margin: 0 0 4px; font-size: 26px; }
.auth .tabs2 { display: flex; gap: 8px; margin: 18px 0 4px; }
.auth .tabs2 button { flex: 1; }
.auth .tabs2 button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.code { letter-spacing: .4em; font-size: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: 15px; margin-top: 8px; }
.kv .k { color: var(--muted); }
.kv .v { white-space: pre-wrap; word-break: break-word; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
#toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 15px;
  max-width: 90vw; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20;
}
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); }
a { color: var(--teal-d); }
