/*
 * Company registration — VIVA.
 * Colours and fonts from myviva.net: navy #06182c, blue #0b91e6 and the
 * blue-to-cyan gradient of the VIVA "V", Manrope + Inter. Amber marks what the
 * applicant still has to fill in. The DGI appears
 * as the client (its seal in the hero and footer), not as the theme.
 */
:root {
    --navy: #06182c;
    --navy-2: #0a2847;
    --navy-3: #123b62;
    --blue: #0b91e6;
    --blue-ink: #0a6fb3;          /* blue for text and links: AA on white */
    --blue-50: #e7f4fd;
    --cyan: #18c3e8;
    --accent: linear-gradient(135deg, #0a5ce0, #0b7fd8);   /* buttons, switch: white text, AA */
    --accent-hover: linear-gradient(135deg, #0950c4, #0a70c0);
    --sky: #7cc8f5;               /* light blue on navy */
    --amber: #f2a71b;
    --amber-50: #fff5df;
    --amber-ink: #7a4b00;         /* text on amber-50 */
    --green: #1d7f47;
    --green-50: #e6f4ec;
    --red: #d6362f;
    --red-50: #fdecea;

    --ink: #10243b;
    --muted: #5d6f83;
    --line: #d8e2e9;
    --bg: #f4f7f9;
    --card: #ffffff;
    --field-locked: #f1f5f8;

    --gradient: linear-gradient(90deg, #0a5ce0, var(--blue) 45%, var(--cyan));
    --radius: 10px;
    --shadow: 0 1px 2px rgba(6, 24, 44, .06), 0 18px 48px rgba(6, 24, 44, .10);
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --font-head: "Manrope", "Inter", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 400 15px/1.55 var(--font);
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0; letter-spacing: -.01em; }

.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

.skip-link {
    position: absolute; left: 8px; top: -48px; z-index: 10;
    background: #fff; color: var(--navy); padding: 8px 12px; border-radius: 6px;
}
.skip-link:focus { top: 8px; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ------------------------------------------------------------------ header */
.site-header { background: var(--navy); color: #fff; position: relative; z-index: 1; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; }
.brand { display: block; line-height: 0; }
.brand-logo { height: 40px; width: auto; }

.lang-switch { display: inline-flex; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; padding: 3px; }
.lang-switch button {
    font: 700 12.5px/1 var(--font); letter-spacing: .06em;
    color: #cfdbe7; background: transparent; border: 0; border-radius: 999px;
    padding: 7px 13px; cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.lang-switch button:not([aria-pressed="true"]):hover { color: #fff; background: rgba(255, 255, 255, .10); }

.brand-line { height: 3px; background: var(--gradient); }

/* -------------------------------------------------------------------- hero */
.hero {
    background:
        radial-gradient(900px 340px at 92% -10%, rgba(24, 195, 232, .28), transparent 65%),
        radial-gradient(700px 300px at 0% 120%, rgba(11, 145, 230, .25), transparent 70%),
        linear-gradient(180deg, var(--navy-2), var(--navy));
    color: #fff;
    padding: 36px 0 112px;
}
.hero-client {
    display: inline-flex; align-items: center; gap: 10px; margin: 0 0 18px;
    padding: 5px 14px 5px 5px; border-radius: 999px;
    background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
    font-size: 13px; font-weight: 600; color: #e3ecf4;
}
.hero-client img { background: #fff; border-radius: 50%; padding: 1px; }
.eyebrow { margin: 0 0 10px; font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sky); }
.hero h1 { font-size: clamp(28px, 4.2vw, 42px); font-weight: 800; }
.hero-lead { margin: 12px 0 0; max-width: 640px; color: #c9d7e5; font-size: 16px; }

/* -------------------------------------------------------------------- card */
.card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); }
.wizard { margin: -80px 0 48px; padding: 36px 40px 40px; position: relative; overflow: hidden; }
.wizard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--gradient); }

.demo-banner {
    margin: -8px 0 24px; padding: 10px 14px; border-radius: 8px;
    background: var(--amber-50); color: var(--amber-ink); font-size: 13.5px; font-weight: 600;
    border: 1px solid #f6dca3;
}

/* ----------------------------------------------------------------- stepper */
.stepper { list-style: none; margin: 0 0 32px; padding: 0; display: flex; }
.stepper-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; text-align: center; }
.stepper-item:not(:first-child)::before {
    content: ""; position: absolute; top: 17px; right: 50%; width: 100%; height: 2px;
    background: var(--line); z-index: 0;
}
.stepper-item.is-active::before, .stepper-item.is-done::before { background: var(--blue); }
.stepper-dot {
    position: relative; z-index: 1;
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    background: #fff; border: 2px solid var(--line); color: var(--muted);
    font-weight: 800; font-size: 14px; font-family: var(--font-head);
    transition: background .2s, border-color .2s, box-shadow .2s;
}
.stepper-dot svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; display: none; }
.stepper-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stepper-item.is-active .stepper-dot { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 0 0 5px rgba(11, 145, 230, .25); }
.stepper-item.is-active .stepper-label { color: var(--navy); font-weight: 700; }
.stepper-item.is-done .stepper-dot { background: var(--blue); border-color: var(--blue); color: #fff; }
.stepper-item.is-done .stepper-dot .num { display: none; }
.stepper-item.is-done .stepper-dot svg { display: block; }
.stepper-item.is-done .stepper-label { color: var(--ink); }

/* -------------------------------------------------------------------- steps */
.step h2 { font-size: 24px; font-weight: 800; color: var(--navy); }
.step h2:focus { outline: none; }
.step-lead { margin: 6px 0 24px; color: var(--muted); max-width: 680px; }

.alert {
    display: flex; gap: 10px; align-items: flex-start;
    margin: 0 0 20px; padding: 12px 14px; border-radius: 8px;
    background: var(--red-50); color: #8f1d18; border: 1px solid #f5c6c3; font-weight: 600; font-size: 14px;
}
.alert::before { content: "!"; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 13px; }

/* ------------------------------------------------------------------ fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; }
.field input {
    width: 100%; height: 44px; padding: 0 12px;
    font: 400 15px var(--font); color: var(--ink);
    background: #fff; border: 1px solid #c2cfdb; border-radius: 8px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:hover { border-color: #93a9bf; }
.field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(11, 145, 230, .2); }
.field input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px rgba(214, 54, 47, .14); }
.field-error { color: #b4231d; font-size: 12.5px; font-weight: 600; }
.field-error:empty { display: none; }
.hint { color: var(--muted); font-size: 12.5px; }

.req { color: var(--red); display: none; }
.field.is-required .req { display: inline; }

.badge { display: none; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; }
.badge-locked { background: var(--blue-50); color: var(--blue-ink); }
.badge-todo { background: var(--amber-50); color: var(--amber-ink); }
.field.is-locked .badge-locked, .field.is-todo .badge-todo { display: inline-block; }
.field.is-unset .badge-locked { display: none; }

.input-wrap { position: relative; }
.lock-icon {
    display: none; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; fill: none; stroke: #8a9aac; stroke-width: 2; stroke-linecap: round;
}
.field.is-locked input {
    background: var(--field-locked); border-color: #e1e8ef; color: var(--navy-3);
    padding-right: 36px; cursor: default; font-weight: 600;
}
.field.is-locked input:focus { box-shadow: 0 0 0 3px rgba(11, 145, 230, .10); border-color: #c2cfdb; }
.field.is-locked input::placeholder { color: #8a9aac; font-weight: 400; font-style: italic; }
.field.is-locked .lock-icon { display: block; }
.field.is-todo input { border-left: 3px solid var(--amber); }

/* step 1 */
.nif-form { max-width: 560px; }
.nif-row { display: flex; gap: 10px; }
.field-nif input {
    height: 54px; font-size: 20px; font-weight: 600; letter-spacing: .08em;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.field-nif input::placeholder { font-weight: 400; letter-spacing: .04em; color: #9aa8b6; }
.field-nif label { font-size: 14px; }
.field-nif .btn { height: 54px; flex: none; }

.info-box {
    display: flex; gap: 12px; margin-top: 28px; padding: 16px 18px; max-width: 560px;
    background: var(--blue-50); border-radius: var(--radius); color: var(--navy); font-size: 14px;
}
.info-box svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--blue-ink); stroke-width: 2; stroke-linecap: round; }
.info-box p { margin: 2px 0 0; color: #36506b; }

/* step 2 */
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: -6px 0 24px; }
.summary-nif { font-size: 13.5px; color: var(--muted); margin-right: 6px; }
.summary-nif strong { color: var(--ink); letter-spacing: .05em; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chip-locked { background: var(--blue-50); color: var(--blue-ink); }
.chip-todo { background: var(--amber-50); color: var(--amber-ink); }

.group { border: 0; margin: 0 0 8px; padding: 0; }
.group legend {
    width: 100%; padding: 0 0 10px; margin-bottom: 18px; border-bottom: 1px solid var(--line);
    font: 800 16px var(--font-head); color: var(--navy);
}
.group legend::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 2px; background: var(--blue); vertical-align: middle; }
.group + .group { margin-top: 26px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }

.note { display: flex; gap: 8px; align-items: flex-start; margin: 26px 0 0; font-size: 13px; color: var(--muted); }
.note svg { flex: none; width: 15px; height: 15px; margin-top: 2px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }

/* step 3 */
.uploads { display: grid; gap: 16px; }
.upload { border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: border-color .15s; }
.upload.has-file { border-color: #b7d9f3; background: #fbfdff; }
.upload.is-invalid { border-color: #f0b4b1; }
.upload-head { display: flex; gap: 14px; align-items: flex-start; }
.upload-num {
    flex: none; width: 30px; height: 30px; border-radius: 8px;
    display: grid; place-items: center; background: var(--navy); color: #fff;
    font: 800 14px var(--font-head);
}
.upload h3 { font-size: 16px; font-weight: 800; color: var(--navy); }
.upload-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }

.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
    padding: 22px 16px; border: 2px dashed #c3d0dd; border-radius: 10px;
    color: var(--muted); font-size: 14px; cursor: pointer; background: #fafcfe;
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--blue); background: var(--blue-50); }
.dropzone svg { width: 28px; height: 28px; fill: none; stroke: var(--blue-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.dropzone u { color: var(--blue-ink); font-weight: 600; text-underline-offset: 3px; }
.dropzone small { font-size: 12px; }

.file-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.file-thumb {
    flex: none; width: 56px; height: 56px; border-radius: 8px; overflow: hidden;
    display: grid; place-items: center; background: var(--blue-50); border: 1px solid var(--line);
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb.is-pdf { background: var(--red-50); color: var(--red); font-weight: 800; font-size: 13px; letter-spacing: .04em; }
.file-meta { flex: 1; min-width: 140px; display: flex; flex-direction: column; }
.file-name { font-size: 14px; overflow-wrap: anywhere; }
.file-size { color: var(--muted); font-size: 12.5px; }

.consent { display: flex; gap: 12px; align-items: flex-start; margin-top: 24px; padding: 16px; background: var(--bg); border-radius: var(--radius); }
.consent input { flex: none; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--navy); }
.consent label { font-size: 14px; }
#err_consent { margin-top: 6px; }

/* done */
.step-done { text-align: center; }
.step-done .step-lead { margin-left: auto; margin-right: auto; }
.done-icon {
    width: 72px; height: 72px; border-radius: 50%; margin: 8px auto 18px;
    display: grid; place-items: center; background: var(--green-50); color: var(--green);
    box-shadow: 0 0 0 8px rgba(29, 127, 71, .10);
}
.done-icon svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.receipt { max-width: 520px; margin: 0 auto; text-align: left; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.receipt div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 16px; }
.receipt div + div { border-top: 1px solid var(--line); }
.receipt dt { color: var(--muted); font-size: 13.5px; }
.receipt dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
#done-reference { color: var(--blue-ink); font-family: ui-monospace, Consolas, monospace; letter-spacing: .04em; }
.step-done .note { justify-content: center; }

/* ----------------------------------------------------------------- buttons */
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.actions-center { justify-content: center; border-top: 0; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 46px; padding: 0 24px; border-radius: 999px; border: 1px solid transparent;
    font: 700 15px var(--font); cursor: pointer; text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 6px 18px rgba(11, 110, 216, .35); }
.btn-primary:active { background: #0950c4; }
.btn-ghost { background: #fff; color: var(--navy); border-color: #c2cfdb; }
.btn-ghost:hover { border-color: var(--navy); background: var(--bg); }
.btn-link { height: auto; padding: 6px 8px; background: none; color: var(--blue-ink); font-size: 13.5px; border-radius: 6px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #b4231d; }
.btn:disabled { cursor: progress; opacity: .85; }

.spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .8s linear infinite; }
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ footer */
.site-footer { background: var(--navy); color: #a9bbcd; font-size: 13.5px; position: relative; }
.site-footer::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--gradient); }
.footer-inner { display: grid; grid-template-columns: auto 1fr; gap: 12px 32px; align-items: center; padding-top: 30px; padding-bottom: 26px; }
.footer-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.footer-brand img { height: 30px; width: auto; }
.footer-brand span { font-size: 12.5px; color: #8fa5ba; }
.footer-client { display: flex; align-items: center; gap: 12px; justify-self: end; max-width: 420px; text-align: right; }
.footer-client img { flex: none; background: #fff; border-radius: 50%; padding: 1px; order: 2; }
.footer-copy { grid-column: 1 / -1; margin: 10px 0 0; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .10); font-size: 12.5px; color: #7f95ab; }

/* ------------------------------------------------------------------ mobile */
@media (max-width: 720px) {
    .header-inner { min-height: 64px; }
    .brand-logo { height: 30px; }
    .hero { padding: 26px 0 96px; }
    .hero-lead { font-size: 15px; }
    .wizard { padding: 26px 18px 26px; margin-top: -72px; }
    .grid { grid-template-columns: 1fr; }
    .nif-row { flex-direction: column; }
    .field-nif .btn { width: 100%; }
    .stepper-label { font-size: 12px; }
    .actions { flex-direction: column-reverse; }
    .actions .btn { width: 100%; }
    .footer-inner { grid-template-columns: 1fr; }
    .footer-client { justify-self: start; text-align: left; }
    .footer-client img { order: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; }
}
