/* ============================================================
   POI Assistant PWA — Design System v28
   Operational Light · OKLCH tokens · Mirrors POI Tracker Admin
   Plus Jakarta Sans + JetBrains Mono · Inline SVG icons only
   (All legacy class names preserved — light re-skin)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Admin OKLCH palette */
  --canvas:        oklch(98.5% 0.003 250);
  --surface:       #FFFFFF;
  --surface-2:     oklch(98% 0.005 250);
  --surface-3:     oklch(96% 0.006 250);
  --ink:           oklch(20% 0.02 258);
  --ink-2:         oklch(36% 0.02 258);
  --ink-3:         oklch(50% 0.015 258);
  --ink-4:         oklch(64% 0.012 258);
  --accent:        oklch(54% 0.17 258);
  --accent-hover:  oklch(48% 0.18 258);
  --accent-soft:   oklch(96% 0.025 258);
  --accent-soft-2: oklch(92% 0.04 258);
  --accent-ink:    oklch(38% 0.16 258);
  --pos:           oklch(56% 0.13 152);
  --pos-soft:      oklch(96% 0.04 152);
  --pos-ink:       oklch(38% 0.12 152);
  --warn:          oklch(66% 0.14 70);
  --warn-soft:     oklch(96% 0.05 75);
  --warn-ink:      oklch(46% 0.13 60);
  --neg:           oklch(58% 0.16 27);
  --neg-soft:      oklch(96% 0.04 27);
  --neg-ink:       oklch(42% 0.15 25);
  --info:          oklch(58% 0.13 232);
  --info-soft:     oklch(96% 0.03 232);
  --info-ink:      oklch(42% 0.13 232);
  --purple:        oklch(56% 0.16 300);
  --purple-soft:   oklch(96% 0.03 300);
  --purple-ink:    oklch(42% 0.15 300);
  --side:          oklch(22% 0.015 260);

  /* Brand (legacy aliases → light palette) */
  --primary:        var(--accent);
  --primary-dim:    var(--accent-hover);
  --primary-glow:   var(--accent-soft-2);
  --primary-subtle: var(--accent-soft);

  /* Background layers (legacy → light) */
  --bg-base:        var(--canvas);
  --bg-surface:     var(--surface);
  --bg-card:        var(--surface);
  --bg-elevated:    var(--surface-3);
  --bg-input:       var(--surface);

  /* Borders */
  --border:         oklch(91% 0.008 250);
  --border-strong:  oklch(85% 0.01 250);
  --border-focus:   var(--accent);

  /* Text */
  --text:           var(--ink);
  --text-secondary: var(--ink-2);
  --text-tertiary:  var(--ink-3);
  --text-inverse:   #FFFFFF;

  /* Status colors (legacy names → admin hues) */
  --green:          var(--pos);
  --green-dim:      var(--pos-soft);
  --yellow:         var(--warn);
  --yellow-dim:     var(--warn-soft);
  --red:            var(--neg);
  --red-dim:        var(--neg-soft);
  --orange:         var(--warn);
  --orange-dim:     var(--warn-soft);
  --cyan:           var(--info);
  --cyan-dim:       var(--info-soft);

  /* Layout */
  --bottom-nav-h:   64px;
  --header-h:       56px;
  --safe-bottom:    env(safe-area-inset-bottom, 0px);
  --safe-top:       env(safe-area-inset-top, 0px);

  /* Radius */
  --radius-xs:  6px;
  --radius-sm:  10px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-full: 9999px;

  /* Shadows — soft, light-theme */
  --shadow-sm:  0 1px 2px rgba(20,30,50,.05), 0 1px 0 rgba(20,30,50,.03);
  --shadow-md:  0 6px 18px -8px rgba(20,30,50,.16), 0 1px 2px rgba(20,30,50,.04);
  --shadow-lg:  0 18px 46px -20px rgba(20,30,50,.28), 0 3px 8px rgba(20,30,50,.07);
  --shadow-primary: 0 10px 22px -8px oklch(54% 0.17 258 / .45);

  /* Typography */
  --font:       'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Transitions */
  --transition: 0.16s ease;
  --transition-slow: 0.28s ease;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
  background: var(--canvas);
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  min-height: 100%;
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: var(--font); }
img { max-width: 100%; display: block; }
.icon-svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.125em;
}

/* ── App Shell ──────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
  background: linear-gradient(180deg, var(--canvas), oklch(96.8% 0.007 250));
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  padding-top: var(--safe-top);
  background: color-mix(in oklch, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-left: 16px;
  padding-right: 16px;
  gap: 12px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.app-header .header-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  flex: 1;
}

.app-header .header-subtitle {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
}

.header-back,
.header-action {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.header-back:active, .header-action:active { background: var(--surface-2); transform: scale(.95); }

/* ── Bottom Navigation (legacy shell) ───────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in oklch, var(--surface) 92%, transparent);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink-3);
  transition: color var(--transition);
  position: relative;
  padding: 8px 4px;
  font-weight: 700;
}

.nav-item.active { color: var(--accent-ink); }

.nav-item .nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 20px;
}

.nav-item.active .nav-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
  border-radius: var(--radius-sm);
  z-index: -1;
}

.nav-item .nav-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.nav-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  background: var(--neg);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 800;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.page-content.no-pad { padding: 0; }
.page-content.pad-bottom { padding-bottom: 24px; }

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

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title {
  font-size: 14px;
  font-weight: 850;
  color: var(--ink);
  letter-spacing: -0.015em;
}

.card-subtitle {
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 600;
  margin-top: 1px;
}

.card-body { padding: 16px; }

/* ── Stat Cards ─────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stats-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent-ink);
}
.stat-value.green  { color: var(--pos-ink); }
.stat-value.yellow { color: var(--warn-ink); }
.stat-value.red    { color: var(--neg-ink); }
.stat-value.orange { color: var(--warn-ink); }

.stat-label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 750;
}

/* ── List Items ─────────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--surface-2); }

.list-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  background: var(--surface-3);
  color: var(--ink-2);
}

.list-item-content { flex: 1; min-width: 0; }

.list-item-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-sub {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  text-align: right;
  flex-shrink: 0;
}

.list-item-arrow { color: var(--ink-4); flex-shrink: 0; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  height: 48px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255,255,255,.13);
}
.btn-primary:active { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--border-strong);
}
.btn-secondary:active { background: var(--surface-2); }

.btn-danger {
  background: var(--neg-soft);
  color: var(--neg-ink);
  border: 1px solid oklch(88% 0.06 27);
}

.btn-ghost { background: transparent; color: var(--ink-3); }
.btn-ghost:active { background: var(--surface-3); }

.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { height: 52px; font-size: 16px; border-radius: 16px; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-sm); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink-2);
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.form-input,
.form-select {
  width: 100%;
  height: 48px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

.form-textarea {
  width: 100%;
  min-height: 100px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--ink-4); }
.form-input:disabled { opacity: 0.55; background: var(--surface-3); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-hint  { font-size: 11px; color: var(--ink-4); font-weight: 600; }
.form-error { font-size: 12px; color: var(--neg-ink); font-weight: 700; }

/* Input with icon */
.input-wrap { position: relative; }
.input-wrap .form-input { padding-left: 44px; }
.input-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-4);
  pointer-events: none;
}
.input-wrap .input-action {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-3);
}
.input-wrap .input-action:active { background: var(--surface-3); }

/* ── Toggle / Radio Pills ────────────────────────────────────── */
.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }

.pill {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 800;
  border: 1px solid var(--border);
  color: var(--ink-3);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  -webkit-user-select: none;
  box-shadow: var(--shadow-sm);
}
.pill:active { transform: scale(0.96); }

.pill.selected {
  background: var(--accent-soft);
  border-color: var(--accent-soft-2);
  color: var(--accent-ink);
}
.pill.selected.green  { background: var(--pos-soft);  border-color: oklch(88% .06 152); color: var(--pos-ink); }
.pill.selected.red    { background: var(--neg-soft);  border-color: oklch(88% .06 27);  color: var(--neg-ink); }
.pill.selected.yellow { background: var(--warn-soft); border-color: oklch(88% .07 75);  color: var(--warn-ink); }
.pill.selected.orange { background: var(--warn-soft); border-color: oklch(88% .07 75);  color: var(--warn-ink); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
}

.badge-blue    { background: var(--accent-soft); color: var(--accent-ink); }
.badge-green   { background: var(--pos-soft);    color: var(--pos-ink); }
.badge-yellow  { background: var(--warn-soft);   color: var(--warn-ink); }
.badge-red     { background: var(--neg-soft);    color: var(--neg-ink); }
.badge-orange  { background: var(--warn-soft);   color: var(--warn-ink); }
.badge-purple  { background: var(--purple-soft); color: var(--purple-ink); }
.badge-gray    { background: var(--surface-3);   color: var(--ink-3); }
.badge-cyan    { background: var(--info-soft);   color: var(--info-ink); }

/* ── Step Indicator ──────────────────────────────────────────── */
.step-indicator { display: flex; align-items: center; padding: 0 16px; gap: 0; }

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-4);
  flex-shrink: 0;
  transition: all var(--transition-slow);
  position: relative;
  z-index: 1;
}
.step-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.step-dot.done { background: var(--pos); border-color: var(--pos); color: white; }

.step-line { flex: 1; height: 2px; background: var(--border); transition: background var(--transition-slow); }
.step-line.done { background: var(--pos); }

/* ── Photo Upload ────────────────────────────────────────────── */
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.photo-slot {
  aspect-ratio: 4/3;
  border-radius: 14px;
  border: 1.5px dashed var(--border-strong);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  color: var(--ink-3);
}
.photo-slot:active { border-color: var(--accent); background: var(--accent-soft); }
.photo-slot.filled { border-style: solid; border-color: var(--border); }
.photo-slot.filled img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-slot .photo-label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 700;
  text-align: center;
  padding: 0 8px;
  position: relative;
  z-index: 1;
}
.photo-slot .photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  background: rgba(17,25,35,0.65);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  color: white;
  font-size: 14px;
}

/* ── GPS Indicator ───────────────────────────────────────────── */
.gps-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.gps-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--ink-4);
  flex-shrink: 0;
}
.gps-dot.acquiring { background: var(--warn); animation: gps-pulse 1.2s ease-in-out infinite; }
.gps-dot.ready { background: var(--pos); }
.gps-dot.error { background: var(--neg); }

@keyframes gps-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

.gps-text { flex: 1; font-size: 12px; color: var(--ink-2); font-weight: 650; }
.gps-coords { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }

/* ── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
  left: 16px;
  right: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--side);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  font-size: 13px;
  font-weight: 750;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.22s ease;
  pointer-events: auto;
}
.toast.success { background: oklch(33% 0.08 152); }
.toast.error   { background: oklch(30% 0.05 27); }
.toast.warning { background: oklch(34% 0.07 70); }
.toast.info    { background: var(--side); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,25,35,0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(18px + var(--safe-bottom));
  border-top: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 -18px 50px rgba(20,30,50,.24);
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  max-height: 90dvh;
  overflow-y: auto;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-handle {
  width: 42px;
  height: 5px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  margin: 0 auto 14px;
}

.modal-title { font-size: 18px; font-weight: 900; letter-spacing: -0.025em; color: var(--ink); margin-bottom: 4px; }
.modal-sub   { font-size: 13px; color: var(--ink-3); font-weight: 650; line-height: 1.5; margin-bottom: 18px; }

.modal-actions { display: flex; gap: 8px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* ── Loading States ──────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--canvas);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 999;
  color: var(--ink-3);
  font-weight: 750;
}
.loading-screen .spinner { width: 34px; height: 34px; }
.loading-screen p { font-size: 14px; color: var(--ink-3); }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 10px;
  text-align: center;
}
.empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
  color: var(--accent-ink);
  font-size: 24px;
}
.empty-title { font-size: 15px; font-weight: 850; color: var(--ink); letter-spacing: -0.015em; }
.empty-sub { font-size: 13px; color: var(--ink-3); font-weight: 600; line-height: 1.6; }

/* ── Section Header ──────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-title {
  font-size: 11px;
  font-weight: 850;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.section-action { font-size: 12px; color: var(--accent-ink); font-weight: 800; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Info Row ────────────────────────────────────────────────── */
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-label {
  font-size: 10.5px;
  color: var(--ink-4);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 110px;
  flex-shrink: 0;
  padding-top: 2px;
}
.info-value { font-size: 13px; color: var(--ink); font-weight: 700; flex: 1; line-height: 1.5; overflow-wrap: anywhere; }

/* ── Alert Banner ────────────────────────────────────────────── */
.alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}
.alert-info    { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-soft-2); }
.alert-success { background: var(--pos-soft);    color: var(--pos-ink);    border: 1px solid oklch(88% .06 152); }
.alert-warning { background: var(--warn-soft);   color: var(--warn-ink);   border: 1px solid oklch(88% .07 75); }
.alert-danger  { background: var(--neg-soft);    color: var(--neg-ink);    border: 1px solid oklch(88% .06 27); }

/* ── Login Page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 15% 5%, var(--accent-soft-2), transparent 34%),
    radial-gradient(circle at 88% 12%, var(--info-soft), transparent 30%),
    var(--canvas);
  color: var(--ink);
  position: relative;
  overflow: hidden;
}

.login-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.login-bg::before {
  content: '';
  position: absolute;
  top: -120px;
  left: -80px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, oklch(92% 0.04 258 / .6) 0%, transparent 70%);
  border-radius: 50%;
}
.login-bg::after {
  content: '';
  position: absolute;
  bottom: 80px;
  right: -100px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, oklch(94% 0.03 232 / .55) 0%, transparent 70%);
  border-radius: 50%;
}

.login-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px;
  padding-top: calc(32px + var(--safe-top));
  position: relative;
  z-index: 1;
}

.login-logo-wrap { margin-bottom: 40px; }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }

.logo-mark {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent), oklch(48% 0.18 280));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: white;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-md);
}

.logo-text { font-size: 18px; font-weight: 850; letter-spacing: -0.025em; color: var(--ink); }

.login-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.12;
  letter-spacing: -0.045em;
}
.login-sub { font-size: 14px; color: var(--ink-3); font-weight: 600; margin-top: 6px; line-height: 1.5; }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 28px;
  background: color-mix(in oklch, var(--surface) 78%, transparent);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.login-error {
  display: none;
  padding: 12px 14px;
  background: var(--neg-soft);
  border: 1px solid oklch(88% .06 27);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--neg-ink);
  line-height: 1.5;
}
.login-error.show { display: block; }

.login-footer {
  padding: 20px 24px;
  padding-bottom: calc(20px + var(--safe-bottom));
  text-align: center;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-4);
  position: relative;
  z-index: 1;
}

/* ── Utility ─────────────────────────────────────────────────── */
.text-primary   { color: var(--accent-ink); }
.text-green     { color: var(--pos-ink); }
.text-red       { color: var(--neg-ink); }
.text-yellow    { color: var(--warn-ink); }
.text-secondary { color: var(--ink-2); }
.text-tertiary  { color: var(--ink-3); }
.text-center    { text-align: center; }
.text-sm        { font-size: 13px; }
.text-xs        { font-size: 11px; }
.font-mono      { font-family: var(--font-mono); }
.font-bold      { font-weight: 800; }
.fw-500         { font-weight: 600; }
.fw-600         { font-weight: 750; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }

.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up   { animation: fade-up 0.3s ease both; }
.fade-up-1 { animation: fade-up 0.3s 0.05s ease both; }
.fade-up-2 { animation: fade-up 0.3s 0.10s ease both; }
.fade-up-3 { animation: fade-up 0.3s 0.15s ease both; }
.fade-up-4 { animation: fade-up 0.3s 0.20s ease both; }
.fade-up-5 { animation: fade-up 0.3s 0.25s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ============================================================
   PWA Readability + Installed App Layout Fix
   ============================================================ */
body { font-size: 16px; text-rendering: optimizeLegibility; }

@media (display-mode: standalone), (max-width: 480px) {
  .app-header .header-title { font-size: 18px; }
  .app-header .header-subtitle { font-size: 13px; }
  .page-content { padding: 18px 14px; gap: 16px; }
  .section-title, .section-action { font-size: 13px; }
  .card-title { font-size: 15px; }
  .card-subtitle { font-size: 13px; }
  .stat-value { font-size: 28px; }
  .stat-label { font-size: 13px; }
  .list-item-title { font-size: 16px; }
  .list-item-sub { font-size: 14px; }
  .list-item-meta { font-size: 13px; }
  .nav-item .nav-label { font-size: 12px; }
  .nav-item .nav-icon { width: 26px; height: 26px; }
  .form-label { font-size: 13px; }
  .form-input, .form-select, .form-textarea { font-size: 16px; }
  .btn { font-size: 16px; }
  .btn-sm { font-size: 14px; }
  .btn-lg { font-size: 17px; }
  .pill { font-size: 14px; }
  .badge { font-size: 12px; }
  .info-label { font-size: 12px; }
  .info-value { font-size: 15px; }
  .gps-text { font-size: 14px; }
  .gps-coords { font-size: 12px; }
  .toast, .alert { font-size: 14px; }
  .modal-title { font-size: 19px; }
  .modal-sub { font-size: 15px; }
  .empty-title { font-size: 17px; }
  .empty-sub { font-size: 15px; }
  .login-title { font-size: 30px; }
  .login-sub { font-size: 16px; }
  .logo-text { font-size: 20px; }
}

@media (min-width: 600px) {
  .login-body, .app-shell {
    max-width: 520px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  .app-header, .bottom-nav, .toast-container {
    max-width: 520px;
    left: 50%;
    right: auto;
    width: 100%;
    transform: translateX(-50%);
  }
  .modal { max-width: 520px; margin-left: auto; margin-right: auto; }
}

/* ============================================================
   Force Mobile Layout Fix
   ============================================================ */
:root {
  --app-max-width: 430px;
  --desktop-view-zoom: 1;
}

html { width: 100%; min-height: 100%; text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
body { width: 100%; min-width: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }

.login-page, .app-shell {
  width: 100%;
  max-width: var(--app-max-width);
  margin-left: auto;
  margin-right: auto;
}

.app-header, .bottom-nav, .toast-container {
  width: 100%;
  max-width: var(--app-max-width);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.login-body {
  width: 100%;
  max-width: var(--app-max-width);
  margin-left: auto;
  margin-right: auto;
}

input, button, textarea, select { font-size: 16px; }

@media (min-width: 431px) {
  body { background: var(--canvas); }
  .login-page, .app-shell { box-shadow: 0 0 34px rgba(20,30,50,.08); }
}

html.force-mobile-viewport body {
  width: calc(100% / var(--desktop-view-zoom));
  min-width: calc(100% / var(--desktop-view-zoom));
  transform-origin: top left;
  zoom: var(--desktop-view-zoom);
}

html.force-mobile-viewport .login-page,
html.force-mobile-viewport .app-shell,
html.force-mobile-viewport .login-body,
html.force-mobile-viewport .modal { max-width: 430px; }

html.force-mobile-viewport .app-header,
html.force-mobile-viewport .bottom-nav,
html.force-mobile-viewport .toast-container { max-width: 430px; }


/* ============================================================
   v29 — DARK THEME
   Diaktifkan via html[data-theme="dark"] (di-set oleh shared/theme.js;
   default 'auto' mengikuti prefers-color-scheme).
   Specificity html[data-theme] (0,1,1) > :root (0,1,0), jadi blok ini
   juga menimpa token :root yang dideklarasi ulang di pages/*.css.
   ============================================================ */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

html[data-theme="dark"] {
  --canvas:        oklch(16.5% 0.016 258);
  --surface:       oklch(21% 0.018 258);
  --surface-2:     oklch(24% 0.02 258);
  --surface-3:     oklch(27.5% 0.022 258);
  --border:        oklch(29% 0.022 258);
  --border-strong: oklch(35% 0.025 258);
  --ink:           oklch(93.5% 0.008 250);
  --ink-2:         oklch(80% 0.012 252);
  --ink-3:         oklch(65% 0.014 254);
  --ink-4:         oklch(52% 0.014 256);
  --mute:          oklch(44% 0.014 256);
  --accent:        oklch(72% 0.13 258);
  --accent-hover:  oklch(78% 0.11 258);
  --accent-soft:   oklch(28% 0.055 258);
  --accent-soft-2: oklch(33% 0.07 258);
  --accent-ink:    oklch(80% 0.1 258);
  --pos:           oklch(72% 0.14 152);
  --pos-soft:      oklch(26.5% 0.05 152);
  --pos-ink:       oklch(80% 0.13 152);
  --warn:          oklch(75% 0.14 75);
  --warn-soft:     oklch(28% 0.05 75);
  --warn-ink:      oklch(82% 0.12 80);
  --neg:           oklch(68% 0.16 25);
  --neg-soft:      oklch(27% 0.055 25);
  --neg-ink:       oklch(80% 0.1 25);
  --info:          oklch(72% 0.12 232);
  --info-soft:     oklch(27% 0.05 232);
  --info-ink:      oklch(80% 0.1 232);
  --purple:        oklch(72% 0.13 300);
  --purple-soft:   oklch(27% 0.05 300);
  --purple-ink:    oklch(82% 0.09 300);
  --side:          oklch(30% 0.02 260);
  --side-2:        oklch(34% 0.022 260);
  --side-3:        oklch(38% 0.024 260);
  --text-inverse:  oklch(17% 0.025 258);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 6px 18px -8px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.3);
  --shadow-lg: 0 18px 46px -20px rgba(0,0,0,.7), 0 3px 8px rgba(0,0,0,.35);
  --shadow-primary: 0 10px 22px -8px oklch(40% 0.12 258 / .5);
}

/* Latar halaman: matikan gradient terang */
html[data-theme="dark"] body {
  background: linear-gradient(180deg, var(--canvas), oklch(14.5% 0.014 258));
}
html[data-theme="dark"] .app-shell {
  background: linear-gradient(180deg, var(--canvas), oklch(14.5% 0.014 258));
}

/* Teks di atas warna accent (accent jadi terang di dark) */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .modal-btn.primary,
html[data-theme="dark"] .step-dot.active,
html[data-theme="dark"] .step-dot.done,
html[data-theme="dark"] .nav-badge,
html[data-theme="dark"] .logo-mark {
  color: var(--text-inverse);
}
html[data-theme="dark"] .btn-primary {
  box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255,255,255,.08);
}

/* Modal sheet & toast */
html[data-theme="dark"] .modal {
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -18px 50px rgba(0,0,0,.6);
}
html[data-theme="dark"] .toast {
  border: 1px solid rgba(255,255,255,.12);
}
html[data-theme="dark"] .toast.success { background: oklch(30% 0.07 152); }
html[data-theme="dark"] .toast.error   { background: oklch(29% 0.06 27); }
html[data-theme="dark"] .toast.warning { background: oklch(30% 0.06 70); }
html[data-theme="dark"] .toast.info    { background: oklch(28% 0.025 260); }

/* Login: redupkan glow dekoratif */
html[data-theme="dark"] .login-bg::before {
  background: radial-gradient(circle, oklch(30% 0.06 258 / .5) 0%, transparent 70%);
}
html[data-theme="dark"] .login-bg::after {
  background: radial-gradient(circle, oklch(28% 0.05 232 / .45) 0%, transparent 70%);
}

/* Tombol toggle tema (header) — specificity 0,3,0 supaya menang atas `.icon-btn .icon-svg { display:block }` di app.css */
.icon-btn.theme-toggle .icon-sun, .theme-toggle.icon-btn .icon-sun { display: none; }
html[data-theme="dark"] .icon-btn.theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .icon-btn.theme-toggle .icon-moon { display: none; }
