/* ============================================================
   MAINTEN CMMS — Estilos globales
   Versión: 1.0 — Junio 2026
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design Tokens ── */
:root {
  /* Colores principales */
  --primary:        #1e3a5f;
  --primary-light:  #2d5a9e;
  --primary-dark:   #152c48;
  --primary-hover:  #24466e;

  /* Sidebar */
  --sidebar-bg:     #1a2035;
  --sidebar-active: rgba(255,255,255,0.11);
  --sidebar-hover:  rgba(255,255,255,0.07);

  /* Superficies */
  --bg:             #f0f4f8;
  --surface:        #ffffff;
  --surface-hover:  #f8fafc;

  /* Texto */
  --text-1:         #1a1a2e;
  --text-2:         #64748b;
  --text-3:         #94a3b8;

  /* Bordes */
  --border:         #e2e8f0;
  --border-light:   #f1f5f9;

  /* Semáforo */
  --success:        #22c55e;
  --success-bg:     #f0fdf4;
  --success-border: #bbf7d0;
  --warning:        #f59e0b;
  --warning-bg:     #fffbeb;
  --warning-border: #fde68a;
  --danger:         #ef4444;
  --danger-bg:      #fef2f2;
  --danger-border:  #fecaca;
  --info:           #3b82f6;
  --info-bg:        #eff6ff;
  --info-border:    #bfdbfe;

  /* Tipografía */
  --font-body:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', monospace;

  /* Espaciado */
  --sidebar-width:  250px;
  --header-height:  60px;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      12px;
  --radius-xl:      16px;
  --radius-full:    9999px;

  /* Sombras */
  --shadow-sm:      0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:      0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg:      0 4px 12px rgba(0,0,0,0.1);
  --shadow-xl:      0 8px 24px rgba(0,0,0,0.12);

  /* Transiciones */
  --transition:     150ms ease;
}


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

html {
  overflow-x: clip;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text-1);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--primary-light);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

/* ── Layout: Sidebar + Main ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  padding: 0 32px 32px;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
}


/* ════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

/* Logo */
.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.sidebar-logo-text .brand {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.sidebar-logo-text .tagline {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Nav items */
.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}

/* Section group label */
.nav-group {
  margin-bottom: 4px;
}

.nav-group-label {
  padding: 14px 20px 5px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.32);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  user-select: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.65);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.9);
  text-decoration: none;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: #60a5fa;
}

.nav-item.nav-item-special {
  color: #60a5fa;
}

.nav-item.nav-item-special:hover {
  color: #93c5fd;
  background: transparent;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

/* Sidebar footer (user info) */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-light);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  text-transform: capitalize;
}

.sidebar-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logout:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.sidebar-logout svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* ════════════════════════════════════════════
   PAGE HEADER
   ════════════════════════════════════════════ */
.page-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-height: var(--header-height);
  /* Extend to full width cancelling parent side padding */
  margin: 0 -32px 24px;
  padding: 12px 32px;
}

.page-header h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
}

.page-header .subtitle {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}


/* ════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

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

.card-subtitle {
  font-size: 12px;
  color: var(--text-2);
}


/* ════════════════════════════════════════════
   KPI CARDS (Dashboard)
   ════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.kpi-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.kpi-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.kpi-sparkline {
  line-height: 0;
  flex-shrink: 0;
}

.kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon.blue    { background: var(--info-bg);    color: var(--info); }
.kpi-icon.green   { background: var(--success-bg); color: var(--success); }
.kpi-icon.amber   { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.red     { background: var(--danger-bg);  color: var(--danger); }
.kpi-icon.primary { background: rgba(30,58,95,0.08); color: var(--primary); }

.kpi-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kpi-data {
  flex: 1;
  min-width: 0;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  font-family: var(--font-mono);
  line-height: 1.1;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

.kpi-trend {
  font-size: 11px;
  font-weight: 500;
}

.kpi-trend.up      { color: var(--success); }
.kpi-trend.down    { color: var(--danger); }
.kpi-trend.neutral { color: var(--text-2); }


/* ════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #16a34a;
}

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

.btn-outline {
  background: var(--surface);
  color: var(--text-1);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: none;
  padding: 6px 10px;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-1);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 10px 24px;
  font-size: 15px;
}

.btn-icon {
  padding: 7px;
  min-width: 32px;
}


/* ════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 6px;
}

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(45,90,158,0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-3);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.form-hint {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

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

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}


/* ════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-1);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.data-table .col-code {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12.5px;
  color: var(--primary);
}

.data-table .col-actions {
  display: flex;
  gap: 4px;
}

.table-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-2);
}

.table-empty svg {
  width: 40px;
  height: 40px;
  stroke: var(--text-3);
  fill: none;
  stroke-width: 1.5;
  margin: 0 auto 12px;
}


/* ════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Estado de activo */
.badge-activo     { background: var(--success-bg); color: #15803d; border: 1px solid var(--success-border); }
.badge-inactivo   { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.badge-reparacion { background: var(--warning-bg); color: #b45309; border: 1px solid var(--warning-border); }
.badge-baja       { background: var(--danger-bg);  color: #b91c1c; border: 1px solid var(--danger-border); }

/* Criticidad */
.badge-alta   { background: var(--danger-bg);  color: #b91c1c; border: 1px solid var(--danger-border); }
.badge-media  { background: var(--warning-bg); color: #b45309; border: 1px solid var(--warning-border); }
.badge-baja-c { background: var(--success-bg); color: #15803d; border: 1px solid var(--success-border); }

/* Prioridad OT */
.badge-prioridad-alta  { background: var(--danger);  color: #fff; }
.badge-prioridad-media { background: var(--warning); color: #fff; }
.badge-prioridad-baja  { background: var(--info);    color: #fff; }

/* Estado OT */
.badge-pendiente  { background: var(--warning-bg); color: #b45309; border: 1px solid var(--warning-border); }
.badge-en-curso   { background: var(--info-bg);    color: #1d4ed8; border: 1px solid var(--info-border); }
.badge-completada { background: var(--success-bg); color: #15803d; border: 1px solid var(--success-border); }
.badge-vencida    { background: var(--danger-bg);  color: #b91c1c; border: 1px solid var(--danger-border); }
.badge-cancelada  { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

/* Tipo mantenimiento */
.badge-preventivo { background: var(--info-bg);    color: #1d4ed8; }
.badge-correctivo { background: var(--warning-bg); color: #b45309; }
.badge-predictivo { background: #f5f3ff;           color: #6d28d9; }
.badge-emergencia { background: var(--danger-bg);  color: #b91c1c; }
.badge-revision   { background: #f0fdfa;           color: #0f766e; }

/* Genéricos */
.badge-info       { background: var(--info-bg);    color: #1d4ed8; }
.badge-permanente { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }


/* ════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(10px) scale(0.98);
  transition: transform 200ms ease;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text-1);
}

.modal-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-lg { max-width: 720px; }


/* ════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text-1);
  min-width: 280px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastIn 300ms ease forwards;
}

.toast.removing {
  animation: toastOut 250ms ease forwards;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.success .toast-icon { color: var(--success); }

.toast.error { border-left: 4px solid var(--danger); }
.toast.error .toast-icon { color: var(--danger); }

.toast.warning { border-left: 4px solid var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }

.toast.info { border-left: 4px solid var(--info); }
.toast.info .toast-icon { color: var(--info); }

.toast-message { flex: 1; }

.toast-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
}

.toast-close:hover { color: var(--text-1); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}


/* ════════════════════════════════════════════
   FILTERS BAR
   ════════════════════════════════════════════ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.filter-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
}

.filter-search input:focus {
  border-color: var(--primary-light);
}

.filter-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--text-3);
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}

.filter-select {
  padding: 8px 30px 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-1);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.filter-select:focus {
  border-color: var(--primary-light);
}


/* ════════════════════════════════════════════
   TABS
   ════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover {
  color: var(--text-1);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab .tab-count {
  background: var(--bg);
  color: var(--text-2);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.tab.active .tab-count {
  background: rgba(30,58,95,0.08);
  color: var(--primary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}


/* ════════════════════════════════════════════
   PAGINATION
   ════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-2);
}

.pagination-info {
  font-size: 12px;
}

.pagination-buttons {
  display: flex;
  gap: 4px;
}

.pagination-buttons button {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-1);
  transition: all var(--transition);
}

.pagination-buttons button:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-3);
}

.pagination-buttons button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* ════════════════════════════════════════════
   LOADING STATES
   ════════════════════════════════════════════ */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

.spinner-lg {
  width: 36px;
  height: 36px;
}

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

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--text-2);
  font-size: 13px;
}

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════ */
.text-mono    { font-family: var(--font-mono); }
.text-primary { color: var(--primary); }
.text-muted   { color: var(--text-2); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-info    { color: var(--info); }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }

.d-flex     { display: flex; }
.d-grid     { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap  { flex-wrap: wrap; }
.flex-1     { flex: 1; }

.hidden    { display: none !important; }
.sr-only   {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cursor-pointer { cursor: pointer; }


/* ════════════════════════════════════════════
   LOGIN PAGE (special layout, no sidebar)
   ════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

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

.login-logo-icon svg {
  width: 24px;
  height: 24px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
}

.login-logo-text {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
}

.login-title {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 4px;
  color: var(--text-1);
}

.login-subtitle {
  font-size: 13px;
  text-align: center;
  margin-bottom: 28px;
  color: var(--text-2);
}

.login-form .btn {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-2);
}

.login-footer a {
  color: var(--primary-light);
  font-weight: 500;
}


/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  /* Columna en móvil: header arriba, contenido abajo */
  .app-layout {
    flex-direction: column;
  }

  /* Sidebar: width explícito para que translateX(-100%) funcione correctamente */
  .sidebar {
    width: 250px;
    transform: translateX(-250px);
    transition: transform 250ms ease;
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
  }

  .main-content {
    margin-left: 0;
    padding: 0 16px 24px;
    width: 100%;
  }

  .page-header {
    margin: 0 -16px 20px;
    padding: 12px 16px;
  }

  /* Header móvil: barra fija en la parte superior */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 52px;
    background: var(--sidebar-bg);
    color: #fff;
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 100;
    flex-shrink: 0;
  }

  .mobile-menu-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: flex;
  }

  .mobile-menu-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
  }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
    display: none;
  }

  .mobile-backdrop.active {
    display: block;
  }

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

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal {
    max-width: 100%;
    max-height: 95vh;
  }

  /* ── Filtros: scroll horizontal en vez de wrapping ── */
  .filters-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .filters-bar::-webkit-scrollbar { display: none; }
  .filters-bar .filter-search { min-width: 150px; flex-shrink: 0; }
  .filters-bar .filter-select  { flex-shrink: 0; }
  .filters-bar .btn            { flex-shrink: 0; white-space: nowrap; }

  /* ── Controls de reportes: scroll horizontal ── */
  .report-controls {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
    scrollbar-width: none;
  }
  .report-controls::-webkit-scrollbar { display: none; }
  .report-controls .filter-select { flex-shrink: 0; }
  .report-controls .btn           { flex-shrink: 0; white-space: nowrap; }

  /* ── Grids de reportes: 1 columna en móvil ── */
  .report-grid {
    grid-template-columns: 1fr;
  }
  .quick-reports-grid {
    grid-template-columns: 1fr;
  }

  /* ── Vista calendario OTs: scroll horizontal ── */
  #calendarioBoard {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .calendar-grid {
    min-width: 560px;
  }
}
