/* Application form styles. Tokens come from index.html (:root). */
:root { --ps-err: #B42318; --ps-ok: #0B7A55; --ps-field: #F5F8FF; }
.progress { position: sticky; top: 0; z-index: 5; background: var(--ps-bg); padding: 12px 0 10px; margin-bottom: 18px; border-bottom: 1px solid var(--ps-border); }
.pbar { height: 8px; border-radius: 99px; background: var(--ps-border); overflow: hidden; }
.pfill { height: 100%; width: 0; background: var(--ps-coral); transition: width .2s; }
.plabel { font-size: .85rem; color: var(--ps-gray); margin-top: 6px; }
fieldset.sec { border: 0; background: transparent; padding: 0; margin: 0 0 40px; min-width: 0; }
fieldset.sec > header { margin-bottom: 14px; }
.secid { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ps-coral); }
fieldset.sec h3 { font-size: 1.35rem; margin: 2px 0 6px; color: var(--ps-navy); }
.secnote { color: var(--ps-gray); margin: 0; max-width: 62ch; }
.f { padding: 12px 0 16px; }
.f.hidden { display: none; }
.f > .q { display: block; font-weight: 600; margin: 0 0 4px; }
.qid { display: inline-block; min-width: 2.4em; font-size: .78rem; font-weight: 600; color: var(--ps-gray); }
.req-star { color: var(--ps-coral); margin-left: 4px; }
.help { color: var(--ps-gray); font-size: .9rem; margin: 0 0 8px; max-width: 70ch; }
.help:empty { display: none; }
.body { display: flex; flex-direction: column; gap: .5rem; }
input[type=text], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=date], textarea, select {
  width: 100%; font: inherit; color: var(--ps-text); background: var(--ps-field);
  border: 1px solid var(--ps-border); border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 96px; resize: vertical; }
input[type=file] { font: inherit; color: var(--ps-text); max-width: 100%; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--ps-coral); outline-offset: 1px; }
.f.error input:not([type=checkbox]):not([type=radio]), .f.error textarea, .f.error select { border-color: var(--ps-err); }
.errmsg { color: var(--ps-err); font-size: .88rem; font-weight: 600; margin: 4px 0 0; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.opt input { margin-top: .35em; width: 18px; height: 18px; flex: none; accent-color: var(--ps-btn); }
.opt.boxed { border: 1px solid var(--ps-border); border-radius: 8px; padding: 10px 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wc { font-size: .8rem; color: var(--ps-gray); text-align: right; }
.wc.over { color: var(--ps-err); font-weight: 600; }
.computed { font-size: .9rem; color: var(--ps-gray); }
.cs { position: relative; }
.cs-list { display: none; position: absolute; z-index: 4; left: 0; right: 0; max-height: 240px; overflow: auto; background: var(--ps-card); border: 1px solid var(--ps-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.cs-list.show { display: block; }
.cs-item { padding: 9px 12px; cursor: pointer; }
.cs-item:hover { background: var(--ps-light); }
.tblwrap { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; min-width: 520px; }
table.grid th { text-align: left; font-size: .82rem; color: var(--ps-gray); padding: 4px 6px; }
table.grid td { padding: 4px 6px; }
.bline { display: grid; grid-template-columns: 1fr 140px; gap: 10px; align-items: center; }
.bsum { font-weight: 600; font-size: .92rem; margin-top: 4px; }
.bsum.ok { color: var(--ps-ok); } .bsum.bad { color: var(--ps-err); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.submitbar { display: grid; gap: 12px; justify-items: start; margin-top: 8px; }
button.submit { font: inherit; font-weight: 700; background: var(--ps-btn); color: #fff; border: 0; border-radius: 6px; padding: 14px 28px; font-size: 1.05rem; cursor: pointer; }
button.submit:disabled { opacity: .6; cursor: wait; }
button.submit:focus-visible { outline: 3px solid var(--ps-blue); outline-offset: 3px; }
.status { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--ps-border); max-width: 70ch; }
.status.ok { border-color: var(--ps-ok); }
.status.bad { border-color: var(--ps-err); }
.status:empty { display: none; }
@media (max-width: 560px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .bline { grid-template-columns: 1fr 110px; }
}
@media (prefers-reduced-motion: reduce) { .pfill { transition: none; } }

/* `hidden` has to win over any class that sets display. Without this, the
   door's states (display: grid / flex) all render at once. */
[hidden] { display: none !important; }

/* ---- save and resume ----
   One moment at a time: the door at the top, a card at the first save, the
   code card once issued, and a compact chip with the code after that. */
.door { margin-bottom: 18px; display: grid; gap: 10px; }
.door-fresh { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.door-lead { margin: 0; flex: 1 1 320px; line-height: 1.5; }
.door-title { margin: 0; font-weight: 700; font-size: 1.05rem; }
.door-back, .door-chip, .door-resume {
  border: 1px solid var(--ps-border); border-radius: 10px; padding: 14px 16px; background: var(--ps-field);
}
.door-back { display: grid; gap: 8px; }
.door-actions { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.door-resume { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.door-resume label { font-weight: 600; }
.door-resume input, .savecard input {
  font: inherit; padding: 9px 12px; border: 1px solid var(--ps-border); border-radius: 6px; min-width: 0; max-width: 100%;
}
.door-resume input { width: 15em; text-transform: uppercase; letter-spacing: .04em; }
.door-chip { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 14px; }
.chip-lab { font-size: .9rem; opacity: .8; }
.chip-note { font-size: .86rem; opacity: .8; flex: 1 1 200px; }

button.savebtn { font: inherit; font-weight: 600; font-size: .95rem; background: #fff; color: var(--ps-btn); border: 1.5px solid var(--ps-btn); border-radius: 6px; padding: 9px 18px; cursor: pointer; }
button.savebtn.primary { background: var(--ps-btn); color: #fff; }
button.savebtn.small { padding: 4px 12px; font-size: .86rem; }
button.savebtn:focus-visible, button.linkbtn:focus-visible { outline: 3px solid var(--ps-blue); outline-offset: 2px; }
button.linkbtn { font: inherit; font-size: .95rem; background: none; border: 0; padding: 4px 0; color: var(--ps-btn); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.codeval { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; letter-spacing: .05em; user-select: all; }
.codeval.big { font-size: 1.6rem; letter-spacing: .08em; }

/* the cards open inside the footer of the section where the person saved */
.savehost:empty { display: none; }
.savecard, .codecard {
  flex-basis: 100%; display: grid; gap: 8px; margin-top: 12px; max-width: 520px;
  border: 1.5px solid var(--ps-btn); border-radius: 12px; padding: 16px 18px; background: #fff;
}
.codecard { border-color: var(--ps-ok); background: #f4fbf6; }
.card-title { margin: 0; font-weight: 700; font-size: 1.05rem; }
.card-lead { margin: 0; line-height: 1.5; }
.card-hint { font-size: .86rem; opacity: .8; }
.card-err { font-size: .9rem; color: #7a2412; }
/* inline format error under an email input */
.fielderr { display: block; margin-top: 6px; font-size: .9rem; color: #7a2412; }
/* "Still needed: …" under a question answered only in part */
.partnote { margin: 8px 0 0; font-size: .9rem; color: #7a2412; }

/* ---- one section at a time ---- */
/* scroll-margin: on its own page the progress bar is sticky on top and would
   cover the step bar after "Next" scrolls to it. Embedded, it is static. */
.stepper { margin: 0 0 18px; scroll-margin-top: 90px; }
html.embed .stepper { scroll-margin-top: 16px; }
.step-now { margin: 0 0 8px; font-weight: 600; }
.step-list { position: relative; list-style: none; margin: 0; padding: 0 0 4px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.step-list li { flex: 0 0 auto; }
button.step {
  font: inherit; font-size: .85rem; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--ps-border); background: #fff;
  color: var(--ps-text, #1b2430); cursor: pointer; white-space: nowrap;
}
button.step .step-id { font-weight: 700; }
button.step .step-title { display: none; }
button.step.cur { background: var(--ps-btn); border-color: var(--ps-btn); color: #fff; }
button.step.cur .step-title { display: inline; }
button.step.done { border-color: var(--ps-ok); color: var(--ps-ok); }
button.step.open { border-color: #c98a1a; color: #7a4d00; }
button.step.locked { opacity: .45; cursor: not-allowed; }
button.step:focus-visible { outline: 3px solid var(--ps-blue); outline-offset: 2px; }
.step-mark { font-weight: 700; }
@media (min-width: 900px) { button.step .step-title { display: inline; } }

.secnav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; }
.secnav .navmsg { flex: 1 1 200px; font-size: .92rem; }
.secnav .navmsg.bad { color: #7a2412; font-weight: 600; }
.secnav button.primary { margin-left: auto; }
input[aria-invalid="true"] { border-color: #b3401f !important; }
.savecard label { font-weight: 600; margin-top: 4px; }
.code-big { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 6px 0; }
.codecard .linkbtn { justify-self: start; }
.savemsg { font-size: .95rem; } .savemsg:empty { display: none; }
.savemsg.ok { color: var(--ps-ok); } .savemsg.bad { color: var(--ps-err); }
.secsave { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--ps-border); }
.secmsg { font-size: .92rem; opacity: .85; } .secmsg.saved { color: var(--ps-ok); opacity: 1; } .secmsg.done { font-weight: 600; }
/* Resultado del guardado, junto al botón que se presionó. Separado de
   .secmsg, que lleva el estado de completitud y lo reescribe updateSaveUI. */
.secflash { font-size: .92rem; font-weight: 600; padding: 3px 9px; border-radius: 3px; }
.secflash.ok  { color: #0b5a33; background: #e4f4ea; }
.secflash.bad { color: #7a2412; background: #fbe8e2; }

/* Progreso por sección: no necesita sticky porque está donde la persona
   acaba de llegar. Se vuelve el encabezado del paso cuando el formulario
   pase a una sección por página. */
.secprog { margin: 6px 0 0; font-size: .86rem; color: var(--ps-muted, #5a6472); font-variant-numeric: tabular-nums; }
.secprog.done { color: var(--ps-ok); font-weight: 600; }
.subrow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.filenote { font-style: italic; }
html.embed button.savebtn { border-color: #001B5B; color: #001B5B; border-radius: 999px; }
html.embed button.savebtn.primary { background: #001B5B; color: #fff; }
.coderow[hidden] { display: none; }
