/* Driver app styles. Built for phones; on a computer it shows as a phone-width column. */

:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --ink: #16212b;
  --ink-2: #56636f;
  --line: #d2d8de;
  --accent: #1d5aa6;
  --accent-ink: #ffffff;
  --accent-soft: #e2ebf7;
  --pass: #1f7a48;
  --pass-soft: #e2f2e8;
  --fail: #be3a2c;
  --fail-soft: #fae5e2;
  --warn: #8a5a00;
  --warn-soft: #fbefd6;
  --na: #56636f;
  --plate: #f6cf1e;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: Consolas, "Cascadia Mono", ui-monospace, Menlo, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: #dde2e7; color: var(--ink); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.noscript { padding: 24px; }

/* One phone-width column, full height. */
.app { max-width: 480px; min-height: 100%; margin: 0 auto; background: var(--bg); display: flex; flex-direction: column; position: relative; }
.screen { flex: 1; display: flex; flex-direction: column; }
.pad { padding: 18px 16px 24px; display: grid; gap: 20px; align-content: start; }
.muted { color: var(--ink-2); }
.small { font-size: 0.85rem; }

/* Buttons */
.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(--surface); font-weight: 600; text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: default; }
.link { background: none; border: 0; padding: 4px 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.link-quiet { color: var(--ink-2); font-weight: 500; }

/* Fields */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
input, select, textarea { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
textarea { min-height: 72px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.code-input { font-family: var(--mono); font-size: 1.4rem; letter-spacing: 0.3em; }
.alert { padding: 12px 14px; border-radius: 10px; font-weight: 500; }
.alert-problem { background: var(--fail-soft); color: var(--fail); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-good { background: var(--pass-soft); color: var(--pass); }

/* Sign-in */
.signin { padding: calc(40px + var(--safe-top)) 22px 28px; display: grid; gap: 18px; align-content: start; }
/* The Fleet Ops logo: a yellow number plate. */
.logo { display: inline-block; font-weight: 800; font-size: 1.9rem; line-height: 1.1; letter-spacing: 0.06em; background: var(--plate); color: #111; border: 2px solid rgba(0, 0, 0, 0.35); border-radius: 8px; padding: 6px 16px; }
.signin h1 { font-size: 1.6rem; line-height: 1.1; margin-top: 8px; }

/* Home */
.appbar { background: var(--accent); color: var(--accent-ink); padding: calc(18px + var(--safe-top)) 20px 22px; }
.appbar-eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.8; }
.appbar h1 { font-size: 2rem; line-height: 1.1; overflow-wrap: anywhere; }
.appbar-sub { font-size: 0.9rem; opacity: 0.85; margin-top: 2px; }
.section-h { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }
.form-card { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.form-card:hover { border-color: var(--accent); }
.form-card-name { font-size: 1.35rem; font-weight: 700; }
.form-card-meta { grid-column: 1; font-size: 0.9rem; color: var(--ink-2); }
.form-card-chev { grid-column: 2; grid-row: 1 / 3; font-size: 1.8rem; color: var(--accent); line-height: 1; }
.home-foot { position: sticky; bottom: 0; margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: 12px 18px calc(16px + var(--safe-bottom)); }
.copyright { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--ink-2); display: grid; place-items: center; color: var(--ink-2); font-weight: 600; }
.help-fab { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 1.8rem; font-weight: 800; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); }

/* Daily Check */
.formbar { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); padding: calc(8px + var(--safe-top)) 12px 8px; }
.formbar h1 { font-size: 1.15rem; }
.back { justify-self: start; background: none; border: 0; color: var(--accent); font-weight: 600; padding: 8px 4px; }
.header-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.header-field { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.header-label { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.header-number { width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 0.7rem; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.header-value { font-weight: 600; overflow-wrap: anywhere; }
.locked { display: block; font-size: 0.75rem; font-weight: 500; color: var(--ink-2); }
.header-field select, .header-field input { min-height: 42px; padding: 6px 10px; }
.unit-input { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.unit-input:focus-within { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.unit { display: grid; place-items: center; padding: 0 10px; background: var(--surface-2); border-right: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: 0.85rem; }
.unit-input input { border: 0; border-radius: 0; outline: none; font-family: var(--mono); min-width: 0; }

.section-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.checks { display: grid; gap: 8px; }
.check { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.check-fail { border-color: var(--fail); }
.check-head { display: flex; gap: 10px; align-items: flex-start; }
.check-number { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); min-width: 22px; padding-top: 3px; }
.check-name { font-weight: 600; line-height: 1.25; display: block; }
.check-sub { font-size: 0.85rem; color: var(--ink-2); display: block; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.choices-2 { grid-template-columns: 1fr 1.5fr; }
.choice { min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; }
.choice[aria-pressed="true"].choice-pass, .choice[aria-pressed="true"].choice-yes { background: var(--pass); border-color: var(--pass); color: #fff; }
.choice[aria-pressed="true"].choice-fail, .choice[aria-pressed="true"].choice-no { background: var(--fail); border-color: var(--fail); color: #fff; }
.choice[aria-pressed="true"].choice-na { background: var(--na); border-color: var(--na); color: #fff; }
.detail { display: grid; gap: 10px; }
.add-note { justify-self: start; }
.required { color: var(--fail); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-left: 6px; }
.declaration { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; font-weight: 500; cursor: pointer; }
.declaration input { width: 24px; height: 24px; min-height: 0; margin: 0; flex: none; accent-color: var(--accent); }

/* "Show me what's left" outlines everything still missing in red. */
.show-missing .is-missing { border-color: var(--fail); box-shadow: inset 0 0 0 1px var(--fail); }
.show-missing .is-missing .check-name, .show-missing .is-missing .header-label { color: var(--fail); }

.sendbar { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 14px calc(12px + var(--safe-bottom)); }
.sendbar-info { display: grid; gap: 2px; min-width: 0; font-size: 0.95rem; }
.sendbar-info .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sendbar-error { color: var(--fail); white-space: normal !important; }
.send { flex: none; min-height: 50px; padding: 0 26px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.send[aria-disabled="true"] { background: var(--line); border-color: var(--line); color: var(--ink-2); cursor: not-allowed; }

/* Pop-up sheets (Help, result) */
.sheet-back { position: fixed; inset: 0; z-index: 10; background: rgba(8, 14, 20, 0.5); }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 11; background: var(--surface); border-radius: 20px 20px 0 0; padding: 22px 20px calc(24px + var(--safe-bottom)); display: grid; gap: 14px; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2); animation: rise 0.2s ease-out; }
.sheet h2 { font-size: 1.5rem; }
.help-number { display: grid; gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.help-number b { font-family: var(--mono); font-size: 1.3rem; user-select: all; }
.result-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; background: var(--pass-soft); color: var(--pass); }
.sheet-center { justify-items: center; text-align: center; }
.sheet-center .btn, .sheet-center .alert { width: 100%; }
@keyframes rise { from { transform: translate(-50%, 24px); opacity: 0.6; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

.loading { padding: 40px 20px; text-align: center; color: var(--ink-2); }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 0.9rem; border-radius: 8px; }

/* Photos on a check */
.row-actions { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-remove { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 1rem; line-height: 26px; padding: 0; }
.photo-error { color: var(--fail); margin: 0; }
.saved-note { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; }

/* Checks waiting to send */
.notice { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.queue { display: grid; gap: 8px; }
.queue-card { background: var(--surface); border: 1px solid var(--warn); border-left-width: 5px; border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 6px; }
.queue-card-stuck { border-color: var(--fail); }
.queue-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.queue-status { font-size: 0.9rem; color: var(--warn); }
.queue-stuck { color: var(--fail); }
.queue-actions { display: flex; align-items: center; gap: 16px; }
.result-icon-wait { background: var(--warn-soft); color: var(--warn); }
