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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  overflow-x: hidden;
}


/* LAYOUT */
.page { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  background: #1e293b;
  padding: .75rem max(1.5rem, calc(50% - 700px + 1.5rem));
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
}
.page-title { font-size: 1.4rem; font-weight: 700; color: #f1f5f9; }
.page-header .btn-ghost {
  border-color: rgba(255,255,255,.22);
  color: #cbd5e1;
  background: transparent;
}
.page-header .btn-ghost:hover {
  background: rgba(255,255,255,.09);
  color: #fff;
  border-color: rgba(255,255,255,.35);
}

/* CARDS */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.card-header {
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--gray-800);
}

/* GRID STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  border-left: 4px solid var(--primary);
}
.stat-card.green { border-color: var(--success); }
.stat-card.yellow { border-color: var(--warning); }
.stat-card.red { border-color: var(--danger); }
.stat-label { font-size: .78rem; color: var(--gray-600); margin-bottom: .3rem; }
.stat-value { font-size: 1.8rem; font-weight: 700; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: filter .15s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(.92); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-ghost   { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

/* FORMS */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .35rem; }
.form-control {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }

/* TABLE */
.table-wrapper { overflow-x: auto; width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.fixed-layout { table-layout: fixed; }
th { background: var(--gray-50); text-align: left; padding: .65rem .9rem; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--gray-600); border-bottom: 1px solid var(--gray-200); }
td { padding: .65rem .9rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* BADGES */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 9999px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* SEARCH BAR */
.search-bar {
  display: flex;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.search-bar .form-control { max-width: 320px; }

/* ALERTS */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* MODAL */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
}
.modal-body { padding: 1.25rem; }
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: .75rem;
}
.btn-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--gray-400); line-height: 1; }
.btn-close:hover { color: var(--gray-800); }

/* HORARIO GRID */
.horario-grid { display: grid; gap: .6rem; }
.horario-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr 1fr;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
}
.horario-row label { font-weight: 500; }
.horario-row input[type=time] {
  padding: .3rem .5rem;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  font-size: .85rem;
}
.horario-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* CLIENTE SELECTOR */
.cliente-selector { max-height: 380px; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: var(--radius); }
.cliente-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background .1s;
}
.cliente-item:last-child { border-bottom: none; }
.cliente-item:hover { background: var(--gray-50); }
.cliente-item.selected { background: #eff6ff; }
.cliente-item input[type=checkbox] { width: 16px; height: 16px; flex-shrink: 0; }
.cliente-item-info { flex: 1; min-width: 0; }
.cliente-item-nombre { font-weight: 500; font-size: .875rem; }
.cliente-item-dir { font-size: .78rem; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cliente-item-horario { font-size: .75rem; color: var(--primary); white-space: nowrap; }
.cliente-item-warn { font-size: .75rem; color: var(--warning); }

/* RUTA PANEL */
.ruta-layout { display: grid; grid-template-columns: 360px 1fr; gap: 1rem; height: calc(100vh - 100px); }
.ruta-sidebar { overflow-y: auto; }
.ruta-map { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.parada-item {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background .1s;
}
.parada-item:hover { background: var(--gray-50); }
.parada-item.visitado { opacity: .6; }
.parada-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: .8rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.parada-num.visitado-num { background: var(--success); }
.parada-num.no-entregado-num { background: var(--danger); }
.parada-info { flex: 1; min-width: 0; }
.parada-nombre { font-weight: 600; font-size: .875rem; }
.parada-dir { font-size: .78rem; color: var(--gray-600); }
.parada-meta { display: flex; gap: .75rem; margin-top: .25rem; flex-wrap: wrap; }
.parada-eta { font-size: .78rem; color: var(--primary); font-weight: 500; }
.parada-ventana { font-size: .78rem; color: var(--gray-600); }
.parada-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-400); }
.empty-state-icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; }

/* LOADING */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* UPLOAD ZONE */
.upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}
.upload-zone p { color: var(--gray-600); font-size: .875rem; margin-top: .5rem; }

/* HORARIO COMPACTO (tabla de clientes) */
.horario-compacto {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: default;
}
.horario-chips-fila {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.horario-chip {
  background: #dbeafe;
  color: #1d4ed8;
  font-size: .68rem;
  font-weight: 700;
  padding: .1rem .3rem;
  border-radius: 3px;
  white-space: nowrap;
}
.horario-hora-fila {
  font-size: .73rem;
  color: #374151;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  line-height: 1.3;
}
.horario-hora-item {
  white-space: nowrap;
  background: #f3f4f6;
  border-radius: 3px;
  padding: .05rem .25rem;
}
.horario-sin-hora {
  color: var(--gray-400);
  font-style: italic;
}

/* BULK TOOLBAR */
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 1rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  margin-bottom: .75rem;
  font-size: .875rem;
}
.bulk-toolbar .bulk-count { font-weight: 600; color: #1d4ed8; }


/* ── RESPONSIVE — tablet ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ruta-layout { grid-template-columns: 1fr; height: auto; }
  .ruta-map { height: 320px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .horario-row { grid-template-columns: 80px 1fr 1fr auto; }
}

/* ── RESPONSIVE — mobile ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* Page */
  .page { padding: .65rem .75rem; }
  .page-title { font-size: 1.15rem; }

  /* Icon-only buttons on mobile */
  .hdr-ico { display: none; }

  /* Page header: hamburger+title row 1, buttons row 2 */
  .page-header { justify-content: flex-start; padding: .6rem .9rem; gap: .5rem; }
  .page-header .page-title { flex: 1; }
  .page-header > div { flex: 0 0 100%; }
  .hdr-lbl { display: none; }
  .hdr-ico { display: inline; font-size: 1rem; }
  .page-header > div .btn { font-size: .92rem; padding: .5rem .85rem; }
  #btn-nuevo-cli { margin-left: auto; }

  /* Table scroll indicator (right shadow) */
  .table-wrapper {
    position: relative;
    background:
      linear-gradient(to right, white 30%, rgba(255,255,255,0)),
      linear-gradient(to right, rgba(255,255,255,0), white 70%) 100% 0,
      linear-gradient(to right, rgba(0,0,0,.1), rgba(0,0,0,0)),
      linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,.1)) 100% 0;
    background-repeat: no-repeat;
    background-size: 30px 100%, 30px 100%, 8px 100%, 8px 100%;
    background-attachment: local, local, scroll, scroll;
  }

  /* Cards */
  .card { padding: .85rem .9rem; }

  /* Forms */
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .horario-row { grid-template-columns: 75px 1fr 1fr auto; gap: .3rem; font-size: .8rem; }

  /* Modals — bottom sheet */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
  }

  /* Tables */
  .table-wrapper { -webkit-overflow-scrolling: touch; }
  th, td { padding: .5rem .6rem; font-size: .8rem; }

  /* ── Card table layout ────────────────────────────────────────────────────── */
  .card-table thead { display: none; }
  .card-table tbody tr:not(.day-header):not(.rep-header):not(.col-header) {
    display: block;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: .5rem;
    margin-bottom: .6rem;
    padding: .4rem .7rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
  }
  .card-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: .3rem 0;
    border-bottom: 1px solid #f3f4f6;
    gap: .5rem;
    font-size: .82rem;
    white-space: normal !important;
  }
  .card-table td:last-child { border-bottom: none; }
  .card-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    flex-shrink: 0;
    min-width: 36%;
    padding-right: .4rem;
    padding-top: .05rem;
  }
  .card-table td[data-label=""]::before { display: none; }
  .card-table td[data-label=""] { justify-content: flex-end; flex-wrap: wrap; gap: .3rem; }
  .card-table td[colspan] { display: block; text-align: center; }
  /* Cobranzas: day/rep headers como bloques (no table-row — evita scroll horizontal) */
  .cob-table .day-header,
  .cob-table .rep-header { display: block !important; padding: 0; margin-bottom: .3rem; border-radius: .4rem; }
  .cob-table .day-header td,
  .cob-table .rep-header td { display: block !important; padding: .45rem .7rem; border-bottom: none; }
  .cob-table .day-header td::before,
  .cob-table .rep-header td::before { display: none !important; }
  .cob-table .col-header { display: none !important; }
  /* day-row-inner: anular anchos fijos para que no desborde en mobile */
  .cob-table .day-row-inner { flex-wrap: wrap; gap: .2rem .4rem; width: 100%; }
  .cob-table .day-title { min-width: 0 !important; width: 100%; }
  .cob-table .day-stat { width: auto !important; flex-shrink: 1; white-space: normal !important; }
  .cob-table .rep-header .day-title { min-width: 0 !important; width: 100%; }
  /* Celdas con contenido complejo (multi-div) → card header full-width sin etiqueta */
  .card-table td[data-label="Cliente"] {
    display: block;
    padding-bottom: .5rem;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: .1rem;
  }
  .card-table td[data-label="Cliente"]::before { display: none; }
  /* Reagendamientos: item rows indented */
  .reag-table .item-row { padding-left: 1rem; border-left: 3px solid #e5e7eb; }
  /* Clientes: disable fixed layout on mobile */
  .fixed-layout { table-layout: auto !important; }
  .fixed-layout td[style*="max-width"] { max-width: none !important; overflow: visible !important; white-space: normal !important; text-overflow: clip !important; }

  /* Search bar — force full width on mobile (overrides inline max-width) */
  .search-bar { gap: .5rem; }
  .search-bar .form-control { max-width: 100% !important; width: 100%; }
  .search-bar select.form-control { max-width: 100% !important; width: 100%; }

  /* Bulk toolbar */
  .bulk-toolbar { flex-wrap: wrap; gap: .5rem; padding: .5rem .75rem; font-size: .82rem; }

  /* Ruta layout (ver-ruta) */
  .ruta-layout { grid-template-columns: 1fr; height: auto; }
  .ruta-map { height: 280px; }

  /* Stats grid */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat-value { font-size: 1.4rem; }
}

/* Chat FAB flotante */
#fab-chat {
  position: fixed; bottom: 22px; right: 22px;
  width: 52px; height: 52px; border-radius: 50%;
  background: #2563eb; color: #fff; border: none;
  font-size: 1.35rem; cursor: pointer;
  z-index: 998; box-shadow: 0 4px 14px rgba(37,99,235,.45);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
}
#fab-chat:hover { background: #1d4ed8; transform: scale(1.07); }
#fab-chat #chat-badge {
  position: absolute; top: -3px; right: -3px;
  background: #ef4444; color: #fff; border-radius: 10px;
  padding: 1px 5px; font-size: .7rem; font-weight: 700;
  min-width: 18px; text-align: center; line-height: 16px;
  pointer-events: none;
}

/* Chat panel */
#chat-panel {
  position: fixed; right: 0; top: 0; height: 100vh; width: 340px;
  background: #fff; box-shadow: -4px 0 16px rgba(0,0,0,.15);
  z-index: 1000; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
}
#chat-panel.open { transform: translateX(0); }
#chat-panel-header {
  padding: .875rem 1rem; background: #1e293b; color: #f1f5f9;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 1.4rem; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
}
#chat-panel-body { flex: 1; overflow-y: auto; padding: 8px; }
@media (max-width: 600px) { #chat-panel { width: 100vw; } }

/* ════════════════════════════════════════════════════════
   SIDEBAR NAV — App Layout
   ════════════════════════════════════════════════════════ */

.app-layout { display: flex; min-height: 100vh; }

#app-sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: 60px;
  background: #1e293b;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
  transition: width .2s ease;
  box-shadow: 2px 0 12px rgba(0,0,0,.18);
}
#app-sidebar:hover { width: 220px; }

#app-main {
  flex: 1;
  margin-left: 60px;
  transition: margin-left .2s ease;
  min-height: 100vh;
  overflow-x: hidden;
  background: #f1f5f9;
}
#app-sidebar:hover ~ #app-main { margin-left: 220px; }

.sb-brand {
  display: flex; align-items: center; justify-content: center;
  padding: .75rem .5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: 60px; overflow: hidden; flex-shrink: 0;
}
.sb-brand-logo {
  width: 44px; height: auto; display: block;
  filter: brightness(0) invert(1);
  transform: scale(1);
  transition: transform .22s ease;
  object-fit: contain;
}
#app-sidebar:hover .sb-brand-logo { transform: scale(2.2); }
.sb-ver-bottom {
  text-align: center; padding: .3rem 0 .5rem;
  font-size: .58rem; color: rgba(255,255,255,.45);
  letter-spacing: .04em; flex-shrink: 0;
  white-space: nowrap; overflow: hidden;
}
#app-sidebar:hover .sb-ver-bottom {
  text-align: left; padding-left: .9rem;
}

.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .4rem 0; }
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.sb-group-label {
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: rgba(255,255,255,.3);
  padding: .75rem .9rem .2rem; white-space: nowrap; overflow: hidden;
  opacity: 0; transition: opacity .18s ease;
}
#app-sidebar:hover .sb-group-label { opacity: 1; }

.sb-divider { height: 1px; background: rgba(255,255,255,.07); margin: .35rem .6rem; }

.sb-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .5rem .8rem; color: rgba(255,255,255,.72);
  text-decoration: none; font-size: .845rem; font-weight: 500;
  border-radius: 8px; margin: .08rem .45rem;
  cursor: pointer; transition: background .13s, color .13s;
  white-space: nowrap; overflow: hidden; position: relative;
}
.sb-item:hover { background: rgba(255,255,255,.09); color: #fff; }
.sb-item.active { background: #3b82f6; color: #fff; }
.sb-item .sb-icon { font-size: 1.05rem; flex-shrink: 0; width: 28px; text-align: center; }
#app-sidebar:not(:hover) .sb-item { padding: .5rem 0 .5rem .55rem; }
.sb-item .sb-label { white-space: nowrap; }

.sb-item::after {
  content: attr(data-tooltip);
  position: absolute; left: 68px;
  background: #334155; color: #fff; font-size: .77rem;
  padding: .3rem .65rem; border-radius: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transform: translateX(-4px);
  transition: opacity .12s, transform .12s;
  z-index: 300; box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
#app-sidebar:not(:hover) .sb-item:hover::after { opacity: 1; transform: translateX(0); }

.sb-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .7rem .8rem; display: flex; align-items: center;
  gap: .65rem; overflow: hidden; flex-shrink: 0;
}
.sb-user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #3b82f6; color: #fff; font-weight: 700; font-size: .8rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sb-user-name {
  font-size: .78rem; font-weight: 600; color: #fff; white-space: nowrap;
  opacity: 0; transition: opacity .18s ease;
}
.sb-user-role {
  font-size: .68rem; color: rgba(255,255,255,.4); white-space: nowrap;
  opacity: 0; transition: opacity .18s ease;
}
.sb-logout {
  margin-left: auto; font-size: .75rem; color: rgba(255,255,255,.35);
  cursor: pointer; transition: color .13s, opacity .18s ease; flex-shrink: 0;
  background: none; border: none; white-space: nowrap;
  opacity: 0;
}
#app-sidebar:hover .sb-user-name,
#app-sidebar:hover .sb-user-role,
#app-sidebar:hover .sb-logout { opacity: 1; }
.sb-logout:hover { color: #f87171; }

/* ── Mobile nav overlay ──────────────────────────────────────────────────────── */
#sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 250;
  cursor: pointer;
}
#sb-overlay.active { display: block; }
#mob-hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.45rem;
  cursor: pointer;
  line-height: 1;
  padding: .1rem .35rem;
  flex-shrink: 0;
  margin-right: .15rem;
}
#mob-hamburger-float {
  display: none;
  position: fixed;
  top: .7rem; left: .7rem;
  z-index: 400;
  background: rgba(30,41,59,.88);
  border: none; border-radius: 8px;
  color: #fff; font-size: 1.3rem;
  padding: .4rem .65rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}

/* ── Mobile sidebar drawer ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #mob-hamburger { display: block; }
  #mob-hamburger-float { display: block; }
  #app-sidebar {
    transform: translateX(-100%);
    width: 280px;
    transition: transform .25s ease;
    z-index: 300;
  }
  #app-sidebar.sb-open { transform: translateX(0); }
  #app-sidebar:hover { width: 280px; }
  #app-sidebar:hover ~ #app-main { margin-left: 0; }
  #app-sidebar .sb-label,
  #app-sidebar .sb-group-label,
  #app-sidebar .sb-user-name,
  #app-sidebar .sb-user-role,
  #app-sidebar .sb-logout { opacity: 1; }
  #app-sidebar .sb-brand-logo { transform: scale(2.2); }
  #app-sidebar .sb-item { padding: .5rem .8rem; }
  #app-sidebar .sb-item::after { display: none; }
  #app-sidebar .sb-ver-bottom { text-align: left; padding-left: .9rem; }
  #app-main { margin-left: 0; }
}

/* ── Mobile map toggle button ────────────────────────────────────────────────── */
.btn-mob-toggle {
  display: none;
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 500;
  border: none; border-radius: 999px;
  padding: .7rem 1.3rem; font-weight: 700; font-size: .9rem;
  cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.28);
  white-space: nowrap;
}
@media (max-width: 600px) {
  .btn-mob-toggle { display: block; bottom: 5.5rem; }
}
