/* Helpdesk ROMSEGROUP
   Dirección: placa de equipo con la imagen corporativa de romsegroup.com (azul marino #1A4374, azul #0071B7, blanco y grises).
   Para cambiar la marca basta con editar las variables de :root. */
:root {
  color-scheme: light dark;
  --bg: #e8edf2;
  --card: #ffffff;
  --field: #f2f5f9;
  --ink: #14191f;
  --muted: #55606c;
  --line: #ccd5de;
  --top: #1a4374;
  --brand: #1a4374;
  --btn-bg: #1a4374;
  --btn-ink: #ffffff;
  --led: #3da0e6;
  --bad: #c23b22;
  --ok: #1b7a4b;
  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d141c; --card: #152130; --field: #1b2a3b; --ink: #e6ecf2; --muted: #93a3b3;
    --line: #26384c; --top: #0a2038; --brand: #6db3e8; --btn-bg: #6db3e8; --btn-ink: #06213a;
    --led: #4aa8e8; --bad: #ff7a5f; --ok: #5fd39a;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--body); }
a { color: var(--brand); }
a.badge { text-decoration: none; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1180px; }

/* ---------- Cabecera ---------- */
.top { background: var(--top); color: #fff; border-bottom: 3px solid var(--led); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 12px; padding-bottom: 12px; max-width: 1180px; }
.brand { color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; font: 700 1rem/1 var(--display); font-stretch: 120%; letter-spacing: .08em; text-transform: uppercase; }
.brand-logo { display: block; height: 52px; width: auto; background: #fff; border-radius: 6px; padding: 4px 10px; }
.top nav { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; font-size: .92rem; }
.top nav a { color: #fff; text-decoration: none; opacity: .85; padding: 4px 0; border-bottom: 2px solid transparent; }
.top nav a:hover { opacity: 1; border-bottom-color: var(--led); }
.who { font: .78rem var(--mono); opacity: .65; }

main.wrap { padding-top: 28px; padding-bottom: 56px; }
h1 { font: 700 clamp(1.6rem, 3vw, 2.15rem)/1.1 var(--display); font-stretch: 118%; letter-spacing: -.01em; margin: 0 0 8px; }
h2 { font: 700 1.1rem/1.25 var(--display); font-stretch: 112%; margin: 0 0 12px; }
.lead { color: var(--muted); margin: 0 0 22px; max-width: 62ch; }

/* ---------- Estructura del formulario público ---------- */
.shell { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 960px) { .shell { grid-template-columns: 290px minmax(0, 1fr); gap: 36px; } .rail { position: sticky; top: 20px; } }
.rail { border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
.rail summary { cursor: pointer; padding: 12px 16px; font: 700 .78rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); list-style: none; }
.rail summary::-webkit-details-marker { display: none; }
.rail ul { list-style: none; margin: 0; padding: 0 0 6px; }
.rail li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 16px 10px 12px; border-left: 4px solid transparent; transition: background .15s, border-color .15s; }
.rail li b { display: block; font-size: .95rem; }
.rail li div span { display: block; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.rail li .ico { margin-top: 2px; color: var(--muted); transition: color .15s; }
.rail li.on .ico { color: var(--brand); }

/* Íconos de servicio */
.ico { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 22px; height: 22px; font-style: normal; color: var(--brand); }
.ico svg { width: 100%; height: 100%; }
.ico.sm { width: 18px; height: 18px; margin-right: 8px; vertical-align: -3px; }
.ico.lg { width: 38px; height: 38px; padding: 8px; margin-right: 12px; border-radius: 8px; background: color-mix(in srgb, var(--brand) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent); }
.card h2:has(.ico.lg) { display: flex; align-items: center; }
.opt .ico { margin-top: 1px; color: var(--muted); }
.opt:has(input:checked) .ico { color: var(--brand); }
.rail li.on { border-left-color: var(--led); background: color-mix(in srgb, var(--led) 12%, var(--card)); }
.rail .note { margin: 0; padding: 12px 16px; border-top: 1px dashed var(--line); font-size: .85rem; color: var(--muted); }

/* ---------- Tarjetas y campos ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 22px; margin-bottom: 16px; }
.card[hidden], .field[hidden] { display: none; }
.card[data-section]:not([hidden]) { animation: entra .22s ease-out; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
label, legend { display: block; font-weight: 600; margin-bottom: 4px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.req { color: var(--bad); }
.help { color: var(--muted); font-size: .9rem; margin: 0 0 8px; font-weight: 400; max-width: 70ch; }
.help p { margin: 0 0 8px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=password], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 6px;
}
input[type=date] { cursor: pointer; min-height: 46px; }
input[type=file] { padding: 9px 10px; }
input:focus-visible, textarea:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--led) 70%, transparent); outline-offset: 1px; border-color: var(--brand);
}
.opts { display: grid; gap: 8px; }
.opt { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); cursor: pointer; margin: 0; transition: border-color .12s, background .12s; }
.opt:hover { border-color: var(--brand); }
.opt:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, var(--card)); }
.opt.check { background: transparent; border-style: dashed; }
/* Opción única: indicador LED. Casilla: cuadro con marca. */
.opt input { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 3px 0 0; border: 2px solid var(--muted); background: var(--card); display: grid; place-content: center; cursor: pointer; }
.opt input[type=radio] { border-radius: 50%; }
.opt input[type=radio]:checked { border-color: var(--ink); background: var(--led); box-shadow: 0 0 0 3px color-mix(in srgb, var(--led) 30%, transparent), 0 0 8px color-mix(in srgb, var(--led) 70%, transparent); }
.opt input[type=checkbox] { border-radius: 4px; }
.opt input[type=checkbox]:checked { background: var(--brand); border-color: var(--brand); }
.opt input[type=checkbox]:checked::before { content: ""; width: 9px; height: 5px; border: 2px solid var(--btn-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.legal { max-height: 240px; overflow: auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; font-size: .88rem; color: var(--muted); margin-bottom: 10px; background: var(--field); }
.legal p, .legal ul { margin: 0 0 8px; }
.legal ul { padding-left: 20px; }
.err { color: var(--bad); font-size: .9rem; margin-top: 4px; font-weight: 500; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* ---------- Botones y avisos ---------- */
.btn { display: inline-block; background: var(--btn-bg); color: var(--btn-ink); border: 2px solid var(--btn-bg); border-radius: 6px; padding: 11px 22px; font: 600 1rem var(--body); cursor: pointer; text-decoration: none; transition: filter .12s; }
.btn:hover { filter: brightness(1.1); }
.btn.sec { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn.sm { padding: 6px 12px; font-size: .88rem; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn[disabled] { opacity: .6; cursor: progress; }
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; border-left-width: 5px; }
.flash.ok { background: color-mix(in srgb, var(--ok) 10%, var(--card)); border-color: var(--ok); }
.flash.error { background: color-mix(in srgb, var(--bad) 10%, var(--card)); border-color: var(--bad); }
footer.foot { color: var(--muted); font: .75rem var(--mono); letter-spacing: .06em; padding-top: 18px; padding-bottom: 28px; text-align: left; text-transform: uppercase; border-top: 1px dashed var(--line); }

/* ---------- Etiqueta de ticket (firma) ---------- */
.tag { position: relative; max-width: 440px; background: var(--card); border: 1px solid var(--ink); border-radius: 12px; padding: 0; margin: 4px 0 22px; overflow: hidden; box-shadow: 0 1px 0 var(--ink), 0 14px 28px -18px rgba(0, 0, 0, .55); transform-origin: top center; }
.tag.print { animation: imprime .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes imprime { from { transform: translateY(-14px) scaleY(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.tag-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--top); color: #fff; font: 600 .72rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.tag-led { width: 10px; height: 10px; border-radius: 50%; background: var(--led); box-shadow: 0 0 0 3px rgba(61, 160, 230, .28), 0 0 10px rgba(61, 160, 230, .75); }
.tag-body { padding: 18px 18px 14px; }
.tag-code { font: 600 clamp(1.5rem, 6vw, 2.1rem)/1.1 var(--mono); letter-spacing: .02em; word-break: break-all; }
.tag-bars { display: block; width: 100%; height: 38px; margin: 14px 0 4px; color: var(--ink); }
.tag-cut { position: relative; border-top: 2px dashed var(--line); margin: 0; }
.tag-cut::before, .tag-cut::after { content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); border: 1px solid var(--ink); }
.tag-cut::before { left: -11px; }
.tag-cut::after { right: -11px; }
.tag-meta { margin: 0; padding: 14px 18px 16px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .88rem; }
.tag-meta dt { color: var(--muted); font: .72rem var(--mono); letter-spacing: .08em; text-transform: uppercase; padding-top: 2px; }
.tag-meta dd { margin: 0; }
@media (prefers-reduced-motion: reduce) { .tag.print, .card[data-section]:not([hidden]) { animation: none; } * { transition: none !important; } }

/* ---------- Estados y tablas (panel) ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 4px; font: 600 .74rem var(--mono); letter-spacing: .03em; text-transform: uppercase; background: color-mix(in srgb, var(--muted) 16%, var(--card)); color: var(--ink); white-space: nowrap; border: 1px solid color-mix(in srgb, var(--muted) 30%, transparent); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.nuevo::before { background: var(--brand); }
.badge.retenido_mora::before, .badge.rechazado::before { background: var(--bad); }
.badge.en_analisis::before, .badge.en_ejecucion::before { background: var(--led); }
.badge.aprobado::before, .badge.agendado::before { background: var(--ok); }
.badge.cerrado::before { background: var(--muted); opacity: .5; }
.badge[class*=" p-"]::before { display: none; }
.badge.p-critica { background: var(--bad); color: #fff; border-color: var(--bad); }
.badge.p-alta { background: var(--led); color: #14191f; border-color: var(--led); }
.badge.p-media, .badge.p-baja { color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th, table.t td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { color: var(--muted); font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .08em; }
table.t td:first-child { white-space: nowrap; }
table.t td:first-child b { font: 600 .9rem var(--mono); }
table.t tbody tr:hover td { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.scroll { overflow-x: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.filters > div { min-width: 150px; flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 2fr 1fr; } }
dl.kv { display: grid; grid-template-columns: 1fr; gap: 2px 14px; margin: 0; }
@media (min-width: 600px) { dl.kv { grid-template-columns: 220px 1fr; } }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0 0 8px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 3px solid var(--line); margin-left: 4px; }
.timeline li.pub { border-left-color: var(--led); }
.timeline small { color: var(--muted); display: block; font: .75rem var(--mono); }
.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
ul.firmas { list-style: none; margin: 0 0 8px; padding: 0 0 0 14px; border-left: 3px solid var(--ok); }
ul.firmas li { padding: 4px 0; }
.sep { border: 0; border-top: 1px dashed var(--line); margin: 18px 0; }

/* ================= Acceso por código ================= */
.acceso { max-width: 520px; margin: 0 auto; }
input.codigo { font: 700 1.9rem/1.2 var(--mono); letter-spacing: .5em; text-transform: uppercase; text-align: center; padding: 14px 12px; }
main:has(.acceso) > .flash { max-width: 520px; margin-left: auto; margin-right: auto; }
.acceso-otras { margin: -4px 0 8px; }
.acceso-otras form { display: inline; }

/* ================= Asistente por fases ================= */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wizard { max-width: 860px; margin: 0 auto; }
.paso[hidden] { display: none; }
.paso.entra-der { animation: sl-der .3s ease-out; }
.paso.entra-izq { animation: sl-izq .3s ease-out; }
@keyframes sl-der { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes sl-izq { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

/* Indicador de progreso: una pista con un LED que avanza */
.stepper { --pf: 0; list-style: none; display: flex; margin: 26px 0 28px; padding: 0; position: relative; }
.stepper::before, .stepper::after { content: ""; position: absolute; top: 21px; left: 10%; height: 4px; border-radius: 2px; }
.stepper::before { right: 10%; background: var(--line); }
.stepper::after { width: calc(80% * var(--pf)); background: var(--led); box-shadow: 0 0 10px color-mix(in srgb, var(--led) 70%, transparent); transition: width .5s cubic-bezier(.4, .1, .2, 1); }
.stepper li { flex: 1; display: flex; justify-content: center; position: relative; z-index: 1; }
.st { display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.st:disabled { cursor: default; }
.st-dot { position: relative; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 2px solid var(--line); color: var(--muted); transition: border-color .25s, background .25s, color .25s, box-shadow .25s, transform .25s; }
.st-ok { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .25s; }
.st-lab { font: 600 .7rem var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.stepper li.hecho .st-dot { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); }
.stepper li.hecho .st-ico { opacity: 0; }
.stepper li.hecho .st-ok { opacity: 1; transform: none; }
.stepper li.actual .st-dot { border-color: var(--ink); color: var(--brand); transform: scale(1.1); box-shadow: 0 0 0 5px color-mix(in srgb, var(--led) 30%, transparent), 0 0 18px color-mix(in srgb, var(--led) 60%, transparent); }
.stepper li.actual .st-lab { color: var(--ink); }
.st:not(:disabled):hover .st-dot { border-color: var(--brand); }
@media (max-width: 620px) { .st-lab { display: none; } .stepper li.actual .st-lab { display: block; position: absolute; top: 54px; white-space: nowrap; } .stepper { margin-bottom: 40px; } .st-dot { width: 40px; height: 40px; } .stepper::before, .stepper::after { top: 18px; } }

/* Tarjetas de servicio */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.svc { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--field); cursor: pointer; font-weight: 400; margin: 0; transition: transform .15s, border-color .15s, box-shadow .15s, background .15s; }
.svc:hover { transform: translateY(-2px); border-color: var(--brand); }
.svc b { font: 700 1rem/1.2 var(--display); font-stretch: 108%; margin-top: 6px; }
.svc span { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.svc:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, var(--card)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.svc input { appearance: none; -webkit-appearance: none; position: absolute; top: 14px; right: 14px; width: 18px; height: 18px; margin: 0; border: 2px solid var(--muted); border-radius: 50%; background: var(--card); cursor: pointer; }
.svc input:checked { border-color: var(--ink); background: var(--led); box-shadow: 0 0 0 3px color-mix(in srgb, var(--led) 30%, transparent), 0 0 8px color-mix(in srgb, var(--led) 70%, transparent); }
.svc input:focus-visible { outline: 3px solid color-mix(in srgb, var(--led) 70%, transparent); outline-offset: 2px; }
.ico.xl { width: 54px; height: 54px; padding: 13px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 11%, var(--card)); border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent); }
.svc:has(input:checked) .ico.xl { background: var(--brand); color: var(--btn-ink); }

/* Búsqueda del proceso y su panel */
.buscar { display: flex; gap: 10px; }
.buscar input { flex: 1; text-transform: uppercase; }
.buscar .btn { white-space: nowrap; }
.proceso-info { margin-bottom: 18px; padding: 16px 18px; border: 1px solid var(--line); border-left: 5px solid var(--led); border-radius: 8px; background: var(--field); }
.proceso-info:empty { display: none; }
.pi-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.pi-codigo { font: 600 .85rem var(--mono); color: var(--muted); }
.proceso-info dl.kv { grid-template-columns: 1fr; }
@media (min-width: 600px) { .proceso-info dl.kv { grid-template-columns: 200px 1fr; } }
.proceso-info .help { margin: 6px 0 0; }

/* Navegación del asistente */
.wiz-nav { display: flex; align-items: center; gap: 12px; position: sticky; bottom: 0; padding: 14px 0; margin-top: 4px; background: linear-gradient(to top, var(--bg) 82%, transparent); z-index: 5; }
.mora-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.mora-form input[type="text"] { flex: 1 1 220px; min-width: 0; }
/* En pantallas angostas la barra se apila y debe taparse con un fondo sólido, o el texto de abajo se transparenta. */
@media (max-width: 640px) { .wiz-nav { background: var(--bg); border-top: 1px solid var(--line); margin-inline: -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 16px -10px rgba(10, 32, 56, .25); } }
.wiz-nav .btn { min-width: 120px; }
#btn-sig, #btn-enviar { margin-left: auto; }
.wiz-info { color: var(--muted); font: .78rem var(--mono); letter-spacing: .04em; text-transform: uppercase; }
#btn-atras[hidden] + .wiz-info { margin-right: auto; }
.wiz-pie { font-size: .9rem; }
.sacude { animation: sacude .35s; }
@keyframes sacude { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.field.invalido input:not([type=radio]):not([type=checkbox]), .field.invalido textarea, .field.invalido select { border-color: var(--bad); }
.field.invalido .opt, .field.invalido .svc { border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }

/* Revisión */
.res-grupo { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: var(--field); }
.res-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.res-cab b { font: 700 1rem var(--display); font-stretch: 110%; }
@media (prefers-reduced-motion: reduce) { .paso.entra-der, .paso.entra-izq, .sacude { animation: none; } .stepper::after, .st-dot, .st-ok, .svc { transition: none; } }
