/*
 * Portail citoyen : un écran, une décision.
 * Dépend de tokens.css.
 */

.steps {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.steps i {
    height: 4px;
    flex: 1;
    border-radius: 2px;
    background: var(--line);
}

.steps i.is-done { background: var(--accent); }
.steps i.is-now { background: var(--accent); opacity: .45; }

.eyebrow {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.screen {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* sans JavaScript, tous les écrans restent lisibles à la suite */
.has-js .screen { display: none; }
.has-js .screen.is-active { display: flex; }

.screen > h1 { margin-bottom: 8px; }

.lead {
    color: var(--ink-2);
    font-size: var(--t-sm);
    margin: 0 0 18px;
}

.spacer { flex: 1; min-height: 16px; }

.screen-center {
    text-align: center;
    align-items: center;
}

.screen-center > * { width: 100%; }

.tick {
    width: 62px;
    height: 62px;
    margin: 26px auto 18px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-on);
    display: grid;
    place-items: center;
}

.tick svg { width: 30px; height: 30px; display: block; }

.purpose-card,
.scan-card {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    text-align: left;
}

.purpose-card h2,
.scan-card h2 {
    margin: 0 0 6px;
    font-size: var(--t-base);
}

.purpose-card p,
.scan-card p {
    margin: 0;
    color: var(--ink-2);
    font-size: var(--t-sm);
}

.purpose-card .hint,
.scan-card .hint { margin-top: 8px; }

.scan-card {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.scan-card .btn { width: 100%; }

.scan-status {
    min-height: 1.35em;
    color: var(--accent) !important;
    font-weight: 700;
}

.input-action {
    position: relative;
}

.input-action input {
    width: 100%;
    padding-right: 58px;
    font-family: var(--mono);
    letter-spacing: .08em;
}

.input-action-button {
    position: absolute;
    top: 5px;
    right: 5px;
    display: grid;
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: calc(var(--radius) - 2px);
    background: var(--accent-soft);
    color: var(--accent);
    cursor: pointer;
}

.input-action-button:hover { background: var(--line); }

.input-action-button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.input-action-button:disabled {
    opacity: .55;
    cursor: wait;
}

.input-action-button svg { width: 22px; height: 22px; }

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.field-grid .field { margin: 0; }

.identity-review-hint { margin-top: 10px; }

/* ---------- téléphone ---------- */

.contact-methods {
    display: grid;
    gap: 8px;
    margin: 0 0 18px;
    padding: 0;
    border: 0;
}

.contact-methods legend {
    margin-bottom: 8px;
    font-size: var(--t-xs);
    font-weight: 700;
    color: var(--ink-2);
}

.contact-method {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--tap);
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
}

.contact-method:has(input:checked) {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
    background: var(--accent-soft);
}

.contact-method input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    min-height: 0;
    margin: 0;
    accent-color: var(--accent);
}

.contact-method span { display: grid; gap: 2px; }
.contact-method b { font-size: var(--t-sm); text-transform: capitalize; }
.contact-method small { color: var(--ink-3); font-size: var(--t-xs); }

.telrow { display: flex; gap: 8px; }

.telrow .prefix {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: var(--t-base);
}

.telrow input {
    flex: 1;
    font-family: var(--mono);
    letter-spacing: .08em;
}

@media (max-width: 520px) {
    .field-grid { grid-template-columns: 1fr; }
}

/* ---------- code OTP ---------- */

.otp {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.otp input {
    flex: 1;
    min-width: 0;
    padding: 12px 0;
    text-align: center;
    font-family: var(--mono);
    font-size: 1.25rem;
    font-weight: 500;
}

.otp input::-webkit-outer-spin-button,
.otp input::-webkit-inner-spin-button {
    appearance: none;
    margin: 0;
}

.otpmeta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: var(--t-xs);
    color: var(--ink-3);
    margin-bottom: 16px;
}

.otpmeta button {
    background: none;
    border: 0;
    padding: 6px 0;
    font-family: inherit;
    font-size: var(--t-xs);
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
}

.otpmeta button[disabled] {
    color: var(--ink-3);
    font-weight: 400;
    cursor: default;
}

.channels {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.channels button {
    text-align: left;
    padding: 11px 13px;
    min-height: var(--tap);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink-2);
    font-family: inherit;
    font-size: var(--t-sm);
    cursor: pointer;
}

.channels button:hover { border-color: var(--line-strong); }

.fallback-card {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--warn);
    border-radius: var(--radius-lg);
    background: var(--warn-soft);
    color: var(--ink);
}

.fallback-card h2 {
    margin: 0 0 6px;
    font-size: var(--t-base);
}

.fallback-card p {
    margin: 0 0 12px;
    color: var(--ink-2);
    font-size: var(--t-sm);
}

.fallback-card .btn { width: 100%; }

/* ---------- pièces ---------- */

.cardart {
    display: grid;
    place-items: center;
    gap: 8px;
    aspect-ratio: 8 / 5;
    margin-bottom: 16px;
    border: 2px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: var(--t-xs);
    text-align: center;
    padding: 12px;
}

.cardart svg { width: 72px; height: 45px; }
.cardart.is-portrait { aspect-ratio: 4 / 5; max-height: 300px; }
.cardart.is-portrait svg { width: 54px; height: 68px; }

.shot {
    position: relative;
    margin-bottom: 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--doc-bg);
}

.shot img {
    display: block;
    width: 100%;
    height: auto;
}

.shot figcaption {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 3px;
    background: rgba(18, 22, 28, .8);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
}

.journey-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.journey-actions button {
    min-height: var(--tap);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: 700 var(--t-xs) var(--font);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.journey-actions button:last-child { color: var(--critical); }

.thumbs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.thumbs .shot { margin: 0; }

.progress { margin-bottom: 16px; }

.progress-head {
    display: flex;
    justify-content: space-between;
    font-size: var(--t-xs);
    color: var(--ink-2);
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}

.progress-track {
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    border-radius: 3px;
    background: var(--accent);
    transition: width .25s linear;
}

/* ---------- listes de contrôle ---------- */

.checks { margin-bottom: 16px; display: grid; gap: 10px; }

.checkline {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: var(--t-sm);
    color: var(--ink-2);
}

.checkline .box {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin-top: 2px;
    border: 2px solid var(--line-strong);
    border-radius: 4px;
}

.checkline.is-done .box {
    background: var(--accent);
    border-color: var(--accent);
}

.checkline.is-tip .box {
    width: 6px;
    height: 6px;
    margin: 8px 5px 0;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
}

.consent {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 12px 0;
    font-size: var(--t-sm);
    color: var(--ink-2);
    cursor: pointer;
}

.consent input {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    min-height: 0;
    margin: 1px 0 0;
    accent-color: var(--accent);
}

/* ---------- récapitulatif ---------- */

.kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    margin: 0 0 18px;
    font-size: var(--t-sm);
    align-items: baseline;
}

.kv dt {
    color: var(--ink-3);
    font-size: var(--t-xs);
    font-weight: 600;
}

.kv dd {
    margin: 0;
    font-family: var(--mono);
    font-size: var(--t-sm);
}

.reference {
    margin: 0 0 18px;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 1.35rem;
    letter-spacing: .08em;
    text-align: center;
}

.reference-eyebrow { margin-top: 4px; }

.qr-card {
    width: 100%;
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 16px;
    align-items: center;
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    text-align: left;
}

.qr-code {
    width: 132px;
    min-height: 132px;
    aspect-ratio: 1;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #FFFFFF;
}

.qr-code svg { display: block; width: 100%; height: 100%; }
.qr-copy h2 { margin: 0 0 6px; font-size: var(--t-base); }
.qr-copy p { margin: 0 0 8px; color: var(--ink-2); font-size: var(--t-sm); }

.tracking-screen { justify-content: flex-start; padding-top: 28px; }
.tracking-lookup-form { display: grid; gap: 16px; margin-top: 10px; }
.tracking-lookup-form .btn { width: 100%; }
.tracking-reference { margin-bottom: 20px; }
.tracking-auth, .tracking-status { margin-top: 0; text-align: left; }
.tracking-auth .btn { width: 100%; margin-top: 12px; }
.tracking-error { margin-top: 14px; }
.tracking-auth h2, .tracking-status h2 { margin: 0 0 8px; }
.tracking-auth p, .tracking-status p { color: var(--ink-2); }
.tracking-help { margin: 16px 0; color: var(--ink-3); font-size: var(--t-xs); }
.is-hidden { display: none !important; }

@media (max-width: 440px) {
    .qr-card { grid-template-columns: 1fr; text-align: center; }
    .qr-code { margin: 0 auto; }
}

/* ---------- accueil et répertoire ---------- */

.home-hero { padding: 8px 0 24px; }
.home-hero h1 { margin-bottom: 10px; }
.page-links { margin-top: 20px; }
.text-center { text-align: center; }
.next-step-card { margin-top: 22px; text-align: left; }
.next-step-lead { margin: 8px 0 0; }

.trust {
    display: grid;
    gap: 10px;
    margin: 20px 0;
    padding: 0;
    list-style: none;
    font-size: var(--t-sm);
    color: var(--ink-2);
}

.trust li { display: flex; gap: 10px; align-items: flex-start; }

.trust svg {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin-top: 2px;
    color: var(--accent);
}

.directory { max-width: 880px; }

.dirsum {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 18px;
}

.dirsum div { background: var(--surface); padding: 12px 14px; }
.dirsum b { display: block; font-size: var(--t-xl); font-variant-numeric: tabular-nums; }
.dirsum span { font-size: var(--t-xs); color: var(--ink-3); }

.dirtable-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.dirtable {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: var(--t-sm);
}

.dirtable th {
    text-align: left;
    padding: 11px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-3);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}

.dirtable td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.dirtable tr:last-child td { border-bottom: 0; }
.dirtable td.num { font-family: var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }

@media (min-width: 720px) {
    .shell { padding-bottom: 48px; }
}

details > summary {
    min-height: var(--tap);
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: var(--t-sm);
    font-weight: 600;
    color: var(--accent);
}

details[open] > summary { margin-bottom: 10px; }
