/* Circular v2 PWA - mobile first, light/dark via prefers-color-scheme, no external assets.
   2026-10-20 owner: iOS "Settings" look (grouped inset lists, large titles, system blue) + Google Sans, self-hosted
   (assets/vendor/fonts, OFL; Thai glyphs included, Noto Sans Thai as the Thai fallback). The iOS layer is at the end. */
@font-face { font-family: "Google Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../vendor/fonts/GoogleSans-thai.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Google Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../vendor/fonts/GoogleSans-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Google Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../vendor/fonts/GoogleSans-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 400 700; font-display: swap; src: local("Noto Sans Thai"), url("../vendor/fonts/NotoSansThai-thai.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --text: #1c1c1e;
  --muted: #6c6c70;
  --line: #e0e0e5;
  --sep: rgba(60, 60, 67, .16);
  --fill: rgba(118, 118, 128, .12);
  --primary: #007aff;
  --primary-hover: #0068d9;
  --primary-ink: #ffffff;
  --teal: #30b0c7;
  --pass: #248a3d;
  --pass-bg: #e3f5e8;
  --fail: #d70015;
  --fail-bg: #ffe8e9;
  --warn: #a05a00;
  --warn-bg: #fff2dc;
  --info: #0066cc;
  --info-bg: #e6f1ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --focus: #007aff;
  --top-bg: rgba(249, 249, 249, 0.86);
  --bar-solid: #f9f9f9;
  --top-ink: #1c1c1e;
  --nav-h: 58px;
  --top-h: 52px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Google Sans", "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Leelawadee UI", Tahoma, sans-serif;
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --text: #f5f5f7;
    --muted: #98989f;
    --line: #38383a;
    --sep: rgba(84, 84, 88, .65);
    --fill: rgba(118, 118, 128, .24);
    --primary: #0a84ff;
    --primary-hover: #409cff;
    --primary-ink: #ffffff;
    --teal: #40c8e0;
    --pass: #30d158;
    --pass-bg: #12331c;
    --fail: #ff453a;
    --fail-bg: #3d1614;
    --warn: #ffb340;
    --warn-bg: #3a2a0c;
    --info: #64aaff;
    --info-bg: #0d2a4a;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
    --top-bg: rgba(22, 22, 24, 0.86);
    --bar-solid: #161618;
    --top-ink: #f5f5f7;
    --focus: #0a84ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Sarabun", "Noto Sans Thai", "Leelawadee UI", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Tahoma, sans-serif;
  font-size: 1rem; /* 16px; scales with the driver's text size (textsize.js) */
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.35rem; line-height: 1.3; }
h2 { font-size: 1.1rem; }
ol, ul { margin: 0; padding-left: 1.2rem; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.big { font-size: 1.15rem; }
.center { text-align: center; }
.text-fail { color: var(--fail); font-weight: 600; }
.req { color: var(--fail); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row-gap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* splash & states */
.splash { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; z-index: 50; text-align: center; padding: 24px; }
.splash-title { font-size: 1.6rem; font-weight: 700; }
.splash-sub { color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 16px; text-align: center; color: var(--muted); }
.state-title { font-weight: 600; color: var(--text); }
.state.error { color: var(--fail); }
.state.error .state-title { color: var(--fail); }

/* shell */
#app { max-width: 480px; margin: 0 auto; min-height: calc(100vh / var(--z, 1)); min-height: calc(100dvh / var(--z, 1)); display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: calc(var(--top-h) + var(--sat)); padding: var(--sat) 8px 0 12px; display: flex; align-items: center; gap: 8px; background: var(--top-bg); color: var(--top-ink); box-shadow: var(--shadow); }
.top-logo { border-radius: 7px; }
.top-title { flex: 1; min-width: 0; padding: 4px 0; }
.top-title h1 { font-size: 1.05rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-sub { font-size: 0.78rem; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; }
.icon-btn { position: relative; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; border-radius: 50%; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.15); }
.badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--fail); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.view { flex: 1; padding: 14px 16px 24px; outline: none; }
.view:has(+ .bottomnav:not([hidden])) { padding-bottom: calc(var(--nav-h) + var(--sab) + 24px); }
.page { animation: fade 0.15s ease-out; }
@keyframes fade { from { opacity: 0.4; } to { opacity: 1; } }
.bottomnav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--sab); }
.nav-item { position: relative; min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 0.74rem; color: var(--muted); text-decoration: none; }
.nav-item.active { color: var(--primary); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }

/* cards, buttons, inputs */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card > * + * { margin-top: 12px; }
.card-title { font-size: 1.05rem; font-weight: 700; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 8px 18px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-success { background: var(--pass); border-color: var(--pass); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--pass); filter: brightness(1.08); }
.btn-danger { background: var(--fail); border-color: var(--fail); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--fail); filter: brightness(1.08); }
.btn-warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
@media (prefers-color-scheme: dark) { .btn-success, .btn-danger { color: #08121c; } }
.btn-ghost { border-style: dashed; background: transparent; }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-sm { min-height: 44px; padding: 6px 14px; font-size: 0.92rem; }
.input { width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; }
textarea.input { min-height: 80px; resize: vertical; }
.input-lg { min-height: 56px; font-size: 1.2rem; }
.input:focus { border-color: var(--primary); }
.label { display: block; font-weight: 600; margin-bottom: 6px; }
.field-error { color: var(--fail); font-size: 0.88rem; min-height: 0; }
.field-error:empty { display: none; }
.callout { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.callout.warn { background: var(--warn-bg); border-color: var(--warn); color: var(--text); }
.callout.danger { background: var(--fail-bg); border-color: var(--fail); }
.callout.info { background: var(--info-bg); border-color: var(--info); }
.steps { padding-left: 1.3rem; display: flex; flex-direction: column; gap: 4px; }
.steps-bar { font-weight: 700; color: var(--primary); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 8px; }
.link { font-weight: 600; text-decoration: none; padding: 10px 4px; }

/* chips */
.chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.chip-pass { background: var(--pass-bg); color: var(--pass); }
.chip-fail { background: var(--fail-bg); color: var(--fail); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.tab { min-height: 44px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* login / gate */
.login-hero { text-align: center; padding: 18px 0 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.login-hero img { border-radius: 16px; box-shadow: var(--shadow); }
.greet { display: flex; align-items: center; gap: 10px; color: var(--primary); }
.plate-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.plate-badge { background: #fff; color: #111; border: 2px solid #111; border-radius: 8px; padding: 4px 12px; font-weight: 700; font-size: 1.3rem; }
.plate-tail { font-size: 1.3rem; letter-spacing: 2px; color: var(--muted); }
/* phone login plate step (owner 2026-10-03): "55- [ .... ]" like a licence plate, logs in when complete */
.plate-entry { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px auto 0; padding: 10px 16px; background: #fff; color: #111; border: 3px solid #111; border-radius: 12px; font-size: clamp(2rem, calc(10vw / var(--z, 1)), 2.6rem); font-weight: 800; line-height: 1; max-width: 100%; }
.plate-entry-head { white-space: nowrap; }
.plate-tail-input { width: calc(var(--n, 4) * 1.05em + 0.6em); min-width: 3em; max-width: calc(60vw / var(--z, 1)); border: 2px dashed #9ca3af; border-radius: 8px; background: #f9fafb; color: #111; font: inherit; font-variant-numeric: tabular-nums; letter-spacing: 0.25em; text-align: center; padding: 4px 0 4px 0.25em; }
.plate-tail-input:focus { outline: none; border-style: solid; border-color: var(--primary); background: #fff; }
.plate-tail-input::placeholder { color: #c4c9d1; letter-spacing: 0.25em; }
.plate-tail-input:disabled { opacity: 0.6; }
.plate-entry-meta { text-align: center; font-size: 0.95rem; }
.plate-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip-btn { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.chip-btn.active { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
.shake { animation: shake 0.35s ease-in-out; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }
.gate { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.gate > img { align-self: center; border-radius: 16px; }
.gate h1 { text-align: center; }
.perm-row { display: flex; gap: 12px; align-items: flex-start; }
.perm-row + .perm-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.perm-ic { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--info-bg); color: var(--primary); }
.perm-body { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.perm-title { font-weight: 700; }
.hero-ic { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--info-bg); color: var(--primary); }
.id-frame-demo { margin: 0 auto; width: 80%; aspect-ratio: 1.586; border: 3px dashed var(--primary); border-radius: 14px; display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; text-align: center; }
.stat-n { font-size: 1.5rem; font-weight: 800; line-height: 1.1; color: var(--primary); }
.stat-fail .stat-n { color: var(--fail); }
.stat-l { font-size: 0.72rem; color: var(--muted); }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; text-decoration: none; color: var(--text); border: 1px solid var(--line); }
.banner > div { flex: 1; }
.banner.warn { background: var(--warn-bg); border-color: var(--warn); }
.banner.info { background: var(--info-bg); border-color: var(--info); }
.banner.danger { background: var(--fail-bg); border-color: var(--fail); }
.banner.static { cursor: default; flex-wrap: wrap; }
.big-actions { display: flex; flex-direction: column; gap: 10px; }
.big-action { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--line); text-decoration: none; color: var(--text); }
.big-action:active { background: var(--info-bg); }
.big-ic { width: 48px; height: 48px; border-radius: 14px; background: var(--primary); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; flex: none; }
.big-action:nth-child(2) .big-ic { background: var(--teal); color: #04202a; }
.big-action:nth-child(3) .big-ic { background: #6f55c4; color: #fff; }
.big-text { flex: 1; display: flex; flex-direction: column; }
.big-text small { color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 8px; }
.row-card { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text); text-align: left; width: 100%; cursor: pointer; }
.row-card.disabled { opacity: 0.55; cursor: default; }
.row-card.unread { border-color: var(--primary); background: var(--info-bg); }
.btn-row { font: inherit; }
.row-ic { width: 42px; height: 42px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center; }
.row-ic.pass { background: var(--pass-bg); color: var(--pass); }
.row-ic.fail { background: var(--fail-bg); color: var(--fail); }
.row-ic.neutral { background: var(--surface-2); color: var(--primary); border: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.avatar.lg { width: 60px; height: 60px; font-size: 1.5rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex: none; }
.ctx-line { display: flex; align-items: center; gap: 8px; }
.ctx-line + .ctx-line { margin-top: 6px; }
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.fchip { flex: none; min-height: 44px; padding: 6px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; }
.fchip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.profile-head { display: flex; gap: 14px; align-items: center; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.thumbs figure { margin: 0; text-align: center; }
.thumb-img, .thumb-empty { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.thumb-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }
.pic-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }

/* form runner */
.form-page { display: flex; flex-direction: column; gap: 14px; }
.sec-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sec-count { font-size: 0.8rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; }
.sec-count.done { color: var(--pass); background: var(--pass-bg); border-color: transparent; }
.sec-body { display: flex; flex-direction: column; gap: 14px; }
.sec-body > * + * { margin-top: 0; }
.subhead { font-size: 1rem; color: var(--primary); }
.field { padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; transition: border-color 0.15s, background 0.15s; }
.field.is-pass { border-color: color-mix(in srgb, var(--pass) 45%, var(--line)); }
.field.is-fail { border-color: var(--fail); background: color-mix(in srgb, var(--fail-bg) 55%, var(--surface)); }
.field.invalid, .card.invalid { border-color: var(--fail); box-shadow: 0 0 0 2px color-mix(in srgb, var(--fail) 25%, transparent); }
.sig-wrap.invalid .sig-box { border-color: var(--fail); }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 60% { background: var(--warn-bg); } 100% { } }
.field-label { font-weight: 700; }
.field-crit { font-size: 0.88rem; color: var(--muted); }
.field-help { font-size: 0.85rem; color: var(--muted); }
.seg-group { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg-group:has(.stackable) { grid-auto-flow: row; }
.seg { min-height: 50px; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg.on { border-color: var(--primary); background: var(--info-bg); color: var(--primary); }
.seg.pass.on { border-color: var(--pass); background: var(--pass-bg); color: var(--pass); }
.seg.fail.on { border-color: var(--fail); background: var(--fail-bg); color: var(--fail); }
.check { display: flex; gap: 12px; align-items: center; min-height: 44px; }
.check input { width: 22px; height: 22px; }
.bac-result { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); text-align: center; color: var(--muted); font-weight: 600; }
.bac-result.pass { background: var(--pass-bg); color: var(--pass); border: 1px solid var(--pass); font-size: 1.2rem; }
.bac-result.fail { background: var(--fail-bg); color: var(--fail); border: 1px solid var(--fail); font-size: 1.2rem; }
.photo-box { display: flex; flex-direction: column; gap: 6px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ph-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.ph-item img, .ph-blank { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-item.error { border-color: var(--fail); }
.ph-over { position: absolute; inset: auto 0 0 0; padding: 4px 6px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 0.72rem; display: flex; flex-direction: column; gap: 3px; }
.ph-over.err { background: rgba(160, 20, 20, 0.88); }
.ph-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.ph-bar span { display: block; height: 100%; background: #6fdc9b; }
.ph-retry { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 30px; border: 1px solid #fff; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; font-size: 0.78rem; }
.ph-ok { position: absolute; left: 4px; bottom: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--pass); color: #fff; display: flex; align-items: center; justify-content: center; }
.ph-del { position: absolute; top: 3px; right: 3px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.62); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.ph-add { aspect-ratio: 1; border: 2px dashed var(--primary); border-radius: 10px; background: var(--info-bg); color: var(--primary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; font-weight: 700; font-size: 0.85rem; min-height: 88px; }
.ph-hint { grid-column: span 2; font-size: 0.82rem; color: var(--muted); align-self: center; }
.remark textarea { margin-top: 4px; }

/* signature */
.sig-head { display: flex; align-items: center; justify-content: space-between; }
.sig-box { position: relative; border: 2px dashed var(--line); border-radius: 12px; background: #fff; touch-action: none; overflow: hidden; }
.sig-canvas { display: block; width: 100%; height: 170px; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.sig-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9aa7b5; pointer-events: none; font-size: 1.05rem; }
.sig-status { margin-top: 6px; font-size: 0.85rem; color: var(--muted); }
.sig-status.ok { color: var(--pass); font-weight: 600; }
.sig-status.err { color: var(--fail); }
.sig-preview { max-width: 100%; max-height: 120px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.sig + .sig, .sig-wrap + .sig-wrap { margin-top: 14px; }

/* sticky save bar */
.savebar { position: sticky; bottom: 0; z-index: 15; margin: 6px -16px -24px; padding: 10px 16px calc(10px + var(--sab)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.08); display: flex; align-items: center; gap: 10px; }
.savebar-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; background: none; border: 0; padding: 4px 0; text-align: left; cursor: pointer; min-height: 44px; justify-content: center; }
.progress-text { font-size: 0.82rem; font-weight: 600; }
.savebar .btn { flex: none; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--pass); transition: width 0.2s; }
.savebar-spacer { height: 6px; }
.savebar.auto .progress-text { color: var(--pass); }

/* camera */
.cam { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; display: flex; flex-direction: column; }
.cam-top { display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--sat)) 10px 12px; background: rgba(0, 0, 0, 0.7); }
/* owner 2026-10-21 "ขอตัวใหญ่และเด่นขึ้น": what to photograph, big and bold (wraps to 2 lines for long item names) */
.cam-title { flex: 1; font-size: 1.45rem; font-weight: 800; line-height: 1.3; letter-spacing: 0.01em; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cam-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cam-video, .cam-preview { width: 100%; height: 100%; object-fit: contain; background: #000; }
.cam-video.mirror { transform: scaleX(-1); }
.cam-msg { position: absolute; left: 12px; right: 12px; top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.7); display: none; text-align: center; }
.cam-msg.show { display: block; }
.cam-msg.err { background: rgba(170, 30, 30, 0.9); }
.cam-guide { position: absolute; pointer-events: none; border: 3px dashed rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35); }
.cam-guide-face { width: 62%; aspect-ratio: 3/4; border-radius: 50%; max-height: 80%; }
.cam-guide-idcard { width: 86%; aspect-ratio: 1.586; border-radius: 14px; max-height: 70%; }
.cam-guide-plate { width: 84%; aspect-ratio: 3/1; border-radius: 10px; }
.cam-bottom { padding: 10px 12px calc(14px + var(--sab)); background: rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.cam-hint { font-size: 1.05rem; font-weight: 600; line-height: 1.45; text-align: center; }
.cam-extra { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.cam-extra .btn { color: #111; }
.cam-controls { display: flex; justify-content: center; align-items: center; gap: 12px; width: 100%; }
.cam-controls.review .btn { flex: 1; max-width: 200px; color: var(--text); }
.cam-shutter { width: 72px; height: 72px; border-radius: 50%; border: 5px solid #fff; background: rgba(255, 255, 255, 0.25); cursor: pointer; padding: 0; }
.cam-shutter:active { background: #fff; }
.cam .icon-btn { color: #fff; }
/* 029 landscape items (camera behaviour check): "turn the phone" prompt while upright; sideways = the camera fills the
   screen and the controls sit in a column on the right, like the old app v307 */
.cam-rotate { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: rgba(0, 0, 0, 0.88); }
.cam-rotate[hidden] { display: none; }
.cam-rotate-t { font-size: 1.3rem; font-weight: 800; line-height: 1.4; }
.cam-rotate-s { font-size: 0.95rem; line-height: 1.5; color: rgba(255, 255, 255, 0.78); max-width: 320px; }
.cam-rotate-phone { width: 46px; height: 80px; border: 4px solid #fff; border-radius: 10px; position: relative; animation: camTurn 2.2s ease-in-out infinite; }
.cam-rotate-phone::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 10px; height: 3px; margin-left: -5px; border-radius: 2px; background: #fff; }
@keyframes camTurn { 0%, 20% { transform: rotate(0); } 55%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { .cam-rotate-phone { animation: none; transform: rotate(-90deg); } }
@media (orientation: landscape) {
  .cam.cam-landscape { flex-direction: row; }
  .cam.cam-landscape .cam-top { position: absolute; top: 0; left: 0; z-index: 4; padding: calc(6px + var(--sat)) 12px 6px calc(6px + env(safe-area-inset-left, 0px)); border-bottom-right-radius: 12px; max-width: 70%; }
  .cam.cam-landscape .cam-title { font-size: 1.1rem; }
  .cam.cam-landscape .cam-msg { top: 58px; }
  .cam.cam-landscape .cam-stage { flex: 1; }
  .cam.cam-landscape .cam-bottom { width: 150px; justify-content: center; padding: 10px calc(10px + env(safe-area-inset-right, 0px)) 10px 10px; }
  .cam.cam-landscape .cam-hint { font-size: 0.85rem; }
  .cam.cam-landscape .cam-controls.review { flex-direction: column; }
  .cam.cam-landscape .cam-controls.review .btn { width: 100%; }
}

/* face login (facescan.js) */
.face-oval { transition: border-color 0.2s; }
.face-oval.ok { border-style: solid; border-color: #4ade80; }
/* owner 2026-10-03: every message on the scan screen big and easy to read */
.face-status { min-height: 1.5em; font-size: 1.2rem; line-height: 1.4; font-weight: 800; text-align: center; }
.face-status.err { color: #ffb4b4; }
.face-status.ok { color: #86efac; }
/* "only your own face in the frame" is a warning, shown big with a warning sign */
.face-status.warn { color: #1f1400; background: #fbbf24; border-radius: 14px; padding: 12px 16px; font-size: clamp(1.3rem, calc(6vw / var(--z, 1)), 1.6rem); max-width: 440px; }
.face-status.warn::before { content: "⚠ "; }
/* "หันใหม่อีกครั้ง": the biggest, boldest message on the screen */
.face-status.turn { color: #fff; background: #ea580c; border: 3px solid #fff; border-radius: 16px; padding: 14px 22px; font-size: clamp(1.8rem, calc(9vw / var(--z, 1)), 2.4rem); font-weight: 900; line-height: 1.2; text-wrap: balance; max-width: 440px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); animation: face-pop 0.35s ease-out; }
.face-status.turn::before { content: "↻ "; }
@keyframes face-pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .face-status.turn { animation: none; } }
.face-scan .cam-hint { font-size: 1.1rem; line-height: 1.5; }
.face-status.busy::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; animation: spin 0.9s linear infinite; }
.face-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.face-actions .btn { color: var(--text); min-width: 140px; }
.face-dev { width: 100%; max-width: 420px; color: #fff; font-size: 0.85rem; }
.face-dev summary { cursor: pointer; opacity: 0.85; }
.face-dev-row { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 6px; margin: 6px 0; }
.face-dev .input { min-height: 38px; padding: 4px 8px; }
.face-dev .btn { color: var(--text); }
.face-dev-row.live-only { grid-template-columns: 1fr; }
.face-dev-btns { display: flex; gap: 8px; flex-wrap: wrap; }
/* liveness challenge (facescan.js): big instruction, pictogram, countdown, step dots */
/* instruction band: a row between the top bar and the camera picture — never over the face */
.live-step { flex: none; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "icon title count" "icon sub count"; align-items: center; column-gap: 12px; row-gap: 2px; padding: 8px 14px; background: rgba(0, 0, 0, 0.85); border-bottom: 1px solid rgba(255, 255, 255, 0.15); text-align: left; }
.live-icon { grid-area: icon; color: #fde68a; min-height: 0; display: flex; align-items: center; }
.live-icon svg { width: 56px; height: 56px; }
.live-icon:empty { display: none; }
.live-title { grid-area: title; font-size: clamp(1.7rem, calc(8vw / var(--z, 1)), 2.3rem); font-weight: 900; line-height: 1.15; color: #fff; }
.live-sub { grid-area: sub; font-size: 1.1rem; line-height: 1.35; opacity: 0.95; }
.live-sub:empty { display: none; }
.live-count { grid-area: count; font-size: 2.6rem; font-weight: 900; line-height: 1; color: #fde68a; min-width: 1.4em; text-align: right; font-variant-numeric: tabular-nums; }
.live-dots { display: flex; gap: 10px; justify-content: center; }
.live-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.live-dot.now { background: #fde68a; border-color: #fde68a; }
.live-dot.done { background: #4ade80; border-color: #4ade80; }
.live-start { min-width: 220px; }
.live-alt { color: var(--text); }
.live-ic-move { animation: live-move 1s ease-in-out infinite alternate; }
.live-ic-turn_right .live-ic-move { animation-name: live-move-r; }
.live-ic-look_up .live-ic-move { animation-name: live-move-up; }
@keyframes live-move-up { from { transform: translateY(6px); } to { transform: translateY(-6px); } }
.live-ic-pupil { animation: live-blink 1.2s ease-in-out infinite; transform-origin: 32px 32px; }
@keyframes live-move { from { transform: translateX(6px); } to { transform: translateX(-6px); } }
@keyframes live-move-r { from { transform: translateX(-6px); } to { transform: translateX(6px); } }
@keyframes live-blink { 0%, 70%, 100% { transform: scaleY(1); } 80%, 90% { transform: scaleY(0.1); } }
.face-q { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.face-q .hero-ic { width: 72px; height: 72px; }
/* face login vs phone login (owner 2026-10-03) */
.login-cmp { display: grid; gap: 10px; text-align: left; width: 100%; }
.login-cmp-opt { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.login-cmp-opt.rec { border-color: var(--pass); background: var(--pass-bg); }
.login-cmp-opt h3 { margin: 0 0 6px; font-size: 0.98rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.login-cmp-opt ul { margin: 0; padding-left: 18px; font-size: 0.9rem; line-height: 1.5; }
.login-cmp-tag { padding: 1px 8px; border-radius: 999px; background: var(--pass); color: #fff; font-size: 0.75rem; font-weight: 700; }
.login-cmp-help { background: none; border: 0; color: var(--primary); text-decoration: underline; padding: 6px 0; font: inherit; font-size: 0.9rem; cursor: pointer; }
.face-badge { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 12px; border-radius: 999px; background: var(--pass-bg); color: var(--pass); font-size: 0.85rem; font-weight: 700; }

/* modal, viewer, toast */
#layer { position: relative; z-index: 200; }
.modal-wrap { position: fixed; inset: 0; z-index: 120; background: rgba(8, 16, 26, 0.6); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal { width: 100%; max-width: 520px; background: var(--surface); color: var(--text); border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + var(--sab)); box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3); display: flex; flex-direction: column; gap: 14px; max-height: calc(90vh / var(--z, 1)); overflow: auto; }
/* (owner 2026-10-22: phone layout on every device - no centred dialog on wide screens) */
.modal-title { font-size: 1.15rem; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
.viewer { position: fixed; inset: 0; z-index: 130; background: rgba(0, 0, 0, 0.94); display: flex; align-items: center; justify-content: center; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-close { position: absolute; top: calc(10px + var(--sat)); right: 10px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.18); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; background: rgba(255, 255, 255, 0.15); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.viewer-nav.prev { left: 0; border-radius: 0 12px 12px 0; }
.viewer-nav.next { right: 0; border-radius: 12px 0 0 12px; }
.viewer-count { position: absolute; bottom: calc(14px + var(--sab)); left: 0; right: 0; text-align: center; color: #fff; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--sab) + 16px); transform: translate(-50%, 20px); z-index: 140; max-width: min(calc(92vw / var(--z, 1)), 520px); padding: 12px 18px; border-radius: 12px; background: #22313f; color: #fff; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; box-shadow: var(--shadow); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: #b02a2a; }
.toast-success { background: #167a43; }

/* detail */
.detail-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.pics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pics.sm { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.pics figure { margin: 0; }
.pics figcaption, .sigfig figcaption { font-size: 0.82rem; color: var(--muted); text-align: center; margin-top: 4px; }
.pic { width: 100%; aspect-ratio: 4/3; object-fit: contain; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); display: block; }
.pics.sm .pic { aspect-ratio: 1; }
.answers { display: flex; flex-direction: column; }
.answer { padding: 10px 0; border-top: 1px solid var(--line); }
.answer:first-child { border-top: 0; padding-top: 0; }
.answer.is-fail .answer-label { color: var(--fail); }
.answer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.answer-label { font-weight: 600; }
.answer-val { text-align: right; flex: none; max-width: 45%; word-break: break-word; }
.answer-remark { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--warn-bg); font-size: 0.9rem; }
.sigs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.sigfig { margin: 0; }
/* result photos fill the frame (util.js photoFrame): portrait 9:16 / landscape 4:3, only the sides are trimmed */
.pic.photo, .pics.sm .pic.photo { aspect-ratio: 9/16; object-fit: cover; }
.pic.photo.land, .pics.sm .pic.photo.land { aspect-ratio: 4/3; }
.pics { align-items: start; }
.sigfig .pic { aspect-ratio: 16/9; object-fit: contain; background: #fff; }
.timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.timeline li { display: flex; gap: 12px; position: relative; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 18px; bottom: -14px; width: 2px; background: var(--line); }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex: none; z-index: 1; }
.tl-dot.pass { background: var(--pass); } .tl-dot.fail { background: var(--fail); } .tl-dot.warn { background: var(--warn); }
.note { background: var(--surface-2); padding: 6px 10px; border-radius: 8px; margin-top: 4px; }
.decision-wrap { position: sticky; bottom: calc(var(--nav-h) + var(--sab)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.1); }
.decision-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.decision-bar .btn { padding: 8px 6px; font-size: 0.9rem; }
.big-result { text-align: center; font-size: 1.4rem; font-weight: 800; padding: 8px; border-radius: 12px; }
.big-result.pass { background: var(--pass-bg); color: var(--pass); }
.big-result.fail { background: var(--fail-bg); color: var(--fail); }

/* result */
.result-screen { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 20px 4px; }
.result-ic { width: 104px; height: 104px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.result-screen.pass .result-ic { background: var(--pass-bg); color: var(--pass); }
.result-screen.fail .result-ic { background: var(--fail-bg); color: var(--fail); }
.result-screen.pass h1 { color: var(--pass); font-size: 2rem; }
.result-screen.fail h1 { color: var(--fail); font-size: 2rem; }
.result-screen .stack { width: 100%; }
.ref-box { width: 100%; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ref-no { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.5px; word-break: break-all; }


@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 360px) { .stats { grid-template-columns: repeat(2, 1fr); } .photo-grid { grid-template-columns: repeat(2, 1fr); } .decision-bar { grid-template-columns: 1fr; } }

/* multi-tenancy: organisation name on the login screen */
.login-org { margin: 4px 0 0; font-weight: 700; font-size: 1.05rem; color: var(--primary); }

/* ===== login theme inside the PWA (owner 2026-10-19; base rules in assets/vendor/auth/auth.css) ===== */
body.auth-page { background: var(--auth-bg, #eef4fb); }
body.auth-page .topbar, body.auth-page .bottomnav { display: none !important; }
body.auth-page #app { max-width: none; }
body.auth-page .view { padding: 0; }
body.auth-page .page { animation: none; }
body.auth-page .auth-shell { color: #10233d; }
.auth-tabs { margin-bottom: 18px; background: #eef4fb; border-radius: 14px; }
.auth-tabs .tab { min-height: 46px; font-size: 0.9375rem; border-radius: 11px; }
.auth-tabs .tab.active { background: #fff; color: #0b55c9; }
.auth-panel .plate-entry { margin-top: 2px; }
.auth-panel .greet { display: flex; align-items: center; gap: 10px; }
.auth-face { display: grid; gap: 6px; margin-top: 16px; }
.auth-face .auth-submit.secondary svg { width: 20px; height: 20px; }
.auth-panel .login-cmp-help { justify-self: center; }

/* ===== zoom lock (owner rule: every PWA page) — inputs stay >= 16px ===== */
html, body { touch-action: manipulation; }
input, select, textarea { font-size: max(16px, 1em); }

/* ===== passive face scan (login / re-scan) + auto face photo: WHITE screen, small mirrored oval (FestPay style) ===== */
.fpass { position: fixed; inset: 0; z-index: 120; background: #fff; color: #10233d; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: calc(14px + var(--sat, 0px)) 16px calc(20px + var(--sab, 0px)); overflow-y: auto; }
.fp-top { width: 100%; max-width: 520px; display: flex; align-items: center; justify-content: space-between; }
.fp-top b { font-size: 1.125rem; }
.fp-top .icon-btn { background: #f1f5f9; color: #10233d; }
.fp-cam { position: relative; width: min(calc(78vw / var(--z, 1)), 340px); aspect-ratio: 3 / 4; max-height: calc(56vh / var(--z, 1)); margin: auto 0; border-radius: 50% / 42%; overflow: hidden; background: #f1f5f9; flex: none; }
.fp-cam video, .fp-cam img.fp-pick { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fp-cam video { transform: scaleX(-1); }
.fp-cam.back video { transform: none; }
.fp-face { position: absolute; left: 50%; top: 47%; width: 80%; aspect-ratio: 3 / 4; transform: translate(-50%, -50%); display: grid; place-items: center; color: #2e90fa; pointer-events: none; }
.fp-art { width: 56%; height: 56%; }
.fpass.live .fp-art, .fpass.picked .fp-art { display: none; }
.fp-ring { position: absolute; inset: 0; border-radius: 50%; border: 4px solid #2e90fa; box-shadow: 0 0 0 2000px rgba(255, 255, 255, .55); }
.fpass[data-state="busy"] .fp-ring { animation: fpPulse 1s ease-in-out infinite; }
.fpass[data-state="ok"] .fp-ring { border-color: #059669; border-width: 6px; }
.fpass[data-state="bad"] .fp-ring { border-color: #c4291e; }
.fpass[data-state="warn"] .fp-ring { border-color: #d97706; }
@keyframes fpPulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .fp-ring { animation: none !important; } }
.fp-msg { max-width: 520px; text-align: center; font-size: 1.0625rem; font-weight: 600; min-height: 26px; }
.fp-msg.ok { color: #059669; } .fp-msg.bad { color: #c4291e; } .fp-msg.busy { color: #1d4ed8; }
.fp-msg.warn { color: #7a4a00; background: #fff4d6; border: 1px solid #f1cf8f; border-radius: 12px; padding: 8px 12px; }
.fp-tip { max-width: 520px; text-align: center; font-size: 0.875rem; color: #526780; }
.fp-act { width: 100%; max-width: 520px; display: flex; gap: 10px; flex-wrap: wrap; }
.fp-act .btn { flex: 1; min-width: 140px; }
.fp-alt { background: #f1f5f9; color: #10233d; border-color: #e2e8f0; }
.fp-devrow { display: flex; gap: 8px; width: 100%; max-width: 520px; }
.fp-dev { flex: 1; }

/* 019: AI display picture (cut-out on a soft brand circle); evidence photos are never shown here */
.avatar-img { object-fit: cover; padding: 0; background: radial-gradient(circle at 50% 35%, #ffffff, #dbe9fb 72%); border: 1px solid #dbe4f0; }


/* 021: person chips (avatar + name) and the person card on the home page; full ring + soft tint, no edge stripe */
.pchip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 3px 12px 3px 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: inherit; text-decoration: none; vertical-align: middle; line-height: 1.2; }
.pchip .pc-t { display: flex; flex-direction: column; min-width: 0; }
.pchip .pc-t b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip .pc-t small { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-av { position: relative; flex: none; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; font-weight: 700; box-shadow: 0 0 0 2px var(--surface), 0 1px 3px rgba(16, 35, 61, .2); }
.pc-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; opacity: 0; transition: opacity .15s; }
.pc-av.has-img img { opacity: 1; }
.pc-av.has-img .pc-in { visibility: hidden; }
.me-card { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.me-card .me-t { display: flex; flex-direction: column; min-width: 0; }
.me-card .me-t strong { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-card .me-t span { color: var(--muted); font-size: 0.85rem; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.person-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 14px 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); color: inherit; text-decoration: none; min-width: 0; }
.person-card:active { background: var(--info-bg); }
.person-card strong { font-size: 0.95rem; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-card small { color: var(--muted); font-size: 0.78rem; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub .pchip { margin-top: 2px; padding: 2px 10px 2px 2px; }

/* =====================================================================================================================
   iOS "Settings" theme for the PWA (owner 2026-10-20: macOS / iOS System Settings look in every system).
   Translucent bars, large titles, grouped inset lists with hairline separators, system blue, iOS controls.
   Kept on purpose: camera / face-scan / ID-card screens (own black or white full-screen look), person chips,
   the bottom action bars (savebar, decision bar), zoom lock, no coloured edge stripes.
   Motion: transform / opacity only, 180-260 ms ease-out, nothing when prefers-reduced-motion.
   ===================================================================================================================== */
body { font-family: var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; letter-spacing: 0; }
h1, h2 { letter-spacing: -.01em; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 45%, transparent); border-radius: 8px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { box-shadow: none; outline: none; }

/* ---------- navigation bar (top) with large title ---------- */
.topbar { background: var(--bar-solid); color: var(--top-ink); box-shadow: none; border-bottom: .5px solid var(--sep); padding: var(--sat) 6px 0 14px; gap: 6px; }
@media (pointer: fine) { .topbar { background: var(--top-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); } }
@supports (-webkit-touch-callout: none) { .topbar, .bottomnav, .savebar { background: var(--top-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); } }
.top-logo { border-radius: 7px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08); }
.top-title h1 { font-size: 1.0625rem; font-weight: 700; }
.topbar:has(> .top-logo) .top-title h1 { font-size: 1.375rem; letter-spacing: -.02em; }
.top-sub { font-size: 0.78rem; color: var(--muted); opacity: 1; }
.topbar .icon-btn { color: var(--primary); }
.icon-btn:hover { background: var(--fill); }
.icon-btn:active { transform: scale(.92); }
.icon-btn { transition: transform .12s var(--ease), background-color .12s; }
.badge { background: #ff3b30; }

/* ---------- tab bar (bottom) ---------- */
.bottomnav { background: var(--bar-solid); border-top: .5px solid var(--sep); }
@media (pointer: fine) { .bottomnav { background: var(--top-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); } }
.nav-item { font-size: 0.6875rem; font-weight: 500; color: #8e8e93; gap: 1px; transition: color .15s; }
.nav-item.active { color: var(--primary); font-weight: 600; }
.nav-item.active::before { content: none; }
.nav-item svg { transition: transform .18s var(--ease); }
.nav-item:active svg { transform: scale(.88); }

/* ---------- content ---------- */
.view { padding: 12px 16px 24px; }
.page > * + * { margin-top: 0; }
.stack { gap: 16px; }
h2 { font-size: 1.1rem; }
.section-head { margin: 10px 4px 6px; }
.section-head h2, .section-head .card-title { font-size: 0.8125rem; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: .01em; }
.link { color: var(--primary); font-weight: 500; }
/* list boxes */
.card { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.card-title { font-size: 1.02rem; font-weight: 700; }
.callout { border: 0; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--sep); }
.callout.warn { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 40%, transparent); }
.callout.danger { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fail) 40%, transparent); }
.callout.info { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--info) 35%, transparent); }
.banner { border: 0; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--sep); background: var(--surface); }
.banner.warn { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 40%, transparent); }
.banner.info { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--info) 35%, transparent); }
.banner.danger { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fail) 40%, transparent); }
/* grouped inset list: rows share one rounded box, hairline separators inset from the icon, chevrons on links */
.list { gap: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list > .row-card { border: 0; border-radius: 0; min-height: 60px; padding: 10px 14px; background-color: transparent; }
.list > * + * { background-image: linear-gradient(var(--sep), var(--sep)); background-repeat: no-repeat; background-position: 68px 0; background-size: calc(100% - 68px) 1px; }
.row-card { transition: background-color .15s; }
.row-card:active:not(.disabled) { background-color: var(--fill); }
.row-card.unread { background: var(--info-bg); }
.list > .row-card.unread { background-color: var(--info-bg); }
.row-card > svg:last-child, .big-action > svg:last-child, .me-card > svg:last-child, .banner > svg:last-child { flex: none; color: #c4c4c7; width: 18px; height: 18px; }
@media (prefers-color-scheme: dark) { .row-card > svg:last-child, .big-action > svg:last-child, .me-card > svg:last-child { color: #5a5a5f; } }
/* a list box inside a card runs edge to edge under the card title (Settings section) */
.card > .list, .card > .big-actions { margin-left: -16px; margin-right: -16px; margin-bottom: -14px; border-radius: 0 0 var(--radius) var(--radius); box-shadow: inset 0 1px 0 var(--sep); background-color: transparent; }
.row-ic { width: 40px; height: 40px; border-radius: 10px; }
.row-ic.neutral { border: 0; background: var(--fill); }
.row-title { font-weight: 600; }
.row-sub { color: var(--muted); }
/* big actions = Settings rows with coloured app-icon squares */
.big-actions { gap: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.big-action { border: 0; border-radius: 0; background-color: transparent; min-height: 68px; padding: 12px 14px; transition: background-color .15s; }
.big-action + .big-action { background-image: linear-gradient(var(--sep), var(--sep)); background-repeat: no-repeat; background-position: 74px 0; background-size: calc(100% - 74px) 1px; }
.big-action:active { background-color: var(--fill); }
.big-ic { width: 46px; height: 46px; border-radius: 11px; background: #007aff; color: #fff; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .08); }
.big-action:nth-child(2) .big-ic { background: #30b0c7; color: #fff; }
.big-action:nth-child(3) .big-ic { background: #af52de; color: #fff; }
.big-text { font-weight: 600; }
.big-text small { font-weight: 400; }
/* stats */
.stat { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.stat-n { font-weight: 700; letter-spacing: -.02em; }
/* people / me cards */
.me-card { border: 0; box-shadow: var(--shadow); }
.person-card { border: 0; background: var(--surface); box-shadow: var(--shadow); transition: transform .15s var(--ease); }
.person-card:active { transform: scale(.97); }
.card .person-card { background: var(--surface-2); box-shadow: none; }
.pchip { border-color: var(--sep); background: var(--fill); }

/* ---------- buttons ---------- */
.btn { min-height: 46px; padding: 8px 18px; border: 0; border-radius: 12px; background: var(--fill); color: var(--primary); font-weight: 600; transition: transform .12s var(--ease), filter .12s, background-color .12s; }
.btn:hover:not(:disabled) { background: color-mix(in srgb, var(--fill) 100%, var(--primary) 6%); }
.btn:active:not(:disabled) { transform: scale(.97); filter: brightness(.94); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-success { background: var(--pass); color: #fff; }
.btn-danger { background: var(--fail); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-success, .btn-danger { color: #fff; } .btn-success { background: #248a3d; } .btn-danger { background: #d70015; } }
.btn-warn { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 40%, transparent); }
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--sep); border: 0; }
.btn-lg { min-height: 52px; font-size: 1.05rem; border-radius: 14px; }
.btn-sm { min-height: 40px; padding: 6px 14px; border-radius: 10px; }
.chip-btn { border: 0; background: var(--fill); font-weight: 600; transition: transform .12s var(--ease); }
.chip-btn:active { transform: scale(.95); }
.chip-btn.active { background: var(--primary); color: #fff; }
.fchip { border: 0; background: var(--fill); font-weight: 500; min-height: 36px; padding: 4px 14px; transition: background-color .15s, color .15s, transform .12s var(--ease); }
.fchip:active { transform: scale(.95); }
.fchip.on { background: var(--primary); color: #fff; }
.chip { font-weight: 600; }
.chip-neutral { border: 0; background: var(--fill); }

/* ---------- inputs ---------- */
.input { border: 0; border-radius: 10px; background: var(--surface-2); box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .15s, background-color .15s; }
.card .input, .modal .input { background: var(--surface-2); }
.input:focus { outline: none; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--primary), 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.label { font-weight: 600; font-size: .92rem; color: var(--muted); }
/* segmented control (two-way tabs) */
.tabs { background: var(--fill); border-radius: 10px; padding: 2px; gap: 2px; }
.tab { min-height: 40px; border-radius: 8px; font-weight: 600; color: var(--text); transition: background-color .18s, box-shadow .18s; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
@media (prefers-color-scheme: dark) { .tab.active { background: #636366; } }
/* answer buttons in forms = segmented control; pass / fail keep a strong fill (read outdoors at a glance) */
.seg-group { background: var(--fill); border-radius: 12px; padding: 3px; gap: 3px; }
.seg { border: 0; border-radius: 9px; background: transparent; min-height: 48px; color: var(--text); font-weight: 600; transition: background-color .18s, color .18s, box-shadow .18s, transform .12s var(--ease); }
.seg:active { transform: scale(.97); }
.seg.on { background: var(--surface); color: var(--primary); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.seg.pass.on { background: #34c759; color: #fff; }
.seg.fail.on { background: #ff3b30; color: #fff; }
@media (prefers-color-scheme: dark) { .seg.on { background: #636366; color: #fff; } .seg.pass.on { background: #248a3d; } .seg.fail.on { background: #d70015; } }
.check input { accent-color: var(--primary); }

/* ---------- form runner: questions are rows of the section box ---------- */
.sec-body { gap: 0; }
.field { border: 0; border-radius: 10px; background: transparent; padding: 12px 2px; transition: background-color .2s; }
.sec-body > * + .field { background-image: linear-gradient(var(--sep), var(--sep)); background-repeat: no-repeat; background-size: 100% 1px; border-radius: 0; }
.field.is-pass { border: 0; }
.field.is-fail { background: color-mix(in srgb, var(--fail-bg) 70%, transparent); padding: 12px 10px; border-radius: 10px; box-shadow: none; }
.field.invalid, .card.invalid { box-shadow: 0 0 0 2px color-mix(in srgb, var(--fail) 55%, transparent); border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.sec-count { border: 0; background: var(--fill); }
.sec-count.done { background: var(--pass-bg); }
.bac-result { border: 0; border-radius: 12px; background: var(--fill); }
.bac-result.pass { border: 0; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pass) 45%, transparent); }
.bac-result.fail { border: 0; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fail) 45%, transparent); }
.ph-item { border: 0; border-radius: 10px; }
.ph-add { border: 1.5px dashed color-mix(in srgb, var(--primary) 60%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--primary) 7%, transparent); transition: transform .12s var(--ease); }
.ph-add:active { transform: scale(.96); }
.sig-box { border: 1.5px dashed var(--sep); }
/* bottom action bars (kept): translucent like an iOS toolbar */
.savebar { background: var(--bar-solid); border-top: .5px solid var(--sep); box-shadow: none; }
.decision-wrap { border: 0; border-radius: 14px; box-shadow: 0 0 0 .5px var(--sep), 0 6px 24px rgba(0, 0, 0, .12); }
@media (pointer: fine) { .savebar { background: var(--top-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); } }
.progress { background: var(--fill); }
.progress span { background: #34c759; transition: transform .25s var(--ease), width .25s var(--ease); }

/* ---------- detail ---------- */
.answer { border-top: .5px solid var(--sep); }
.pic, .thumb-img, .thumb-empty { border: 0; background: var(--fill); }
.ref-box { border: 0; box-shadow: var(--shadow); }
.big-result { border-radius: 12px; }
.timeline li:not(:last-child)::after { background: var(--sep); }
.login-cmp-opt { border: 0; box-shadow: inset 0 0 0 1px var(--sep); background: var(--surface); }
.login-cmp-opt.rec { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--pass) 55%, transparent); }

/* ---------- sheets / dialogs ---------- */
.modal-wrap { background: rgba(0, 0, 0, .32); animation: ioFade .2s ease-out; }
.modal { border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .22); animation: ioSheetUp .28s var(--ease); }

.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-actions .btn { min-height: 48px; }
.viewer { animation: ioFade .18s ease-out; }
.viewer-img { animation: ioZoom .24s var(--ease); }
.toast { border-radius: 14px; background: rgba(44, 44, 46, .94); font-weight: 500; transition: opacity .2s var(--ease), transform .24s var(--ease); }
.toast-error { background: rgba(200, 20, 30, .95); }
.toast-success { background: rgba(36, 138, 61, .96); }

/* ---------- loading: spinner + skeleton shimmer (transform only) ---------- */
.page > .state.loading { position: relative; padding-top: 168px; }
.page > .state.loading::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 148px; border-radius: var(--radius); background:
  linear-gradient(var(--fill), var(--fill)) 16px 18px / 46% 14px no-repeat,
  linear-gradient(var(--fill), var(--fill)) 16px 46px / 72% 12px no-repeat,
  linear-gradient(var(--fill), var(--fill)) 16px 82px / 60% 14px no-repeat,
  linear-gradient(var(--fill), var(--fill)) 16px 110px / 80% 12px no-repeat,
  var(--surface); box-shadow: var(--shadow); }
.page > .state.loading::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 148px; border-radius: var(--radius); background: linear-gradient(90deg, transparent 20%, rgba(255, 255, 255, .5) 50%, transparent 80%); transform: translateX(-100%); animation: ioShimmer 1.3s ease-in-out infinite; pointer-events: none; }
@media (prefers-color-scheme: dark) { .page > .state.loading::after { background: linear-gradient(90deg, transparent 20%, rgba(255, 255, 255, .07) 50%, transparent 80%); } }
.page > .state.loading { overflow: hidden; }

/* ---------- view transitions + list stagger ---------- */
.page > * { animation: ioView .24s var(--ease) backwards; }
.page > *:nth-child(2) { animation-delay: 25ms; } .page > *:nth-child(n+3) { animation-delay: 45ms; }
.page .stack > *, .page .form-page > * { animation: ioView .24s var(--ease) backwards; }
.page .stack > *:nth-child(2), .page .form-page > *:nth-child(2) { animation-delay: 30ms; }
.page .stack > *:nth-child(3), .page .form-page > *:nth-child(3) { animation-delay: 55ms; }
.page .stack > *:nth-child(4), .page .form-page > *:nth-child(4) { animation-delay: 75ms; }
.page .stack > *:nth-child(n+5), .page .form-page > *:nth-child(n+5) { animation-delay: 90ms; }
.list > *, .big-actions > *, .people-grid > *, .stats > * { animation: ioRow .24s var(--ease) backwards; }
.list > *:nth-child(2), .big-actions > *:nth-child(2), .people-grid > *:nth-child(2), .stats > *:nth-child(2) { animation-delay: 20ms; }
.list > *:nth-child(3), .big-actions > *:nth-child(3), .people-grid > *:nth-child(3), .stats > *:nth-child(3) { animation-delay: 40ms; }
.list > *:nth-child(4), .people-grid > *:nth-child(4), .stats > *:nth-child(4) { animation-delay: 60ms; }
.list > *:nth-child(5), .people-grid > *:nth-child(5) { animation-delay: 80ms; }
.list > *:nth-child(6), .people-grid > *:nth-child(6) { animation-delay: 100ms; }
.list > *:nth-child(n+7), .people-grid > *:nth-child(n+7) { animation-delay: 115ms; }
body.auth-page .page > *, body.auth-page .page .stack > * { animation: none; }
@keyframes ioView { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ioRow { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes ioFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ioSheet { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes ioSheetUp { from { opacity: 0; transform: translateY(28px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes ioZoom { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes ioShimmer { to { transform: translateX(100%); } }

/* ---------- login inside the PWA: dark mode for the light-only bits ---------- */
.auth-tabs { background: rgba(118, 118, 128, .12); border-radius: 10px; }
.auth-tabs .tab { border-radius: 8px; }
.auth-tabs .tab.active { background: #fff; color: #1d1d1f; }
body.auth-page { background: var(--auth-bg, #f2f2f7); }
@media (prefers-color-scheme: dark) {
  body.auth-page .auth-shell { color: #f5f5f7; }
  .auth-tabs .tab { color: #f5f5f7; }
  .auth-tabs .tab.active { background: #636366; color: #fff; }
}

/* iPhone / iPad Safari: real translucent bars (blur is cheap there); other phones keep solid bars */
@supports (-webkit-touch-callout: none) { .topbar, .bottomnav, .savebar { background: var(--top-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); } }

/* text size (textsize.js, owner 2026-10-22): "Aa" in the top bar + 4 sizes; samples keep their own px size */
.ts-btn span { font-weight: 800; font-size: 1.15rem; line-height: 1; letter-spacing: -.02em; }
.ts-btn small { font-size: .78em; font-weight: 800; }
.ts-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ts-opt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px; padding: 10px 6px; border: 0; border-radius: 14px; background: var(--surface-2, #f2f2f7); box-shadow: 0 0 0 1px var(--line); color: var(--text); cursor: pointer; font: inherit; }
.ts-opt.on { background: var(--primary-soft, #e6f1ff); box-shadow: 0 0 0 2.5px var(--primary); }
.ts-sample { font-weight: 700; line-height: 1.2; white-space: nowrap; }
.ts-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.ts-opt.on .ts-label { color: var(--primary); }
.top-title { min-width: 0; }
.top-title h1, .top-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Text size, content only (owner 2026-10-22: "ปรับแค่ส่วนเนื้อหา หัวข้อ ปุ่มใหญ่อยู่แล้ว"): textsize.js sets
   html[data-textsize] and --ts (1.15 / 1.3 / 1.5). Reading text and headings grow; buttons, fields, chips, the
   bottom bar and the camera screens keep their size. Nothing here applies at the normal size. */
html[data-textsize] .page { font-size: calc(1rem * var(--ts)); }
html[data-textsize] .page h1 { font-size: calc(1.35rem * var(--ts)); }
html[data-textsize] .page h2 { font-size: calc(1.1rem * var(--ts)); }
html[data-textsize] .page .card-title { font-size: calc(1.02rem * var(--ts)); }
html[data-textsize] .page .section-head h2, html[data-textsize] .page .section-head .card-title { font-size: calc(0.8125rem * var(--ts)); }
html[data-textsize] .page .small, html[data-textsize] .page .row-sub, html[data-textsize] .page .field-help, html[data-textsize] .page .sig-status,
html[data-textsize] .page .me-card .me-t span, html[data-textsize] .page .face-badge { font-size: calc(0.85rem * var(--ts)); }
html[data-textsize] .page .big { font-size: calc(1.15rem * var(--ts)); }
html[data-textsize] .page .field-error, html[data-textsize] .page .field-crit { font-size: calc(0.88rem * var(--ts)); }
html[data-textsize] .page .label { font-size: calc(.92rem * var(--ts)); }
html[data-textsize] .page .subhead { font-size: calc(1rem * var(--ts)); }
html[data-textsize] .page .progress-text, html[data-textsize] .page .pics figcaption, html[data-textsize] .page .sigfig figcaption { font-size: calc(0.82rem * var(--ts)); }
html[data-textsize] .page .answer-remark, html[data-textsize] .page .login-cmp-opt ul { font-size: calc(0.9rem * var(--ts)); }
html[data-textsize] .page .plate-entry-meta, html[data-textsize] .page .person-card strong { font-size: calc(0.95rem * var(--ts)); }
html[data-textsize] .page .stat-l, html[data-textsize] .page .person-card small, html[data-textsize] .page .pchip .pc-t small { font-size: calc(0.78rem * var(--ts)); }
html[data-textsize] .page .me-card .me-t strong { font-size: calc(1.1rem * var(--ts)); }
html[data-textsize] .page .login-cmp-opt h3 { font-size: calc(0.98rem * var(--ts)); }
html[data-textsize] .page .big-result, html[data-textsize] .page .ref-no { font-size: calc(1.4rem * var(--ts)); }
html[data-textsize] .page .login-org { font-size: calc(1.05rem * var(--ts)); }
html[data-textsize] .top-title h1 { font-size: calc(1.0625rem * var(--ts)); }
html[data-textsize] .topbar:has(> .top-logo) .top-title h1 { font-size: calc(1.375rem * var(--ts)); }
html[data-textsize] .top-sub { font-size: calc(0.78rem * var(--ts)); }
/* controls keep their normal size */
html[data-textsize] .page :is(button, input, select, textarea) { font-size: 1rem; }
html[data-textsize] .page .btn-lg { font-size: 1.05rem; }
html[data-textsize] .page .btn-sm, html[data-textsize] .page .label.btn-sm { font-size: 0.92rem; }
html[data-textsize] .page .input-lg { font-size: 1.2rem; }
html[data-textsize] .page .decision-bar .btn, html[data-textsize] .page .login-cmp-help { font-size: 0.9rem; }
html[data-textsize] .page .auth-tabs .tab { font-size: 0.9375rem; }
html[data-textsize] .page .ph-add { font-size: 0.85rem; }
html[data-textsize] .page .ph-retry { font-size: 0.78rem; }
html[data-textsize] .page :is(button, .btn, .chip, .seg) :is(.small, small) { font-size: 0.85rem; }
html[data-textsize] .page :is(button, .btn, .chip, .seg) .label { font-size: .92rem; }/* sign-in page (auth.css is in px): "Aa" beside the TruckSure label, and its reading text follows the size too */
.auth-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.auth-heading-row .ts-btn { color: var(--primary); }
html[data-textsize] .page .auth-panel-heading h2 { font-size: calc(28px * var(--ts)); }
html[data-textsize] .page .auth-panel-heading .auth-lead { font-size: calc(14px * var(--ts)); }
html[data-textsize] .page .auth-field { font-size: calc(13px * var(--ts)); }
html[data-textsize] .page .auth-alert { font-size: calc(13.5px * var(--ts)); }
html[data-textsize] .page .auth-help { font-size: calc(12.5px * var(--ts)); }
html[data-textsize] .page .auth-brand-copy .auth-sub { font-size: calc(15.5px * var(--ts)); }
html[data-textsize] .page .auth-input-wrap input { font-size: 16px; }
/* Phone layout on every device (fit.js, owner 2026-10-22: "รองรับแค่มือถือเท่านั้น แสดงแบบเดียวกันทุกเครื่อง"):
   computers get the same phone screen in a 480 px column; the sign-in page always uses its phone layout
   (auth.css only switches to it below 520 px). Wide touch screens are scaled by fit.js instead. */
html.phone-only body { background: var(--bg); }
html.phone-only body.auth-page #app { max-width: 480px; }
html.phone-only .auth-shell { width: 100%; min-height: calc(100vh / var(--z, 1)); min-height: calc(100dvh / var(--z, 1)); margin: 0; border: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; animation: none; }
html.phone-only .auth-brand { padding: 18px 16px 20px; flex: none; }
html.phone-only .auth-logo { width: 46px; height: 46px; border-radius: 14px; font-size: 18px; }
html.phone-only .auth-brand h1 { font-size: 22px; }
html.phone-only .auth-brand-copy { margin: 14px 0 0; }
html.phone-only .auth-brand-copy .auth-eyebrow, html.phone-only .auth-brand-copy .auth-sub, html.phone-only .auth-brand-status { display: none; }
html.phone-only .auth-brand-copy h2 { margin: 0; font-size: 18px; line-height: 1.45; letter-spacing: 0; }
html.phone-only .auth-brand-copy h2 br { display: none; }
html.phone-only .auth-panel { display: block; align-items: start; padding: 24px 16px 24px; flex: 1; }
html.phone-only .auth-panel-heading h2 { font-size: 28px; }
html.phone-only .auth-environment { position: static; display: inline-flex; margin-bottom: 14px; }
html.phone-only .auth-heading-row .auth-environment { margin-bottom: 0; }
html.phone-only .auth-heading-row { margin-bottom: 14px; }
html.phone-only .auth-footer { flex-direction: column; gap: 4px; }
/* 030: organisation closed for now (trial ended / payment due), app.js setBillingHandler */
.billing-wall { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.billing-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 24px 20px; text-align: center; }
.billing-card h2 { margin: 0 0 10px; font-size: 20px; }
.billing-card p { margin: 0 0 12px; line-height: 1.6; }
.billing-card .btn { width: 100%; margin-top: 6px; }
