/* ==========================================================================
   COTIZADOR TECNOMÁTICA - DESIGN SYSTEM REFINADO (TOKENS Y COMPONENTES)
   ========================================================================== */

:root {
  /* --- PALETA DE COLORES & MARCA CORPORATIVA --- */
  --brand-50: #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --brand-900: #1e3a8a;

  /* --- NEUTROS DE ALTA FIDELIDAD --- */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: rgba(59, 130, 246, 0.14);

  /* --- TEXTO & JERARQUÍA --- */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  --text-sidebar: #cbd5e1;

  /* --- ESTADOS Y SEÑALIZACIÓN --- */
  --success-bg: #ecfdf5;
  --success-text: #047857;
  --success-border: #a7f3d0;

  --warning-bg: #fffbeb;
  --warning-text: #b45309;
  --warning-border: #fde68a;

  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;
  --danger-border: #fecaca;

  --info-bg: #eff6ff;
  --info-text: #1d4ed8;
  --info-border: #bfdbfe;

  /* --- BORDES & ELEVACIONES CUIDADAS --- */
  --border-color: #e2e8f0;
  --border-color-subtle: #f1f5f9;
  --border-focus: #2563eb;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.14), 0 8px 16px -4px rgba(15, 23, 42, 0.06);

  /* --- RADIOS DE BORDE & ESPACIADO --- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* --- TIPOGRAFÍA & ESTRUCTURA --- */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --z-dropdown: 1000;
  --z-modal: 1100;
  --z-toast: 1200;
}

/* ==========================================================================
   RESET & ESTILOS BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--brand-700);
}

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

:focus-visible {
  outline: 2px solid var(--brand-600) !important;
  outline-offset: 2px !important;
}

/* ==========================================================================
   COMPONENTES REUTILIZABLES CON CARÁCTER VISUAL (.c-)
   ========================================================================== */

/* --- 1. BOTONES DE ALTA FIDELIDAD (.c-btn) --- */
.c-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.c-btn svg, .c-btn i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.c-btn--primary {
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 100%);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.c-btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-800) 100%);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}
.c-btn--primary:active:not(:disabled) {
  transform: translateY(0);
}

.c-btn--secondary {
  background-color: var(--bg-sidebar);
  color: var(--text-inverse);
}
.c-btn--secondary:hover:not(:disabled) {
  background-color: var(--bg-sidebar-hover);
  transform: translateY(-1px);
}

.c-btn--outline {
  background-color: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}
.c-btn--outline:hover:not(:disabled) {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.c-btn--ghost {
  background-color: transparent;
  color: var(--text-secondary);
}
.c-btn--ghost:hover:not(:disabled) {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.c-btn--danger {
  background: linear-gradient(135deg, var(--danger-text) 0%, #991b1b 100%);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.2);
}
.c-btn--danger:hover:not(:disabled) {
  transform: translateY(-1px);
}

.c-btn--sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.c-btn--sm svg, .c-btn--sm i {
  width: 14px;
  height: 14px;
}

.c-btn--lg {
  padding: 12px 24px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

.c-btn--icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}
.c-btn--icon.c-btn--sm {
  width: 32px;
  height: 32px;
  padding: 6px;
}

.c-btn:disabled, .c-btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- 2. CONTROLES DE FORMULARIO REFINADOS --- */
.c-form-group {
  margin-bottom: 16px;
}

.c-form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.c-input, .c-select, .c-textarea {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.c-input:hover, .c-select:hover, .c-textarea:hover {
  border-color: #cbd5e1;
}

.c-input:focus, .c-select:focus, .c-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.c-input[readonly], .c-input:disabled {
  background-color: var(--bg-body);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* --- 3. BADGES DE ESTADO CON PERSONALIDAD --- */
.c-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.c-badge svg, .c-badge i {
  width: 13px;
  height: 13px;
}

.c-badge--amber {
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}
.c-badge--emerald {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}
.c-badge--rose {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}
.c-badge--blue {
  background-color: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}
.c-badge--slate {
  background-color: var(--bg-surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* --- 4. TARJETAS ELEVADAS (.c-card) --- */
.c-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.c-card:hover {
  box-shadow: var(--shadow-md);
}

.c-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color-subtle);
}

.c-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.c-card--stat {
  position: relative;
  overflow: hidden;
  border-top-width: 3px;
}

/* --- 5. TABLAS EJECUTIVAS CON JERARQUÍA (.c-table) --- */
.c-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.c-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.c-table th {
  background-color: #0f172a;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.c-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color-subtle);
  color: var(--text-primary);
  font-size: 13.5px;
  vertical-align: middle;
}

.c-table tbody tr {
  transition: background-color 0.15s ease;
}

.c-table tbody tr:hover {
  background-color: #f1f5f9;
}

/* --- 6. ALERTAS & NOTIFICACIONES --- */
.c-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-md);
}

.c-alert--success {
  background-color: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.c-alert--danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.c-alert--warning {
  background-color: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

/* --- 7. ESTADOS VACÍOS CON CARÁCTER (.c-empty-state) --- */
.c-empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
}
.c-empty-state__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  color: var(--brand-500);
  opacity: 0.8;
  background: var(--brand-50);
  padding: 12px;
  border-radius: 50%;
}
.c-empty-state__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.c-empty-state__text {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 420px;
  margin: 0 auto 16px;
}

/* --- 8. BREADCRUMBS & TOOLTIPS --- */
.c-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.c-breadcrumb a {
  color: var(--text-secondary);
  font-weight: 500;
}
.c-breadcrumb a:hover {
  color: var(--brand-600);
}

[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: var(--z-dropdown);
  box-shadow: var(--shadow-md);
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

/* --- 9. MODALES Y DIÁLOGOS VISUALES (.c-modal-overlay) --- */
.c-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInModal 0.2s ease-out;
}

.c-modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  padding: 24px;
  border: 1px solid var(--border-color);
  animation: scaleInModal 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.c-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color-subtle);
}

.c-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleInModal {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
