/* ============================================================
   Checkpoint — design system
   Station-signage direction: navy fascia, orange accent, totem
   numerals. Screen and PDF report share the exact same palette.
   ============================================================ */

@font-face { font-family: 'Archivo'; font-weight: 500; font-display: swap;
  src: url('/fonts/archivo-500.woff2') format('woff2'); }
@font-face { font-family: 'Archivo'; font-weight: 700; font-display: swap;
  src: url('/fonts/archivo-700.woff2') format('woff2'); }
@font-face { font-family: 'Archivo'; font-weight: 900; font-display: swap;
  src: url('/fonts/archivo-900.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap;
  src: url('/fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap;
  src: url('/fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap;
  src: url('/fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap;
  src: url('/fonts/inter-700.woff2') format('woff2'); }

:root {
  --navy: #064287;
  --navy-deep: #04315f;
  --orange: #F2682B;
  --orange-press: #d9551c;
  --ink: #1c2634;
  --grey: #404854;
  --muted: #848c98;
  --line: #e4e8ee;
  --paper: #f7f9fb;
  --card: #ffffff;
  --pass: #228c48;
  --pass-soft: #e6f4ec;
  --fail: #c82e2e;
  --fail-soft: #faeaea;
  --gold: #c9a227;
  --gold-soft: #f8f2dd;
  --na: #b0b6be;
  --na-soft: #f0f2f4;
  --display: 'Archivo', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(10, 30, 60, .05), 0 4px 14px rgba(10, 30, 60, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-size: 15px; line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid rgba(242, 104, 43, .55); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- top bar (station fascia) ---------- */
.topbar {
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; gap: 22px;
  padding: 0 clamp(14px, 4vw, 32px);
  height: 58px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 var(--navy-deep), 0 3px 12px rgba(4, 30, 60, .25);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--display); }
.brand:hover { text-decoration: none; }
.brand .tick {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--orange);
  display: grid; place-items: center;
  color: #fff; font-weight: 900; font-size: 15px;
}
.brand .word { font-weight: 900; letter-spacing: .14em; font-size: 15px; }
.brand .word span { color: var(--orange); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: rgba(255, 255, 255, .82); font-weight: 600; font-size: 13.5px;
  padding: 7px 12px; border-radius: 7px;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .1); text-decoration: none; color: #fff; }
.topbar nav a.active { background: rgba(255, 255, 255, .16); color: #fff; }
.topbar nav a.active { box-shadow: inset 0 -2px 0 var(--orange); }
.userchip { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.userchip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--orange); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.userchip .role { color: rgba(255,255,255,.6); text-transform: uppercase; font-size: 10.5px; letter-spacing: .08em; }
.userchip form { display: inline; }
.userchip button {
  background: none; border: 1px solid rgba(255,255,255,.28); color: rgba(255,255,255,.85);
  padding: 5px 10px; border-radius: 7px; font-size: 12px; cursor: pointer; font-family: var(--body);
}
.userchip button:hover { background: rgba(255,255,255,.1); }

.demo-ribbon {
  background: var(--gold-soft); color: #7a6112;
  border-bottom: 1px solid #eadfae;
  text-align: center; font-size: 12px; font-weight: 600; padding: 5px 12px;
}

/* ---------- page scaffold ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: clamp(16px, 3.5vw, 34px); }
.page.narrow { max-width: 640px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--display); font-weight: 700; font-size: clamp(20px, 3vw, 26px); letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}

/* ---------- cards, tables, badges ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 16px; }
.card h2 { font-family: var(--display); font-size: 15px; font-weight: 700; margin-bottom: 14px; }

.list-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.list-table th {
  text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--line);
}
.list-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list-table tr:last-child td { border-bottom: none; }
.list-table tbody tr { transition: background .12s ease; }
.list-table tbody tr:hover { background: var(--paper); }
.list-table .rowlink { font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pass { background: var(--pass-soft); color: var(--pass); }
.badge.fail { background: var(--fail-soft); color: var(--fail); }
.badge.na { background: var(--na-soft); color: #6d7683; }
.badge.draft { background: var(--na-soft); color: #6d7683; }
.badge.active { background: var(--pass-soft); color: var(--pass); }
.badge.archived { background: var(--gold-soft); color: #7a6112; }

/* ---------- score plate (the totem) ---------- */
.score-plate {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--navy); color: #fff; border-radius: 9px;
  font-family: var(--display); font-weight: 900;
  font-variant-numeric: tabular-nums;
  position: relative; overflow: hidden;
  padding: 10px 14px 13px;
  min-width: 64px;
}
.score-plate::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: var(--orange);
}
.score-plate .num { font-size: 26px; line-height: 1; }
.score-plate .of { font-size: 9px; font-weight: 700; letter-spacing: .14em; opacity: .65; margin-top: 3px; }
.score-plate.lg { padding: 16px 22px 20px; min-width: 96px; }
.score-plate.lg .num { font-size: 44px; }
.score-plate.sm { padding: 6px 10px 9px; min-width: 50px; border-radius: 7px; }
.score-plate.sm .num { font-size: 18px; }
.score-plate.good::after { background: var(--pass); }
.score-plate.warn::after { background: var(--gold); }
.score-plate.bad::after { background: var(--fail); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
}
.stat .k { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--display); font-weight: 900; font-size: 30px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .v.pass { color: var(--pass); } .stat .v.fail { color: var(--fail); }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--body); font-weight: 600; font-size: 14px;
  border: none; border-radius: 8px; cursor: pointer;
  padding: 10px 18px;
  background: var(--orange); color: #fff;
  transition: background .12s ease, transform .06s ease;
  text-decoration: none;
}
.btn:hover { background: var(--orange-press); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--paper); border-color: #cdd5df; }
.btn.navy { background: var(--navy); }
.btn.navy:hover { background: var(--navy-deep); }
.btn.danger { background: transparent; color: var(--fail); border: 1px solid var(--line); }
.btn.danger:hover { background: var(--fail-soft); border-color: var(--fail); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn.icon { padding: 6px 9px; font-size: 12.5px; line-height: 1; }

label.f-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--grey); margin: 14px 0 5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], textarea, select {
  width: 100%; font-family: var(--body); font-size: 14.5px; color: var(--ink);
  background: #fff; border: 1px solid #cdd5df; border-radius: 8px;
  padding: 10px 12px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(6, 66, 135, .12);
}
textarea { min-height: 84px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; }
.checks label { display: inline-flex; gap: 7px; align-items: center; font-size: 13.5px; color: var(--grey); }

.form-error {
  background: var(--fail-soft); border: 1px solid #eec7c7; color: var(--fail);
  border-radius: 8px; padding: 10px 14px; font-size: 13.5px; font-weight: 500; margin-bottom: 16px;
}
.empty {
  text-align: center; color: var(--muted); padding: 44px 20px; font-size: 14px;
}
.empty .big { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--grey); margin-bottom: 6px; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    linear-gradient(115deg, transparent 0 58%, rgba(242, 104, 43, .13) 58% 66%, transparent 66%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 14px; box-shadow: 0 18px 60px rgba(2, 20, 45, .45);
  padding: 34px 32px 30px;
}
.login-card .brandline { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-card .tick {
  width: 30px; height: 30px; border-radius: 7px; background: var(--orange);
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 17px;
}
.login-card .word { font-family: var(--display); font-weight: 900; letter-spacing: .14em; font-size: 17px; color: var(--navy); }
.login-card .tag { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card .btn { width: 100%; margin-top: 20px; padding: 12px; }

/* ---------- fill flow (phone-first) ---------- */
.fill-shell { max-width: 620px; margin: 0 auto; padding: 16px 14px 120px; }
.fill-head { margin: 6px 0 4px; }
.fill-head h1 { font-family: var(--display); font-weight: 700; font-size: 20px; }
.fill-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.progress-rail {
  position: sticky; top: 58px; z-index: 30;
  background: var(--paper); padding: 10px 0 12px;
}
body.preview .progress-rail { top: 0; }
.progress-track { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--orange), #f8925f);
  border-radius: 99px;
  transition: width .25s ease;
}
.progress-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 5px; }

.q-section { margin-top: 18px; }
.q-section > .sec-title {
  font-family: var(--display); font-weight: 700; font-size: 13px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--navy);
  padding-bottom: 7px; margin-bottom: 2px;
  border-bottom: 2px solid var(--line);
  position: relative;
}
.q-section > .sec-title::after {
  content: ''; position: absolute; left: 0; bottom: -2px; width: 34px; height: 2px; background: var(--orange);
}

.q-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px; margin-top: 10px;
  transition: border-color .15s ease;
}
.q-item.answered { border-color: #cfe0d5; }
.q-item.missing { border-color: var(--fail); box-shadow: 0 0 0 3px rgba(200, 46, 46, .08); }
.q-item .q-text { font-weight: 600; font-size: 15px; }
.q-item .req { color: var(--fail); font-weight: 700; }

.stamp-row { display: flex; gap: 8px; margin-top: 12px; }
.stamp {
  flex: 1; min-height: 52px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer;
  font-family: var(--display); font-weight: 700; font-size: 13.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--grey);
  transition: transform .08s ease, background .1s ease, border-color .1s ease, color .1s ease;
  user-select: none;
}
.stamp input { position: absolute; opacity: 0; pointer-events: none; }
.stamp:active { transform: scale(.97); }
.stamp.pass:hover { border-color: var(--pass); color: var(--pass); }
.stamp.fail:hover { border-color: var(--fail); color: var(--fail); }
.stamp.na:hover { border-color: var(--muted); color: var(--grey); }
.stamp.selected { transform: rotate(-.6deg); }
.stamp.pass.selected { background: var(--pass); border-color: var(--pass); color: #fff; }
.stamp.fail.selected { background: var(--fail); border-color: var(--fail); color: #fff; }
.stamp.na.selected { background: #6d7683; border-color: #6d7683; color: #fff; }

.q-extras { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.q-extras input[type="text"] { flex: 1; }
.photo-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px dashed #cdd5df; border-radius: 8px; background: var(--paper);
  color: var(--grey); font-size: 12.5px; font-weight: 600;
  padding: 9px 12px; cursor: pointer; white-space: nowrap;
}
.photo-btn.has-photo { border-style: solid; border-color: var(--pass); color: var(--pass); background: var(--pass-soft); }
.photo-btn.needs-photo { border-color: var(--fail); color: var(--fail); }
.photo-btn input { display: none; }
.photo-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }

.submit-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  padding: 12px clamp(14px, 4vw, 32px);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.submit-bar .left { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.submit-bar .btn { padding: 12px 26px; font-size: 15px; }

/* ---------- builder ---------- */
.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.phone-frame {
  position: sticky; top: 80px;
  border: 10px solid var(--ink); border-radius: 26px;
  overflow: hidden; background: #fff;
  box-shadow: var(--shadow);
  aspect-ratio: 9 / 17;
}
.phone-frame iframe { width: 100%; height: 100%; border: 0; }
.phone-frame-label { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-top: 8px; }

.q-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; margin-top: 8px;
}
.q-row .txt { flex: 1; font-size: 14px; font-weight: 500; }
.q-row .chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  background: var(--na-soft); color: #5d6673; border-radius: 5px; padding: 2px 7px; white-space: nowrap;
}
.q-row .chip.photo { background: var(--gold-soft); color: #7a6112; }
.q-row .chip.must { background: var(--fail-soft); color: var(--fail); }
.q-row form { display: inline; }
.sec-block { margin-top: 20px; }
.sec-block .sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-block .sec-head h3 { font-family: var(--display); font-size: 14.5px; font-weight: 700; }
.add-inline { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.add-inline input[type="text"] { flex: 2; min-width: 160px; }
.add-inline select { flex: 1; min-width: 120px; width: auto; }

/* ---------- detail / submission ---------- */
.answer-row { display: flex; align-items: start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.answer-row:last-child { border-bottom: none; }
.answer-row .q { flex: 1; font-size: 14.5px; }
.answer-row .note { color: var(--grey); font-size: 13px; font-style: italic; margin-top: 3px; }
.answer-row .photos { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.answer-row .photos img { width: 110px; height: 82px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.meta-grid .k { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.meta-grid .v { font-weight: 600; font-size: 14px; margin-top: 2px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input { width: auto; min-width: 150px; }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.assign-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-top: 12px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.assign-card:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(10, 30, 60, .1); }
.assign-card .t { font-family: var(--display); font-weight: 700; font-size: 16px; }
.assign-card .d { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .builder-grid { grid-template-columns: 1fr; }
  .phone-frame { display: none; }
  .phone-frame-label { display: none; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .submit-bar .left { display: none; }
  .submit-bar { justify-content: stretch; }
  .submit-bar .btn { flex: 1; }
}
@media (max-width: 640px) {
  .topbar { height: 52px; gap: 10px; }
  .topbar nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topbar nav a { white-space: nowrap; padding: 6px 9px; font-size: 12.5px; }
  .userchip .name-role { display: none; }
  .progress-rail { top: 52px; }
  .list-table th:nth-child(n+4), .list-table td:nth-child(n+4) { display: none; }
  .list-table.keep-score th:last-child, .list-table.keep-score td:last-child { display: table-cell; }
}
@media print {
  .topbar, .submit-bar, .filters, .btn { display: none !important; }
}
