/* ═══════════════════════════════════════════════════════
   METRIC POS — styles.css
   ═══════════════════════════════════════════════════════ */

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

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: #1e293b;
  background: #f1f5f9;
  height: 100vh;
  overflow: hidden;
}

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ── NAV ───────────────────────────────────────────────── */
#sidebar {
  width: 180px;
  min-width: 180px;
  background: #1e3a5f;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}
#sidebar-logo {
  padding: 16px 12px 8px;
  text-align: center;
}
#sidebar-logo img {
  max-width: 120px;
  max-height: 48px;
  object-fit: contain;
}
#nav-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 8px 16px;
}
.nav-item {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #e2e8f0; }
.nav-item.active { background: #2563eb; color: #fff; }

/* ── MAIN WRAPPER ──────────────────────────────────────── */
#main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── VIEWS ─────────────────────────────────────────────── */
.view { display: none; flex-direction: column; flex: 1; overflow-y: auto; min-height: 0; }
.view.active { display: flex; }
#pos-view { display: none; flex: 1; overflow: hidden; min-height: 0; }
#pos-view.active { display: flex; }

/* ── MAIN CONTENT AREA ─────────────────────────────────── */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── PAGE WRAPPER (used inside each view) ───────────────── */
.page {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

/* ── PAGE HEADER ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title { font-size: 20px; font-weight: 700; color: #1e3a5f; }
.page-subtitle { font-size: 12px; color: #64748b; margin-top: 2px; }
.page-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── SEARCH BOX ────────────────────────────────────────── */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box input {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  background: #fff;
  width: 220px;
}
.search-box input:focus { border-color: #2563eb; }
.search-icon {
  position: absolute;
  left: 10px;
  color: #94a3b8;
  font-size: 14px;
}

/* ── BUTTONS ───────────────────────────────────────────── */
.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-cancel {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-cancel:hover { background: #e2e8f0; }

.btn-confirm {
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-confirm:hover { background: #15803d; }

.btn-save {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.action-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.action-btn.edit   { background: #eff6ff; color: #2563eb; }
.action-btn.delete { background: #fef2f2; color: #dc2626; }
.action-btn:hover  { opacity: .8; }

/* ── DATA TABLE ────────────────────────────────────────── */
.data-table {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  overflow-x: auto;
  flex: 1;
}
.data-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
.data-table thead th {
  background: #f8fafc;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  white-space: nowrap;
}
.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }

/* ── BADGES ────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.badge-red    { background: #fef2f2; color: #dc2626; }
.badge-green  { background: #f0fdf4; color: #16a34a; }
.badge-blue   { background: #eff6ff; color: #2563eb; }
.badge-amber  { background: #fffbeb; color: #d97706; }
.badge-gray   { background: #f1f5f9; color: #64748b; }

/* ── CARDS GRID ────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

/* ── MODAL ─────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open,
.modal-overlay.active {
  display: flex;
}
.modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #e2e8f0;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a5f;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a5f;
  padding: 18px 20px 0;
}
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 20px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
}

/* ── FORM FIELDS ───────────────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-field input,
.form-field select,
.form-field textarea {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s;
  width: 100%;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: #2563eb; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.span2 { grid-column: span 2; }
.field-label { font-size: 11px; font-weight: 600; color: #64748b; }
.field-value { font-size: 13px; color: #1e293b; }

/* ── POS ───────────────────────────────────────────────── */
#pos-view {
  display: none;
  flex: 1;
  gap: 0;
  overflow: hidden;
}
#pos-view.active { display: flex; }

.pos-products {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 12px;
  gap: 8px;
  min-height: 0;
}
.pos-cart {
  width: 300px;
  min-width: 300px;
  background: #fff;
  border-left: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding-bottom: 8px;
  flex: 1;
  min-height: 0;
  align-content: start;
}
.product-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.product-card:hover { border-color: #2563eb; box-shadow: 0 4px 12px rgba(37,99,235,.15); }
.prod-name { font-size: 13px; font-weight: 600; color: #1e293b; line-height: 1.4; margin-bottom: 4px; }
.prod-code { font-size: 11px; color: #94a3b8; font-family: monospace; }
.prod-price { font-size: 15px; font-weight: 700; color: #2563eb; margin-top: 4px; }
.prod-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }

/* Cart */
.cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.cart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  font-size: 13px;
}
.cart-item {
  padding: 8px 14px;
  border-bottom: 1px solid #f1f5f9;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.cart-item-name { font-size: 12px; font-weight: 600; color: #1e293b; flex: 1; }
.cart-item-remove {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}
.cart-item-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.cart-item-total { font-size: 13px; font-weight: 700; color: #2563eb; }
.qty-controls { display: flex; align-items: center; gap: 4px; }
.qty-btn {
  width: 22px; height: 22px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.qty-num { font-size: 13px; font-weight: 600; min-width: 24px; text-align: center; }

/* Cart totals */
.cart-totals {
  border-top: 1px solid #e2e8f0;
  padding: 12px 14px;
  background: #f8fafc;
}
.totals-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.total-row { display: flex; justify-content: space-between; font-size: 12px; color: #64748b; }
.total-row.big { font-size: 16px; font-weight: 700; color: #1e293b; }

/* Discount */
.discount-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.discount { font-size: 12px; color: #dc2626; font-weight: 600; }

/* Invoice button */
.btn-invoice {
  width: 100%;
  padding: 12px;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-invoice:hover { background: #15803d; }
.btn-print-inv {
  width: 100%;
  padding: 10px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: 6px;
}

/* ── SUCCESS TOAST ─────────────────────────────────────── */
.success-toast {
  display: none;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #16a34a;
}
.save-success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  display: none;
}

/* ── CLIENT CARDS ──────────────────────────────────────── */
.client-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow .15s;
}
.client-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.client-card-header {
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.client-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.client-name { font-size: 14px; font-weight: 700; color: #1e293b; }
.client-rtn { font-size: 11px; color: #94a3b8; font-family: monospace; }
.client-info { padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.client-section { display: flex; flex-direction: column; gap: 2px; }

/* ── SALE CARDS ────────────────────────────────────────── */
.sale-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sale-num { font-size: 13px; font-weight: 700; color: #1e3a5f; font-family: monospace; }
.sale-meta { font-size: 11px; color: #64748b; }
.sale-items-count { font-size: 11px; color: #94a3b8; }
.sale-amount { font-size: 16px; font-weight: 700; color: #16a34a; margin-left: auto; }

/* ── REPORTS ───────────────────────────────────────────── */
.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.report-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
}
.res-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 18px;
}
.res-label { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .4px; }
.res-val { font-size: 20px; font-weight: 700; color: #1e3a5f; margin-top: 4px; }

/* ── CONFIG ────────────────────────────────────────────── */
.config-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
}
.config-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a5f;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

/* ── FP BTN (forma de pago) ────────────────────────────── */
.fp-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.fp-btn:hover { border-color: #2563eb; color: #2563eb; }
.fp-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ── INVOICE BOX ───────────────────────────────────────── */
.invoice-box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  max-width: 700px;
  margin: 0 auto;
}
.invoice-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.company-info { text-align: center; margin-bottom: 16px; }
.company-name { font-size: 18px; font-weight: 700; color: #1e3a5f; }
.company-rtn { font-size: 12px; color: #64748b; }
.totals-table { width: 100%; border-collapse: collapse; }
.totals-section { margin-top: 16px; }
.total-line { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.total-row-item { display: flex; justify-content: space-between; }
.grand-total { font-size: 18px; font-weight: 700; color: #1e3a5f; }
.amount-words { font-size: 11px; color: #64748b; font-style: italic; margin-top: 4px; }

/* firma */
.firma-row { display: flex; gap: 40px; margin-top: 32px; }
.firma { flex: 1; text-align: center; border-top: 1px solid #cbd5e1; padding-top: 6px; font-size: 11px; color: #64748b; }

/* ── EXONERADO ─────────────────────────────────────────── */
.exonerado-check { display: flex; align-items: center; gap: 8px; }
.check-label { font-size: 13px; font-weight: 600; color: #1e293b; cursor: pointer; }
.exonerado-fields { display: none; }
.exonerado-fields.visible { display: contents; }

/* ── CART CLIENT ───────────────────────────────────────── */
.cart-client-rtn { font-size: 11px; color: #94a3b8; font-family: monospace; }
.client-section   { display: flex; flex-direction: column; gap: 2px; }

/* ── KARDEX ────────────────────────────────────────────── */
.kardex-tipo { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.kt-entrada, .kt-compra    { background: #f0fdf4; color: #16a34a; }
.kt-salida, .kt-venta      { background: #fef2f2; color: #dc2626; }
.kt-ajuste                 { background: #eff6ff; color: #2563eb; }
.kt-devolucion             { background: #fffbeb; color: #d97706; }

/* ── EMPTY STATE ───────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #94a3b8;
  text-align: center;
  gap: 8px;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE & PWA — MetricPOS v7.3
   ══════════════════════════════════════════════════════════ */

/* Botón hamburger — oculto en desktop */
#btn-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: #1e3a5f;
  flex-shrink: 0;
}
#btn-hamburger svg { display: block; }

/* Overlay del sidebar en móvil */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
}
#sidebar-overlay.active { display: block; }

/* Toast mejorado para móvil */
#toast-msg {
  max-width: calc(100vw - 32px);
  word-break: break-word;
}

/* ── TABLET (≤900px) ─────────────────────────────────────── */
@media (max-width: 900px) {
  #sidebar { width: 160px; min-width: 160px; }
  .pos-cart { width: 240px; min-width: 240px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

/* ── MOBILE (≤768px) ─────────────────────────────────────── */
@media (max-width: 768px) {

  /* Sidebar → drawer lateral */
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 220px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  #sidebar.open { transform: translateX(0); }

  /* Topbar */
  #topbar {
    padding: 0 12px;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  #btn-hamburger { display: flex; align-items: center; justify-content: center; }
  .topbar-branch { font-size: 11px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-role { display: none; }
  .topbar-version { display: none; }
  #topbar-user { font-size: 11px; }

  /* Main ocupa toda la pantalla */
  #main {
    width: 100%;
    height: calc(100vh - 52px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Pages */
  .page { padding: 12px; }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }
  .page-header .btn-primary { width: 100%; }
  .page-title { font-size: 16px; }

  /* Grids → una columna */
  .form-grid { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: span 1; }
  .report-cards { grid-template-columns: 1fr; }

  /* Tablas → scroll horizontal */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }

  /* POS: layout vertical */
  #pos-layout {
    flex-direction: column !important;
    height: auto !important;
  }
  #pos-productos {
    height: 50vh;
    min-height: 280px;
  }
  .pos-cart {
    width: 100% !important;
    min-width: 0 !important;
    height: 50vh;
    min-height: 300px;
    border-left: none !important;
    border-top: 2px solid #e2e8f0;
  }

  /* Dashboard KPIs: 2 columnas */
  #dash-kpis { grid-template-columns: 1fr 1fr !important; }

  /* Modales full screen en móvil */
  .modal-inner,
  div[style*="max-width:480px"],
  div[style*="max-width:500px"],
  div[style*="max-width:520px"],
  div[style*="max-width:540px"],
  div[style*="max-width:600px"] {
    width: 96vw !important;
    max-width: 96vw !important;
    margin: 2vw !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
  }

  /* Botones de acción */
  .btn-primary, .btn-save, .btn-cancel {
    min-height: 42px;
    font-size: 13px;
  }

  /* Inputs más grandes para touch */
  input, select, textarea {
    font-size: 16px !important; /* evita zoom en iOS */
    min-height: 40px;
  }
  input[type="number"] { font-size: 16px !important; }

  /* Tickets dashboard: 2 cols → 1 */
  #dash-turnos > div { grid-template-columns: 1fr !important; }

  /* Facturación botones */
  .pos-search-bar { flex-wrap: wrap; gap: 8px; }
  .pos-search-bar input { min-width: 0; flex: 1; }
}

/* ── MOBILE PEQUEÑO (≤480px) ─────────────────────────────── */
@media (max-width: 480px) {
  #dash-kpis { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .page { padding: 10px; }
  .topbar-branch { max-width: 80px; }

  /* Ticket stats: 2x2 */
  div[style*="grid-template-columns:repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Ocultar columnas menos importantes en tablas */
  .col-hide-xs { display: none !important; }
}

/* ── SAFE AREA (iPhone notch/home bar) ───────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #main { padding-bottom: env(safe-area-inset-bottom); }
  #topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
}

/* ── PWA STANDALONE: ocultar elementos del browser ──────── */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top, 0); }
}
