/* Ultra One Field — phone-first, readable in sunlight, large touch targets. */
:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #121a24;
  --muted: #5b6878;
  --line: #d9e0e8;
  --brand: #0f2a4a;
  --brand-ink: #ffffff;
  --primary: #0f2a4a;
  --accent: #f2a900;
  --ok: #157f3b;
  --ok-bg: #e3f4e8;
  --warn: #9a5b00;
  --warn-bg: #fff2d6;
  --bad: #b42318;
  --bad-bg: #fde7e5;
  --info-bg: #e8eef7;
  --focus: #2563eb;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d131b;
    --card: #17202b;
    --text: #e8edf3;
    --muted: #9aa8b8;
    --line: #2a3644;
    --brand: #0b1f37;
    --primary: #2d6cdf;
    --ok: #4ade80;
    --ok-bg: #133222;
    --warn: #fbbf24;
    --warn-bg: #3a2c0c;
    --bad: #f87171;
    --bad-bg: #3d1716;
    --info-bg: #1b2a3c;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: env(safe-area-inset-top) 12px 0; background: var(--brand); color: var(--brand-ink); }
.top-title { flex: 1; font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-back { background: none; border: 0; color: inherit; font-size: 34px; line-height: 1; width: 40px; height: 44px; padding: 0 0 4px; }
.top-sync { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.12); border: 0; color: inherit; border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.top-sync .dot { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; }
.top-sync.offline .dot { background: #fbbf24; }
.top-sync.error .dot { background: #f87171; }

main { max-width: 640px; margin: 0 auto; padding: 14px 14px calc(110px + env(safe-area-inset-bottom)); }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 4px 8px; }
h2:first-child { margin-top: 4px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; min-height: 64px; }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 650; }
.row-sub { color: var(--muted); font-size: 14px; }
.chev { color: var(--muted); font-size: 22px; }

.chip { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--info-bg); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-weight: 550; }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.info { background: var(--info-bg); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 84px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; }
.action b { font-size: 17px; }
.action span { color: var(--muted); font-size: 13px; }
.action.primary { background: var(--primary); color: var(--brand-ink); border-color: var(--primary); }
.action.primary span { color: rgba(255,255,255,.75); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 650; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--brand-ink); }
.btn.block { width: 100%; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; }

/* Forms */
.section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.section-head { padding: 12px 14px; font-weight: 700; border-bottom: 1px solid var(--line); background: var(--info-bg); }
.section-hint { font-weight: 450; font-size: 14px; color: var(--muted); margin-top: 2px; }
.q { padding: 14px; border-bottom: 1px solid var(--line); }
.q:last-child { border-bottom: 0; }
.q.missing { box-shadow: inset 4px 0 0 var(--bad); background: var(--bad-bg); }
.q-label { font-weight: 600; margin-bottom: 8px; display: flex; gap: 8px; }
.q-id { color: var(--muted); font-weight: 600; font-size: 13px; min-width: 28px; padding-top: 2px; }
.q-hint { color: var(--muted); font-size: 14px; margin: -4px 0 8px 36px; }
.q-body { margin-left: 36px; display: grid; gap: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { flex: 1 1 auto; min-height: 48px; min-width: 72px; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); font-weight: 650; }
.seg button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--brand-ink); }
.seg button.fail[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: #fff; }
.seg button.pass[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.num { display: flex; align-items: center; gap: 8px; }
.num input, .txt, input[type="datetime-local"], .login input { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); }
.num input { max-width: 180px; font-size: 18px; font-weight: 650; }
.num .unit { color: var(--muted); font-weight: 600; }
textarea.txt { min-height: 84px; resize: vertical; }
.dt { display: flex; flex-wrap: wrap; gap: 8px; }
.dt input { flex: 1 1 170px; min-width: 0; width: auto; }
.dt .btn { flex: none; }
.confirm { display: flex; align-items: center; gap: 12px; min-height: 52px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); font-weight: 650; text-align: left; }
.confirm .box { width: 28px; height: 28px; border-radius: 7px; border: 2px solid var(--muted); display: grid; place-items: center; flex: none; font-size: 18px; }
.confirm[aria-pressed="true"] { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.confirm[aria-pressed="true"] .box { border-color: var(--ok); background: var(--ok); color: #fff; }
.photo { display: flex; align-items: center; gap: 10px; }
.photo img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo label { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 16px; border-radius: 10px; border: 1.5px dashed var(--muted); font-weight: 650; }
.photo input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.req { color: var(--bad); font-weight: 700; }

.submitbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: center; }
.submitbar .btn { flex: 1; max-width: 300px; }

.issue { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.issue:last-child { border-bottom: 0; }

.login { max-width: 380px; margin: 8vh auto 0; }
.login .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login .logo img { width: 56px; height: 56px; border-radius: 14px; }
.login label { display: block; font-weight: 600; margin: 14px 0 6px; }
.err { color: var(--bad); font-weight: 600; margin-top: 12px; }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; max-width: calc(100% - 32px); background: #111827; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-weight: 550; }
.center { text-align: center; }
.foot { margin-top: 28px; text-align: center; color: var(--muted); font-size: 13px; }
.foot a, .foot button { color: inherit; background: none; border: 0; text-decoration: underline; padding: 6px; }
