:root {
  --color-primary: #1e3a5f;        /* navy */
  --color-primary-hover: #162d4a;  /* navy darker */
  --color-accent: #f59e0b;         /* amber */
  --color-accent-hover: #d97706;   /* amber darker */
  --color-bg: #f8fafc;             /* off-white */
  --color-surface: #ffffff;         /* white */
  --color-border: #e2e8f0;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
}

/* ==========================================================================
   Phase 2 — Driver Flow inspection-state tokens (from 02-UI-SPEC §Color)
   ========================================================================== */

:root {
  --color-tile-pending: #e2e8f0;
  --color-tile-captured: #f59e0b;
  --color-tile-error: #fee2e2;
  --color-tile-text-pending: #94a3b8;
  --color-tile-text-captured: #ffffff;
  --color-tile-text-error: #dc2626;
  --color-ring-track: #e2e8f0;
  --color-ring-fill: #f59e0b;
  --color-submit-disabled: #cbd5e1;
}

.checkpoint-tile {
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.checkpoint-tile:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.checkpoint-tile[data-state="pending"] {
  background-color: var(--color-tile-pending);
  color: var(--color-tile-text-pending);
}

.checkpoint-tile[data-state="captured"] {
  background-color: var(--color-tile-captured);
  color: var(--color-tile-text-captured);
}

.checkpoint-tile[data-state="error"] {
  background-color: var(--color-tile-error);
  color: var(--color-tile-text-error);
}

.checkpoint-tile[data-state="uploading"] {
  background-color: var(--color-tile-pending);
  color: var(--color-tile-text-pending);
  position: relative;
}

.checkpoint-tile[data-state="uploading"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 50 50'><circle cx='25' cy='25' r='20' fill='none' stroke='%231e3a5f' stroke-width='4' stroke-dasharray='90 60'><animateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='0.8s' repeatCount='indefinite'/></circle></svg>")
    center / 24px no-repeat;
}

.driver-toast-error {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  background: var(--color-tile-error);
  color: var(--color-tile-text-error);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1080;
  font-weight: 700;
}

#progress-ring-fill {
  transition: stroke-dashoffset 0.4s ease;
}

/* ==========================================================================
   Phase 3 — Admin Portal status tokens (from 03-UI-SPEC §Color)
   ========================================================================== */

:root {
  --color-status-submitted: #16a34a;
  --color-status-pending:   #cbd5e1;
  --color-status-overdue:   #dc2626;
  --color-status-late-indicator: #16a34a;
}

/* Dashboard vehicle card — keyboard focus ring (UI-SPEC §Accessibility).
   Mirrors .checkpoint-tile:focus-visible so focus is visible on tab navigation
   from the filter pills into the grid. */
.vehicle-card {
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.vehicle-card:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Plan 03-05 — Reports page: fleet download button disabled state (D-03)
   ========================================================================== */

.btn-download-fleet[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.6;
  cursor: progress;
}

.btn-download-fleet[aria-disabled="true"]::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.4em;
  vertical-align: -0.15em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-download-fleet-spin 0.7s linear infinite;
}

@keyframes btn-download-fleet-spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Phase 4 — admin management (users + fleet list/form pages)
   ========================================================================== */

/* ==========================================================================
   Quick 260515-k2a — Grid Overview driver UI cards
   ========================================================================== */

.checkpoint-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.checkpoint-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.checkpoint-tile-label {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: pointer;
  z-index: 2;
}

.checkpoint-card[data-state="captured"] {
  border-color: #16a34a;
  background: #dcfce7;
}

.checkpoint-card[data-state="error"] {
  border-color: var(--color-tile-text-error);
}

.checkpoint-card-icon {
  aspect-ratio: 3/4;
  background: #f1f5f9;
  color: var(--color-text-muted);
  transition: background 0.15s, color 0.15s;
}

.checkpoint-card-thumb {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}

/* Bundled guiding reference photo shown in place of the icon on pending tiles
   (feature round A). Fills the icon area; tap enlarges via #guide-dialog. */
.checkpoint-guide-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

#guide-dialog::backdrop {
  background: rgba(0, 0, 0, 0.8);
}

.checkpoint-card[data-state="captured"] .checkpoint-card-icon {
  background: #dcfce7;
  color: #16a34a;
}

.checkpoint-card[data-state="error"] .checkpoint-card-icon {
  background: #fee2e2;
  color: var(--color-tile-text-error);
}

.checkpoint-card-label {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.2;
}

.checkpoint-card-status {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.checkpoint-card[data-state="captured"] .checkpoint-card-status {
  color: #16a34a;
  font-weight: 600;
}


/* Admin table */
.admin-table-wrap {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.07);
}

.admin-table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table-wrap th {
  background: #f8fafc;
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
}

.admin-table-wrap td {
  padding: 13px 16px;
  font-size: 13px;
  color: var(--color-text);
  border-bottom: 1px solid #f8fafc;
}

.admin-table-wrap tr:last-child td { border-bottom: none; }
.admin-table-wrap tr:hover td { background: #f8fafc; }
.admin-table-wrap .td-plate { font-weight: 700; }
.admin-table-wrap .td-muted { color: var(--color-text-muted); }

/* Submission detail — info cards */
.detail-info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  height: 100%;
}

.detail-info-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.detail-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.detail-info-row:last-child { border-bottom: none; }

.detail-info-label {
  color: var(--color-text-muted);
  flex-shrink: 0;
  min-width: 110px;
}

.detail-info-value {
  text-align: right;
  word-break: break-word;
}

/* Submission detail — photo grid badges */
.photo-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 7px;
}

.photo-badge-captured {
  background: #dcfce7;
  color: #16a34a;
}

.photo-badge-missing {
  background: #f1f5f9;
  color: #94a3b8;
}

