/* ==========================================================================
   El Mago de la Empanada — Admin Panel Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand — same as main site */
  --c-primary:       #c2185b;
  --c-primary-dark:  #880e4f;
  --c-primary-light: #f8bbd0;

  /* Admin layout */
  --c-sidebar-bg:    #1a1a2e;
  --c-sidebar-text:  #e8eaf6;
  --c-sidebar-active:#c2185b;
  --c-sidebar-hover: rgba(194, 24, 91, 0.12);
  --c-sidebar-width: 200px;
  --c-topbar-h:      56px;

  /* Content */
  --c-bg:            #f4f6f8;
  --c-card:          #ffffff;
  --c-border:        #e0e0e0;
  --c-text:          #1a1a2e;
  --c-text-light:    #666;
  --c-row-alt:       #f9fafb;

  /* Status colors */
  --c-success:       #2e7d32;
  --c-success-bg:    #e8f5e9;
  --c-warning:       #f9a825;
  --c-warning-bg:    #fff8e1;
  --c-danger:        #c62828;
  --c-danger-bg:     #ffebee;
  --c-info:          #1565c0;
  --c-info-bg:       #e3f2fd;

  /* Misc */
  --font:            'Inter', system-ui, sans-serif;
  --radius:          8px;
  --shadow:          0 1px 3px rgba(0, 0, 0, .08), 0 1px 6px rgba(0, 0, 0, .05);
  --transition:      0.15s ease;
}

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

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

/* --------------------------------------------------------------------------
   Login Page
   -------------------------------------------------------------------------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d1b40 100%);
}

.login-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 2.5rem;
  width: 380px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .24);
  text-align: center;
}

.login-card img {
  height: 72px;
  width: auto;
  margin: 0 auto 1rem;
  display: block;
}

.login-card h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.login-card p {
  color: var(--c-text-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.login-card input[type="text"],
.login-card input[type="email"],
.login-card input[type="password"] {
  display: block;
  width: 100%;
  border: 1.5px solid var(--c-border);
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--c-text);
  background: #fff;
  margin-bottom: 1rem;
  transition: border-color var(--transition);
}

.login-card input[type="text"]:focus,
.login-card input[type="email"]:focus,
.login-card input[type="password"]:focus {
  border-color: var(--c-primary);
  outline: none;
}

.login-card button[type="submit"],
.login-card input[type="submit"] {
  display: block;
  width: 100%;
  background: var(--c-primary);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--transition);
}

.login-card button[type="submit"]:hover,
.login-card input[type="submit"]:hover {
  background: var(--c-primary-dark);
}

/* --------------------------------------------------------------------------
   Admin Layout
   -------------------------------------------------------------------------- */
.admin-layout {
  display: grid;
  grid-template-columns: var(--c-sidebar-width) 1fr;
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  background: var(--c-sidebar-bg);
  color: var(--c-sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar__logo {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar__logo-img {
  width: 48px;
  height: 48px;
  background: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 4px;
}

.sidebar__logo-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar__logo-text {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, .5);
  line-height: 1.3;
}

.sidebar__logo-text strong {
  display: block;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
}

.sidebar__nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  color: var(--c-sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.sidebar__link:hover {
  background: var(--c-sidebar-hover);
  color: #ffffff;
}

.sidebar__link--active {
  border-left-color: var(--c-primary);
  background: var(--c-primary);
  color: #ffffff;
  font-weight: 600;
  border-left-width: 4px;
  border-left-style: solid;
  border-radius: 0 6px 6px 0;
  margin-right: 0.5rem;
}

.sidebar__link--active:hover {
  background: var(--c-primary-dark);
}

.sidebar__link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Badge contador (mensajes nuevos en WhatsApp, etc.) */
.sidebar__badge {
  margin-left: auto;
  background: var(--c-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  min-width: 20px;
  height: 18px;
  padding: 0 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar__separator {
  height: 1px;
  background: rgba(255, 255, 255, .08);
  margin: 0.5rem 1rem;
  list-style: none;
}

.sidebar__footer {
  border-top: 1px solid rgba(255, 255, 255, .08);
  margin-top: auto;
}

.sidebar__logout {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  color: rgba(255, 255, 255, .5);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  font-family: var(--font);
}

.sidebar__logout:hover {
  color: var(--c-danger);
  background: rgba(198, 40, 40, .08);
}

.sidebar__logout svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Main Content
   -------------------------------------------------------------------------- */
.admin-main {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding: 1rem 1.5rem;
}

.topbar {
  height: var(--c-topbar-h);
  background: #ffffff;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: 10px;
}

.topbar__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}


.topbar__datetime {
  font-size: 0.8rem;
  color: var(--c-text-light);
}

.page-content {
  padding: 1rem;
  flex: 1;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--c-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem;
}

.card__title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-light);
  margin-bottom: 0.2rem;
}

h2.card__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--c-primary-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

h2.card__title svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.card__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.2;
}

.card__sub {
  font-size: 0.75rem;
  color: var(--c-text-light);
  margin-top: 0.15rem;
}

/* --------------------------------------------------------------------------
   KPI Grid
   -------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
/* Variante de 5 KPIs (tab Ventas). En clase, no inline, para que los media
   queries de .kpi-grid (auto-fit / 2 col / 1 col) puedan colapsarla en mobile. */
.kpi-grid--5 {
  grid-template-columns: repeat(5, 1fr);
}

.kpi-card {
  background: var(--c-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.65rem 0.85rem;
  border-top: 3px solid var(--accent, var(--c-primary));
  /* card__value y card__sub van EN LINEA (mas compacto). El titulo ocupa
     su propia fila y abajo value+sub comparten una segunda fila alineados
     por baseline. Si el sub es muy largo, wrappea naturalmente. */
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.5rem;
}
.kpi-card > .card__title {
  flex-basis: 100%;
}
.kpi-card > .card__sub {
  margin-top: 0;
}

.kpi-card--primary {
  --accent: var(--c-primary);
}

.kpi-card--warning {
  --accent: var(--c-warning);
}

.kpi-card--success {
  --accent: var(--c-success);
}

.kpi-card--info {
  --accent: var(--c-info);
}

.kpi-card--highlight {
  --accent: var(--c-primary);
  background: linear-gradient(135deg, #fce4ec 0%, #fff 100%);
}

.kpi-card--primary {
  --accent: var(--c-primary);
}

/* Alert variants — fondo coloreado, llamativo. Usar para KPIs que requieren atención. */
.kpi-card--alert-info {
  --accent: var(--c-info);
  background: var(--c-info-bg);
}
.kpi-card--alert-warning {
  --accent: var(--c-warning);
  background: var(--c-warning-bg);
}
.kpi-card--alert-danger {
  --accent: #b71c1c;
  background: var(--c-danger);
  color: #fff;
}
.kpi-card--alert-danger .card__title,
.kpi-card--alert-danger .card__value,
.kpi-card--alert-danger .card__sub {
  color: #fff;
}
.kpi-card--alert-danger .card__sub {
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   Charts Grid
   -------------------------------------------------------------------------- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.charts-grid--evo {
  grid-template-columns: repeat(2, 1fr);
}

/* Tab Ventas: filas de 3 (gráficos / heatmap+gráficos). Antes usaban
   grid-template-columns inline, que pisa los media queries y dejaba los
   gráficos lado a lado en mobile. En clase colapsan a 1 columna en ≤1024px. */
.ventas-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.ventas-grid-3b {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.65rem;
  margin-top: 0.65rem;
}
@media (max-width: 1024px) {
  .ventas-grid-3,
  .ventas-grid-3b {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--c-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem;
  min-height: 250px;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* scroll horizontal fluido en iOS */
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

table.admin-table th {
  background: #f8f9fa;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-light);
  padding: 0.45rem 0.75rem;
  text-align: left;
  border-bottom: 2px solid var(--c-border);
}

table.admin-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.875rem;
  vertical-align: middle;
}

table.admin-table tr:last-child td {
  border-bottom: none;
}

table.admin-table tr:nth-child(even) td {
  background: var(--c-row-alt);
}

table.admin-table tr:hover td {
  background: rgba(194, 24, 91, .04);
}

/* --------------------------------------------------------------------------
   Category Headers in Stock Table
   -------------------------------------------------------------------------- */
.table-category-header td {
  background: var(--c-sidebar-bg);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 0.5rem 1rem;
  cursor: default;
}

/* Override hover and even-row for category headers */
.table-category-header:hover td {
  background: var(--c-sidebar-bg) !important;
  cursor: default;
}

table.admin-table .table-category-header:nth-child(even) td {
  background: var(--c-sidebar-bg);
}

/* --------------------------------------------------------------------------
   Stock Input
   -------------------------------------------------------------------------- */
.stock-input {
  width: 80px;
  border: 1.5px solid var(--c-border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--c-text);
  background: #ffffff;
  transition: border-color var(--transition);
}

.stock-input:focus {
  border-color: var(--c-primary);
  outline: none;
}

.stock-input--changed {
  border-color: var(--c-primary);
  background: rgba(194, 24, 91, .05);
}

.stock-alert-low,
.stock-alert-zero {
  /* Reserved for future use — no visual styling */
}

/* --------------------------------------------------------------------------
   Status Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 0.2em 0.65em;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge--pendiente {
  background: #e3f2fd;
  color: #1565c0;
}

.badge--confirmado {
  background: #fff3e0;
  color: #e65100;
}

.badge--entregado {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge--cancelado {
  background: #ffebee;
  color: #c62828;
}

.badge--abandonado {
  background: #e0e0e0;
  color: #212121;
}

/* Badge toggle clickable */
.badge-toggle {
  display: inline-block;
  padding: 0.2em 0.65em;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.badge-toggle:hover { opacity: 0.75; }
.badge-toggle--on {
  background: #e8f5e9;
  color: #2e7d32;
}
.badge-toggle--activo {
  background: #e8f5e9;
  color: #2e7d32;
}
.badge-toggle--frita {
  background: #fff3e0;
  color: #e65100;
}
.badge-toggle--off {
  background: #ffebee;
  color: #c62828;
}

/* Inline editable cell */
.inline-edit {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.2rem 0.3rem;
  width: 100%;
  border-radius: 4px;
  transition: background 0.15s, box-shadow 0.15s;
}
.inline-edit:hover {
  background: #f0f0f0;
}
.inline-edit:focus {
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 2px #a11045;
}
/* Sortable table headers */
.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.2em !important;
}
.sortable:hover { background: rgba(0,0,0,0.05); }
.sortable::after {
  content: '⇅';
  position: absolute;
  right: 0.3em;
  opacity: 0.3;
  font-size: 0.7em;
}
.sortable.sort-asc::after { content: '▲'; opacity: 0.7; }
.sortable.sort-desc::after { content: '▼'; opacity: 0.7; }

.inline-edit--tipo { font-weight: 600; border-radius: 20px; padding: 0.2em 0.5em; font-size: 0.75rem; }
.inline-edit--tipo-normal { background: transparent; color: var(--text-muted, #999); }
/* Mismos colores que los .ptag--* del portal cliente para consistencia visual. */
.inline-edit--tipo-vegetariana { background: #f1f8e9; color: #33691e; }
.inline-edit--tipo-vegana { background: #e0f4ff; color: #0369a1; }
.inline-edit--narrow { max-width: 60px; text-align: center; }
.inline-edit--select {
  appearance: auto;
  cursor: pointer;
  padding-right: 0.2rem;
}

/* Estado select in pedidos table */
.estado-select {
  min-width: 120px;
  padding: 0.3rem 2rem 0.3rem 0.5rem !important;
  font-size: 0.8rem !important;
  font-weight: 600;
  border-radius: 20px;
  border: none;
}
.estado-select--pendiente {
  background-color: #e3f2fd !important;
  color: #1565c0 !important;
  font-weight: 600 !important;
}
.estado-select--confirmado {
  background-color: #fff3e0 !important;
  color: #e65100 !important;
  font-weight: 600 !important;
}
.estado-select--entregado {
  background-color: #e8f5e9 !important;
  color: #2e7d32 !important;
  font-weight: 600 !important;
}
.estado-select--cancelado {
  background-color: #ffebee !important;
  color: #c62828 !important;
  font-weight: 600 !important;
}
.estado-select--abandonado {
  background-color: #e0e0e0 !important;
  color: #212121 !important;
  font-weight: 600 !important;
}

.origen-select--mostrador {
  background-color: #e3f2fd !important;
  color: #1565c0 !important;
  font-weight: 600 !important;
}
.origen-select--pedidosya {
  background-color: #fff3e0 !important;
  color: #e65100 !important;
  font-weight: 600 !important;
}
.origen-select--tucan {
  background-color: #f3e5f5 !important;
  color: #7b1fa2 !important;
  font-weight: 600 !important;
}
.origen-select--telefono {
  background-color: #e0f2f1 !important;
  color: #00695c !important;
  font-weight: 600 !important;
}
.origen-select--web {
  background-color: #e8eaf6 !important;
  color: #283593 !important;
  font-weight: 600 !important;
}
.origen-select--otro {
  background-color: #f0f0f0 !important;
  color: #666 !important;
  font-weight: 600 !important;
}

.tipo-ajuste--restar {
  background-color: #ffebee !important;
  color: #c62828 !important;
  font-weight: 600 !important;
}
.tipo-ajuste--sumar {
  background-color: #e8f5e9 !important;
  color: #2e7d32 !important;
  font-weight: 600 !important;
}

.badge--venta {
  background: var(--c-danger-bg);
  color: var(--c-danger);
}

.badge--carga {
  background: var(--c-success-bg);
  color: var(--c-success);
}

.badge--ajuste {
  background: #fff3e0;
  color: #e65100;
}

/* Movimientos de stock en historial: cancelación (devolución) en azul y
   reactivación (re-descuento) en violeta, para distinguirlas del rojo de venta
   y del verde de fabricación. No se reusa badge--cancelado acá porque esa clase
   la comparten el estado "Cancelado" del pedido y el badge "Error" de mensajes. */
.badge--mov-cancelacion {
  background: #e3f2fd;
  color: #1565c0;
}

.badge--reactivacion {
  background: #ede7f6;
  color: #6a1b9a;
}

.badge--success {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge--neutral {
  background: #f5f5f5;
  color: #616161;
}

.badge--interno {
  background: #fff3e0;
  color: #bf360c;
}

.badge--externo {
  background: #e0f2f1;
  color: #00695c;
}

/* Badges para origen de pedido (consistentes con .origen-select--*) */
.badge--origen-mostrador { background: #e3f2fd; color: #1565c0; }
.badge--origen-pedidosya { background: #fff3e0; color: #e65100; }
.badge--origen-tucan     { background: #f3e5f5; color: #7b1fa2; }
.badge--origen-telefono  { background: #e0f2f1; color: #00695c; }
.badge--origen-web       { background: #e8eaf6; color: #283593; }
.badge--origen-otro      { background: #f0f0f0; color: #666; }

/* Badges para tipo de entrega — espejados con la paleta de la card
   "Tipo de entrega" del detalle: Delivery naranja / Mostrador celeste. */
.badge--entrega-delivery  { background: #fff3e0; color: #e65100; }
.badge--entrega-mostrador { background: #e3f2fd; color: #1565c0; }

/* Badges para método de pago */
.badge--metodo-efectivo      { background: #e8f5e9; color: #2e7d32; }
.badge--metodo-transferencia { background: #e3f2fd; color: #1565c0; }
.badge--metodo-mercadopago   { background: #e1f5fe; color: #0277bd; }
.badge--metodo-tarjeta       { background: #f3e5f5; color: #7b1fa2; }
.badge--metodo-otro          { background: #f0f0f0; color: #666; }
.badge--metodo-vacio         { background: transparent; color: #999; font-weight: 400; letter-spacing: 0; text-transform: none; }

/* Badges para categoría de ingreso (Tablero → Ingresos) */
.badge--cat-efectivo   { background: #e8f5e9; color: #2e7d32; }
.badge--cat-pyavirtual { background: #fff3e0; color: #e65100; }
.badge--cat-otros      { background: #e8eaf6; color: #283593; }

/* Headers ordenables de la tabla de Ingresos (separado de .sortable global) */
.ing-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}
.ing-sortable:hover { color: var(--c-primary); background: rgba(0,0,0,0.04); }
.ing-sortable::after { content: ' \21C5'; font-size: 0.7em; opacity: 0.4; }
.ing-sortable.sorted-asc::after  { content: ' \2191'; opacity: 1; }
.ing-sortable.sorted-desc::after { content: ' \2193'; opacity: 1; }

/* --------------------------------------------------------------------------
   Movement Log Delta
   -------------------------------------------------------------------------- */
.delta-pos {
  color: var(--c-success);
  font-weight: 700;
}

.delta-neg {
  color: var(--c-danger);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  line-height: 1.25;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
  box-sizing: border-box;
  height: 36px;
}

.btn--primary {
  background: var(--c-primary);
  color: #ffffff;
}

.btn--primary:hover {
  background: var(--c-primary-dark);
}

.btn--outline {
  background: transparent;
  border: 1.5px solid var(--c-border);
  color: var(--c-text);
}

.btn--outline:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}

.btn--danger {
  background: var(--c-danger);
  color: #ffffff;
}

.btn--danger:hover {
  background: #b71c1c;
}

/* Variante "destructiva permanente" — usada para Eliminar (DELETE físico).
   Gris oscuro para diferenciarla visualmente de btn--danger (rojo, usado
   para Cancelar — acción reversible que sólo cambia el estado). */
.btn--dark {
  background: #374151;
  color: #ffffff;
}

.btn--dark:hover {
  background: #1f2937;
}

/* ─────────────────────────────────────────────────────────────────────
   CONVENCIÓN DE COLORES DE BOTONES
   ─────────────────────────────────────────────────────────────────────
   .btn--primary  → magenta (color de marca). Acción principal de la página
                    (crear nuevo, guardar, ir al siguiente paso).
   .btn--info     → celeste (#1565c0). Acciones de IMPRIMIR / vista previa.
                    Misma paleta que .badge--pendiente.
   .btn--excel    → verde Excel (#217346). Acciones de EXPORTAR a Excel.
                    El verde es el color del logo de Excel — los usuarios
                    lo reconocen como "datos a planilla".
   .btn--success  → verde estándar. Confirmaciones genéricas (aprobar,
                    activar). NO confundir con .btn--excel.
   .btn--danger   → rojo. Acción REVERSIBLE destructiva (cancelar, desactivar).
   .btn--dark     → gris oscuro (#374151). Acción PERMANENTE destructiva
                    (eliminar de la BD). Diferenciación visual con danger.
   .btn--outline  → blanco con borde. Acción secundaria neutra (volver, etc).
   ───────────────────────────────────────────────────────────────────── */

/* Variante "informativa" — celeste. Usada para acciones de IMPRIMIR
   (Imprimir Comanda, Imprimir Stock, Imprimir manual). Misma paleta
   que .badge--pendiente y los selects "no pagado". */
.btn--info {
  background: #1565c0;
  color: #ffffff;
}

.btn--info:hover {
  background: #0d47a1;
}

/* Variante "Excel" — verde del logo de Microsoft Excel. Usada para
   acciones de EXPORTAR a Excel (.xls). Diferente a .btn--success
   (verde estándar para confirmaciones). */
.btn--excel {
  background: #217346;
  color: #ffffff;
}

.btn--excel:hover {
  background: #185c38;
}

.btn--success {
  background: var(--c-success);
  color: #ffffff;
}

.btn--success:hover {
  background: #1b5e20;
}

.btn--sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  height: 30px;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.form-grid--2col {
  grid-template-columns: 1fr 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-text-light);
}

.form-control {
  border: 1.5px solid var(--c-border);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--c-text);
  background: #ffffff;
  width: 100%;
  transition: border-color var(--transition);
}

.form-control:focus {
  border-color: var(--c-primary);
  outline: none;
}

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

.form-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   Page Header
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.page-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Flash Alerts
   -------------------------------------------------------------------------- */
.flash-alert {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  max-width: 420px;
  animation: flash-slide-in 0.3s ease-out;
}
@keyframes flash-slide-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.flash-alert--success {
  background: var(--c-success-bg);
  color: var(--c-success);
  border-left: 4px solid var(--c-success);
}

.flash-alert--error {
  background: var(--c-danger-bg);
  color: var(--c-danger);
  border-left: 4px solid var(--c-danger);
}

.flash-alert__close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 0;
  line-height: 1;
}

.flash-alert__close:hover {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Page Actions & Form Actions
   -------------------------------------------------------------------------- */
.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: center;
}

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  color: var(--c-text-light);
  padding: 2rem 1rem;
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   Section Title
   -------------------------------------------------------------------------- */
.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--c-text);
}

/* --------------------------------------------------------------------------
   Required indicator
   -------------------------------------------------------------------------- */
.required {
  color: var(--c-danger);
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Filter Form Label
   -------------------------------------------------------------------------- */
.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-text-light);
}

/* --------------------------------------------------------------------------
   Secondary button
   -------------------------------------------------------------------------- */
.btn--secondary {
  background: #f4f6f8;
  color: var(--c-text);
  border: 1.5px solid var(--c-border);
}

.btn--secondary:hover {
  background: #e8eaf6;
  border-color: var(--c-text-light);
}

.btn--lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Toggle Switch
   -------------------------------------------------------------------------- */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  transition: background 0.2s;
}

.toggle__slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle__slider {
  background: var(--c-success);
}

.toggle input:checked + .toggle__slider::before {
  transform: translateX(22px);
}

/* --------------------------------------------------------------------------
   Coverage Dots & Badges
   -------------------------------------------------------------------------- */
.coverage-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}

.coverage-dot--danger  { background: var(--c-danger); }
.coverage-dot--warning { background: var(--c-warning); }
.coverage-dot--success { background: var(--c-success); }

.coverage-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15em 0.55em;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.coverage-badge--danger {
  background: var(--c-danger-bg);
  color: var(--c-danger);
}

.coverage-badge--warning {
  background: #fff8e1;
  color: #f57f17;
}

.coverage-badge--success {
  background: var(--c-success-bg);
  color: var(--c-success);
}

.coverage-badge--muted {
  background: #f0f0f0;
  color: #999;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Info Tooltip (uses native title attribute)
   -------------------------------------------------------------------------- */
.th-info {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.info-tip {
  display: inline-flex;
  cursor: help;
  color: var(--c-text-light);
  opacity: 0.45;
  transition: opacity 0.15s;
  position: relative;
}

.info-tip:hover { opacity: 0.8; }

/* El SVG del icono no debe capturar pointer-events — el hover/click va al
   span padre, sino el tooltip no se dispara cuando pasás sobre el icono mismo. */
.info-tip > svg { pointer-events: none; }

/* El tooltip se renderea desde JS (admin-common.js → showFloatingTooltip)
   como un <div> flotante con position:fixed en <body>. Esto evita que
   contenedores con overflow:auto/hidden (table-wrap del dashboard, etc.)
   recorten el tooltip. Sin estilos CSS ::after acá para no duplicar. */

/* --------------------------------------------------------------------------
   Sabor Search Dropdown (same style as client search)
   -------------------------------------------------------------------------- */
.sabor-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 0.375rem;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.sabor-search-results .sabor-item {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sabor-search-results .sabor-item:last-child { border-bottom: none; }
.sabor-search-results .sabor-item:hover,
.sabor-search-results .sabor-item.active {
  background: var(--c-primary-light);
}
.sabor-search-results .si-nombre { font-weight: 600; font-size: 0.9rem; }
.sabor-search-results .si-detail { font-size: 0.78rem; color: var(--c-text-light); }

/* --------------------------------------------------------------------------
   Detail Grid (pedido detail, etc.)
   -------------------------------------------------------------------------- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

/* --------------------------------------------------------------------------
   Alerts / Flash Messages
   -------------------------------------------------------------------------- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert--success {
  background: var(--c-success-bg);
  color: var(--c-success);
  border-left: 4px solid var(--c-success);
}

.alert--error {
  background: var(--c-danger-bg);
  color: var(--c-danger);
  border-left: 4px solid var(--c-danger);
}

.alert--warning {
  background: var(--c-warning-bg);
  color: var(--c-warning);
  border-left: 4px solid var(--c-warning);
}

/* --------------------------------------------------------------------------
   Order Form — Product Rows
   -------------------------------------------------------------------------- */
.order-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.order-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.6fr) 1fr 70px auto auto 36px;
  gap: 0.5rem;
  align-items: center;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}

.row-prod-frita {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.row-prod-frita .row-prod-wrap {
  flex: 1;
  min-width: 0;
}

.row-prod-frita .row-frita {
  width: 100px;
  flex-shrink: 0;
}

.order-row__remove {
  color: var(--c-danger);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 1.1rem;
  padding: 0.25rem;
  font-family: var(--font);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition);
}

.order-row__remove:hover {
  opacity: 0.7;
}

.order-total {
  text-align: right;
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1rem;
  color: var(--c-text);
}

.order-total span {
  color: var(--c-primary);
  font-size: 1.3rem;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
}

.modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.modal__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   Bottom Nav (mobile only — hidden on desktop)
   -------------------------------------------------------------------------- */
.bottom-nav {
  display: none;
}

.bottom-nav__item {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.6rem;
  color: rgba(255, 255, 255, .6);
  text-decoration: none;
  font-size: 0.65rem;
  gap: 0.2rem;
  transition: color var(--transition);
  min-width: 44px;
}

.bottom-nav__item svg {
  width: 22px;
  height: 22px;
}

.bottom-nav__item--active {
  color: var(--c-primary);
}

/* --------------------------------------------------------------------------
   Responsive — max-width 1280px (notebooks estándar 13–15")
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  :root {
    --c-sidebar-width: 200px;
  }
  .admin-main {
    padding: 0.85rem 1.15rem;
  }

  /* KPI grid fluido: autofit en vez de columnas fijas (aplica a los inline con 5 cols también) */
  .kpi-grid,
  [class*="kpi-grid"] {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
  }

  /* Form grids inline con 3 cols → 2 cols */
  [style*="grid-template-columns:1fr 1fr 1fr auto"],
  [style*="grid-template-columns: 1fr 1fr 1fr auto"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Topbar: más compacto */
  .topbar {
    padding: 0.5rem 0.75rem;
  }
  .topbar__title {
    font-size: 1rem;
  }
  .topbar__datetime {
    font-size: 0.78rem;
  }
}

/* --------------------------------------------------------------------------
   Responsive — max-width 1024px (notebooks / laptops pequeños)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --c-sidebar-width: 180px;
  }
  .admin-main {
    padding: 0.75rem 1rem;
  }

  /* KPI grid: auto-fit en vez de 4 fijas */
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  /* Charts: 1 columna */
  .charts-grid {
    grid-template-columns: 1fr;
  }

  /* Resumen 2-col (Vista general): colapsa a 1 columna */
  .resumen-2col {
    grid-template-columns: 1fr !important;
  }
}

/* Notebook (entre 768 y 1440px): la columna derecha (Pedidos que requieren
   atención) necesita más ancho para que la tabla se vea bien sin que se
   apreten las columnas. Reducimos la relación de 1.6:1 a 1.15:1. */
@media (min-width: 769px) and (max-width: 1440px) {
  .resumen-2col {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) !important;
  }

  /* Form grid: 2 columnas en vez de 3 */
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Tablas: más compactas */
  table.admin-table {
    font-size: 0.8rem;
  }
  table.admin-table th,
  table.admin-table td {
    padding: 0.35rem 0.5rem;
  }

  /* Metric layout: stack vertical */
  .metric-layout {
    grid-template-columns: 1fr;
  }

  /* Modal más angosto */
  .modal {
    width: 360px;
  }
}

/* --------------------------------------------------------------------------
   Responsive — max-width 768px
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--c-sidebar-bg);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bottom-nav::-webkit-scrollbar {
    display: none;
  }

  .admin-main {
    padding: 0.75rem;
    padding-bottom: 70px;
  }

  .page-content {
    padding: 1rem;
  }

  .topbar {
    padding: 0 1rem;
  }

  .topbar__breadcrumb {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
  }

  /* Stack all grids */
  .kpi-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Page header stacks on small screens */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Order form rows: stack vertically */
  .order-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .order-row .order-row__remove {
    grid-column: 2;
    justify-self: end;
  }

  /* Tables: ensure scroll works */
  .table-wrap {
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0;
  }

  table.admin-table th,
  table.admin-table td {
    padding: 0.5rem 0.65rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  table.admin-table.table--compact th,
  table.admin-table.table--compact td {
    white-space: normal;
    padding: 0.4rem 0.5rem;
  }

  /* Inline grids from PHP pages (override inline styles) */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Metric layout stacks */
  .metric-layout {
    grid-template-columns: 1fr;
  }

  .metric-cards {
    flex-direction: row;
    gap: 0.5rem;
  }

  .metric-card {
    flex: 1;
  }

  /* Pagination: compact */
  .pagination {
    justify-content: center;
  }

  /* Form actions wrap */
  .form-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  /* Card content padding */
  .card {
    padding: 1rem;
  }

  /* Chart card reduce min height */
  .chart-card {
    min-height: 220px;
  }

  .metric-chart {
    min-height: 180px;
  }

  /* Inputs con width inline en px: no desbordan (clamp al contenedor) */
  input.form-control,
  select.form-control,
  textarea.form-control {
    max-width: 100%;
  }

  /* Barras de acciones con inputs y botones */
  .page-actions,
  .page-actions form {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Tablas dentro de cards sin wrap explícito: scroll horizontal fallback */
  .card > table,
  .card > form > table,
  .card > .detalle-wrap > table,
  td > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* --------------------------------------------------------------------------
   Responsive — max-width 480px
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Order rows full stack */
  .order-row {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .order-row .order-row__remove {
    grid-column: 1;
    justify-self: end;
  }

  .login-card {
    width: 100%;
    margin: 1rem;
    padding: 1.5rem;
  }

  /* Page title smaller */
  .page-header h1 {
    font-size: 1.1rem;
  }

  .card__value {
    font-size: 1.5rem;
  }

  /* Metric cards stack vertical on very small */
  .metric-cards {
    flex-direction: column;
  }

  /* Bottom nav: increase touch targets */
  .bottom-nav__item {
    padding: 0.65rem 0.75rem;
    min-width: 52px;
    font-size: 0.7rem;
  }

  .bottom-nav__item svg {
    width: 22px;
    height: 22px;
  }

  /* Topbar hide datetime on very small */
  .topbar__datetime {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Dashboard tabs
   -------------------------------------------------------------------------- */
.dashboard-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  border-bottom: 2px solid var(--c-border);
}
.dashboard-tab {
  padding: 0.65rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--c-text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  text-decoration: none;
}
.dashboard-tab:hover {
  color: var(--c-text);
}
.dashboard-tab--active {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
}

/* Sub-tabs (segundo nivel dentro de un tab-panel) */
.dashboard-subtabs {
  display: flex;
  gap: 0.25rem;
  margin: -0.25rem 0 0.6rem;
  padding: 0.25rem;
  background: var(--c-bg-soft, #f4f4f4);
  border-radius: 6px;
  width: fit-content;
}
.dashboard-subtab {
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--c-text-light);
  cursor: pointer;
  border-radius: 4px;
  transition: var(--transition);
}
.dashboard-subtab:hover {
  color: var(--c-text);
  background: rgba(0, 0, 0, 0.04);
}
.dashboard-subtab--active {
  color: var(--c-primary);
  background: var(--c-card-bg, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   Metric blocks
   -------------------------------------------------------------------------- */
.metric-block {
  margin-bottom: 1.25rem;
}
.metric-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--c-text);
}
.metric-layout {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.75rem;
  align-items: start;
}
.metric-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.metric-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  text-align: center;
}
.metric-card__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-light);
  margin-bottom: 0.2rem;
}
.metric-card__value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--c-text);
}
.metric-card__sub {
  font-size: 0.7rem;
  margin-top: 0.15rem;
  min-height: 1em;
}
.metric-chart {
  background: var(--c-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.65rem;
  min-height: 180px;
}

/* metric-layout responsive is handled in the main 768px media query above */

/* --------------------------------------------------------------------------
   Sortable Table Headers
   -------------------------------------------------------------------------- */
.sortable:hover { color: var(--c-primary); }
.sortable::after { content: ' \21C5'; font-size: 0.7em; opacity: 0.4; }
.sorted-asc::after { content: ' \2191'; opacity: 1; }
.sorted-desc::after { content: ' \2193'; opacity: 1; }

/* --------------------------------------------------------------------------
   Tab Clientes del Dashboard: charts side-by-side
   -------------------------------------------------------------------------- */
.clientes-charts-grid {
    display: grid;
    /* minmax(0, 1fr) evita que el canvas de Chart.js (que tiene tamaño
       intrínseco) fuerce a su columna a expandirse y rompa el grid en
       notebooks. Ambas columnas respetan estrictamente el 50/50 disponible. */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* Wrapper del canvas: ancho fluido al 100% del card padre. */
.clientes-charts-grid .chart-wrap {
    position: relative;
    width: 100%;
}
.clientes-charts-grid .chart-wrap canvas {
    max-width: 100%;
}

@media (max-width: 960px) {
    .clientes-charts-grid {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------------------------------------------
   Funnel chart (Tab Clientes del Dashboard)
   -------------------------------------------------------------------------- */
.funnel-chart {
    padding: 0.75rem 0 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.funnel-row {
    display: grid;
    /* Layout fluido pensado para vivir cómodo dentro de una columna 50/50
       en notebooks (≈ 13"–15"). minmax(0, …) en las 3 columnas evita que
       cualquier contenido fuerce un overflow horizontal. */
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) minmax(0, 0.6fr);
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.funnel-label {
    text-align: right;
    font-weight: 600;
    color: var(--c-text);
    font-size: 0.85rem;
    line-height: 1.2;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.funnel-bar-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
    min-width: 0;
}

.funnel-bar {
    /* --pct viene inline desde PHP, en porcentaje 0-100 */
    width: calc(var(--pct, 100) * 1%);
    max-width: 100%;
    min-width: 44px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: help;
    user-select: none;
    white-space: nowrap;
}

.funnel-bar:hover {
    transform: scale(1.025);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.funnel-count {
    text-align: left;
    color: var(--c-text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: help;
    min-width: 0;
}

/* Mobile: colapsar label arriba, count debajo del bar */
@media (max-width: 720px) {
    .funnel-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
        margin-bottom: 0.5rem;
    }
    .funnel-label {
        text-align: left;
        font-size: 0.85rem;
    }
    .funnel-count {
        text-align: right;
        font-size: 0.8rem;
    }
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.flex-center { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* --------------------------------------------------------------------------
   Promo Admin
   -------------------------------------------------------------------------- */
.promo-slots-section {
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--c-row-alt);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.promo-slots-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--c-text);
}

.promo-slot {
  display: grid;
  grid-template-columns: 1fr 80px auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
  padding: 0.65rem;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 6px;
}

.promo-slot > .form-group:first-child {
  grid-column: 1 / -1;
}

.promo-slot > .form-group:nth-child(2) {
  grid-column: 1 / -1;
}

.promo-slot .form-group label {
  font-size: 0.75rem;
}

.promo-slot .slot-remove {
  align-self: end;
  margin-bottom: 2px;
}

.promo-descuento-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--c-row-alt);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.promo-descuento-badge {
  font-size: 1rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
}

.promo-descuento-badge--ok {
  background: var(--c-success-bg);
  color: var(--c-success);
}

.promo-descuento-badge--neutral {
  background: var(--c-warning-bg);
  color: var(--c-warning);
}

.promo-descuento-badge--warn {
  background: var(--c-danger-bg);
  color: var(--c-danger);
}

.promo-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--c-border);
}

.checkbox-group {
  display: flex;
  gap: 1rem;
  padding-top: 0.4rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  color: var(--c-text) !important;
}

.promo-schedule {
  display: grid;
  grid-template-columns: auto repeat(7, 1fr);
  gap: 0;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-card);
}

.promo-schedule__header {
  background: var(--c-sidebar-bg);
  color: var(--c-sidebar-text);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--c-border);
}

.promo-schedule__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-text-light);
  padding: 0.5rem 0.65rem;
  border-right: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
}

.promo-schedule__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-right: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
}

.promo-schedule__cell:last-child {
  border-right: none;
}

.promo-schedule__cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--c-primary);
}

.promo-list-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.promo-list-card--inactive {
  opacity: 0.6;
}

.promo-list-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--c-row-alt);
  border-bottom: 1px solid var(--c-border);
}

.promo-list-card__body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
}

.promo-list-card__detail {
  padding: 0.6rem 1rem;
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.promo-list-card__detail:last-child {
  border-right: none;
}

.promo-list-card__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--c-text-light);
}

@media (max-width: 768px) {
  .promo-slot {
    grid-template-columns: 1fr 1fr;
  }
  .promo-slot .form-group:first-child {
    grid-column: 1 / -1;
  }
  .promo-schedule__header,
  .promo-schedule__label {
    font-size: 0.7rem;
    padding: 0.35rem 0.2rem;
  }
  .promo-schedule__cell {
    padding: 0.35rem;
  }
  .promo-list-card__body {
    grid-template-columns: 1fr 1fr;
  }
  .promo-list-card__detail {
    border-bottom: 1px solid var(--c-border);
  }
  .promo-list-card__detail:nth-child(even) {
    border-right: none;
  }
  .promo-list-card__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* --------------------------------------------------------------------------
   Comanda Print (hidden on screen)
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;600;700&display=swap');

.comanda-print {
  display: none;
}
.comanda-footer-fixed { display: none; }
.csep { display: none; } /* solo en pantalla — en print se muestran */

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  @page {
    size: A5;
    margin: 5mm 5mm 5mm;
  }
  .sidebar,
  .bottom-nav,
  .topbar,
  .notif-panel,
  .dev-credit,
  .alert {
    display: none !important;
  }
  body:not(.printing-manual) .admin-main > *:not(.comanda-print) {
    display: none !important;
  }

  /* ── Manual print: A4, tipografía estándar ── */
  body.printing-manual .admin-main > *:not(.manual-print) {
    display: none !important;
  }
  body.printing-manual .dashboard-tabs,
  body.printing-manual .btn-print-manual-wrap {
    display: none !important;
  }
  body.printing-manual {
    font-size: 11pt;
    color: #000;
  }
  @page manual {
    size: A4;
    margin: 15mm 18mm;
  }
  .manual-print {
    display: block !important;
    page: manual;
    max-width: 100% !important;
    font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
    font-size: 11pt;
    line-height: 1.55;
    color: #000;
  }
  .manual-print .card__title {
    font-size: 14pt;
    color: #000;
  }
  .manual-print h3 {
    font-size: 12.5pt !important;
    margin-top: 10mm !important;
    page-break-after: avoid;
  }
  .manual-print h4 {
    font-size: 11.5pt !important;
    page-break-after: avoid;
  }
  .manual-print p,
  .manual-print li {
    font-size: 10.5pt;
    orphans: 3;
    widows: 3;
  }
  .manual-print table {
    font-size: 9.5pt;
    page-break-inside: avoid;
  }
  .manual-print code {
    font-size: 9pt;
    background: #eee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .manual-print nav {
    page-break-after: avoid;
  }
  .admin-main {
    margin: 0 !important;
    padding: 0 !important;
  }
  .comanda-print {
    display: block !important;
    position: static;
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Barlow', 'Helvetica Neue', Arial, sans-serif;
    font-size: 12pt;
    color: #000;
    line-height: 1.35;
  }
  .comanda-print * {
    font-family: inherit;
  }
  .comanda-print table {
    page-break-inside: avoid;
  }
  .comanda-print img {
    max-width: 360px !important;
    max-height: 144px !important;
    width: auto !important;
    object-fit: contain;
    display: block;
    margin: 0 auto 3mm;
  }
  /* Separadores CSS */
  .csep {
    display: block !important;
    height: 0;
    margin: 1.5mm 0;
    overflow: hidden;
  }
  .csep--thick {
    border-top: 2px solid #000;
  }
  .csep--thin {
    border-top: 1px solid #555;
  }
  .csep--dashed {
    border-top: 1px dashed #888;
  }
  .comanda-footer-fixed {
    display: block !important;
    position: static;
    padding: 2mm 0 0;
    background: #fff;
  }
}

/* --------------------------------------------------------------------------
   Notification System
   -------------------------------------------------------------------------- */

/* Nav badge (sidebar) */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #c62828;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: auto;
  line-height: 1;
  animation: badge-pulse 2s ease-in-out infinite;
}

.nav-badge--mobile {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  font-size: 0.6rem;
  padding: 0 3px;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Notification panel */
.notif-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 380px;
  max-height: 420px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  z-index: 9999;
  overflow: hidden;
  border: 2px solid #c62828;
}

.notif-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #c62828;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.notif-panel__close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

.notif-panel__list {
  max-height: 340px;
  overflow-y: auto;
  padding: 0.5rem;
}

.notif-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.85rem;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item__info {
  flex: 1;
  min-width: 0;
}

.notif-item__info small {
  color: var(--c-text-light);
}

.notif-item__actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.notif-delivery {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  background: #fff3e0;
  color: #e65100;
  font-weight: 600;
  font-size: 0.75rem;
}

.notif-mostrador {
  display: inline-block;
  padding: 0 4px;
  border-radius: 3px;
  background: #e3f2fd;
  color: #1565c0;
  font-weight: 600;
  font-size: 0.75rem;
}

/* Confirm button on pedidos-ver */
.btn--confirm-order:hover {
  background: #1b5e20 !important;
}

/* Volume slider */
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c-primary);
  cursor: pointer;
}
.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c-primary);
  cursor: pointer;
  border: none;
}

@media (max-width: 768px) {
  .notif-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 70px;
  }
}

/* ==========================================================================
   Mobile admin optimizations (v2)
   Mejoras responsive aplicadas solo a viewports ≤ 768px / ≤ 480px.
   No afecta al layout desktop ni al Tablero (dashboard) en su lógica propia.
   ========================================================================== */

@media (max-width: 768px) {
  /* ---------- Touch targets (WCAG ≥ 40-44px) ---------- */
  .btn {
    min-height: 40px;
    padding: 0.55rem 0.9rem;
  }
  .btn.btn--sm,
  .btn--sm {
    min-height: 34px;
    padding: 0.35rem 0.7rem;
  }
  /* Evita zoom al enfocar en iOS: font-size ≥ 16px */
  .form-control,
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  select,
  textarea {
    min-height: 40px;
    font-size: 16px;
  }
  textarea {
    min-height: 84px;
  }
  label {
    font-size: 0.85rem;
  }

  /* ---------- Flash alert por encima de la bottom-nav ---------- */
  .flash-alert {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    left: 0.75rem;
    right: 0.75rem;
    transform: none;
    max-width: none;
  }

  /* ---------- Tabs con scroll horizontal (configuracion, clientes, etc.) ---------- */
  .dashboard-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .dashboard-tabs::-webkit-scrollbar {
    display: none;
  }
  .dashboard-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    min-height: 40px;
  }

  /* ---------- Page header + acciones ---------- */
  .page-header {
    gap: 0.6rem;
  }
  .page-header h1 {
    font-size: 1.15rem;
    line-height: 1.25;
    word-break: break-word;
  }
  .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-actions > *,
  .page-actions form {
    flex: 1 1 140px;
    min-width: 0;
  }
  .page-actions input,
  .page-actions select {
    width: 100%;
  }

  /* ---------- Inputs inline con width:px fijo se adaptan al contenedor ---------- */
  input[style*="width:"],
  select[style*="width:"],
  textarea[style*="width:"] {
    max-width: 100% !important;
  }

  /* ---------- Grids inline desde PHP (3+ cols → 1 col) ---------- */
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: 1fr !important;
  }
  /* Grid dirección pedidos (calle/núm/piso/depto): 2 columnas en mobile */
  [style*="2fr 80px 80px 1.5fr"],
  [style*="2fr 80px 80px"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* ---------- Modales: casi ancho completo ---------- */
  .modal {
    width: calc(100vw - 1.5rem) !important;
    max-width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
  }
  .modal-overlay {
    padding: 0.75rem;
    align-items: flex-start;
  }

  /* ---------- Cards: padding más compacto ---------- */
  .card {
    padding: 0.9rem;
  }
  .card p,
  .card li,
  .card dd {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /* ---------- Tablas: mejor scroll + links más tocables ---------- */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table.admin-table td a,
  table.admin-table td .btn-link,
  table.admin-table td button.btn--link {
    display: inline-block;
    padding: 0.25rem 0.3rem;
  }

  /* ---------- Filtros/toolbars con varios campos: stack vertical ---------- */
  .filters-row,
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  /* ---------- Badges más compactos ---------- */
  .badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
  }

  /* ---------- Contenedores con display:flex que desbordan ---------- */
  .card > div[style*="display:flex"],
  .card > div[style*="display: flex"] {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  /* Topbar más ajustado */
  .topbar {
    padding: 0 0.75rem;
    min-height: 44px;
  }
  .topbar__title {
    font-size: 0.95rem;
  }

  /* Acciones del header: botón full-width */
  .page-header .page-actions .btn,
  .page-header > .btn {
    width: 100%;
    justify-content: center;
  }

  /* Tablas aún más compactas */
  table.admin-table th,
  table.admin-table td {
    font-size: 0.78rem;
    padding: 0.4rem 0.5rem;
  }

  /* Modal full-screen en pantallas muy pequeñas */
  .modal {
    width: 100vw !important;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .modal-overlay {
    padding: 0;
  }

  /* Form actions: gap cómodo entre botones apilados */
  .form-actions {
    gap: 0.55rem;
  }

  /* Bottom nav: ítems un pelín más compactos para que entren más */
  .bottom-nav__item {
    min-width: 56px;
    padding: 0.55rem 0.5rem;
  }
}

/* ==========================================================================
   Responsive v3 — Mayo 2026
   - Sidebar compacto (icono + label vertical) en notebooks angostos.
   - Notebook density tweaks.
   - Bottom-nav scroll feedback + safe-area.
   - Topbar overflow protection con nombre/rol largo.
   ========================================================================== */

/* Sidebar compacto en notebooks (769–1280px).
   Pasa de 180-200px horizontal a 76px con icono arriba y label vertical
   debajo. Libera ~7-9% del ancho para que las tablas y los dashboards
   no se sientan apretados. */
@media (min-width: 769px) and (max-width: 1280px) {
  :root { --c-sidebar-width: 100px; }

  .sidebar__link,
  .sidebar__link--logout {
    flex-direction: column;
    gap: 0.22rem;
    padding: 0.6rem 0.4rem;
    text-align: center;
    border-left: none !important;
    border-radius: 6px;
    margin: 0.15rem 0.4rem;
    font-size: 0.7rem;
    line-height: 1.2;
  }
  .sidebar__link--active {
    background: var(--c-primary);
    color: #fff;
  }
  .sidebar__icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }
  .sidebar__label {
    font-size: 0.7rem;
    font-weight: 500;
    word-break: keep-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  /* Logo: ocultar texto, solo logo */
  .sidebar__logo {
    justify-content: center;
    padding: 0.75rem 0.5rem;
    flex-direction: column;
    gap: 0.35rem;
  }
  .sidebar__logo-text {
    display: none;
  }
  .sidebar__logo-img {
    width: 42px;
    height: 42px;
  }
  /* Badges: alineados arriba a la derecha del item */
  .sidebar__link .nav-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    margin-left: 0 !important;
  }
  .sidebar__item {
    position: relative;
  }
  /* Separator más sutil */
  .sidebar__separator {
    margin: 0.4rem 0.85rem;
  }
}

/* Bottom-nav móvil: scroll horizontal cómodo con hint visual cuando hay
   más de 6-7 items. Items con tamaño mínimo garantizado y safe-area. */
@media (max-width: 768px) {
  .bottom-nav {
    /* Hint visual de scroll: gradient lateral sutil. */
    background: var(--c-sidebar-bg);
    box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.12);
    scroll-snap-type: x proximity;
  }
  .bottom-nav__item {
    scroll-snap-align: start;
    flex: 0 0 auto;
  }
  /* Reserva más espacio bajo el contenido para evitar que la última fila
     quede pegada / tapada por la barra. */
  .admin-main {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
}

/* Notebook (1024-1440px): densidad ligeramente mayor para tablas y cards
   ahora que el sidebar libró espacio. */
@media (min-width: 769px) and (max-width: 1440px) {
  .card {
    padding: 0.7rem;
  }
  /* KPI cards en notebooks: tipografía un toque más chica */
  .card__value {
    font-size: 1.4rem;
  }
}

/* Topbar: protección contra overflow horizontal cuando el nombre del admin
   y el rol son largos en notebooks angostos. */
@media (max-width: 1024px) {
  .topbar {
    gap: 0.5rem;
  }
  .topbar > div:last-child {
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
  }
  .topbar > div:last-child > span {
    min-width: 0;
    flex-shrink: 1;
  }
}

/* Mobile (≤768px): el bloque info-usuario+datetime de la topbar tiende a
   romper el layout en 2 lineas y empuja el titulo. Lo apretamos. */
@media (max-width: 768px) {
  .topbar > div:last-child {
    gap: 0.4rem !important;
  }
  .topbar > div:last-child > span {
    font-size: 0.72rem !important;
  }
  .topbar > div:last-child > span strong {
    font-weight: 600;
  }
  /* En mobile, ocultar el rol entre paréntesis si entra justo (lo de
     fuera del strong). El strong (nombre) se mantiene. */
  .topbar > div:last-child > span > span:not(.topbar__datetime) {
    display: none;
  }
}
