/* ============================================================
   DXN PROMOS MANAGER — Design System (dxn.css)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* DXN Apple Style Theme */
  /* Reusing existing variable names for backward compatibility */
  --green: #1a2674;        /* DXN Blue Primary */
  --green-dark: #121a52;   /* DXN Blue Dark */
  --green-light: #eff1f9;  /* Light Blue Background */
  --green-mid: #2a3aa5;    /* Mid Blue Hover */
  
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface2: #f5f5f7;     /* Secondary surface */
  --border: #d7dce5;
  --border-light: #e8ebf1;
  
  --text: #151927;
  --text-2: #303647;
  --text-3: #62697a;
  --text-4: #8c93a3;
  
  --red: #e83427;          /* DXN Red */
  --orange: #ff9f0a;
  --blue: #007aff;
  --true-green: #1a7a3c;   /* DXN Green for success states */
  
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  
  --shadow: 0 8px 24px rgba(20, 28, 58, .06), 0 1px 3px rgba(20, 28, 58, .06);
  --shadow-hover: 0 14px 34px rgba(20, 28, 58, .11);
  --nav-h: 68px;
}

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

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

button, input, select, textarea { font: inherit; }

:focus-visible {
  outline: 3px solid rgba(42, 58, 165, .22);
  outline-offset: 2px;
}

a {
  color: var(--green);
  text-decoration: none;
}

a:hover {
  color: var(--green-dark);
}

/* ── Navbar ────────────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  padding: 0 clamp(16px, 3vw, 36px);
  z-index: 1000;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 4px 18px rgba(20, 28, 58, .04);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  margin-right: 34px;
  white-space: nowrap;
  letter-spacing: -0.5px;
}

.nav-brand .brand-icon {
  font-size: 1.4rem;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}

.nav-links a {
  color: var(--text-2);
  padding: 9px 13px;
  border-radius: var(--radius-xs);
  font-size: .875rem;
  font-weight: 500;
  transition: all .2s ease;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--green-light);
  color: var(--green);
}

.nav-links a.active { box-shadow: inset 0 -2px 0 var(--green); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  padding: 4px 12px 4px 6px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 500;
}

.user-chip .avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .75rem;
  color: #fff;
}

.btn-logout-nav {
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: .8rem;
  cursor: pointer;
  transition: all .2s;
}

.btn-logout-nav:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-logout-nav:focus-visible,
.nav-hamburger:focus-visible { outline-color: rgba(26, 38, 116, .3); }

/* Hamburger */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}

/* ── Drawer (mobile) ───────────────────────────────────────── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 1100;
  opacity: 0;
  transition: opacity .3s;
}

.drawer-overlay.open {
  display: block;
  opacity: 1;
}

.nav-drawer {
  position: fixed;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100vh;
  background: var(--surface);
  z-index: 1200;
  transition: right .3s ease;
  box-shadow: -4px 0 20px rgba(0, 0, 0, .15);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.nav-drawer.open {
  right: 0;
}

.drawer-header {
  background: var(--green-dark);
  padding: 24px 20px;
  color: #fff;
}

.drawer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--green-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.drawer-name {
  font-weight: 600;
  font-size: 1rem;
}

.drawer-meta {
  font-size: .78rem;
  opacity: .75;
  margin-top: 2px;
}

.drawer-links {
  padding: 12px 0;
  flex: 1;
}

.drawer-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text);
  font-size: .92rem;
  font-weight: 500;
  transition: background .15s;
}

.drawer-links a:hover,
.drawer-links a.active {
  background: var(--green-light);
  color: var(--green-dark);
}

.drawer-links a i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  margin-top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
}

.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.page-title {
  font-size: clamp(1.45rem, 2vw, 1.8rem);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: .92rem;
  color: var(--text-3);
  margin-bottom: 20px;
}

/* ── Section Card ──────────────────────────────────────────── */
.section-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  margin-bottom: 20px;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.section-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

.section-body {
  padding: 20px;
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform .2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: 2px;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: .82rem;
  color: var(--text-3);
  font-weight: 500;
}

.stat-card.orange .stat-number {
  color: var(--orange);
}

.stat-card.green .stat-number {
  color: var(--green);
}

.stat-card.blue .stat-number {
  color: var(--blue);
}

.stat-card.red .stat-number {
  color: var(--red);
}

/* ── Badges ────────────────────────────────────────────────── */
.badge-estado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pendiente {
  background: #fff3cd;
  color: #856404;
}

.badge-entregado {
  background: #d4edda;
  color: #155724;
}

.badge-cancelado {
  background: #f8d7da;
  color: #721c24;
}

.badge-activa {
  background: var(--green-light);
  color: var(--green-dark);
}

.badge-pausada {
  background: #fff3cd;
  color: #856404;
}

.badge-cerrada {
  background: #f8d7da;
  color: #721c24;
}

/* Role pills */
.role-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: .72rem;
  font-weight: 600;
}

.role-admin_general {
  background: #f8d7da;
  color: #721c24;
}

.role-admin_centro {
  background: #fff3cd;
  color: #856404;
}

.role-vendedor {
  background: #d1ecf1;
  color: #0c5460;
}

/* ── Tables ────────────────────────────────────────────────── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  font-size: .875rem;
}

.table th {
  background: var(--surface2);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
  border-color: var(--border-light);
}

.table tbody tr { transition: background-color .15s ease; }
.table tbody tr:hover { background: #f8f9fc; }

.form-control,
.form-select {
  border-color: var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(42, 58, 165, .12);
}

.form-label { color: var(--text-2); font-weight: 600; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-dxn {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  font-size: .875rem;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 5px 14px rgba(26, 38, 116, .2);
}

.btn-dxn:hover {
  background: var(--green-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(26, 38, 116, .26);
}

.btn-dxn-outline {
  background: transparent;
  color: var(--green);
  border: 1.5px solid var(--green);
  padding: 7px 16px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  font-size: .875rem;
  cursor: pointer;
  transition: all .2s;
}

.btn-dxn-outline:hover {
  background: var(--green);
  color: #fff;
}

.btn-sm {
  padding: 4px 10px;
  font-size: .78rem;
}

/* ── Filters Bar ───────────────────────────────────────────── */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.filters-bar .form-control,
.filters-bar .form-select {
  max-width: 180px;
  font-size: .85rem;
}

.filters-bar label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 2px;
}

/* ── Upload Zone ───────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  transition: all .3s;
  cursor: pointer;
  position: relative;
  background: var(--surface2);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--green);
  background: var(--green-light);
}

.upload-zone.has-file {
  border-color: var(--green);
  border-style: solid;
}

.upload-zone .upload-icon {
  font-size: 2rem;
  color: var(--text-4);
}

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

.upload-zone .upload-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-xs);
  margin-top: 8px;
}

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

.upload-btns {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.upload-btns label,
.upload-btns .btn {
  font-size: .78rem;
  padding: 5px 12px;
}

/* Hidden file inputs */
.upload-zone input[type="file"] {
  display: none;
}

/* ── Signature Pad ─────────────────────────────────────────── */
.sig-wrap {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  position: relative;
}

.sig-canvas {
  display: block;
  width: 100%;
  height: 180px;
  cursor: crosshair;
  touch-action: none;
}

.sig-actions {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-light);
  background: var(--surface2);
}

/* ── Form Sections ─────────────────────────────────────────── */
.form-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title i {
  color: var(--green);
}

.form-row-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Login Page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.login-hero {
  background: transparent;
  padding: 40px 32px 10px;
  text-align: center;
  color: var(--text);
}

.login-hero .login-logo {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.login-hero h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0;
  color: var(--text);
}

.login-hero p {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-3);
  margin: 6px 0 0;
}

.login-body {
  padding: 24px 32px 40px;
}

.login-body .form-label {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text-2);
}

.login-body .form-control {
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  font-size: .95rem;
  border: 1px solid var(--border);
  background: var(--surface2);
  transition: all 0.2s ease;
}

.login-body .form-control:focus {
  border-color: var(--green);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(26, 38, 116, 0.1);
}

.login-body .btn-login {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-xs);
  background: var(--green);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all .2s ease;
  margin-top: 12px;
  box-shadow: 0 4px 12px rgba(26, 38, 116, 0.2);
}

.login-body .btn-login:hover {
  background: var(--green-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(26, 38, 116, 0.3);
}

/* ── Portal Page ───────────────────────────────────────────── */
.portal-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--green-dark), #0a3d1e);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.portal-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, .25);
  width: 100%;
  max-width: 550px;
  overflow: hidden;
}

.portal-hero {
  background: var(--green-dark);
  padding: 28px 24px;
  text-align: center;
  color: #fff;
}

.portal-body {
  padding: 28px 24px;
}

/* ── Bar Chart (CSS only) ──────────────────────────────────── */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 140px;
  padding: 0 10px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.bar-fill {
  width: 100%;
  max-width: 48px;
  background: linear-gradient(180deg, var(--green-mid), var(--green));
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height .4s ease;
}

.bar-value {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 4px;
}

.bar-label {
  font-size: .65rem;
  color: var(--text-4);
  margin-top: 6px;
  text-align: center;
  word-break: break-word;
  max-width: 60px;
}

/* ── Progress Overlay ──────────────────────────────────────── */
.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

.upload-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.upload-overlay-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
  max-width: 360px;
  width: 100%;
}

.upload-overlay-card h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-mid));
  width: 0%;
  transition: width .3s;
  border-radius: 4px;
}

.progress-text {
  font-size: .82rem;
  color: var(--text-3);
  margin-top: 8px;
}

/* ── Alert Tweaks ──────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-xs);
  font-size: .875rem;
  border: 1px solid currentColor;
  box-shadow: 0 4px 14px rgba(20, 28, 58, .05);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Print View ────────────────────────────────────────────── */
.print-view {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px;
}

.print-header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 3px solid var(--green);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.print-logo {
  font-size: 2rem;
  font-weight: 800;
  color: var(--green-dark);
}

.print-company {
  font-size: .85rem;
  color: var(--text-3);
}

.print-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green-dark);
  text-align: center;
  margin-bottom: 24px;
}

.print-section {
  margin-bottom: 20px;
}

.print-section h3 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--green);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.print-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}

.print-field {
  font-size: .82rem;
  padding: 3px 0;
}

.print-field strong {
  color: var(--text-3);
  font-weight: 600;
}

.print-photos {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.print-photos img {
  max-width: 200px;
  max-height: 150px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
}

.print-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--text-4);
}

/* ── Locked field ──────────────────────────────────────────── */
.locked-field {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  font-size: .9rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.locked-field .lock-icon {
  color: var(--orange);
}

/* ── Campaign banner ───────────────────────────────────────── */
.campaign-banner {
  background: linear-gradient(135deg, var(--green), var(--green-mid));
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.campaign-banner h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.campaign-banner .cb-meta {
  display: flex;
  gap: 20px;
  font-size: .85rem;
  opacity: .9;
  flex-wrap: wrap;
}

/* ── Tabs ─────────────────────────────────────────────────── */
.nav-tabs .nav-link {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-3);
}

.nav-tabs .nav-link.active {
  color: var(--green);
  border-color: var(--border-light) var(--border-light) #fff;
}

/* ── PV Indicator ──────────────────────────────────────────── */
.pv-ok {
  color: var(--green);
  font-weight: 700;
}

.pv-fail {
  color: var(--red);
  font-weight: 700;
}

/* ── My deliveries counter ─────────────────────────────────── */
.my-counter {
  background: rgba(255, 255, 255, .15);
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .9rem;
  margin-top: 10px;
}

/* ── Centro stats grid ─────────────────────────────────────── */
.centros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.centro-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--green);
}

.centro-card h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.centro-card .centro-meta {
  font-size: .8rem;
  color: var(--text-3);
  display: flex;
  gap: 16px;
}

/* ── PDF Preview in upload zone ────────────────────────────── */
.pdf-preview-icon {
  text-align: center;
  padding: 16px 0;
}

.pdf-preview-icon i {
  font-size: 3.5rem;
  color: #dc3545;
}

/* ── Responsive ────────────────────────────────────────────── */

/* === Tablet & below (≤ 768px) === */
@media (max-width: 768px) {

  /* Navigation */
  .nav-links {
    display: none;
  }

  .nav-user {
    display: none;
  }

  .nav-hamburger {
    display: block;
  }

  /* Layout */
  .page-container {
    padding: 16px 12px;
  }

  .page-title {
    font-size: 1.2rem;
  }

  .page-subtitle {
    font-size: .84rem;
    margin-bottom: 14px;
  }

  /* Grid system */
  .row {
    --bs-gutter-x: 12px;
  }

  .col-md-6,
  .col-md-4,
  .col-lg-6 {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* Stats */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-number {
    font-size: 1.4rem;
  }

  /* Section cards */
  .section-card {
    border-radius: var(--radius-sm);
  }

  .section-header {
    padding: 12px 16px;
  }

  .section-header h2 {
    font-size: .95rem;
  }

  .section-body {
    padding: 16px;
  }

  /* Form sections */
  .form-section {
    padding: 16px;
    margin-bottom: 12px;
  }

  .form-row-dual {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Upload zones */
  .upload-zone {
    padding: 16px;
    min-height: 100px;
  }

  .upload-zone .upload-preview {
    max-height: 160px;
  }

  /* Signature pad */
  .sig-canvas {
    height: 150px;
  }

  /* Filters */
  .filters-bar {
    flex-direction: column;
    gap: 8px;
  }

  .filters-bar .form-control,
  .filters-bar .form-select {
    max-width: 100%;
  }

  /* Tables */
  .table {
    font-size: .8rem;
  }

  .table th {
    font-size: .72rem;
    padding: 8px 6px;
  }

  .table td {
    padding: 8px 6px;
  }

  .table .btn-sm {
    padding: 2px 8px;
    font-size: .72rem;
  }

  /* Buttons */
  .btn-dxn {
    padding: 10px 16px;
    font-size: .85rem;
  }

  .d-flex.justify-content-between {
    flex-direction: column;
    gap: 10px;
  }

  .d-flex.justify-content-between .d-flex {
    width: 100%;
  }

  /* Print */
  .print-grid {
    grid-template-columns: 1fr;
  }

  .print-view {
    padding: 16px;
  }

  .print-photos img {
    max-width: 140px;
    max-height: 100px;
  }

  /* Centros grid */
  .centros-grid {
    grid-template-columns: 1fr;
  }

  /* Campaign banner */
  .campaign-banner {
    padding: 16px;
  }

  .campaign-banner h2 {
    font-size: 1.05rem;
  }

  .campaign-banner .cb-meta {
    gap: 10px;
    font-size: .78rem;
  }

  /* Bar chart */
  .bar-chart {
    height: 100px;
    gap: 6px;
    padding: 0 4px;
  }

  .bar-label {
    font-size: .58rem;
    max-width: 40px;
  }

  .bar-value {
    font-size: .65rem;
  }

  /* Upload overlay */
  .upload-overlay-card {
    padding: 24px 20px;
    margin: 0 16px;
  }

  /* Alert */
  .alert {
    font-size: .8rem;
    padding: 10px 14px;
  }

  /* Locked field */
  .locked-field {
    font-size: .82rem;
    padding: 8px 12px;
    flex-wrap: wrap;
  }
}

/* === Phone (≤ 480px) === */
@media (max-width: 480px) {

  /* Layout */
  .page-container {
    padding: 12px 10px;
  }

  .page-title {
    font-size: 1.1rem;
  }

  /* Stats single column */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .stat-icon {
    font-size: 1.2rem;
    margin-bottom: 0;
  }

  /* Upload zones compact */
  .upload-zone {
    padding: 12px;
    min-height: 80px;
    gap: 6px;
  }

  .upload-zone .btn {
    font-size: .72rem;
    padding: 4px 10px;
  }

  /* Section cards tight */
  .section-header h2 {
    font-size: .88rem;
  }

  .section-body {
    padding: 12px;
  }

  .form-section {
    padding: 12px;
  }

  .form-section-title {
    font-size: .92rem;
    margin-bottom: 12px;
  }

  /* Signature compact */
  .sig-canvas {
    height: 120px;
  }

  /* Table card layout for small screens */
  .table-responsive {
    margin: 0 -12px;
  }

  .table th {
    font-size: .68rem;
  }

  .table td {
    font-size: .75rem;
  }

  /* Pagination compact */
  .pagination .page-item .page-link {
    padding: 4px 8px;
    min-width: 30px;
    font-size: .78rem;
  }

  /* Buttons full width */
  .btn-dxn.btn-lg {
    font-size: .9rem;
    padding: 12px;
  }

  /* Nav brand */
  .nav-brand {
    font-size: .95rem;
    margin-right: 8px;
  }

  .nav-brand .brand-icon {
    font-size: 1.2rem;
  }

  /* Progress overlay */
  .upload-overlay-card {
    padding: 20px 16px;
  }

  .upload-overlay-card h3 {
    font-size: 1rem;
  }

  /* Bar chart minimal */
  .bar-chart {
    height: 80px;
    gap: 4px;
  }

  .bar-label {
    font-size: .5rem;
    max-width: 30px;
  }

  .bar-fill {
    max-width: 28px;
  }

  /* Print */
  .print-header {
    flex-direction: column;
    text-align: center;
  }

  .print-photos {
    justify-content: center;
  }

  .print-photos img {
    max-width: 120px;
  }

  .print-footer {
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }
}

/* === Touch-friendly overrides === */
@media (hover: none) and (pointer: coarse) {
  .upload-zone {
    min-height: 100px;
  }

  .upload-zone .btn {
    min-height: 40px;
    font-size: .82rem;
  }

  .form-control,
  .form-select {
    min-height: 42px;
    font-size: .9rem !important;
  }

  .btn {
    min-height: 38px;
  }

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

/* ── Pagination ────────────────────────────────────────── */
nav .pagination,
.pagination {
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination .page-item .page-link {
  border: 1px solid var(--border, #e8e8ed);
  border-radius: 8px !important;
  color: var(--text-2, #424245);
  font-size: .85rem;
  font-weight: 500;
  padding: 6px 12px;
  min-width: 36px;
  text-align: center;
  transition: all .2s;
  line-height: 1.4;
}

.pagination .page-item .page-link:hover {
  background: var(--green-light, #e8f5ee);
  border-color: var(--green, #1a7a3c);
  color: var(--green, #1a7a3c);
}

.pagination .page-item.active .page-link,
.pagination .page-item.active .page-link:hover {
  background: var(--green, #1a7a3c);
  border-color: var(--green, #1a7a3c);
  color: #fff;
  box-shadow: 0 2px 6px rgba(26, 122, 60, .25);
}

.pagination .page-item.disabled .page-link {
  opacity: .4;
  pointer-events: none;
  background: var(--bg, #f5f5f7);
  border-color: var(--border, #e8e8ed);
  color: var(--text-4, #a1a1a6);
}

/* Arrow nav buttons */
.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
  font-weight: 700;
  padding: 6px 10px;
}

/* SVG arrows inside pagination fix */
.pagination .page-link svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

@media print {
  .no-print {
    display: none !important;
  }

  .site-nav,
  .nav-drawer,
  .drawer-overlay {
    display: none !important;
  }

  .main-content {
    margin-top: 0;
  }

  body {
    background: #fff;
  }

  .print-view {
    padding: 0;
    max-width: 100%;
  }

  .print-body {
    display: flex;
    gap: 20px;
  }
  .print-main-column {
    flex: 65%;
  }
  .print-side-column {
    flex: 35%;
  }
}

/* ── Print Receipt Specific Styles ─────────────────────────── */
.print-view {
  background: #fff;
  padding: 30px;
  max-width: 900px;
  margin: 20px auto;
  color: #1d1d1f;
  border: 1px solid #e8e8ed;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

@media print {
  .print-view {
    border: none;
  box-shadow: 0 5px 14px rgba(26, 38, 116, .2);
    margin: 0;
    padding: 10px;
  }
}

.print-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--green-dark);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.print-logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--green-dark);
  letter-spacing: -0.5px;
}

.print-logo-container img {
  height: 45px;
}

.print-company-info {
  text-align: right;
}

.print-company-info strong {
  font-size: 1.1rem;
  color: var(--text);
  display: block;
  font-weight: 700;
}

.print-company-info span {
  font-size: 0.85rem;
  color: var(--text-3);
  display: block;
  margin-top: 2px;
}

.print-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 28px;
  color: var(--text);
}

.print-body {
  display: flex;
  gap: 30px;
}

.print-main-column {
  flex: 65%;
}

.print-side-column {
  flex: 35%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.print-section {
  margin-bottom: 24px;
}

.print-section h3 {
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 12px;
  color: var(--green-dark);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.print-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  font-size: 0.9rem;
}

.print-field strong {
  display: inline-block;
  color: var(--text-2);
  font-weight: 600;
  margin-right: 4px;
}

/* Photo evidence section */
.print-photo-box {
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  background: var(--surface2);
}

.print-photo-box h4 {
  font-size: 0.85rem;
  margin: 0 0 12px;
  color: var(--text-2);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.print-photo-main {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.print-docs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

.print-doc-img {
  width: 100%;
  height: 240px;
  object-fit: contain;
  background: var(--surface2);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.print-signature-box {
  margin-top: 10px;
  text-align: center;
}

.print-signature-img {
  max-width: 100%;
  height: 120px;
  object-fit: contain;
  border-bottom: 1px solid var(--text);
  margin-bottom: 6px;
}

.print-signature-box span {
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 500;
}

.print-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-4);
  font-weight: 500;
}

/* ── Shared Mobile Components ─────────────────────────────── */
.mobile-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface, #fff);
  border: 1.5px solid var(--border-light, #e8e8ed);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.mobile-search-bar i { color: var(--text-4, #888); font-size: 1.1rem; flex-shrink: 0; }
.mobile-search-bar input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: .92rem; color: var(--text, #050505); font-family: inherit;
}
.mobile-search-bar input::placeholder { color: var(--text-4, #888); }

.filter-toggle-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none;
  color: var(--text-2, #222); font-size: .85rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; padding: 4px 8px;
  border-radius: 8px; transition: background .15s;
}
.filter-toggle-btn:hover, .filter-toggle-btn.active { background: var(--green-light, #eff1f9); }

.mobile-filter-row {
  display: none;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; margin-top: 10px;
  animation: slideDown .25s ease;
}
.mobile-filter-row.open { display: grid; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mobile-filter-select {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border-light, #e8e8ed);
  border-radius: 10px; background: var(--surface, #fff);
  font-size: .82rem; font-weight: 600;
  color: var(--text-2, #222); font-family: inherit;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.mobile-filter-actions {
  grid-column: 1 / -1;
  display: flex; gap: 8px; margin-top: 2px;
}

.btn-mobile-filter-apply {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px; border: none; border-radius: 10px;
  background: var(--green, #1a2674); color: #fff;
  font-size: .82rem; font-weight: 700;
  font-family: inherit; cursor: pointer;
  transition: background .2s;
}
.btn-mobile-filter-apply:hover { background: var(--green-dark, #121a52); }

.btn-mobile-filter-clear {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px;
  border: 1.5px solid var(--border, #d2d2d7);
  border-radius: 10px; background: transparent;
  color: var(--text-3, #555); font-size: .82rem; font-weight: 600;
  text-decoration: none; transition: all .2s;
}

/* ── Bottom Tab Navigation (mobile) ───────────────────────── */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 1000;
    padding: 0;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .bottom-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-4, #888);
    font-size: .62rem;
    font-weight: 600;
    padding: 6px 0;
    flex: 1;
    transition: color .15s;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-tab i {
    font-size: 1.25rem;
    line-height: 1;
  }

  .bottom-tab.active {
    color: var(--green, #1a2674);
  }

  .bottom-tab.active i {
    transform: scale(1.1);
  }

  .main-content {
    padding-bottom: 72px;
  }
}

/* ── Professional UI refinement ───────────────────────────── */
.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-copy strong {
  color: var(--green-dark);
  font-size: 1rem;
  letter-spacing: .02em;
}

.brand-copy small {
  color: var(--text-3);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .04em;
  margin-top: 3px;
}

.site-nav::after {
  content: '';
  position: absolute;
  inset: auto 0 -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--green) 0 72%, var(--red) 72% 100%);
  opacity: .9;
}

.nav-brand img { width: 34px; height: 34px; object-fit: contain; }

.section-header h2 i {
  color: var(--green);
  margin-right: 6px;
}

.section-body > :last-child { margin-bottom: 0; }

.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
  content: '';
  position: absolute;
  width: 74px;
  height: 74px;
  right: -28px;
  top: -30px;
  border-radius: 50%;
  background: currentColor;
  opacity: .035;
}

.stat-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface2);
}

.input-group-text {
  color: var(--green);
  background: #f7f8fb;
  border-color: var(--border);
}

.form-control,
.form-select,
.input-group-text { min-height: 42px; }

.btn, .btn-dxn, .btn-dxn-outline { font-weight: 650; }

.login-page {
  background:
    radial-gradient(circle at 8% 10%, rgba(26, 38, 116, .13), transparent 30rem),
    radial-gradient(circle at 94% 90%, rgba(232, 52, 39, .08), transparent 26rem),
    var(--bg);
}

.login-card {
  max-width: 440px;
  box-shadow: 0 28px 80px rgba(20, 28, 58, .16);
}

.login-card::before {
  content: '';
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--green) 0 74%, var(--red) 74%);
}

.login-eyebrow {
  display: inline-block;
  color: var(--green);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  margin-bottom: 9px;
}

.login-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-4);
  font-size: .7rem;
  margin-top: 18px;
}

.login-security i { color: var(--true-green); }

@media (max-width: 1100px) and (min-width: 769px) {
  .user-chip > span:last-child { display: none; }
  .user-chip { padding-right: 6px; }
  .nav-brand { margin-right: 16px; }
  .nav-links a { padding-inline: 9px; font-size: .8rem; }
}

@media (max-width: 768px) {
  .site-nav { height: 62px; }
  :root { --nav-h: 62px; }
  .nav-brand img { width: 30px; height: 30px; }
  .page-container { padding-top: 20px; }
  .section-card, .form-section { box-shadow: 0 5px 18px rgba(20, 28, 58, .055); }
  .mobile-bottom-nav { box-shadow: 0 -8px 24px rgba(20, 28, 58, .07); }
  .bottom-tab { min-width: 0; }
}

@media (max-width: 480px) {
  .login-page { align-items: flex-start; padding: 20px 12px; }
  .login-card { margin-top: max(10px, 4vh); border-radius: 16px; }
  .login-hero { padding: 30px 20px 8px; }
  .login-body { padding: 22px 20px 30px; }
  .login-hero .login-logo img { height: 54px; }
  .brand-copy small { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { flex-direction: column; align-items: flex-start; gap: 7px; }
  .stat-icon { width: 34px; height: 34px; }
}
