/* ── Reset ─────────────────────────────────────── */
*, ::backdrop, ::file-selector-button, :after, :before {
  border: 0 solid;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Variables ─────────────────────────────────── */
:root {
  --brand:        #F47C20;
  --primary:      #000;
  --on-primary:   #fff;
  --bg:           #F2F2F7;
  --surface:      #fff;
  --border:       #E5E5EA;
  --border-input: #ccc;
  --text:         #1C1C1E;
  --muted:        #6C6C70;
  --success:      #059669;
  --success-bg:   #D1FAE5;
  --danger:       #DC2626;
  --danger-bg:    #FEE2E2;
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-w:    240px;
  --topbar-h:     56px;
  --bottom-nav-h: 64px;
  --radius-sm:    0.5rem;
  --radius-md:    12px;
  --radius-full:  9999px;
}

/* ── Base ──────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ── Typography ────────────────────────────────── */
h1 { font-size: 2.25rem; font-weight: bold; }
h2 { font-size: 1.5rem;  font-weight: bold; }
h3 { font-size: 1.25rem; font-weight: bold; }
h4 { font-size: 1rem;    font-weight: bold; }

/* ── Layout ────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar { display: none; }

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--bottom-nav-h);
}

/* ── Topbar (mobile) ───────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 10;
  gap: 8px;
}

.topbar-logo { height: 26px; width: auto; }

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.topbar-spacer { flex: 1; }

.back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--brand);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

/* ── Content ───────────────────────────────────── */
.content {
  padding: 16px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* ── Page header (tablet/desktop) ─────────────── */
.page-header { display: none; margin-bottom: 24px; }

/* ── Bottom Nav ────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 20;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 500;
  transition: color 0.15s;
}

.bottom-nav-item.active { color: var(--brand); }
.bottom-nav-item svg { width: 24px; height: 24px; }

/* ── Sidebar ───────────────────────────────────── */
.sidebar {
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 30;
  overflow: hidden;
}

.sidebar-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo { height: auto; width: 48px; }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin: 0 8px;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { color: var(--brand); background: #FFF4EC; }
.nav-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.nav-label { display: none; }

/* ── Cards ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* ── Group label (iOS style) ───────────────────── */
.group-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 20px 4px 8px;
}

/* ── Form ──────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.input {
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  width: 100%;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}

.input:focus { border-color: var(--brand); }
textarea.input { resize: vertical; min-height: 80px; }

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

/* ── Buttons ───────────────────────────────────── */
.primary-button {
  background: #000;
  color: white;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  width: 100%;
  display: block;
  text-align: center;
  transition: background 0.15s;
  line-height: 1.5;
}

.primary-button:hover { background: #222; }

/* ── Checklist ─────────────────────────────────── */
.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  gap: 12px;
  transition: background 0.1s;
}

.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: #FAFAFA; }
.checklist-item[data-state="pass"] { background: var(--success-bg); }
.checklist-item[data-state="fail"] { background: var(--danger-bg); }
.item-label { font-size: 0.9375rem; flex: 1; }
.item-icon { flex-shrink: 0; line-height: 0; }

/* ── Section footer ────────────────────────────── */
.section-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 4px;
}

.section-result-label { font-size: 0.875rem; color: var(--muted); }

/* ── Badges ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge--pending { background: #F3F4F6; color: #6B7280; }
.badge--pass    { background: var(--success-bg); color: var(--success); }
.badge--fail    { background: var(--danger-bg); color: var(--danger); }
.badge--fmcsa   { background: #EFF6FF; color: #1D4ED8; font-weight: 600; letter-spacing: 0; }

/* ── Stats ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
}

.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 0.6875rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }
.stat-card--pass .stat-value { color: var(--success); }
.stat-card--fail .stat-value { color: var(--danger); }

/* ── Action cards ──────────────────────────────── */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s;
}

.action-card:hover { box-shadow: 0 2px 16px rgba(0,0,0,0.08); }

.action-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-icon--brand { background: var(--brand); color: #fff; }
.action-icon--dark  { background: var(--primary); color: #fff; }
.action-title { font-size: 0.9375rem; font-weight: 600; }
.action-desc  { font-size: 0.8125rem; color: var(--muted); }

/* ── Recent list ───────────────────────────────── */
.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.recent-item:last-child { border-bottom: none; }
.recent-info { flex: 1; min-width: 0; }
.recent-truck { font-size: 0.9375rem; font-weight: 600; }
.recent-meta  { font-size: 0.8125rem; color: var(--muted); margin-top: 2px; }

/* ── Final eval ────────────────────────────────── */
.final-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.overall-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.overall-label { font-size: 1rem; font-weight: 600; }

/* ── Vehicle status options ────────────────────── */
.status-options { display: flex; gap: 12px; }

.status-opt {
  flex: 1;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s;
  user-select: none;
}

.status-opt:hover { border-color: var(--text); }
.status-opt.is-safe   { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.status-opt.is-unsafe { border-color: var(--danger);  background: var(--danger-bg);  color: var(--danger); }

/* ── Submit area ───────────────────────────────── */
.submit-area { margin-top: 32px; padding-bottom: 32px; }

/* ── Spacers ───────────────────────────────────── */
.spacer-sm { height: 8px; }
.spacer-md { height: 16px; }

/* ── Tablet 768px+ ─────────────────────────────── */
@media (min-width: 768px) {
  .sidebar { display: flex; width: 64px; }
  .main-area { margin-left: 64px; padding-bottom: 0; }
  .bottom-nav { display: none; }
  .topbar { display: none; }
  .page-header { display: block; }
  .content { padding: 24px; }
}

/* ── Desktop 1024px+ ───────────────────────────── */
@media (min-width: 1024px) {
  .sidebar { width: var(--sidebar-w); }
  .sidebar-logo { width: 140px; }
  .sidebar-logo-wrap { justify-content: flex-start; padding: 24px 20px; }
  .nav-item { justify-content: flex-start; gap: 12px; padding: 10px 16px; }
  .nav-label { display: block; }
  .main-area { margin-left: var(--sidebar-w); }
  .content { padding: 32px 40px; max-width: 900px; }
  .input-row { grid-template-columns: 1fr 1fr 1fr; }
}

/* ── Print ─────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .bottom-nav { display: none !important; }
  .main-area { margin: 0 !important; padding: 0 !important; }
  .content { padding: 0 !important; max-width: none !important; }
  .page-header { display: block !important; }
  .checklist-item { break-inside: avoid; }
}
