/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  #eff6ff;
  --secondary:      #64748b;
  --success:        #16a34a;
  --success-light:  #dcfce7;
  --warning:        #d97706;
  --warning-light:  #fef3c7;
  --danger:         #dc2626;
  --danger-light:   #fee2e2;
  --info:           #0891b2;
  --info-light:     #e0f2fe;

  --bg:             #f1f5f9;
  --bg-card:        #ffffff;
  --border:         #e2e8f0;
  --text:           #1e293b;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;

  --sidebar-w:      260px;
  --topbar-h:       60px;
  --bottomnav-h:    64px;
  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:      0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.05);
  --transition:     0.2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ─── Layout Principal ──────────────────────────────────────────────────── */

/* Solo para páginas con sidebar (autenticadas) */
body.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand .brand-icon svg { width: 22px; height: 22px; color: #fff; }

.sidebar-brand .brand-text {
  display: flex; flex-direction: column;
}

.sidebar-brand .brand-name {
  font-size: 1rem; font-weight: 700; color: #fff; line-height: 1.2;
}

.sidebar-brand .brand-company {
  font-size: .72rem; color: rgba(255,255,255,.5); line-height: 1.2; margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.3);
  padding: 10px 8px 4px;
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.65);
  font-size: .9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.sidebar-link:hover, .sidebar-link.active {
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--primary);
  color: #fff;
}

.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.sidebar-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 0px) 24px 0 24px;
  z-index: 90;
  gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* Contenido principal */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  flex: 1;
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px));
}

/* ─── Botón hamburguesa (mobile) ──────────────────────────── */
.btn-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background var(--transition);
}

.btn-hamburger:hover { background: var(--bg); }
.btn-hamburger svg { width: 22px; height: 22px; }

/* ─── Overlay sidebar mobile ────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ─── Botón de navegación inferior (mobile) ───────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  z-index: 90;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 500;
  flex: 1;
  transition: color var(--transition), background var(--transition);
  cursor: pointer;
}

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

.bottom-nav-item:hover, .bottom-nav-item.active {
  color: var(--primary);
  text-decoration: none;
}

.bottom-nav-item.active { background: var(--primary-light); }

/* ─── Componentes de UI ─────────────────────────────────────── */

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(.97); }
.btn:hover { text-decoration: none; }

.btn svg { width: 16px; height: 16px; }

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); color: #fff; }

.btn-success  { background: var(--success);  color: #fff; }
.btn-success:hover  { background: #15803d; color: #fff; }

.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover   { background: #b91c1c; color: #fff; }

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

.btn-ghost    { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover    { background: var(--bg); color: var(--text); }

.btn-sm { padding: 5px 11px; font-size: .82rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-full { width: 100%; }

/* Formularios */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: #f8fafc; cursor: not-allowed; color: var(--text-secondary); }

textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 4px; }

/* Alertas / Flash */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-light); color: #14532d; border-color: #bbf7d0; }
.alert-warning { background: var(--warning-light); color: #78350f; border-color: #fde68a; }
.alert-danger  { background: var(--danger-light);  color: #7f1d1d; border-color: #fecaca; }
.alert-info    { background: var(--info-light);    color: #0c4a6e; border-color: #bae6fd; }

.flash-container {
  position: fixed;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 10px);
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  width: calc(100vw - 32px);
}

.flash-msg {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight .3s ease;
}

.flash-msg .flash-close {
  margin-left: auto;
  cursor: pointer;
  opacity: .6;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: inherit;
  flex-shrink: 0;
  padding: 0;
}
.flash-msg .flash-close:hover { opacity: 1; }

@keyframes slideInRight {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-gray    { background: #f1f5f9;              color: var(--text-secondary); }

/* Tabla */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: -ms-autohiding-scrollbar;
  width: 100%;
}

table.table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: .88rem;
}

.table thead tr { background: #f8fafc; }
.table th {
  padding: 11px 14px;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* Paginación */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn.disabled { opacity: .4; pointer-events: none; }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-zone-icon { width: 40px; height: 40px; color: var(--text-muted); margin: 0 auto 8px; }

.upload-zone-text {
  font-size: .88rem;
  color: var(--text-secondary);
}

.upload-zone-hint {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* File list preview */
.file-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.file-item-icon { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-item-icon.pdf { background: #fee2e2; color: var(--danger); }
.file-item-icon.image { background: var(--primary-light); color: var(--primary); }
.file-item-icon svg { width: 16px; height: 16px; }

.file-item-info { flex: 1; min-width: 0; }
.file-item-name { font-size: .85rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-size { font-size: .75rem; color: var(--text-muted); }

.file-item-remove { background: none; border: none; cursor: pointer; color: var(--danger); opacity: .6; transition: opacity var(--transition); padding: 4px; }
.file-item-remove:hover { opacity: 1; }
.file-item-remove svg { width: 16px; height: 16px; }

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
}

.stat-card-label { font-size: .78rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card-value { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1.2; margin-top: 4px; }
.stat-card-sub { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }

/* Utilidades */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.mt-4  { margin-top: 4px;  }
.mt-8  { margin-top: 8px;  }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px;  }
.mb-8  { margin-bottom: 8px;  }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm   { font-size: .85rem; }
.text-xs   { font-size: .75rem; }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }

/* Grid forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

/* Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open { display: block; }

  .topbar {
    left: 0;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
    margin-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    margin-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  }

  .bottom-nav { display: flex; }

  .btn-hamburger { display: flex; }

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

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

  .card-header { padding: 14px 16px; }
  .card-body   { padding: 16px; }

  .table th, .table td { padding: 10px 12px; }

  /* Ocultar/mostrar columnas en mobile */
  .hide-mobile { display: none !important; }
  .show-mobile { display: flex !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .flash-container { top: auto; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px) + 12px); right: 12px; left: 12px; max-width: 100%; width: auto; }
}

/* ─── Página de login ──────────────────────────────────────── */
body.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #2563eb 100%);
  padding: calc(16px + env(safe-area-inset-top, 0px))
           calc(16px + env(safe-area-inset-right, 0px))
           calc(16px + env(safe-area-inset-bottom, 0px))
           calc(16px + env(safe-area-inset-left, 0px));
}

.auth-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
}

@media (max-width: 480px) {
  .auth-card { padding: 28px 20px; }
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-logo-icon {
  width: 44px; height: 44px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}

.auth-logo-icon svg { width: 26px; height: 26px; color: #fff; }

.auth-logo-text { font-size: 1.3rem; font-weight: 700; color: var(--text); }

.auth-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { font-size: .88rem; color: var(--text-secondary); margin-bottom: 28px; }

/* ─── Select empresa ────────────────────────────────────────── */
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.company-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  background: #fff;
  text-align: center;
}

.company-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,.1);
}

.company-card-icon {
  width: 52px; height: 52px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}

.company-card-icon svg { width: 26px; height: 26px; }
.company-card-name { font-size: .95rem; font-weight: 600; color: var(--text); }
.company-card-rut { font-size: .78rem; color: var(--text-muted); margin-top: 3px; }

/* ─── Detail view ───────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 600px) {
  .detail-grid { grid-template-columns: 1fr; gap: 14px; }
}

.detail-field { display: flex; flex-direction: column; gap: 3px; }
.detail-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: var(--text-muted); }
.detail-value { font-size: .95rem; color: var(--text); }

/* ─── Spinners / Loading ────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Empty state ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state svg { width: 56px; height: 56px; margin: 0 auto 12px; opacity: .5; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: .88rem; }

/* ─── PWA install banner ─────────────────────────────────────── */
#pwa-banner {
  display: none;
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 12px);
  left: 12px;
  right: 12px;
  background: #0f172a;
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  z-index: 150;
  align-items: center;
  gap: 12px;
  max-width: 440px;
}

#pwa-banner.show { display: flex; }
#pwa-banner p { flex: 1; font-size: .85rem; line-height: 1.4; margin: 0; }

/* ─── PWA update banner ──────────────────────────────────────── */
#sw-update-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #166534;
  color: #fff;
  padding: 14px 20px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 16px rgba(0,0,0,.3);
  z-index: 9999;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideUp .25s ease;
}
#sw-update-banner.show { display: flex; }
#sw-update-banner p {
  flex: 1;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}
#sw-update-banner button {
  flex-shrink: 0;
  background: #fff;
  color: #166534;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ─── Modo oscuro (futuro) ─── */
@media (prefers-color-scheme: dark) {
  /* Se puede implementar en el futuro */
}
