/* ============================================================
   TENIS EL CAMPEON - Design System
   Unified CSS for the entire application
   ============================================================ */

/* ── PWA SPLASH SCREEN ──────────────────────────────────────── */
#pwa-splash {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1.2rem;
  background: #09090b;
  transition: opacity .4s ease, visibility .4s ease;
}
#pwa-splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.pwa-splash-logo { width: 96px; height: 96px; object-fit: contain; animation: splashPulse 1.5s ease-in-out infinite; }
.pwa-splash-name { color: #fff; font-family: 'Inter', sans-serif; font-size: 1.2rem; font-weight: 700; letter-spacing: .04em; }
.pwa-splash-spinner {
  width: 28px; height: 28px; margin-top: .5rem;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: #2563eb; border-radius: 50%;
  animation: splashSpin .7s linear infinite;
}
@keyframes splashSpin { to { transform: rotate(360deg); } }
@keyframes splashPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ── DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #eff6ff;
  --color-primary-muted: rgba(37,99,235,.12);
  --color-success: #10b981;
  --color-success-hover: #059669;
  --color-success-light: #ecfdf5;
  --color-warning: #f59e0b;
  --color-warning-hover: #d97706;
  --color-warning-light: #fffbeb;
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-danger-light: #fef2f2;
  --color-info: #3b82f6;
  --color-info-light: #eff6ff;

  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --bg-muted: #f8fafc;
  --bg-input: #ffffff;
  --bg-raised: #ffffff;

  --sidebar-bg: #1e293b;
  --sidebar-width: 68px;
  --sidebar-expanded: 220px;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255,255,255,.08);

  --topbar-bg: #ffffff;
  --topbar-height: 58px;
  --topbar-border: #e2e8f0;

  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.04);
  --shadow-xl: 0 20px 40px rgba(0,0,0,.1);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --ease: cubic-bezier(.4,0,.2,1);
  --duration: 180ms;
  --duration-lg: 260ms;
}

/* ── DARK THEME TOKENS ──────────────────────────────────────── */
[data-theme="oscuro"] {
  --bg-page: #0f172a;
  --bg-card: #1e293b;
  --bg-muted: #1e293b;
  --bg-input: #0f172a;
  --bg-raised: #334155;
  --topbar-bg: #1e293b;
  --topbar-border: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --border-hover: #475569;
  --color-primary-light: rgba(37,99,235,.15);
  --color-success-light: rgba(16,185,129,.12);
  --color-warning-light: rgba(245,158,11,.12);
  --color-danger-light: rgba(239,68,68,.12);
  --color-info-light: rgba(59,130,246,.12);
}

/* ── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

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

/* ── SCROLLBAR ──────────────────────────────────────────────── */
html { scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { color: var(--text-primary); font-weight: 600; line-height: 1.3; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.015em; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }
h5 { font-size: 1rem; font-weight: 600; }
p { color: var(--text-secondary); margin: 0 0 .75rem; }
small { color: var(--text-muted); }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* ── SIDEBAR LAYOUT ─────────────────────────────────────────── */
.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  width: var(--sidebar-width);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.06);
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
  overflow: hidden;
  transition: width .25s cubic-bezier(.4,0,.2,1);
}
.sidebar.expanded { width: var(--sidebar-expanded); }

.sidebar .logo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0 .6rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: .4rem;
}
.sidebar .logo-img {
  width: 44px; height: 44px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(37,99,235,.12);
  padding: 4px;
  border: 1px solid rgba(37,99,235,.2);
  transition: transform .2s ease, box-shadow .2s ease;
}
.sidebar .logo-img:hover {
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(37,99,235,.3);
}
.sidebar .logo-text {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--sidebar-text);
  text-transform: uppercase;
  display: none;
  margin-top: .35rem;
  white-space: nowrap;
}
.sidebar.expanded .logo-text { display: block; }

.sidebar nav { flex: 1; padding: .25rem .5rem; }
.sidebar .nav-link {
  color: var(--sidebar-text);
  padding: .65rem .6rem;
  text-align: left;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: 3px 0;
  font-weight: 500;
  font-size: .84rem;
  white-space: nowrap;
  position: relative;
  text-decoration: none;
  min-height: 44px;
  transition: background .18s ease, color .18s ease, transform .15s ease;
}
.sidebar .nav-link .bi {
  font-size: 1.25rem;
  flex-shrink: 0;
  width: 1.3rem;
  text-align: center;
  transition: color .18s ease;
}
.sidebar .nav-link span { display: none; overflow: hidden; }
.sidebar.expanded .nav-link span { display: inline; }
.sidebar.expanded .nav-link { justify-content: flex-start; }
.sidebar .nav-link:hover {
  color: #e2e8f0;
  background: rgba(255,255,255,.06);
  transform: translateX(2px);
}
.sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(37,99,235,.85), rgba(29,78,216,.95));
  box-shadow: 0 4px 14px rgba(37,99,235,.35), inset 0 1px 0 rgba(255,255,255,.1);
}
.sidebar .nav-link.active .bi {
  filter: drop-shadow(0 0 4px rgba(96,165,250,.5));
}
.sidebar .nav-link.active:hover {
  background: linear-gradient(135deg, rgba(37,99,235,.95), rgba(29,78,216,1));
  transform: none;
}
.sidebar .nav-link.logout-link:hover {
  background: rgba(239,68,68,.12);
  color: #f87171;
  transform: translateX(2px);
}

.sidebar .user-info {
  margin-top: auto;
  padding: .75rem .5rem;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}
.sidebar .user-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(37,99,235,.3);
}
.sidebar .user-circle .bi { font-size: 1.2rem; color: #fff; }
.sidebar .username {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sidebar .user-name {
  font-size: .76rem;
  font-weight: 600;
  color: #e2e8f0;
  text-align: center;
  line-height: 1.2;
  max-width: 140px;
  white-space: normal;
  word-break: break-word;
  display: none;
}
.sidebar .user-role {
  font-size: .65rem;
  color: #60a5fa;
  font-weight: 600;
  letter-spacing: .03em;
  display: none;
}
.sidebar.expanded .user-name,
.sidebar.expanded .user-role { display: block; }

/* ── MAIN CONTENT ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left .22s var(--ease);
}
.sidebar.expanded ~ .main-content { margin-left: var(--sidebar-expanded); }

/* ── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  background: var(--topbar-bg);
  box-shadow: var(--shadow-sm);
  padding: 0 1.75rem;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--topbar-border);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.toggle-sidebar {
  font-size: 1.45rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: .3rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.toggle-sidebar:hover { background: var(--bg-page); color: var(--color-primary); }
.empresa-text {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  letter-spacing: .5px;
}
.topbar-icons { display: flex; align-items: center; gap: .5rem; }
.topbar-icon-wrap { position: relative; }
.topbar-icon-wrap a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  transition: background var(--duration) var(--ease);
}
.topbar-icon-wrap a:hover { background: var(--bg-page); }
.topbar-icon-wrap a .bi { font-size: 1.25rem; color: var(--text-muted); }
.badge-noti {
  position: absolute;
  top: 2px; right: 2px;
  font-size: .65em;
  min-width: 16px; height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar .dropdown-toggle {
  color: var(--text-primary);
  font-weight: 600;
  font-size: .875rem;
  padding: .35rem .65rem;
  border-radius: var(--radius-sm);
  transition: background var(--duration) var(--ease);
}
.topbar .dropdown-toggle:hover { background: var(--bg-page); }
.topbar .bi-person-circle { color: var(--text-secondary); font-size: 1.8rem; }
.topbar .dropdown-username { color: var(--color-primary); }

/* SweetAlert detail preview used in messaging/confirmation dialogs */
.swal-detail-preview { text-align: left; margin: 1rem 0; }
.swal-chat-options { text-align: left; }
.swal-chat-options .btn { margin: .5rem; background: var(--color-danger); color: #fff; }

/* ── CONTENT AREA ───────────────────────────────────────────── */
.content-area { padding: 1.5rem; }

/* ── PAGE HEADER ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.02em;
  margin: 0 0 .15rem;
}
.page-subtitle {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 400;
}
.page-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
}
.card-body { padding: 1.25rem; }
.card-title { font-size: .9rem; font-weight: 600; color: var(--text-primary); margin: 0; }

/* ── METRIC CARDS ───────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.metric-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.metric-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.metric-icon.blue { background: var(--color-primary-light); color: var(--color-primary); }
.metric-icon.green { background: var(--color-success-light); color: var(--color-success); }
.metric-icon.amber { background: var(--color-warning-light); color: var(--color-warning); }
.metric-icon.red { background: var(--color-danger-light); color: var(--color-danger); }
.metric-icon.info { background: var(--color-info-light); color: var(--color-info); }
.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.metric-label {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 500;
  margin-top: .15rem;
}
.metric-trend {
  display: inline-flex;
  align-items: center;
  font-size: .7rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: var(--radius-full);
  margin-top: .35rem;
}
.metric-trend.up { background: var(--color-success-light); color: var(--color-success); }
.metric-trend.down { background: var(--color-danger-light); color: var(--color-danger); }
.metric-trend.neutral { background: var(--color-primary-light); color: var(--color-primary); }

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-primary);
  font-size: .85rem;
  margin: 0;
}
.table th {
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-primary);
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: var(--bg-muted); }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  font-size: .82rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  transition: background var(--duration) var(--ease), box-shadow var(--duration) var(--ease),
              transform var(--duration) var(--ease), border-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.btn-success { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.btn-success:hover { background: var(--color-success-hover); color: #fff; box-shadow: 0 4px 12px rgba(16,185,129,.3); }
.btn-danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger-hover); color: #fff; box-shadow: 0 4px 12px rgba(239,68,68,.3); }
.btn-warning { background: var(--color-warning); color: #fff; border-color: var(--color-warning); }
.btn-warning:hover { background: var(--color-warning-hover); color: #fff; }
.btn-secondary { background: var(--bg-raised); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-page); border-color: var(--border-hover); color: var(--text-primary); }
.btn-outline-primary { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline-primary:hover { background: var(--color-primary); color: #fff; }
.btn-outline-danger { background: transparent; color: var(--color-danger); border-color: var(--color-danger); }
.btn-outline-danger:hover { background: var(--color-danger); color: #fff; }
.btn-outline-secondary { background: transparent; color: var(--text-secondary); border-color: var(--border-color); }
.btn-outline-secondary:hover { background: var(--bg-page); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-page); color: var(--text-primary); }
.btn-sm { padding: .35rem .7rem; font-size: .75rem; border-radius: var(--radius-sm); }
.btn-lg { padding: .7rem 1.5rem; font-size: .95rem; border-radius: var(--radius-md); }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--radius); justify-content: center; font-size: .9rem; }
.btn-icon.btn-sm { width: 28px; height: 28px; font-size: .8rem; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .18rem .6rem;
  font-size: .68rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: .03em;
}
.badge-blue { background: var(--color-primary-light); color: var(--color-primary); }
.badge-green { background: var(--color-success-light); color: var(--color-success); }
.badge-amber { background: var(--color-warning-light); color: var(--color-warning); }
.badge-red { background: var(--color-danger-light); color: var(--color-danger); }
.badge-neutral { background: var(--bg-muted); color: var(--text-secondary); border: 1px solid var(--border-color); }
.bg-success { background: var(--color-success) !important; }
.bg-danger { background: var(--color-danger) !important; }
.bg-warning { background: var(--color-warning) !important; }
.bg-primary { background: var(--color-primary) !important; }
.bg-info { background: var(--color-info) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-primary { color: var(--color-primary) !important; }
.text-muted { color: var(--text-muted) !important; }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .4rem;
  display: block;
}
.form-control, .form-select,
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], input[type="date"],
input[type="datetime-local"],
textarea, select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: .85rem;
  padding: .55rem .85rem;
  width: 100%;
  outline: none;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.form-control:focus, .form-select:focus,
input:focus, textarea:focus, select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control::placeholder,
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.form-text { font-size: .73rem; color: var(--text-muted); margin-top: .25rem; }
.input-group .form-control { border-radius: 0 var(--radius) var(--radius) 0; }
.input-group-text {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-right: none;
  color: var(--text-muted);
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: .85rem;
}

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-md);
  border: none;
  font-size: .85rem;
  padding: .85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert-success { background: var(--color-success-light); color: #065f46; }
.alert-danger { background: var(--color-danger-light); color: #991b1b; }
.alert-warning { background: var(--color-warning-light); color: #92400e; }
.alert-info { background: var(--color-info-light); color: #1e40af; }
[data-theme="oscuro"] .alert-success { color: #6ee7b7; }
[data-theme="oscuro"] .alert-danger { color: #fca5a5; }
[data-theme="oscuro"] .alert-warning { color: #fde68a; }
[data-theme="oscuro"] .alert-info { color: #93c5fd; }

/* ── MODALS ─────────────────────────────────────────────────── */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  color: var(--text-primary);
}
.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  background: transparent;
}
.modal-body { padding: 1.5rem; }
.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  background: transparent;
}
.modal-title { font-size: .95rem; font-weight: 600; color: var(--text-primary); }
.btn-close { opacity: .5; transition: opacity var(--duration) var(--ease); }
.btn-close:hover { opacity: 1; }
[data-theme="oscuro"] .btn-close { filter: invert(1); }

/* ── DROPDOWNS ──────────────────────────────────────────────── */
.dropdown-menu {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: .35rem;
  min-width: 170px;
  font-size: .85rem;
}
.dropdown-item {
  border-radius: var(--radius-sm);
  padding: .45rem .75rem;
  color: var(--text-primary);
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  transition: background var(--duration) var(--ease);
}
.dropdown-item:hover { background: var(--bg-muted); color: var(--color-primary); }
.dropdown-item.text-danger:hover { background: var(--color-danger-light); color: var(--color-danger); }
.dropdown-divider { border-color: var(--border-color); margin: .3rem 0; }

/* ── LIST GROUP ─────────────────────────────────────────────── */
.list-group-item {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
  font-size: .85rem;
}
.list-group-item:hover { background: var(--bg-muted); }
.list-group-item.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* ── PAGINATION ─────────────────────────────────────────────── */
.pagination .page-link {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
  font-size: .8rem;
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
}
.pagination .page-link:hover { background: var(--bg-muted); color: var(--color-primary); border-color: var(--color-primary); }
.pagination .page-item.active .page-link { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.pagination .page-item.disabled .page-link { opacity: .4; }

/* ── PROGRESS ───────────────────────────────────────────────── */
.progress {
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
}
.progress-bar { background: var(--color-primary); border-radius: var(--radius-full); }

/* ── TOOLTIPS ───────────────────────────────────────────────── */
.tooltip-inner {
  background: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: .72rem;
  padding: .3rem .6rem;
}

/* ── SECTION PATTERNS ───────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: .75rem;
}
.section-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
}
.section-title .bi { color: var(--color-primary); font-size: 1rem; }

/* ── FILTER SECTION ─────────────────────────────────────────── */
.filters-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

/* ── AVATAR ─────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: .82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-lg { width: 48px; height: 48px; font-size: .95rem; }
.avatar-green { background: var(--color-success-light); color: var(--color-success); }
.avatar-amber { background: var(--color-warning-light); color: var(--color-warning); }

/* ── STATUS DOT ─────────────────────────────────────────────── */
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot-green { background: var(--color-success); }
.status-dot-amber { background: var(--color-warning); }
.status-dot-red { background: var(--color-danger); }

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 2rem;
  text-align: center;
  gap: .75rem;
  color: var(--text-muted);
}
.empty-state .bi { font-size: 2.5rem; opacity: .5; }
.empty-state h6 { font-size: .9rem; color: var(--text-secondary); margin: 0; }
.empty-state p { font-size: .8rem; color: var(--text-muted); margin: 0; }

/* ── VENDOR ROW ─────────────────────────────────────────────── */
.vendor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-radius: var(--radius);
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  margin-bottom: .5rem;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.vendor-row:hover { background: var(--color-primary-light); border-color: var(--color-primary); }

/* ── AUTH PAGES ──────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #38bdf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
[data-theme="oscuro"] .auth-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e293b 100%);
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  max-width: 420px;
  width: 100%;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: authSlideUp .4s var(--ease);
}
@keyframes authSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-logo {
  width: 80px; height: 80px;
  margin-bottom: 1.25rem;
  border-radius: 50%;
  padding: 6px;
  background: linear-gradient(135deg, var(--color-primary), #38bdf8);
  box-shadow: 0 4px 15px rgba(37,99,235,.3);
}
.auth-title {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: .25rem;
  text-align: center;
}
.auth-subtitle {
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: 1.75rem;
  text-align: center;
}
.auth-form { width: 100%; }
.auth-form .form-control {
  font-size: .95rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  padding: .8rem 1rem;
  border: 1.5px solid var(--border-color);
}
.auth-form .form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.auth-submit {
  background: var(--color-primary);
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 1rem;
  padding: .8rem;
  border-radius: var(--radius-md);
  width: 100%;
  cursor: pointer;
  transition: background var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.auth-submit:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 15px rgba(37,99,235,.35);
}
.auth-footer {
  color: var(--text-muted);
  font-size: .8rem;
  margin-top: 1.75rem;
  text-align: center;
}

/* ── ERROR PAGES ────────────────────────────────────────────── */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #09090b;
  padding: 1.5rem;
  overflow: hidden;
  position: relative;
}
.error-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(37,99,235,.1) 0%, transparent 60%);
  pointer-events: none;
}
.error-wrap {
  text-align: center;
  position: relative;
  z-index: 1;
  max-width: 480px;
}
.error-code {
  font-size: clamp(6rem, 20vw, 10rem);
  font-weight: 900;
  letter-spacing: -.08em;
  line-height: 1;
  background: linear-gradient(135deg, #2563eb 0%, #60a5fa 50%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .5rem;
  animation: errorPulse 3s ease-in-out infinite;
}
@keyframes errorPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .7; }
}
.error-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: .6rem;
}
.error-desc {
  font-size: .88rem;
  color: rgba(255,255,255,.4);
  line-height: 1.6;
  margin-bottom: 2rem;
}
.error-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: #2563eb;
  color: #fff;
  padding: .7rem 1.5rem;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, transform .12s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(37,99,235,.35);
}
.error-btn:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37,99,235,.5);
  color: #fff;
}
.error-meta {
  margin-top: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-size: .72rem;
  color: rgba(255,255,255,.2);
}
.error-meta img {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  opacity: .4;
}

/* ── SWEETALERT2 OVERRIDES ──────────────────────────────────── */
.swal2-popup {
  border-radius: var(--radius-lg) !important;
  font-family: 'Inter', sans-serif !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-xl) !important;
  padding: 2rem !important;
}
.swal2-title {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  padding: 0 0 .5rem !important;
}
.swal2-html-container {
  font-size: .85rem !important;
  color: var(--text-secondary) !important;
  margin: .25rem 0 1.25rem !important;
}
.swal2-icon { margin: 0 auto 1.25rem !important; }
.swal2-actions { gap: .6rem !important; margin-top: 0 !important; }
.swal2-confirm, .swal2-cancel, .swal2-deny {
  border-radius: var(--radius) !important;
  font-size: .82rem !important;
  font-weight: 600 !important;
  padding: .55rem 1.2rem !important;
  border: none !important;
  font-family: inherit !important;
}
.swal2-confirm { background: var(--color-primary) !important; color: #fff !important; }
.swal2-confirm:hover { background: var(--color-primary-hover) !important; }
.swal2-cancel { background: var(--bg-raised) !important; color: var(--text-primary) !important; border: 1px solid var(--border-color) !important; }
.swal2-cancel:hover { background: var(--bg-muted) !important; }
.swal2-timer-progress-bar { background: var(--color-primary) !important; height: 3px !important; }
.swal2-icon.swal2-question { border-color: var(--color-primary) !important; color: var(--color-primary) !important; }
.swal-wide { width: 540px !important; max-width: 92vw !important; }
[data-theme="oscuro"] .swal2-popup { background: var(--bg-card) !important; color: var(--text-primary) !important; }
[data-theme="oscuro"] .swal2-title { color: var(--text-primary) !important; }
[data-theme="oscuro"] .swal2-html-container { color: var(--text-secondary) !important; }
[data-theme="oscuro"] .swal2-cancel { background: var(--bg-raised) !important; color: var(--text-primary) !important; border-color: var(--border-color) !important; }

/* ── DARK THEME GLOBAL OVERRIDES ────────────────────────────── */
[data-theme="oscuro"] .card,
[data-theme="oscuro"] .modal-content,
[data-theme="oscuro"] .bg-white { background: var(--bg-card) !important; color: var(--text-primary) !important; border-color: var(--border-color) !important; }
[data-theme="oscuro"] .form-control,
[data-theme="oscuro"] .form-select,
[data-theme="oscuro"] input[type="text"],
[data-theme="oscuro"] input[type="password"],
[data-theme="oscuro"] input[type="email"],
[data-theme="oscuro"] input[type="number"],
[data-theme="oscuro"] input[type="search"],
[data-theme="oscuro"] input[type="date"],
[data-theme="oscuro"] textarea,
[data-theme="oscuro"] select {
  background: var(--bg-page) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}
[data-theme="oscuro"] .form-control::placeholder,
[data-theme="oscuro"] input::placeholder,
[data-theme="oscuro"] textarea::placeholder { color: var(--text-muted) !important; opacity: 1 !important; }
[data-theme="oscuro"] .form-control:focus,
[data-theme="oscuro"] .form-select:focus,
[data-theme="oscuro"] input:focus,
[data-theme="oscuro"] textarea:focus {
  background: var(--bg-card) !important;
  border-color: var(--color-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.2) !important;
}
[data-theme="oscuro"] .dropdown-menu { background: var(--bg-card) !important; border-color: var(--border-color) !important; }
[data-theme="oscuro"] .dropdown-item { color: var(--text-primary) !important; }
[data-theme="oscuro"] .dropdown-item:hover { background: rgba(37,99,235,.15) !important; color: #60a5fa !important; }
[data-theme="oscuro"] .table { color: var(--text-primary) !important; }
[data-theme="oscuro"] .table th { background: var(--bg-card) !important; border-color: var(--border-color) !important; }
[data-theme="oscuro"] .table td { border-color: var(--border-color) !important; }
[data-theme="oscuro"] .table-hover tbody tr:hover { background: rgba(255,255,255,.04) !important; }
[data-theme="oscuro"] .form-label,
[data-theme="oscuro"] label { color: var(--text-primary) !important; }
[data-theme="oscuro"] .list-group-item { background: var(--bg-card) !important; border-color: var(--border-color) !important; color: var(--text-primary) !important; }
[data-theme="oscuro"] select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
}
[data-theme="oscuro"] hr { border-color: var(--border-color) !important; }
[data-theme="oscuro"] .filters-section { background: var(--bg-card) !important; border-color: var(--border-color) !important; }

/* ── MOBILE ─────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .sidebar.mobile-hidden {
    left: -100vw !important;
    box-shadow: none !important;
  }
  .sidebar.mobile-overlay {
    left: 0 !important;
    z-index: 9999 !important;
    width: 72vw !important;
    box-shadow: 4px 0 20px rgba(0,0,0,.25) !important;
  }
  .main-content { margin-left: 0 !important; }
  .sidebar.expanded ~ .main-content { margin-left: 0 !important; }
  .content-area { padding: 1rem !important; }
  .empresa-text { font-size: .95rem; }
  .dropdown-menu { min-width: 170px !important; }
  .swal-wide { width: 98vw !important; max-width: 98vw !important; }
  .topbar { padding: 0 1rem; height: 52px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 2rem 1.25rem; }
}
@media (max-width: 576px) {
  .metrics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  html, body { font-size: 13px; }
}

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn .3s var(--ease); }
.animate-slide-up { animation: slideUp .3s var(--ease); }

/* ── NAV TABS ───────────────────────────────────────────────── */
.nav-tabs { border-bottom: 1px solid var(--border-color); gap: .1rem; }
.nav-tabs .nav-link {
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: .82rem;
  font-weight: 500;
  padding: .6rem .9rem;
  background: transparent;
  transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.nav-tabs .nav-link:hover { color: var(--text-primary); }
.nav-tabs .nav-link.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ── NOTIFICATIONS / ALERTAS ───────────────────────────────── */
.notification-item { transition: background var(--duration) var(--ease); }
.notification-item.unread { background: var(--color-primary-light); border-left: 3px solid var(--color-primary); }
.notification-item.selected { background: var(--color-info-light); }
.selection-mode .notification-checkbox { display: block !important; }
.selection-controls.active { display: flex !important; }
.selection-controls.active ~ .normal-controls { display: none !important; }

/* ── DETALLE EXPANDIBLE ──────────────────────────────────── */
.detalles-section {
  margin-top: .75rem;
  border-top: 1px solid var(--border-color);
  padding-top: .75rem;
}
.detalles-color-block {
  margin-bottom: .6rem;
  padding: .5rem;
  background: var(--bg-page);
  border-radius: 6px;
}
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }

/* ── PAGE TRANSITIONS ───────────────────────────────────────── */
@keyframes contentFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.content-area { animation: contentFadeIn .28s cubic-bezier(.16,1,.3,1); }

/* ── SCROLL REVEAL ──────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .45s cubic-bezier(.16,1,.3,1), transform .45s cubic-bezier(.16,1,.3,1);
}
.reveal.visible { opacity: 1; transform: none; }

/* ── PAGE LOADER BAR ────────────────────────────────────────── */
#page-loader {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  z-index: 9999; background: transparent; pointer-events: none;
}
#page-loader .loader-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--color-primary), #60a5fa);
  transition: width .35s cubic-bezier(.4,0,.2,1), opacity .2s ease;
  box-shadow: 0 0 10px rgba(37,99,235,.6);
}

/* ── PERFORMANCE HINTS ──────────────────────────────────────── */
.sidebar { will-change: width; }
.main-content { will-change: margin-left; }

/* ── ENHANCED CARD HOVER ────────────────────────────────────── */
.card {
  transition: box-shadow .22s var(--ease), transform .22s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }

/* ── USER AVATAR CHIP (topbar dropdown) ─────────────────────── */
.user-avatar-chip {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .02em;
}

/* ── TOPBAR PAGE TITLE ──────────────────────────────────────── */
.topbar-page-title {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
@media (max-width: 700px) { .topbar-page-title { display: none; } }

/* Smooth hover on metric cards */
.metric-card {
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

