:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --field: #f8fafc;
  --tx: #17202a;
  --mut: #667085;
  --bd: #e2e8f0;
  --ac: #1d4ed8;
  --ac-strong: #173ea8;
  --ac-soft: #e8efff;
  --ok: #0f7b4a;
  --ok-bg: #e8f7ef;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --info: #0b5cad;
  --info-bg: #e8f2ff;
  --track: #e9edf3;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a;
    --card: #171e26;
    --field: #111820;
    --tx: #e8edf3;
    --mut: #98a2b3;
    --bd: #29323d;
    --ac: #7aa2ff;
    --ac-strong: #9bb9ff;
    --ac-soft: #1a2942;
    --ok: #5fd68a;
    --ok-bg: #12301d;
    --warn: #f5b45a;
    --warn-bg: #35260f;
    --bad: #ff8a80;
    --bad-bg: #3a1816;
    --info: #84b8ff;
    --info-bg: #12263f;
    --track: #26313d;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font: 15px/1.5 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.011em;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 24px 10px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e2e8f0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
}

.topbar-container {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  cursor: pointer;
}

.brand-emblem {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #071b30 0%, #0284c7 100%) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.brand:hover .brand-emblem {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5);
}

.brand-text {
  display: flex;
  align-items: center;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 800;
  color: #0a2540;
  letter-spacing: -0.01em;
  line-height: 1;
}

.brand-accent {
  color: #0284c7;
  font-weight: 900;
}

.brand-flag {
  font-size: 9.5px;
  background: #f0fdf4;
  color: #166534;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid #bbf7d0;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* Navegación y Cápsula Unificada */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 4px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.pill-plan-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
  transition: opacity 0.15s ease;
}

.pill-plan-btn:hover {
  opacity: 0.85;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #16a34a;
  border-radius: 50%;
  box-shadow: 0 0 4px #16a34a;
}

.pill-divider {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 300;
}

.pill-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.pill-user-email {
  color: #64748b;
  font-size: 11.5px;
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.topbar-btn-back {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

.topbar-btn-back:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.topbar-btn-help {
  background: #f8fafc;
  color: #475569;
  border-color: #e2e8f0;
}

.topbar-btn-help:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

/* Breadcrumb estándar alineado */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--mut);
  margin-bottom: 16px;
  padding: 0 4px;
}

.breadcrumb a {
  color: var(--ac);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--mut);
  opacity: 0.5;
}

.breadcrumb-current {
  color: var(--tx);
  font-weight: 600;
}

.app {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 120px;
}

/* ============================================================
   SaaS FINANCIERO: HERO ULTRA-PREMIUM (ESTILO SUISSO MINIMALISTA)
   ============================================================ */

.saas-hero {
  position: relative;
  overflow: hidden;
  padding: 32px 32px 26px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: #0f172a;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.03);
  margin-bottom: 24px;
}

.saas-hero-mesh {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(#e2e8f0 1px, transparent 1px),
    radial-gradient(#f1f5f9 1px, transparent 1px);
  background-size: 24px 24px, 12px 12px;
  background-position: 0 0, 12px 12px;
  opacity: 0.8;
  pointer-events: none;
}

.saas-hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 36px;
  align-items: center;
}

/* Columna Izquierda: Mensaje y Caso Rápido */
.saas-hero-content {
  display: flex;
  flex-direction: column;
}

.saas-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 4px 11px;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 14px;
}

.saas-tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0284c7;
  box-shadow: 0 0 6px #38bdf8;
}

.saas-title {
  margin: 0 0 12px;
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: #0a2540;
}

.saas-description {
  margin: 0 0 24px;
  max-width: 54ch;
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
}

/* Barra Rápida de Ejemplos */
.saas-quick-case {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 6px 8px 6px 14px;
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.saas-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #64748b;
  white-space: nowrap;
}

.saas-select-wrap {
  position: relative;
  flex: 1;
}

.saas-select {
  appearance: none;
  -webkit-appearance: none;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 28px 7px 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: all 0.15s ease;
}

.saas-select:hover,
.saas-select:focus {
  border-color: #0284c7;
  background-color: #ffffff;
}

.saas-select option {
  background: #ffffff;
  color: #0f172a;
  padding: 8px;
}

.saas-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0284c7;
  color: #ffffff;
  border: 1px solid #0284c7;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25);
  transition: all 0.15s ease;
}

.saas-btn-primary:hover {
  background: #0369a1;
  border-color: #0369a1;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
}

/* Columna Derecha: Tarjetas Selectoras de Modalidad */
.saas-hero-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saas-mode-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.saas-card-option {
  position: relative;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.saas-card-option:hover:not(.active) {
  border-color: #94a3b8;
  background: #f8fafc;
  transform: translateY(-1px);
}

.saas-card-option.active {
  background: #ffffff;
  color: #0f172a;
  border: 2px solid #0284c7;
  box-shadow: 0 4px 14px -2px rgba(2, 132, 199, 0.15);
}

.saas-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.saas-card-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.saas-card-option.active .saas-card-icon-box {
  background: #e0f2fe;
  color: #0284c7;
}

.saas-card-title-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.saas-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.saas-card-option.active .saas-card-title {
  color: #0a2540;
}

.saas-card-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-free {
  background: #f1f5f9;
  color: #475569;
}

.saas-card-option.active .badge-free {
  background: #0a2540;
  color: #ffffff;
}

.badge-official {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.saas-card-option.active .badge-official {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.saas-card-text {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #64748b;
  padding-left: 42px;
}

.saas-card-option.active .saas-card-text {
  color: #475569;
}

.saas-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 42px;
  font-size: 11.5px;
  font-weight: 700;
}

.saas-card-action {
  color: #64748b;
  letter-spacing: 0.02em;
}

.saas-card-option.active .saas-card-action {
  color: #0284c7;
  font-weight: 800;
}

.saas-radio-indicator {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: inline-block;
  position: relative;
  transition: all 0.2s ease;
}

.saas-card-option.active .saas-radio-indicator {
  border-color: #0284c7;
  background: #0284c7;
  box-shadow: inset 0 0 0 2.5px #ffffff;
}

/* Herramientas Auxiliares Inferiores */
.saas-hero-aux {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
}

.saas-aux-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  background: #ffffff;
  color: #475569;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.saas-aux-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.saas-aux-btn.danger-hover:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
}

.saas-aux-btn.token-btn {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.saas-aux-btn.token-btn:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
}

/* Banner de Créditos */
.credit-status-notice {
  background: rgba(240, 253, 244, 0.95);
  border: 1px solid #86efac;
  color: #166534;
  border-radius: 12px;
  padding: 12px 18px;
  margin-top: 18px;
  position: relative;
  z-index: 2;
}

.credit-status-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-size: 13.5px;
}

.card {
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  margin-bottom: 14px;
  overflow: hidden;
}

.card > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.card > summary::-webkit-details-marker {
  display: none;
}

.card > summary::after {
  content: "";
  width: 9px;
  height: 9px;
  margin-left: auto;
  border-right: 2px solid var(--mut);
  border-bottom: 2px solid var(--mut);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex: 0 0 auto;
}

.card[open] > summary::after {
  transform: rotate(-135deg);
}

.card[open] > summary {
  border-bottom: 1px solid var(--bd);
}

.step {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--ac-soft);
  color: var(--ac);
  font-weight: 800;
  font-size: 13px;
  flex: 0 0 auto;
}

.card > summary strong {
  display: block;
  font-size: 15px;
}

.card > summary small {
  display: block;
  color: var(--mut);
  font-size: 12px;
  margin-top: 1px;
}

.card-body {
  padding: 24px;
}

/* Grilla Simétrica de 12 Columnas para Formularios Financieros */
.form-grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px 14px;
  align-items: start;
}

.form-col-12 { grid-column: span 12; }
.form-col-8 { grid-column: span 8; }
.form-col-6 { grid-column: span 6; }
.form-col-5 { grid-column: span 5; }
.form-col-4 { grid-column: span 4; }
.form-col-3 { grid-column: span 3; }
.form-col-2 { grid-column: span 2; }

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

.span-2 {
  grid-column: span 2;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--mut);
  font-size: 13px;
  font-weight: 500;
}

.field > span,
.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
  margin-bottom: 6px;
  color: var(--tx);
  font-size: 13px;
  font-weight: 600;
}

.field-label span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field input,
.field select,
.field textarea,
.doc input[type="file"] {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--bd);
  border-radius: 9px;
  background: var(--card);
  color: var(--tx);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.field textarea {
  height: auto;
  min-height: 82px;
  padding: 10px 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.doc input[type="file"]:focus {
  border-color: var(--ac);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
  background: #ffffff;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

/* Grupo Unificado de RUT + Botón SII */
.rut-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.rut-input-group input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
}

.rut-sii-btn {
  height: 42px;
  padding: 0 14px;
  border-radius: 9px;
  background: var(--ac-soft);
  color: var(--ac);
  border: 1px solid color-mix(in srgb, var(--ac) 28%, transparent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.rut-sii-btn:hover {
  background: var(--ac);
  color: #ffffff;
  border-color: var(--ac);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.money-hint {
  color: #0284c7;
  font-size: 11.5px;
  font-weight: 700;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.money-hint:empty {
  display: none;
}

/* Tarjetas de Mitigantes y Garantías */
.mitigant-container {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--bd);
}

.mitigant-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--tx);
  margin-bottom: 10px;
}

.mitigant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.mitigant-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--field);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mitigant-card:hover {
  border-color: #93c5fd;
  background: #f8fafc;
  transform: translateY(-1px);
}

.mitigant-card input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--ac);
  cursor: pointer;
  flex-shrink: 0;
}

.mitigant-info strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--tx);
  line-height: 1.25;
}

.mitigant-info small {
  display: block;
  font-size: 11px;
  color: var(--mut);
  margin-top: 2px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--field);
  color: var(--tx);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  cursor: pointer;
}

.check input {
  margin: 2px 0 0;
  accent-color: var(--ac);
  flex: 0 0 auto;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.doc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--bd);
  border-radius: 12px;
  background: var(--field);
}

.doc-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--tx);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}

.doc-head input {
  margin: 2px 0 0;
  accent-color: var(--ac);
  flex: 0 0 auto;
}

.doc input[type="file"] {
  padding: 8px;
  font-size: 12px;
  background: var(--card);
}

.doc input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: var(--ac-soft);
  color: var(--ac);
  font-weight: 600;
  cursor: pointer;
}

.file-label {
  color: var(--mut);
  font-size: 11px;
  min-height: 16px;
  overflow-wrap: anywhere;
}

.section-note {
  margin: 12px 0 0;
  color: var(--mut);
  font-size: 12px;
}

.inline-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--ac-soft);
  color: var(--tx);
  font-size: 12px;
  margin-bottom: 14px;
}

.live-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.live-metric {
  padding: 10px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--card);
}

.live-metric small {
  display: block;
  color: var(--mut);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-metric b {
  display: block;
  margin-top: 3px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.actions {
  position: sticky;
  bottom: 0;
  z-index: 15;
  display: flex;
  gap: 10px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg) 72%, transparent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn.primary {
  flex: 1;
  background: var(--ac);
  color: #fff;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.28);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--ac) 28%, transparent);
}

.btn.primary:hover {
  background: var(--ac-strong);
}

.btn.ghost {
  background: var(--card);
  color: var(--tx);
  border-color: var(--bd);
}

.btn.ghost:hover {
  border-color: var(--ac);
}

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

.hidden {
  display: none !important;
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--bd);
  border-radius: 11px;
  background: var(--info-bg);
  color: var(--tx);
  font-size: 12px;
  margin-bottom: 14px;
}

.results {
  margin-top: 18px;
  scroll-margin-top: 78px;
}

.table-wrap.compact table {
  min-width: 0;
}

.result-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--bd);
  border-radius: 20px;
  padding: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.result-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--tone, var(--ac));
}

.result-hero.tone-ok {
  --tone: var(--ok);
  --tone-bg: var(--ok-bg);
}

.result-hero.tone-warn {
  --tone: var(--warn);
  --tone-bg: var(--warn-bg);
}

.result-hero.tone-bad {
  --tone: var(--bad);
  --tone-bg: var(--bad-bg);
}

.result-hero.tone-info {
  --tone: var(--info);
  --tone-bg: var(--info-bg);
}

.score-layout {
  display: flex;
  align-items: center;
  gap: 20px;
}

.gauge {
  --p: calc(var(--score, 0) * 1%);
  position: relative;
  display: grid;
  place-items: center;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: conic-gradient(var(--tone, var(--ac)) var(--p), var(--track) 0);
  flex: 0 0 auto;
}

.gauge::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--card);
}

.gauge-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  line-height: 1;
}

.gauge-inner strong {
  display: block;
  font-size: 34px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.gauge-inner small {
  display: block;
  margin-top: 4px;
  color: var(--mut);
  font-size: 11px;
  font-weight: 600;
}

.result-copy {
  min-width: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--tone-bg, var(--ac-soft));
  color: var(--tone, var(--ac));
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-copy h2 {
  margin: 9px 0 2px;
  font-size: clamp(20px, 4.4vw, 28px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.result-copy .company {
  color: var(--mut);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.result-copy .decision {
  margin: 10px 0 0;
  font-size: 13px;
}

.result-section {
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  background: var(--card);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  scroll-margin-top: 78px;
}

.result-section > h2 {
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.result-section > h2 + p {
  margin-top: -6px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.metric {
  padding: 12px;
  border: 1px solid var(--bd);
  border-radius: 12px;
  background: var(--field);
}

.metric small {
  display: block;
  color: var(--mut);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metric b {
  display: block;
  margin-top: 5px;
  font-size: 20px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.metric span {
  display: block;
  margin-top: 4px;
  color: var(--mut);
  font-size: 11px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--bd);
  border-radius: 12px;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 11px;
  text-align: left;
  border-bottom: 1px solid var(--bd);
  vertical-align: top;
}

th {
  color: var(--mut);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--field);
}

tr:last-child td {
  border-bottom: 0;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tr.total td {
  font-weight: 800;
  background: var(--ac-soft);
}

.formula {
  display: block;
  margin-top: 3px;
  color: var(--mut);
  font-size: 11px;
  font-weight: 400;
}

.dimension {
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 13px;
  background: var(--field);
  margin-bottom: 10px;
}

.dimension:last-child {
  margin-bottom: 0;
}

.dim-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dim-head strong {
  display: block;
  font-size: 13px;
}

.dim-head small {
  display: block;
  margin-top: 2px;
  color: var(--mut);
  font-size: 11px;
}

.score-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--bd);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.bar {
  height: 7px;
  margin: 10px 0;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--tone, var(--ac));
}

.indicator-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.indicator-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: baseline;
  padding: 6px 0;
  border-top: 1px dashed var(--bd);
  font-size: 12px;
}

.indicator-list li:first-child {
  border-top: 0;
}

.indicator-list .name {
  color: var(--tx);
  min-width: 0;
}

.indicator-list .value {
  color: var(--mut);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.indicator-list .pts {
  min-width: 32px;
  color: var(--ac);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.indicator-list .underperform {
  color: var(--bad);
}

.issues {
  display: grid;
  gap: 8px;
}

.issue-group h3 {
  margin: 0 0 7px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.issue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.issue-list li {
  padding: 9px 11px;
  border-left: 3px solid var(--tone, var(--mut));
  border-radius: 8px;
  background: var(--tone-bg, var(--field));
  font-size: 12px;
  line-height: 1.4;
}

.issue-list.hard {
  --tone: var(--bad);
  --tone-bg: var(--bad-bg);
}

.issue-list.pending {
  --tone: var(--warn);
  --tone-bg: var(--warn-bg);
}

.issue-list.warning {
  --tone: var(--warn);
  --tone-bg: var(--warn-bg);
}

.issue-list.info {
  --tone: var(--info);
  --tone-bg: var(--info-bg);
}

.issue-list.ok {
  --tone: var(--ok);
  --tone-bg: var(--ok-bg);
}

.legal {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--field);
  border: 1px solid var(--bd);
  color: var(--mut);
  font-size: 12px;
  line-height: 1.55;
}

.conditions {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.conditions li {
  padding-left: 18px;
  position: relative;
  color: var(--tx);
  font-size: 12px;
}

.conditions li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--ac);
  font-weight: 800;
}

.muted {
  color: var(--mut);
}

.small {
  font-size: 12px;
}

.report-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px 32px;
  color: var(--mut);
  font-size: 11px;
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: end center;
  background: rgba(10, 15, 25, 0.55);
  padding: 18px;
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none !important;
}

.modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-card h3 {
  margin: 18px 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mut);
}

.modal-card p,
.modal-card li {
  font-size: 13px;
  line-height: 1.55;
}

.modal-card ul {
  margin: 6px 0;
  padding-left: 20px;
}

.modal-card table {
  min-width: 100%;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  z-index: 60;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--tx);
  color: var(--bg);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 620px) {
  .app {
    padding-left: 14px;
    padding-right: 14px;
  }

  .grid,
  .span-2,
  .check-grid,
  .doc-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .score-layout {
    align-items: flex-start;
    gap: 14px;
  }

  .gauge {
    width: 104px;
    height: 104px;
  }

  .gauge-inner strong {
    font-size: 28px;
  }

  .hero,
  .card > summary,
  .card-body,
  .result-hero,
  .result-section {
    padding: 16px 14px;
  }

  .metric b {
    font-size: 18px;
  }

  .topbar-container {
    flex-wrap: wrap;
    gap: 8px;
  }

  .brand small {
    display: none;
  }

  .actions {
    gap: 8px;
  }

  .btn {
    padding: 12px 14px;
  }

  .btn.ghost {
    flex: 0 0 auto;
  }
}

@media (min-width: 900px) {
  .app {
    padding-top: 28px;
  }

  .actions {
    position: static;
    background: none;
    padding: 4px 0 0;
  }

  .actions .btn.primary {
    flex: 0 0 auto;
    min-width: 220px;
  }
}

@media print {
  :root {
    --bg: #fff;
    --card: #fff;
    --field: #fff;
    --tx: #111;
    --mut: #444;
    --bd: #ccc;
    --shadow: none;
    color-scheme: light;
  }

  body {
    background: #fff;
    color: #111;
    font-size: 11px;
  }

  .topbar,
  .hero,
  #creditForm,
  .actions,
  .footer,
  .modal,
  .toast,
  .notice,
  .report-footer .btn,
  #btnHelp {
    display: none !important;
  }

  .stale-notice {
    display: block !important;
  }

  .stale-notice .btn {
    display: none !important;
  }

  .app {
    max-width: none;
    padding: 0;
  }

  .results {
    display: block !important;
    margin: 0;
  }

  #results:empty {
    display: none !important;
  }

  .result-hero,
  .result-section {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 10px;
    border-color: #bbb;
  }

  .result-hero {
    padding: 14px;
  }

  .gauge {
    width: 92px;
    height: 92px;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .gauge::after {
    inset: 7px;
  }

  .gauge-inner strong {
    font-size: 24px;
  }

  .metric,
  .dimension,
  .issue-list li {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
  }

  .btn {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Barra de estado y progreso activa */
.task-progress-box {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  transition: all 0.3s ease;
}

.task-progress-box.hidden {
  display: none !important;
}

.task-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 6px;
}

.task-progress-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ac);
}

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--ac-soft);
  border-top-color: var(--ac);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.task-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}

.task-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ac), #3b82f6);
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Lista interactiva de Representantes Legales */
.rep-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.rep-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--field);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 4px 6px 4px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rep-row:focus-within {
  border-color: var(--ac);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ac) 15%, transparent);
}

.rep-index-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--mut);
  min-width: 20px;
  user-select: none;
}

.rep-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 8px 4px !important;
  font-size: 14px !important;
  font-family: inherit;
  color: var(--tx) !important;
  outline: none !important;
  box-shadow: none !important;
}

.rep-input::placeholder {
  color: color-mix(in srgb, var(--mut) 60%, transparent);
}

.btn-rep-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #ef4444;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  flex: 0 0 auto;
}

.btn-rep-del:hover {
  background: rgba(239, 68, 68, 0.12);
  transform: scale(1.05);
}

.btn-rep-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--ac) 40%, var(--bd));
  background: var(--ac-soft);
  color: var(--ac);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-rep-add:hover {
  background: var(--ac);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px -1px rgba(37, 99, 235, 0.35);
}


/* Menú Hamburguesa & Drawer Móvil para Evaluador App */
.topbar-menu-toggle {
  display: none;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
  padding: 6px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.topbar-menu-toggle:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.topbar-mobile-drawer {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 14px 16px;
  animation: drawerSlide 0.18s ease-out;
  z-index: 40;
}

.topbar-mobile-drawer.open {
  display: block;
}

@keyframes drawerSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.drawer-user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 12px;
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.drawer-link:hover {
  background: #f1f5f9;
  color: #0284c7;
}

/* Responsividad para Topbar, Hero SaaS y Form-Grid-12 */
@media (max-width: 900px) {
  .saas-hero-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .saas-hero {
    padding: 28px 24px 22px;
  }
  .saas-quick-case {
    width: 100%;
  }

  .form-grid-12 {
    grid-template-columns: repeat(6, 1fr);
  }
  .form-col-6 { grid-column: span 6; }
  .form-col-5 { grid-column: span 6; }
  .form-col-4 { grid-column: span 3; }
  .form-col-3 { grid-column: span 3; }
  .form-col-2 { grid-column: span 2; }
}

@media (max-width: 600px) {
  .topbar {
    padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px;
  }
  .topbar-container {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .brand-emblem {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }
  .brand-title {
    font-size: 14.5px;
  }
  .brand-flag {
    display: none;
  }
  .topbar-nav {
    width: auto;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
  }
  .user-status-pill {
    min-width: 0;
    max-width: 145px;
    padding: 3px 8px;
    font-size: 11px;
    gap: 5px;
  }
  .pill-plan-btn {
    font-size: 11px;
    padding: 0;
  }
  .pill-user-email,
  .pill-divider,
  #userTypeBadge {
    display: none !important;
  }
  #creditsTopText {
    display: inline-block;
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-actions {
    margin-left: 0;
    gap: 4px;
  }
  .topbar-btn {
    padding: 5px 9px;
    font-size: 11.5px;
  }
  .topbar-btn-back span {
    display: none;
  }
  .topbar-btn-back {
    padding: 6px 8px;
  }
  .topbar-menu-toggle {
    display: inline-flex !important;
  }
  .topbar-actions #btnHelp {
    display: none !important;
  }
  .saas-hero {
    padding: 22px 18px 18px;
    border-radius: 16px;
  }
  .saas-quick-case {
    flex-direction: column;
    align-items: stretch;
  }
  .saas-select-wrap,
  .saas-select {
    width: 100%;
  }
  .saas-hero-aux {
    justify-content: space-between;
  }

  .form-grid-12 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .form-col-12,
  .form-col-8,
  .form-col-6,
  .form-col-5,
  .form-col-4,
  .form-col-3,
  .form-col-2 {
    grid-column: span 1;
  }
}




/* ============================================================
   REFINAMIENTOS UI/UX APP FINANCIERA (NO AI LOOK)
   ============================================================ */

/* Inputs y Selects de calidad institucional */
input[type="text"],
input[type="number"],
input[type="email"],
select {
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18) !important;
}

/* Indicadores numéricos y de moneda con font-mono */
.mono-amount, .saas-hero-selector .saas-card-badge, .kpi-val, .score-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Botones principales de la aplicación */
.btn.primary, .saas-btn-primary {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn.primary:hover, .saas-btn-primary:hover {
  transform: translateY(-1px);
}

/* Tarjetas y pasos con transiciones refinadas */
details.card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

details.card[open] {
  border-color: #cbd5e1;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06);
}

/* ============ Asistente WhatsApp flotante ============ */
.wa-assistant-app {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: inherit;
}

.wa-chat-box-app {
  position: absolute;
  bottom: 60px;
  right: 0;
  width: min(320px, calc(100vw - 28px));
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 18px 36px -8px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  flex-direction: column;
}

.wa-chat-header {
  background: linear-gradient(135deg, #075e54, #128c7e);
  color: #ffffff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-chat-avatar-wrap {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.wa-avatar-online {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  border: 2px solid #075e54;
}

.wa-app-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 9px 15px 9px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px -4px rgba(22, 101, 52, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wa-app-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -4px rgba(22, 101, 52, 0.5);
}

@media (max-width: 899px) {
  /* Flota limpiamente ARRIBA de la barra sticky de evaluacin (bottom: 78px)
     y se transforma en un botn circular discreto (44px) sin texto, evitando sobreposicin */
  .wa-assistant-app {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    right: 14px !important;
    z-index: 25 !important;
  }
  .wa-app-toggle-btn {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
  }
  .wa-app-btn-text {
    display: none !important;
  }
  .wa-chat-box-app {
    bottom: 54px !important;
    right: 0 !important;
    width: calc(100vw - 28px) !important;
    max-width: 320px !important;
  }
}

/* Panel: principales variaciones EEFF (anio base -> anio actual) */

/* Banner aviso de variaciones EEFF */
.var-prompt-banner {
  margin-top: 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.var-prompt-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.var-prompt-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.var-prompt-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #166534;
}
.var-prompt-sub {
  font-size: 11.5px;
  color: #15803d;
  margin-top: 2px;
}
.var-prompt-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.var-prompt-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.var-prompt-btn.primary {
  background: #16a34a;
  color: #ffffff;
}
.var-prompt-btn.primary:hover {
  background: #15803d;
}
.var-prompt-btn.ghost {
  background: transparent;
  color: #4b5563;
  border-color: #d1d5db;
}
.var-prompt-btn.ghost:hover {
  background: #f3f4f6;
  color: #111827;
}
@media (max-width: 600px) {
  .var-prompt-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .var-prompt-actions {
    justify-content: flex-end;
  }
}

.var-panel {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.var-panel.hidden { display: none; }
.var-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 10px;
  font-size: 13.5px;
  color: var(--tx);
}
.var-periods { font-size: 12px; color: var(--mut); }
.var-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(140px, 1fr) minmax(130px, auto) minmax(180px, 1.6fr);
  gap: 6px 14px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--bd);
}
.var-glosa { font-size: 12.5px; font-weight: 600; color: var(--tx); }
.var-amount { font-size: 13.5px; font-weight: 700; color: var(--tx); white-space: nowrap; }
.var-base { display: block; font-size: 11px; font-weight: 500; color: var(--mut); }
.var-chip {
  justify-self: start;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  white-space: normal;
  max-width: 100%;
}
.var-chip.var-up { color: var(--ok); background: var(--ok-bg); }
.var-chip.var-down { color: var(--bad); background: var(--bad-bg); }
.var-note { font-size: 12px; color: var(--mut); line-height: 1.45; }
.var-row.var-immaterial .var-chip { opacity: 0.75; }
.var-row.var-immaterial .var-note { font-style: italic; }
@media (max-width: 900px) {
  .var-row {
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    padding: 10px 0;
  }
  .var-glosa { grid-column: 1; }
  .var-chip { grid-column: 2; grid-row: 1; justify-self: end; }
  .var-amount { grid-column: 1; }
  .var-note { grid-column: 1 / -1; }
}

.var-hint {
  font-size: 11.5px;
  color: var(--mut);
  font-style: italic;
  margin-bottom: 6px;
  line-height: 1.4;
}
