/* =========================================================================
   Asistente de contratación · Sistema visual
   Base: colores corporativos SaludMadrid (azul #00a3e0 / rojo #e73339)
   ========================================================================= */
:root {
  --blue: #00a3e0;
  --blue-dark: #0077a8;
  --blue-ink: #005f87;
  --blue-soft: #e8f6fc;
  --blue-line: #a9dcf1;
  --red: #e73339;
  --red-soft: #fdeced;
  --bg: #f3f6f9;
  --panel: #ffffff;
  --text: #1f2a35;
  --muted: #5b6875;
  --faint: #8794a1;
  --line: #dfe5eb;
  --line-strong: #c9d2db;
  --nav: #15283a;
  --nav-2: #1d3449;
  --nav-text: #c3d1de;
  --ok: #157a3c;
  --ok-soft: #e8f6ee;
  --ok-line: #b4e2c6;
  --warn: #9a6200;
  --warn-soft: #fff5e1;
  --warn-line: #f2d398;
  --error: #b42318;
  --error-soft: #fdeceb;
  --error-line: #f4c1bc;
  --neutral-soft: #eef1f4;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(21, 40, 58, .04), 0 8px 24px rgba(21, 40, 58, .06);
  --shadow-lg: 0 20px 50px rgba(21, 40, 58, .18);
  --header-h: 68px;
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
a { color: var(--blue-dark); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(0, 163, 224, .35); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------- */
.top-header {
  height: var(--header-h);
  position: sticky; top: 0; z-index: 40;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -3px 0 var(--blue);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px 3px 16px;
}
.menu-toggle { display: none; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; min-width: 0; }
.brand img { height: 34px; width: auto; display: block; }
.brand-sep { width: 1px; height: 30px; background: var(--line); }
.brand-app strong { display: block; font-size: 14px; color: var(--text); }
.brand-app span { display: block; font-size: 12px; color: var(--muted); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.chip-ia {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue-soft); color: var(--blue-ink);
  border: 1px solid var(--blue-line); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.chip-ia .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 0 rgba(0,163,224,.6); animation: pulse 1.6s infinite; }
.chip-ia.idle .dot { animation: none; background: var(--ok); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(0,163,224,.55); } 70% { box-shadow: 0 0 0 8px rgba(0,163,224,0); } 100% { box-shadow: 0 0 0 0 rgba(0,163,224,0); } }
.badge-demo { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--red); background: var(--red-soft); border: 1px solid #f5c6c8; padding: 5px 10px; border-radius: 999px; }
.user { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: #f8fafc; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; background: linear-gradient(180deg, var(--blue), var(--blue-dark)); flex-shrink: 0; }
.user strong { display: block; font-size: 13px; line-height: 1.2; }
.user span { display: block; font-size: 11px; color: var(--muted); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.sidebar {
  background: var(--nav); color: var(--nav-text);
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
  overflow-y: auto; padding: 14px 10px 24px;
}
.nav-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #7f94a8; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; margin-bottom: 2px; border-radius: 10px;
  color: var(--nav-text); text-decoration: none; font-size: 14px; font-weight: 600;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(0,163,224,.18); color: #fff; box-shadow: inset 3px 0 0 var(--blue); }
.nav-item .ico { width: 18px; text-align: center; opacity: .9; flex-shrink: 0; }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 800; background: rgba(255,255,255,.1); padding: 1px 8px; border-radius: 999px; }
.nav-context { margin: 10px 4px 0; padding: 12px 6px 6px; border-radius: 12px; background: var(--nav-2); }
.nav-context-title { padding: 0 8px 8px; font-size: 12px; color: #fff; font-weight: 700; line-height: 1.35; }
.nav-context-title span { display: block; color: #8ea4b8; font-weight: 600; font-size: 11px; margin-top: 2px; }
.nav-step { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; color: var(--nav-text); text-decoration: none; font-size: 13px; }
.nav-step:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-step.active { background: rgba(0,163,224,.22); color: #fff; }
.nav-step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; border: 1.5px solid #5c7489; color: #a9bccd; flex-shrink: 0; }
.nav-step.s-done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.nav-step.s-progress .n { border-color: var(--blue); color: #fff; background: rgba(0,163,224,.35); }
.nav-step.s-attention .n { border-color: #f0b54a; color: #ffd38a; }
.nav-divider { height: 1px; background: rgba(255,255,255,.08); margin: 8px 8px; }
.sidebar-foot { margin: 18px 12px 0; font-size: 11px; color: #6f869b; line-height: 1.5; }

.main { min-width: 0; padding: 22px 32px 64px; }
.screen { animation: fadeIn .2s ease; max-width: 1440px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Page head ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--blue-dark); text-decoration: underline; }
.crumbs .sep { color: var(--faint); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.eyebrow { font-size: 12px; font-weight: 800; color: var(--blue-dark); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0; letter-spacing: -.015em; font-weight: 800; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 800; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 800; }
.lead { color: var(--muted); margin: 6px 0 0; max-width: 820px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 14px; font-weight: 700; cursor: pointer;
  background: var(--blue-dark); color: #fff; white-space: nowrap; text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--blue-ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover { background: #f6f8fa; }
.btn.ghost { background: transparent; color: var(--blue-dark); padding: 7px 10px; }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #0f6430; }
.btn.danger { background: #fff; color: var(--error); border-color: var(--error-line); }
.btn.danger:hover { background: var(--error-soft); }
.btn.danger.solid { background: var(--error); color: #fff; border-color: var(--error); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.link { background: none; border: none; padding: 0; color: var(--blue-dark); font-weight: 700; cursor: pointer; font-size: 13px; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- Cards / grids ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 800; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

/* ---------- KPIs ---------- */
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi .value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.kpi .value small { font-size: 14px; color: var(--muted); font-weight: 700; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.warn { border-color: var(--warn-line); background: linear-gradient(180deg, #fffaf0, #fff); }
.kpi.ok { border-color: var(--ok-line); }

/* ---------- Status / pills ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.ok, .status.done, .status.exported, .status.aprobada, .status.cumple { background: var(--ok-soft); color: var(--ok); }
.status.warn, .status.review, .status.dudoso, .status.attention { background: var(--warn-soft); color: var(--warn); }
.status.error, .status.rechazada, .status.no { background: var(--error-soft); color: var(--error); }
.status.info, .status.running, .status.progress { background: var(--blue-soft); color: var(--blue-ink); }
.status.draft, .status.pending, .status.pendiente, .status.queued, .status.todo { background: var(--neutral-soft); color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; background: var(--neutral-soft); color: var(--muted); }
.tag.blue { background: var(--blue-soft); color: var(--blue-ink); }
.tag.ia { background: #eef0ff; color: #3d3fb0; }
.conf { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; }
.conf .bar { width: 44px; height: 6px; border-radius: 99px; background: var(--neutral-soft); overflow: hidden; }
.conf .bar i { display: block; height: 100%; background: var(--ok); }
.conf.mid .bar i { background: #e2a63b; }
.conf.low .bar i { background: var(--error); }
.conf.low { color: var(--error); }
.conf.mid { color: var(--warn); }

/* ---------- Progress ---------- */
.progress { height: 8px; background: var(--neutral-soft); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--blue-dark)); transition: width .5s ease; }
.progress.ok > i { background: var(--ok); }
.progress.striped > i { background-image: linear-gradient(45deg, rgba(255,255,255,.25) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.25) 50%, rgba(255,255,255,.25) 75%, transparent 75%); background-size: 16px 16px; background-color: var(--blue); animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 16px 0; } }

/* ---------- Stepper (Fase 2) ---------- */
.stepper { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.stepper.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.st { position: relative; display: flex; gap: 10px; align-items: center; padding: 12px 14px; text-decoration: none; color: var(--muted); border-right: 1px solid var(--line); min-width: 0; }
.st:last-child { border-right: none; }
.st:hover { background: #f8fafc; }
.st .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; border: 2px solid var(--line-strong); color: var(--muted); flex-shrink: 0; background: #fff; }
.st .t { min-width: 0; }
.st .t strong { display: block; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st .t span { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st.s-done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.st.s-progress .n { border-color: var(--blue); color: var(--blue-ink); background: var(--blue-soft); }
.st.s-attention .n { border-color: #e2a63b; color: var(--warn); background: var(--warn-soft); }
.st.active { background: var(--blue-soft); box-shadow: inset 0 -3px 0 var(--blue); }
.st.active .t strong { color: var(--blue-ink); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f8fafc; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: #f6fbfe; }
td .sub { display: block; font-size: 12px; color: var(--muted); }
tr.row-warn td { background: #fffbf2; }
tr.row-group td { background: #f3f6f9; font-weight: 800; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 14px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.winner td { background: var(--ok-soft); }
tr.tie td { background: var(--warn-soft); }

/* ---------- Forms ---------- */
.input, .select, textarea.input { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; font-family: inherit; background: #fff; color: var(--text); }
textarea.input { min-height: 84px; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,163,224,.18); }
.select.sm { padding: 5px 8px; font-size: 13px; border-radius: 8px; width: auto; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { max-width: 340px; }
.toolbar .select { width: auto; min-width: 180px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: none; background: transparent; padding: 7px 12px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--blue-soft); color: var(--blue-ink); }

/* ---------- Dropzone ---------- */
.drop { border: 1.5px dashed #9ccbe0; background: var(--blue-soft); border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { background: #dcf1fb; border-color: var(--blue); }
.drop strong { display: block; color: var(--blue-ink); font-size: 15px; }
.drop span { color: var(--muted); font-size: 13px; }
.drop .ico { font-size: 26px; display: block; margin-bottom: 4px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.file-ico { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 11px; color: #fff; background: #1f7a4a; flex-shrink: 0; }
.file-ico.pdf { background: #c0392b; }
.file-ico.docx { background: #2b5797; }
.file-row .meta { min-width: 0; flex: 1; }
.file-row .meta strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .meta span { font-size: 12px; color: var(--muted); }

/* ---------- Callouts ---------- */
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 14px; }
.callout + .callout { margin-top: 8px; }
.callout .ci { font-size: 16px; line-height: 1.3; flex-shrink: 0; }
.callout.info { background: var(--blue-soft); border-color: var(--blue-line); color: #0b4a68; }
.callout.warn { background: var(--warn-soft); border-color: var(--warn-line); color: #6b4300; }
.callout.ok { background: var(--ok-soft); border-color: var(--ok-line); color: #0e5129; }
.callout.error { background: var(--error-soft); border-color: var(--error-line); color: #7a1a12; }
.callout .grow { flex: 1; min-width: 0; }
.callout strong { display: block; }

/* ---------- Overview (Resumen) ---------- */
.next-action { display: flex; gap: 18px; align-items: center; padding: 18px 20px; border-radius: var(--radius); background: linear-gradient(120deg, var(--nav) 0%, #1f4562 100%); color: #fff; box-shadow: var(--shadow); }
.next-action .eyebrow { color: #7fd3f3; }
.next-action h2 { color: #fff; margin: 0 0 4px; font-size: 19px; }
.next-action p { margin: 0; color: #c8d6e2; }
.next-action .btn { background: #fff; color: var(--nav); }
.next-action .btn:hover { background: var(--blue-soft); }
.phase-list { display: grid; gap: 0; }
.phase { display: grid; grid-template-columns: 34px minmax(0, 1fr) 190px 120px; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.phase:last-child { border-bottom: none; }
.phase:hover { background: #f8fafc; }
.phase .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; border: 2px solid var(--line-strong); color: var(--muted); }
.phase.s-done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.phase.s-progress .n { border-color: var(--blue); color: var(--blue-ink); background: var(--blue-soft); }
.phase.s-attention .n { border-color: #e2a63b; color: var(--warn); background: var(--warn-soft); }
.phase strong { display: block; font-size: 14px; }
.phase .desc { font-size: 12px; color: var(--muted); }
.phase .prog span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.activity li:last-child { border-bottom: none; }
.activity .when { color: var(--faint); font-size: 12px; white-space: nowrap; min-width: 64px; }

/* ---------- Jobs (procesos IA) ---------- */
.job { display: grid; grid-template-columns: 40px minmax(0, 1.3fr) minmax(0, 1fr) 140px 120px; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.job:last-child { border-bottom: none; }
.job-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--neutral-soft); font-size: 17px; }
.job.running .job-ico { background: var(--blue-soft); }
.job.done .job-ico { background: var(--ok-soft); }
.job strong { display: block; font-size: 14px; }
.job .sub { font-size: 12px; color: var(--muted); }
.job .prog .sub { margin-top: 4px; }

/* ---------- Matriz técnica ---------- */
.lote-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.lote-card + .lote-card { margin-top: 10px; }
.lote-head { display: flex; gap: 12px; align-items: center; padding: 12px 16px; cursor: pointer; background: #fff; border: none; width: 100%; text-align: left; font-size: 14px; color: inherit; }
.lote-head:hover { background: #f8fafc; }
.lote-num { min-width: 52px; height: 28px; border-radius: 8px; background: var(--blue-soft); color: var(--blue-ink); font-weight: 800; font-size: 12px; display: grid; place-items: center; padding: 0 8px; }
.lote-head .chev { margin-left: auto; color: var(--faint); transition: transform .15s; }
.lote-card.open .chev { transform: rotate(90deg); }
.lote-body { display: none; border-top: 1px solid var(--line); }
.lote-card.open .lote-body { display: block; }
.req-list { list-style: none; margin: 0; padding: 0; }
.req-list li { display: flex; gap: 10px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.req-list li:last-child { border-bottom: none; }

/* ---------- Revisión experta ---------- */
.review { display: grid; grid-template-columns: 250px minmax(0, 1fr) minmax(0, 0.85fr); gap: 16px; align-items: start; }
.review.no-viewer { grid-template-columns: 250px minmax(0, 1fr); }
.review-nav { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); display: flex; flex-direction: column; }
.review-nav .list { overflow-y: auto; padding: 6px; }
.rn-lote { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 10px 4px; }
.rn-item { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 13px; color: inherit; }
.rn-item:hover { background: #f6f8fa; }
.rn-item.active { background: var(--blue-soft); border-color: var(--blue-line); }
.rn-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rn-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); flex-shrink: 0; }
.rn-dot.aprobada { background: var(--ok); }
.rn-dot.rechazada { background: var(--error); }
.rn-dot.alert { background: #e2a63b; }
.rn-dot.proc { background: var(--blue); }
.offer-head { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.offer-head h2 { margin: 2px 0 2px; }
.req-eval { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.re-row { padding: 12px 14px; border-bottom: 1px solid var(--line); box-shadow: inset 3px 0 0 var(--ok-line); display: grid; gap: 8px; }
.re-row:last-child { border-bottom: none; }
.re-top { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.re-top strong { font-size: 14px; flex: 1 1 220px; }
.re-top .spacer { display: none; }
.ia-sug { display: inline-flex; gap: 6px; align-items: center; }
.pres { font-size: 13px; color: #33424f; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.pres .lbl { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-bottom: 2px; }
.re-row.flag-no { box-shadow: inset 3px 0 0 var(--error); background: #fffafa; }
.re-row.flag-dudoso { box-shadow: inset 3px 0 0 #e2a63b; background: #fffdf7; }
.evid { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--blue-dark); background: none; border: 1px solid var(--blue-line); border-radius: 8px; padding: 3px 8px; cursor: pointer; }
.evid:hover { background: var(--blue-soft); }
.evid.on { background: var(--blue-dark); color: #fff; border-color: var(--blue-dark); }
.verdict { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.verdict button { white-space: nowrap; border: none; background: #fff; padding: 4px 10px; font-size: 12px; font-weight: 700; cursor: pointer; color: var(--muted); border-right: 1px solid var(--line); }
.verdict button:last-child { border-right: none; }
.verdict button.on.cumple { background: var(--ok); color: #fff; }
.verdict button.on.no { background: var(--error); color: #fff; }
.verdict button.on.dudoso { background: #e2a63b; color: #fff; }
.decision-bar { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 18px; background: rgba(255,255,255,.96); backdrop-filter: blur(4px); border-top: 1px solid var(--line); }
.viewer { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); display: flex; flex-direction: column; }
.viewer-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.viewer-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.viewer-tabs button.on { background: var(--blue-soft); color: var(--blue-ink); border-color: var(--blue-line); }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.viewer-canvas { background: #e9eef2; padding: 18px; overflow: auto; flex: 1; }
.page { background: #fff; max-width: 520px; margin: 0 auto; padding: 34px 38px; box-shadow: 0 4px 18px rgba(0,0,0,.12); font-family: Georgia, "Times New Roman", serif; font-size: 12px; color: #333; min-height: 560px; }
.page h4 { font-family: var(--font); font-size: 13px; margin: 0 0 10px; color: #222; }
.page .ln { height: 7px; background: #e6e9ec; border-radius: 3px; margin: 9px 0; }
.page mark { background: #fff1a8; box-shadow: 0 0 0 3px #fff1a8; padding: 0 1px; display: block; margin: 12px 0; border-radius: 2px; font-family: var(--font); font-size: 12px; line-height: 1.5; outline: 2px solid #f0c419; outline-offset: 3px; }
.page .pg { text-align: center; color: #999; font-size: 11px; margin-top: 26px; font-family: var(--font); }

/* ---------- Criterios ---------- */
.formula { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; background: #f4f6f8; border: 1px solid var(--line); padding: 3px 8px; border-radius: 6px; color: #33424f; }
.score-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--neutral-soft); min-width: 120px; }
.score-bar i { display: block; height: 100%; }
.score-bar i.c0 { background: var(--blue-dark); }
.score-bar i.c1 { background: #6cc4e8; }
.score-bar i.c2 { background: #9aa9b6; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }

/* ---------- Documentos generados ---------- */
.doc-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; text-align: left; width: 100%; font-size: 14px; color: inherit; }
.doc-card:hover { border-color: var(--blue-line); }
.doc-card.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,163,224,.15); }
.doc-card .grow { flex: 1; min-width: 0; }
.paper { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 40px 48px; box-shadow: 0 10px 30px rgba(21,40,58,.08); max-width: 860px; margin: 0 auto; font-size: 14px; line-height: 1.6; }
.paper h3 { color: var(--blue-ink); font-size: 18px; text-align: center; margin-bottom: 4px; }
.paper h4 { color: var(--blue-ink); font-size: 14px; margin: 22px 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.paper table th { text-transform: none; letter-spacing: 0; font-size: 12px; }
.paper table td, .paper table th { padding: 7px 10px; border: 1px solid var(--line); font-size: 13px; }
.paper [contenteditable]:focus { outline: 2px dashed var(--blue-line); outline-offset: 4px; }

/* ---------- Modal / Toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 28, 41, .45); display: grid; place-items: center; z-index: 90; padding: 16px; animation: fadeIn .15s ease; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal.wide { width: min(820px, 100%); }
.modal-head { padding: 18px 20px 6px; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 10px 20px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 18px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--nav); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 380px; animation: fadeIn .2s ease; display: flex; gap: 10px; align-items: flex-start; }
.toast.ok { background: #0f5a2d; }
.toast.warn { background: #6b4300; }

.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .big { font-size: 30px; }
.coming { border: 1px dashed var(--line-strong); background: #fafbfc; border-radius: 12px; padding: 14px 16px; }

/* ---------- Fase 1 ---------- */
.templates { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.template { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.template:has(input:checked) { border-color: var(--blue-line); background: var(--blue-soft); }
.template strong { display: block; font-size: 14px; }
.template span { display: block; font-size: 12px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); }
.kv .status { align-self: center; white-space: nowrap; flex-shrink: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1360px) {
  .review { grid-template-columns: 250px minmax(0, 1fr); }
  .review .viewer { grid-column: 1 / -1; position: static; max-height: none; }
  .job { grid-template-columns: 40px minmax(0, 1fr) 140px 110px; }
  .job .job-detail { display: none; }
}
@media (max-width: 1100px) {
  .g-main, .g-3 { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stepper, .stepper.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .st { border-bottom: 1px solid var(--line); }
  .phase { grid-template-columns: 34px minmax(0, 1fr) 110px; }
  .phase .prog { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px; font-size: 16px; cursor: pointer; }
  .sidebar { position: fixed; left: 0; top: var(--header-h); z-index: 50; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .main { padding: 18px 16px 48px; }
  .brand-sep, .brand-app, .user .meta, .badge-demo, #chip-ia-text { display: none; }
  .chip-ia { padding: 10px; }
  .user { padding: 2px; }
  .brand img { height: 28px; }
  .g-2, .g-4, .templates { grid-template-columns: 1fr; }
  .review, .review.no-viewer { grid-template-columns: 1fr; }
  .review-nav { position: static; max-height: 320px; }
  .stepper, .stepper.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job { grid-template-columns: 40px minmax(0, 1fr); }
  .job .job-state, .job .prog { grid-column: 2; }
  .phase { grid-template-columns: 34px minmax(0, 1fr); }
  .phase > :last-child { grid-column: 2; }
  .next-action { flex-direction: column; align-items: flex-start; }
  .paper { padding: 24px 18px; }
  h1 { font-size: 22px; }
}
