/* ============================================================
   SISTEMA DE ASISTENCIA - LADRILLERA CHOQUE
   Design System - Dark Industrial Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ──────────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --brand-primary:    #f59e0b;   /* Amber - ladrillo/fuego */
  --brand-secondary:  #d97706;
  --brand-dark:       #92400e;
  --brand-light:      #fde68a;

  /* Dark Theme */
  --bg-base:          #0f1117;
  --bg-surface:       #1a1d27;
  --bg-card:          #21253a;
  --bg-card-hover:    #272b41;
  --bg-input:         #2a2f47;
  --bg-sidebar:       #161924;

  /* Borders */
  --border:           rgba(255,255,255,0.07);
  --border-focus:     rgba(245,158,11,0.5);

  /* Text */
  --text-primary:     #f1f5f9;
  --text-secondary:   #94a3b8;
  --text-muted:       #64748b;
  --text-brand:       #f59e0b;

  /* Status Colors */
  --color-presente:   #10b981;
  --color-falta:      #ef4444;
  --color-permiso:    #3b82f6;
  --color-vacaciones: #8b5cf6;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
  --shadow-brand: 0 4px 20px rgba(245,158,11,0.2);

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h:  64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Transitions */
  --transition: all 0.2s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--brand-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--brand-light); }

img { max-width: 100%; display: block; }

ul, ol { list-style: none; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-card-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Layout Principal ───────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-brand);
  flex-shrink: 0;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-text .brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-logo-text .brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 20px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 12px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(245,158,11,0.12);
  color: var(--brand-primary);
  font-weight: 600;
}

.nav-item.active .nav-icon {
  color: var(--brand-primary);
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 14px;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-logout:hover { color: var(--color-falta); }

/* ── MAIN CONTENT ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-date {
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ── PAGE CONTENT ───────────────────────────────────────────── */
.page-content {
  padding: 28px;
  flex: 1;
}

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--transition);
}

.card:hover { border-color: rgba(255,255,255,0.1); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── STATS GRID ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stat-card.stat-total::before   { background: var(--brand-primary); }
.stat-card.stat-present::before { background: var(--color-presente); }
.stat-card.stat-absent::before  { background: var(--color-falta); }
.stat-card.stat-sync::before    { background: var(--color-permiso); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255,255,255,0.1);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-card.stat-total .stat-icon   { background: rgba(245,158,11,0.12); color: var(--brand-primary); }
.stat-card.stat-present .stat-icon { background: rgba(16,185,129,0.12); color: var(--color-presente); }
.stat-card.stat-absent .stat-icon  { background: rgba(239,68,68,0.12);  color: var(--color-falta); }
.stat-card.stat-sync .stat-icon    { background: rgba(59,130,246,0.12); color: var(--color-permiso); }

.stat-info { flex: 1; }

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: #1a0a00;
  box-shadow: var(--shadow-brand);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(245,158,11,0.35);
  color: #1a0a00;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.15);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(239,68,68,0.1);
  color: var(--color-falta);
  border-color: rgba(239,68,68,0.2);
}

.btn-danger:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.4);
  color: var(--color-falta);
}

.btn-success {
  background: rgba(16,185,129,0.1);
  color: var(--color-presente);
  border-color: rgba(16,185,129,0.2);
}

.btn-success:hover {
  background: rgba(16,185,129,0.2);
  border-color: rgba(16,185,129,0.4);
  color: var(--color-presente);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.1);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ── TABLE ──────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  background: var(--bg-input);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: rgba(255,255,255,0.025); }

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

td .text-muted { color: var(--text-muted); }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-presente   { background: rgba(16,185,129,0.15);  color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.badge-falta      { background: rgba(239,68,68,0.15);   color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.badge-permiso    { background: rgba(59,130,246,0.15);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-vacaciones { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.2); }
.badge-activo     { background: rgba(16,185,129,0.15);  color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.badge-inactivo   { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.2); }
.badge-suspendido { background: rgba(245,158,11,0.15);  color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
}

.alert-success { background: rgba(16,185,129,0.1);  border-color: rgba(16,185,129,0.2);  color: #34d399; }
.alert-danger  { background: rgba(239,68,68,0.1);   border-color: rgba(239,68,68,0.2);   color: #f87171; }
.alert-warning { background: rgba(245,158,11,0.1);  border-color: rgba(245,158,11,0.2);  color: #fbbf24; }
.alert-info    { background: rgba(59,130,246,0.1);  border-color: rgba(59,130,246,0.2);  color: #60a5fa; }

/* ── PAGINATION ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 20px;
}

.page-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.page-item:hover, .page-item.active {
  background: var(--brand-primary);
  color: #1a0a00;
  border-color: var(--brand-primary);
}

/* ── AVATAR ─────────────────────────────────────────────────── */
.worker-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #374151, #1f2937);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  overflow: hidden;
  flex-shrink: 0;
}

.worker-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.worker-name { font-weight: 600; color: var(--text-primary); }
.worker-sub  { font-size: 12px; color: var(--text-muted); }

/* ── SEARCH & FILTERS ───────────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.search-input:focus { border-color: var(--border-focus); }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal { transform: scale(1); }

.modal-header {
  padding: 22px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title { font-size: 17px; font-weight: 700; }

.modal-close {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  font-size: 18px;
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.modal-body { padding: 0 24px 24px; }

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }

.empty-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }

.empty-desc { font-size: 13px; color: var(--text-muted); }

/* ── SYNC STATUS ────────────────────────────────────────────── */
.sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.sync-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-presente);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.85); }
}

/* ── BREADCRUMB ─────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.breadcrumb-sep { opacity: 0.4; }
.breadcrumb-current { color: var(--text-secondary); }

/* ── DIVIDER ────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── UTILITY ────────────────────────────────────────────────── */
.d-flex     { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8      { gap: 8px; }
.gap-12     { gap: 12px; }
.gap-16     { gap: 16px; }
.text-right { text-align: right; }
.text-center{ text-align: center; }
.text-muted { color: var(--text-muted); }
.text-brand { color: var(--brand-primary); }
.text-success { color: var(--color-presente); }
.text-danger  { color: var(--color-falta); }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }
.fs-12      { font-size: 12px; }
.fs-13      { font-size: 13px; }
.mt-4       { margin-top: 4px; }
.mt-8       { margin-top: 8px; }
.mt-16      { margin-top: 16px; }
.mt-20      { margin-top: 20px; }
.mb-20      { margin-bottom: 20px; }
.w-100      { width: 100%; }

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(245,158,11,0.15), transparent),
    radial-gradient(ellipse 40% 40% at 80% 80%, rgba(217,119,6,0.08), transparent);
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-brand);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── PHOTO UPLOAD ───────────────────────────────────────────── */
.photo-upload {
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
  position: relative;
  margin: 0 auto;
}

.photo-upload:hover { border-color: var(--brand-primary); }

.photo-upload img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.photo-upload-icon { font-size: 24px; color: var(--text-muted); }
.photo-upload-text { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── TIPO PAGO SELECTOR ─────────────────────────────────────── */
.tipo-pago-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.tipo-pago-option {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.tipo-pago-option:hover { border-color: rgba(245,158,11,0.3); }

.tipo-pago-option.selected {
  border-color: var(--brand-primary);
  background: rgba(245,158,11,0.08);
}

.tipo-pago-option .icon { font-size: 22px; margin-bottom: 6px; }
.tipo-pago-option .label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

/* ── LOADING SPINNER ─────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ─────────────────────────────────────────────── */

/* Botón hamburguesa: oculto en desktop, visible solo en móvil */
.sidebar-toggle-btn {
  display: none;
}

@media (max-width: 768px) {
  /* Mostrar hamburguesa */
  .sidebar-toggle-btn {
    display: inline-flex !important;
  }

  /* Sidebar oculto fuera de pantalla */
  .sidebar {
    transform: translateX(-100%);
    z-index: 300;
  }

  /* Sidebar abierto */
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.6);
  }

  /* Overlay oscuro detrás del sidebar */
  .sidebar.mobile-open::after {
    content: '';
    position: fixed;
    inset: 0;
    left: var(--sidebar-w);
    background: rgba(0,0,0,0.5);
    z-index: -1;
    backdrop-filter: blur(2px);
  }

  .main-content  { margin-left: 0; }
  .stats-grid    { grid-template-columns: 1fr 1fr; }
  .form-row,
  .form-row-3    { grid-template-columns: 1fr; }
  .page-content  { padding: 16px; }
  .topbar        { padding: 0 16px; }
  .tipo-pago-options { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }

  /* Tabla horizontal scroll suave */
  .table-wrapper { -webkit-overflow-scrolling: touch; }

  /* Modal full width en móvil pequeño */
  .modal { max-width: 100% !important; margin: 0 8px; }
}

/* Safe area para iPhone con notch/Dynamic Island */
@supports (padding: env(safe-area-inset-top)) {
  .topbar {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
  }
  .sidebar {
    padding-top: env(safe-area-inset-top);
  }
}
