﻿/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange: #F5A623;
  --orange-dark: #E8941A;
  --red: #E02020;
  --black: #1a1a1a;
  --gray-dark: #2d2d2d;
  --gray: #555;
  --gray-light: #f4f4f4;
  --white: #fff;
  --border: #e0e0e0;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.18);
  --radius: 10px;
  --sidebar-w: 240px;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--gray-light);
  color: var(--black);
  min-height: 100vh;
}

/* ===== LOGIN ===== */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23F5A623' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-card {
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 50px 44px 44px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo img { max-width: 220px; height: auto; }

.login-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray);
  text-align: center;
  margin-bottom: 30px;
  letter-spacing: 0.5px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.97rem;
  color: var(--black);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--orange);
  color: var(--white);
  width: 100%;
  justify-content: center;
  font-size: 1rem;
  padding: 14px;
}

.btn-primary:hover { background: var(--orange-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(245,166,35,0.35); }

.btn-secondary { background: var(--gray-light); color: var(--black); }
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: #ff4d4d; color: var(--white); }
.btn-danger:hover { background: #e03333; }

.btn-success { background: #27ae60; color: var(--white); }
.btn-success:hover { background: #219150; }

.btn-info { background: #2980b9; color: var(--white); }
.btn-info:hover { background: #1f6396; }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }

.login-error {
  background: #fff0f0;
  border: 1.5px solid #ffb3b3;
  color: var(--red);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 18px;
  display: none;
}

.login-footer {
  text-align: center;
  margin-top: 28px;
  font-size: 0.78rem;
  color: #aaa;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  color: var(--black);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  border-right: 1px solid var(--border);
  transition: transform 0.3s;
}

.sidebar-logo {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.sidebar-logo img {
  max-width: 160px;
  height: auto;
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-block;
}

.sidebar-user {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: var(--orange); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section {
  padding: 8px 16px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(0,0,0,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--black);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover { background: var(--gray-light); color: var(--black); }
.nav-item.active { background: rgba(245,166,35,0.12); color: var(--orange-dark); border-left-color: var(--orange); }
.nav-item .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }

/* ===== COLLAPSIBLE SUBMENU ===== */
.nav-group {
  justify-content: flex-start;
  user-select: none;
}
.nav-arrow {
  margin-left: auto;
  font-size: 0.65rem;
  opacity: 0.5;
  transition: transform 0.22s;
  flex-shrink: 0;
}
.nav-group.open .nav-arrow { transform: rotate(180deg); opacity: 0.9; }
.nav-group.open { color: var(--black); }

.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  background: rgba(0,0,0,0.03);
}
.nav-submenu.open { max-height: 200px; }

.nav-sub {
  padding-left: 44px !important;
  font-size: 0.88rem !important;
  font-weight: 600;
  border-left: 3px solid transparent;
  color: var(--black) !important;
}
.nav-sub:hover { color: var(--black) !important; }
.nav-sub.active {
  color: var(--orange-dark) !important;
  border-left-color: var(--orange);
  background: rgba(245,166,35,0.10);
}

.sidebar-bottom {
  padding: 16px;
  border-top: 1px solid var(--border);
}

/* ===== COLAPSAR / EXPANDIR SIDEBAR ===== */
.sidebar-collapse-btn {
  position: absolute;
  top: 18px; right: -13px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #2c2c2c;
  border: none;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 101;
  transition: background 0.15s;
}
.sidebar-collapse-btn:hover { background: #1a1a1a; }

/* Ancho colapsado — sin ningún borde horizontal interno en el sidebar,
   así no coincide por casualidad con un borde del contenido a la derecha */
.app-layout.sidebar-collapsed .sidebar { width: 64px; }
.app-layout.sidebar-collapsed .main-content { margin-left: 64px; }

.app-layout.sidebar-collapsed .sidebar-logo { border-bottom: none; padding: 14px 4px; }
.app-layout.sidebar-collapsed .sidebar-logo img { max-width: 34px; padding: 4px; }
.app-layout.sidebar-collapsed .sidebar-user { padding: 18px 0; justify-content: center; border-bottom: none; }
.app-layout.sidebar-collapsed .sidebar-bottom { padding: 12px 6px; border-top: none; }
.app-layout.sidebar-collapsed .sidebar-bottom .btn { padding: 10px 2px; font-size: 0.68rem; line-height: 1.2; }

.app-layout.sidebar-collapsed .user-info,
.app-layout.sidebar-collapsed .nav-section,
.app-layout.sidebar-collapsed .nav-label,
.app-layout.sidebar-collapsed .nav-arrow,
.app-layout.sidebar-collapsed #btn-activity-log {
  display: none;
}
.app-layout.sidebar-collapsed .nav-item { justify-content: center; padding: 11px 0; gap: 0; }

/* Submenú de grupo (Tráficos) como flyout flotante al lado del ícono */
.app-layout.sidebar-collapsed .sidebar-nav { position: relative; overflow: visible; }
.app-layout.sidebar-collapsed .nav-submenu {
  max-height: 0 !important;
  position: absolute;
  left: 64px;
  width: 180px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 4px 16px rgba(0,0,0,0.18);
  z-index: 150;
}
.app-layout.sidebar-collapsed .nav-submenu.open { max-height: 300px !important; }
.app-layout.sidebar-collapsed .nav-submenu .nav-label { display: inline; }
.app-layout.sidebar-collapsed .nav-submenu .nav-item.nav-sub {
  justify-content: flex-start;
  padding: 11px 16px !important;
  gap: 10px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title h1 { font-size: 1.3rem; font-weight: 700; color: var(--black); }
.topbar-title p { font-size: 0.8rem; color: var(--gray); margin-top: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 28px; flex: 1; }

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-header h3 { font-size: 1rem; font-weight: 700; color: var(--black); }
.card-body { padding: 24px; }

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.orange { background: rgba(245,166,35,0.12); }
.stat-icon.blue { background: rgba(41,128,185,0.12); }
.stat-icon.green { background: rgba(39,174,96,0.12); }
.stat-icon.red { background: rgba(224,32,32,0.12); }

.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--black); }
.stat-label { font-size: 0.8rem; color: var(--gray); margin-top: 2px; }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  background: var(--gray-light);
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray);
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--black);
  vertical-align: middle;
}

tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-admin { background: rgba(224,32,32,0.1); color: var(--red); }
.badge-supervisor { background: rgba(245,166,35,0.15); color: #b37a00; }
.badge-agente { background: rgba(41,128,185,0.12); color: #1a5f8a; }
.badge-operador { background: rgba(39,174,96,0.12); color: #1a7840; }

.badge-activo { background: rgba(39,174,96,0.12); color: #1a7840; }
.badge-inactivo { background: rgba(150,150,150,0.12); color: #777; }

/* ===== TOOLBAR ===== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.search-box input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus { border-color: var(--orange); }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #aaa; font-size: 0.9rem; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--white);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.25s;
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--gray); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--black); }

.modal-body { padding: 26px; }
.modal-footer { padding: 18px 26px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== GRID FORMS ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 44px 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--orange);
  background: rgba(245,166,35,0.04);
}

.upload-zone .upload-icon { font-size: 3rem; margin-bottom: 12px; }
.upload-zone p { color: var(--gray); font-size: 0.92rem; }
.upload-zone span { color: var(--orange); font-weight: 600; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--black);
  color: var(--white);
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  min-width: 260px;
}

.toast.success { background: #27ae60; }
.toast.error { background: var(--red); }
.toast.warning { background: var(--orange); color: var(--black); }

@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tab-btn.active { color: var(--orange); border-bottom-color: var(--orange); }
.tab-btn:hover:not(.active) { color: var(--black); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 14px; }
.empty-state h4 { font-size: 1rem; margin-bottom: 6px; color: var(--black); }
.empty-state p { font-size: 0.85rem; }

/* ===== HAMBURGER BUTTON ===== */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--black);
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.menu-toggle:hover { background: var(--gray-light); }

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ===== RESPONSIVE — TABLET ===== */
@media (max-width: 900px) {
  :root { --sidebar-w: 220px; }
  .page-content { padding: 20px; }
  .topbar { padding: 14px 20px; }
}

/* ===== RESPONSIVE — MÓVIL ===== */
@media (max-width: 768px) {

  /* Sidebar oculto por defecto, desliza desde la izquierda */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
  .sidebar.open { transform: translateX(0); }

  /* El colapsado de escritorio no aplica en mobile (usa el drawer de hamburguesa) */
  .sidebar-collapse-btn { display: none; }
  .app-layout.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
  .app-layout.sidebar-collapsed .main-content { margin-left: 0; }
  .app-layout.sidebar-collapsed .sidebar-logo { border-bottom: 1px solid var(--border); padding: 14px 16px; }
  .app-layout.sidebar-collapsed .sidebar-user { border-bottom: 1px solid var(--border); padding: 18px 20px; justify-content: flex-start; }
  .app-layout.sidebar-collapsed .sidebar-bottom { border-top: 1px solid var(--border); padding: 16px; }
  .app-layout.sidebar-collapsed .sidebar-bottom .btn { padding: 10px; font-size: inherit; }
  .app-layout.sidebar-collapsed .nav-label,
  .app-layout.sidebar-collapsed .nav-arrow { display: inline; }
  .app-layout.sidebar-collapsed .user-info { display: block; }
  .app-layout.sidebar-collapsed .nav-section { display: block; }
  .app-layout.sidebar-collapsed .nav-item { justify-content: flex-start; padding: 11px 20px; gap: 12px; }
  .app-layout.sidebar-collapsed .sidebar-nav { position: static; overflow: hidden auto; }
  .app-layout.sidebar-collapsed .nav-submenu {
    position: static; width: auto; left: auto;
    background: rgba(0,0,0,0.03); border: none; box-shadow: none;
  }
  .app-layout.sidebar-collapsed .nav-submenu.open { max-height: 200px !important; }
  .app-layout.sidebar-collapsed .nav-submenu .nav-item.nav-sub { padding-left: 44px !important; }

  /* Botón hamburguesa visible */
  .menu-toggle { display: flex; align-items: center; justify-content: center; }

  /* Contenido ocupa todo el ancho */
  .main-content { margin-left: 0; }

  /* Topbar compacta */
  .topbar {
    padding: 12px 16px;
    gap: 10px;
  }
  .topbar-title h1 { font-size: 1.05rem; }
  .topbar-title p  { display: none; }
  .topbar-actions  { gap: 8px; flex-wrap: wrap; }

  /* Padding reducido */
  .page-content { padding: 14px; }

  /* Stats: 2 columnas en mobile */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card  { padding: 14px 12px; gap: 10px; }
  .stat-value { font-size: 1.4rem; }
  .stat-icon  { width: 42px; height: 42px; font-size: 1.2rem; }

  /* Formularios en una columna */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Toolbar apilado */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .search-box { max-width: 100%; min-width: unset; }
  .toolbar select,
  .toolbar input[type="date"] { width: 100%; }

  /* Tablas con scroll horizontal */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 0.82rem; min-width: 480px; }
  thead th { padding: 10px 10px; }
  tbody td  { padding: 10px 10px; }

  /* Modales: casi pantalla completa en mobile */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: 93vh;
    border-radius: 18px 18px 0 0;
    transform: translateY(40px);
  }
  .modal-overlay.open .modal { transform: translateY(0); }
  .modal-wide { max-width: 100%; }
  .modal-body  { padding: 18px 16px; }
  .modal-header { padding: 16px 18px; }
  .modal-footer { padding: 14px 16px; flex-wrap: wrap; }

  /* Botones más fáciles de tocar */
  .btn      { padding: 11px 18px; font-size: 0.9rem; min-height: 42px; }
  .btn-sm   { padding: 9px 12px; font-size: 0.82rem; min-height: 36px; }
  .actions-cell { gap: 4px; }

  /* Cards */
  .card-header { padding: 14px 16px; }
  .card-body   { padding: 16px; }

  /* Login card */
  .login-card { padding: 32px 22px; margin: 16px; }

  /* Toast al fondo al centro */
  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }
  .toast { min-width: unset; width: 100%; }

  /* Ocultar texto secundario en topbar */
  #top-date { display: none; }
}

/* ===== RESPONSIVE — TELÉFONO PEQUEÑO ===== */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card  { padding: 12px 10px; }
  .stat-value { font-size: 1.25rem; }
  .stat-label { font-size: 0.72rem; }

  .topbar-title h1 { font-size: 0.95rem; }

  /* Tabs: scroll horizontal si hay muchos */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; padding-bottom: 2px; }
  .tab-btn { white-space: nowrap; padding: 10px 14px; }
}

/* ===== iOS — SAFE AREA (notch y barra home) ===== */
@supports (padding-top: env(safe-area-inset-top)) {
  .sidebar {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .topbar { padding-top: max(12px, env(safe-area-inset-top)); }
  .toast-container { bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* ===== iOS — evitar zoom al enfocar inputs ===== */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}


/* Variables que sí cambian */

/* Fondo de página y texto general del contenido */

/* Topbar */

/* Cards y stats */

/* Tablas */

/* Formularios */

/* Toolbar y búsqueda */

/* Tabs */

/* Modales */

/* Botón secundario */

/* Upload zone */

/* Secciones del cotizador */

/* Panel de detalle (reservas) */

/* Badges */

/* Login — sin dark mode: ya tiene fondo oscuro propio */

/* Botón toggle tema (siempre en sidebar oscuro) */
#theme-toggle {
  width: 100%;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 9px 14px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
#theme-toggle:hover { background: rgba(255,255,255,0.14); color: #fff; }

