/* ============================================================
   Galpon Tolosa ERP — Estilos Globales
   Mobile First · Modern & Clean
   ============================================================ */

/* ── Variables de Diseño — LIGHT MODE (navbar/sidebar oscuros) ──── */
:root {
  --primary:        #0d1117;
  --primary-light:  #161b22;
  --accent:         #0969da;
  --accent-hover:   #0550ae;
  --success:        #1a7f37;
  --danger:         #cf222e;
  --warning:        #9a6700;
  --info:           #0969da;

  --bg:             #f6f8fa;
  --bg-card:        #ffffff;
  --bg-elevated:    #f0f2f5;
  --sidebar-bg:     #0d1117;
  --navbar-bg:      #161b22;

  --text-primary:   #1f2328;
  --text-secondary: #656d76;
  --text-light:     #818b98;
  --text-on-dark:   #e6edf3;

  --border:         #d0d7de;
  --border-radius:  12px;
  --border-radius-sm: 8px;

  --shadow:         0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:      0 8px 32px rgba(0,0,0,.15);
  --shadow-card:    0 1px 4px rgba(0,0,0,.08);

  --sidebar-width:       240px;
  --sidebar-width-mini:   64px;
  --navbar-height:        60px;

  --transition:     all .25s cubic-bezier(.4,0,.2,1);
  --font:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; }

::selection { background: rgba(88,166,255,.25); color: var(--text-primary); }

/* ── Tipografía ─────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Scrollbar personalizado ────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8ccd0; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #a5abb3; }

/* ╔══════════════════════════════════════════════════════╗
   ║  LAYOUT PRINCIPAL                                    ║
   ╚══════════════════════════════════════════════════════╝ */

/* Wrapper raíz */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── NAVBAR ─────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--navbar-bg);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.3px;
  flex: 1;
}

.navbar-brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.navbar-brand span.brand-accent {
  color: var(--accent);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Campana de notificaciones ──────────────────────────── */
.notif-bell {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-on-dark);
  opacity: 0.7;
  transition: var(--transition);
  flex-shrink: 0;
}

.notif-bell:hover {
  background: rgba(255,255,255,.1);
  opacity: 1;
}

.notif-bell i {
  font-size: 1rem;
}

.notif-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e53e3e;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}

.notif-badge.visible {
  display: flex;
}

/* Botón hamburguesa */
.btn-hamburger {
  display: flex;
  flex-direction: column;
  gap: 4.5px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
}

.btn-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-on-dark);
  border-radius: 2px;
  transition: var(--transition);
}

.btn-hamburger:hover { background: rgba(255,255,255,.1); }

/* Avatar de usuario */
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,.2);
  transition: var(--transition);
  position: relative;
}

.user-avatar:hover { border-color: var(--accent); transform: scale(1.05); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 0.5rem 0;
  display: none;
  z-index: 2000;
}

.user-dropdown.open { display: block; }

.user-dropdown-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.user-dropdown-header .user-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-primary);
}

.user-dropdown-header .user-role {
  font-size: .75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  color: var(--text-primary);
  font-size: .875rem;
  transition: var(--transition);
}

.user-dropdown a:hover { background: rgba(88,166,255,.08); color: var(--accent); }
.user-dropdown a.logout { color: var(--danger); }
.user-dropdown a.logout:hover { background: rgba(248,81,73,.1); }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width-mini);
  background: var(--sidebar-bg);
  overflow: hidden;
  transition: width .3s cubic-bezier(.4,0,.2,1);
  z-index: 900;
  display: flex;
  flex-direction: column;
}

/* Modo expandido (desktop hover / mobile open) */
.sidebar.expanded,
.sidebar:hover {
  width: var(--sidebar-width);
}

/* En móvil, el sidebar arranca fuera de pantalla */
@media (max-width: 1023px) {
  .sidebar {
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }
}

/* Overlay para móvil */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 800;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }

/* Nav links del sidebar */
.sidebar-nav {
  padding: 0.75rem 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.3);
  padding: 1rem 1.2rem 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  transition: opacity .2s .1s;
}

.sidebar.expanded .sidebar-section-label,
.sidebar:hover .sidebar-section-label {
  opacity: 1;
}

@media (max-width: 1023px) {
  .sidebar .sidebar-section-label { opacity: 1; }
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.75rem;
  color: rgba(255,255,255,.65);
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: #fff;
  background: rgba(88,166,255,.12);
  border-left-color: var(--accent);
}

.sidebar-link i {
  font-size: 1.1rem;
  min-width: 38px;
  text-align: center;
  transition: var(--transition);
}

.sidebar-link span {
  opacity: 0;
  transition: opacity .15s;
  padding-left: .25rem;
}

.sidebar.expanded .sidebar-link span,
.sidebar:hover .sidebar-link span {
  opacity: 1;
}

@media (max-width: 1023px) {
  .sidebar-link span { opacity: 1; }
  .sidebar-link i { min-width: 36px; }
}

/* Tooltip de icono (solo en modo mini) */
.sidebar-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-width-mini) + 8px);
  background: var(--primary-light);
  color: #fff;
  font-size: .78rem;
  padding: .35rem .75rem;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 1100;
}

.sidebar:not(:hover):not(.expanded) .sidebar-link:hover::after {
  opacity: 1;
}

@media (max-width: 1023px) {
  .sidebar-link::after { display: none; }
}

/* Sidebar footer */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .75rem;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-footer .app-version {
  font-size: .7rem;
  color: rgba(255,255,255,.25);
  opacity: 0;
  transition: opacity .2s .1s;
}

.sidebar.expanded .sidebar-footer .app-version,
.sidebar:hover .sidebar-footer .app-version { opacity: 1; }

@media (max-width: 1023px) {
  .sidebar-footer .app-version { opacity: 1; }
}

/* ── CONTENIDO PRINCIPAL ─────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  margin-top: var(--navbar-height);
  margin-left: var(--sidebar-width-mini);
  padding: 1.5rem 1rem;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}

/* Modo sin sidebar (invitados de Google) */
.no-sidebar .main-content {
  margin-left: 0 !important;
}

.no-sidebar .btn-hamburger {
  display: none;
}

.sidebar:hover ~ .main-content {
  margin-left: var(--sidebar-width);
}

@media (max-width: 1023px) {
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .sidebar:hover ~ .main-content {
    margin-left: 0;
  }
}

/* ── PÁGINA HEADER ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header-left { display: flex; flex-direction: column; gap: .25rem; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--text-secondary);
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb i { font-size: .7rem; }

/* ╔══════════════════════════════════════════════════════╗
   ║  COMPONENTES UI                                      ║
   ╚══════════════════════════════════════════════════════╝ */

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}

.card-body { padding: 1.25rem; }
.card-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Stat cards (dashboard) */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.12); transform: translateY(-2px); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: rgba(88,166,255,.12);  color: var(--accent); }
.stat-icon.green  { background: rgba(63,185,80,.12);   color: var(--success); }
.stat-icon.orange { background: rgba(210,153,34,.12);  color: var(--warning); }
.stat-icon.red    { background: rgba(248,81,73,.12);   color: var(--danger); }
.stat-icon.teal   { background: rgba(57,197,207,.12);  color: var(--info); }

.stat-info { flex: 1; min-width: 0; }

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

.stat-label {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-top: .2rem;
}

/* Grid de stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (min-width: 576px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── BOTONES ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem 1.25rem;
  font-size: .875rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  min-height: 42px; /* Fácil de tocar en móvil */
}

.btn:focus-visible { outline: 3px solid rgba(88,166,255,.5); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary    { background: var(--accent);   color: #ffffff; font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(88,166,255,.3); }

.btn-success    { background: var(--success);  color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.08); }

.btn-danger     { background: var(--danger);   color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }

.btn-warning    { background: var(--warning);  color: #fff; }
.btn-warning:hover:not(:disabled) { filter: brightness(1.08); }

.btn-outline-primary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-outline-primary:hover:not(:disabled) {
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.btn-outline-success {
  background: transparent;
  color: var(--success);
  border: 1.5px solid var(--success);
}

.btn-outline-success:hover:not(:disabled) {
  background: var(--success);
  color: #ffffff;
  font-weight: 700;
}

.btn-outline-danger {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
}

.btn-outline-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover:not(:disabled) { background: var(--bg-elevated); color: var(--text-primary); }

.btn-sm { padding: .45rem .9rem; font-size: .8rem; min-height: 34px; }
.btn-lg { padding: .8rem 1.75rem; font-size: 1rem; min-height: 50px; }
.btn-icon { padding: .6rem; min-height: 38px; min-width: 38px; border-radius: var(--border-radius-sm); }
.btn-block { width: 100%; }

/* ── FORMULARIOS ─────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .4rem;
}

.form-control,
.form-select {
  display: block;
  width: 100%;
  padding: .7rem 1rem;
  font-size: .9rem;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  min-height: 44px; /* Táctil */
  font-family: var(--font);
  color-scheme: light;
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,.15);
  background: var(--bg-elevated);
}

.form-control::placeholder { color: var(--text-light); }

.form-control.is-invalid  { border-color: var(--danger); }
.form-control.is-valid    { border-color: var(--success); }

.form-feedback {
  font-size: .78rem;
  margin-top: .35rem;
}

.form-feedback.invalid { color: var(--danger); }
.form-feedback.valid   { color: var(--success); }

/* Input con ícono */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group-icon {
  position: absolute;
  left: .9rem;
  color: var(--text-light);
  font-size: .95rem;
  pointer-events: none;
  transition: var(--transition);
}

.input-group .form-control { padding-left: 2.5rem; }

.input-group-icon-right {
  position: absolute;
  right: .9rem;
  color: var(--text-light);
  font-size: .95rem;
  cursor: pointer;
  transition: var(--transition);
}

.input-group-icon-right:hover { color: var(--accent); }

.input-group .form-control:focus ~ .input-group-icon { color: var(--accent); }

/* Textarea */
textarea.form-control {
  resize: vertical;
  min-height: 90px;
}

/* Checkbox & Radio modernos */
.form-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .875rem;
  color: var(--text-primary);
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── TABLAS ───────────────────────────────────────────────── */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.table th {
  background: #e2e5ea;
  padding: .75rem 1rem;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  text-align: left;
}

.table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover td { background: rgba(0,0,0,.04); }

/* Lista card para móvil (alternativa a tabla) */
.card-list { display: flex; flex-direction: column; gap: .75rem; }

.card-list-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  transition: var(--transition);
}

.card-list-item:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-1px); }

.card-list-item-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(88,166,255,.12);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  font-weight: 700;
}

.card-list-item-body { flex: 1; min-width: 0; }

.card-list-item-title {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-list-item-subtitle {
  font-size: .78rem;
  color: var(--text-secondary);
  margin-top: .2rem;
}

.card-list-item-actions {
  display: flex;
  gap: .4rem;
  flex-shrink: 0;
}

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .6rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.badge-primary   { background: rgba(88,166,255,.15);  color: var(--accent);    border: 1px solid rgba(88,166,255,.2); }
.badge-success   { background: rgba(63,185,80,.15);   color: var(--success);   border: 1px solid rgba(63,185,80,.2); }
.badge-danger    { background: rgba(248,81,73,.15);   color: var(--danger);    border: 1px solid rgba(248,81,73,.2); }
.badge-warning   { background: rgba(210,153,34,.15);  color: var(--warning);   border: 1px solid rgba(210,153,34,.2); }
.badge-secondary { background: var(--bg-elevated);   color: var(--text-secondary); border: 1px solid var(--border); }

/* ── MODALES ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: var(--navbar-height);
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  width: 100%;
  max-height: calc(100vh - var(--navbar-height));
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(-20px);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  padding: 1.2rem 1.5rem;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--accent);
  z-index: 1;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-title { font-size: 1.05rem; font-weight: 700; color: #ffffff; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: var(--transition);
  font-size: 1.1rem;
}

.modal-close:hover { background: rgba(255,255,255,.28); border-color: rgba(255,255,255,.6); color: #ffffff; }

.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding-top: 0;
  }
  .modal {
    max-width: 520px;
    max-height: 90vh;
    border-radius: var(--border-radius);
    transform: translateY(40px);
  }
}

@media (max-width: 639px) {
  .btn-label-desktop { display: none; }
}

@media (min-width: 1024px) {
  .modal { max-width: 580px; }
}

/* ── BARRA DE BÚSQUEDA / FILTRO ─────────────────────────── */
.search-bar {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap > i {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.search-input-wrap input {
  padding-left: 2.5rem;
  padding-right: 2.5rem;
  min-height: 42px;
}

.search-clear-btn {
  display: none;
  position: absolute;
  right: .7rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: .85rem;
  padding: 0;
  transition: color .2s;
}

.search-clear-btn i {
  display: block;
  line-height: 1;
}

.search-clear-btn:hover { color: var(--text-primary); }
.search-clear-btn.visible { display: block; }

/* ── PAGINACIÓN ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: wrap;
}

.page-link {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  padding: 0 .6rem;
}

.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.active { background: var(--accent); color: #ffffff; font-weight: 700; border-color: var(--accent); }
.page-link.disabled { opacity: .4; cursor: default; }

/* ── LOADING SPINNER ─────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spinner-primary {
  border: 2.5px solid rgba(88,166,255,.15);
  border-top-color: var(--accent);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Loading overlay */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(2px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.loading-overlay.active { display: flex; }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.empty-state i {
  font-size: 3.5rem;
  color: #c8ccd0;
  margin-bottom: 1rem;
}

.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: .4rem; }
.empty-state p  { font-size: .85rem; }

/* ── TOAST NOTIFICATIONS ─────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: .85rem 1.25rem;
  border-radius: var(--border-radius-sm);
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 260px;
  max-width: 95vw;
  animation: toastIn .3s ease;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ╔══════════════════════════════════════════════════════╗
   ║  PÁGINA DE LOGIN                                     ║
   ╚══════════════════════════════════════════════════════╝ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 80% at 50% -20%, rgba(88,166,255,.06) 0%, transparent 100%);
  position: relative;
  overflow: hidden;
}

/* Círculos decorativos de fondo */
.auth-page::before,
.auth-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(88,166,255,.04);
}

.auth-page::before {
  width: 400px;
  height: 400px;
  top: -120px;
  right: -80px;
}

.auth-page::after {
  width: 300px;
  height: 300px;
  bottom: -80px;
  left: -60px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 0 0 1px rgba(9,105,218,.1);
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  .auth-page {
    align-items: flex-start;
    justify-content: center;
    padding: 1.75rem 1rem 1rem;
  }
  .auth-card {
    margin-top: 1.5rem;
  }
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo-img {
  width: 160px;
  height: 160px;
  background: transparent;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  margin-bottom: .75rem;
}

.auth-logo-img i { font-size: 2rem; color: #fff; }

.auth-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.auth-logo h1 span { color: var(--accent); }

.auth-logo p {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-top: .25rem;
}

.auth-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.auth-footer-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: .83rem;
  color: var(--text-secondary);
}

.auth-footer-link a { color: var(--accent); font-weight: 600; }

/* ── UTILIDADES ──────────────────────────────────────────── */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-end { text-align: right; }
.text-muted { color: var(--text-secondary); font-size: .85rem; }
.text-small { font-size: .8rem; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent  { color: var(--accent); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.5rem; }
.p-0 { padding: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Grilla simple */
.row { display: flex; flex-wrap: wrap; margin: 0 -.5rem; }
.col { flex: 1; padding: 0 .5rem; }
.col-12 { flex: 0 0 100%; padding: 0 .5rem; }
.col-6  { flex: 0 0 50%; padding: 0 .5rem; }

@media (min-width: 640px) {
  .col-sm-2 { flex: 0 0 16.666%; padding: 0 .5rem; }
  .col-sm-3 { flex: 0 0 25%; padding: 0 .5rem; }
  .col-sm-4 { flex: 0 0 33.333%; padding: 0 .5rem; }
  .col-sm-6 { flex: 0 0 50%; padding: 0 .5rem; }
  .col-sm-8 { flex: 0 0 66.666%; padding: 0 .5rem; }
  .col-sm-9 { flex: 0 0 75%; padding: 0 .5rem; }
  .col-sm-12 { flex: 0 0 100%; padding: 0 .5rem; }
}

@media (min-width: 768px) {
  .col-md-4 { flex: 0 0 33.333%; padding: 0 .5rem; }
  .col-md-6 { flex: 0 0 50%; padding: 0 .5rem; }
  .col-md-8 { flex: 0 0 66.666%; padding: 0 .5rem; }
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--text-light);
  font-size: .8rem;
  margin: 1.25rem 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ╔══════════════════════════════════════════════════════╗
   ║  SWEETALERT2 — MODO OSCURO (confirmaciones/loading)  ║
   ╚══════════════════════════════════════════════════════╝ */
.swal-dark-popup.swal2-popup {
  background: #161b22 !important;
  color: #e6edf3 !important;
  border: 1px solid #30363d !important;
  box-shadow: 0 25px 60px rgba(0,0,0,.7) !important;
}

.swal-dark-popup .swal2-title {
  color: #e6edf3 !important;
  font-size: 1.15rem !important;
}

.swal-dark-popup .swal2-html-container,
.swal-dark-popup .swal2-content {
  color: #8b949e !important;
}

.swal-dark-popup .swal2-input,
.swal-dark-popup .swal2-textarea,
.swal-dark-popup .swal2-select {
  background: #1c2128 !important;
  border: 1.5px solid #30363d !important;
  color: #e6edf3 !important;
}

.swal-dark-popup .swal2-input:focus {
  border-color: #58a6ff !important;
  box-shadow: 0 0 0 3px rgba(88,166,255,.15) !important;
}

.swal-dark-popup .swal2-confirm {
  background: #58a6ff !important;
  color: #0d1117 !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
}

.swal-dark-popup .swal2-confirm:hover {
  background: #388bfd !important;
}

.swal-dark-popup .swal2-cancel {
  background: #21262d !important;
  color: #8b949e !important;
  border: 1px solid #30363d !important;
  border-radius: 8px !important;
}

.swal-dark-popup .swal2-cancel:hover {
  background: #30363d !important;
  color: #e6edf3 !important;
}

.swal-dark-popup .swal2-icon.swal2-success {
  border-color: #3fb950 !important;
  color: #3fb950 !important;
}

.swal-dark-popup .swal2-icon.swal2-success [class^='swal2-success-line'] {
  background-color: #3fb950 !important;
}

.swal-dark-popup .swal2-icon.swal2-success .swal2-success-ring {
  border-color: rgba(63,185,80,.25) !important;
}

.swal-dark-popup .swal2-icon.swal2-error {
  border-color: #f85149 !important;
  color: #f85149 !important;
}

.swal-dark-popup .swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
  background-color: #f85149 !important;
}

.swal-dark-popup .swal2-icon.swal2-warning {
  border-color: #d29922 !important;
  color: #d29922 !important;
}

.swal-dark-popup .swal2-icon.swal2-info {
  border-color: #39c5cf !important;
  color: #39c5cf !important;
}

.swal-dark-popup .swal2-icon.swal2-question {
  border-color: #58a6ff !important;
  color: #58a6ff !important;
}

.swal-dark-popup .swal2-timer-progress-bar {
  background: #58a6ff !important;
}

.swal-dark-popup .swal2-close {
  color: #6e7681 !important;
}

.swal-dark-popup .swal2-close:hover {
  color: #f85149 !important;
}

.swal2-backdrop-show.swal2-container {
  background: rgba(0,0,0,.7) !important;
  backdrop-filter: blur(3px);
}

/* ╔══════════════════════════════════════════════════════╗
   ║  SWEETALERT2 — MODO CLARO (notificaciones/auto-close)║
   ╚══════════════════════════════════════════════════════╝ */

/* Botón OK en alerts claros */
.swal-ok-btn {
  min-width: 90px;
}

/* Barra de progreso del timer */
.swal2-timer-progress-bar-container {
  border-radius: 0 0 5px 5px;
  overflow: hidden;
}
