/* ============================================================
   VKS Patrol PWA — iOS-style direction
   System-grouped backgrounds, inset rounded lists, hairline
   separators, system-blue tint, Live Activity capsule, sheets.
   Type: Noto Sans Lao + Noto Sans only.
   ============================================================ */

:root {
  /* iOS system colors as HSL triplets */
  --background:        220 16% 96.5%;       /* #F2F2F7 systemGroupedBackground */
  --foreground:        0 0% 0%;             /* label */
  --card:              0 0% 100%;           /* secondarySystemGroupedBackground */
  --card-foreground:   0 0% 0%;
  --popover:           0 0% 100%;
  --popover-foreground: 0 0% 0%;
  --primary:           211 100% 50%;        /* #007AFF systemBlue */
  --primary-foreground: 0 0% 100%;
  --secondary:         240 4% 18%;
  --secondary-foreground: 0 0% 100%;
  --muted:             240 6% 92%;
  --muted-foreground:  240 4% 38%;
  --accent:            240 6% 92%;
  --accent-foreground: 0 0% 0%;
  --destructive:       4 100% 59%;          /* #FF3B30 systemRed */
  --destructive-foreground: 0 0% 100%;
  --border:            240 6% 88%;
  --input:             240 6% 88%;
  --ring:              211 100% 50%;

  /* Page surface — iOS systemGroupedBackground */
  --page-bg:           220 16% 96.5%;

  /* iOS additional system colors */
  --ios-green:         142 71% 45%;         /* #34C759 */
  --ios-orange:        35 100% 50%;         /* #FF9500 */
  --ios-purple:        285 67% 60%;         /* #AF52DE */
  --ios-pink:          340 79% 60%;
  --ios-yellow:        50 100% 50%;
  --ios-indigo:        239 70% 60%;         /* #5856D6 */
  --ios-gray:          240 6% 92%;
  --ios-gray-2:        240 6% 88%;
  --ios-gray-3:        240 6% 78%;
  --ios-label-2:       240 4% 38%;
  --ios-label-3:       240 4% 56%;

  /* Hairline separator (iOS uses 0.33pt rgba black) */
  --hairline:          rgba(60, 60, 67, 0.18);

  /* Brand accent — kept for legacy refs */
  --brand-accent:      #007AFF;

  /* iOS radii — larger and consistent */
  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* iOS-style shadows (subtle, depth-of-paper not depth-of-elevation) */
  --shadow-sm: 0 0.5px 0 rgba(0,0,0,0.04);
  --shadow:    0 1px 2px rgba(0,0,0,0.04), 0 0 0 0.5px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 16px -8px rgba(0,0,0,0.1), 0 0 0 0.5px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 40px -16px rgba(0,0,0,0.18), 0 0 0 0.5px rgba(0,0,0,0.04);

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; border-width: 0; border-style: solid; border-color: hsl(var(--border)); }

html, body {
  margin: 0; padding: 0;
  min-height: 100vh; min-height: 100dvh;
  font-family: 'Noto Sans Lao', 'Noto Sans', system-ui, sans-serif;
  font-feature-settings: "tnum" 1, "ss01" 1;
  letter-spacing: -0.012em;
  background-color: hsl(var(--page-bg));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.55;
  overscroll-behavior-y: contain;
}

/* iOS — tabular numerals on numeric displays (timer, scores, IDs, GPS). */
.mono, .input-id, .timer-time, .stat-value, .metric-value, .rating-num, .resume-elapsed,
.history-time, .history-detail-grid strong, .history-card-row2 .mono,
.h-time, .nav-meta,
input[type="time"], time {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "ss01" 1;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.025em; }

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 1, 'wght' 400;
  vertical-align: middle;
  font-size: 1.25rem;
}

.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app-shell {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

.container { width: 100%; padding: 1rem; }

/* ============================================================
   HEADER (matches VKS .site-header pattern)
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(0.875rem + var(--safe-top)) 1rem 0.875rem;
  background: hsl(var(--background) / 0.92);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid hsl(var(--border));
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.header-logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(189 94% 35%) 100%);
  color: hsl(var(--primary-foreground));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: hsl(222 47% 11.2%);
}
.brand-text .accent { color: var(--brand-accent); margin-left: 2px; }

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  display: grid;
  place-items: center;
  transition: background 150ms, transform 80ms;
}
.icon-btn:hover { background: hsl(var(--accent)); }
.icon-btn:active { transform: scale(0.94); }

/* ============================================================
   STATUS PILL (online/offline)
   ============================================================ */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.625rem 0.25rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
}
.status-pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: hsl(var(--muted-foreground));
  position: relative;
  flex: none;
}
.status-pill.online {
  color: hsl(142 76% 30%);
  background: hsl(142 76% 36% / 0.10);
  border-color: hsl(142 76% 36% / 0.25);
}
.status-pill.online .dot { background: hsl(142 76% 36%); }
.status-pill.online .dot::after {
  content: ""; position: absolute; inset: -2px;
  border-radius: 50%; background: hsl(142 76% 36%);
  opacity: 0.45;
  animation: pulse 1.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.status-pill.offline {
  color: hsl(38 92% 38%);
  background: hsl(38 92% 50% / 0.10);
  border-color: hsl(38 92% 50% / 0.30);
}
.status-pill.offline .dot { background: hsl(38 92% 50%); }

/* ============================================================
   CARDS (matches VKS .card pattern with primary left border)
   ============================================================ */

.card {
  border-radius: var(--radius-xl);
  border: 1px solid hsl(var(--border) / 0.8);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 4px solid hsl(var(--primary));
  overflow: hidden;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 1.25rem 1.25rem 0.75rem;
}
.card-title {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.card-description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}
.card-content { padding: 0 1.25rem 1.25rem; }

/* Greeting / hero variant */
.card-hero {
  padding: 1.25rem;
}
.card-hero .greeting-line {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}
.card-hero h2 {
  font-size: 1.4rem;
  line-height: 1.2;
  margin: 0.25rem 0 0.875rem;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  letter-spacing: 0.01em;
}
.chip.chip-id {
  background: hsl(var(--primary) / 0.08);
  color: hsl(var(--primary));
  border-color: hsl(var(--primary) / 0.22);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.chip .material-symbols-outlined { font-size: 0.95rem; }

/* ============================================================
   MODE CARD (matches VKS .mode-card pattern)
   ============================================================ */

.mode-card {
  cursor: pointer;
  padding: 1rem;
  border-radius: var(--radius-xl);
  border: 2px solid hsl(var(--border));
  background: hsl(var(--background));
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: all 0.25s ease;
  text-align: left;
  width: 100%;
  position: relative;
}

.mode-card:hover {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.03);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.mode-card:active { transform: scale(0.985); }

.mode-card.patrol:hover { border-color: #3B82F6; background: #EFF6FF; }
.mode-card.special:hover { border-color: #A855F7; background: #FAF5FF; }

.mode-card[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
.mode-card[aria-disabled="true"]:hover {
  border-color: hsl(var(--border));
  background: hsl(var(--background));
  transform: none;
  box-shadow: var(--shadow-sm);
}

.mode-icon-box {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-lg);
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.mode-icon-box .material-symbols-outlined { font-size: 1.6rem; }

.mode-card.patrol .mode-icon-box { background: #DBEAFE; color: #2563EB; }
.mode-card.special .mode-icon-box { background: #F3E8FF; color: #9333EA; }
.mode-card.history .mode-icon-box { background: #ECFDF5; color: #059669; }
.mode-card.sites .mode-icon-box { background: #FFF7ED; color: #C2410C; }

.mode-text { flex: 1; min-width: 0; }
.mode-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: hsl(222 47% 11%);
  margin-bottom: 0.125rem;
  line-height: 1.25;
}
.mode-card-desc {
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.35;
}

.mode-chevron {
  color: hsl(var(--border));
  transition: color 0.2s, transform 0.2s;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.mode-card:hover .mode-chevron { color: hsl(var(--primary)); transform: translateX(2px); }

.tag-soon {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: hsl(38 92% 50% / 0.12);
  color: hsl(38 92% 38%);
  border: 1px solid hsl(38 92% 50% / 0.25);
  margin-top: 0.25rem;
}

/* ============================================================
   BUTTONS (mirrors VKS .btn family)
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  height: 2.75rem;
  padding: 0 1.25rem;
  cursor: pointer;
  transition: all 150ms;
  user-select: none;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.btn:active { transform: scale(0.98); }
.btn:disabled { pointer-events: none; opacity: 0.5; }

.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-primary:hover { opacity: 0.92; }

.btn-outline { background: hsl(var(--background)); border: 1px solid hsl(var(--border)); }
.btn-outline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.btn-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }

.btn-block { width: 100%; height: 3rem; font-size: 1rem; }

@media (max-width: 640px) {
  .btn { min-height: 48px; font-size: 1rem; }
}

/* ============================================================
   INPUTS
   ============================================================ */

.input-group { margin-bottom: 1.25rem; }
label {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: block;
  color: hsl(var(--foreground));
}

.input {
  display: block;
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  font-size: 1rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
  font-family: inherit;
}
.input:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.18);
}
.input::placeholder { color: hsl(var(--muted-foreground)); }

.input-id {
  font-family: 'Noto Sans', system-ui, monospace;
  font-feature-settings: "tnum";
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 1.05rem;
}

.field-error {
  margin-top: 0.75rem;
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  background: hsl(var(--destructive) / 0.08);
  color: hsl(var(--destructive));
  border: 1px solid hsl(var(--destructive) / 0.22);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  animation: shake 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.field-error.visible { display: flex; }
.field-error .material-symbols-outlined { font-size: 1.05rem; flex: none; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */

.login-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(2rem + var(--safe-top)) 1rem calc(1.5rem + var(--safe-bottom));
  animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-brand .header-logo {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 0.875rem;
  font-size: 1rem;
  border-radius: var(--radius);
}
.login-brand h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: hsl(222 47% 11%);
  margin: 0 0 0.25rem;
}
.login-brand h1 .accent { color: var(--brand-accent); }
.login-brand p {
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
  margin: 0;
}

.login-card-wrap { padding: 0; }

.login-footer {
  text-align: center;
  margin-top: 1.25rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

/* ============================================================
   HOME SCREEN
   ============================================================ */

#screen-home {
  display: flex;
  flex-direction: column;
  flex: 1;
}

main.home-main {
  padding: 1rem 1rem calc(1.5rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.section-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.5rem 0.125rem 0;
}
.section-h h3 {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.section-h .section-sub {
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
}

.action-stack { display: flex; flex-direction: column; gap: 0.625rem; }

/* ============================================================
   BOTTOM SHEET MENU
   ============================================================ */

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgb(0 0 0 / 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: 100%;
  max-width: 440px;
  background: hsl(var(--background));
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  border-top: 1px solid hsl(var(--border));
  padding: 0 0 calc(1.25rem + var(--safe-bottom));
  z-index: 101;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -10px 40px rgb(0 0 0 / 0.18);
  overflow: hidden;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet.dragging { transition: none; }

/* Drag handle hit area — covers the handle plus a touch target above */
.sheet-grabber {
  padding: 0.5rem 0 0.625rem;
  cursor: grab;
  touch-action: none;
}
.sheet-grabber:active { cursor: grabbing; }
.sheet-handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: hsl(var(--border));
  margin: 0 auto;
  transition: background 150ms;
}
.sheet-grabber:active .sheet-handle { background: hsl(var(--muted-foreground) / 0.5); }

/* ----- Profile block ----- */
.sheet-profile {
  position: relative;
  padding: 0.5rem 1.25rem 1rem;
  background:
    radial-gradient(120% 80% at 100% 0%, hsl(var(--primary) / 0.10), transparent 55%),
    hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
}
.sheet-profile-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}
.sheet-avatar {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(189 94% 32%) 100%);
  color: hsl(var(--primary-foreground));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  flex: none;
  box-shadow: 0 2px 8px hsl(var(--primary) / 0.30);
  border: 2px solid hsl(var(--background));
}
.sheet-profile-meta { flex: 1; min-width: 0; }
.sheet-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0;
  color: hsl(222 47% 11%);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-sub {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.25rem 0 0;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  background: hsl(var(--primary) / 0.08);
  color: hsl(var(--primary));
  border: 1px solid hsl(var(--primary) / 0.22);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.sheet-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.875rem;
}
.sheet-chip-row .chip { font-size: 0.7rem; padding: 0.2rem 0.55rem; }

/* ----- Sections ----- */
.sheet-section {
  padding: 0.625rem 0.625rem 0.25rem;
}
.sheet-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  padding: 0 0.625rem 0.375rem;
}

.sheet-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 0.625rem;
  border-radius: var(--radius);
  width: 100%;
  text-align: left;
  color: hsl(var(--foreground));
  min-height: 52px;
  transition: background 150ms, transform 80ms;
}
.sheet-row:hover { background: hsl(var(--muted)); }
.sheet-row:active { transform: scale(0.985); background: hsl(var(--accent)); }
.sheet-row .icn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  display: grid;
  place-items: center;
  flex: none;
}
.sheet-row .icn .material-symbols-outlined { font-size: 1.15rem; }
.sheet-row .lbl {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sheet-row .lbl-sub {
  font-size: 0.72rem;
  font-weight: 400;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.01em;
}
.sheet-row .meta {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  background: hsl(var(--muted));
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}
.sheet-row .chevron {
  color: hsl(var(--muted-foreground) / 0.6);
  display: grid;
  place-items: center;
}
.sheet-row .chevron .material-symbols-outlined { font-size: 1.1rem; }

/* ----- Sign out CTA ----- */
.sheet-footer {
  padding: 0.5rem 1rem 0;
  border-top: 1px solid hsl(var(--border));
  margin-top: 0.5rem;
}
.btn-signout {
  width: 100%;
  height: 3rem;
  border-radius: var(--radius);
  background: hsl(var(--destructive) / 0.08);
  color: hsl(var(--destructive));
  border: 1px solid hsl(var(--destructive) / 0.22);
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 150ms, transform 80ms;
}
.btn-signout:hover { background: hsl(var(--destructive) / 0.12); }
.btn-signout:active { transform: scale(0.985); }
.btn-signout .material-symbols-outlined { font-size: 1.15rem; }

/* ============================================================
   PATROL FORM SCREEN
   ============================================================ */

#screen-patrol-form {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.form-top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: calc(0.75rem + var(--safe-top)) 0.875rem 0.75rem;
  background: hsl(var(--background) / 0.94);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid hsl(var(--border));
}
.form-top-bar .icon-btn { background: transparent; }

/* Step progress */
.step-progress {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.step-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.step-progress-title {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step-progress-num {
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.step-bar {
  height: 3px;
  background: hsl(var(--muted));
  border-radius: var(--radius-full);
  overflow: hidden;
}
.step-bar-fill {
  height: 100%;
  background: hsl(var(--primary));
  border-radius: inherit;
  transition: width 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.form-main {
  padding: 1rem 1rem calc(7rem + var(--safe-bottom));
  position: relative;
}

/* Stage = one wizard step. Only the active stage is rendered. */
.stage {
  display: none;
  flex-direction: column;
  gap: 0.875rem;
}
.stage.active {
  display: flex;
  animation: slideStage 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.stage.back-anim.active {
  animation: slideStageBack 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes slideStage {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideStageBack {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.form-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-xl);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.form-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  margin: 0 0 0.875rem;
}
.form-card-title .material-symbols-outlined {
  font-size: 1.05rem;
  color: hsl(var(--primary));
}

.form-row + .form-row { margin-top: 0.875rem; }
.form-row label {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: hsl(var(--foreground));
}

select.input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, hsl(var(--muted-foreground)) 50%),
                    linear-gradient(135deg, hsl(var(--muted-foreground)) 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 1.1rem, calc(100% - 0.85rem) 1.1rem;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
}

textarea.input {
  height: auto;
  min-height: 5rem;
  padding: 0.75rem 0.875rem;
  resize: vertical;
  line-height: 1.5;
}

input[type="time"].input { padding: 0 0.875rem; }

/* ----- Radio group ----- */
.radio-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.radio-tile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 150ms;
  background: hsl(var(--background));
  font-size: 0.875rem;
  font-weight: 500;
  user-select: none;
}
.radio-tile:has(input:checked) {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.05);
  color: hsl(var(--primary));
}
.radio-tile input { display: none; }
.radio-tile .material-symbols-outlined { font-size: 1.05rem; }

/* ----- Equipment grid (2x2 mini cards) ----- */
.equip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.equip-cell {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--background));
  min-height: 110px;
}
.equip-cell .equip-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  line-height: 1.25;
}
.equip-cell .equip-label .material-symbols-outlined {
  font-size: 1.1rem;
  color: hsl(var(--primary));
  flex: none;
}
.equip-cell .equip-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-top: auto;
}
.equip-cell label.radio-tile {
  padding: 0.5rem 0.4rem;
  font-size: 0.78rem;
  justify-content: center;
  min-height: 38px;
}
.equip-cell label.radio-tile.yes:has(input:checked) {
  border-color: hsl(142 76% 40%);
  background: hsl(142 76% 36% / 0.10);
  color: hsl(142 76% 30%);
}
.equip-cell label.radio-tile.no:has(input:checked) {
  border-color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.10);
  color: hsl(var(--destructive));
}

/* ----- Check-tile (single-press perimeter checks) ----- */
.check-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.check-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1.5px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 150ms;
  background: hsl(var(--background));
  user-select: none;
}
.check-tile:has(input:checked) {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.05);
}
.check-tile input { display: none; }
.check-tile .check-box {
  width: 1.25rem; height: 1.25rem;
  border-radius: 6px;
  border: 1.5px solid hsl(var(--border));
  display: grid;
  place-items: center;
  flex: none;
  transition: all 150ms;
  background: hsl(var(--background));
}
.check-tile:has(input:checked) .check-box {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
}
.check-tile .check-box .material-symbols-outlined {
  font-size: 1rem;
  color: white;
  opacity: 0;
  transition: opacity 150ms;
}
.check-tile:has(input:checked) .check-box .material-symbols-outlined { opacity: 1; }
.check-tile .check-text { flex: 1; min-width: 0; }
.check-tile .check-text .ct-label {
  font-size: 0.875rem;
  font-weight: 500;
  display: block;
}
.check-tile .check-text .ct-sub {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
}
.check-tile .check-icon {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  display: grid;
  place-items: center;
  flex: none;
  transition: all 150ms;
}
.check-tile:has(input:checked) .check-icon {
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}

/* ----- Photo grid (Stage 5) ----- */
.photo-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 3rem;
  padding: 0 1rem;
  border: 1.5px dashed hsl(var(--primary) / 0.45);
  border-radius: var(--radius);
  background: hsl(var(--primary) / 0.04);
  color: hsl(var(--primary));
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.photo-add-btn:hover { background: hsl(var(--primary) / 0.08); border-color: hsl(var(--primary)); }
.photo-add-btn .material-symbols-outlined { font-size: 1.25rem; }

.photo-add-btn input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

.photo-empty {
  text-align: center;
  padding: 1.25rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
  border: 1.5px dashed hsl(var(--border));
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.photo-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: hsl(var(--muted));
  border: 1px solid hsl(var(--border));
  animation: photoIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes photoIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
.photo-tile img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.photo-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid; place-items: center;
  color: white;
}
.photo-overlay.error {
  background: hsl(var(--destructive) / 0.85);
}
.photo-overlay .material-symbols-outlined { font-size: 1.5rem; }
.photo-overlay .spinner {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: white;
  width: 22px; height: 22px;
}

.photo-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: hsl(142 76% 36%);
  color: white;
  display: grid; place-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.photo-badge .material-symbols-outlined { font-size: 14px; }

.photo-delete {
  position: absolute;
  top: 6px; left: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 150ms;
}
.photo-delete:hover { background: rgba(0, 0, 0, 0.85); }
.photo-delete .material-symbols-outlined { font-size: 14px; }

.photo-hint {
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
  margin: 0.5rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.4;
}
.photo-hint .material-symbols-outlined { font-size: 1rem; flex: none; }

/* ----- Auto-capture banner (Stage 6) ----- */
.auto-banner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  background: hsl(var(--primary) / 0.06);
  border: 1px dashed hsl(var(--primary) / 0.3);
  border-radius: var(--radius);
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
}
.auto-banner .ab-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  display: grid; place-items: center;
  flex: none;
}
.auto-banner .ab-icon .material-symbols-outlined { font-size: 1rem; }
.auto-banner .ab-text strong { font-weight: 600; color: hsl(var(--foreground)); }
.auto-banner .ab-text { line-height: 1.4; }
.auto-banner.has-fix {
  background: hsl(142 76% 36% / 0.06);
  border-color: hsl(142 76% 36% / 0.30);
  border-style: solid;
}
.auto-banner.has-fix .ab-icon {
  background: hsl(142 76% 36% / 0.15);
  color: hsl(142 76% 36%);
}

/* ============================================================
   JT-SELECT (custom dropdown — replaces native <select>)
   ============================================================ */

.jt-select { position: relative; }
.jt-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  font-size: 1rem;
  font-family: inherit;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: border-color 150ms, box-shadow 150ms;
  text-align: left;
}
.jt-select-trigger:hover { border-color: hsl(var(--muted-foreground) / 0.5); }
.jt-select-trigger.is-open,
.jt-select-trigger:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.18);
  outline: none;
}
.jt-select-trigger .jt-sel-label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.95rem;
}
.jt-select-trigger .jt-sel-placeholder { color: hsl(var(--muted-foreground)); }
.jt-select-trigger .jt-sel-arrow {
  font-size: 1.15rem;
  color: hsl(var(--muted-foreground));
  transition: transform 200ms ease;
  flex-shrink: 0;
}
.jt-select-trigger.is-open .jt-sel-arrow { transform: rotate(180deg); }

.jt-select-panel {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.18), 0 4px 8px rgb(0 0 0 / 0.08);
  z-index: 9999;
  overflow: hidden;
  animation: jtDropIn 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* Allow the panel to escape ancestor containers (sub-options card, reveal) */
.jt-select { z-index: auto; }
.jt-select:has(.jt-select-trigger.is-open) { z-index: 100; position: relative; }
@keyframes jtDropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.jt-select-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
}
.jt-select-search-wrap .material-symbols-outlined {
  font-size: 1.1rem;
  color: hsl(var(--muted-foreground));
}
.jt-select-search {
  flex: 1;
  border: 0;
  outline: none;
  font-size: 0.875rem;
  font-family: inherit;
  background: transparent;
  color: hsl(var(--foreground));
}
.jt-select-search::placeholder { color: hsl(var(--muted-foreground)); opacity: 0.7; }

.jt-select-scroll {
  max-height: 240px;
  overflow-y: auto;
  padding: 0.25rem;
}

.jt-select-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  font-size: 0.875rem;
  font-family: inherit;
  color: hsl(var(--foreground));
  cursor: pointer;
  text-align: left;
  transition: background 100ms;
  min-height: 40px;
}
.jt-select-option:hover { background: hsl(var(--muted)); }
.jt-select-option.is-selected {
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  font-weight: 600;
}
.jt-select-option .jt-sel-icon { font-size: 1.1rem; flex: none; }
.jt-select-option .jt-sel-text { flex: 1; min-width: 0; }
.jt-select-option .jt-sel-check {
  font-size: 1.1rem;
  color: hsl(var(--primary));
  flex: none;
}
/* Route tag inside dropdown options + trigger label */
.jt-select-option .site-route-tag,
.jt-sel-tag.site-route-tag {
  flex: none;
  font-size: 10.5px;
  padding: 2px 7px;
}
.jt-sel-tag {
  margin-left: 0.4rem;
  vertical-align: middle;
}
.jt-select-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

/* ----- Conditional reveal (uniform/defense missing, sleep/position reason)
        Cap is high enough for the 7-item uniform grid and any future block.
        overflow toggles to visible after the open animation so the
        jt-select dropdown panel can escape the container. */
.reveal {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 320ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 220ms,
              margin-top 200ms,
              overflow 0s 0s;
  margin-top: 0;
}
.reveal.open {
  max-height: 1400px;
  opacity: 1;
  margin-top: 0.75rem;
  overflow: visible;
  transition: max-height 320ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 220ms,
              margin-top 200ms,
              overflow 0s 320ms;
}

/* ----- Slider ----- */
.slider-group { padding: 0.25rem 0; }
.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.slider-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.slider-label .material-symbols-outlined {
  font-size: 1rem;
  color: hsl(var(--muted-foreground));
}
.slider-value {
  font-weight: 700;
  color: hsl(var(--primary));
  font-size: 0.95rem;
  min-width: 2.4rem;
  text-align: right;
}
input[type="range"].slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: hsl(var(--muted));
  border-radius: var(--radius-full);
  outline: none;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: hsl(var(--primary));
  border: 3px solid hsl(var(--background));
  box-shadow: 0 2px 6px hsl(var(--primary) / 0.4);
  cursor: pointer;
  transition: transform 100ms;
}
input[type="range"].slider::-webkit-slider-thumb:active { transform: scale(1.15); }
input[type="range"].slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: hsl(var(--primary));
  border: 3px solid hsl(var(--background));
  box-shadow: 0 2px 6px hsl(var(--primary) / 0.4);
  cursor: pointer;
}
.slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  padding: 0 4px;
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
}
.slider-group + .slider-group {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed hsl(var(--border));
}

/* ----- GPS card ----- */
.gps-card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: hsl(var(--muted) / 0.5);
  border: 1px dashed hsl(var(--border));
  margin-bottom: 0.75rem;
}
.gps-card.has-fix {
  background: hsl(142 76% 36% / 0.06);
  border-color: hsl(142 76% 36% / 0.3);
  border-style: solid;
}
.gps-icon-box {
  width: 2rem; height: 2rem;
  border-radius: var(--radius-sm);
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  display: grid; place-items: center;
  flex: none;
}
.gps-card.has-fix .gps-icon-box {
  background: hsl(142 76% 36% / 0.15);
  color: hsl(142 76% 36%);
}
.gps-info { flex: 1; min-width: 0; }
.gps-info .gps-label { font-size: 0.8rem; font-weight: 500; }
.gps-info .gps-coords {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  font-family: 'Noto Sans', monospace;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----- Read-only patrol header ----- */
.patrol-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.patrol-header .avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(189 94% 32%) 100%);
  color: hsl(var(--primary-foreground));
  display: grid;
  place-items: center;
  font-weight: 700;
  flex: none;
}
.patrol-header .meta { flex: 1; min-width: 0; }
.patrol-header .meta strong {
  font-size: 0.9rem;
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.patrol-header .meta small {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
}

/* ----- Sticky submit / nav bar ----- */
.submit-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 440px;
  padding: 0.75rem 1rem calc(0.75rem + var(--safe-bottom));
  background: hsl(var(--background) / 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid hsl(var(--border));
  z-index: 25;
  display: flex;
  gap: 0.5rem;
}
.submit-bar .btn { height: 3rem; }
.submit-bar .btn-flex-grow { flex: 1; }

/* Special-mode bottom bar — same layout as .submit-bar */
.form-bottom-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 440px;
  padding: 0.75rem 1rem calc(0.75rem + var(--safe-bottom));
  background: hsl(var(--background) / 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid hsl(var(--border));
  z-index: 25;
  display: flex;
  gap: 0.5rem;
}
.form-bottom-bar .btn { height: 3rem; }
.form-bottom-bar .btn-flex-grow { flex: 1; }

/* Hide the sticky bottom bar while the soft keyboard is open
   (any input/textarea focused inside the screen). */
#screen-patrol-form:has(input:not([type="hidden"]):focus, textarea:focus) .submit-bar,
#screen-special:has(input:not([type="hidden"]):focus, textarea:focus) .form-bottom-bar {
  transform: translateX(-50%) translateY(140%);
  pointer-events: none;
  opacity: 0;
}
.submit-bar, .form-bottom-bar {
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms ease;
}

/* ----- Checkbox tile (multi-select missing items) ----- */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.checkbox-tile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  background: hsl(var(--background));
  font-size: 0.85rem;
  font-weight: 500;
  user-select: none;
  transition: all 150ms;
  min-height: 44px;
}
.checkbox-tile:has(input:checked) {
  border-color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.06);
  color: hsl(var(--destructive));
}
.checkbox-tile input { display: none; }
.checkbox-tile .emoji {
  font-size: 1.05rem;
  flex: none;
}

/* Sub-options block (revealed on No) */
.sub-options {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: hsl(var(--destructive) / 0.04);
  border: 1px dashed hsl(var(--destructive) / 0.30);
  border-radius: var(--radius);
}
.sub-options-label {
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* ----- Summary card (Confirm stage) ----- */
.summary-card {
  background: linear-gradient(180deg, hsl(var(--primary) / 0.06), transparent);
  border: 1px solid hsl(var(--primary) / 0.18);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.summary-card h4 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.625rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--primary));
}
.summary-card h4 .material-symbols-outlined { font-size: 1.05rem; }
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed hsl(var(--border));
  font-size: 0.85rem;
}
.summary-row:last-child { border-bottom: 0; }
.summary-row .lbl { color: hsl(var(--muted-foreground)); flex: none; }
.summary-row .val { font-weight: 500; text-align: right; word-break: break-word; }
.summary-row .val.warn { color: hsl(38 92% 38%); }
.summary-row .val.danger { color: hsl(var(--destructive)); }
.summary-row .val.ok { color: hsl(142 76% 30%); }

/* ============================================================
   QUEUE BADGE + TOAST
   ============================================================ */

.queue-badge {
  display: none;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0.125rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  background: hsl(38 92% 50% / 0.10);
  border: 1px solid hsl(38 92% 50% / 0.30);
  color: hsl(38 92% 38%);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms;
}
.queue-badge.visible { display: inline-flex; }
.queue-badge:hover { background: hsl(38 92% 50% / 0.16); }
.queue-badge .material-symbols-outlined { font-size: 1.05rem; }
.queue-badge .count {
  margin-left: auto;
  background: hsl(38 92% 50%);
  color: white;
  border-radius: var(--radius-full);
  padding: 0.05rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.queue-badge.syncing { background: hsl(var(--primary) / 0.10); border-color: hsl(var(--primary) / 0.3); color: hsl(var(--primary)); }
.queue-badge.syncing .count { background: hsl(var(--primary)); }

/* Toast — anchored to the top so it doesn't collide with the sticky
   submit/nav bar at the bottom of every screen. */
.toast-stack {
  position: fixed;
  left: 50%;
  top: calc(0.75rem + var(--safe-top));
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9000;
  pointer-events: none;
}
.toast {
  background: hsl(222 47% 11%);
  color: white;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  box-shadow: 0 10px 25px rgb(0 0 0 / 0.35);
  pointer-events: auto;
  animation: toastIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toast.toast-success { background: hsl(142 71% 30%); }
.toast.toast-warn    { background: hsl(38 92% 38%); }
.toast.toast-error   { background: hsl(0 76% 45%); }
.toast .material-symbols-outlined { font-size: 1.15rem; }
.toast.leaving { animation: toastOut 0.22s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-20px) scale(0.96); }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid hsl(var(--primary-foreground) / 0.3);
  border-top-color: hsl(var(--primary-foreground));
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  70%  { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-3px); }
  40%, 80% { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .status-pill.online .dot::after { display: none; }
}

/* =====================================================================
   HISTORY screen
   ===================================================================== */

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0 0 5rem;
  position: relative;
}

.history-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.history-card:active {
  transform: scale(0.985);
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.2);
}

/* Expandable detail — collapsed by default, slides open when .expanded */
.history-detail {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 280ms ease, opacity 200ms ease, margin-top 200ms ease;
}
.history-card.expanded .history-detail {
  max-height: 240px;
  opacity: 1;
  margin-top: 0.5rem;
}
.history-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
  padding: 0.75rem;
  background: hsl(var(--muted) / 0.4);
  border-radius: 10px;
}
.history-detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  font-size: 0.75rem;
  min-width: 0;
}
.history-detail-grid small {
  color: hsl(var(--muted-foreground));
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.history-detail-grid strong {
  color: hsl(var(--foreground));
  font-weight: 600;
  word-break: break-word;
}
.history-chevron {
  margin-left: auto;
  transition: transform 220ms ease;
  color: hsl(var(--muted-foreground));
  opacity: 0.6;
}
.history-card.expanded .history-chevron {
  transform: rotate(180deg);
  color: hsl(var(--primary));
  opacity: 1;
}

/* Skeleton placeholder cards */
.history-skeleton {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.history-skeleton .sk-row1, .history-skeleton .sk-row2 {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.sk-bar, .sk-pill {
  height: 12px;
  background: linear-gradient(90deg, hsl(var(--muted) / 0.5), hsl(var(--muted) / 0.85), hsl(var(--muted) / 0.5));
  background-size: 200% 100%;
  border-radius: 6px;
  animation: skShimmer 1.4s ease-in-out infinite;
}
.sk-pill { width: 56px; height: 18px; border-radius: 999px; flex-shrink: 0; }
.sk-w70 { width: 70%; flex: 1; }
.sk-w30 { width: 30%; }
.sk-w20 { width: 20%; }
.sk-w25 { width: 25%; }
@keyframes skShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Pull-to-refresh indicator */
.pull-indicator {
  position: absolute;
  top: -52px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}
.pull-indicator .material-symbols-outlined {
  font-size: 22px;
  color: hsl(var(--primary));
  transition: transform 200ms ease;
}
.pull-indicator.ready .material-symbols-outlined {
  transform: rotate(180deg);
}
.pull-indicator.refreshing .material-symbols-outlined {
  animation: spin 0.8s linear infinite;
}

/* GPS retry link inside the timer card */
.gps-retry {
  color: hsl(var(--primary));
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* =====================================================================
   Install banner (Android Chrome beforeinstallprompt capture)
   ===================================================================== */
.install-banner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  background: linear-gradient(135deg, hsl(var(--primary) / 0.1), hsl(var(--primary) / 0.02));
  border: 1px solid hsl(var(--primary) / 0.3);
  border-radius: 14px;
  margin-bottom: 0.75rem;
  animation: slideDownIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.install-banner[hidden] { display: none; }
@keyframes slideDownIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.install-icon {
  flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 10px;
  background: hsl(var(--primary));
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.install-icon .material-symbols-outlined { font-size: 1.2rem !important; }
.install-meta { flex: 1; min-width: 0; }
.install-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: hsl(var(--primary));
}
.install-desc {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.35;
}
.install-btn {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  background: hsl(var(--primary));
  color: white;
  font-weight: 700;
  font-size: 0.78rem;
  border: none; cursor: pointer; font-family: inherit;
  min-height: 36px;
}
.install-btn:active { transform: scale(0.97); }
.install-x {
  flex-shrink: 0;
  min-width: 36px; min-height: 36px;
  width: 36px; height: 36px;
  border-radius: 8px;
  background: transparent;
  color: hsl(var(--muted-foreground));
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
}
.install-x .material-symbols-outlined { font-size: 1.05rem; }

/* =====================================================================
   Resume in-progress duty card (purple-themed, gentle pulse)
   ===================================================================== */
.resume-card {
  width: 100%;
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, hsl(262 83% 58% / 0.08), hsl(262 83% 58% / 0.02));
  border: 1px solid hsl(262 83% 58% / 0.3);
  border-radius: 16px;
  margin-bottom: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  position: relative;
  animation: resumePulse 2.4s ease-in-out infinite;
  transition: transform 0.15s ease;
}
.resume-card[hidden] { display: none; }
.resume-card:active { transform: scale(0.99); }
@keyframes resumePulse {
  0%, 100% { box-shadow: 0 0 0 0 hsl(262 83% 58% / 0); }
  50%      { box-shadow: 0 0 0 6px hsl(262 83% 58% / 0.12); }
}
.resume-head { display: flex; align-items: center; gap: 0.625rem; }
.resume-icon {
  flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 11px;
  background: hsl(262 83% 58% / 0.12);
  display: flex; align-items: center; justify-content: center;
  color: hsl(262 83% 58%);
}
.resume-icon .material-symbols-outlined { font-size: 1.25rem !important; animation: timerPulse 2s ease-in-out infinite; }
.resume-text { min-width: 0; flex: 1; }
.resume-sub {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: hsl(262 83% 35%);
}
.resume-title {
  font-size: 0.95rem; font-weight: 700;
  color: hsl(var(--foreground)); margin-top: 0.1rem;
}
.resume-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
  background: hsl(var(--card));
  border-radius: 10px; padding: 0.5rem 0.75rem;
}
.resume-meta > div { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.resume-meta small {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: hsl(var(--muted-foreground));
}
.resume-meta strong {
  font-size: 0.8rem; font-weight: 700; color: hsl(var(--foreground));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.resume-elapsed {
  text-align: center;
  font-size: 1.5rem; font-weight: 700;
  color: hsl(262 83% 50%);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  padding: 0.2rem 0;
}
.resume-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem;
}
.resume-act {
  height: 2.6rem;
  font-size: 0.85rem;
  width: 100%;
}

/* =====================================================================
   History — type chips + filter tabs + per-kind stripe
   ===================================================================== */
.history-filter-row {
  display: flex; gap: 0.4rem;
  margin-bottom: 0.75rem;
  position: sticky; top: 0;
  background: hsl(var(--background) / 0.95);
  backdrop-filter: blur(8px);
  z-index: 5;
  padding: 0.25rem 0;
}
.history-filter-tab {
  padding: 0.4rem 0.875rem;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  min-height: 36px;
  transition: all 0.15s ease;
}
.history-filter-tab.active {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  border-color: hsl(var(--foreground));
}
.history-card.is-special { border-left: 3px solid hsl(262 83% 58%); }
.history-card.is-patrol  { border-left: 3px solid hsl(var(--primary)); }

.type-chip {
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.type-chip.regular {
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}
.type-chip.special {
  background: hsl(262 83% 58% / 0.14);
  color: hsl(262 83% 45%);
}
.type-chip.emergency {
  background: hsl(0 84% 60% / 0.14);
  color: hsl(0 84% 45%);
}

/* =====================================================================
   Sites screen — simple list of route locations
   ===================================================================== */
.sites-list {
  display: flex; flex-direction: column;
  gap: 0.5rem;
  padding: 0 0 5rem;
}
.site-item {
  display: flex; align-items: center; gap: 0.75rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  padding: 0.75rem 0.875rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.site-num {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-weight: 700;
  font-size: 0.85rem;
}
.site-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  word-break: break-word;
}
.site-route {
  flex-shrink: 0;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Failed-photo tile invites tap to retry */
.photo-tile:has(.photo-overlay.error) {
  cursor: pointer;
}
.photo-tile:has(.photo-overlay.error)::after {
  content: "ກົດເພື່ອລອງໃໝ່ · Tap to retry";
  position: absolute;
  inset: auto 0 0 0;
  background: rgba(239, 68, 68, 0.85);
  color: white;
  font-size: 0.62rem;
  font-weight: 600;
  text-align: center;
  padding: 0.18rem 0.25rem;
  letter-spacing: 0.02em;
}

.history-card-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.history-site {
  font-weight: 600;
  font-size: 0.95rem;
  color: hsl(var(--foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.history-status {
  flex-shrink: 0;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.history-status.normal {
  background: hsl(142 71% 45% / 0.12);
  color: hsl(142 71% 32%);
}

.history-status.issue {
  background: hsl(38 92% 50% / 0.15);
  color: hsl(38 92% 35%);
}

.history-card-row2 {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.875rem;
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
}

.history-card-row2 span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.history-card-row2 .material-symbols-outlined {
  font-size: 14px;
  opacity: 0.7;
}

.history-issues {
  font-size: 0.78rem;
  color: hsl(38 92% 35%);
  line-height: 1.4;
  background: hsl(38 92% 50% / 0.08);
  padding: 0.4rem 0.625rem;
  border-radius: 8px;
  border-left: 2px solid hsl(38 92% 50%);
}

.history-empty,
.history-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
  gap: 0.625rem;
}

.history-empty .material-symbols-outlined {
  font-size: 48px;
  color: hsl(var(--primary) / 0.3);
}

.history-empty h3 {
  margin: 0;
  color: hsl(var(--foreground));
  font-size: 1rem;
  font-weight: 600;
}

.history-empty p {
  margin: 0;
  font-size: 0.85rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid hsl(var(--primary) / 0.2);
  border-top-color: hsl(var(--primary));
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =====================================================================
   SPECIAL DUTY screen — duty type cards, timer, risk tiles
   ===================================================================== */

.duty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
}

.duty-card {
  background: hsl(var(--card));
  border: 2px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
  font-family: inherit;
}

.duty-card .material-symbols-outlined {
  font-size: 32px;
  color: hsl(var(--muted-foreground));
  transition: color 0.2s ease;
}

.duty-card strong {
  font-size: 0.88rem;
  color: hsl(var(--foreground));
  font-weight: 600;
}

.duty-card small {
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.02em;
}

.duty-card:active {
  transform: scale(0.96);
}

.duty-card.selected {
  background: hsl(var(--primary) / 0.08);
  border-color: hsl(var(--primary));
}

.duty-card.selected .material-symbols-outlined {
  color: hsl(var(--primary));
}

.duty-card.selected strong {
  color: hsl(var(--primary));
}

.timer-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: linear-gradient(180deg, hsl(var(--primary) / 0.04), hsl(var(--card)));
  border: 1px solid hsl(var(--primary) / 0.18);
  padding: 1rem 1rem 1.25rem;
}

.timer-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0 0.5rem;
  width: 100%;
}

.timer-icon {
  font-size: 36px !important;
  color: hsl(var(--primary));
  margin-bottom: 0.5rem;
  animation: timerPulse 2s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.timer-time {
  font-family: var(--font-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 2.75rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  letter-spacing: 0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px hsl(var(--primary) / 0.18);
}

.timer-label {
  margin-bottom: 0.625rem;
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
}

.timer-meta {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.875rem 0;
  margin-top: 0.5rem;
  border-top: 1px solid hsl(var(--border));
  border-bottom: 1px solid hsl(var(--border));
}

.timer-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

.timer-meta-row .material-symbols-outlined {
  font-size: 18px;
  color: hsl(var(--primary));
}

.timer-meta-row strong {
  color: hsl(var(--foreground));
  font-weight: 600;
}

.timer-hint {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.risk-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.risk-tile {
  position: relative;
  cursor: pointer;
}

.risk-tile input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.risk-tile span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.7rem 0.5rem;
  border: 2px solid hsl(var(--border));
  border-radius: 10px;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  transition: all 0.15s ease;
}
.risk-tile span strong {
  font-weight: 700;
  font-size: 0.88rem;
}
.risk-tile span em {
  font-style: normal;
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}
.risk-tile input:checked + span em {
  color: inherit;
  opacity: 0.85;
}

.risk-tile:nth-child(1) input:checked + span {
  background: hsl(142 71% 45% / 0.12);
  border-color: hsl(142 71% 45%);
  color: hsl(142 71% 32%);
}

.risk-tile:nth-child(2) input:checked + span {
  background: hsl(38 92% 50% / 0.15);
  border-color: hsl(38 92% 50%);
  color: hsl(38 92% 35%);
}

.risk-tile:nth-child(3) input:checked + span {
  background: hsl(0 84% 60% / 0.12);
  border-color: hsl(0 84% 60%);
  color: hsl(0 84% 45%);
}

.rating-num {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-weight: 700;
  color: hsl(var(--primary));
  margin-left: 0.25rem;
}

/* =====================================================================
   SPECIAL DUTY — purple mode scope (legacy parity)
   ===================================================================== */
.special-mode {
  --primary: 262 83% 58%;             /* purple #7C3AED */
  --primary-foreground: 0 0% 100%;
}

/* Emergency reason cards (Step 1) */
.emg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.emg-tile {
  position: relative;
  cursor: pointer;
}
.emg-tile input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.emg-tile span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 0.5rem;
  border: 2px solid hsl(var(--border));
  border-radius: 12px;
  background: hsl(var(--card));
  transition: all 0.15s ease;
}
.emg-tile .emg-emoji {
  font-size: 1.5rem;
  margin-bottom: 0.2rem;
}
.emg-tile strong {
  font-weight: 600;
  font-size: 0.88rem;
  color: hsl(var(--foreground));
}
.emg-tile em {
  font-style: normal;
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.1rem;
}
.emg-tile input:checked + span {
  background: hsl(0 84% 60% / 0.08);
  border-color: hsl(0 84% 60%);
}
.emg-tile input:checked + span strong {
  color: hsl(0 84% 45%);
}

/* Step 2 — Live badge + location card */
.timer-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 0.875rem;
}
.timer-header-text {
  font-size: 1rem;
  font-weight: 700;
  color: hsl(var(--primary));
  line-height: 1.25;
}
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: hsl(0 84% 60% / 0.1);
  border: 1px solid hsl(0 84% 60% / 0.25);
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: hsl(0 84% 50%);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: hsl(0 84% 55%);
  position: relative;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: hsl(0 84% 55%);
  opacity: 0.6;
  animation: liveRing 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes liveRing {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(2.4); opacity: 0; }
}

.loc-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: hsl(var(--muted) / 0.4);
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  padding: 0.75rem 0.875rem;
  width: 100%;
  margin-bottom: 0.875rem;
}
.loc-icon {
  background: hsl(var(--primary) / 0.1);
  padding: 0.5rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loc-icon .material-symbols-outlined {
  color: hsl(var(--primary));
  font-size: 1.4rem !important;
}
.loc-meta {
  flex: 1;
  min-width: 0;
}
.loc-label {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  font-weight: 700;
  margin-bottom: 0.15rem;
}
.loc-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  line-height: 1.3;
  word-break: break-word;
}

/* Onboarding-only "Guard Not Coming?" amber CTA */
.btn-no-show {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  margin-top: 0.875rem;
  background: hsl(38 92% 50% / 0.1);
  border: 1px solid hsl(38 92% 50% / 0.3);
  color: hsl(38 92% 35%);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}
.btn-no-show:hover { background: hsl(38 92% 50% / 0.18); }

/* Guard Not Coming modal — default hidden; only displayed when [hidden] removed */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9500;
}
.modal-backdrop:not([hidden]) {
  display: flex;
  animation: backdropIn 0.2s ease;
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: hsl(var(--card));
  border-radius: 18px;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  animation: modalIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  padding: 1.125rem 1.25rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
}
.modal-head h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}
.modal-head p {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}
.modal-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.modal-foot {
  display: flex;
  gap: 0.625rem;
  padding: 0.75rem 1.25rem 1.125rem;
  border-top: 1px solid hsl(var(--border));
}
.modal-foot .btn { flex: 1; justify-content: center; }

.reason-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem;
  background: hsl(var(--muted) / 0.3);
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.reason-row:hover { background: hsl(var(--muted) / 0.5); }
.reason-row input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: hsl(var(--primary));
}
.reason-row:has(input:checked) {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.06);
}

.btn-warn {
  background: hsl(38 92% 50%);
  color: white;
  border: none;
  padding: 0.625rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-warn:hover { background: hsl(38 92% 45%); }

/* Destructive confirm action */
.btn-danger {
  background: hsl(0 84% 55%);
  color: white;
}
.btn-danger:hover { background: hsl(0 84% 48%); }
.btn-danger:active { background: hsl(0 84% 42%); transform: scale(0.98); }

/* Reusable confirm dialog */
.confirm-card .modal-head {
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
}
.confirm-card .modal-head h3 {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}
.confirm-card .modal-head h3 .material-symbols-outlined {
  font-size: 1.5rem !important;
  color: hsl(0 84% 55%);
  background: hsl(0 84% 55% / 0.1);
  padding: 0.4rem;
  border-radius: 10px;
}
.confirm-card .modal-head p {
  margin: 0;
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}
.confirm-card .modal-foot {
  padding: 0.875rem 1.25rem 1rem;
  border-top: 1px solid hsl(var(--border));
}

/* Step 3 — Metric cards header */
.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}
.metric-card {
  background: hsl(var(--muted) / 0.4);
  border: 1px solid hsl(var(--border));
  border-radius: 16px;
  padding: 0.875rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
}
.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: hsl(var(--primary) / 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.2rem;
}
.metric-icon .material-symbols-outlined {
  color: hsl(var(--primary));
  font-size: 1.15rem !important;
}
.metric-icon.blue {
  background: hsl(217 91% 60% / 0.12);
}
.metric-icon.blue .material-symbols-outlined {
  color: hsl(217 91% 50%);
}
.metric-label {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  font-weight: 700;
}
.metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  word-break: break-word;
}

/* Step 3 — Risk tile icons */
.risk-tile span .risk-icon {
  font-size: 1.25rem !important;
  margin-bottom: 0.15rem;
}
.risk-low span .risk-icon  { color: hsl(142 71% 40%); }
.risk-med span .risk-icon  { color: hsl(38 92% 50%); }
.risk-high span .risk-icon { color: hsl(0 84% 55%); }

/* Step 3 — Big centered rating below slider */
.rating-big {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: hsl(var(--primary));
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
}

/* Step 3 — Dual photo input row + counter */
.photo-dual-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}
.photo-dual-btn {
  width: 100%;
  justify-content: center;
}
.photo-counter {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
}

/* GPS pending / fix / fail badges in the timer card */
.gps-pending {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: hsl(var(--muted-foreground));
}
.gps-dot {
  width: 8px;
  height: 8px;
  background: hsl(var(--primary));
  border-radius: 50%;
  animation: gpsBlink 1.4s ease-in-out infinite;
}
@keyframes gpsBlink {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}
.gps-fix {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.78rem;
  color: hsl(142 71% 32%);
}
.gps-fail {
  color: hsl(0 84% 50%);
  font-style: italic;
}

/* Duty summary banner on Stage 3 */
.duty-summary {
  background: linear-gradient(135deg, hsl(var(--primary) / 0.08), hsl(var(--primary) / 0.02));
  border: 1px solid hsl(var(--primary) / 0.2);
  border-radius: var(--radius-xl);
  padding: 0.875rem 1rem;
  box-shadow: var(--shadow-sm);
}
.duty-summary-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.duty-summary-row > .material-symbols-outlined {
  font-size: 28px !important;
  color: hsl(var(--primary));
  flex-shrink: 0;
}
.duty-summary-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}
.duty-summary-text strong {
  font-size: 0.95rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}
.duty-summary-text small {
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.duty-summary-time {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  padding: 0.35rem 0.625rem;
  border-radius: 999px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-weight: 600;
  font-size: 0.85rem;
  color: hsl(var(--foreground));
  flex-shrink: 0;
}
.duty-summary-time .material-symbols-outlined {
  font-size: 16px;
  color: hsl(var(--primary));
}

/* ============================================================
   ╔═════════════════════════════════════════════════════════╗
   ║  iOS DIRECTION — overrides applied at the END of file   ║
   ║  Cards become inset grouped lists, buttons become iOS   ║
   ║  tinted/filled, modals become sheets w/ grabber,        ║
   ║  resume card becomes a Live Activity capsule.           ║
   ╚═════════════════════════════════════════════════════════╝
   ============================================================ */

/* Reset some legacy shadows / borders for iOS-flat look */
.card,
.form-card,
.history-card,
.metric-card,
.loc-card,
.duty-summary,
.stat-card,
.tile,
.site-item {
  box-shadow: var(--shadow-sm) !important;
  border: 0;
}

/* ─── iOS top bar: large title pattern ─── */
.site-header {
  background: hsl(var(--page-bg) / 0.85);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 0.5px solid var(--hairline);
}
.form-top-bar {
  background: hsl(var(--page-bg) / 0.85);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 0.5px solid var(--hairline);
}

/* ─── iOS rounded icon buttons ─── */
.icon-btn {
  background: transparent !important;
  color: hsl(var(--primary));
}
.icon-btn:hover { background: rgba(0, 122, 255, 0.06) !important; }
.icon-btn:active { background: rgba(0, 122, 255, 0.12) !important; transform: scale(0.94); }
.icon-btn .material-symbols-outlined { font-size: 1.5rem; }

/* ─── iOS BUTTONS ─── */
.btn {
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  height: 50px;
  font-size: 17px;
  transition: opacity 150ms, transform 100ms, background 150ms;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: hsl(var(--primary));
  color: white;
}
.btn-primary:hover { background: hsl(var(--primary)); opacity: 0.92; }

.btn-secondary {
  background: rgba(0, 122, 255, 0.1);
  color: hsl(var(--primary));
  border: 0;
}
.btn-secondary:hover { background: rgba(0, 122, 255, 0.16); }

.btn-outline {
  background: rgba(120, 120, 128, 0.12);
  color: hsl(var(--foreground));
  border: 0;
}
.btn-outline:hover { background: rgba(120, 120, 128, 0.18); }

.btn-destructive,
.btn-danger {
  background: hsl(var(--destructive));
  color: white;
}

.btn-warn {
  background: hsl(var(--ios-orange));
  color: white;
  border: 0;
}

.btn-block {
  width: 100%;
  height: 50px;
  font-size: 17px;
}

/* ─── HOME: mode-cards as iOS inset grouped list ─── */
.action-stack {
  margin: 0;
  background: hsl(var(--card));
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.section-h {
  padding: 16px 20px 6px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.section-h h3 {
  font-size: 13px;
  font-weight: 400;
  color: hsl(var(--ios-label-2));
  letter-spacing: 0.02em;
}
.section-h .section-sub { display: none; }

.mode-card {
  background: transparent !important;
  border: 0;
  border-radius: 0;
  padding: 10px 16px !important;
  min-height: 56px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}
.mode-card + .mode-card::before {
  content: "";
  position: absolute; top: 0; left: 60px; right: 0;
  height: 0.5px; background: var(--hairline);
}
.mode-card:active { background: rgba(0, 0, 0, 0.04) !important; }
.mode-card[aria-disabled="true"] { opacity: 0.5; }

.mode-card .mode-icon-box {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: hsl(var(--primary));
  color: white;
  box-shadow: none;
}
.mode-card.special .mode-icon-box  { background: hsl(var(--ios-purple)); }
.mode-card.history .mode-icon-box  { background: hsl(var(--ios-orange)); }
.mode-card.sites   .mode-icon-box  { background: hsl(var(--ios-green)); }
.mode-card .mode-icon-box .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: 'FILL' 1, 'wght' 500;
  color: white;
}

.mode-card .mode-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.mode-card-title {
  font-size: 16px !important;
  font-weight: 400 !important;
  color: hsl(var(--foreground));
  line-height: 1.3;
  letter-spacing: -0.012em;
}
.mode-card-desc {
  font-size: 13px !important;
  color: hsl(var(--ios-label-2));
  font-weight: 400;
  line-height: 1.3;
}

.mode-chevron {
  flex-shrink: 0;
  color: hsl(var(--ios-label-3));
  display: flex; align-items: center;
}
.mode-chevron .material-symbols-outlined {
  font-size: 18px;
  font-weight: 600;
}

.tag-soon { display: none; }

/* ─── HOME hero greeting card — flat list-style header ─── */
.card-hero {
  background: transparent !important;
  box-shadow: none !important;
  padding: 12px 4px 4px !important;
  margin: 0 !important;
}
.card-hero .greeting-line {
  font-size: 15px;
  color: hsl(var(--ios-label-2));
  margin: 0 0 2px;
  letter-spacing: -0.012em;
}
.card-hero h2 {
  font-size: 28px !important;
  font-weight: 700 !important;
  letter-spacing: -0.022em !important;
  line-height: 1.05;
  margin: 0 0 10px !important;
}
.card-hero .chip-row { gap: 6px; flex-wrap: wrap; }
.card-hero .chip {
  background: hsl(var(--card));
  border: 0;
  box-shadow: 0 0 0 0.5px rgba(60,60,67,0.12);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: hsl(var(--ios-label-2));
}

/* ─── Resume card → Live Activity dark capsule ─── */
.resume-card {
  background: linear-gradient(180deg, #1c1c1e, #1a1a1c) !important;
  color: white !important;
  border: 0 !important;
  border-radius: 22px !important;
  padding: 14px !important;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18), 0 0 0 0.5px rgba(255,255,255,0.06) !important;
  animation: none !important;
}
.resume-card .resume-sub {
  color: rgba(255,255,255,0.55) !important;
  font-size: 11px !important;
  letter-spacing: 0.04em !important;
}
.resume-card .resume-title {
  color: white !important;
  font-size: 16px !important;
  font-weight: 600 !important;
}
.resume-card .resume-icon {
  background: hsl(var(--primary)) !important;
}
.resume-card .resume-icon .material-symbols-outlined {
  color: white !important;
  font-variation-settings: 'FILL' 1, 'wght' 600;
  animation: none !important;
}
.resume-card .resume-meta {
  background: rgba(255,255,255,0.08) !important;
  border: 0 !important;
}
.resume-card .resume-meta small {
  color: rgba(255,255,255,0.48) !important;
}
.resume-card .resume-meta strong {
  color: white !important;
}
.resume-card .resume-elapsed {
  color: white !important;
  font-size: 30px !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em !important;
  font-variant-numeric: tabular-nums;
}
.resume-card .resume-actions {
  gap: 6px !important;
}
.resume-card .resume-act {
  height: 40px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}
.resume-card .btn-secondary {
  background: rgba(255,255,255,0.12) !important;
  color: white !important;
}
.resume-card .btn-primary {
  background: hsl(var(--primary)) !important;
  color: white !important;
}

/* Pulsing live dot in the corner of the live capsule */
.resume-card::before {
  content: "";
  position: absolute;
  top: 14px; right: 14px;
  width: 8px; height: 8px; border-radius: 50%;
  background: hsl(var(--destructive));
  box-shadow: 0 0 10px hsl(var(--destructive));
  animation: ios-pulse 1.4s ease-in-out infinite;
}
@keyframes ios-pulse { 0%,100%{opacity:1}50%{opacity:.4} }

/* ─── Greeting / queue badge as iOS pill ─── */
.queue-badge {
  border-radius: 12px !important;
  background: rgba(255, 149, 0, 0.12) !important;
  color: hsl(var(--ios-orange)) !important;
  border: 0 !important;
}
.queue-badge .material-symbols-outlined { color: hsl(var(--ios-orange)); }

/* ─── Install banner → iOS prompt-style ─── */
.install-banner {
  background: hsl(var(--card)) !important;
  border: 0 !important;
  box-shadow: var(--shadow-md);
  border-radius: 14px !important;
  padding: 12px 14px !important;
}
.install-banner .install-icon {
  background: hsl(var(--primary)) !important;
  border-radius: 9px !important;
}
.install-banner .install-title { color: hsl(var(--foreground)) !important; }
.install-banner .install-desc { color: hsl(var(--ios-label-2)) !important; }
.install-banner .install-btn {
  background: hsl(var(--primary)) !important;
  color: white !important;
}

/* ─── HISTORY filter as iOS segmented control ─── */
.history-filter-row {
  background: rgba(118, 118, 128, 0.12);
  border-radius: 9px;
  padding: 2px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 !important;
  margin: 0 0 14px !important;
  position: sticky;
  top: 8px;
  backdrop-filter: none !important;
}
.history-filter-tab {
  background: transparent !important;
  border: 0 !important;
  border-radius: 7px !important;
  padding: 6px 0 !important;
  min-height: 32px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: hsl(var(--foreground)) !important;
  letter-spacing: -0.01em;
  position: relative;
}
.history-filter-tab.active {
  background: white !important;
  color: hsl(var(--foreground)) !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
}

/* History cards inside list group look */
.history-list { padding: 0 0 5rem; gap: 0.5rem; }
.history-card {
  border-left: 0 !important;
  border-radius: var(--radius) !important;
  padding: 12px 14px !important;
}
.history-card.is-special::before,
.history-card.is-patrol::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.history-card.is-special::before { background: hsl(var(--ios-purple)); }
.history-card.is-patrol::before  { background: hsl(var(--primary)); }
.type-chip {
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  padding: 3px 8px !important;
}
.type-chip.regular {
  background: rgba(0, 122, 255, 0.12) !important;
  color: hsl(var(--primary)) !important;
}
.type-chip.special {
  background: rgba(175, 82, 222, 0.14) !important;
  color: hsl(var(--ios-purple)) !important;
}
.type-chip.emergency {
  background: rgba(255, 59, 48, 0.14) !important;
  color: hsl(var(--destructive)) !important;
}
.history-status {
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
}
.history-status.normal {
  background: rgba(52, 199, 89, 0.14) !important;
  color: hsl(var(--ios-green)) !important;
}
.history-status.issue {
  background: rgba(255, 149, 0, 0.16) !important;
  color: hsl(var(--ios-orange)) !important;
}

/* ─── Sites screen → iOS list ─── */
.site-item {
  background: hsl(var(--card)) !important;
  border: 0 !important;
  border-radius: var(--radius) !important;
  padding: 12px 14px !important;
}
.site-num {
  background: hsl(var(--primary)) !important;
  color: white !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 7px !important;
  font-size: 12px !important;
}
.site-name { font-size: 15px !important; font-weight: 500 !important; }
.site-route {
  background: rgba(60, 60, 67, 0.08) !important;
  color: hsl(var(--ios-label-2)) !important;
  font-weight: 600 !important;
  font-size: 11px !important;
}

/* ─── Modals → iOS sheet style with grabber ─── */
.modal-card {
  border-radius: 14px !important;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(0,0,0,0.06) !important;
}
.modal-head {
  padding: 1rem 1.25rem 0.5rem !important;
  border-bottom: 0 !important;
}
.modal-head h3 {
  font-size: 17px !important;
  font-weight: 700 !important;
  letter-spacing: -0.022em !important;
  color: hsl(var(--foreground)) !important;
}
.modal-head h3 .material-symbols-outlined {
  font-size: 1.6rem !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
}
.modal-head p {
  font-size: 13px !important;
  color: hsl(var(--ios-label-2)) !important;
}
.modal-body {
  padding: 0 1.25rem 1rem !important;
}
.modal-foot {
  padding: 0.625rem 1.25rem 1rem !important;
  border-top: 0.5px solid var(--hairline) !important;
  gap: 0.5rem !important;
}
.modal-foot .btn {
  height: 44px !important;
  font-size: 15px !important;
  border-radius: 12px !important;
}
.confirm-card .modal-head h3 .material-symbols-outlined {
  background: rgba(255,59,48,0.1) !important;
  padding: 0.4rem !important;
  border-radius: 10px !important;
  color: hsl(var(--destructive)) !important;
}
.reason-row {
  background: hsl(var(--page-bg)) !important;
  border: 0 !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}
.reason-row:has(input:checked) {
  background: rgba(0,122,255,0.08) !important;
  border: 0 !important;
}

/* ─── Toast → iOS-style banner notification ─── */
.toast {
  border-radius: 14px !important;
  padding: 10px 14px !important;
  box-shadow: 0 12px 30px rgba(0,0,0,0.2), 0 0 0 0.5px rgba(0,0,0,0.05) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.toast-success { background: rgba(52,199,89,0.95) !important; color: white !important; }
.toast-warn    { background: rgba(255,149,0,0.95) !important; color: white !important; }
.toast-error   { background: rgba(255,59,48,0.95) !important; color: white !important; }
.toast-info    { background: rgba(0,122,255,0.95) !important; color: white !important; }
.toast .material-symbols-outlined { color: white !important; }

/* ─── Stage / form-card polish ─── */
.form-card {
  border-radius: var(--radius) !important;
  padding: 16px !important;
}
.form-card-title {
  font-size: 12px !important;
  letter-spacing: 0.04em !important;
  color: hsl(var(--ios-label-2)) !important;
  margin: 0 0 12px !important;
}
.form-card-title .material-symbols-outlined { color: hsl(var(--primary)) !important; }

/* ─── Inputs → iOS-style ─── */
.input {
  border-radius: 10px !important;
  border: 0 !important;
  background: hsl(var(--page-bg)) !important;
  height: 44px !important;
  font-size: 17px !important;
  padding: 0 14px !important;
}
.input:focus {
  background: white !important;
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.4) !important;
}
textarea.input {
  height: auto !important;
  padding: 12px 14px !important;
  line-height: 1.45;
}

/* ─── Step bottom bars → iOS-blur action bar ─── */
.submit-bar,
.form-bottom-bar {
  background: hsla(var(--page-bg), 0.78) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-top: 0.5px solid var(--hairline) !important;
}
.submit-bar .btn,
.form-bottom-bar .btn { height: 50px !important; font-size: 17px !important; }

/* ─── Special timer card → Live Activity treatment ─── */
.timer-card {
  background: linear-gradient(180deg, #1c1c1e, #1a1a1c) !important;
  border: 0 !important;
  border-radius: 22px !important;
  color: white !important;
  padding: 16px !important;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18), 0 0 0 0.5px rgba(255,255,255,0.06) !important;
}
.timer-card .timer-header-text { color: white !important; }
.timer-card .timer-time {
  color: white !important;
  font-size: 56px !important;
  font-weight: 600 !important;
  letter-spacing: -0.04em !important;
  text-shadow: none !important;
  font-variant-numeric: tabular-nums !important;
}
.timer-card .timer-label {
  color: rgba(255,255,255,0.55) !important;
  font-weight: 400;
  letter-spacing: 0.16em !important;
}
.timer-card .timer-meta-row {
  color: rgba(255,255,255,0.7) !important;
}
.timer-card .timer-meta-row strong { color: white !important; }
.timer-card .timer-meta-row .material-symbols-outlined { color: hsl(var(--primary)) !important; }
.timer-card .timer-meta { border-color: rgba(255,255,255,0.12) !important; }
.timer-card .loc-card {
  background: rgba(255,255,255,0.08) !important;
  border: 0 !important;
}
.timer-card .loc-card .loc-icon { background: rgba(0,122,255,0.2) !important; }
.timer-card .loc-card .loc-icon .material-symbols-outlined { color: hsl(var(--primary)) !important; }
.timer-card .loc-card .loc-label { color: rgba(255,255,255,0.55) !important; }
.timer-card .loc-card .loc-value { color: white !important; }
.timer-card .live-badge {
  background: rgba(255,59,48,0.15) !important;
  border: 0 !important;
  color: #FF6961 !important;
}
.timer-card .timer-hint { color: rgba(255,255,255,0.45) !important; }
.timer-card .gps-pending { color: rgba(255,255,255,0.6) !important; }
.timer-card .gps-fix     { color: hsl(var(--ios-green)) !important; }
.timer-card .gps-fail    { color: #FF6961 !important; }

.btn-no-show {
  background: rgba(255,149,0,0.15) !important;
  border: 0 !important;
  color: hsl(var(--ios-orange)) !important;
}

/* ─── Stage 3 metric cards → iOS stat tiles ─── */
.metric-card {
  background: hsl(var(--card)) !important;
  border: 0 !important;
  padding: 14px !important;
}
.metric-icon { background: rgba(0,122,255,0.12) !important; }
.metric-icon .material-symbols-outlined { color: hsl(var(--primary)) !important; }
.metric-icon.blue { background: rgba(88,86,214,0.12) !important; }
.metric-icon.blue .material-symbols-outlined { color: hsl(var(--ios-indigo)) !important; }
.metric-label {
  letter-spacing: 0.04em !important;
  color: hsl(var(--ios-label-2)) !important;
}
.metric-value {
  font-size: 17px !important;
  font-weight: 600 !important;
  letter-spacing: -0.012em !important;
}

/* ─── Risk tiles → iOS-flavored chips ─── */
.risk-tile span {
  border-radius: 12px !important;
  border: 1.5px solid hsl(var(--border)) !important;
}

/* ─── Slider → iOS slider thumb size + rail ─── */
input[type="range"].slider {
  height: 28px;
}
input[type="range"].slider::-webkit-slider-runnable-track {
  height: 4px;
  background: hsl(var(--border));
  border-radius: 99px;
}
input[type="range"].slider::-webkit-slider-thumb {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: white !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 0.5px rgba(0,0,0,0.06) !important;
  -webkit-appearance: none;
  margin-top: -12px;
}

/* Scope dropdown to iOS look */
.jt-select-trigger {
  border-radius: 10px !important;
  border: 0 !important;
  background: hsl(var(--page-bg)) !important;
  height: 44px !important;
  font-size: 17px !important;
}
.jt-select-trigger.is-open { background: white !important; box-shadow: 0 0 0 2px hsl(var(--primary) / 0.4) !important; }
.jt-select-panel {
  border-radius: 14px !important;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18), 0 0 0 0.5px rgba(0,0,0,0.06) !important;
}

/* Headline name uses Lao font fallback (Noto Sans Lao stays primary) */
.brand-text { letter-spacing: -0.02em; }
.brand-text .accent { color: hsl(var(--primary)); }
.header-logo {
  background: hsl(var(--primary));
  border-radius: 8px;
}

/* Login screen → cleaner */
.login-card-wrap { box-shadow: var(--shadow-md); border-radius: var(--radius-lg); }

/* Bottom sheet → iOS sheet */
.sheet { border-radius: 14px 14px 0 0 !important; }
.sheet-handle {
  width: 36px !important;
  height: 5px !important;
  background: rgba(60,60,67,0.3) !important;
  border-radius: 999px !important;
}
.sheet-row {
  min-height: 44px;
  padding: 10px 16px !important;
  font-size: 15px !important;
}
.sheet-row .icn { color: hsl(var(--primary)); }
.sheet-row.danger,
.btn-signout {
  color: hsl(var(--destructive)) !important;
}

/* Section labels in sheet → iOS settings style */
.sheet-section-label {
  font-size: 13px !important;
  font-weight: 400 !important;
  letter-spacing: 0.02em !important;
  text-transform: uppercase !important;
  color: hsl(var(--ios-label-2)) !important;
  padding: 10px 16px 4px !important;
}

/* Step progress bar → iOS-style dots / minimal */
.step-progress-title {
  font-size: 16px !important;
  font-weight: 600 !important;
  letter-spacing: -0.012em !important;
}
.step-progress-num {
  font-size: 13px !important;
  color: hsl(var(--ios-label-2)) !important;
  font-weight: 400 !important;
  font-variant-numeric: tabular-nums;
}
.step-bar {
  height: 3px !important;
  background: hsl(var(--ios-gray-2)) !important;
  border-radius: 99px;
}
.step-bar-fill {
  background: hsl(var(--primary)) !important;
  border-radius: 99px;
}

/* Material icons inside iOS list rows: smaller + system color */
.ios-list .material-symbols-outlined { font-size: 22px; }

/* ============================================================
   ╔═════════════════════════════════════════════════════════╗
   ║  NATIVE-FEEL PASS — make it look like an iOS app, not   ║
   ║  a styled webpage: bottom tab bar, large titles, no     ║
   ║  brand chrome, no dashboard accents, edge-to-edge.      ║
   ╚═════════════════════════════════════════════════════════╝
   ============================================================ */

/* App shell holds bottom tab bar room; remove desktop frame look */
.app-shell {
  max-width: 100% !important;
  background: hsl(var(--background));
}

/* ─── Kill the dashboard "border-left primary stripe" on cards ─── */
.card,
.form-card,
.history-card,
.metric-card,
.duty-summary {
  border-left: 0 !important;
}

/* ─── HOME: replace website-style header with iOS large title ─── */
#screen-home .site-header {
  background: transparent !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  border-bottom: 0 !important;
  padding: calc(8px + var(--safe-top)) 16px 0 !important;
}
#screen-home .header-container {
  justify-content: flex-end !important;
}
/* Hide the brand block on home — apps don't repeat their name in their nav */
#screen-home .brand-block { display: none !important; }
#screen-home .icon-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  background: hsl(var(--ios-gray-2)) !important;
  color: hsl(var(--ios-label-1)) !important;
  border-radius: 999px !important;
}
#screen-home #netStatus { display: none !important; }

/* iOS-style large title — replaces hero greeting card */
#screen-home .home-main {
  padding: 0 !important;
  padding-bottom: calc(96px + var(--safe-bottom)) !important;
}
#screen-home .card-hero {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 4px 16px 8px !important;
  margin: 0 !important;
}
#screen-home .card-hero .greeting-line {
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  color: hsl(var(--ios-label-2)) !important;
  margin: 0 0 2px 0 !important;
  text-transform: none !important;
}
#screen-home #profileName {
  font-size: 34px !important;
  font-weight: 700 !important;
  letter-spacing: -0.022em !important;
  line-height: 1.1 !important;
  margin: 0 0 12px 0 !important;
  color: hsl(var(--ios-label-1)) !important;
}
#screen-home .card-hero .chip-row {
  gap: 6px !important;
  margin-top: 2px !important;
}
#screen-home .card-hero .chip {
  background: hsl(var(--ios-gray-2)) !important;
  border: 0 !important;
  color: hsl(var(--ios-label-1)) !important;
  font-size: 12px !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  font-weight: 500 !important;
}
#screen-home .card-hero .chip .material-symbols-outlined {
  font-size: 14px !important;
  color: hsl(var(--ios-label-2)) !important;
}
#screen-home .card-hero .chip-id {
  background: hsl(var(--primary) / 0.12) !important;
  color: hsl(var(--primary)) !important;
}
#screen-home .card-hero .chip-id .material-symbols-outlined {
  color: hsl(var(--primary)) !important;
}

/* Section heading on home: iOS uppercase "settings" style, edge-aligned */
#screen-home .section-h {
  padding: 24px 32px 6px !important;
  margin: 0 !important;
}
#screen-home .section-h h3 {
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: hsl(var(--ios-label-2)) !important;
  margin: 0 !important;
}
#screen-home .section-sub { display: none !important; }

/* Primary actions: two big hero tiles. Patrol and Special Duty are what an
   inspector opens the app for; History and Sites live in the tab bar. */
#screen-home .action-stack {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 12px !important;
  margin: 0 16px !important;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
}
/* Secondary actions: compact full-width list rows below the hero tiles.
   History + Sites are still visible on home (faster than tab bar for a glance),
   just visually de-emphasized — single line, smaller icons, hairline card. */
#screen-home .mode-card.history,
#screen-home .mode-card.sites {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns: 32px 1fr 18px !important;
  grid-template-rows: auto !important;
  align-items: center !important;
  justify-items: stretch !important;
  gap: 12px !important;
  padding: 12px 14px !important;
  min-height: 56px !important;
  background: hsl(var(--card)) !important;
  border-radius: 14px !important;
  box-shadow: 0 0 0 0.5px var(--hairline) !important;
  text-align: left !important;
  transition: transform 100ms cubic-bezier(.4,0,.2,1) !important;
}
/* Tighten the visual gap between the two secondary rows so they read as a pair */
#screen-home .mode-card.sites {
  margin-top: -4px !important;
}
#screen-home .mode-card.history:active,
#screen-home .mode-card.sites:active {
  transform: scale(0.985) !important;
  background: hsl(var(--ios-gray-2)) !important;
}
#screen-home .mode-card.history .mode-icon-box,
#screen-home .mode-card.sites .mode-icon-box {
  width: 32px !important;
  height: 32px !important;
  border-radius: 8px !important;
  margin: 0 !important;
  align-self: center !important;
  background: hsl(var(--ios-orange)) !important;
}
#screen-home .mode-card.sites .mode-icon-box {
  background: hsl(var(--ios-green)) !important;
}
#screen-home .mode-card.history .mode-icon-box .material-symbols-outlined,
#screen-home .mode-card.sites .mode-icon-box .material-symbols-outlined {
  font-size: 18px !important;
}
#screen-home .mode-card.history .mode-card-title,
#screen-home .mode-card.sites .mode-card-title {
  font-size: 15px !important;
  font-weight: 500 !important;
  align-self: center !important;
  letter-spacing: -0.005em !important;
}
#screen-home .mode-card.history .mode-card-desc,
#screen-home .mode-card.sites .mode-card-desc {
  display: none !important;
}
#screen-home .mode-card.history .mode-chevron,
#screen-home .mode-card.sites .mode-chevron {
  display: grid !important;
  place-items: center !important;
  color: hsl(var(--ios-label-3)) !important;
  align-self: center !important;
}
#screen-home .mode-card.history .mode-chevron .material-symbols-outlined,
#screen-home .mode-card.sites .mode-chevron .material-symbols-outlined {
  font-size: 18px !important;
  font-weight: 600 !important;
  color: hsl(var(--ios-label-3)) !important;
}
#screen-home .mode-card {
  background: hsl(var(--card)) !important;
  border: 0 !important;
  border-radius: 22px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 0 0 0.5px var(--hairline) !important;
  padding: 16px 16px 18px !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  grid-template-rows: auto 1fr auto !important;
  align-items: stretch !important;
  justify-items: start !important;
  gap: 0 !important;
  position: relative !important;
  width: 100% !important;
  min-height: 148px !important;
  text-align: left !important;
  transition: transform 120ms cubic-bezier(.4,0,.2,1), box-shadow 120ms !important;
  overflow: hidden !important;
}
#screen-home .mode-card::before {
  content: none !important;
}
#screen-home .mode-card:active {
  transform: scale(0.97) !important;
  background: hsl(var(--card)) !important;
}
#screen-home .mode-icon-box {
  width: 44px !important;
  height: 44px !important;
  border-radius: 12px !important;
  display: grid !important;
  place-items: center !important;
  color: white !important;
  box-shadow: none !important;
  margin-bottom: 14px !important;
  align-self: start !important;
}
#screen-home .mode-icon-box .material-symbols-outlined {
  font-size: 26px !important;
  color: white !important;
  font-variation-settings: 'FILL' 1, 'wght' 500 !important;
}
#screen-home .mode-card.patrol .mode-icon-box {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(211 100% 42%)) !important;
}
#screen-home .mode-card.special .mode-icon-box {
  background: linear-gradient(135deg, hsl(var(--ios-purple)), hsl(285 67% 50%)) !important;
}
#screen-home .mode-card-title {
  font-size: 17px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  color: hsl(var(--ios-label-1)) !important;
  margin: 0 !important;
  line-height: 1.2 !important;
  align-self: end !important;
}
#screen-home .mode-card-desc {
  display: block !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  color: hsl(var(--ios-label-2)) !important;
  margin: 4px 0 0 !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
}
/* Hide chevron on hero tiles — the whole card is the affordance */
#screen-home .mode-chevron {
  display: none !important;
}
/* Section heading above the hero tiles is redundant — the tiles speak for themselves */
#screen-home .section-h { display: none !important; }

/* ============================================================
   STEP 2 — Equipment: HEAD-style section-per-item layout.
   Each item gets its own section with header + accent line and
   two big full-width radio cards (ຄົບຖ້ວນ / ບໍ່ຄົບຖ້ວນ).
   ============================================================ */

/* Strip the wrapper card chrome and use a small uppercase section title */
.stage[data-step="2"] > .form-card {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  border: 0 !important;
}
.stage[data-step="2"] > .form-card > .form-card-title {
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: hsl(var(--ios-label-2)) !important;
  padding: 0 16px 12px !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.stage[data-step="2"] > .form-card > .form-card-title .material-symbols-outlined {
  font-size: 14px !important;
  color: hsl(var(--ios-label-2)) !important;
}

/* equip-grid → vertical stack of sections (no longer a 2x2 grid) */
.stage[data-step="2"] .equip-grid {
  display: flex !important;
  flex-direction: column !important;
  gap: 18px !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
  padding: 0 !important;
}

/* Each cell becomes its own section block */
.stage[data-step="2"] .equip-cell {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding: 0 !important;
  min-height: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  position: static !important;
}
.stage[data-step="2"] .equip-cell::before {
  display: none !important;
  content: none !important;
}

/* Section header: icon + bilingual label + horizontal accent line */
.stage[data-step="2"] .equip-cell .equip-label {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: hsl(var(--ios-label-1)) !important;
  letter-spacing: -0.005em !important;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  width: 100% !important;
}
.stage[data-step="2"] .equip-cell .equip-label .material-symbols-outlined {
  width: auto !important;
  height: auto !important;
  background: transparent !important;
  border-radius: 0 !important;
  font-size: 16px !important;
  color: hsl(var(--primary)) !important;
}
/* Inline the bilingual label (Lao · English) — drop the <br> */
.stage[data-step="2"] .equip-cell .equip-label > span:last-child br {
  display: none !important;
}
.stage[data-step="2"] .equip-cell .equip-label > span:last-child {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: baseline !important;
  gap: 6px !important;
  white-space: normal !important;
}
.stage[data-step="2"] .equip-cell .equip-label > span:last-child::after {
  display: none;
}
/* Trailing accent hairline after the label */
.stage[data-step="2"] .equip-cell .equip-label::after {
  content: "" !important;
  flex: 1 !important;
  height: 1px !important;
  background: var(--hairline) !important;
  margin-left: 4px !important;
}

/* Two big full-width radio cards per item */
.stage[data-step="2"] .equip-cell .equip-toggle {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  margin-top: 0 !important;
}
.stage[data-step="2"] .equip-cell label.radio-tile {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 14px 10px !important;
  min-height: 56px !important;
  min-width: 0 !important;
  background: hsl(var(--card)) !important;
  border: 1.5px solid hsl(var(--ios-gray-2)) !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: hsl(var(--ios-label-1)) !important;
  letter-spacing: -0.005em !important;
  box-shadow: none !important;
  transition: all 120ms !important;
}
.stage[data-step="2"] .equip-cell label.radio-tile:active {
  transform: scale(0.985) !important;
}
.stage[data-step="2"] .equip-cell label.radio-tile.yes:has(input:checked) {
  background: hsl(142 71% 45% / 0.10) !important;
  border-color: hsl(142 71% 45%) !important;
  color: hsl(142 71% 28%) !important;
  box-shadow: none !important;
}
.stage[data-step="2"] .equip-cell label.radio-tile.no:has(input:checked) {
  background: hsl(var(--destructive) / 0.10) !important;
  border-color: hsl(var(--destructive)) !important;
  color: hsl(var(--destructive)) !important;
  box-shadow: none !important;
}

/* ============================================================
   STEP 7 — Confirm: iOS Review screen with banner + grouped sections
   ============================================================ */
/* Hide the legacy summary-card chrome — we render our own structure now */
.stage[data-step="7"] .summary-card {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.stage[data-step="7"] .summary-card > h4 {
  display: none !important;
}

/* Top status banner */
.rsum-banner {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  margin: 0 0 18px;
  border: 0;
}
.rsum-banner .material-symbols-outlined {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-variation-settings: 'FILL' 1, 'wght' 500;
  color: white;
}
.rsum-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rsum-banner-text strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: hsl(var(--ios-label-1));
  line-height: 1.2;
}
.rsum-banner-text small {
  font-size: 12px;
  font-weight: 400;
  color: hsl(var(--ios-label-2));
  line-height: 1.3;
}
.rsum-banner.is-normal {
  background: hsl(142 71% 45% / 0.10);
}
.rsum-banner.is-normal .material-symbols-outlined {
  background: linear-gradient(135deg, hsl(142 71% 45%), hsl(142 71% 38%));
}
.rsum-banner.is-issue {
  background: hsl(35 100% 50% / 0.12);
}
.rsum-banner.is-issue .material-symbols-outlined {
  background: linear-gradient(135deg, hsl(35 100% 50%), hsl(35 100% 42%));
}

/* Grouped sections */
.rsum-section { margin-bottom: 22px; }
.rsum-section:last-child { margin-bottom: 8px; }

.rsum-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 6px;
}
.rsum-section-head .material-symbols-outlined {
  font-size: 14px;
  color: hsl(var(--ios-label-2));
  font-variation-settings: 'FILL' 1, 'wght' 500;
}
.rsum-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: hsl(var(--ios-label-2));
}
.rsum-section-sub {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: hsl(var(--ios-label-3));
  margin-left: auto;
}

.rsum-list {
  background: hsl(var(--card));
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 0.5px var(--hairline);
}
.rsum-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  position: relative;
  min-height: 52px;
}
.rsum-row + .rsum-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 0;
  height: 0.5px;
  background: var(--hairline);
}
.rsum-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.rsum-lao {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: hsl(var(--ios-label-1));
  line-height: 1.25;
}
.rsum-en {
  font-size: 11px;
  font-weight: 400;
  color: hsl(var(--ios-label-3));
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.rsum-val {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}
.rsum-val.rsum-plain   { color: hsl(var(--ios-label-1)); }
.rsum-val.rsum-ok      { color: hsl(142 71% 35%); }
.rsum-val.rsum-danger  { color: hsl(var(--destructive)); }
.rsum-val.rsum-warn    { color: hsl(35 100% 42%); }
.rsum-val.rsum-missing { color: hsl(var(--ios-label-3)); font-style: italic; }

/* ============================================================
   STEP 2 — Reveal panels (Missing Uniform / Missing Defense)
   The reveal lives INSIDE its own .equip-cell now, so the chips
   appear directly under the radio cards they belong to.
   ============================================================ */
.stage[data-step="2"] .equip-cell .reveal {
  margin-top: 0 !important;
}
.stage[data-step="2"] .reveal .form-card {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-top: 4px !important;
}
/* Section label above the pills — small uppercase, system red, flush-left
   with the radio cards above it */
.stage[data-step="2"] .reveal .form-card-title {
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: hsl(var(--destructive)) !important;
  padding: 0 0 8px !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.stage[data-step="2"] .reveal .form-card-title .material-symbols-outlined {
  font-size: 14px !important;
  color: hsl(var(--destructive)) !important;
  display: inline-grid !important;
  width: auto !important;
  height: auto !important;
  background: transparent !important;
  border-radius: 0 !important;
}

/* Wrap-flex of chip pills — no fixed grid, no orphans, flush-left */
.stage[data-step="2"] .checkbox-grid {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  grid-template-columns: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* ============================================================
   SITES — make rows tappable + chevron, open Site Detail on tap
   ============================================================ */
.site-item {
  display: grid !important;
  grid-template-columns: 32px 1fr auto 18px !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 14px !important;
  background: hsl(var(--card)) !important;
  border: 0 !important;
  border-radius: 0 !important;
  width: 100% !important;
  text-align: left !important;
  position: relative !important;
  min-height: 56px !important;
  font-family: inherit !important;
  color: inherit !important;
  cursor: pointer !important;
  transition: background 100ms !important;
}
/* Route tag pill — A is iOS blue, B is iOS purple, AB is teal */
.site-route-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.site-route-a {
  background: hsl(var(--primary) / 0.14);
  color: hsl(var(--primary));
}
.site-route-b {
  background: hsl(var(--ios-purple) / 0.14);
  color: hsl(var(--ios-purple));
}
.site-route-ab {
  background: hsl(174 72% 38% / 0.14);
  color: hsl(174 72% 30%);
}
.site-item + .site-item::before {
  content: "";
  position: absolute;
  top: 0; left: 60px; right: 0;
  height: 0.5px;
  background: var(--hairline);
}
.site-item:active { background: hsl(var(--ios-gray-2)) !important; }
.site-item .site-num {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.site-item .site-name {
  font-size: 15px;
  font-weight: 500;
  color: hsl(var(--ios-label-1));
  letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-item .site-chev {
  font-size: 18px;
  color: hsl(var(--ios-label-3));
}
/* Wrap consecutive site-items in a single inset card visually */
.sites-list {
  background: hsl(var(--card));
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 0.5px var(--hairline);
}

/* ============================================================
   SITE DETAIL — hero, map preview, contacts, SOP
   ============================================================ */
.site-hero {
  background: linear-gradient(160deg, #1c1c1e, #2c2c2e);
  color: #fff;
  margin: 0 0 14px;
  padding: 22px 18px 20px;
  border-radius: 22px;
}
.site-hero-pos {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.site-hero-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
  margin: 0;
}
.site-hero-addr {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  margin: 6px 0 0;
  line-height: 1.35;
}

/* Map preview tile + Directions CTA */
.site-map-tile {
  height: 200px;
  margin: 0 0 14px;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 0.5px var(--hairline);
  background: #e6ecf2;
}
.site-map-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  z-index: 1;
}
/* Fallback only shows when JS toggles it on (e.g. iframe blocked / offline) */
.site-map-fallback {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(60,60,67,0.04) 14px 28px),
    linear-gradient(180deg, #d6e4f0, #c6d4e6);
  display: none;
  z-index: 0;
}
.site-map-tile.no-iframe .site-map-fallback { display: block; z-index: 1; }
.site-map-tile.no-iframe .site-map-frame { display: none; }
.site-map-pin {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -100%);
  color: hsl(var(--destructive));
  font-size: 36px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
  font-variation-settings: 'FILL' 1, 'wght' 500;
}
.site-map-coords {
  position: absolute;
  bottom: 12px; left: 14px;
  background: rgba(28,28,30,0.85);
  color: #fff;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 11px;
  letter-spacing: -0.005em;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  max-width: calc(100% - 28px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-map-cta {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  background: rgba(255,255,255,0.96);
  color: hsl(var(--primary));
  padding: 8px 14px 8px 12px;
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.04);
  transition: transform 100ms;
}
.site-map-cta:active { transform: scale(0.96); }
.site-map-cta .material-symbols-outlined { font-size: 16px; }

/* Section labels above each card on detail */
#screen-site-detail .ios-section-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: hsl(var(--ios-label-2));
  margin: 18px 16px 6px;
}
/* Inset cards (contacts, SOP) */
#screen-site-detail .ios-card {
  background: hsl(var(--card));
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 0.5px var(--hairline);
  margin: 0 0 12px;
}
#screen-site-detail .ios-card .ios-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  position: relative;
  min-height: 56px;
}
#screen-site-detail .ios-card .ios-row + .ios-row::before {
  content: "";
  position: absolute;
  top: 0; left: 58px; right: 0;
  height: 0.5px;
  background: var(--hairline);
}
#screen-site-detail .ios-card .ios-row .icn {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  font-size: 16px;
}
#screen-site-detail .ios-card .ios-row .icn.gray {
  background: hsl(var(--ios-gray-2));
  color: hsl(var(--ios-label-3));
}
#screen-site-detail .ios-card .ios-row .lbl {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
#screen-site-detail .ios-card .ios-row .lbl .top {
  font-size: 14px;
  font-weight: 500;
  color: hsl(var(--ios-label-1));
  letter-spacing: -0.005em;
}
#screen-site-detail .ios-card .ios-row .lbl .bot {
  font-size: 11px;
  color: hsl(var(--ios-label-3));
  letter-spacing: 0.005em;
}
/* Empty-state rows look softer */
#screen-site-detail .ios-card .ios-row[data-empty="1"] .lbl .top {
  color: hsl(var(--ios-label-2));
  font-weight: 400;
}

/* SOP row — clickable button that opens the SOP modal */
#screen-site-detail .sop-row {
  width: 100% !important;
  background: transparent !important;
  border: 0 !important;
  text-align: left !important;
  cursor: pointer !important;
  font-family: inherit !important;
  color: inherit !important;
  display: grid !important;
  grid-template-columns: 32px 1fr auto !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 14px !important;
  min-height: 56px !important;
  transition: background 100ms !important;
}
#screen-site-detail .sop-row:active { background: hsl(var(--ios-gray-2)) !important; }
#screen-site-detail .sop-row .bot {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#screen-site-detail .sop-chev {
  font-size: 18px;
  color: hsl(var(--ios-label-3));
}

/* SOP modal — full-text reader */
.sop-modal {
  max-width: 90vw;
  width: 480px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
}
.sop-modal-site {
  font-size: 12px;
  color: hsl(var(--ios-label-2));
  margin: 4px 0 0;
  letter-spacing: 0;
  font-family: inherit;
  font-weight: 400;
}
.sop-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
  -webkit-overflow-scrolling: touch;
}
.sop-text {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
  color: hsl(var(--ios-label-1));
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  padding: 8px 0 16px;
}

/* Tap-to-call icon button on contact rows */
#screen-site-detail .contact-call {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: hsl(var(--primary) / 0.10);
  color: hsl(var(--primary));
  display: grid; place-items: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: transform 100ms;
}
#screen-site-detail .contact-call:active {
  transform: scale(0.92);
  background: hsl(var(--primary) / 0.18);
}
#screen-site-detail .contact-call .material-symbols-outlined { font-size: 18px; }

/* Icon tones used by contact rows */
#screen-site-detail .ios-card .ios-row .icn.green {
  background: hsl(var(--ios-green) / 0.12);
  color: hsl(var(--ios-green));
}
#screen-site-detail .ios-card .ios-row .icn.blue {
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
}
#screen-site-detail .ios-card .ios-row .icn.orange {
  background: hsl(var(--ios-orange) / 0.12);
  color: hsl(var(--ios-orange));
}

/* Hide the existing site-route badge on detail screen — using hero instead */
#screen-site-detail main { padding-bottom: calc(96px + var(--safe-bottom)); }

/* ============================================================
   LANGUAGE PICKER — segmented control in the settings sheet
   ============================================================ */
.lang-seg {
  display: inline-flex;
  background: rgba(60,60,67,0.10);
  padding: 2px;
  border-radius: 8px;
  gap: 2px;
}
.lang-seg .lang-opt {
  padding: 6px 12px;
  min-height: 30px;
  font-size: 12px;
  font-weight: 500;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: hsl(var(--ios-label-2));
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.lang-seg .lang-opt.is-active {
  background: white;
  color: hsl(var(--primary));
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04);
}
.sheet-row-static {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
}
.sheet-row-static .icn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: hsl(var(--ios-gray-2));
  display: grid; place-items: center;
  color: hsl(var(--primary));
}
.sheet-row-static .lbl {
  display: flex; flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.sheet-row-static .lbl > span:first-child {
  font-size: 14px; font-weight: 500;
  color: hsl(var(--ios-label-1));
}
.sheet-row-static .lbl-sub {
  font-size: 11px;
  color: hsl(var(--ios-label-3));
}

.stage[data-step="2"] .checkbox-tile {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 8px 14px !important;
  min-height: 36px !important;
  border-radius: 999px !important;
  border: 0 !important;
  background: hsl(var(--ios-gray-2)) !important;
  color: hsl(var(--ios-label-1)) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: -0.005em !important;
  transition: background 120ms, color 120ms, transform 100ms !important;
  cursor: pointer !important;
  user-select: none !important;
  white-space: nowrap !important;
}
.stage[data-step="2"] .checkbox-tile:active {
  transform: scale(0.96) !important;
}
.stage[data-step="2"] .checkbox-tile:has(input:checked) {
  background: hsl(var(--destructive)) !important;
  color: white !important;
  border: 0 !important;
}
.stage[data-step="2"] .checkbox-tile .emoji {
  font-size: 14px !important;
  line-height: 1 !important;
  flex: none !important;
}

/* Resume / install / queue badge: inset, no full-width edge */
#screen-home .queue-badge,
#screen-home .install-banner,
#screen-home .resume-card {
  margin-left: 16px !important;
  margin-right: 16px !important;
}

/* ─── BOTTOM TAB BAR ─── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: hsl(var(--page-bg) / 0.82);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border-top: 0.5px solid var(--hairline);
  padding: 6px 0 calc(6px + var(--safe-bottom));
  z-index: 90;
}
.tab-bar[hidden] { display: none; }
.tab-item {
  background: transparent;
  border: 0;
  display: grid;
  place-items: center;
  gap: 1px;
  padding: 4px 0 2px;
  color: hsl(var(--ios-label-3));
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 100ms;
}
.tab-item .material-symbols-outlined {
  font-size: 26px;
  font-variation-settings: 'FILL' 0, 'wght' 400;
  transition: font-variation-settings 120ms, transform 120ms;
}
.tab-item .tab-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.tab-item.is-active {
  color: hsl(var(--primary));
}
.tab-item.is-active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 500;
  transform: scale(1.04);
}
.tab-item:active {
  transform: scale(0.92);
}

/* History / Sites screens: pad bottom for tab bar */
#screen-history .history-main,
#screen-sites main {
  padding-bottom: calc(96px + var(--safe-bottom)) !important;
}

/* History + Sites: also strip the brand-block on their headers */
#screen-history .brand-block,
#screen-sites .brand-block {
  display: none !important;
}
#screen-history .site-header,
#screen-sites .site-header {
  padding: calc(8px + var(--safe-top)) 16px 0 !important;
  background: transparent !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  border-bottom: 0 !important;
}
#screen-history .header-container,
#screen-sites .header-container {
  justify-content: space-between !important;
}
/* Inject a screen title via the netStatus slot — actually use a pseudo-element */
#screen-history .header-container::before {
  content: "ປະຫວັດ";
  font-size: 17px;
  font-weight: 600;
  color: hsl(var(--ios-label-1));
  letter-spacing: -0.01em;
}
#screen-sites .header-container::before {
  content: "ສະຖານທີ່";
  font-size: 17px;
  font-weight: 600;
  color: hsl(var(--ios-label-1));
  letter-spacing: -0.01em;
}
#screen-history #netStatus,
#screen-sites #netStatus {
  display: none !important;
}

/* Form + Special screens: hide tab bar (they have their own back chevron) */
#screen-patrol-form ~ .tab-bar,
#screen-special ~ .tab-bar {
  display: none !important;
}

/* Login screen: also strip dashboard look — full-bleed */
#screen-login {
  background: hsl(var(--background));
}
#screen-login .card.login-card-wrap {
  border-left: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

