:root {
  --ink: #17233a;
  --muted: #5e6d84;
  --line: #d9e2f0;
  --soft: #f3f6fb;
  --paper: #ffffff;
  --brand: #1a4ca5;
  --brand-dark: #0e2f6c;
  --brand-bright: #0866ff;
  --brand-soft: #eaf1ff;
  --amber: #c87512;
  --amber-soft: #fff3df;
  --red: #b33a45;
  --red-soft: #fdecef;
  --shadow: 0 18px 55px rgba(17, 47, 100, 0.1);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #eef3fa;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: linear-gradient(145deg, #f9fbfe 0%, #eef3fa 58%, #e8eff8 100%); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.topbar {
  min-height: 78px;
  padding: 14px clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--brand-dark);
  color: #fff;
  border-bottom: 3px solid var(--brand-bright);
}

.brand { display: flex; align-items: center; }
.eyebrow, .section-kicker { margin: 0 0 3px; font-size: 10px; line-height: 1.2; letter-spacing: .18em; font-weight: 800; }
.brand .eyebrow { color: #8eb8ff; }
.brand h1 { margin: 0; font-size: clamp(17px, 2vw, 22px); line-height: 1.15; font-weight: 650; letter-spacing: -.02em; }
.topbar-meta { display: flex; gap: 9px; align-items: center; }
.topbar-link {
  padding: 8px 12px; color: #dce8ff; border: 1px solid rgba(255,255,255,.2);
  border-radius: 9px; text-decoration: none; font-size: 11px; font-weight: 750;
}
.topbar-link:hover { color: #fff; border-color: rgba(255,255,255,.38); }
/* El boton de salir usa el mismo estilo que los enlaces; sin esto hereda el fondo
   claro por defecto del navegador y su texto queda ilegible sobre la barra oscura. */
.session-signout { background: transparent; cursor: pointer; font-weight: 750; }
.session-pill {
  display: inline-flex; align-items: center; padding: 7px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; color: #fff;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
}
.status-pill, .version-pill, .mini-badge {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 999px;
  padding: 7px 11px; font-size: 11px; line-height: 1; font-weight: 800; letter-spacing: .04em;
}
.status-test { color: #775216; background: #ffeab8; border: 1px solid #f3cf77; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #d78b13; box-shadow: 0 0 0 3px rgba(215,139,19,.16); }
.version-pill { color: #d7e5ff; border: 1px solid rgba(255,255,255,.2); }

.warning-banner {
  padding: 9px clamp(20px, 4vw, 64px); text-align: center; font-size: 12px;
  color: #664511; background: #fff5df; border-bottom: 1px solid #edd9aa;
}

.workspace {
  width: min(1500px, calc(100% - 36px)); margin: 28px auto;
  display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(390px, .82fr); gap: 24px; align-items: start;
}
.input-panel, .result-panel { background: var(--paper); border: 1px solid rgba(26,76,165,.12); border-radius: 20px; box-shadow: var(--shadow); }
.input-panel { overflow: hidden; }
.result-panel { position: sticky; top: 20px; min-height: 720px; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding: 28px 30px 22px; }
.section-kicker { color: var(--brand); }
.panel-heading h2, .result-empty h2, .result-error h2, .result-loading h2 { margin: 3px 0 6px; font-size: 24px; letter-spacing: -.035em; }
.panel-heading p:not(.section-kicker), .section-title-row p, .result-empty > p, .result-loading p, .result-error p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.button { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 750; font-size: 13px; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; transform: none; }
.button-secondary { color: var(--brand-dark); background: var(--brand-soft); border: 1px solid #c5d7f7; }
.button-ghost { color: var(--muted); background: #fff; border: 1px solid var(--line); }
.button-primary { color: #fff; background: var(--brand); box-shadow: 0 8px 18px rgba(26,76,165,.24); }
.button-evaluate { min-width: 190px; display: flex; justify-content: space-between; align-items: center; color: #fff; background: var(--brand-bright); box-shadow: 0 8px 20px rgba(8,102,255,.26); }
.full-width { width: 100%; }

.stepper { display: flex; align-items: flex-start; padding: 18px 30px; background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.step { flex: 0 0 auto; display: grid; justify-items: center; gap: 6px; min-width: 72px; padding: 0; color: #8a948f; background: transparent; border: 0; }
.step span { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #c9d0cc; border-radius: 50%; background: #fff; font-size: 11px; font-weight: 800; }
.step b { font-size: 10px; font-weight: 700; }
.step.active, .step.completed { color: var(--brand); }
.step.active span { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px rgba(8,102,255,.12); }
.step.completed span { color: var(--brand); border-color: #9cbbed; background: var(--brand-soft); }
.step-line { flex: 1 1 auto; height: 1px; margin: 14px 4px 0; background: #ccd3cf; }

.form-step { display: none; padding: 30px; min-height: 490px; animation: appear .2s ease; }
.form-step.active { display: block; }
@keyframes appear { from { opacity: .3; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.section-title-row { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 25px; }
.section-number { flex: 0 0 auto; width: 35px; height: 35px; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); border-radius: 9px; font-size: 11px; font-weight: 900; }
.section-title-row h3 { margin: 0 0 3px; font-size: 17px; letter-spacing: -.02em; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 20px; }
.field { display: grid; align-content: start; gap: 7px; min-width: 0; }
.field > span:first-child { font-size: 11px; font-weight: 800; color: #47534d; }
.field small { font-size: 10px; line-height: 1.4; color: #7a847f; }
.span-2 { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 10px 12px; color: var(--ink); background: #fff;
  border: 1px solid #d5dcd8; border-radius: 9px; outline: none; transition: border .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #4f83de; box-shadow: 0 0 0 3px rgba(8,102,255,.13); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(173,56,56,.08); }
.money-input, .suffix-input { display: flex; align-items: center; border: 1px solid #d5dcd8; border-radius: 9px; background: #fff; overflow: hidden; }
.money-input:focus-within, .suffix-input:focus-within { border-color: #4f83de; box-shadow: 0 0 0 3px rgba(8,102,255,.13); }
.money-input span, .suffix-input span { padding: 0 0 0 12px; color: #7b8580; font-size: 12px; }
.suffix-input span { padding: 0 12px 0 0; white-space: nowrap; }
.money-input input, .suffix-input input { border: 0; box-shadow: none; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px; }
.check-card { display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfa; cursor: pointer; }
.check-card input { width: 17px; min-height: 17px; accent-color: var(--brand); }
.check-card span { display: grid; gap: 2px; }
.check-card b { font-size: 11px; }
.check-card small { color: var(--muted); font-size: 10px; }
.inline-notice { display: flex; gap: 10px; align-items: center; margin: -6px 0 20px; padding: 10px 12px; border-radius: 9px; color: #72501b; background: var(--amber-soft); border: 1px solid #efd6a8; font-size: 11px; }
.subsection-title { margin: 26px 0 15px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #58645e; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 26px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--line); }
.summary-strip div { display: grid; gap: 5px; padding: 15px; background: #f8faf8; }
.summary-strip span { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.summary-strip strong { font-size: 14px; }
.form-actions { display: flex; align-items: center; gap: 10px; min-height: 72px; padding: 14px 30px; border-top: 1px solid var(--line); background: #fbfcfb; }
.form-spacer { flex: 1; }

.result-empty, .result-loading, .result-error { min-height: 720px; padding: 70px 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.result-empty > p { max-width: 390px; }
.empty-visual { position: relative; width: 130px; height: 130px; display: grid; place-items: center; margin-bottom: 28px; }
.empty-visual .ring { position: absolute; border-radius: 50%; border: 1px solid; }
.ring-outer { inset: 0; border-color: #bfd1f1 !important; background: radial-gradient(circle, rgba(234,241,255,.72), transparent 67%); }
.ring-inner { inset: 24px; border-color: #8fb1eb !important; }
.empty-visual > span { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--brand); font-size: 23px; font-weight: 850; box-shadow: 0 10px 28px rgba(26,76,165,.25); }
.empty-list { display: flex; gap: 18px; margin: 28px 0 0; padding: 0; list-style: none; color: #68736e; font-size: 10px; }
.empty-list li { display: flex; align-items: center; gap: 6px; }
.empty-list span { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 6px; color: var(--brand); background: var(--brand-soft); font-weight: 900; }
.spinner { width: 44px; height: 44px; margin-bottom: 22px; border-radius: 50%; border: 3px solid #dce6f6; border-top-color: var(--brand-bright); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: var(--red); background: var(--red-soft); font-size: 24px; font-weight: 900; }

.result-content { padding: 26px; animation: appear .25s ease; }
.result-header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.result-header #result-reference { display: block; max-width: 280px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.decision-card { margin: 20px 0; padding: 20px; border-radius: 14px; color: #173d7a; background: linear-gradient(135deg, #e8f0ff, #f5f8ff); border: 1px solid #bdd0f4; }
.decision-card.warning { color: #674513; background: linear-gradient(135deg, #fff0d7, #fff8eb); border-color: #efcf95; }
.decision-card.danger { color: #732f2f; background: linear-gradient(135deg, #fdeaea, #fff4f4); border-color: #efc4c4; }
.decision-label { display: flex; gap: 10px; align-items: center; font-size: 19px; font-weight: 850; letter-spacing: -.025em; }
.decision-label > span:first-child { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: currentColor; font-size: 0; }
.decision-label > span:first-child::after { content: ""; width: 7px; height: 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translateY(-1px); }
.decision-card.warning .decision-label > span:first-child::after, .decision-card.danger .decision-label > span:first-child::after { width: 2px; height: 10px; border: 0; border-left: 2px solid #fff; transform: none; box-shadow: 0 6px 0 -0.5px #fff; }
.decision-card p { margin: 9px 0 13px; color: currentColor; opacity: .82; font-size: 12px; line-height: 1.45; }
.communicability { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 7px; background: rgba(255,255,255,.65); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.communicability span { color: var(--amber); }
.score-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.score-card { min-width: 0; padding: 13px 9px; display: flex; gap: 9px; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; }
.score-card.total { color: #fff; background: var(--brand-dark); border-color: var(--brand-dark); }
.score-letter { flex: 0 0 auto; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; color: var(--brand); background: var(--brand-soft); font-size: 11px; font-weight: 900; }
.score-card.total .score-letter { color: #8eb8ff; background: rgba(255,255,255,.12); }
.score-card > div:last-child { min-width: 0; display: grid; gap: 2px; }
.score-card span { font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .7; }
.score-card strong { font-size: 18px; }
.result-section { margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; }
.result-section-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.result-section h3 { margin: 0; font-size: 13px; }
.mini-badge { padding: 5px 8px; color: var(--brand); background: var(--brand-soft); font-size: 8px; }
.mini-badge.amber { color: #7f5412; background: var(--amber-soft); }
.metric-list { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 20px; }
.metric-list div { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid #edf0ee; }
.metric-list div:nth-child(-n+2) { border-top: 0; }
.metric-list span { color: var(--muted); font-size: 9px; }
.metric-list strong { font-size: 13px; }
.structure-highlight { display: flex; align-items: baseline; gap: 10px; padding: 13px; border-radius: 10px; background: var(--soft); }
.structure-highlight span { color: var(--muted); font-size: 9px; }
.structure-highlight strong { margin-left: auto; font-size: 19px; color: var(--brand-dark); }
.structure-highlight small { font-size: 9px; color: var(--muted); }
.proposal-section { border-color: #ebcd94; background: #fffaf0; }
.reasons-list, .missing-list { display: grid; gap: 8px; }
.reason-row { display: flex; gap: 9px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; background: var(--soft); font-size: 10px; line-height: 1.4; }
.reason-code { flex: 0 0 auto; min-width: 31px; padding: 3px 5px; text-align: center; border-radius: 5px; color: var(--brand); background: var(--brand-soft); font-weight: 900; }
.missing-list:not(:empty) { margin-top: 9px; }
.missing-list .reason-row { color: #742f2f; background: var(--red-soft); }
.audit-save-card { display: grid; gap: 10px; margin-top: 18px; padding: 16px; border: 1px solid #bfd1f1; border-radius: 13px; background: #f1f6ff; }
.audit-save-copy { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 10px; align-items: start; }
.audit-save-copy > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--brand); font-weight: 900; }
.audit-save-copy h3 { margin: 0 0 4px; font-size: 15px; }
.audit-save-copy p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.audit-save-card .button { margin: 0; text-align: center; text-decoration: none; }
.audit-save-status { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; text-align: center; }
.audit-save-status.success { color: var(--brand-dark); font-weight: 750; }
.audit-save-status.error { color: var(--red); font-weight: 750; }
.restructure-workflow { display: grid; gap: 13px; margin-top: 18px; padding: 18px; border: 1px solid #ebcd94; border-radius: 13px; background: #fffaf0; }
.restructure-workflow > p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.workflow-note { display: grid; gap: 7px; }
.workflow-note > span { color: #47534d; font-size: 14px; font-weight: 800; }
.workflow-confirm { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid #ead5a8; border-radius: 9px; background: #fff; cursor: pointer; }
.workflow-confirm input { width: 18px; min-height: 18px; margin: 1px 0 0; accent-color: var(--brand); }
.workflow-confirm span { color: #5e4b28; font-size: 13px; line-height: 1.4; }
.workflow-actions { display: grid; grid-template-columns: minmax(0,.7fr) minmax(0,1.3fr); gap: 9px; }
.workflow-status { text-align: center; }
.workflow-status.success { color: var(--brand-dark); font-weight: 750; }
.workflow-status.error { color: var(--red); font-weight: 750; }
.result-content > .button { margin-top: 18px; }

footer { width: min(1500px, calc(100% - 36px)); margin: 0 auto 24px; display: flex; justify-content: space-between; color: #77817c; font-size: 10px; }

/* Escala de lectura: mantiene los cálculos compactos sin exigir zoom del navegador. */
.eyebrow, .section-kicker { font-size: 12px; }
.warning-banner { font-size: 15px; line-height: 1.5; }
.status-pill, .version-pill, .mini-badge { font-size: 13px; }
.topbar-link { font-size: 14px; }
.panel-heading p:not(.section-kicker),
.section-title-row p,
.result-empty > p,
.result-loading p,
.result-error p { font-size: 16px; }
.button { font-size: 15px; }
.step b { font-size: 13px; }
.step span { font-size: 13px; }
.section-title-row h3 { font-size: 20px; }
.field > span:first-child { font-size: 14px; }
.field small { font-size: 13px; }
.check-card b { font-size: 14px; }
.check-card small { font-size: 12px; }
.inline-notice { font-size: 14px; line-height: 1.5; }
.subsection-title { font-size: 14px; }
.summary-strip span { font-size: 12px; }
.summary-strip strong { font-size: 17px; }
.empty-list { font-size: 13px; }
.result-header #result-reference { font-size: 14px; }
.decision-card p { font-size: 15px; }
.communicability { font-size: 12px; }
.score-card span { font-size: 11px; }
.result-section h3 { font-size: 16px; }
.metric-list span, .structure-highlight span, .structure-highlight small { font-size: 12px; }
.metric-list strong { font-size: 16px; }
.reason-row { font-size: 13px; }
.audit-save-copy h3 { font-size: 16px; }
.audit-save-copy p { font-size: 13px; }
.audit-save-status { font-size: 12px; }
footer { font-size: 13px; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .result-panel { position: static; min-height: 0; }
  .result-empty, .result-loading, .result-error { min-height: 460px; }
}

@media (max-width: 680px) {
  .topbar { align-items: stretch; flex-direction: column; gap: 14px; padding: 14px 16px; }
  .topbar-meta { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .topbar-link { padding: 8px 10px; font-size: 12px; }
  .status-pill, .version-pill { padding: 7px 9px; font-size: 11px; }
  .warning-banner { padding-inline: 16px; font-size: 13px; }
  .workspace { width: min(100% - 20px, 1500px); margin: 12px auto; gap: 14px; }
  .panel-heading { padding: 22px 18px 17px; flex-direction: column; }
  .stepper { padding: 15px 9px; }
  .step { min-width: 50px; }
  .step b { display: block; max-width: 64px; font-size: 11px; line-height: 1.25; }
  .form-step { padding: 23px 18px; }
  .form-grid, .check-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .summary-strip { grid-template-columns: 1fr; }
  .form-actions { padding: 12px 18px; }
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  .result-content { padding: 18px; }
  .metric-list { grid-template-columns: 1fr; }
  .metric-list div:nth-child(2) { border-top: 1px solid #edf0ee; }
  .workflow-actions { grid-template-columns: 1fr; }
  .empty-list { flex-direction: column; align-items: flex-start; }
  footer { width: calc(100% - 24px); flex-direction: column; gap: 5px; }
}

/* Selector de casos sinteticos del evaluador */
.sample-picker { display: flex; align-items: flex-end; gap: 10px; }
.sample-picker .field { min-width: 15rem; }
.sample-situation {
  margin: 0 0 4px; padding: 10px 12px; border-radius: 9px;
  background: #f2f6fd; color: #33507f; font-size: 12px; line-height: 1.5;
}
