:root {
  --brand: #0B5CAB;
  --brand-hover: #014486;
  --border: #dddbda;
  --bg: #f3f2f2;
  --text: #080707;
  --muted: #706e6b;
  --radius: 10px;
  --shadow: 0 2px 0 rgba(0,0,0,0.06);

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
}

a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}
a:hover {
  text-decoration: underline;
}

/* ==========================================
   TIPOGRAFÍA Y ENCABEZADOS
   ========================================== */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 10px 0;
  color: var(--text);
  font-weight: 600;
}
h1 { font-size: 1.8rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 10px 0; }

/* ==========================================
   BOTONES Y ACCIONES
   ========================================== */
button, .btn {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  background-color: #f9fafb;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

button:hover, .btn:hover {
  border-color: var(--brand);
  background-color: #ffffff;
}

button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

/* Botones de píldora estilo Salesforce */
.btn-primary-pill {
  background: #0176D3; /* Salesforce Action Blue */
  color: #ffffff;
  border: 1px solid #0176D3;
  border-radius: 9999px;
  padding: 6px 16px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.btn-primary-pill:hover {
  background: #014486;
  border-color: #014486;
  color: #ffffff;
}

.btn-outline-pill {
  background: #ffffff;
  color: #0176D3;
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.btn-outline-pill:hover {
  border-color: #0176D3;
  background: rgba(1, 118, 211, 0.05);
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}
.btn-danger:hover {
  background: #b91c1c;
}

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

/* ==========================================
   CONTENEDOR Y LAYOUT SLDS
   ========================================== */
.slds-main-container {
  width: 100%;
  max-width: min(1800px, 98vw);
  margin: 0 auto;
  padding: 20px 16px;
}

.slds-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.slds-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.slds-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

/* ==========================================
   TABLAS DE DATOS SLDS
   ========================================== */
.slds-table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}

.slds-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.slds-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.slds-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.slds-table tr:hover {
  background-color: #f8fafc;
}

/* Badges / Etiquetas de Estado */
.slds-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.slds-badge-success { background: #dcfce7; color: #15803d; }
.slds-badge-warning { background: #fef9c3; color: #a16207; }
.slds-badge-info { background: #e0f2fe; color: #0369a1; }
.slds-badge-danger { background: #fee2e2; color: #b91c1c; }
.slds-badge-neutral { background: #f1f5f9; color: #475569; }

/* ==========================================
   FORMULARIOS E INPUTS
   ========================================== */
.slds-form-group {
  margin-bottom: 16px;
}

.slds-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.slds-input, .slds-select, .slds-textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.slds-input:focus, .slds-select:focus, .slds-textarea:focus {
  outline: none;
  border-color: #0176D3;
  box-shadow: 0 0 0 3px rgba(1, 118, 211, 0.15);
}

.slds-grid {
  display: grid;
  gap: 16px;
}
.slds-grid-2 { grid-template-columns: repeat(2, 1fr); }
.slds-grid-3 { grid-template-columns: repeat(3, 1fr); }
.slds-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .slds-grid-2, .slds-grid-3, .slds-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   MODALES SLDS
   ========================================== */
.slds-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 7, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}

.slds-modal {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

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

.slds-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================
   NOTIFICACIONES (TOASTS)
   ========================================== */
#toast-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slds-toast {
  min-width: 280px;
  max-width: 400px;
  background: #1e293b;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  animation: toastSlideIn 0.25s ease-out;
}
.slds-toast.success { background: #065f46; border-left: 4px solid #10b981; }
.slds-toast.error { background: #881337; border-left: 4px solid #f43f5e; }

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

/* ==========================================
   FORMATO Y CAPTURA DE COTIZACIÓN (LEÓN SUR)
   ========================================== */
.cot-paper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 32px 36px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1e293b;
  line-height: 1.4;
  box-sizing: border-box;
}

.cot-input-underline {
  border: none;
  border-bottom: 1.5px solid #cbd5e1;
  background: transparent;
  padding: 2px 4px;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}
.cot-input-underline:focus {
  outline: none;
  border-bottom: 2px solid #b91c1c;
}

.cot-input-line {
  border: none;
  border-bottom: 1px solid #cbd5e1;
  background: transparent;
  padding: 2px 4px;
  font-family: inherit;
  font-size: 12px;
  color: #1e293b;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}
.cot-input-line:focus {
  outline: none;
  border-bottom: 1.5px solid #b91c1c;
}

.cot-input-cell {
  border: none;
  border-bottom: 1px solid #cbd5e1;
  background: transparent;
  padding: 2px 4px;
  text-align: right;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  width: 95%;
  box-sizing: border-box;
}
.cot-input-cell:focus {
  outline: none;
  border-bottom: 1.5px solid #b91c1c;
}

.cot-textarea-bullets {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  color: #1e293b;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}
.cot-textarea-bullets:focus {
  outline: none;
  border-color: #b91c1c;
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.08);
}

@media print {
  @page {
    size: letter portrait;
    margin: 8mm 10mm;
  }
  body {
    background: #ffffff !important;
  }
  #navbar-root,
  .slds-nav-tab-container,
  .sal-instr-card,
  .sal-steps-card,
  .cot-toolbar,
  .sal-side-col,
  aside,
  header,
  footer,
  #modal-root,
  #toast-root,
  .cot-no-print {
    display: none !important;
  }
  .slds-main-container,
  .sal-main-grid,
  .sal-main-col {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
  #cotizacion-sheet-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .cot-input-underline,
  .cot-input-line,
  .cot-input-cell,
  .cot-textarea-bullets {
    border: none !important;
    border-bottom: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
  }
}

