:root {
  --navy: #10233f;
  --ink: #17304f;
  --blue: #1d6adf;
  --blue-dark: #1554b8;
  --muted: #5c6e86;
  --line: #e1e7f0;
  --bg: #f3f6fb;
  --card: #ffffff;
  --ok: #0d7a45;
  --ok-bg: #e7f6ee;
  --warn: #8a5a00;
  --warn-bg: #fff5e4;
  --bad: #9d1c1c;
  --bad-bg: #fdecec;
  --shadow: 0 16px 40px rgba(16, 35, 63, 0.06);
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, h3 { color: var(--navy); line-height: 1.2; margin: 0 0 0.4rem; }
p { margin: 0 0 0.8rem; }

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.auth-card, .card, .sheet {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.auth-card { width: min(440px, 100%); padding: 32px 28px; }
.lede, .hint, .meta, footer, .note { color: var(--muted); }
.hint { font-size: 0.92rem; }
.snippet {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.82rem;
  color: var(--navy);
}
.snippet.scroll { max-height: 240px; overflow: auto; }
.sha { font-family: ui-monospace, Consolas, monospace; font-size: 0.82rem; word-break: break-all; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--navy); font-weight: 700; letter-spacing: -0.02em; }
.brand.small { font-size: 0.95rem; }
.mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--navy); color: white;
  display: grid; place-items: center; font-size: 0.95rem;
}
form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; color: var(--navy); }
input[type="email"], input[type="password"], input[type="text"], textarea, select {
  width: 100%; border: 1px solid #cfd7e4; border-radius: 10px; padding: 11px 12px; background: white; font-weight: 400;
}
textarea { min-height: 88px; resize: vertical; }
.primary, .secondary, .ghost, .segmented button {
  border-radius: 10px; padding: 11px 16px; border: 1px solid transparent; font-weight: 650;
}
.primary { background: var(--blue); color: white; }
.primary:hover { background: var(--blue-dark); }
.secondary, .ghost { background: white; border-color: var(--line); color: var(--navy); }
.ghost { padding: 8px 12px; }
.primary:disabled, .secondary:disabled { opacity: 0.55; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.error { color: var(--bad); background: var(--bad-bg); border-radius: 10px; padding: 10px 12px; }
.error[hidden], [hidden] { display: none !important; }
.switch { margin: 16px 0 0; }

.shell { max-width: 1040px; margin: 0 auto; padding: 20px 20px 48px; }
.top {
  display: flex; align-items: center; gap: 20px; margin-bottom: 22px;
}
.top nav { display: flex; gap: 6px; }
.top nav a { color: var(--muted); font-weight: 650; padding: 8px 10px; border-radius: 8px; text-decoration: none; }
.top nav a.on, .top nav a:hover { color: var(--navy); background: white; }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.92rem; }
footer { margin-top: 22px; font-size: 0.88rem; }

.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 18px; }
.steps li { padding: 6px 10px; border-radius: 999px; background: white; border: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; font-weight: 650; }
.steps li.done { color: var(--ok); }
.steps li.current { color: white; background: var(--navy); border-color: var(--navy); }

.page-head { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 16px; }
.card { padding: 22px; }
.words { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.word, .word-input { display: flex; gap: 8px; align-items: center; background: #f6f8fc; border-radius: 8px; padding: 7px 10px; }
.word span, .word-input span { color: var(--muted); font-weight: 650; width: 1.4rem; flex: none; font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.word b { font-weight: 650; color: var(--navy); }
.word-input input { border: 0; background: transparent; padding: 2px 0; width: 100%; font-weight: 600; }
.qr-wrap { display: grid; justify-items: center; gap: 8px; text-align: center; }
.qr-wrap img { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 12px; }
.keyline { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; word-break: break-all; background: #f6f8fc; border-radius: 8px; padding: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 3px; }
.warn-note { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; }

.banner { border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; }
.banner strong { display: block; margin-bottom: 4px; }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner p { margin: 0; }

.stats { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: 0.85rem; }
.pill.active { background: var(--ok-bg); color: var(--ok); }
.pill.test_due { background: var(--warn-bg); color: var(--warn); }
.pill.paused, .pill.setup { background: var(--bad-bg); color: var(--bad); }
.bar { height: 8px; background: #e7edf5; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue); }
.quota-top { display: flex; justify-content: space-between; font-size: 0.92rem; margin-bottom: 8px; }

.files { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.file { display: flex; justify-content: space-between; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.badge { display: inline-block; margin-left: 6px; border-radius: 999px; padding: 2px 8px; font-size: 0.75rem; background: #eef3fb; color: var(--navy); font-weight: 700; }
.badge.held { background: var(--warn-bg); color: var(--warn); }
.segmented { display: flex; gap: 6px; flex-wrap: wrap; }
.segmented button { background: white; border: 1px solid var(--line); color: var(--navy); }
.segmented button.on { background: var(--navy); color: white; border-color: var(--navy); }
.demo { border-style: dashed; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.panel { display: none; }
.panel.on { display: block; }
.camera {
  background: #0e1b30; border-radius: 12px; min-height: 220px; display: grid; place-items: center; overflow: hidden; position: relative;
}
.camera video { width: 100%; max-height: 320px; }
.camera p { color: white; padding: 16px; text-align: center; }
.success-pre {
  white-space: pre-wrap; background: var(--ok-bg); color: var(--ink); border-radius: 12px; padding: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.drop {
  border: 1.5px dashed #b7c4d6; border-radius: 16px; padding: 36px 16px; text-align: center; background: white;
}
.drop.over { border-color: var(--blue); background: #f3f7ff; }
.log { margin-top: 12px; }

.sheet-page { max-width: 820px; margin: 0 auto; padding: 24px 16px 48px; }
.sheet { padding: 36px 40px; }
.sheet header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--navy); padding-bottom: 12px; margin-bottom: 18px; }
.sheet-grid { display: grid; grid-template-columns: 240px 1fr; gap: 22px; align-items: start; }
.facts { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0 0 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 650; }
.sheet .words { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.warning { border: 1px solid var(--bad); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-weight: 650; }

@media (max-width: 860px) {
  .grid-2, .stats, .sheet-grid, .top { display: block; }
  .account { margin: 12px 0 0; }
  .sheet .words, .words { grid-template-columns: 1fr 1fr; }
  .file { display: block; }
}

@media print {
  body { background: white; }
  .no-print { display: none !important; }
  .sheet-page { padding: 0; max-width: none; }
  .sheet { box-shadow: none; border: none; }
}
