: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 .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; }

/* Report-type picker cards */
#typeCards { display: flex; flex-direction: column; gap: 12px; }
.type-card {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  gap: 6px; width: 100%; margin: 0; padding: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04); cursor: pointer;
}
.type-card:active { border-color: var(--ssg-blue); background: #f3f8fd; }
.type-card .type-name { font-size: 18px; font-weight: 700; color: var(--ssg-navy); }
.type-card .type-desc { font-size: 13px; font-weight: 400; color: var(--muted); line-height: 1.4; }
#changeTypeBtn { width: auto; margin: 0; padding: 8px 12px; font-size: 13px; }

/* Checklist groups (Infinity checklist attributes) */
.checklist-group { margin: 4px 0 16px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.checklist-head {
  display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px;
  color: var(--ssg-navy); background: #eef2f7; padding: 10px 12px;
}
.checklist-item {
  display: flex; flex-direction: row; align-items: flex-start; gap: 10px; margin: 0;
  padding: 11px 12px; border-top: 1px solid var(--line); font-weight: 400; font-size: 15px;
}
.checklist-item input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; margin: 1px 0 0; }
.checklist-item span { flex: 1; }
.checklist-item.suggested { background: #f3f8fd; }
.ai-tag { display: inline-block; }

.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); } }

/* Follow-along GPS route tracking */
.gps-status {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  background: #eef4fb; border: 1px solid #cfe0f2; color: var(--ssg-navy);
  font-size: 14px; line-height: 1.5;
}
.gps-status.tracking { background: #eafaf0; border-color: #b7e6c8; }
.gps-status .gps-metric { font-weight: 700; }
.gps-status .gps-live { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--ssg-red); }
.gps-status .gps-live::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ssg-red);
  animation: gpspulse 1.1s ease-in-out infinite;
}
@keyframes gpspulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.gps-preview {
  width: 100%; height: auto; margin-top: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #f4f6f9; display: block;
}
