:root {
  --bg: #0f172a;
  --bg-2: #111827;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --ink: #0b1220;
  --ink-2: #475569;
  --brand: #1d4ed8;
  --brand-2: #0ea5e9;
  --brand-ink: #ffffff;
  --accent: #10b981;
  --danger: #dc2626;
  --warning: #f59e0b;
  --warning-ink: #92400e;
  --ok: #15803d;
  --c-danger: #dc2626;
  --c-ok: #15803d;
  --c-warning-ink: #92400e;
  --c-border: #e2e8f0;
  --c-ink: #0b1220;
  --border: #e2e8f0;
  --shadow: 0 8px 24px rgba(15,23,42,0.08);
  --header-blue: #355d98;
  --header-blue-dark: #2f558d;
  --cta-green: #91bf16;
  --cta-green-dark: #7ca50f;
  --sticky-scroll-offset: 92px;
}

* { box-sizing: border-box; }
html {
  margin: 0;
  padding: 0;
  scroll-padding-top: var(--sticky-scroll-offset);
}
body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--panel-2);
  font-size: 14px;
  line-height: 1.45;
}

code {
  background: #eef2ff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #3730a3;
}

.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.big   { font-size: 28px; font-weight: 700; margin: 8px 0; color: var(--ink); }
.hidden { display: none !important; }

/* ================= LOGIN ================= */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 10% 0%, #1e3a8a22, transparent 60%),
    radial-gradient(800px 500px at 100% 100%, #0ea5e922, transparent 60%),
    linear-gradient(160deg, var(--bg) 0%, #1e293b 100%);
  color: #e2e8f0;
}

.login-card {
  width: min(420px, 92vw);
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148,163,184,0.2);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(2,6,23,0.5);
}

.login-brand { text-align: center; margin-bottom: 20px; }
.logo-mark {
  display: inline-grid; place-items: center;
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; letter-spacing: 1px;
  margin: 0 auto 12px;
}
.login-brand h1 { margin: 0; font-size: 20px; letter-spacing: 0.2px; }
.login-brand h1 span { color: var(--brand-2); }
.tagline { color: #94a3b8; font-size: 12.5px; margin: 6px 0 0; }

.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form label { font-size: 12px; color: #cbd5e1; font-weight: 600; }
.login-form input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.25);
  background: rgba(15,23,42,0.6);
  color: #f1f5f9;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.login-form input:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.18);
}
.login-form .remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #cbd5e1;
  font-weight: 500;
  margin: 2px 0 4px;
  user-select: none;
}
.login-form .remember-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: var(--brand-2);
  cursor: pointer;
}

#btn-login {
  margin-top: 6px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
#btn-login:active { transform: translateY(1px); }

.form-msg { min-height: 18px; margin: 4px 0 0; font-size: 12.5px; }
.form-msg.err { color: #fecaca; }
.form-msg.ok  { color: #bbf7d0; }

.login-foot { margin-top: 18px; padding-top: 14px; border-top: 1px dashed rgba(148,163,184,0.2); }
.login-foot p { margin: 0; color: #94a3b8; font-size: 12px; }
.login-foot code { background: #334155; color: #e2e8f0; }

/* ================= NAVBAR + SHELL ================= */
.navbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px;
  background: linear-gradient(180deg, var(--header-blue) 0%, var(--header-blue-dark) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 28px rgba(27,48,84,0.18);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.nav-brand:hover,
.nav-brand:focus-visible {
  text-decoration: none;
}
.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}
.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brand-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
}
.brand-text { color: #fff; font-size: 19px; line-height: 1.05; }
.brand-text strong { color: #fff; font-weight: 800; letter-spacing: 0.1px; }

.nav-links {
  list-style: none; display: flex; gap: 4px;
  padding: 0; margin: 0 auto 0 20px;
  flex-wrap: wrap;
}
.nav-link {
  display: inline-block; padding: 9px 14px; border-radius: 10px;
  color: rgba(255,255,255,0.88); text-decoration: none; font-weight: 700; font-size: 13px;
  background: transparent;
  border: 1px solid transparent;
}
.nav-link:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-link.active {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border-color: rgba(255,255,255,0.1);
}

.nav-user { display: flex; align-items: center; gap: 10px; }
.user-email { color: rgba(255,255,255,0.88); font-size: 12.5px; font-weight: 600; }
.btn-logout {
  padding: 7px 12px; border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.1);
  border-radius: 8px; color: #fff; font-weight: 700; font-size: 12.5px; cursor: pointer;
}
.btn-logout:hover { background: rgba(255,255,255,0.18); }

.app-shell {
  max-width: 1600px;
  margin: 18px auto;
  padding: 0 28px 160px;
}

.section-head { margin-bottom: 14px; }
.section-head h2 { margin: 0 0 4px; font-size: 31px; color: #0d5788; }
.section-head p { max-width: 1100px; }
.section-head-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
}
.section-head-copy {
  min-width: 0;
}
.section-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.section-head-action {
  flex: 0 0 auto;
  margin-bottom: 2px;
  white-space: nowrap;
}

.intake-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  margin-bottom: 14px;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.card.empty { min-height: 180px; display: grid; place-items: center; color: var(--ink-2); }

.intake-card {
  min-height: 178px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 22px 20px 18px;
}
#sec-inicio.batch-detail-only-mode .section-head,
#sec-inicio.batch-detail-only-mode .intake-grid {
  display: none;
}
#sec-inicio.batch-detail-only-mode #cotizacion-card {
  margin-top: 0 !important;
}
.intake-title {
  margin: 0 0 8px !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  color: #0d5788 !important;
}
.intake-copy {
  margin: 0 0 14px !important;
  min-height: 34px;
}
.intake-form-row {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  gap: 14px;
  min-height: 128px;
}
.upload-form-slot {
  display: flex;
  flex: 1 1 auto;
}
.upload-inline-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  gap: 14px;
  width: 100%;
}
.upload-inline-form .intake-field-stack {
  width: 100%;
}
.intake-label-placeholder {
  visibility: hidden;
  user-select: none;
}
.upload-inline-form input[type="file"] {
  width: 100%;
  max-width: 100%;
  font: inherit;
  color: var(--ink-2);
}
.upload-inline-form .btn-primary-action {
  justify-self: start;
  min-width: 260px;
}
.upload-inline-form input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 10px 14px;
  border: 1px solid #cfd8e6;
  border-radius: 10px;
  background: #fff;
  color: #355d98;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.upload-inline-form input[type="file"]::file-selector-button:hover {
  background: #f8fbff;
}
.intake-status {
  margin-top: auto;
  padding-top: 12px;
}
.intake-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-ink);
}
.intake-field-stack {
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
  align-content: start;
}
.intake-input {
  flex: 1;
  min-width: 240px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.intake-input:focus {
  border-color: #005387;
  box-shadow: 0 0 0 3px rgba(0,83,135,0.12);
}
.mp-intake-form-row {
  gap: 14px;
}
.mp-intake-form-row .intake-field-stack {
  width: 100%;
}
.mp-intake-form-row .intake-input {
  width: 100%;
  min-width: 0;
}
.mp-intake-form-row .btn-primary-action {
  justify-self: start;
  min-width: 320px;
}

.batch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.batch-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-width: 0;
  transition: height 280ms ease;
}
.batch-stage-track {
  display: flex;
  width: 200%;
  min-width: 0;
  align-items: start;
  transform: translateX(0);
  transition: transform 320ms ease;
  will-change: transform;
}
.batch-stage[data-view="detail"] .batch-stage-track {
  transform: translateX(-50%);
}
.batch-stage-pane {
  flex: 0 0 50%;
  min-width: 0;
  width: 100%;
  max-width: 50%;
}
.batch-stage-pane .batch-card:last-child,
.batch-stage-pane .batch-grid:last-child {
  margin-bottom: 0;
}
.batch-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.batch-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.batch-card-head--back-first {
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.batch-card-head--back-first > div {
  min-width: 0;
}
.batch-textarea {
  width: 100%;
  min-height: 136px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}
.batch-textarea:focus {
  outline: 2px solid rgba(13, 87, 136, 0.16);
  border-color: #005387;
}
.batch-preview-grid,
.batch-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.batch-preview-item,
.batch-summary-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #f8fafc;
}
.batch-preview-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.25px;
  color: var(--ink-2);
}
.batch-validation-detail,
.batch-create-status,
.batch-polling-status {
  min-height: 20px;
}
.batch-note {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(13, 87, 136, 0.16);
  background: rgba(13, 87, 136, 0.06);
  color: #0d5788;
  font-size: 13px;
}
.batch-actions-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.batch-refresh-btn {
  min-width: 130px;
}
.btn-secundario.btn-lotes {
  border-color: #2e4f7d;
  background: #2e4f7d;
  color: #fff;
  box-shadow: 0 10px 24px rgba(46, 79, 125, 0.22);
}
.btn-secundario.btn-lotes:hover:not(:disabled) {
  background: #254164;
  border-color: #254164;
  color: #fff;
}
.btn-secundario.btn-back-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 16px;
  border-color: #c8d7e7;
  background: #eaf0f7;
  color: #2e4f7d;
  box-shadow: 0 6px 18px rgba(46, 79, 125, 0.08);
}
.btn-secundario.btn-back-nav:hover:not(:disabled) {
  background: #dde7f2;
  border-color: #b4c8dd;
  color: #254164;
}
.btn-back-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 15px;
  line-height: 1;
}
.batch-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #d7e2ef;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}
.batch-table th,
.batch-table td {
  padding: 14px 14px;
  border-bottom: 1px solid #e6edf5;
  text-align: left;
  vertical-align: top;
}
.batch-table th {
  background: #f8fafc;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: #475569;
}
.batch-table tbody tr:hover td {
  background: #f8fbff;
}
.batch-codes-cell {
  min-width: 150px;
}
.batch-col-created,
.batch-cell-created,
.batch-col-summary,
.batch-cell-summary,
.batch-cell-close {
  white-space: nowrap;
}
.batch-cell-created,
.batch-cell-summary,
.batch-cell-close {
  font-size: 13px;
}
.batch-cell-code,
.batch-cell-close {
  white-space: nowrap;
}
.batch-cell-code {
  width: 180px;
  min-width: 180px;
}
.batch-code-strong {
  display: inline-block;
  white-space: nowrap;
}
.batch-cell-name {
  min-width: 360px;
  white-space: normal;
  word-break: break-word;
}
.batch-col-actions,
.batch-cell-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.batch-codes-list {
  margin: 0;
  white-space: pre-line;
  font: inherit;
  line-height: 1.45;
  color: var(--ink);
}
.batch-table .num {
  text-align: right;
}
.batch-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.batch-open-btn {
  min-width: 84px;
  min-height: 36px;
  padding: 8px 14px;
  box-shadow: none;
}
.batch-table-actions-stack {
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 165px;
}
.batch-inline-link {
  border: 0;
  background: transparent;
  color: #0d5788;
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.section,
#sec-batch,
#batch-tracking-card,
.batch-inline-link,
.batch-table tbody tr {
  scroll-margin-top: var(--sticky-scroll-offset);
}
.batch-inline-link:disabled {
  color: var(--ink-2);
  cursor: not-allowed;
}
.batch-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.batch-status-pendiente {
  background: #e2e8f0;
  color: #334155;
}
.batch-status-procesando {
  background: #dbeafe;
  color: #1d4ed8;
}
.batch-status-procesando::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: rgba(29, 78, 216, 0.18);
  border-top-color: rgba(29, 78, 216, 0.45);
  box-sizing: border-box;
  animation: batch-processing-spin 0.85s linear infinite;
}
.batch-status-completado {
  background: #dcfce7;
  color: #166534;
}
.batch-status-revision {
  background: #fef3c7;
  color: #92400e;
}
.batch-status-temporal {
  background: #ffedd5;
  color: #c2410c;
}
.batch-status-error {
  background: #fee2e2;
  color: #b91c1c;
}

.card ul { padding-left: 18px; }
.card ul li { margin: 4px 0; }

@keyframes batch-processing-pulse {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

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

.mb-10 { margin-bottom: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.strong { font-weight: 700; }

.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ================= MATCHING BADGES / CHIPS / TABLE ================= */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
}
.badge-ok        { background: #10b981; }
.badge-revisar   { background: #f59e0b; color: #111827; }
.badge-warn      { background: #f59e0b; color: #111827; border: 1px solid #d97706; }
.badge-sin-match { background: #dc2626; }
.badge-excluido  { background: #64748b; }

.badge-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}
.badge-dot-ok        { background: #10b981; }
.badge-dot-revisar   { background: #f59e0b; }
.badge-dot-sin-match { background: #dc2626; }
.badge-dot-excluido  { background: #64748b; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chip {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.chip:hover { background: #f8fafc; }
.chip.active {
  background: #eff6ff;
  color: var(--brand);
  border-color: #bfdbfe;
}

.table-wrap {
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

/* ============= TABLAS ABAJO COTIZACIÓN (Codigo VC / Nombre VC || Operación) ============= */
.tablas-detalle-row { display: none; }
.tabla-detalle {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.tabla-detalle table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
}
.tabla-detalle thead {
  background: #1d6fa5;
  color: #fff;
}
.tabla-detalle th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.1px;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.tabla-detalle th:last-child { border-right: 0; }
.tabla-detalle td {
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.2;
}
.tabla-detalle tr:nth-child(even) td { background: #f8fafc; }
.tabla-detalle td.codigo-vc {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #0c4a6e;
  font-weight: 600;
  width: 96px;
  white-space: nowrap;
}
.tabla-detalle td.num-vc {
  width: 36px;
  color: var(--ink-2);
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.tabla-detalle .detalle-name-cell {
  word-break: break-word;
}
.tabla-detalle .empty-td {
  color: #94a3b8;
  text-align: center;
  font-style: italic;
  padding: 12px;
}
.matching-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.matching-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f9;
}
.matching-table th,
.matching-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  text-align: left;
}
.matching-table th {
  font-weight: 700;
  color: var(--ink-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.matching-table tbody tr:hover { background: #f8fafc; }
.matching-table td.desc-col       { max-width: 280px; }
.matching-table td.criterio-col   { max-width: 160px; }
.matching-table td.col-acc        { width: 84px; }

.btn-revisar {
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: 6px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.75;
}

/* ================= TOASTS ================= */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.toast {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #0b1220;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15,23,42,0.12);
  animation: toastIn .22s ease-out;
}
.toast-success { border-left: 4px solid #8cb811; }
.toast-error   { border-left: 4px solid #dc2626; color: #7f1d1d; }
.toast-warning { border-left: 4px solid #f59e0b; color: #92400e; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ================= OVERLAY LOADING ================= */
.overlay {
  position: relative;
}
.overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.72);
  border-radius: 14px;
  z-index: 4;
  backdrop-filter: blur(2px);
}
.overlay-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #e2e8f0;
  border-top-color: #005387;
  animation: spin .8s linear infinite;
  z-index: 5;
}
.overlay-message {
  position: absolute;
  top: calc(50% + 34px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  color: #005387;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  max-width: 80%;
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ================= COSTEO ================= */
.costeo-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(170px, 0.8fr) minmax(190px, 0.9fr) auto auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}
.costeo-toolbar--lic-only {
  display: block;
}
.costeo-toolbar--lic-only .costeo-field {
  width: 100%;
}
.cotizacion-toolbar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.cotizacion-toolbar-head #cotizacion-lic-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 16px;
  color: #0d5788;
}
.batch-detail-only-mode .cotizacion-toolbar-head {
  margin-bottom: 16px;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.batch-detail-only-mode .cotizacion-toolbar-head #cotizacion-lic-label {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
}
.batch-detail-only-mode #cotizacion-lic-static {
  padding: 0;
  margin: 0 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  min-height: 0;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
  color: #0d5788;
}
.cotizacion-batch-context {
  display: none;
}
.cotizacion-back-btn {
  min-width: 0;
  padding: 8px 14px;
  font-size: 13px;
  align-self: flex-start;
}
.costeo-field { display: flex; flex-direction: column; gap: 6px; }
.costeo-field label {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.costeo-field select,
.costeo-field input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.costeo-field select:focus,
.costeo-field input:focus {
  border-color: #005387;
  box-shadow: 0 0 0 3px rgba(0,83,135,0.12);
}
.costeo-field-static {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  background: #f8fafc;
  min-height: 39px;
  display: flex;
  align-items: center;
}
.costeo-toolbar > .btn-verde {
  min-height: 39px;
  white-space: nowrap;
}
.costeo-toolbar > .btn-secundario {
  min-height: 39px;
  white-space: nowrap;
}
.hidden-accessory-control {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.btn-verde {
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--cta-green);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
  box-shadow: 0 8px 20px rgba(145,191,22,0.24);
}
.btn-verde:hover:not(:disabled) { background: var(--cta-green-dark); }
.btn-verde:active:not(:disabled) { transform: translateY(1px); }
.btn-verde:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  color: #64748b;
  box-shadow: none;
}
.btn-primary-action {
  min-width: 240px;
  min-height: 42px;
  justify-content: center;
  text-align: center;
}
.btn-verde .spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

#mp-import-status.status-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#mp-import-status.status-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid rgba(146, 64, 14, 0.22);
  border-top-color: #92400e;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}

.import-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.import-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(2px);
}
.import-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(460px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid rgba(0, 83, 135, 0.14);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
  padding: 28px 24px 22px;
  text-align: center;
}
.import-modal-spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 999px;
  border: 5px solid rgba(0, 83, 135, 0.12);
  border-top-color: #005387;
  animation: spin 0.85s linear infinite;
}
.import-modal-title {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}
.import-modal-text {
  font-size: 15px;
  line-height: 1.45;
  color: #1e293b;
  font-weight: 600;
}
.import-modal-subtext {
  margin-top: 10px;
  font-size: 13px;
  color: #64748b;
}
.import-modal-dialog-error {
  max-width: 520px;
}
.import-modal-icon-error {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
}
.import-modal-title-error {
  font-size: 22px;
}
.import-modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.btn-secundario {
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #005387;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease, border-color .15s ease;
}
.btn-secundario:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #005387;
}
.btn-secundario:active:not(:disabled) { transform: translateY(1px); }
.btn-secundario:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

.costeo-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}
.costeo-summary .badge {
  font-size: 13px;
  padding: 5px 12px;
}
.badge-ok-green { background: #8cb811; }
.badge-revisar-amber { background: #f59e0b; color: #111827; }
.badge-error-red { background: #dc2626; }

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.stat-pill strong { color: var(--ink); }

#costeo-table-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.costeo-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.costeo-block-title {
  margin: 0;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  color: #fff;
  background: #005387;
}
.costeo-block:nth-of-type(2) .costeo-block-title {
  background: #1d6fa5;
}
.costeo-block:nth-of-type(3) .costeo-block-title {
  background: #0f766e;
}
.rentabilidad-totales {
  background: #f3f4f6;
  font-weight: 700;
  border-top: 2px solid var(--ink-2);
}
.rentabilidad-totales td.num.strong {
  font-weight: 700;
  color: var(--ink);
}
.td-totales-label {
  background: #dbeafe;
  text-align: right;
  padding-right: 14px;
  font-size: 14px;
  letter-spacing: 0.5px;
}
.costeo-table-wrap-inner {
  max-height: 52vh;
  overflow: auto;
}
.costeo-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.costeo-table thead { position: sticky; top: 0; z-index: 2; background: #f1f5f9; }
.costeo-table th, .costeo-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  text-align: left;
}
.costeo-table th {
  font-weight: 700;
  color: var(--ink-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.costeo-table tbody tr[data-estado^="EXCLUIDO_T"] { background: #f5f5f5; }
.costeo-table tbody tr[data-estado^="SIN_COSTO"],
.costeo-table tbody tr[data-estado^="EXCLUIDO_XX"] { background: #fff9e6; }
.costeo-table tbody tr[data-estado^="ERROR"] { background: #fde7e9; }
.costeo-table tbody tr:hover:not([class*="bg-"]) { background: #f8fafc; }
.costeo-table td.col-n { width: 48px; }
.costeo-table td.dash { color: #94a3b8; text-align: center; }

/* ================= COTIZACIÓN (pestaña principal V0+) ================= */
.cotizacion-header {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px 24px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg,#eff6ff 0%, #fff 100%);
  margin-bottom: 12px;
}
.cotizacion-header-left, .cotizacion-header-right {
  display: flex; flex-direction: column; gap: 6px;
}
.cliente-row { display: flex; align-items: baseline; gap: 8px; }
.cliente-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.3px;
  font-weight: 700; color: var(--ink-2); min-width: 170px; width: 170px;
}
.cliente-val {
  font-size: 13.5px; color: var(--ink); font-weight: 500; word-break: break-word;
}
.cliente-val.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }
.cotizacion-extra {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  margin: 0 0 18px;
  padding: 22px 24px;
  border: 1px solid #d7e2ef;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}
.cotizacion-extra.hidden {
  display: none;
}
.cotizacion-extra-main {
  min-width: 0;
}
.cotizacion-meta-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.cotizacion-meta-row:last-child {
  margin-bottom: 0;
}
.cotizacion-meta-label {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
  color: #334155;
  text-transform: none;
  letter-spacing: 0;
}
.cotizacion-meta-text,
.cotizacion-link-url,
.cotizacion-descripcion-text,
.cotizacion-plazo-text {
  min-width: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  white-space: normal;
  word-break: break-word;
}
.cotizacion-link-url {
  color: #0d5788;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cotizacion-descripcion-text {
  min-height: 44px;
  white-space: pre-wrap;
}
.cotizacion-extra-side {
  align-self: start;
  padding: 18px 18px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #d7e2ef;
}
.cotizacion-adjuntos-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #35506a;
  text-transform: none;
}
.cotizacion-adjuntos-list {
  margin: 0;
  padding-left: 18px;
}
.cotizacion-adjuntos-list li {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  white-space: normal;
  word-break: break-word;
}
.cotizacion-adjuntos-list li:last-child {
  margin-bottom: 0;
}
.cotizacion-adjuntos-empty {
  list-style: none;
  margin-left: -18px;
  color: #64748b;
}
.cotizacion-adjunto-id {
  color: #64748b;
}
@media (max-width: 980px) {
  .cotizacion-header,
  .cotizacion-extra {
    grid-template-columns: 1fr;
  }
}

.cotizacion-search,
.cotizacion-filter {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.cotizacion-search:focus,
.cotizacion-filter:focus {
  border-color: #005387;
  box-shadow: 0 0 0 3px rgba(0,83,135,0.12);
}
.cotizacion-view-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 14px;
  padding: 0 4px;
  border-bottom: 1px solid #d7dee8;
}
.cotizacion-view-tab {
  border: 1px solid transparent;
  border-bottom: 4px solid transparent;
  background: #eef3f8;
  color: #64748b;
  border-radius: 12px 12px 0 0;
  padding: 10px 16px 9px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: -1px;
}
.cotizacion-view-tab.active {
  background: #ffffff;
  border-color: #d7dee8;
  border-bottom-color: #0d5788;
  color: #0d5788;
  box-shadow: 0 8px 20px rgba(13, 87, 136, 0.08);
}
.cotizacion-panel.hidden {
  display: none;
}
.productos-panel-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin: 0 0 12px;
}
.productos-add-btn {
  min-width: 156px;
}
.cotizacion-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.cotizacion-table thead { position: sticky; top: 0; z-index: 2; background: #005387; color: #fff; }
.cotizacion-table th {
  padding: 7px 7px; font-weight: 700; letter-spacing: 0;
  font-size: 10.5px; text-align: left; border-bottom: 1px solid var(--border);
}
.cotizacion-table th.num, .cotizacion-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cotizacion-table td {
  padding: 6px 6px; border-bottom: 1px solid #dbe3ee; vertical-align: top; text-align: left; color: var(--ink);
  line-height: 1.2; font-size: 11.5px;
}
.cotizacion-table tbody tr[data-estado^="EXCLUIDO_T"] { background: #f5f5f5; }
.cotizacion-table tbody tr[data-estado^="SIN_COSTO"],
.cotizacion-table tbody tr[data-estado^="EXCLUIDO_XX"],
.cotizacion-table tbody tr[data-estado="SIN_MATCH"] { background: #fff9e6; }
.cotizacion-table tbody tr[data-estado^="ERROR"] { background: #fde7e9; }
.cotizacion-table tbody tr.cotizacion-extra-row { background: #f8fbff; }
.cotizacion-table tbody tr:hover:not([class*="bg-"]) { background: #f8fafc; }
.cotizacion-table th.col-n,
.cotizacion-table td.col-n { width: 26px; }
.cotizacion-table th.col-item,
.cotizacion-table td.desc-col { width: 22%; max-width: 210px; }
.cotizacion-table th.col-cant,
.cotizacion-table td.col-cant { width: 48px; }
.licitacion-panel-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin: 0 0 10px;
}
.licitacion-readonly-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  table-layout: fixed;
  border: 1px solid #d7e2ef;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.licitacion-readonly-table thead th {
  background: #0d5788;
  color: #fff;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  border-bottom: 1px solid #0b486f;
}
.licitacion-readonly-table thead th.num,
.licitacion-readonly-table tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.licitacion-readonly-table tbody td {
  padding: 10px 10px;
  border-bottom: 1px solid #e6edf5;
  vertical-align: top;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink);
  background: #fff;
}
.licitacion-readonly-table tbody tr:last-child td {
  border-bottom: 0;
}
.licitacion-readonly-table th.col-n,
.licitacion-readonly-table td.col-n {
  width: 54px;
}
.licitacion-readonly-table th.col-item,
.licitacion-readonly-table td.col-item {
  width: auto;
}
.licitacion-readonly-table th.col-cant,
.licitacion-readonly-table td.col-cant {
  width: 120px;
}
.licitacion-readonly-table tbody td.col-item {
  white-space: normal;
  word-break: break-word;
}
.licitacion-readonly-table tbody td.col-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
  color: #0f172a;
}
.licitacion-readonly-table tbody tr:hover td {
  background: #f8fbff;
}
.licitacion-docx-box {
  margin: 0 0 14px;
  padding: 16px 18px;
  border: 1px solid #d7e2ef;
  border-radius: 14px;
  background: #f8fafc;
}
.licitacion-docx-head {
  margin-bottom: 12px;
}
.licitacion-docx-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 800;
  color: #16324f;
}
.licitacion-docx-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #475569;
}
.licitacion-docx-controls {
  margin-bottom: 10px;
}
.licitacion-docx-controls input[type="file"] {
  width: 100%;
  max-width: 100%;
  font: inherit;
  color: var(--ink-2);
}
.licitacion-docx-controls input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 10px 14px;
  border: 1px solid #cfd8e6;
  border-radius: 10px;
  background: #fff;
  color: #355d98;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.licitacion-docx-controls input[type="file"]::file-selector-button:hover {
  background: #f8fbff;
}
.licitacion-docx-controls input[type="file"]:disabled::file-selector-button {
  cursor: not-allowed;
  opacity: 0.6;
}
.licitacion-docx-confirm-wrap {
  display: flex;
  gap: 10px;
  align-items: end;
  margin: 0 0 10px;
  flex-wrap: wrap;
}
.licitacion-docx-parent-label {
  display: block;
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: #35506a;
}
.licitacion-docx-parent-select {
  min-width: 320px;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd8e6;
  border-radius: 10px;
  background: #fff;
  color: #16324f;
  font: inherit;
}
.licitacion-docx-message {
  min-height: 20px;
  margin: 0 0 10px;
}
.licitacion-docx-stale-wrap {
  margin: 0 0 12px;
}
.licitacion-docx-stale-card {
  padding: 12px 14px;
  border: 1px solid #f2c98b;
  border-radius: 12px;
  background: #fff7ed;
}
.licitacion-docx-stale-card + .licitacion-docx-stale-card {
  margin-top: 10px;
}
.licitacion-docx-stale-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
  color: #92400e;
}
.licitacion-docx-stale-copy,
.licitacion-docx-stale-compare {
  font-size: 12px;
  line-height: 1.45;
  color: #7c4a03;
}
.licitacion-docx-stale-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.licitacion-docx-tone-muted {
  color: #64748b;
}
.licitacion-docx-tone-warning {
  color: #92400e;
}
.licitacion-docx-tone-error {
  color: #991b1b;
}
.licitacion-docx-summary {
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #dbe7f3;
}
.licitacion-docx-summary-line {
  font-size: 13px;
  line-height: 1.45;
  color: #0f172a;
}
.licitacion-docx-summary-line + .licitacion-docx-summary-line {
  margin-top: 4px;
}
.licitacion-docx-technical {
  margin: 0 0 10px;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  background: #fff;
}
.licitacion-docx-technical summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #35506a;
}
.licitacion-docx-technical-body {
  padding: 0 14px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #334155;
  word-break: break-word;
}
.licitacion-docx-list-wrap {
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fffdf7;
  border: 1px solid #f2ddae;
}
.licitacion-docx-list-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  color: #7c4a03;
}
.licitacion-docx-list {
  margin: 0;
  padding-left: 18px;
}
.licitacion-docx-list li {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.4;
  color: #6b4f17;
}
.licitacion-docx-list li:last-child {
  margin-bottom: 0;
}
.licitacion-docx-table th.col-note,
.licitacion-docx-table td.col-note {
  width: 150px;
}
.licitacion-docx-table tbody td.col-note {
  color: #475569;
}
.gate3-parent-notes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: 12px;
}
.gate3-parent-note {
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  background: #f8fafc;
}
.gate3-parent-note.is-stale {
  border-color: #f2c98b;
  background: #fff7ed;
}
.gate3-parent-note-title {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
  color: #16324f;
}
.gate3-parent-note-body {
  font-size: 12px;
  line-height: 1.45;
  color: #475569;
}
.btn-linklike {
  border: 0;
  padding: 0;
  margin-left: 6px;
  background: transparent;
  color: #355d98;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.cotizacion-table th.col-unit-base,
.cotizacion-table td.col-unit-base { width: 88px; }
.cotizacion-table th.col-unit-final,
.cotizacion-table td.col-unit-final { width: 108px; }
.cotizacion-table th.col-total,
.cotizacion-table td.col-total { width: 88px; }
.cotizacion-table th.col-oferta,
.cotizacion-table td.col-oferta { width: 24%; min-width: 220px; }
.cotizacion-table th.col-vc-code,
.cotizacion-table td.col-vc-code { width: 98px; }
.cotizacion-table th.col-vc-name,
.cotizacion-table td.col-vc-name { width: 18%; min-width: 170px; }
.cotizacion-table td.col-img { width: 72px; text-align: center; color: #94a3b8; font-size: 11px; }
.cotizacion-desc-main { margin-bottom: 3px; }
.cotizacion-desc-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cotizacion-extra-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e0ecf7;
  color: #0d5788;
  font-size: 10px;
  font-weight: 800;
}
.cotizacion-extra-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.remove-extra-btn {
  border: 0;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
}
.remove-extra-btn {
  background: #e2e8f0;
  color: #334155;
}
.remove-extra-btn:hover:not(:disabled) {
  background: #cbd5e1;
}
.cotizacion-table td.desc-col,
.cotizacion-table td.col-vc-name {
  word-break: break-word;
}
.cotizacion-table th.col-vc-code,
.cotizacion-table th.col-vc-name {
  background: #667f49;
  color: #ffffff;
}
.cotizacion-table td.col-vc-code,
.cotizacion-table td.col-vc-name {
  background: #dfead4;
  color: #1f3521;
}
.cotizacion-table td.col-vc-code.match-no-hit,
.cotizacion-table td.col-vc-name.match-no-hit {
  color: var(--danger);
  font-weight: 700;
}
.cotizacion-table td.col-vc-code {
  font-weight: 700;
}
.cotizacion-table td.col-unit-final.is-provisional {
  color: #b45309;
  background: #fff7ed;
  font-weight: 700;
}
.cotizacion-cost-origin {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.25;
  color: #64748b;
  text-align: left;
  overflow-wrap: anywhere;
}
.cotizacion-cost-origin.is-empty {
  color: #94a3b8;
}
.cotizacion-cost-origin-empty {
  color: inherit;
}
.cotizacion-table td.col-unit-base.match-no-hit .cotizacion-cost-origin.is-empty,
.cotizacion-table td.col-unit-base.match-no-hit .cotizacion-cost-origin.is-empty .cotizacion-cost-origin-empty {
  color: var(--danger);
  font-weight: 700;
}
.cotizacion-cost-origin-provider {
  display: block;
}
.cotizacion-cost-origin-date {
  display: block;
  white-space: nowrap;
}
.price-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 16px;
}
.price-loading-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid #cbd5e1;
  border-top-color: #005387;
  border-radius: 999px;
  animation: price-spin 0.75s linear infinite;
}
@keyframes price-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.detalle-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 10.5px;
  font-weight: 700;
  color: #005387;
  cursor: pointer;
}
.detalle-toggle:hover { text-decoration: underline; }
.detalle-toggle.expanded { color: #0f766e; }
.cotizacion-detail-row td {
  padding: 0;
  background: #f8fbff;
  border-bottom: 1px solid #dbe3ee;
}
.cotizacion-detail-panel {
  padding: 10px 12px;
}
.cotizacion-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.cotizacion-detail-card {
  background: #fff;
  border: 1px solid #d9e5f0;
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 62px;
}
.cotizacion-detail-card-vc {
  background: #edf5e6;
  border-color: #c7d9b8;
}
.cotizacion-detail-card-vc .cotizacion-detail-label {
  color: #4f6a34;
}
.cotizacion-detail-label {
  font-size: 10px;
  letter-spacing: 0;
  color: #64748b;
  font-weight: 800;
  margin-bottom: 4px;
}
.cotizacion-detail-value {
  font-size: 11px;
  line-height: 1.3;
  color: #0f172a;
  font-weight: 600;
  word-break: break-word;
}
.cotizacion-detail-value.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cotizacion-history-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.35fr);
  gap: 8px;
  margin-top: 8px;
}
.cotizacion-history-card {
  background: #fff;
  border: 1px solid #d9e5f0;
  border-radius: 10px;
  padding: 10px;
}
.cotizacion-history-right-column {
  display: grid;
  gap: 8px;
}
.cotizacion-history-card-last-purchase,
.cotizacion-history-card-table {
  min-width: 0;
}
.cotizacion-cost-selector-strip {
  border: 1px solid #d9e5f0;
  border-radius: 10px;
  background: #f8fbff;
  padding: 9px 10px;
}
.cotizacion-cost-strip-label {
  font-size: 10px;
  font-weight: 800;
  color: #475569;
  margin-bottom: 6px;
}
.cotizacion-cost-mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.cotizacion-cost-mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.cotizacion-cost-mode-badge.is-auto {
  background: #dbeafe;
  color: #1d4ed8;
}
.cotizacion-cost-mode-badge.is-manual {
  background: #dcfce7;
  color: #166534;
}
.cotizacion-cost-mode-summary {
  font-size: 11px;
  color: #0f172a;
  font-weight: 700;
  flex: 1 1 220px;
}
.cotizacion-cost-actions {
  margin-top: 8px;
}
.cotizacion-cost-auto-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.cotizacion-cost-auto-btn:hover:not(:disabled) {
  background: #dbeafe;
}
.cotizacion-cost-auto-btn.is-active,
.cotizacion-cost-auto-btn:disabled {
  border-color: #dbe3ee;
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}
.cotizacion-history-table-wrap {
  overflow-x: auto;
}
.cotizacion-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.cotizacion-history-table th,
.cotizacion-history-table td {
  padding: 8px 10px;
  border-top: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
}
.cotizacion-history-table thead th {
  border-top: 0;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
}
.cotizacion-history-table tr.is-fallback td {
  background: #fff7f7;
}
.cotizacion-history-provider-name {
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
}
.cotizacion-history-provider-note {
  margin-top: 5px;
}
.cotizacion-history-table-price {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
}
.cotizacion-history-table-date {
  margin-top: 4px;
  font-size: 10px;
  color: #475569;
}
.cotizacion-history-table-badge-row {
  margin-top: 5px;
}
.cotizacion-history-inline-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}
.cotizacion-history-inline-badge-auto {
  background: #dcfce7;
  color: #166534;
}
.cotizacion-history-inline-badge-fallback {
  background: #fee2e2;
  color: #b91c1c;
}
.cotizacion-history-inline-badge-manual {
  background: #dbeafe;
  color: #1d4ed8;
}
.cotizacion-history-last-cell {
  padding: 0;
}
.cotizacion-history-last-button,
.cotizacion-history-last-static {
  display: block;
  width: 100%;
  min-height: 100%;
  padding: 8px 10px;
  text-align: left;
}
.cotizacion-history-last-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.cotizacion-history-last-button:hover:not(:disabled) {
  background: #eff6ff;
}
.cotizacion-history-last-button.is-selected {
  background: #eef7df;
}
.cotizacion-history-last-button:disabled {
  cursor: wait;
  opacity: 0.75;
}
.cotizacion-cost-ref-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.cotizacion-cost-ref-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid #d9e5f0;
  background: #f8fbff;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}
.cotizacion-cost-ref-btn:hover:not(:disabled) {
  border-color: #93c5fd;
  background: #eff6ff;
}
.cotizacion-cost-ref-btn.is-selected {
  border-color: #8cb811;
  background: #f5faea;
}
.cotizacion-cost-ref-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}
.cotizacion-cost-ref-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}
.cotizacion-cost-ref-price {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
}
.cotizacion-cost-ref-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 9px;
  font-weight: 800;
}
.cotizacion-cost-ref-badge.is-recent {
  background: #dcfce7;
  color: #166534;
}
.cotizacion-cost-ref-meta {
  font-size: 10px;
  color: #475569;
}
.cotizacion-cost-ref-action {
  font-size: 10px;
  font-weight: 800;
  color: #0f766e;
}
.cotizacion-history-title {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
}
.cotizacion-history-subtitle {
  margin-top: 2px;
  margin-bottom: 8px;
  font-size: 10px;
  color: #64748b;
}
.cotizacion-history-metric {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid #edf2f7;
}
.cotizacion-history-metric:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.cotizacion-history-metric-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 700;
}
.cotizacion-history-metric-value {
  font-size: 11px;
  color: #0f172a;
  font-weight: 700;
  text-align: right;
  max-width: 62%;
  overflow-wrap: anywhere;
}
.cotizacion-history-list-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: flex-start;
  padding: 7px 0;
  border-top: 1px solid #edf2f7;
}
.cotizacion-history-list-item:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.cotizacion-history-list-rank {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #e6f0f7;
  color: #005387;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cotizacion-history-list-top,
.cotizacion-history-list-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cotizacion-history-price {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
}
.cotizacion-history-list-meta {
  margin-top: 3px;
  font-size: 10px;
  color: #475569;
}
.cotizacion-history-empty {
  font-size: 11px;
  color: #64748b;
}
.cotizacion-history-footnote {
  margin-top: 8px;
  font-size: 10px;
  color: #64748b;
}
.cotizacion-history-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 10.5px;
  font-weight: 700;
}
.cotizacion-history-note.is-warning {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.cotizacion-table select.item-oferta {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  background: #f9fbfd;
  font-size: 11px;
  color: var(--ink);
  outline: none;
}
.cotizacion-table td.col-oferta select.item-oferta.match-no-hit,
.cotizacion-table td.col-oferta select.item-oferta.match-no-hit:focus {
  color: var(--danger);
  font-weight: 700;
}
.cotizacion-table select.item-oferta:focus {
  border-color: #005387;
  box-shadow: 0 0 0 3px rgba(0,83,135,0.12);
}
.item-oferta-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.item-oferta-wrap select {
  min-width: 0;
  flex: 1 1 auto;
}
.manual-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #7aa30d;
  background: #97c20f;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.manual-add-btn:hover:not(:disabled) {
  background: #7fab0c;
}
.manual-add-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.qty-extra-input {
  width: 74px;
  padding: 4px 6px;
  border: 1px solid #d7dee8;
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  text-align: right;
}
.qty-extra-input:focus {
  border-color: #005387;
  box-shadow: 0 0 0 3px rgba(0,83,135,0.12);
  outline: none;
}
.cotizacion-table tfoot tr td {
  padding: 8px 10px; border-top: 2px solid #e2e8f0; border-bottom: 0; background: #fefefe;
  font-size: 11.5px;
}
.cotizacion-table tfoot tr.total-neto td.num { font-size: 12px; }
.cotizacion-table tfoot tr.total-iva td.num { color: var(--ink-2); }
.cotizacion-table tfoot tr.total-final td { background: #005387; color: #fff; border-top: 2px solid #00426a; }
.cotizacion-table tfoot tr.total-final td.num strong { color: #fff; }
.cotizacion-table tfoot tr.total-final td:not(.num) { color: #fff; }

.picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}
.picker-modal.hidden {
  display: none;
}
.picker-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
}
.picker-modal-dialog {
  position: relative;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.picker-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.picker-modal-head h3 {
  margin: 0 0 4px;
  color: #0d5788;
}
.picker-target-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.picker-target-label {
  font-size: 12px;
  font-weight: 800;
  color: #475569;
}
.picker-results {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  min-height: 220px;
}
.picker-result-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #dbe3ee;
  background: #fff;
  padding: 12px 14px;
  text-align: left;
  display: grid;
  grid-template-columns: 118px minmax(220px, 1.2fr) minmax(220px, 1fr);
  gap: 12px;
  cursor: pointer;
}
.picker-result-row:hover {
  background: #eff6ff;
}
.picker-result-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #0d5788;
}
.picker-result-ricardo,
.picker-result-vc {
  font-size: 12.5px;
  color: var(--ink);
}
.transport-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.transport-pill {
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  min-width: 150px;
}
.transport-pill-label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  margin-bottom: 2px;
}
.transport-pill-value {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}
.picker-result-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.25px;
  color: var(--ink-2);
  margin-bottom: 2px;
}

@media (max-width: 1280px) {
  .intake-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .batch-preview-grid,
  .batch-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cotizacion-detail-grid,
  .cotizacion-history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .navbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
  }
  .nav-links {
    order: 3;
    width: 100%;
    margin: 0;
  }
  .nav-user {
    margin-left: auto;
  }
  .section-head h2 {
    font-size: 26px;
  }
  .section-head-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .section-head-action {
    align-self: auto;
    margin-bottom: 0;
  }
  .section-head-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }
  .section-head-actions > .section-head-action {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    text-align: center;
  }
  .intake-form-row {
    align-items: stretch;
    min-height: 0;
  }
  .batch-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .batch-stage,
  .batch-stage-track {
    overflow: visible;
  }
  .upload-form-slot,
  .upload-form-slot form {
    width: 100%;
  }
  .btn-primary-action,
  .btn-secundario,
  .intake-input,
  .batch-textarea {
    width: 100%;
    min-width: 0;
  }
  .batch-card-head,
  .batch-actions-row {
    flex-direction: column;
    align-items: stretch;
  }
  .mp-intake-form-row {
    display: grid;
    gap: 10px;
  }
  .upload-inline-form .btn-primary-action,
  .mp-intake-form-row .intake-input,
  .mp-intake-form-row .btn-primary-action {
    max-width: none;
    min-width: 0;
  }
  .import-modal-dialog {
    padding: 24px 18px 18px;
  }
  .import-modal-title {
    font-size: 20px;
  }
  .costeo-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .cotizacion-toolbar-head {
    align-items: stretch;
  }
  .cotizacion-detail-grid,
  .cotizacion-history-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .picker-result-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .section-head-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .section-head-actions > .section-head-action {
    flex: 1 1 auto;
    width: 100%;
  }
}
