.portal-shell {
    min-height: calc(100vh - 76px);
    background: var(--slc-soft);
    color: var(--slc-ink);
}

.portal-shell a {
    color: inherit;
}

.portal-wizard {
    min-height: calc(100vh - 76px);
    display: grid;
    background: var(--slc-white);
}

.portal-stage {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 18px 18px 120px;
}

.portal-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .72rem;
    font-weight: 800;
}

.portal-brand-mark {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 2px solid var(--slc-ink);
    background: var(--slc-ink);
    color: var(--slc-white);
    font-size: .68rem;
    line-height: 1;
}

.portal-mobile-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    margin: -16px -16px 16px;
    background: var(--slc-ink, #1a1a1a);
    border-bottom: 1px solid #000;
    color: var(--slc-white, #fff);
}

.portal-mobile-top > span {
    font-family: "Courier New", Courier, monospace;
    font-size: .7rem;
    color: rgba(255, 255, 255, 0.72);
    text-align: right;
}

.portal-progress-row {
    display: grid;
    gap: 8px;
    margin: 18px 0 26px;
    font-family: "Courier New", Courier, monospace;
    font-size: .72rem;
    color: var(--slc-muted);
    text-transform: uppercase;
}

.portal-progress-track {
    height: 6px;
    background: var(--slc-line);
    overflow: hidden;
}

#portal-progress-fill {
    display: block;
    width: 0;
    height: 100%;
    background: var(--slc-orange);
    transition: width 180ms ease;
}

.portal-step-panel {
    display: none;
}

.portal-step-panel.is-active {
    display: block;
}

.portal-kicker {
    margin: 0 0 10px;
    font-family: "Courier New", Courier, monospace;
    font-size: .74rem;
    font-weight: 700;
    color: var(--slc-orange);
    text-transform: uppercase;
}

.portal-step-panel h1,
.portal-status-card h1 {
    margin: 0;
    max-width: 12ch;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.45rem, 12vw, 4.25rem);
    line-height: .9;
    letter-spacing: 0;
}

.portal-lead {
    margin: 20px 0 0;
    max-width: 560px;
    font-size: 1rem;
    line-height: 1.65;
    color: #4a4a4a;
}

.portal-unit-card {
    margin-top: 28px;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    border: 2px solid var(--slc-ink);
    background: var(--slc-white)5f0;
    padding: 10px;
}

.portal-unit-media {
    aspect-ratio: 4 / 3;
    background: #ffd9cf;
    border: 1px solid var(--slc-ink);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.portal-unit-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portal-unit-media svg {
    width: 76%;
    height: auto;
    fill: none;
    stroke: var(--slc-orange);
    stroke-width: 4;
}

.portal-unit-card strong,
.portal-resume-card strong {
    display: block;
    font-size: .98rem;
}

.portal-unit-card span,
.portal-resume-card span {
    display: block;
    margin-top: 6px;
    color: var(--slc-muted);
    font-size: .82rem;
    line-height: 1.4;
}

.portal-task-list {
    margin-top: 28px;
    display: grid;
    gap: 8px;
}

.portal-task-list article {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 14px 0;
    border-top: 1px solid var(--slc-line);
}

.portal-task-list article:last-child {
    border-bottom: 1px solid var(--slc-line);
}

.portal-task-list article > span,
.portal-drop-section legend span {
    font-family: "Courier New", Courier, monospace;
    color: var(--slc-orange);
    font-weight: 700;
}

.portal-task-list strong {
    display: block;
    font-size: 1rem;
}

.portal-task-list small {
    display: block;
    margin-top: 4px;
    color: var(--slc-muted);
    line-height: 1.45;
}

.portal-action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--slc-line);
    backdrop-filter: blur(8px);
}

.portal-primary-action,
.portal-secondary-action,
.portal-secondary-link,
.portal-back-link,
.portal-map-location {
    min-height: 46px;
    border: 2px solid var(--slc-ink);
    border-radius: 0;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    text-transform: uppercase;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .02em;
    cursor: pointer;
}

.portal-primary-action {
    background: var(--slc-orange);
    color: var(--slc-white);
}

.portal-secondary-action,
.portal-secondary-link,
.portal-back-link,
.portal-map-location {
    background: var(--slc-white);
    color: var(--slc-ink);
}

.portal-primary-action:disabled {
    opacity: .42;
    cursor: not-allowed;
}

.portal-small-note {
    margin: 16px 0 0;
    color: var(--slc-muted);
    font-size: .82rem;
    line-height: 1.45;
}

.portal-back-link {
    min-height: auto;
    border: 0;
    padding: 0 0 18px;
    justify-content: flex-start;
    color: var(--slc-muted);
}

.portal-tip,
.portal-photo-summary,
.portal-coords-box,
.portal-notes-box,
.portal-review-grid article {
    border: 1px solid var(--slc-line);
    background: var(--slc-soft);
    padding: 14px;
}

.portal-tip {
    margin-top: 22px;
    color: #084030;
    background: #e8fbf5;
    border-color: var(--slc-mint);
    line-height: 1.5;
}

.portal-photo-summary {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.portal-photo-summary span {
    color: var(--slc-muted);
    font-size: .85rem;
}

.portal-drop-section {
    margin: 18px 0 0;
    padding: 0;
    border: 0;
}

.portal-drop-section legend {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 0;
    font-weight: 800;
}

.portal-drop-section p {
    margin: 8px 0 0;
    color: var(--slc-muted);
    line-height: 1.5;
}

.dropzone {
    margin-top: 12px;
    border: 2px dashed #c0c0c0;
    background: var(--slc-white);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: border-color 120ms, background 120ms;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--slc-orange);
    background: var(--slc-white)5f0;
}

.dropzone.is-complete {
    border-color: var(--slc-mint);
}

.dropzone-empty p {
    margin: 8px 0 4px;
    font-weight: 800;
}

.dropzone-empty small {
    color: var(--slc-muted);
}

.dropzone-icon {
    width: 34px;
    height: 34px;
    margin: 0 auto;
    display: block;
    border: 2px solid var(--slc-ink);
    position: relative;
}

.dropzone-icon::before,
.dropzone-icon::after {
    content: "";
    position: absolute;
    background: var(--slc-ink);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.dropzone-icon::before {
    width: 16px;
    height: 2px;
}

.dropzone-icon::after {
    width: 2px;
    height: 16px;
}

.dropzone-previews {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.dropzone-previews:empty {
    display: none;
}

.preview {
    position: relative;
    margin: 0;
    aspect-ratio: 1 / 1;
    background: var(--slc-line);
    overflow: hidden;
}

.preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border: 2px solid var(--slc-white);
    background: var(--slc-ink);
    color: var(--slc-white);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.portal-map-card {
    position: relative;
    margin-top: 22px;
    border: 2px solid var(--slc-ink);
    background: var(--slc-white);
}

#leaflet-map {
    height: min(58vh, 420px);
    min-height: 320px;
}

.portal-map-location {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}

.portal-coords-box,
.portal-notes-box {
    margin-top: 16px;
}

.portal-coords-box label,
.portal-notes-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 800;
}

.portal-notes-box label span {
    color: var(--slc-muted);
    font-weight: 500;
}

.portal-fallback-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.portal-fallback-row input,
#input-notes {
    width: 100%;
    border: 1px solid #c0c0c0;
    background: var(--slc-white);
    padding: 12px;
    font: inherit;
}

#input-notes {
    min-height: 116px;
    resize: vertical;
}

.portal-coords-box small,
#notes-counter {
    display: block;
    margin-top: 8px;
    color: var(--slc-muted);
    font-size: .8rem;
}

#notes-counter {
    text-align: right;
}

.portal-review-grid {
    margin-top: 26px;
    display: grid;
    gap: 10px;
}

.portal-review-group {
    margin-bottom: 24px;
    display: grid;
    gap: 14px;
    border-bottom: 1px solid var(--slc-line);
    padding-bottom: 24px;
}

.portal-review-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.portal-review-subtitle {
    font-family: var(--slc-title);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--slc-ink);
    margin: 0 0 4px;
}

.review-thumbnails {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.review-thumbnails img {
    width: 64px;
    height: 64px;
    max-width: 64px;
    max-height: 64px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--slc-line);
}

.portal-review-grid article {
    display: grid;
    gap: 4px;
}

.portal-review-grid span {
    color: var(--slc-muted);
    font-size: .8rem;
    text-transform: uppercase;
}

.portal-submit {
    margin-top: 24px;
    display: grid;
    gap: 12px;
}

.portal-submit .portal-primary-action {
    width: 100%;
}

#submit-progress progress {
    width: 100%;
    height: 8px;
}

.hidden {
    display: none !important;
}

.portal-rail {
    display: none;
}

.portal-shell-status {
    display: grid;
    place-items: start center;
    padding: 18px;
}

.portal-status-card {
    width: min(100%, 760px);
    min-height: calc(100vh - 112px);
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: var(--slc-white);
    border: 2px solid var(--slc-ink);
    padding: 18px;
}

.portal-status-card h1 {
    max-width: 11ch;
}

/* ── Timeline horizontal del portal post-pago ────────────────────────────── */
.portal-timeline {
    list-style: none;
    margin: 24px 0 0;
    padding: 4px 0 8px;
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.portal-timeline li {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1 1 0;
    min-width: 110px;
    padding: 0 6px;
    scroll-snap-align: center;
}

/* Línea conectora horizontal hacia el siguiente paso. */
.portal-timeline li::after {
    content: "";
    position: absolute;
    top: 19px;
    left: calc(50% + 24px);
    right: calc(-50% + 24px);
    height: 2px;
    background: #e5e7eb;
    border-radius: 2px;
    z-index: 0;
}

.portal-timeline li:last-child::after {
    display: none;
}

.portal-timeline li.done::after {
    background: var(--slc-mint);
}

.portal-timeline-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--slc-white);
    border: 2px solid #d4d4d4;
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 200ms ease, background 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
    z-index: 1;
}

.portal-timeline-icon svg {
    width: 18px;
    height: 18px;
}

.portal-timeline-body {
    margin-top: 12px;
    min-width: 0;
    width: 100%;
}

.portal-timeline-body strong {
    display: block;
    font-family: var(--slc-title, inherit);
    font-size: 14px;
    margin: 0 0 4px;
    color: #9ca3af;
    letter-spacing: -0.005em;
    line-height: 1.25;
}

.portal-timeline-body span {
    display: block;
    font-size: 12px;
    line-height: 1.45;
    color: #b0b5bd;
    font-weight: 500;
}

/* Estado: completado */
.portal-timeline li.done .portal-timeline-icon {
    background: var(--slc-mint);
    border-color: var(--slc-mint);
    color: var(--slc-white);
    box-shadow: 0 0 0 4px rgba(45, 212, 168, 0.18);
}

.portal-timeline li.done .portal-timeline-body strong {
    color: var(--slc-ink);
}

.portal-timeline li.done .portal-timeline-body span {
    color: var(--slc-muted, #5b6470);
}

/* Estado: actual (en curso) */
.portal-timeline li.current .portal-timeline-icon {
    background: var(--slc-white);
    border-color: var(--slc-orange);
    color: var(--slc-orange);
    box-shadow: 0 0 0 6px rgba(225, 90, 61, 0.16);
    animation: portalPulse 2s ease-in-out infinite;
}

.portal-timeline li.current .portal-timeline-body strong {
    color: var(--slc-orange);
}

.portal-timeline li.current .portal-timeline-body span {
    color: var(--slc-ink);
}

/* Estado: futuro */
.portal-timeline li.upcoming .portal-timeline-icon {
    border-style: dashed;
}

@keyframes portalPulse {
    0%, 100% {
        box-shadow: 0 0 0 6px rgba(225, 90, 61, 0.16);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(225, 90, 61, 0.04);
    }
}

@media (max-width: 640px) {
    /* En movil el timeline pasa a vertical: 6 pasos en horizontal no caben. */
    .portal-timeline {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        overflow-x: visible;
        scroll-snap-type: none;
        padding: 4px 0 0;
    }
    .portal-timeline li {
        flex: 0 0 auto;
        min-width: 0;
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 14px;
        align-items: flex-start;
        text-align: left;
        padding: 10px 0;
    }
    .portal-timeline-icon {
        width: 36px;
        height: 36px;
    }
    .portal-timeline-icon svg {
        width: 16px;
        height: 16px;
    }
    /* Conector vertical en lugar de horizontal. */
    .portal-timeline li::after {
        content: "";
        position: absolute;
        top: 46px;
        bottom: -10px;
        left: 17px;
        right: auto;
        width: 2px;
        height: auto;
        background: #e5e7eb;
    }
    .portal-timeline li:last-child::after {
        display: none;
    }
    .portal-timeline li.done::after {
        background: var(--slc-mint);
    }
    .portal-timeline-body {
        margin-top: 4px;
        width: auto;
        text-align: left;
    }
    .portal-timeline-body strong {
        font-size: 15px;
    }
    .portal-timeline-body span {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portal-timeline li.current .portal-timeline-icon {
        animation: none;
    }
}

.portal-existing-photos h2 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.portal-photo-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.portal-photo-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.portal-status-footer {
    margin-top: auto;
    display: grid;
    gap: 12px;
    color: var(--slc-muted);
    font-size: .86rem;
}

.error-message {
    color: #b42318;
    font-weight: 700;
}

/* ── Responsive: pantalla de status (post-pago) en movil ──────────────────── */
@media (max-width: 640px) {
    .portal-shell-status {
        padding: 12px;
    }

    .portal-status-card {
        padding: 18px 16px 22px;
        gap: 16px;
        min-height: auto;
        border-width: 1px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .portal-status-card .brand-mark img {
        height: 42px;
    }

    .portal-status-card h1 {
        font-size: clamp(1.7rem, 7.5vw, 2.2rem);
        line-height: 1.1;
        max-width: 100%;
        letter-spacing: -0.01em;
    }

    .portal-kicker {
        font-size: 0.68rem;
        margin-bottom: 6px;
    }

    .portal-lead {
        margin-top: 12px;
        font-size: 0.95rem;
        line-height: 1.55;
        max-width: 100%;
    }

    .portal-existing-photos {
        margin-top: 4px;
    }

    .portal-existing-photos h2 {
        font-size: 0.95rem;
    }

    .portal-photo-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .portal-status-footer {
        font-size: 0.8rem;
        gap: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--slc-line);
    }

    .portal-status-footer .portal-secondary-link {
        font-size: 0.85rem;
    }
}

@media (min-width: 760px) {
    .portal-stage {
        padding-inline: 28px;
    }

    .portal-step-panel h1,
    .portal-status-card h1 {
        font-size: 4.6rem;
    }

    .dropzone-previews {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1040px) {
    .portal-wizard {
        min-height: calc(100vh - 76px);
        grid-template-columns: 340px minmax(0, 1fr);
    }

    .portal-rail {
        display: flex;
        flex-direction: column;
        gap: 24px;
        min-height: calc(100vh - 76px);
        padding: 28px;
        border-right: 2px solid var(--slc-ink);
        background: var(--slc-soft);
    }

    .portal-mobile-top {
        display: none;
    }

    .portal-stage {
        max-width: 840px;
        padding: 48px 56px 72px;
    }

    .portal-progress-row {
        margin-top: 0;
    }

    .portal-rail-block {
        display: grid;
        gap: 18px;
    }

    .portal-rail-block h2 {
        margin: 0;
        font-family: Georgia, "Times New Roman", serif;
        font-size: 2.1rem;
        line-height: .95;
    }

    .portal-rail-steps {
        list-style: none;
        margin: 0;
        padding: 0;
        display: grid;
        gap: 6px;
    }

    .portal-rail-steps li {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 10px;
        padding: 11px 0;
        color: var(--slc-muted);
        border-top: 1px solid var(--slc-line);
        font-weight: 700;
    }

    .portal-rail-steps li.is-active {
        color: var(--slc-ink);
    }

    .portal-rail-steps li span,
    .portal-resume-card p {
        font-family: "Courier New", Courier, monospace;
        color: var(--slc-orange);
        font-size: .75rem;
        font-weight: 700;
    }

    .portal-resume-card {
        margin-top: 130px;
        border: 2px solid var(--slc-ink);
        background: var(--slc-white);
        padding: 16px;
    }

    .portal-resume-card p {
        margin: 0 0 10px;
    }

    .portal-action-bar {
        position: static;
        margin-top: 34px;
        padding: 0;
        border-top: 0;
        background: transparent;
        backdrop-filter: none;
        grid-template-columns: auto auto;
        justify-content: start;
    }

    .portal-primary-action,
    .portal-secondary-action,
    .portal-secondary-link {
        min-width: 170px;
    }

    .portal-status-card {
        margin-top: 28px;
        padding: 34px;
        min-height: auto;
    }
}
