/* ==========================================================================
   PALETA DE COLORES BMC & VARIABLES GLOBALES (TEMA DE LA APP)
   ========================================================================== */
:root {
  /* Fuentes */
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Colores del Sistema Oscuro (App UI) */
  --bg-app: hsl(222, 47%, 10%);       /* Slate Profundo */
  --bg-card: hsla(223, 47%, 15%, 0.7); /* Slate Glass */
  --border-glass: hsla(217, 30%, 30%, 0.3);
  --border-focus: hsl(197, 85%, 45%);

  --text-main: hsl(210, 40%, 96%);     /* Blanco */
  --text-muted: hsl(215, 20%, 65%);    /* Gris Muted */
  --text-dark: hsl(222, 47%, 12%);

  /* Acentos de Marca BMC */
  --bmc-navy: #1e3a8a;       /* Azul Marino BMC */
  --bmc-blue: #0284c7;       /* Azul Celeste BMC */
  --color-primary: hsl(221, 83%, 45%);   /* Azul */
  --color-teal: hsl(187, 85%, 40%);      /* Celeste */
  --color-emerald: hsl(142, 72%, 29%);   /* Verde Aprobado */
  --color-amber: hsl(35, 92%, 45%);      /* Naranja Alerta */
  --color-rose: hsl(347, 77%, 48%);      /* Rojo Alerta */

  /* Sombras y Radios */
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-premium: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESETS & GLOBAL SETUP
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg-app);
  background-image: radial-gradient(at 0% 0%, hsla(221, 83%, 45%, 0.15) 0px, transparent 50%),
                    radial-gradient(at 100% 0%, hsla(187, 85%, 40%, 0.12) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 50px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 600;
  letter-spacing: -0.5px;
}

/* ==========================================================================
   INTERFAZ DE AUTENTICACIÓN (LOGIN & REGISTRO)
   ========================================================================== */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  padding: 40px;
  animation: modalEntry 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--bmc-navy) 0%, var(--bmc-blue) 100%);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: white;
  margin-bottom: 15px;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
}

.auth-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
}

.auth-header p {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-switch a {
  color: var(--bmc-blue);
  font-weight: 600;
  text-decoration: none;
}

.error-box {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 15px;
  line-height: 1.4;
}

.success-box {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 15px;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   ESTILOS DE GLASSMORPHISM
   ========================================================================== */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-premium);
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   CABECERA PRINCIPAL Y PERFIL
   ========================================================================== */
.app-header {
  background: rgba(10, 18, 35, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 15px 0;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--bmc-navy) 0%, var(--bmc-blue) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
}

.logo-text h1 {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(90deg, #ffffff 0%, var(--bmc-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text span {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Perfil de Usuario */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px 6px 6px;
  border-radius: 50px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--bmc-blue);
  border: 1px solid var(--border-glass);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: white;
}

.user-info .badge {
  font-size: 9px;
  padding: 2px 6px;
  margin-top: 2px;
  background: rgba(2, 132, 199, 0.15);
  color: var(--bmc-blue);
  border: 1px solid rgba(2, 132, 199, 0.3);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  margin-left: 10px;
  transition: var(--transition-smooth);
}
.btn-logout:hover {
  color: var(--color-rose);
  transform: scale(1.1);
}

/* ==========================================================================
   KPIS & METRICAS CARD
   ========================================================================== */
.kpis-section {
  max-width: 1400px;
  margin: 30px auto 0 auto;
  padding: 0 30px;
}

.kpis-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.kpi-card {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition-smooth);
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.1);
}

.kpi-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.kpi-icon.blue { background: rgba(30, 58, 138, 0.2); color: #60a5fa; }
.kpi-icon.orange { background: rgba(194, 65, 12, 0.2); color: #f59e0b; }
.kpi-icon.green { background: rgba(6, 95, 70, 0.2); color: #34d399; }
.kpi-icon.purple { background: rgba(107, 33, 168, 0.2); color: #c084fc; }

.kpi-value {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 800;
  color: white;
}

.kpi-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Animación de pulso */
.pulsing {
  position: relative;
}
.pulsing::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
  animation: pulse 2s infinite;
}

/* ==========================================================================
   ESTRUCTURA PRINCIPAL Y PANELES
   ========================================================================== */
.main-content {
  max-width: 1400px;
  margin: 30px auto 0 auto;
  padding: 0 30px;
}

.role-view {
  display: none;
}
.role-view.active {
  display: block;
}

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

.view-header h2 {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  margin-bottom: 20px;
  gap: 20px;
  flex-wrap: wrap;
}

.search-input-group {
  position: relative;
  flex: 1;
  max-width: 400px;
  min-width: 250px;
}

.search-input-group i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input-group input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 40px;
  color: white;
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition-smooth);
}
.search-input-group input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.filter-tabs {
  display: flex;
  gap: 6px;
  background: rgba(255,255,255,0.02);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.filter-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}
.filter-tab:hover {
  color: white;
}
.filter-tab.active {
  background: rgba(255,255,255,0.06);
  color: var(--bmc-blue);
  font-weight: 600;
}

/* ==========================================================================
   BÚSQUEDA HISTÓRICA POR CLIENTE
   ========================================================================== */
.history-search-card {
  padding: 24px;
}

.history-search-card h3 {
  font-size: 16px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-search-card .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 15px;
}

.align-end {
  align-items: flex-end;
}

.history-results-box {
  margin-top: 20px;
  border-top: 1px solid var(--border-glass);
  padding-top: 15px;
  overflow-x: auto;
  animation: rowSlideIn 0.3s ease;
}

.nested-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.nested-table th {
  padding: 10px;
  background: rgba(0,0,0,0.2);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-glass);
}
.nested-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

/* ==========================================================================
   ESTILOS DE TABLAS CORPORATIVAS
   ========================================================================== */
.table-container {
  overflow-x: auto;
  padding: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 14px 12px;
  color: var(--text-muted);
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border-glass);
}

td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border-glass);
  font-size: 14px;
  color: white;
  vertical-align: middle;
}

tbody tr:hover {
  background: rgba(255,255,255,0.01);
}

/* Estados de Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge.borrador { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge.pendiente { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.aprobado { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge.enviado { background: rgba(2, 132, 199, 0.15); color: var(--bmc-blue); border: 1px solid rgba(2, 132, 199, 0.3); }

/* ==========================================================================
   BOTONES E INPUTS PREMIUM
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--bmc-navy) 0%, var(--bmc-blue) 100%);
  color: white;
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  color: white;
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
}

.btn-success {
  background: linear-gradient(135deg, var(--color-emerald) 0%, var(--bmc-blue) 100%);
  color: white;
}
.btn-success:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-size: 13px;
}
.btn-icon.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.btn-icon.blue:hover { background: #3b82f6; color: white; }
.btn-icon.orange { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.btn-icon.orange:hover { background: #f59e0b; color: white; }
.btn-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.btn-icon.green:hover { background: #10b981; color: white; }
.btn-icon.red { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.btn-icon.red:hover { background: #ef4444; color: white; }

.actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ==========================================================================
   MODALES Y FORMULARIOS
   ========================================================================== */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 10, 20, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalEntry 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-content.wide {
  max-width: 950px;
}

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

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
}
.close-btn:hover { color: white; }

.modal-body {
  padding: 20px 24px;
}

form {
  padding: 20px 24px;
}

.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 15px;
  flex: 1;
}
.form-group.col-6 { flex: 0 0 calc(50% - 7.5px); }
.form-group.col-4 { flex: 0 0 calc(33.333% - 10px); }
.form-group.col-3 { flex: 0 0 calc(25% - 11.2px); }
.form-group.col-8 { flex: 0 0 calc(66.666% - 5px); }

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: white;
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition-smooth);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  background: rgba(255,255,255,0.06);
}

select option {
  background-color: #0f172a !important;
  color: #ffffff !important;
}

.input-addon {
  display: flex;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.addon-prefix, .addon-suffix {
  padding: 0 12px;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.input-addon input {
  flex: 1;
  border: none !important;
  background: transparent !important;
}

/* Partidas de Cotización */
.partidas-section {
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-bottom: 20px;
}
.partidas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.items-list-header {
  display: flex;
  padding: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-glass);
  margin-bottom: 10px;
}

.quote-items-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.item-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.col-desc { flex: 1.5; min-width: 0; position: relative; }
.col-brand { flex: 0.8; }
.col-unit { width: 80px; }
.col-qty { width: 70px; }
.col-price { width: 120px; }
.col-action { width: 36px; display: flex; justify-content: center; }

.col-desc input, .col-brand input, .col-unit input, .col-qty input {
  width: 100%;
}

.price-indicator {
  display: block;
  font-size: 11px;
  color: var(--color-teal);
  text-align: right;
}

/* Sugerencias Autocompletar */
.autocomplete-suggestions {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: hsl(223, 47%, 12%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  z-index: 1000;
  max-height: 140px;
  overflow-y: auto;
}
.suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition-smooth);
}
.suggestion-item:hover {
  background: var(--bmc-blue);
  color: white;
}

/* ==========================================================================
   VALORACIÓN DE PRECIOS POR EL JEFE
   ========================================================================== */
.quote-pricing-details {
  display: flex;
  gap: 15px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 15px;
}
.detail-item { font-size: 13px; }
.currency-badge {
  background: var(--bmc-blue);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
}

.items-pricing-header {
  display: flex;
  padding: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-glass);
  margin-bottom: 10px;
}

.pricing-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-glass);
}
.col-num { width: 25px; text-align: center; font-weight: bold; color: var(--text-muted); }
.col-history { width: 150px; font-size: 10px; color: var(--color-teal); }
.col-val { width: 140px; }
.col-save-cat { width: 110px; display: flex; justify-content: center; }

/* Switch Toggle Custom */
.switch-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11px;
}
.switch-label input { display: none; }
.switch-custom {
  width: 38px;
  height: 18px;
  background: rgba(255,255,255,0.1);
  border-radius: 50px;
  position: relative;
  border: 1px solid var(--border-glass);
}
.switch-custom::after {
  content: '';
  position: absolute;
  top: 1px; left: 1px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  transition: var(--transition-smooth);
}
.switch-label input:checked + .switch-custom {
  background: var(--bmc-blue);
}
.switch-label input:checked + .switch-custom::after {
  left: 21px;
}

/* ==========================================================================
   CONFIGURACIONES Y MÉTRICAS (DASHBOARD)
   ========================================================================== */
.boss-navigation {
  display: flex;
  gap: 5px;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 25px;
}
.boss-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  position: relative;
}
.boss-tab.active {
  color: var(--bmc-blue);
}
.boss-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 3px;
  background: var(--bmc-blue);
  border-radius: 5px 5px 0 0;
}
.boss-tab .badge {
  background: var(--color-rose);
  color: white;
  font-size: 9px;
  padding: 2px 5px;
}

.boss-panel { display: none; }
.boss-panel.active { display: block; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}
.settings-card { padding: 24px; }
.settings-card h3 { font-size: 16px; margin-bottom: 15px; }

/* Dashboard Gráficos */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 25px;
}
.chart-card {
  padding: 24px;
}
.chart-card h3 {
  font-size: 15px;
  margin-bottom: 15px;
  color: white;
}
.chart-wrapper {
  position: relative;
  height: 240px;
  width: 100%;
}

.email-simulation-details {
  background: rgba(0,0,0,0.3);
  border: 1px dashed var(--border-glass);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-top: 15px;
}
.email-simulation-details h4 { font-size: 13px; margin-bottom: 6px; }
.simulation-links { display: flex; gap: 8px; margin: 10px 0; }
.hint-text { font-size: 11px; color: var(--text-muted); }

/* ==========================================================================
   VISTA DE PREVISUALIZACIÓN IMPRESIÓN (PDF MEMBRETADO BMC EXACTO)
   ========================================================================== */
.print-preview-container {
  display: none;
  background: #0f172a;
  min-height: 100vh;
  padding: 30px 15px;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2000;
}
.print-preview-container.active { display: block; }
.print-actions {
  max-width: 800px;
  margin: 0 auto 20px auto;
  display: flex;
  justify-content: space-between;
}

/* Hoja BMC Oficial */
.quote-sheet {
  background: #ffffff;
  color: #1e293b;
  width: 100%;
  max-width: 800px;
  min-height: 1050px;
  margin: 0 auto;
  padding: 45px 50px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Header BMC */
.logo-and-brand {
  display: flex;
  align-items: center;
  gap: 15px;
}
.bmc-letterhead-logo {
  border: 2px solid var(--bmc-navy);
  padding: 6px 12px;
  border-radius: 4px;
  text-align: center;
  line-height: 1.1;
}
.bmc-letterhead-logo .md-sub {
  font-size: 14px;
  font-weight: 800;
  color: var(--bmc-navy);
  letter-spacing: 1px;
}
.bmc-letterhead-logo .md-desc {
  font-size: 7px;
  font-weight: 700;
  color: #64748b;
}

.bmc-brand-text {
  border-left: 2px solid #cbd5e1;
  padding-left: 12px;
  line-height: 1.1;
}
.bmc-brand-text h2 {
  font-size: 24px;
  font-weight: 900;
  color: var(--bmc-navy);
  margin: 0;
}
.bmc-brand-text span {
  font-size: 9px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.doc-meta-block {
  text-align: right;
  line-height: 1.4;
}
.doc-meta-block .city-date {
  font-size: 11px;
  color: var(--bmc-navy);
  font-weight: 700;
}
.doc-meta-block .folio {
  font-size: 18px;
  color: #c2410c; /* Rojo Naranja */
  font-family: var(--font-title);
  margin-top: 2px;
}
.doc-meta-block .provider {
  font-size: 11px;
  color: #475569;
}

.bmc-blue-bar {
  height: 4px;
  background: var(--bmc-navy);
  margin: 15px 0 20px 0;
}

.recipient-box h3 {
  font-size: 13px;
  color: var(--bmc-navy);
  font-weight: 800;
}
.recipient-box p {
  font-size: 12px;
  color: #475569;
  margin-top: 3px;
}

.intro-paragraph {
  font-size: 11.5px;
  line-height: 1.5;
  color: #334155;
  margin: 20px 0;
}

/* Tabla BMC */
.bmc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.bmc-table th {
  background: #cbd5e1 !important;
  color: var(--bmc-navy) !important;
  font-weight: 800;
  font-size: 10.5px;
  padding: 8px;
  border-bottom: 2px solid var(--bmc-navy);
}
.bmc-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
  font-size: 11.5px;
  vertical-align: middle;
}
.bmc-table tr:hover { background: transparent !important; }

/* Totales BMC */
.totals-section {
  display: flex;
  justify-content: space-between;
  margin-bottom: 25px;
  align-items: flex-start;
}
.amount-in-letters {
  width: 60%;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 12px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  line-height: 1.4;
}
.totals-table {
  width: 35%;
  font-size: 11.5px;
}
.totals-table td {
  padding: 4px 6px;
  border-bottom: none;
  color: #334155;
}
.totals-table .lbl { text-align: right; font-weight: 700; }
.totals-table .val { text-align: right; font-weight: 700; }
.totals-table .final-row { background: #cbd5e1; }
.totals-table .final-row td { color: var(--bmc-navy); font-size: 13px; font-weight: 800; }

.proposals-included, .notes-included {
  margin-bottom: 20px;
}
.proposals-included h4, .notes-included h4 {
  font-size: 11px;
  color: var(--bmc-navy);
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.proposals-included ul, .notes-included ul {
  padding-left: 20px;
  font-size: 11px;
  color: #475569;
  line-height: 1.4;
}

/* Página 2 */
.contacts-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 25px;
}
.contacts-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--bmc-navy);
  margin-bottom: 12px;
}
.contact-card {
  font-size: 11.5px;
  color: #334155;
  line-height: 1.4;
  margin-bottom: 10px;
}
.contact-card:last-child { margin-bottom: 0; }

.commercial-terms {
  margin-bottom: 25px;
}
.commercial-terms h4 {
  font-size: 11px;
  color: var(--bmc-navy);
  font-weight: 800;
  text-transform: uppercase;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 4px;
  margin-bottom: 10px;
}
.commercial-terms table {
  width: 100%;
  font-size: 11.5px;
}
.commercial-terms td {
  padding: 4px 0;
  border-bottom: none;
  color: #334155;
}

.closing-paragraph {
  font-size: 11.5px;
  color: #334155;
  margin-bottom: 30px;
}

/* Atentamente e Firmas */
.signature-section {
  width: 320px;
  margin-bottom: 40px;
}
.signature-section p { font-size: 11.5px; }
.signature-graphic-box {
  height: 60px;
  position: relative;
  margin: 10px 0;
}
.signature-line-mark {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: #475569;
}
.sig-name { font-weight: 700; color: #1e293b; margin-top: 8px; }
.sig-title { font-size: 10px; color: #64748b; text-transform: uppercase; }

/* Pie de Página BMC */
.bmc-footer {
  border-top: 1px solid #cbd5e1;
  padding-top: 10px;
  margin-top: auto;
  font-size: 9.5px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
}
.footer-contacts span { margin-right: 15px; }

/* ==========================================================================
   ANIMACIONES MICRO-INTERACTIVAS Y MEDIA RULES
   ========================================================================== */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-4px); }
  100% { transform: translateY(0px); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

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

@keyframes rowSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 1024px) {
  .header-container { flex-direction: column; gap: 10px; }
  .metrics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .kpis-container { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .form-group.col-6, .form-group.col-4, .form-group.col-3, .form-group.col-8 {
    flex: 0 0 100% !important;
  }
}

/* ==========================================================================
   REGLAS DE IMPRESIÓN OFICIAL (PDF PERFECTO DE BMC)
   ========================================================================== */
@media print {
  /* Ocultar absolutamente toda la interfaz web */
  body * {
    visibility: hidden;
  }
  
  /* Mostrar solamente la hoja de cotización */
  #print-preview-container,
  #print-preview-container * {
    visibility: visible;
  }
  
  #print-preview-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 0;
    margin: 0;
    background: #ffffff !important;
  }
  
  .no-print {
    display: none !important;
  }
  
  .quote-sheet {
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    min-height: 100% !important;
    background: #ffffff !important;
  }

  .page-break {
    page-break-before: always;
    break-before: always;
  }

  /* Asegurar colores e imágenes de fondo en impresión */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .bmc-blue-bar {
    background: var(--bmc-navy) !important;
  }
  
  .sheet-items-table th {
    background: #cbd5e1 !important;
    color: var(--bmc-navy) !important;
  }
  
  .totals-table .final-row {
    background: #cbd5e1 !important;
  }
}
