:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --text: #14201a;
  --muted: #64736b;
  --line: #dfe7e2;
  --primary: #166534;
  --primary-strong: #14532d;
  --primary-soft: #dcfce7;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warning: #a15c07;
  --warning-soft: #fff4d6;
  --info: #175cd3;
  --info-soft: #e8f1ff;
  --shadow: 0 16px 40px rgba(20, 32, 26, .08);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-width: 248px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }

.splash-screen,
.setup-screen,
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.splash-screen { align-content: center; text-align: center; }
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: -.04em;
  color: white;
  background: linear-gradient(145deg, #15803d, #14532d);
  box-shadow: 0 12px 28px rgba(22, 101, 52, .28);
}
.brand-lockup { display: flex; gap: 12px; align-items: center; }
.brand-lockup strong { display: block; font-size: 18px; }
.brand-lockup span { color: var(--muted); font-size: 12px; }

.auth-shell,
.setup-card {
  width: min(980px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.auth-shell { display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-hero {
  padding: 54px;
  background:
    radial-gradient(circle at top right, rgba(134, 239, 172, .55), transparent 38%),
    linear-gradient(145deg, #14532d, #166534 64%, #15803d);
  color: white;
  min-height: 610px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-hero .brand-mark { background: white; color: var(--primary); box-shadow: none; }
.auth-hero h1 { font-size: clamp(38px, 6vw, 62px); line-height: .98; letter-spacing: -.055em; margin: 44px 0 18px; }
.auth-hero p { max-width: 430px; color: rgba(255,255,255,.78); font-size: 17px; line-height: 1.6; }
.hero-points { display: grid; gap: 12px; }
.hero-point { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.9); }
.hero-point::before { content: "✓"; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.15); }
.auth-panel { padding: 46px; align-self: center; }
.auth-panel h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.035em; }
.auth-panel > p { margin: 0 0 28px; color: var(--muted); }
.auth-tabs { display: flex; padding: 4px; background: var(--surface-soft); border-radius: 12px; margin-bottom: 24px; }
.auth-tab { flex: 1; border: 0; border-radius: 9px; padding: 10px; color: var(--muted); background: transparent; font-weight: 700; }
.auth-tab.active { color: var(--primary); background: white; box-shadow: 0 2px 8px rgba(0,0,0,.06); }

.setup-card { max-width: 720px; padding: 42px; }
.setup-card h1 { margin: 18px 0 8px; }
.setup-card code { background: #eef2ef; padding: 2px 6px; border-radius: 6px; }
.setup-steps { margin: 26px 0; display: grid; gap: 14px; }
.setup-step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.step-number { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); font-weight: 800; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 750; color: #324139; }
.field small { color: var(--muted); line-height: 1.45; }
.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #cfd9d3;
  border-radius: 12px;
  background: white;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 94px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: #46a66c; box-shadow: 0 0 0 4px rgba(34, 197, 94, .12); }
.input[disabled], .select[disabled] { background: #f1f4f2; color: #88938d; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: transform .15s, background .15s, border-color .15s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-primary { color: white; background: var(--primary); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-secondary { color: var(--text); background: white; border-color: var(--line); }
.btn-soft { color: var(--primary); background: var(--primary-soft); }
.btn-danger { color: white; background: var(--danger); }
.btn-danger-soft { color: var(--danger); background: var(--danger-soft); }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 16px; border-radius: 14px; }
.btn-sm { min-height: 34px; padding: 7px 11px; border-radius: 9px; font-size: 13px; }
.link-button { border: 0; background: transparent; color: var(--primary); padding: 4px; font-weight: 750; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions-end { justify-content: flex-end; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) 1fr; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: #10231a;
  color: white;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.sidebar .brand-lockup span { color: rgba(255,255,255,.55); }
.sidebar-nav { margin-top: 34px; display: grid; gap: 7px; }
.nav-button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  color: rgba(255,255,255,.72);
  background: transparent;
  text-align: left;
  font-weight: 700;
}
.nav-button:hover, .nav-button.active { color: white; background: rgba(255,255,255,.1); }
.nav-icon { width: 24px; text-align: center; font-size: 17px; }
.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); }
.user-summary { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; margin-bottom: 14px; }
.avatar { width: 38px; height: 38px; border-radius: 12px; background: rgba(134, 239, 172, .18); color: #bbf7d0; display: grid; place-items: center; font-weight: 900; }
.user-summary strong { display: block; font-size: 13px; }
.user-summary span { display: block; color: rgba(255,255,255,.52); font-size: 12px; margin-top: 2px; }

.main { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 30px;
  border-bottom: 1px solid rgba(223, 231, 226, .9);
  background: rgba(244, 247, 245, .9);
  backdrop-filter: blur(14px);
}
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.content { padding: 28px 30px 90px; max-width: 1500px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 24px; }
.page-head h2 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.04em; }
.page-head p { margin: 0; color: var(--muted); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stats-grid.dashboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-card, .card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(20, 32, 26, .04);
}
.stat-card { padding: 18px; }
.stat-card .stat-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.stat-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-soft); }
.stat-card strong { display: block; margin-top: 15px; font-size: 30px; letter-spacing: -.05em; }
.stat-card small { display: block; color: var(--muted); margin-top: 4px; }
.card { padding: 20px; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.card-head h3 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, .8fr); gap: 18px; }
.grid-equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { background: #f7faf8; color: var(--muted); font-size: 12px; text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px; border-bottom: 1px solid #edf1ee; font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.table-primary { font-weight: 800; }
.table-secondary { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.empty-state { padding: 42px 20px; text-align: center; border: 1px dashed #cbd8d0; border-radius: 14px; color: var(--muted); }
.empty-icon { font-size: 34px; margin-bottom: 12px; }

.status { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 850; white-space: nowrap; }
.status-draft, .status-pending { color: #475467; background: #f2f4f7; }
.status-ready, .status-assigned { color: #175cd3; background: #eaf2ff; }
.status-started, .status-in_route, .status-next_delivery { color: #93370d; background: #fff0c7; }
.status-delivered, .status-completed { color: #067647; background: #dcfae6; }
.status-not_delivered, .status-cancelled { color: #b42318; background: #fee4e2; }
.status-rescheduled { color: #6941c6; background: #f0eaff; }

.progress { height: 9px; border-radius: 999px; overflow: hidden; background: #e8eeea; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22c55e, #15803d); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row strong { font-size: 12px; min-width: 40px; text-align: right; }

.route-card-list { display: grid; gap: 12px; }
.route-card { border: 1px solid var(--line); border-radius: 15px; padding: 16px; background: white; transition: border-color .15s, transform .15s; }
.route-card:hover { border-color: #9ec7ac; transform: translateY(-1px); }
.route-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.route-card h3 { margin: 0 0 5px; font-size: 16px; }
.route-card p { margin: 0; color: var(--muted); font-size: 13px; }
.route-metrics { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 15px; color: var(--muted); font-size: 12px; }
.route-metrics strong { color: var(--text); }

.map { width: 100%; min-height: 430px; border-radius: 15px; overflow: hidden; background: #e9efeb; border: 1px solid var(--line); }
.route-marker-wrapper { background: transparent; border: 0; }
.route-marker { width: 34px; height: 34px; border: 3px solid white; border-radius: 50% 50% 50% 8px; transform: rotate(-45deg); display: grid; place-items: center; color: white; font-size: 12px; font-weight: 900; box-shadow: 0 5px 14px rgba(0,0,0,.22); background: #64748b; }
.route-marker span { transform: rotate(45deg); display: block; }
.marker-origin { background: #111827; }
.marker-pending { background: #2563eb; }
.marker-next { background: #f59e0b; }
.marker-delivered { background: #16a34a; }
.marker-problem { background: #dc2626; }

.stop-list { display: grid; gap: 11px; }
.stop-card { display: grid; grid-template-columns: 42px 1fr auto; gap: 13px; align-items: start; border: 1px solid var(--line); border-radius: 15px; padding: 14px; background: white; }
.stop-card.next { border-color: #f4b740; box-shadow: 0 0 0 3px rgba(245, 158, 11, .12); }
.stop-number { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); font-weight: 900; }
.stop-card h4 { margin: 0 0 5px; font-size: 15px; }
.stop-card p { margin: 3px 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.stop-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 9px; color: var(--muted); font-size: 11px; }
.stop-actions { display: grid; gap: 7px; min-width: 126px; }

.route-form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.sticky-card { position: sticky; top: 90px; }
.delivery-editor { display: grid; gap: 12px; }
.delivery-row { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fbfdfb; }
.delivery-row-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.delivery-row-head strong { font-size: 14px; }
.summary-list { display: grid; gap: 12px; }
.summary-item { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 13px; }
.summary-item strong { color: var(--text); }
.notice { padding: 13px 14px; border-radius: 12px; color: #694a05; background: var(--warning-soft); font-size: 13px; line-height: 1.5; }
.notice-info { color: #164c94; background: var(--info-soft); }
.notice-danger { color: var(--danger); background: var(--danger-soft); }

.driver-shell { min-height: 100vh; max-width: 760px; margin: 0 auto; background: var(--bg); padding-bottom: 92px; }
.driver-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 17px; background: rgba(244,247,245,.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.driver-header .brand-mark { width: 40px; height: 40px; border-radius: 12px; font-size: 13px; }
.driver-content { padding: 18px 14px; }
.driver-hero { padding: 20px; color: white; background: linear-gradient(145deg, #14532d, #15803d); border-radius: 20px; box-shadow: 0 14px 36px rgba(20,83,45,.22); }
.driver-hero h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.04em; }
.driver-hero p { margin: 0; color: rgba(255,255,255,.72); }
.driver-hero .route-metrics { color: rgba(255,255,255,.67); margin: 20px 0; }
.driver-hero .route-metrics strong { color: white; }
.driver-progress { margin-top: 16px; }
.driver-progress .progress { background: rgba(255,255,255,.2); }
.driver-progress .progress > span { background: #bbf7d0; }
.driver-section-title { display: flex; justify-content: space-between; align-items: center; margin: 22px 2px 11px; }
.driver-section-title h2 { margin: 0; font-size: 18px; }
.driver-stop { border: 1px solid var(--line); border-radius: 18px; background: white; padding: 17px; margin-bottom: 12px; box-shadow: 0 5px 20px rgba(20,32,26,.035); }
.driver-stop.next { border: 2px solid #f5b333; }
.driver-stop.completed { opacity: .72; }
.driver-stop-top { display: flex; gap: 12px; align-items: flex-start; }
.driver-stop .stop-number { flex: 0 0 auto; }
.driver-stop h3 { margin: 1px 0 4px; font-size: 17px; }
.driver-stop p { margin: 4px 0; color: var(--muted); line-height: 1.45; }
.driver-stop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.driver-stop-actions .btn:first-child { grid-column: 1 / -1; }
.mobile-nav { position: fixed; inset: auto 0 0; z-index: 25; max-width: 760px; margin: auto; display: grid; grid-template-columns: repeat(3,1fr); padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.mobile-nav button { border: 0; background: transparent; padding: 7px; color: var(--muted); font-size: 11px; font-weight: 750; }
.mobile-nav button span { display: block; font-size: 20px; margin-bottom: 3px; }
.mobile-nav button.active { color: var(--primary); }

.modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 18px; background: rgba(10, 21, 15, .58); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: min(520px, 100%); max-height: min(88vh, 900px); overflow-y: auto; border-radius: 20px; background: white; padding: 24px; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.modal-wide { width: min(920px, 100%); }
.modal-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 10px; background: #f1f4f2; font-size: 22px; }
.modal-card h2 { margin: 0 38px 7px 0; letter-spacing: -.035em; }
.modal-card > p { margin: 0 0 20px; color: var(--muted); }

.toast-region { position: fixed; top: 18px; right: 18px; z-index: 2000; display: grid; gap: 10px; width: min(380px, calc(100vw - 36px)); }
.toast { transform: translateY(-10px); opacity: 0; padding: 13px 15px; color: white; background: #25332c; border-radius: 12px; box-shadow: 0 14px 35px rgba(0,0,0,.18); transition: opacity .2s, transform .2s; font-weight: 700; font-size: 13px; }
.toast-visible { transform: translateY(0); opacity: 1; }
.toast-error { background: #9f1d16; }
.toast-warning { background: #8a4c04; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-secondary .spinner { border-color: rgba(20,32,26,.2); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .route-form-layout { grid-template-columns: 1fr; }
  .sticky-card { position: static; }
}

@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; max-width: 560px; }
  .auth-hero { display: none; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main { grid-column: auto; }
  .content { padding: 20px 14px 82px; }
  .topbar { padding: 11px 14px; }
  .page-head { align-items: stretch; flex-direction: column; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .grid-equal { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .auth-panel, .setup-card { padding: 28px 20px; }
  .auth-shell, .setup-card { border-radius: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card strong { font-size: 25px; }
  .card { padding: 16px; border-radius: 16px; }
  .map { min-height: 330px; }
  .stop-card { grid-template-columns: 38px 1fr; }
  .stop-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .driver-stop-actions { grid-template-columns: 1fr; }
  .driver-stop-actions .btn:first-child { grid-column: auto; }
  .modal-card { padding: 22px 17px; border-radius: 18px; }
}


/* Admin mobile navigation v6 */
.mobile-admin-header,
.mobile-menu-drawer,
.mobile-menu-backdrop { display: none; }

.brand-mark-sm {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 12px;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mobile-brand strong {
  display: block;
  font-size: 14px;
  line-height: 1.15;
}
.mobile-brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  max-width: 210px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.settings-grid .card + .card { margin-top: 0; }
.settings-password-card { grid-column: 1 / -1; }

@media (max-width: 820px) {
  .desktop-admin-topbar { display: none; }

  .mobile-admin-header {
    position: sticky;
    top: 0;
    z-index: 45;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    border-bottom: 1px solid var(--line);
    background: rgba(244,247,245,.96);
    backdrop-filter: blur(16px);
  }

  .mobile-menu-trigger,
  .mobile-menu-close {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: white;
    color: var(--text);
    font-size: 22px;
    font-weight: 800;
  }

  .mobile-menu-close {
    margin-left: auto;
    font-size: 27px;
    line-height: 1;
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: block;
    background: rgba(8, 20, 13, .42);
    backdrop-filter: blur(2px);
  }
  .mobile-menu-backdrop[hidden] { display: none; }

  .mobile-menu-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(86vw, 330px);
    display: flex;
    flex-direction: column;
    padding: calc(16px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
    background: #10231a;
    color: white;
    box-shadow: 18px 0 44px rgba(0,0,0,.22);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  .mobile-menu-drawer.open { transform: translateX(0); }
  .mobile-menu-drawer .mobile-brand span { color: rgba(255,255,255,.55); }
  .mobile-menu-drawer .mobile-menu-close {
    color: white;
    border-color: rgba(255,255,255,.12);
    background: rgba(255,255,255,.08);
  }

  .mobile-menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 2px 18px;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .mobile-menu-nav {
    display: grid;
    gap: 7px;
    padding-top: 18px;
  }
  .mobile-menu-account {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,.1);
  }
  .mobile-menu-account .user-summary span { color: rgba(255,255,255,.52); }
  .mobile-logout { color: #fecaca; }
  body.mobile-menu-open { overflow: hidden; }

  .settings-grid { grid-template-columns: 1fr; }
  .settings-password-card { grid-column: auto; }

  /* The page title lives in the content on mobile; remove duplicated topbar title/update controls. */
  .content { padding-top: 18px; }
}

/* Mobile viewport lock v6.1 - impede a pagina inteira de deslizar lateralmente */
html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y pinch-zoom;
  position: relative;
}
#app,
.app-shell,
.main,
.content,
.driver-shell,
.driver-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.app-shell,
.main,
.content,
.driver-shell,
.driver-content {
  overflow-x: clip;
}
.card,
.page-head,
.grid-2,
.route-form-layout,
.form-grid,
.form-grid > *,
.form-grid-3 > *,
.grid-2 > *,
.route-form-layout > * {
  min-width: 0;
  max-width: 100%;
}
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
img, svg, canvas, iframe {
  max-width: 100%;
}
@media (max-width: 820px) {
  .app-shell, .main, .content {
    max-width: 100vw;
  }
  .page-head {
    width: 100%;
  }
  .card {
    width: 100%;
  }
}

/* v6.1 - trava o layout no eixo horizontal em celulares */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

#app, .app-shell, .main, .content,
.page-head, .card, .form-grid, .field,
.grid-2, .route-form-layout, .delivery-editor,
.driver-shell, .driver-content {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

img, video, canvas, svg, iframe {
  max-width: 100%;
}

@supports (overflow: clip) {
  html, body, #app, .app-shell, .main, .content {
    overflow-x: clip;
  }
}

@media (max-width: 820px) {
  body {
    touch-action: pan-y;
  }

  .app-shell,
  .main,
  .content,
  .page-head,
  .card,
  .route-form-layout,
  .form-grid,
  .delivery-row,
  .driver-shell,
  .driver-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .content {
    margin-left: 0;
    margin-right: 0;
  }

  .actions {
    max-width: 100%;
    flex-wrap: wrap;
  }

  .input, .select, textarea, button {
    max-width: 100%;
  }

  .mobile-admin-header {
    left: 0;
    right: 0;
    width: 100%;
  }
}

/* Parceiros v6.2 */
.partner-id-panel{display:flex;align-items:center;justify-content:space-between;gap:16px;background:linear-gradient(135deg,#f0fdf4,#ffffff)}
.partner-id-panel h2{margin:6px 0 4px;font-size:34px;letter-spacing:.02em}
.partner-id-panel small{font-weight:800;color:var(--muted)}
.partner-list{display:grid;gap:10px}
.partner-row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 0;border-bottom:1px solid var(--line)}
.partner-row:last-child{border-bottom:0}
.partner-row p{margin:4px 0;color:var(--muted);font-size:13px}
.partner-main{display:flex;align-items:center;gap:12px;min-width:0}
.partner-avatar{width:44px;height:44px;border-radius:14px;background:#e8f7ec;color:#166534;display:grid;place-items:center;font-weight:900;flex:0 0 auto}
.partner-code{display:inline-block;font-size:12px;font-weight:800;background:#f3f4f6;border-radius:999px;padding:5px 9px}
@media(max-width:820px){
 .partner-id-panel,.partner-row{align-items:flex-start;flex-direction:column}
 .partner-row .actions{width:100%}
 .partner-row .actions .btn{flex:1}
 .partner-id-panel .btn{width:100%}
}

/* Notificações v6.3 */
.topbar-actions,.driver-header-actions{display:flex;align-items:center;gap:10px}
.notification-bell{
  position:relative; width:42px; height:42px; border:1px solid var(--line); border-radius:13px;
  background:#fff; display:grid; place-items:center; cursor:pointer; font-size:19px; line-height:1;
  box-shadow:0 1px 2px rgba(15,23,42,.03)
}
.notification-bell:hover{background:#f8faf9}
.notification-badge{
  position:absolute; top:-5px; right:-5px; min-width:19px; height:19px; padding:0 5px;
  border-radius:999px; background:#dc2626; color:#fff; border:2px solid #fff;
  display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:900; line-height:1
}
.notification-badge[hidden]{display:none!important}
.notification-panel{
  position:fixed; z-index:1200; top:76px; right:24px; width:min(390px,calc(100vw - 32px)); max-height:min(620px,calc(100vh - 96px));
  overflow:hidden; background:#fff; border:1px solid var(--line); border-radius:18px;
  box-shadow:0 24px 60px rgba(15,23,42,.18); color:var(--text)
}
.notification-panel[hidden]{display:none!important}
.notification-panel-head{
  display:flex; align-items:center; justify-content:space-between; gap:14px; padding:16px 18px;
  border-bottom:1px solid var(--line); background:#fff
}
.notification-panel-head>div{display:flex;flex-direction:column;gap:2px}
.notification-panel-head strong{font-size:16px}
.notification-panel-head span{font-size:12px;color:var(--muted)}
.notification-list{max-height:520px;overflow:auto;overscroll-behavior:contain}
.notification-item{
  width:100%; display:flex; align-items:flex-start; gap:12px; padding:14px 16px; border:0; border-bottom:1px solid #eef1ef;
  background:#fff; text-align:left; cursor:pointer; color:inherit
}
.notification-item:hover{background:#f8faf9}
.notification-item.unread{background:#f0fdf4}
.notification-item.unread .notification-copy strong::after{
  content:''; display:inline-block; width:7px; height:7px; margin-left:7px; border-radius:50%; background:#16a34a; vertical-align:1px
}
.notification-icon{
  width:36px; height:36px; border-radius:11px; background:#f3f7f4; display:grid; place-items:center; flex:0 0 auto; font-size:17px
}
.notification-copy{display:flex;flex-direction:column;gap:3px;min-width:0}
.notification-copy strong{font-size:13px}
.notification-copy span{font-size:12px;line-height:1.4;color:#475569}
.notification-copy small{font-size:11px;color:#94a3b8}
.notification-empty{padding:34px 18px;text-align:center;color:var(--muted);font-size:13px}
.driver-notification-panel{top:74px;right:max(16px,calc((100vw - 680px)/2 + 16px))}
@media(max-width:820px){
  .desktop-admin-topbar .notification-bell{display:none}
  .mobile-admin-header{justify-content:space-between}
  .mobile-notification-bell{margin-left:auto;flex:0 0 auto}
  .notification-bell{width:40px;height:40px;border-radius:12px}
  .notification-panel,.driver-notification-panel{
    top:72px; right:10px; left:10px; width:auto; max-height:calc(100dvh - 92px); border-radius:16px
  }
  .notification-list{max-height:calc(100dvh - 160px)}
  .driver-header-actions{gap:8px}
}

.add-stop-bottom{margin-top:14px;border-style:dashed;min-height:44px}

/* Entregas recolhíveis v6.4 */
.delivery-row{overflow:hidden}
.delivery-row-head{display:flex;align-items:center;gap:10px;padding:14px 16px}
.delivery-collapse-trigger{flex:1;min-width:0;border:0;background:transparent;display:flex;align-items:center;gap:12px;text-align:left;cursor:pointer;color:inherit;padding:0}
.delivery-stop-number{font-weight:900;white-space:nowrap}
.delivery-collapse-summary{display:flex;flex-direction:column;gap:2px;min-width:0}
.delivery-collapse-summary strong{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.delivery-collapse-summary small{font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.delivery-chevron{margin-left:auto;font-size:18px;color:var(--muted);flex:0 0 auto}
.delivery-row-body{padding:0 16px 16px}
.delivery-row.collapsed .delivery-row-head{background:#fbfcfb}
.delivery-row.collapsed{border-color:#e4e9e5}
.delivery-row.expanded{box-shadow:0 8px 24px rgba(15,23,42,.05)}
@media(max-width:820px){
 .delivery-row-head{padding:12px}
 .delivery-row-body{padding:0 12px 12px}
 .delivery-collapse-trigger{align-items:flex-start}
 .delivery-stop-number{font-size:13px}
}

/* Controles de edição/minimização v6.5 */
.delivery-head-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}
.delivery-toggle-button{
  width:34px;height:34px;border:1px solid var(--line);border-radius:10px;background:#fff;
  display:grid;place-items:center;font-size:22px;font-weight:800;line-height:1;cursor:pointer;color:var(--text)
}
.delivery-toggle-button:hover{background:#f7faf8}
.delivery-collapse-trigger{cursor:default}
@media(max-width:820px){
  .delivery-row-head{align-items:flex-start}
  .delivery-head-actions{gap:6px}
  .delivery-toggle-button{width:32px;height:32px;border-radius:9px}
}

/* Aprovação de rotas v6.6 */
.status-waiting-approval{background:#fff7ed;color:#c2410c;border:1px solid #fed7aa}
.status-rejected{background:#fef2f2;color:#b91c1c;border:1px solid #fecaca}
.route-approval-modal{text-align:center}
.route-approval-icon{width:58px;height:58px;border-radius:18px;background:#ecfdf3;display:grid;place-items:center;font-size:28px;margin:0 auto 12px}
.route-approval-modal>p{color:var(--muted);margin-top:-4px}
.route-approval-card{text-align:left;margin-top:18px;padding:18px;border:1px solid var(--line);border-radius:16px;background:#fbfcfb}
.route-approval-card>strong{display:block;font-size:18px;margin-bottom:14px}
.route-approval-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.route-approval-grid>div,.route-approval-origin{padding:10px 12px;border-radius:12px;background:#fff;border:1px solid #edf1ee}
.route-approval-grid span,.route-approval-origin span{display:block;font-size:11px;color:var(--muted);margin-bottom:3px}
.route-approval-grid b,.route-approval-origin strong{font-size:13px}
.route-approval-origin{margin-top:10px}
.route-approval-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:18px}
@media(max-width:620px){.route-approval-actions{grid-template-columns:1fr}.route-approval-grid{grid-template-columns:1fr 1fr}}

/* Gerenciamento simples de rotas v6.7 */
.route-manager-bar{
  display:flex;align-items:center;justify-content:space-between;gap:18px;
  padding:16px 18px;margin-bottom:18px;border:1px solid #dfe7e1;border-radius:18px;background:#f8fbf9
}
.route-manager-bar>div:first-child{display:flex;flex-direction:column;gap:3px;min-width:170px}
.route-manager-bar>div:first-child strong{font-size:15px}
.route-manager-bar>div:first-child span{font-size:12px;color:var(--muted)}
.route-manager-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;flex:1}
.route-manager-action{
  display:grid;grid-template-columns:34px 1fr;grid-template-rows:auto auto;column-gap:10px;
  align-items:center;text-align:left;padding:12px;border:1px solid var(--line);border-radius:14px;background:#fff;color:var(--text);cursor:pointer
}
.route-manager-action:hover{border-color:#86b996;background:#f5fbf7}
.route-manager-action>span{grid-row:1/3;width:34px;height:34px;border-radius:10px;background:#eaf7ee;display:grid;place-items:center;font-size:19px;font-weight:900;color:#176b38}
.route-manager-action>b{font-size:13px}
.route-manager-action>small{font-size:11px;color:var(--muted);margin-top:2px}
.simple-route-modal>h2{margin:8px 0 4px}
.simple-route-modal>p{margin:0 0 18px;color:var(--muted);line-height:1.45}
.edit-route-options{display:grid;gap:9px}
.edit-route-option{width:100%;display:grid;grid-template-columns:42px 1fr 20px;align-items:center;gap:11px;padding:12px 13px;border:1px solid var(--line);border-radius:14px;background:#fff;color:var(--text);text-align:left;cursor:pointer}
.edit-route-option:hover{border-color:#86b996;background:#f5fbf7}
.edit-route-option>span{width:42px;height:42px;border-radius:12px;background:#eaf7ee;color:#176b38;display:grid;place-items:center;font-size:20px;font-weight:900}
.edit-route-option>div{display:flex;flex-direction:column;gap:3px;min-width:0}
.edit-route-option strong{font-size:14px}
.edit-route-option small{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.edit-route-option>b{font-size:24px;color:#789086;font-weight:500;text-align:right}
.modal-intro-icon{width:50px;height:50px;border-radius:16px;background:#eaf7ee;display:grid;place-items:center;font-size:24px;color:#176b38}
.stop-type-picker{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.stop-type-option{border:1px solid var(--line);border-radius:12px;background:#fff;padding:10px 8px;font-weight:700;cursor:pointer}
.stop-type-option.active{border-color:#20814a;background:#edf9f0;color:#176b38}
.saved-stop-address-option{display:flex;align-items:center;gap:10px;padding:12px 13px;border:1px solid var(--line);border-radius:12px;background:#f8fbf9;cursor:pointer}
.saved-stop-address-option input{width:18px;height:18px;accent-color:#176b38;flex:none}
.saved-stop-address-option span{font-size:13px;line-height:1.35}
.modal-action-stack{display:grid;gap:8px;margin-top:8px}
.split-helper{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:16px 0 8px}
.split-helper span{font-size:12px;color:var(--muted)}
.split-stop-list{display:grid;gap:8px;max-height:320px;overflow:auto;padding-right:2px}
.split-stop-option{display:grid;grid-template-columns:22px 36px 1fr;align-items:center;gap:10px;padding:11px;border:1px solid var(--line);border-radius:13px;background:#fff;cursor:pointer}
.split-stop-option:has(input:checked){border-color:#57a66e;background:#f1faf4}
.split-stop-option input{width:18px;height:18px}
.split-stop-number{width:34px;height:34px;border-radius:10px;background:#eaf7ee;display:grid;place-items:center;font-weight:900;color:#176b38}
.split-stop-option>span:last-child{display:flex;flex-direction:column;gap:2px;min-width:0}
.split-stop-option strong{font-size:13px}
.split-stop-option small{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.split-config-grid{margin-top:14px}
.stop-title-line{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.stop-title-line h4{margin:0}
.extra-stop-badge{display:inline-flex;align-items:center;padding:3px 7px;border-radius:999px;background:#eef6ff;color:#1d4ed8;font-size:10px;font-weight:800}
@media(max-width:820px){
  .route-manager-bar{display:block;padding:14px;margin-bottom:14px}
  .route-manager-bar>div:first-child{margin-bottom:10px}
  .route-manager-actions{grid-template-columns:1fr}
  .route-manager-action{min-height:58px}
  .stop-type-picker{grid-template-columns:1fr 1fr}
  .simple-route-modal{padding-bottom:6px}
  .split-stop-list{max-height:42vh}
}

/* Rota estilo app de navegação v6.8 */
.route-detail-page{position:relative}
.route-map-stage{position:relative;margin-bottom:18px}
.route-main-map{min-height:520px;border-radius:20px}
.route-map-top-controls,.route-map-bell,.route-directions-card{display:none}
.route-bottom-sheet{background:transparent}
.route-sheet-handle{display:none}
.route-sheet-summary{
  display:flex;align-items:flex-start;justify-content:space-between;gap:18px;
  padding:18px 20px;margin-bottom:16px;border:1px solid var(--line);border-radius:18px;background:#fff;
  box-shadow:0 8px 28px rgba(20,32,26,.04)
}
.route-sheet-summary>div:first-child{display:flex;flex-direction:column;gap:4px}
.route-sheet-time{font-size:28px;letter-spacing:-.045em}
.route-sheet-summary span{color:var(--muted);font-size:13px}
.route-sheet-summary small{color:var(--muted);font-size:12px}
.route-google-actions{display:flex;gap:10px;overflow:auto;padding:0 0 16px;scrollbar-width:none}
.route-google-actions::-webkit-scrollbar{display:none}
.route-google-action{
  border:1px solid var(--line);background:#fff;color:var(--text);border-radius:999px;
  min-height:46px;padding:9px 16px;display:inline-flex;align-items:center;gap:8px;white-space:nowrap;
  font-weight:800;box-shadow:0 1px 2px rgba(15,23,42,.03)
}
.route-google-action>span{font-size:20px;line-height:1}
.route-google-action.primary{background:var(--primary);color:#fff;border-color:var(--primary)}
.route-stops-section{border:1px solid var(--line);border-radius:18px;background:#fff;padding:18px}
.route-stops-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.route-stops-head h3{margin:0;font-size:20px}
.route-stops-head p{margin:3px 0 0;color:var(--muted);font-size:12px}
.route-stops-head>span{display:inline-flex;align-items:center;justify-content:center;min-width:42px;height:28px;padding:0 9px;border-radius:999px;background:#f1f5f2;color:var(--muted);font-size:12px;font-weight:800}
.route-sheet-error{margin-bottom:16px}
.route-direction-dot{width:10px;height:10px;border-radius:50%;display:block;flex:0 0 10px}
.route-direction-dot.origin{background:#4285f4}
.route-direction-dot.destination{border:3px solid #ea4335;background:#fff;width:12px;height:12px;flex-basis:12px}
.route-direction-row{display:flex;gap:12px;align-items:center}
.route-direction-row>div{min-width:0;display:flex;flex-direction:column}
.route-direction-row small{font-size:10px;color:#7b8790}
.route-direction-row strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.route-direction-line{width:0;height:15px;border-left:2px dotted #9aa0a6;margin:2px 0 2px 4px}
.route-map-circle{border:0;background:#fff;color:#263238;width:42px;height:42px;border-radius:50%;display:grid;place-items:center;font-size:20px;font-weight:800;box-shadow:0 3px 12px rgba(0,0,0,.18)}
.route-map-bell .notification-bell{box-shadow:0 3px 12px rgba(0,0,0,.18);border:0;border-radius:50%}
.route-detail-page .leaflet-control-zoom a{border-radius:10px!important}
.route-detail-page .leaflet-control-attribution{font-size:9px!important}

@media(max-width:820px){
  .main:has(.route-detail-page) .mobile-admin-header{display:none}
  .main:has(.route-detail-page) .content{padding:0 0 max(20px,env(safe-area-inset-bottom));overflow:visible}
  .route-detail-page{background:#fff;min-height:100dvh}
  .route-desktop-head,.route-desktop-stats{display:none}
  .route-map-stage{height:56dvh;min-height:390px;margin:0;background:#e9efeb;overflow:hidden}
  .route-main-map{position:absolute;inset:0;width:100%;height:100%;min-height:0;border:0;border-radius:0}
  .route-map-top-controls{display:flex;position:absolute;z-index:500;top:calc(12px + env(safe-area-inset-top));left:12px;gap:8px}
  .route-map-bell{display:block;position:absolute;z-index:500;top:calc(12px + env(safe-area-inset-top));right:12px}
  .route-directions-card{
    display:block;position:absolute;z-index:450;top:calc(64px + env(safe-area-inset-top));left:12px;right:12px;
    padding:11px 14px;border-radius:16px;background:rgba(255,255,255,.96);box-shadow:0 4px 18px rgba(0,0,0,.18);
    backdrop-filter:blur(12px)
  }
  .route-map-stage .leaflet-top.leaflet-left{top:auto;bottom:24px;left:8px}
  .route-map-stage .leaflet-control-zoom{margin:0!important;border:0!important;box-shadow:0 3px 12px rgba(0,0,0,.15)!important;border-radius:12px!important;overflow:hidden}
  .route-map-stage .leaflet-control-zoom a{width:38px;height:38px;line-height:38px;border-radius:0!important}
  .route-bottom-sheet{
    position:relative;z-index:550;margin-top:-24px;padding:8px 14px 24px;background:#fff;
    border-radius:24px 24px 0 0;box-shadow:0 -6px 24px rgba(15,23,42,.12)
  }
  .route-sheet-handle{display:block;width:44px;height:5px;border-radius:99px;background:#d6dbd8;margin:2px auto 14px}
  .route-sheet-summary{border:0;border-radius:0;box-shadow:none;padding:0 2px 14px;margin:0;align-items:flex-start}
  .route-sheet-time{font-size:31px;line-height:1;color:#137333}
  .route-sheet-status{padding-top:2px}
  .route-google-actions{margin:0 -14px;padding:0 14px 16px;gap:10px}
  .route-google-action{min-height:48px;padding:9px 15px;background:#f7f9f8}
  .route-google-action.primary{background:#0f7b6c;border-color:#0f7b6c}
  .route-stops-section{padding:0;border:0;border-radius:0}
  .route-stops-head{padding:2px 2px 12px;margin:0}
  .route-stops-head h3{font-size:22px}
  .route-stops-section .stop-list{gap:10px}
  .route-stops-section .stop-card{
    grid-template-columns:42px minmax(0,1fr);padding:14px 12px;border-radius:18px;border-color:#e2e6e3;
    box-shadow:0 1px 2px rgba(15,23,42,.02)
  }
  .route-stops-section .stop-number{width:38px;height:38px;border-radius:50%;background:#e6f4ea;color:#137333}
  .route-stops-section .stop-actions{grid-column:2;display:flex;align-items:center;justify-content:flex-start;min-width:0;margin-top:4px}
  .route-stops-section .stop-card h4{font-size:16px}
  .route-stops-section .stop-card p{font-size:13px;line-height:1.35}
  .route-stops-section .stop-meta{font-size:12px;margin-top:8px}
  .route-sheet-error{margin:0 0 14px}
  .notification-panel{z-index:1600}
}

@media(max-width:430px){
  .route-map-stage{height:53dvh;min-height:365px}
  .route-directions-card{top:calc(60px + env(safe-area-inset-top))}
  .route-sheet-summary{gap:10px}
  .route-sheet-time{font-size:28px}
  .route-sheet-summary span{font-size:12px}
  .route-sheet-summary small{font-size:11px}
  .route-google-action{padding:8px 13px}
  .route-google-action b{font-size:12px}
}

/* Marcadores mais familiares em navegação */
.route-detail-page .marker-pending,
.route-detail-page .marker-next,
.route-detail-page .marker-delivered,
.route-detail-page .marker-problem{
  border-radius:50%;
  transform:none;
}
.route-detail-page .marker-pending span,
.route-detail-page .marker-next span,
.route-detail-page .marker-delivered span,
.route-detail-page .marker-problem span{
  transform:none;
}
.route-detail-page .marker-pending{background:#1a73e8}
.route-detail-page .marker-next{background:#1a73e8;box-shadow:0 0 0 4px rgba(26,115,232,.18),0 5px 14px rgba(0,0,0,.22)}

/* Reordenação por arrastar v6.9 */
.stop-order-control{
  width:42px;display:flex;flex-direction:column;align-items:center;gap:6px;align-self:start
}
.route-stop-drag-handle{
  width:38px;height:26px;border:0;border-radius:9px;background:#f1f4f2;color:#64736b;
  display:grid;place-items:center;font-size:22px;font-weight:900;line-height:1;cursor:grab;
  touch-action:none;-webkit-user-select:none;user-select:none
}
.route-stop-drag-handle:active{cursor:grabbing}
.route-stop-drag-handle:disabled{opacity:.45;cursor:wait}
.route-stop-reorderable{transition:transform .14s ease,box-shadow .14s ease,border-color .14s ease}
.route-stop-dragging-card{
  position:relative;z-index:20;border-color:#1a73e8!important;
  box-shadow:0 12px 32px rgba(26,115,232,.18)!important;
  transform:scale(1.012);background:#fff!important
}
.route-stop-dragging-list .stop-card:not(.route-stop-dragging-card){transition:transform .12s ease}
.route-stop-drag-active{user-select:none;-webkit-user-select:none}
.route-recalculating{position:relative;pointer-events:none;opacity:.72}
.route-recalculating::after{
  content:'Recalculando rota...';position:sticky;bottom:16px;display:block;width:max-content;max-width:90%;
  margin:14px auto 0;padding:9px 14px;border-radius:999px;background:#14201a;color:#fff;
  font-size:12px;font-weight:800;box-shadow:0 8px 22px rgba(0,0,0,.16);z-index:30
}
@media(max-width:820px){
  .route-stops-section .stop-card{grid-template-columns:42px minmax(0,1fr)}
  .stop-order-control{width:38px}
  .route-stop-drag-handle{width:36px;height:25px}
  .route-stops-head p{max-width:300px;line-height:1.35}
}

/* Reordenar rota por botão v6.10 */
.reorder-route-list{display:grid;gap:8px;max-height:48vh;overflow:auto;padding:2px}
.reorder-route-item{
  display:grid;grid-template-columns:38px minmax(0,1fr) auto;gap:10px;align-items:center;
  padding:11px 12px;border:1px solid var(--line);border-radius:14px;background:#fff
}
.reorder-route-number{
  width:36px;height:36px;border-radius:50%;display:grid;place-items:center;
  background:#e8f5ec;color:#176b38;font-weight:900
}
.reorder-route-copy{display:flex;flex-direction:column;gap:3px;min-width:0}
.reorder-route-copy strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.reorder-route-copy small{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.reorder-route-controls{display:flex;gap:6px}
.reorder-arrow{
  width:38px;height:38px;border:1px solid var(--line);border-radius:11px;background:#f8faf9;
  display:grid;place-items:center;font-size:18px;font-weight:900;color:var(--text);cursor:pointer
}
.reorder-arrow:disabled{opacity:.28;cursor:not-allowed}
.reorder-arrow:not(:disabled):active{transform:scale(.96)}
@media(max-width:620px){
  .reorder-route-item{grid-template-columns:34px minmax(0,1fr) auto;padding:10px}
  .reorder-route-number{width:32px;height:32px}
  .reorder-arrow{width:36px;height:36px}
}

/* Reordenar dentro do modal por arrastar v6.11 */
.reorder-route-item{grid-template-columns:38px minmax(0,1fr) 42px}
.reorder-drag-handle{
  width:40px;height:40px;border:1px solid var(--line);border-radius:12px;background:#f7f9f8;
  display:grid;place-items:center;font-size:24px;font-weight:900;color:#5b6a62;cursor:grab;
  touch-action:none;-webkit-user-select:none;user-select:none
}
.reorder-drag-handle:active{cursor:grabbing}
.reorder-route-item-dragging{
  position:relative;z-index:20;border-color:#1a73e8!important;
  box-shadow:0 12px 28px rgba(26,115,232,.20)!important;
  transform:scale(1.015);background:#fff!important
}
.reorder-route-list-dragging{user-select:none;-webkit-user-select:none}
@media(max-width:620px){
  .reorder-route-item{grid-template-columns:34px minmax(0,1fr) 40px}
  .reorder-drag-handle{width:38px;height:38px}
}

/* Reordenar confiável desktop + mobile v6.12 */
.reorder-route-list{
  overflow-y:auto!important;
  overflow-x:hidden!important;
  width:100%;
  max-width:100%;
}
.reorder-route-item{
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  cursor:grab;
  -webkit-user-select:none;
  user-select:none;
}
.reorder-route-item:active{cursor:grabbing}
.reorder-route-copy{min-width:0}
.reorder-drag-handle{
  flex:0 0 auto;
  cursor:grab;
  touch-action:none!important;
  overscroll-behavior:none;
  -webkit-touch-callout:none;
}
.reorder-route-item-dragging{
  opacity:.92;
  cursor:grabbing!important;
}
.reorder-route-list-dragging{
  cursor:grabbing;
  overscroll-behavior:contain;
}

/* Confirmação de entrega nas rotas recebidas v6.13 */
.route-delivered-button{
  margin-top:8px;
  border-radius:999px;
  min-width:92px;
  font-weight:900;
}
.complete-delivery-modal>h2{margin:8px 0 4px}
.complete-delivery-modal>p{margin:0 0 18px;color:var(--muted);line-height:1.45}
.optional-label{
  display:inline-flex;
  margin-left:6px;
  padding:2px 7px;
  border-radius:999px;
  background:#f1f4f2;
  color:var(--muted);
  font-size:10px;
  font-weight:800;
  vertical-align:middle;
}
.proof-photo-input{padding:9px}
.proof-photo-preview{
  display:grid;
  grid-template-columns:64px minmax(0,1fr);
  gap:10px;
  align-items:center;
  margin-top:9px;
  padding:9px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#f8faf9;
}
.proof-photo-preview img{
  width:64px;
  height:64px;
  object-fit:cover;
  border-radius:9px;
  background:#e9eeeb;
}
.proof-photo-preview>div{display:flex;flex-direction:column;gap:3px;min-width:0}
.proof-photo-preview strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.proof-photo-preview small{font-size:10px;color:var(--muted)}
@media(max-width:820px){
  .route-stops-section .stop-actions{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
  }
  .route-delivered-button{
    min-height:38px;
    padding:8px 14px;
    margin-top:0;
  }
}

/* Cards de pedido simplificados + detalhes em tela cheia v6.14 */
.route-order-card{cursor:pointer}
.route-order-card:focus-visible{outline:3px solid rgba(26,115,232,.22);outline-offset:2px}
.route-order-main{min-width:0}
.route-order-address{margin-top:4px}
.route-order-product{margin-top:8px}
.route-order-phone{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  margin:9px 0;padding:9px 10px;border-radius:12px;background:#f0f7ff;border:1px solid #d8e8ff
}
.route-order-phone a{
  display:inline-flex;align-items:center;gap:7px;min-width:0;color:#0b57d0;text-decoration:none;font-weight:900
}
.route-order-phone a strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.route-order-phone button{
  border:0;border-radius:9px;padding:7px 10px;background:#fff;color:#0b57d0;font-size:11px;font-weight:900;
  box-shadow:0 0 0 1px #cbdcf6 inset;cursor:pointer
}
.route-order-observation{
  margin-top:8px!important;padding:8px 10px;border-radius:10px;background:#fff8e6;color:#6c4b08
}
.delivery-fullscreen-card{width:min(760px,100%)}
.delivery-full-detail{padding-top:4px}
.delivery-full-header{display:flex;gap:14px;align-items:flex-start;padding-right:42px}
.delivery-full-header>div:last-child{min-width:0}
.delivery-full-header h2{margin:7px 0 3px!important;font-size:26px}
.delivery-full-header p{margin:0;color:var(--muted);font-size:12px}
.delivery-detail-phone{
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  margin:20px 0;padding:14px 16px;border-radius:16px;background:#eef6ff;border:1px solid #d6e7ff
}
.delivery-detail-phone>div{display:flex;flex-direction:column;gap:3px;min-width:0}
.delivery-detail-phone small{color:#61758d;font-size:11px}
.delivery-detail-phone a{color:#0b57d0;font-size:19px;font-weight:900;text-decoration:none}
.delivery-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.delivery-detail-field{
  padding:13px 14px;border:1px solid var(--line);border-radius:13px;background:#fbfcfb;
  display:flex;flex-direction:column;gap:4px
}
.delivery-detail-field.field-full{grid-column:1/-1}
.delivery-detail-field span{font-size:11px;color:var(--muted)}
.delivery-detail-field strong{font-size:14px;line-height:1.4}
.delivery-detail-observation{background:#fff9e9;border-color:#f2dfaa}
.delivery-full-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:18px}
@media(max-width:820px){
  .route-order-card{cursor:pointer}
  .route-order-phone{margin:8px 0 9px;padding:9px 10px}
  .route-order-phone a{font-size:14px}
  .delivery-fullscreen-card{
    position:fixed!important;inset:0!important;width:100%!important;height:100dvh!important;
    max-width:none!important;max-height:none!important;border-radius:0!important;
    padding:calc(22px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom))!important;
    overflow-y:auto!important
  }
  .delivery-fullscreen-card .modal-close{top:calc(12px + env(safe-area-inset-top));right:12px;z-index:4}
  .delivery-detail-grid{grid-template-columns:1fr}
  .delivery-detail-field.field-full{grid-column:auto}
  .delivery-full-actions{grid-template-columns:1fr;position:sticky;bottom:0;padding-top:12px;background:linear-gradient(transparent,#fff 24%)}
  .delivery-full-header h2{font-size:24px}
}

/* Pedidos expandir/minimizar + telefone discreto v6.15 */
.route-order-card{cursor:default!important}
.route-order-shell{min-width:0}
.route-order-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.route-order-headcopy{min-width:0;flex:1}
.route-order-toggle{
  width:34px;
  height:34px;
  flex:0 0 34px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#f7f9f8;
  color:var(--text);
  font-size:23px;
  font-weight:700;
  line-height:1;
  display:grid;
  place-items:center;
  cursor:pointer;
}
.route-order-toggle:active{transform:scale(.96)}
.route-order-details{display:block}
.route-order-card.is-collapsed .route-order-details{display:none}
.route-order-card.is-collapsed{padding-bottom:13px}
.route-order-phone{
  display:flex!important;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  margin:8px 0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
}
.route-order-phone a{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:var(--muted)!important;
  font-size:13px!important;
  font-weight:700!important;
  text-decoration:none;
}
.route-order-phone a span{font-size:12px;opacity:.75}
.route-order-phone button{
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  color:#486256!important;
  padding:3px 5px!important;
  font-size:10px!important;
  font-weight:800!important;
  text-decoration:underline;
  text-underline-offset:2px;
}
@media(max-width:820px){
  .route-order-header{gap:8px}
  .route-order-toggle{
    width:32px;
    height:32px;
    flex-basis:32px;
    border-radius:9px;
    font-size:21px;
  }
  .route-order-card.is-collapsed{padding-bottom:12px}
  .route-order-phone a{font-size:12px!important}
}
