/* ══════════════════════════════════════════════
   NARATODO — Design tokens (CLAUDE.md canónico)
   ══════════════════════════════════════════════ */
:root {
  /* Fondos */
  --bg:          #FBF7F1;
  --surface:     #FFFFFF;
  --line:        #E9E1D4;
  --line-soft:   #F2ECE0;

  /* Tinta */
  --ink:         #1D2B2E;
  --ink-soft:    #4E6266;
  --ink-mute:    #8A9A9D;

  /* Marca */
  --primary:     #1F8A8C;
  --primary-600: #19787A;
  --primary-50:  #E6F2F2;
  --primary-100: #CDE6E6;

  /* Acentos */
  --accent-warm:  #E89A5A;
  --accent-pink:  #F4A6B8;
  --accent-lilac: #A99ACB;
  --accent-blue:  #6C8BB4;
  --good:         #2F9E6B;
  --warn:         #D98A2B;

  /* Alias legacy (no romper otras páginas) */
  --verde:       #1F8A8C;
  --verde-dark:  #155f61;
  --verde-light: #2ab5b8;
  --rosa:        #E91E63;
  --rosa-light:  #F48FB1;
  --teal-50:     #E6F2F2;

  /* Radios */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Sombras */
  --shadow-sm: 0 1px 0 rgba(29,43,46,0.04), 0 1px 2px rgba(29,43,46,0.04);
  --shadow-md: 0 2px 0 rgba(29,43,46,0.03), 0 8px 24px -12px rgba(29,43,46,0.12);

  --sidebar-w: 248px;
}

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

body {
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* ══════════════════════════════════════════════
   SIDEBAR — white
   ══════════════════════════════════════════════ */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: #fff;
  border-right: 1px solid var(--line);
  color: var(--ink);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
  overflow-y: auto;
}

/* Logo row */
.sidebar-logo {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.1rem 1rem 1rem;
  border-bottom: 1px solid var(--line-soft);
}
.bear-icon {
  width: 36px; height: 36px;
  background: var(--verde);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-text {
  font-size: 1.15rem; font-weight: 800; color: var(--ink);
  letter-spacing: -.3px;
}
.logo-text em { font-style: normal; color: var(--verde); }

/* User chip */
.sidebar-user-chip {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line-soft);
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--verde);
  color: #fff; font-size: .82rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-name  { font-size: .85rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta  { font-size: .72rem; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Nav links */
.sidebar nav { flex: 1; padding: .5rem .6rem; }
.sidebar nav a {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem .75rem;
  color: var(--ink-mute);
  text-decoration: none;
  font-size: .88rem; font-weight: 600;
  border-radius: 8px;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.sidebar nav a:hover {
  background: var(--line-soft);
  color: var(--ink);
}
.sidebar nav a.active {
  background: var(--ink);
  color: #fff !important;
  font-weight: 700;
}
.nav-icon { display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; width:16px; height:16px; }

/* Nav section label */
.nav-section-label {
  font-size: .67rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-mute);
  padding: .6rem .75rem .2rem;
  margin-top: .3rem;
}

/* Sidebar footer */
.sidebar-foot {
  padding: .9rem 1rem;
  border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; align-items: flex-start; gap: .2rem;
}
.sidebar-foot-mascot { font-size: 1.4rem; }
.sidebar-foot-text   { font-size: .72rem; color: var(--ink-mute); font-weight: 600; }
.sidebar-foot-logout {
  font-size: .8rem; color: var(--ink-mute);
  text-decoration: none; margin-top: .3rem;
  transition: color .15s;
}
.sidebar-foot-logout:hover { color: var(--rosa); }

/* ── Legacy sidebar classes kept for compatibility ── */
.sidebar-user { padding: .75rem 1rem; font-size: .8rem; border-bottom: 1px solid var(--line-soft); }
.sidebar-footer { padding: .75rem 1rem; border-top: 1px solid var(--line-soft); }
.sidebar-footer a { color: var(--ink-mute); font-size: .85rem; text-decoration: none; }
.sidebar-footer a:hover { color: var(--rosa); }

/* ══════════════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════════════ */
.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: .75rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.btn-menu {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--line-soft); border: none;
  font-size: 1.1rem; color: var(--ink); cursor: pointer;
  transition: background .15s;
  margin-right: .5rem;
}
.btn-menu:hover { background: var(--line); }

/* Sidebar colapsado en desktop (ocultar permanentemente vía toggle) */
@media (min-width: 769px) {
  body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  body.sidebar-collapsed .main-wrap { margin-left: 0; transition: margin-left .25s ease; }
  .main-wrap { transition: margin-left .25s ease; }
}
.content { padding: 20px 28px 60px; flex: 1; }

/* ══════════════════════════════════════════════
   CARD component
   ══════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}
/* Las tablas dentro de cards sí necesitan recorte horizontal */
.card > .table-wrap,
.card > div > table {
  overflow-x: auto;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px; font-weight: 800; color: var(--ink);
  display: flex; align-items: center; gap: .5rem;
}
.card-pad { padding: 18px 20px; }

/* ══════════════════════════════════════════════
   CHIP filter pills
   ══════════════════════════════════════════════ */
.chip-bar { display: flex; gap: .4rem; flex-wrap: wrap; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line-soft); }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .28rem .8rem;
  border-radius: 999px;
  font-size: .78rem; font-weight: 700;
  background: #f3f4f6; color: var(--ink-mute);
  cursor: pointer; text-decoration: none;
  border: 1.5px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.chip:hover { background: var(--teal-50); color: var(--verde); }
.chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* ══════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════ */
.table-wrap { background: transparent; box-shadow: none; border-radius: 12px; overflow: hidden; border: none; }
table { width: 100%; border-collapse: collapse; }
thead { background: #FCFAF5; }
thead th { padding: 14px 16px; text-align: left; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-mute); border-bottom: 1px solid var(--line); }
tbody tr { background: #fff; border-bottom: 6px solid #F5F0EB; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
tbody td { padding: .7rem 1rem; font-size: .88rem; vertical-align: middle; }
tbody td a { color: var(--verde); text-decoration: none; font-weight: 500; }
tbody td a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════
   STATS / CARDS
   ══════════════════════════════════════════════ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff; border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.stat-card .label { font-size: .75rem; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .5px; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; color: var(--verde); margin-top: .2rem; }

/* ══════════════════════════════════════════════
   ORDER / STATE BADGES
   ══════════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem; font-weight: 600;
  background: #e5f3ed; color: var(--verde-dark);
}
.badge-final  { background: #fce4ec; color: #880e4f; }
.badge-espera { background: #fff3e0; color: #e65100; }

/* Orden badge */
.orden-badge {
  display: inline-block;
  padding: .3rem .65rem;
  border-radius: 6px;
  font-size: .82rem; font-weight: 700;
  text-decoration: none !important;
  letter-spacing: .3px;
  background: #EDE8E1; color: #2d2d2d;
}
.orden-badge:hover { opacity: .8; }
/* colores vienen inline desde la BD */

/* Estado pill — colores vienen inline desde la BD */
.estado-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .7rem;
  border-radius: 999px;
  font-size: .75rem; font-weight: 700;
  white-space: nowrap;
  background: #F3F4F6; color: #4b5563; /* fallback */
}
.estado-pill::before { content: '●'; font-size: .55rem; }


/* ══════════════════════════════════════════════
   PAYMENT METHOD PILLS (Efectivo / Bold / Sistecredito)
   ══════════════════════════════════════════════ */
.pago-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; white-space: nowrap;
}
.pago-pill::before { content: '●'; font-size: .55rem; }
.pago-efectivo     { background: #E4F3EB; color: #1F6B47; }
.pago-bold         { background: #EEEAF6; color: #5B4A87; }
.pago-sistecredito { background: #FFF1DF; color: #9B5B17; }
.pago-sin-pago     { background: var(--line-soft); color: var(--ink-mute); }

/* ══════════════════════════════════════════════
   PAGINATION FOOTER
   ══════════════════════════════════════════════ */
.pagination-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1.1rem;
  border-top: 1px solid var(--line-soft);
  background: #fff;
  font-size: .82rem; color: var(--ink-mute);
  flex-wrap: wrap; gap: .5rem;
}
.pagination-footer .pg-info { font-weight: 600; }
.pagination-footer .pg-btns { display: flex; gap: .4rem; }
.pg-btn {
  display: inline-flex; align-items: center;
  padding: .28rem .75rem; border-radius: 6px;
  border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); font-size: .8rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.pg-btn:hover:not(.disabled) { background: var(--teal-50); border-color: var(--verde); color: var(--verde); }
.pg-btn.disabled { opacity: .4; pointer-events: none; }

/* ══════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════ */
.form-card {
  background: #fff; border-radius: 14px;
  padding: 1.5rem; box-shadow: 0 1px 6px rgba(0,0,0,.08);
  margin-bottom: 1.25rem;
}
.form-card h3 {
  font-size: 1rem; font-weight: 700; color: var(--ink);
  margin-bottom: 1rem;
}
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: .75rem; }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label {
  font-size: 11.5px; color: var(--ink-mute); font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
}
.form-group input[readonly] { background: var(--line-soft); color: var(--ink-mute); }

.total-box {
  background: linear-gradient(135deg, var(--verde) 0%, var(--verde-dark) 100%);
  color: #fff; border-radius: 12px; padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.total-box .total-label { font-size: .9rem; opacity: .85; }
.total-box .total-value { font-size: 1.8rem; font-weight: 700; }

/* ══════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.2rem; border-radius: 8px;
  font-size: .9rem; font-weight: 700; cursor: pointer;
  border: none; text-decoration: none;
  font-family: inherit;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
}
.btn-primary:hover { background: var(--primary-600); opacity: 1; }
.btn-rosa { background: var(--rosa); color: #fff; }
.btn-rosa:hover { opacity: .88; }
.btn-outline {
  background: transparent; border: 1.5px solid var(--verde); color: var(--verde);
}
.btn-outline:hover { background: #e8f5ee; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ══════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════ */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #059669; }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }

/* ══════════════════════════════════════════════
   AUTOCOMPLETE
   ══════════════════════════════════════════════ */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 999;
  background: #fff;
  border: 1.5px solid var(--verde-light); border-top: none;
  border-radius: 0 0 10px 10px;
  max-height: 220px; overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.autocomplete-list .ac-item { padding: .6rem .85rem; cursor: pointer; font-size: .9rem; border-bottom: 1px solid var(--line-soft); }
.autocomplete-list .ac-item:last-child { border-bottom: none; }
.autocomplete-list .ac-item:hover { background: #e8f5ee; }
.autocomplete-list .ac-item .ac-cedula { font-weight: 700; color: var(--verde-dark); }
.autocomplete-list .ac-item .ac-nombre { color: #374151; }
.autocomplete-list .ac-empty { padding: .6rem .85rem; color: var(--ink-mute); font-size: .88rem; }

/* ══════════════════════════════════════════════
   FORMULA
   ══════════════════════════════════════════════ */
.formula-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.formula-ojo { background: #f8faf9; border: 1.5px solid var(--line); border-radius: 10px; padding: .85rem; }
.formula-ojo h4 { font-size: .85rem; font-weight: 700; color: var(--verde-dark); margin-bottom: .65rem; }
@media(max-width:600px){ .formula-grid { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════
   CLIENTE INFO BOX
   ══════════════════════════════════════════════ */
.cliente-info {
  background: #e8f5ee; border: 1.5px solid var(--verde-light);
  border-radius: 10px; padding: .75rem 1rem; display: none;
}
.cliente-info.visible { display: block; }
.cliente-info strong { color: var(--verde-dark); }

/* ══════════════════════════════════════════════
   FILTERS (legacy select-based)
   ══════════════════════════════════════════════ */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters select, .filters input { border: 1.5px solid #d1d5db; border-radius: 8px; padding: .4rem .8rem; font-size: .88rem; }

/* ══════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--verde-dark) 0%, var(--verde) 60%, #40916c 100%);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.login-card {
  background: #fff; border-radius: 16px;
  padding: 2rem 2.25rem; width: 100%; max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo h1 { font-size: 2rem; font-weight: 800; color: var(--verde-dark); }
.login-logo h1 span { color: var(--rosa); }
.login-logo p { color: var(--ink-mute); font-size: .85rem; margin-top: .25rem; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: .65rem; font-size: 1rem; margin-top: .5rem; }

/* ══════════════════════════════════════════════
   PUBLIC REGISTRATION PAGE
   ══════════════════════════════════════════════ */
.public-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #e8f5ee 0%, #fce4ec 100%);
  padding: 1.5rem 1rem;
  display: flex; flex-direction: column; align-items: center;
}
.public-card {
  background: #fff; border-radius: 16px;
  padding: 1.75rem 1.5rem; width: 100%; max-width: 520px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
}
.public-header { text-align: center; margin-bottom: 1.5rem; }
.public-header h1 { font-size: 1.7rem; font-weight: 800; color: var(--verde-dark); }
.public-header h1 span { color: var(--rosa); }
.public-header p { color: var(--ink-mute); font-size: .88rem; margin-top: .3rem; }
.public-card .btn-rosa { width: 100%; justify-content: center; padding: .65rem; font-size: 1rem; margin-top: .75rem; }

/* ══════════════════════════════════════════════
   DETALLE ORDEN
   ══════════════════════════════════════════════ */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.detail-item .dl { font-size: .78rem; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .4px; }
.detail-item .dt { font-size: .95rem; font-weight: 500; color: #111; margin-top: .1rem; }

/* ══════════════════════════════════════════════
   OVERLAY + RESPONSIVE
   ══════════════════════════════════════════════ */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 90;
}
.overlay.active { display: block; }

/* ══════════════════════════════════════════════
   MOBILE — Bottom Navigation Bar
   ══════════════════════════════════════════════ */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  /* ── Layout base ── */
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }
  .main-wrap { margin-left: 0; }
  .btn-menu {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--line-soft); border: none;
    font-size: 1.2rem; color: var(--ink); cursor: pointer;
  }

  /* ── Topbar móvil ── */
  .topbar {
    padding: .6rem .9rem;
    gap: .5rem;
    min-height: 54px;
  }
  .topbar-title {
    font-size: .95rem; font-weight: 800;
    flex: 1; text-align: center;
  }

  /* ── Contenido ── */
  .content {
    padding: 12px 12px 90px;
  }

  /* ── Overlay — solo visible cuando está active ── */
  .overlay { display: none; }
  .overlay.active { display: block; }

  /* ── Grids ── */
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }

  /* ── Cards ── */
  .form-card { padding: 1rem; border-radius: 12px; }
  .card { border-radius: 12px; }
  .card-pad { padding: 14px; }

  /* ── Tablas — scroll horizontal suave ── */
  .table-wrap, .card > div { -webkit-overflow-scrolling: touch; }
  table { font-size: .8rem; }
  thead th { padding: 10px 10px; font-size: .65rem; }
  tbody td { padding: .5rem .65rem; }

  /* ── Botones ── */
  .btn { min-height: 40px; padding: .5rem .9rem; font-size: .85rem; }
  .btn-sm { min-height: 34px; }
  .btn-group { gap: .4rem; }

  /* ── Alerts ── */
  .alert { font-size: .85rem; border-radius: 10px; padding: .7rem .9rem; }

  /* ── Chips ── */
  .chip-bar { padding: .6rem .75rem; gap: .35rem; }
  .chip { font-size: .72rem; padding: .25rem .65rem; }

  /* ── Form inputs — más grandes para dedos ── */
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 11px 12px;
    font-size: 16px; /* Evita zoom automático en iOS */
    min-height: 44px;
  }
  .form-group label { font-size: 10.5px; }

  /* ── Total box ── */
  .total-box { padding: .85rem 1rem; }
  .total-box .total-value { font-size: 1.5rem; }

  /* ── Bottom nav ── */
  .mobile-bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 80;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 16px rgba(0,0,0,.07);
  }
  .mob-nav-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--ink-mute);
    font-size: .6rem; font-weight: 700;
    letter-spacing: .02em;
    padding: 6px 4px;
    position: relative;
    transition: color .15s;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer; border: none; background: none; font-family: inherit;
  }
  .mob-nav-item svg { flex-shrink: 0; }
  .mob-nav-item span { line-height: 1.1; text-align: center; }
  .mob-nav-item.active { color: var(--primary); }
  .mob-nav-item.active svg { stroke: var(--primary); }
  .mob-nav-item.active::after {
    content: '';
    position: absolute; top: 0; left: 20%; right: 20%;
    height: 2.5px; background: var(--primary); border-radius: 0 0 3px 3px;
  }
  .mob-nav-cta {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; text-decoration: none;
    font-size: .6rem; font-weight: 700; color: #fff;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-nav-cta-dot {
    width: 44px; height: 44px; border-radius: 14px;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(31,138,140,.4);
    margin-top: -14px;
  }

  /* ── Sidebar: cerrar con swipe area ── */
  .sidebar { width: 280px; }
  .sidebar nav a {
    padding: .65rem .9rem;
    font-size: .92rem;
    min-height: 44px;
  }
  .sidebar-logo { padding: 1.2rem 1rem; }
  .sidebar-user-chip { padding: 1rem; }

  /* ── Esconder sidebar foot en móvil para ahorrar espacio ── */
  .sidebar-foot { padding: .7rem 1rem 1.5rem; }

  /* ── Scroll snap horizontal para tablas ── */
  .table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
  }

  /* ── Flash messages más compactos ── */
  .alert { margin-bottom: .65rem; }

  /* ── Detalle orden: columnas una sola ── */
  .detail-grid > div { grid-column: 1 / -1; }
}

/* Safe area para iPhones con notch (aplica siempre) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(60px + env(safe-area-inset-bottom));
  }
  @media (max-width: 768px) {
    .content { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  }
}
