/* ═══════════════════════════════════════════════════
   GPS Entregas — Design System · Mist · Cool Minimal
   ═══════════════════════════════════════════════════ */

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

:root {
  /* ── Surfaces ── */
  --bg: #eef0f3;
  --surface: #ffffff;

  /* ── Text ── */
  --ink: #0f1217;
  --ink-soft: #4e5663;
  --ink-faint: #9aa1ad;

  /* ── Lines ── */
  --rule: #e3e6ec;

  /* ── Accent ── */
  --accent: #0f1217;
  --accent-ink: #ffffff;
  --accent-halo: rgba(15,18,23,0.10);
  --accent-shadow: rgba(15,18,23,0.25);

  /* ── Success ── */
  --success: #1f6b4f;
  --success-ink: #f1f7f3;

  /* ── Scrim ── */
  --scrim: rgba(15,18,23,0.18);

  /* ── Shadows ── */
  --shadow-chip:       0 1px 0 rgba(15,18,23,0.04), 0 2px 6px rgba(15,18,23,0.05);
  --shadow-pin:        0 4px 10px rgba(15,18,23,0.18);
  --shadow-pin-active: 0 6px 18px var(--accent-shadow), 0 0 0 6px var(--accent-halo);
  --shadow-fab:        0 4px 14px rgba(15,18,23,0.10);
  --shadow-sheet:      0 -12px 32px rgba(15,18,23,0.10);

  /* ── Map tokens ── */
  --map-land:    #e8eaed;
  --map-block:   #d9dce3;
  --map-road:    #f5f6f8;
  --map-park:    #d1d8d4;
  --map-water:   #c8d4e0;
  --map-highway: #c5c9d4;

  /* ── Typography ── */
  --font-sans: 'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* ── Radii ── */
  --r-xs:   9px;
  --r-sm:   11px;
  --r-md:   13px;
  --r-lg:   14px;
  --r-xl:   16px;
  --r-2xl:  18px;
  --r-sheet:24px;
  --r-pill: 999px;

  /* ── Transitions ── */
  --ease: .2s ease;
}


/* ══════════════════════════════════════════════════════
   Tema Carbon · Dark + Âmbar quente
   ══════════════════════════════════════════════════════ */
.theme-carbon {
  --bg: #0d0e10;
  --surface: #16181c;
  --ink: #f1f1f3;
  --ink-soft: #9498a1;
  --ink-faint: #585c66;
  --rule: #262830;
  --accent: #e7a35d;
  --accent-ink: #1a1208;
  --accent-halo: rgba(231,163,93,0.22);
  --accent-shadow: rgba(231,163,93,0.45);
  --success: #5cb27d;
  --success-ink: #0b1610;
  --scrim: rgba(0,0,0,0.35);
  --shadow-chip: 0 1px 0 rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.35);
  --shadow-pin: 0 4px 10px rgba(0,0,0,0.45);
  --shadow-pin-active: 0 6px 18px var(--accent-shadow), 0 0 0 6px var(--accent-halo);
  --shadow-fab: 0 4px 14px rgba(0,0,0,0.45);
  --shadow-sheet: 0 -12px 32px rgba(0,0,0,0.45);
}

/* ══════════════════════════════════════════════════════
   Theme Switcher
   ══════════════════════════════════════════════════════ */
#theme-switcher { position: relative; }
.theme-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.4);
}
.theme-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 6px;
  z-index: 2000;
  min-width: 130px;
  box-shadow: var(--shadow-sheet);
}
.theme-menu.open { display: block; }
.theme-menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: none; background: none;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  border-radius: var(--r-sm);
  text-align: left;
  transition: background var(--ease);
  white-space: nowrap;
}
.theme-menu-item:hover,
.theme-menu-item.tm-active { background: var(--bg); }

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ── Loading overlay ── */
#loading-overlay {
  position: fixed; inset: 0;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity .4s ease;
}
#loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-box { text-align: center; color: var(--ink-soft); }
.loading-box p { margin-top: 14px; font-size: 14px; font-family: var(--font-sans); }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#toast-container {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  z-index: 9000; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--surface);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700;
  font-family: var(--font-sans);
  opacity: 0; transform: translateY(-8px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast--green { background: var(--success); color: var(--success-ink); }
.toast.toast--red   { background: #c0392b; color: #fff; }

/* ── Top bar ── */
.top-bar {
  position: fixed; top: 12px; left: 12px; right: 12px;
  z-index: 1200;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}

.topbar-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-chip);
  flex-shrink: 0;
  transition: background var(--ease);
}
.topbar-btn:active { background: var(--bg); }
.topbar-btn--danger { color: #dc3545; }
.topbar-btn--danger:active { background: rgba(220,53,69,.12); }

.topbar-pill {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 6px 14px;
  text-align: center;
  box-shadow: var(--shadow-chip);
  flex: 1;
  min-width: 0;
}
.topbar-eyebrow {
  font-size: 9.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  font-family: var(--font-mono);
}
.topbar-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Stat row ── */
.stat-row {
  position: fixed; top: 64px; left: 12px; right: 12px;
  display: flex; gap: 6px;
  z-index: 1100;
  pointer-events: none;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.stat-row::-webkit-scrollbar { display: none; }

.stat-chip {
  height: 28px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--rule);
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: var(--shadow-chip);
  pointer-events: auto;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.stat-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
}

.stat-label {
  color: var(--ink-soft);
  font-weight: 500;
}

/* ── FAB column ── */
.fab-col {
  position: fixed; right: 12px; bottom: 204px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1150;
}

.fab {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-fab);
  cursor: pointer;
  transition: background var(--ease);
}
.fab:active { background: var(--bg); }

/* ── Map ── */
#map {
  position: fixed; inset: 0;
  z-index: 1;
  filter: none;
}

/* MarkerCluster override */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large { background: rgba(15,18,23,0.10) !important; }
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: var(--ink) !important;
  color: var(--surface) !important;
  font-weight: 700 !important;
  font-size: 12px !important;
}

/* ── Pin novo ── */
.pin-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.pin-circle {
  border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; letter-spacing: -0.5px;
  white-space: nowrap;
}
.pin-circle--pending {
  min-width: 28px; height: 28px; padding: 0 5px;
  background: var(--ink); color: var(--surface);
  border: 2px solid var(--surface); font-size: 12px;
  box-shadow: var(--shadow-pin);
}
.pin-circle--active {
  min-width: 36px; height: 36px; padding: 0 8px;
  background: var(--accent); color: var(--accent-ink);
  border: 3px solid var(--surface); font-size: 14px;
  box-shadow: var(--shadow-pin-active);
}
.pin-circle--done {
  min-width: 28px; height: 28px; padding: 0 5px;
  background: var(--surface); color: var(--ink-faint);
  border: 1.5px solid var(--rule); font-size: 12px;
  box-shadow: var(--shadow-pin);
}
.pin-circle--occ {
  min-width: 28px; height: 28px; padding: 0 5px;
  background: #dc3545; color: #ffffff;
  border: 2px solid var(--surface); font-size: 12px;
  box-shadow: var(--shadow-pin);
}
.pin-circle--multi {
  box-shadow: var(--shadow-pin), 0 0 0 2px #e03030;
}

.pin-tail {
  width: 2px;
  background: var(--ink);
  margin-top: -1px;
}
.pin-tail--active  { height: 9px; background: var(--accent); }
.pin-tail--pending { height: 6px; background: var(--ink); }
.pin-tail--done    { height: 6px; background: var(--ink-faint); }
.pin-tail--occ     { height: 6px; background: #dc3545; }

/* ── Scrim ── */
#scrim {
  position: fixed; inset: 0;
  background: var(--scrim);
  z-index: 1999;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
#scrim.active { opacity: 1; pointer-events: auto; }

/* ── Next Stop Card ── */
#next-stop-card {
  position: fixed; left: 12px; right: 12px; bottom: 12px;
  z-index: 1100;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-2xl);
  padding: 14px;
  box-shadow: var(--shadow-sheet);
}

.nsc-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.nsc-eyebrow {
  font-size: 9.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.nsc-line {
  flex: 1; height: 1px;
  background: var(--rule);
}
.nsc-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.nsc-body {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 14px;
}
.nsc-badge {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.nsc-addr {
  font-size: 15px; font-weight: 700;
  color: var(--ink); letter-spacing: -0.2px;
  line-height: 1.3;
}
.nsc-meta {
  font-size: 12px; color: var(--ink-soft);
  margin-top: 3px;
}

.nsc-footer {
  display: flex; gap: 8px;
}
.nsc-route-btn {
  flex: 1; height: 46px;
  background: var(--ink); color: var(--surface);
  border: none; border-radius: var(--r-md);
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  font-family: var(--font-sans);
  transition: opacity var(--ease);
}
.nsc-route-btn:active { opacity: 0.85; }
.nsc-sec-btn {
  width: 46px; height: 46px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--ease);
}
.nsc-sec-btn:active { background: var(--bg); }

.nsc-toggle {
  width: 24px; height: 24px;
  border: none; background: none;
  color: var(--ink-faint);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background var(--ease);
}
.nsc-toggle:hover { background: var(--bg); }
.nsc-toggle svg { transition: transform 0.2s ease; }
#next-stop-card.nsc--collapsed .nsc-toggle svg { transform: rotate(180deg); }

.nsc-mini-badge {
  display: none;
  font-family: var(--font-mono); font-weight: 700; font-size: 11px;
  color: var(--ink); white-space: nowrap;
}

#next-stop-card.nsc--collapsed {
  padding: 10px 14px;
}
#next-stop-card.nsc--collapsed .nsc-header {
  margin-bottom: 0;
}
#next-stop-card.nsc--collapsed .nsc-mini-badge {
  display: inline;
}
#next-stop-card.nsc--collapsed .nsc-body,
#next-stop-card.nsc--collapsed .nsc-footer {
  display: none;
}

/* ── Empty card ── */
.empty-card {
  position: fixed; left: 12px; right: 12px; bottom: 12px;
  z-index: 1100;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-2xl);
  padding: 24px 14px;
  box-shadow: var(--shadow-sheet);
  text-align: center;
}
.empty-icon { font-size: 32px; margin-bottom: 8px; }
.empty-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.empty-sub { font-size: 12px; color: var(--ink-soft); margin-bottom: 16px; }
.empty-csv-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border: 1.5px solid var(--accent);
  background: transparent; color: var(--accent);
  border-radius: var(--r-pill);
  font-family: var(--font-sans); font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: background var(--ease);
}
.empty-csv-btn:active { background: rgba(15,18,23,0.06); }

/* ── Bottom Sheet ── */
#sheet {
  position: fixed; bottom: -100%; left: 0; right: 0;
  z-index: 2000;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
  padding: 12px 16px 28px;
  max-height: 88dvh;
  display: flex; flex-direction: column;
  transition: bottom .25s cubic-bezier(.32,.72,0,1);
}
#sheet.active { bottom: 0; }

.drag-handle {
  width: 36px; height: 4px;
  background: var(--rule);
  border-radius: var(--r-pill);
  margin: 0 auto 14px;
  flex-shrink: 0;
}

.sheet-head {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.sheet-badge {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.sheet-head-info { flex: 1; min-width: 0; }
.sheet-eyebrow {
  font-size: 9.5px; letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-faint); font-weight: 700;
  font-family: var(--font-mono);
}
.sheet-title {
  font-size: 16px; font-weight: 700;
  color: var(--ink); letter-spacing: -0.2px;
  margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sheet-close-btn {
  width: 30px; height: 30px;
  border-radius: 9px;
  border: 1px solid var(--rule);
  background: transparent; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--ease);
}
.sheet-close-btn:active { background: var(--bg); }

.sheet-addr-card {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.addr-main { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -0.1px; }
.addr-sub  { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.addr-divider { height: 1px; background: var(--rule); margin: 10px 0; }
.addr-meta { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Secondary actions grid ── */
.sec-actions {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.sec-action {
  height: 56px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink);
  text-decoration: none; cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--ease);
}
.sec-action:active { background: var(--rule); }
.sec-action-label {
  font-size: 10px; color: var(--ink-soft);
  font-weight: 600; letter-spacing: 0.2px;
}

/* ── Tabs ── */
.tabs {
  display: flex; gap: 16px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.tab-btn {
  background: none; border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  color: var(--ink-soft); font-weight: 600; font-size: 13.5px;
  cursor: pointer; font-family: var(--font-sans);
  margin-bottom: -1px;
  transition: color var(--ease);
}
.tab-btn--active {
  border-bottom: 2px solid var(--ink);
  color: var(--ink); font-weight: 700;
}

.tab-panel { display: none; overflow-y: auto; flex: 1; }
.tab-panel--active { display: block; }

/* ── Client cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 14px; margin-bottom: 8px;
}
.card--done { background: var(--bg); opacity: 0.75; }

.card-name { font-weight: 700; font-size: 13px; color: var(--ink); margin-bottom: 2px; }
.card-addr { color: var(--ink); font-size: 12px; margin-bottom: 4px; }
.card-pkg  { color: var(--ink-faint); font-size: 11px; font-family: var(--font-mono); margin-bottom: 10px; }
.card-warn { color: #c0392b; font-size: 12px; margin-bottom: 8px; }

/* ── Overlay de Navegação (v1.1 Fase 1) ──────────────── */
.nav-overlay {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1200;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  border-top-left-radius: var(--r-sheet); border-top-right-radius: var(--r-sheet);
  box-shadow: var(--shadow-sheet);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-width: 640px; margin: 0 auto;
  font-family: var(--font-sans); color: var(--ink);
}
.nav-grab { width: 36px; height: 4px; border-radius: 99px; background: var(--ink-faint);
  opacity: .5; margin: -6px auto 12px; }
.nav-stats { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 14px; align-items: end; margin-bottom: 14px; }
.nav-stat .l { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); display: block; margin-bottom: 2px; }
.nav-stat .v { font-family: var(--font-mono); font-weight: 600; font-size: 28px; line-height: 1; color: var(--ink); }
.nav-stat.r { text-align: right; }
.nav-sep { background: var(--rule); }
.nav-dest { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--rule); border-radius: var(--r-md); margin-bottom: 12px; }
.nav-dest .b { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.nav-dest .t { font-size: 14px; font-weight: 700; min-width: 0; }
.nav-dest .s { font-size: 12px; color: var(--ink-faint); margin-top: 1px; }
.nav-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nav-btn { appearance: none; border: 0; cursor: pointer; font-family: var(--font-sans);
  font-weight: 700; font-size: 14px; min-height: 46px; padding: 0 14px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.nav-btn--primary { background: var(--accent); color: var(--accent-ink); }
.nav-btn--ghost { background: var(--bg); color: var(--ink); border: 1px solid var(--rule); }
.nav-gmaps { display: block; text-align: center; margin-top: 10px; padding: 8px;
  color: var(--ink-faint); font-size: 12px; font-weight: 600; text-decoration: none; }
.nav-gmaps:hover { color: var(--ink); }
.nav-row { display: flex; align-items: center; gap: 12px; }
.nav-spinner { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 99px;
  border: 3px solid var(--rule); border-top-color: var(--accent); animation: nav-spin .9s linear infinite; }
@keyframes nav-spin { to { transform: rotate(360deg); } }
.nav-title { font-weight: 700; font-size: 15px; color: var(--ink); }
.nav-sub { font-size: 13px; color: var(--ink-faint); margin-top: 3px; line-height: 1.4; }
.nav-err-ic { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px;
  background: rgba(192,57,43,.14); color: #c0392b; display: grid; place-items: center; font-size: 20px; }
.nav-ok-ic { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px;
  background: rgba(31,107,79,.16); color: var(--success); display: grid; place-items: center; font-size: 20px; font-weight: 800; }

/* Banner de próxima manobra (topo) — Fase 2 */
.nav-maneuver {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 1200;
  max-width: 616px; margin: 0 auto;
  background: var(--accent); color: var(--accent-ink);
  border-radius: var(--r-xl); box-shadow: var(--shadow-sheet);
  padding: 12px 16px; font-family: var(--font-sans);
}
.nav-mnv-dist { font-family: var(--font-mono); font-weight: 600; font-size: 18px; line-height: 1; }
.nav-mnv-instr { font-size: 14px; font-weight: 600; margin-top: 4px; opacity: .95;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card-btns-row { display: flex; gap: 8px; margin-bottom: 8px; }
.card-btn {
  flex: 1; text-align: center; text-decoration: none;
  padding: 10px 8px; border-radius: var(--r-md);
  font-size: 12px; font-weight: 800;
  border: none; cursor: pointer; display: block;
  font-family: var(--font-sans);
  transition: opacity var(--ease);
}
.card-btn:active { opacity: .8; }
.card-btn--zap    { background: var(--bg); color: #25d366; border: 1px solid rgba(37,211,102,.4); }
.card-btn--arrive { background: var(--accent); color: var(--accent-ink); }
.card-btn--route  { background: var(--bg); color: var(--ink); border: 1px solid var(--rule); margin-bottom: 8px; }
.card-btn--done   { background: var(--success); color: var(--success-ink); padding: 13px; font-size: 14px; font-weight: 900; letter-spacing: .3px; margin-top: 8px; }
.card-btn--occ    { background: #dc3545; color: #fff; padding: 13px; font-size: 14px; font-weight: 900; letter-spacing: .3px; }
.card-btn--undo   { background: transparent; border: 1px solid var(--rule); color: var(--ink-soft); }
/* CONCLUIR + OCORRÊNCIA lado a lado: zera o margin-top próprio do done */
.card-btns-row .card-btn--done { margin-top: 0; }

/* ── Card resolvido como ocorrência ── */
.card--occ { border: 1px solid rgba(220,53,69,.45); background: rgba(220,53,69,.06); }
.card-occ-tag {
  display: inline-block; margin: 2px 0 6px;
  font-size: 11px; font-weight: 800; letter-spacing: .3px;
  color: #dc3545;
}

/* ── CSV Panel ── */
#csv-panel {
  position: fixed; bottom: -100%; left: 0; right: 0;
  z-index: 2000;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
  padding: 12px 16px 28px;
  max-height: 88dvh; overflow-y: auto;
  transition: bottom .25s cubic-bezier(.32,.72,0,1);
}
#csv-panel.active { bottom: 0; }

.csv-dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1.5px dashed var(--rule);
  border-radius: var(--r-xl); padding: 22px;
  cursor: pointer; transition: border-color .2s;
}
.csv-dropzone:hover { border-color: var(--accent); }
.csv-dropzone-icon {
  width: 48px; height: 48px;
  background: var(--bg); border-radius: 12px; border: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); margin-bottom: 6px;
}
.csv-dropzone-text { font-size: 14px; font-weight: 700; color: var(--ink); }
.csv-dropzone-sub  { font-size: 12px; color: var(--accent); font-weight: 600; }

.csv-github-row { display: flex; gap: 6px; margin-bottom: 6px; }
.csv-gh-input {
  flex: 1;
  background: var(--bg); border: 1px solid var(--rule); color: var(--ink);
  padding: 11px 12px; border-radius: var(--r-md);
  font-size: 12px; font-family: var(--font-mono); outline: none;
  transition: border-color var(--ease);
}
.csv-gh-input:focus { border-color: var(--accent); }
.csv-gh-input::placeholder { color: var(--ink-faint); }
.btn-csv-gh {
  width: 44px; height: 44px;
  background: var(--ink); color: var(--surface);
  border: none; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: opacity var(--ease);
}
.btn-csv-gh:active { opacity: .85; }
.btn-csv-gh.loading { opacity: .5; animation: spin .7s linear infinite; }

.csv-gh-status {
  font-size: 12px; min-height: 18px; margin-top: 4px;
  font-weight: 700; font-family: var(--font-sans);
}
.csv-gh-status.ok  { color: var(--success); }
.csv-gh-status.err { color: #c0392b; }
.csv-gh-status.inf { color: var(--ink-soft); }

.csv-divider {
  text-align: center; font-size: 11px; color: var(--ink-faint);
  margin: 12px 0; letter-spacing: .05em;
}

#csv-result { margin-top: 8px; }
.csv-success {
  background: #e8f5ec; border: 1px solid rgba(63,107,74,.3);
  border-radius: var(--r-md);
  padding: 10px 14px; font-size: 13px; font-weight: 700;
  color: var(--success); margin-bottom: 6px;
}
.csv-warn {
  background: #f4f5f7; border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 10px 14px; font-size: 11px; color: var(--ink-soft);
  margin-bottom: 6px; max-height: 100px; overflow-y: auto;
}
.csv-warn li { list-style: none; padding: 2px 0; }
.btn-add-csv {
  width: 100%;
  background: var(--success); color: var(--success-ink);
  border: none; border-radius: var(--r-md);
  padding: 12px; font-weight: 800; font-size: 13px;
  cursor: pointer; margin-top: 4px;
  font-family: var(--font-sans);
  transition: opacity var(--ease);
}
.btn-add-csv:active { opacity: .85; }

/* ── List Panel (fullscreen) ── */
#list-panel {
  position: fixed; inset: 0;
  z-index: 2100;
  background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.32,.72,0,1);
}
#list-panel.active { transform: translateX(0); }

.list-header {
  padding: 16px 16px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.list-eyebrow {
  font-size: 9.5px; letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-faint); font-weight: 700;
  font-family: var(--font-mono);
}
.list-title {
  font-size: 22px; font-weight: 700;
  color: var(--ink); letter-spacing: -0.5px;
  margin-top: 2px; margin-bottom: 14px;
}
.list-tabs { display: flex; gap: 20px; padding-top: 4px; }
.list-tab {
  background: none; border: none;
  border-bottom: 2px solid transparent;
  padding: 0 0 10px;
  font-size: 13.5px; font-weight: 600;
  color: var(--ink-soft); cursor: pointer;
  font-family: var(--font-sans);
  display: flex; align-items: center; gap: 4px;
  transition: color var(--ease);
}
.list-tab--active { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }
.list-tab-count {
  font-family: var(--font-mono); color: var(--ink-faint); font-size: 12px;
}

.list-items {
  flex: 1; overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}

.list-row {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  transition: background var(--ease);
}
.list-row:active { background: var(--bg); }
.list-row--active { border-color: var(--accent); }
.list-row--done { opacity: 0.6; }

.list-row-badge {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--ink); color: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.list-row-badge--active { background: var(--accent); color: var(--accent-ink); }
.list-row-badge--done { background: var(--surface); color: var(--ink-faint); border: 1px solid var(--rule); }
.list-row-badge--occ  { background: #dc3545; color: #fff; }

.list-row-addr {
  font-size: 14px; font-weight: 700;
  color: var(--ink); letter-spacing: -0.1px;
}
.list-row-addr--done {
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint);
}
.list-row-meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.list-row-next {
  font-size: 9.5px; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--accent); font-weight: 700;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.list-footer {
  padding: 10px 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  display: flex; gap: 8px;
  flex-shrink: 0;
}
.list-add-input {
  flex: 1; height: 46px;
  background: var(--bg); border: 1px solid var(--rule);
  border-radius: var(--r-md); padding: 0 14px;
  font-size: 13px; color: var(--ink-faint);
  font-family: var(--font-sans); outline: none;
  transition: border-color var(--ease);
}
.list-add-input:focus { border-color: var(--ink); color: var(--ink); }
.list-add-input::placeholder { color: var(--ink-faint); }
.list-add-btn {
  width: 46px; height: 46px;
  background: var(--ink); color: var(--surface);
  border: none; border-radius: var(--r-md);
  font-size: 22px; font-weight: 300;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity var(--ease);
}
.list-add-btn:active { opacity: .85; }

/* ── Batch queue (mantido para compatibilidade) ── */
.batch-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px; padding-top: 8px;
}
.batch-item {
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 5px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  display: flex; align-items: center; gap: 6px;
}
.batch-item b { color: #c0392b; cursor: pointer; font-weight: 700; font-size: 14px; }

.btn-confirm {
  display: none;
  width: 100%; margin-top: 8px;
  background: var(--success); color: var(--success-ink);
  border: none; border-radius: var(--r-md);
  padding: 13px; font-size: 14px; font-weight: 800;
  letter-spacing: .4px; cursor: pointer;
  font-family: var(--font-sans);
  transition: opacity var(--ease);
}
.btn-confirm:active { opacity: .85; }

/* ── Scanner de pacotes ───────────────────────────── */
.scanner-entry-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--ink);
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--surface);
  font-family: var(--font-sans);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.scanner-entry-btn:active { opacity: .86; }
.scanner-entry-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255,255,255,.12);
}
.scanner-entry-btn > span:nth-child(2) { min-width: 0; flex: 1; }
.scanner-entry-btn b { display: block; font-size: 14px; font-weight: 800; }
.scanner-entry-btn small { display: block; margin-top: 2px; font-size: 11px; opacity: .7; }
.scanner-entry-arrow { flex: 0 0 auto; opacity: .7; }
.scanner-csv-divider { margin-top: 16px; }

.scanner-panel {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--ink);
  overflow-y: auto;
  transform: translateY(100%);
  visibility: hidden;
  transition: transform .25s ease, visibility .25s;
}
.scanner-panel.active { transform: none; visibility: visible; }
.scanner-header { display: flex; align-items: center; justify-content: space-between; }
.scanner-title { margin-top: 2px; font-size: 20px; font-weight: 800; letter-spacing: -.35px; }
.scanner-camera {
  position: relative;
  width: 100%;
  min-height: 280px;
  flex: 1 1 44vh;
  max-height: 58vh;
  overflow: hidden;
  border-radius: 20px;
  background: #080a0c;
  box-shadow: var(--shadow-lg);
}
.scanner-camera video { width: 100%; height: 100%; min-height: 280px; object-fit: cover; display: block; }
.scanner-frame {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 150px;
  transform: translateY(-50%);
  border: 2px solid rgba(255,255,255,.88);
  border-radius: 16px;
  box-shadow: 0 0 0 999px rgba(0,0,0,.34);
  pointer-events: none;
}
.scanner-frame::before,
.scanner-frame::after {
  content: '';
  position: absolute;
  width: 25px;
  height: 25px;
  border-color: #ffb05f;
}
.scanner-frame::before { left: -3px; top: -3px; border-left: 4px solid #ffb05f; border-top: 4px solid #ffb05f; border-radius: 12px 0 0; }
.scanner-frame::after { right: -3px; bottom: -3px; border-right: 4px solid #ffb05f; border-bottom: 4px solid #ffb05f; border-radius: 0 0 12px; }
.scanner-frame span {
  position: absolute;
  left: 5%;
  right: 5%;
  top: 50%;
  height: 2px;
  background: #ff9d3d;
  box-shadow: 0 0 12px rgba(255,157,61,.9);
  animation: scanner-line 1.8s ease-in-out infinite alternate;
}
@keyframes scanner-line { from { transform: translateY(-55px); } to { transform: translateY(55px); } }
.scanner-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 13px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
.scanner-status--ready { color: var(--ink); }
.scanner-status--loading { color: #9a5a16; border-color: rgba(231,163,93,.5); }
.scanner-status--error { color: #b42318; border-color: rgba(220,53,69,.35); background: rgba(220,53,69,.06); }
.scanner-actions { display: flex; gap: 10px; }
.scanner-photo-btn,
.scanner-retry-btn {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 700 13px var(--font-sans);
  cursor: pointer;
}
.scanner-manual { padding-top: 2px; }
.scanner-manual > label { display: block; margin-bottom: 6px; color: var(--ink-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.scanner-manual > div { display: flex; gap: 8px; }
.scanner-manual input {
  min-width: 0;
  flex: 1;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font: 13px var(--font-mono);
  outline: none;
}
.scanner-manual input:focus { border-color: var(--ink); }
.scanner-manual button {
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  background: var(--ink);
  color: var(--surface);
  font: 800 13px var(--font-sans);
  cursor: pointer;
}
.scanner-help { margin: 0; color: var(--ink-faint); font-size: 10px; line-height: 1.45; text-align: center; }

.scanner-result {
  display: none;
  flex: 1;
  min-height: 360px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px 18px;
  text-align: center;
}
.scanner-panel--result .scanner-camera,
.scanner-panel--result .scanner-status,
.scanner-panel--result .scanner-actions,
.scanner-panel--result .scanner-manual,
.scanner-panel--result .scanner-help { display: none; }
.scanner-panel--result .scanner-result { display: flex; }
.scanner-result-icon {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 50%;
  font-size: 43px;
  background: rgba(25,135,84,.1);
}
.scanner-result--error .scanner-result-icon { background: rgba(220,53,69,.1); }
.scanner-result h3 { margin: 0; color: var(--ink); font-size: 22px; letter-spacing: -.35px; }
.scanner-result p { max-width: 390px; margin: 9px 0 0; color: var(--ink-muted); font-size: 14px; line-height: 1.5; }
.scanner-result small { max-width: 390px; margin-top: 8px; color: var(--ink-faint); font-size: 11px; line-height: 1.4; }
.scanner-result-actions { width: min(360px, 100%); display: grid; gap: 9px; margin-top: 25px; }
.scanner-result-actions button {
  min-height: 48px;
  border-radius: 12px;
  font: 800 13px var(--font-sans);
  cursor: pointer;
}
.scanner-result-next { border: 0; background: var(--ink); color: var(--surface); }
.scanner-result-manual { border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); }
.scanner-result-view {
  display: none;
  min-height: auto !important;
  width: fit-content;
  margin: 1px auto 0;
  padding: 3px 5px;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font-size: 11px !important;
  font-weight: 650 !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.scanner-result--success .scanner-result-view { display: inline-block; }
.scanner-result--success .scanner-result-manual { display: none; }

/* Marcador do GPS com direção de deslocamento */
.gps-direction-marker {
  width: 40px;
  height: 40px;
  transform-origin: 20px 23px;
  transition: transform .3s linear;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.24));
  will-change: transform;
}
.gps-direction-marker svg { display: block; overflow: visible; }
.gps-direction-arrow,
.gps-direction-dot {
  fill: var(--gps-color);
  stroke: #fff;
  stroke-width: 3px;
}
.gps-direction-arrow {
  stroke-linejoin: round;
  transition: opacity .2s ease;
}
.gps-direction-marker--unknown .gps-direction-arrow { opacity: 0; }

.package-scan-details { margin: 0 16px 14px; }
.package-scan-details details {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--surface);
}
.package-scan-details summary {
  padding: 12px 13px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.package-detail-grid { border-top: 1px solid var(--rule); }
.package-detail-row { display: grid; grid-template-columns: minmax(90px, .8fr) minmax(0, 1.4fr); gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--rule); font-size: 11px; line-height: 1.35; }
.package-detail-row:last-child { border-bottom: 0; }
.package-detail-row span { color: var(--ink-faint); }
.package-detail-row b { color: var(--ink); font-family: var(--font-mono); font-weight: 600; overflow-wrap: anywhere; }

@media (min-width: 700px) {
  .scanner-panel { left: 50%; right: auto; width: min(520px, 100%); transform: translate(-50%, 100%); box-shadow: 0 0 60px rgba(0,0,0,.24); }
  .scanner-panel.active { transform: translate(-50%, 0); }
}

