:root {
  --ssg-navy: #0d2340;
  --ssg-blue: #1d6fb8;
  --ssg-red: #c8102e;
  --ink: #1a1a1a;
  --muted: #5b6b7d;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ok: #1f9d55;
  --line: #e2e8f0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink);
  line-height: 1.45; min-height: 100vh;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 40px; }

header.topbar {
  background: var(--ssg-navy); color: #fff;
  padding: 14px 16px; text-align: center;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
header.topbar img { height: 38px; width: auto; display: block; margin: 0 auto; }
header.topbar img.pending { visibility: hidden; }
/* A logo supplied as a JPEG carries its own white field, so it gets a light chip
   rather than sitting on the dark bar as a stray white rectangle. */
header.topbar img.on-white {
  /* A wide logo constrained by height ends up a postage stamp, so a brand mark on
     its own white field is sized by width and given a light chip to sit on. */
  height: auto; width: 210px; max-width: 74%;
  background: #fff; border-radius: 8px; padding: 6px 10px;
}
header.topbar .company { font-size: 13px; opacity: .85; margin-top: 4px; }

h1 { font-size: 22px; margin: 22px 0 6px; color: var(--ssg-navy); }
p.lede { color: var(--muted); margin: 0 0 18px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; margin: 14px 0; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 15px; }
select, input[type="date"], input[type="text"], input[type="tel"] {
  width: 100%; padding: 13px; font-size: 16px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
.field-checkbox { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 10px; }
.field-checkbox label { margin: 0; }
.field-checkbox input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; margin: 0; }
textarea {
  width: 100%; padding: 13px; font-size: 16px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); resize: vertical;
  font-family: inherit; line-height: 1.45;
}
.row { display: flex; gap: 10px; }
.row button { flex: 1; }
.btn-ghost.recording { background: var(--ssg-red); color: #fff; }

button {
  font-size: 17px; font-weight: 700; border: none; border-radius: 12px;
  padding: 16px; width: 100%; cursor: pointer; margin-top: 14px;
}
.btn-primary { background: var(--ssg-blue); color: #fff; }
.btn-primary:active { background: #155a96; }
.btn-danger { background: var(--ssg-red); color: #fff; }
.btn-ghost { background: #eef2f7; color: var(--ssg-navy); }
button:disabled { opacity: .5; }

.progress { display: flex; align-items: center; gap: 10px; margin: 18px 0 6px; }
.progress .bar { flex: 1; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress .bar > i { display: block; height: 100%; background: var(--ssg-blue); width: 0; transition: width .25s; }
.progress .count { font-size: 13px; color: var(--muted); white-space: nowrap; }

.step-title { font-size: 20px; color: var(--ssg-navy); margin: 6px 0 4px; }
.step-instruction { color: var(--muted); margin: 0 0 14px; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .state {
  position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff;
  border-radius: 999px; font-size: 11px; padding: 2px 7px;
}
.thumb .state.ok { background: var(--ok); }
.thumb .rm {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; line-height: 22px;
  text-align: center; background: rgba(0,0,0,.6); color: #fff; border-radius: 999px; font-size: 16px;
}

/* Structured accident-detail fields */
.field { margin: 0 0 12px; }
.field label { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.field select { border-color: var(--line); }
.field.suggested select { border-color: var(--ssg-blue); background: #f3f8fd; }
.ai-tag {
  font-size: 11px; font-weight: 700; color: #fff; background: var(--ssg-blue);
  border-radius: 999px; padding: 2px 8px; letter-spacing: .02em;
}
.field.suggested .ai-tag { display: inline-block; }
.field .ai-tag { display: none; }
.field.from-roster select { border-color: var(--ok); background: #f1faf3; }
.roster-tag {
  font-size: 11px; font-weight: 700; color: #fff; background: var(--ok);
  border-radius: 999px; padding: 2px 8px; letter-spacing: .02em;
}
.field.from-roster .roster-tag { display: inline-block; }
.field .roster-tag { display: none; }

.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 14px; }
.big-check { font-size: 56px; color: var(--ok); }
.err { background: #fdecee; color: var(--ssg-red); border: 1px solid #f5c2c9; padding: 12px; border-radius: 10px; margin: 12px 0; font-size: 14px; }
.footer-note { text-align: center; color: var(--muted); font-size: 12px; margin-top: 26px; }
.spinner { display:inline-block; width:18px; height:18px; border:3px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation:spin .8s linear infinite; vertical-align:middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Remedial-training prompt: pops over the "Report Filed" screen so the ask
   lands while the supervisor still has the event in front of them. */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(13, 35, 64, .62);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 520px;
  padding: 20px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
  max-height: 92vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 6px; font-size: 20px; color: var(--ssg-navy); }
.modal .btn-primary, .modal .btn-ghost { margin-top: 10px; }
.modal .why {
  background: #f3f8fd; border: 1px solid #cfe1f5; border-radius: 8px;
  padding: 8px 10px; margin: 8px 0 0; font-size: 13px; color: #14213d;
}

/* Event picker on the driver start screen (accident / spill / loading-tarp).
   Big tap targets - a driver is using this one-handed on the shoulder of a road. */
.event-options { display: grid; gap: 10px; }
.event-options button {
  margin-top: 0; text-align: left; padding: 15px 16px; font-size: 16px;
  background: #fff; color: var(--ssg-navy); border: 2px solid var(--line);
}
.event-options button.selected {
  border-color: var(--ssg-blue); background: #eef5fc; color: var(--ssg-blue);
}

/* Photos already on a report: captioned thumbnails + full-size viewer */
.thumb.record .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  color: #fff; font-size: 10px; line-height: 1.25; text-align: left;
}
.thumb.record { cursor: pointer; }
.thumb.record img { opacity: 0; transition: opacity .2s; }
.thumb.record img.ready { opacity: 1; }
.viewer {
  width: 100%; max-width: 720px; text-align: center;
}
.viewer img {
  width: 100%; max-height: 74vh; object-fit: contain;
  border-radius: 12px; background: #000;
}
.viewer-caption { color: #fff; font-size: 14px; margin: 10px 0 0; }
.viewer-nav { display: flex; gap: 8px; }
.viewer-nav .btn-ghost { flex: 1; }
.viewer .btn-ghost { background: rgba(255,255,255,.92); }
