/* ---- tokens: taken from 2doit.nu (Elementor kit + home page) ---- */
:root {
    --brand-dark: #002027;   /* home hero band */
    --ink: #113A4E;          /* Syne headings */
    --text: #1F2A30;
    --muted: #4F6470;        /* secondary text, AA on white and --card */
    --blue: #007CBA;         /* every button on the site */
    --blue-dark: #00679B;
    --sky: #D4E9F5;          /* header bar */
    --sky-line: #BED9E7;     /* header accents; our rules and borders */
    --sky-soft: #EEF6FF;
    --card: #F5F7F9;         /* post cards; our page background */
    --white: #FFFFFF;
    --ok: #079E7A;
    --err: #BA1139;
    --warn-bg: #FFF4D6;

    --font-head: 'Syne', 'DM Sans', sans-serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    /* 1.25 scale on a 16px base */
    --fs-sm: 0.875rem;
    --fs-base: 1rem;
    --fs-md: 1.25rem;
    --fs-lg: 1.5625rem;
    --fs-xl: 1.953rem;
    --fs-xxl: 2.75rem;

    --bs-body-font-family: var(--font-body);
    --bs-body-font-size: var(--fs-base);
    --bs-body-line-height: 1.55;
    --bs-body-bg: var(--card);
    --bs-body-color: var(--text);
    --bs-border-color: var(--sky-line);
    --bs-link-color-rgb: 0, 124, 186;
    --bs-link-hover-color-rgb: 0, 103, 155;
    --bs-secondary-color: var(--muted);
    --bs-form-invalid-border-color: var(--err);
    --bs-form-invalid-color: var(--err);
}

::selection {
    background: var(--sky);
    color: var(--ink);
}

/* keeps the footer at the bottom on short pages */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--card);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--font-head);
    font-weight: 600;
    color: var(--ink);
    line-height: 1.15;
}

h1:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

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

/* ---- hero band, as on the 2doit.nu home page ---- */
.hero {
    background: var(--brand-dark);
    color: var(--white);
    padding: 3.5rem 0 6.5rem;
}

    /* message-only pages: the band runs down to the footer instead of leaving an empty slab */
    .hero.hero-short {
        padding-bottom: 3.5rem;
        flex: 1 0 auto;
    }

/* global, not in MainLayout.razor.css: the hero is rendered by the page, outside the layout's CSS scope */
main:has(> .hero.hero-short) {
    padding-bottom: 0;
}

/* the head shares the logo's left edge; only its text is kept to a readable width */
.page-head > h1, .page-head > p {
    max-width: 42rem;
}

    .page-head h1 {
        color: var(--white);
        font-size: var(--fs-xxl);
        margin: 0 0 0.75rem;
    }

    .page-head p {
        font-size: var(--fs-md);
        color: rgba(255, 255, 255, 0.82);
        margin: 0;
    }

    .page-head .btn {
        margin-top: 1.75rem;
    }

@media (max-width: 575.98px) {
    .hero {
        padding: 2.25rem 0 5rem;
    }

    .page-head h1 {
        font-size: var(--fs-xl);
    }

    .page-head p {
        font-size: var(--fs-base);
    }
}

/* the panel and voucher overlap the band's lower edge */
.wizard-wrap {
    margin-top: -4rem;
}

/* ---- two columns: form + voucher ---- */
.wizard {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 2rem;
    align-items: start;
}

.wizard-aside {
    position: sticky;
    top: 1.5rem;
}

@media (max-width: 899.98px) {
    .wizard {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    /* the compact voucher strip sits above the form */
    .wizard-aside {
        position: static;
        order: -1;
    }

    /* an empty voucher strip only pushes the form down */
    .hide-on-small {
        display: none;
    }
}

.panel {
    background: var(--white);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 1px 2px rgba(0, 32, 39, 0.06), 0 8px 24px rgba(0, 32, 39, 0.06);
}

@media (max-width: 575.98px) {
    .panel {
        padding: 1.25rem;
    }
}

.panel h2 {
    font-size: var(--fs-lg);
    margin: 0 0 0.35rem;
}

.panel-intro {
    color: var(--muted);
    margin: 0 0 1.5rem;
}

/* ---- field mapping: a tab per entity, one row per shop field, hairline rows like .ledger ---- */
.mapping-tabs {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--sky-line);
}

.mapping-tab {
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 0.4rem 0;
    font-weight: 500;
    color: var(--muted);
}

    .mapping-tab:hover {
        color: var(--ink);
    }

    .mapping-tab.is-active {
        color: var(--ink);
        border-bottom-color: var(--blue);
    }

    .mapping-tab:focus-visible {
        outline: 2px solid var(--blue);
        outline-offset: 2px;
        border-radius: 4px;
    }

.mapping-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--sky-line);
    border-radius: 10px;
    overflow: hidden;
}

    .mapping-table th, .mapping-table td {
        padding: 0.3rem 0.75rem;
        vertical-align: middle;
        border-top: 1px solid var(--sky-line);
    }

    .mapping-table thead th {
        border-top: 0;
        background: var(--sky-soft);
        font-size: var(--fs-sm);
        font-weight: 500;
        color: var(--muted);
    }

    .mapping-table thead th:first-child, .mapping-table tbody th {
        width: 40%;
    }

    .mapping-table tbody th {
        font-weight: 500;
        color: var(--ink);
    }

        .mapping-table tbody th label {
            margin: 0;
        }

    /* heading for a run of related rows, e.g. the delivery address; quieter than a field row */
    .mapping-table .mapping-group th {
        width: auto;
        padding-top: 0.75rem;
        padding-bottom: 0.2rem;
        font-size: var(--fs-sm);
        font-weight: 500;
        color: var(--muted);
    }

    /* a link that can't be changed (SKU = item number): plain text, aligned with the text inside the selects */
    .mapping-fixed {
        display: inline-block;
        padding: 0.3rem 0.6rem;
        font-size: var(--fs-sm);
        color: var(--text);
    }

    .mapping-fixed-note {
        font-size: var(--fs-sm);
        color: var(--muted);
    }

    /* this row no longer uses the usual field: tint the row, outline the choice */
    .mapping-table .is-changed {
        background: var(--sky-soft);
    }

        .mapping-table .is-changed .form-select {
            border-color: var(--blue);
        }

    .mapping-table .is-off th, .mapping-table .is-off .form-select {
        color: var(--muted);
    }

    .mapping-table.is-invalid {
        border-color: var(--err);
    }

.form-select.form-select-sm {
    font-size: var(--fs-sm);
    padding: 0.3rem 2rem 0.3rem 0.6rem;
    border-radius: 8px;
}

.mapping-reset {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

    .mapping-reset .btn-quiet {
        font-size: var(--fs-sm);
        padding: 0.35rem 0;
    }

.mapping-summary {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.2rem 1rem;
    margin: 0;
    font-size: var(--fs-sm);
}

    .mapping-summary dt {
        font-weight: 400;
        color: var(--muted);
    }

    .mapping-summary dd {
        margin: 0;
        color: var(--text);
    }

@media (max-width: 575.98px) {
    .mapping-table thead {
        display: none;
    }

    .mapping-table tr {
        display: block;
        padding: 0.5rem 0.75rem;
        border-top: 1px solid var(--sky-line);
    }

    .mapping-table tbody tr:first-child {
        border-top: 0;
    }

    .mapping-table tbody th, .mapping-table td {
        display: block;
        width: auto;
        padding: 0;
        border-top: 0;
    }

    .mapping-table tbody th {
        font-size: var(--fs-sm);
        margin-bottom: 0.25rem;
    }

    /* the row already has padding here */
    .mapping-table .mapping-group th {
        padding: 0;
        margin-bottom: 0;
    }
}

/* ---- stepper: a real sequence ---- */
.stepper {
    display: flex;
    gap: 0.75rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1.75rem;
}

    .stepper li {
        flex: 1;
        border-top: 3px solid var(--sky-line);
        padding-top: 0.5rem;
        color: var(--muted);
        font-size: var(--fs-sm);
        font-variant-numeric: tabular-nums;
    }

    /* weight only: a wider face would wrap the active label on phones */
    .stepper .is-active {
        border-color: var(--blue);
        color: var(--ink);
        font-weight: 600;
    }

    .stepper .is-done {
        border-color: var(--ok);
    }

        .stepper .is-done::before {
            content: "✓ ";
            color: var(--ok);
        }

/* phones: only the current step keeps its name */
@media (max-width: 575.98px) {
    .stepper li:not(.is-active) .step-label {
        display: none;
    }

    .stepper li:not(.is-active) {
        flex: 0 0 3.5rem;
    }

    .stepper .is-active {
        flex: 1;
    }
}

/* ---- fields ---- */
.field {
    margin-bottom: 1.25rem;
}

    .field label, .field-label {
        display: block;
        font-weight: 500;
        color: var(--ink);
        margin-bottom: 0.35rem;
    }

.label-note {
    font-weight: 400;
    color: var(--muted);
}

.hint {
    color: var(--muted);
    font-size: var(--fs-sm);
    margin-top: 0.35rem;
}

.form-control, .form-select, .input-group-text {
    font-size: var(--fs-base);
    border-color: var(--sky-line);
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
}

.form-control, .form-select {
    background-color: var(--white);
    color: var(--text);
}

    /* lighter than real input, so an example never passes for a filled-in value */
    .form-control::placeholder {
        color: #9BB0BC;
    }

    .form-control:focus, .form-select:focus {
        border-color: var(--blue);
        box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.2);
    }

    .form-control.is-invalid:focus {
        border-color: var(--err);
        box-shadow: 0 0 0 3px rgba(186, 17, 57, 0.18);
    }

    .form-control:disabled {
        background-color: var(--card);
        color: var(--muted);
    }

.input-group-text {
    background: var(--sky-soft);
    color: var(--muted);
}

.form-check-input {
    border-color: var(--muted);
}

    .form-check-input:checked {
        background-color: var(--blue);
        border-color: var(--blue);
    }

.availability {
    font-size: var(--fs-sm);
    margin-top: 0.35rem;
    min-height: 1.2em;
    transition: color 150ms ease;
}

.is-ok {
    color: var(--ok);
}

.is-err {
    color: var(--err);
}

/* ---- buttons: pills, as on 2doit.nu ---- */
.actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.75rem;
}

    .actions .btn-primary {
        margin-left: auto;
    }

.btn {
    font-weight: 500;
    border-radius: 999px;
    padding: 0.8rem 1.9rem;
}

.btn-sm {
    padding: 0.35rem 1rem;
}

.btn-primary {
    --bs-btn-bg: var(--blue);
    --bs-btn-border-color: var(--blue);
    --bs-btn-hover-bg: var(--blue-dark);
    --bs-btn-hover-border-color: var(--blue-dark);
    --bs-btn-active-bg: var(--blue-dark);
    --bs-btn-active-border-color: var(--blue-dark);
    --bs-btn-disabled-bg: var(--blue);
    --bs-btn-disabled-border-color: var(--blue);
}

.btn-outline-dark {
    --bs-btn-color: var(--ink);
    --bs-btn-border-color: var(--ink);
    --bs-btn-hover-bg: var(--ink);
    --bs-btn-hover-border-color: var(--ink);
}

.btn-quiet {
    background: none;
    border: 0;
    padding: 0.6rem 0;
    color: var(--muted);
    font-weight: 500;
}

    .btn-quiet:hover {
        color: var(--ink);
        text-decoration: underline;
    }

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-back-icon {
    width: 1em;
    height: 1em;
    flex: none;
    transition: transform 0.15s ease;
}

    .btn-back:hover:not(:disabled) .btn-back-icon {
        transform: translateX(-3px);
    }

@media (prefers-reduced-motion: reduce) {
    .btn-back-icon {
        transition: none;
    }
}

.btn-busy::after {
    content: "";
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    margin-left: 0.5em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -0.1em;
    animation: spin 700ms linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- messages: thin full rule + tint ---- */
.note {
    border: 1px solid var(--sky-line);
    padding: 0.65rem 0.95rem;
    margin-bottom: 1.25rem;
    background: var(--sky-soft);
    border-radius: 10px;
}

.note-err {
    border-color: #EBB7C2;
    color: var(--err);
    background: #FCEEF1;
}

.note-ok {
    border-color: #A9DCCD;
    background: #E9F7F2;
}

.note-warn {
    border-color: #E8C766;
    background: var(--warn-bg);
}

/* ---- status: overall progress bar above the steps ---- */
.progress-block {
    margin: 0 0 1rem;
}

.progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--sky-line);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
    transition: width 400ms ease-out;
}

.progress-block.is-done .progress-fill {
    background: var(--ok);
}

.progress-block.is-failed .progress-fill {
    background: var(--err);
}

.progress-text {
    margin: 0.5rem 0 0;
    font-size: 0.9em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
    .progress-fill {
        transition: none;
    }
}

/* ---- status: provisioning steps as ruled rows ---- */
.ledger {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}

    .ledger li {
        display: grid;
        grid-template-columns: 1.75rem 1fr;
        align-items: baseline;
        padding: 0.6rem 0;
        border-bottom: 1px solid var(--sky-line);
        color: var(--muted);
        font-variant-numeric: tabular-nums;
    }

    .ledger .is-done {
        color: var(--text);
    }

        .ledger .is-done .step-mark {
            color: var(--ok);
        }

    .ledger .is-current {
        color: var(--ink);
        font-weight: 600;
    }

        .ledger .is-current .step-mark {
            color: var(--blue);
        }

    .ledger .is-failed {
        color: var(--err);
        font-weight: 600;
    }

    .ledger .is-warning {
        color: var(--text);
    }

        .ledger .is-warning .step-mark {
            color: #C99A00;
            font-weight: 700;
        }

    .ledger .step-note {
        grid-column: 2;
        margin: 0.4rem 0 0;
        font-size: 0.9em;
        font-weight: 400;
        color: var(--muted);
    }

        .ledger .step-note.note-err {
            color: var(--err);
        }

.mark-spin {
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.secret-block {
    background: var(--warn-bg);
    border: 1px dashed #C99A00;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
}

    .secret-block p {
        margin: 0 0 0.6rem;
    }

.secret-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.secret-value {
    font-size: var(--fs-md);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    user-select: all;
    word-break: break-all;
}

.tech-details summary {
    color: var(--muted);
    font-size: var(--fs-sm);
    cursor: pointer;
}

.tech-log {
    margin-top: 0.5rem;
    background: var(--brand-dark);
    color: #D6E6EE;
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    max-height: 280px;
    overflow: auto;
    white-space: pre-wrap;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---- template leftovers still used by Blazor ---- */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--ok);
}

.invalid {
    outline: 1px solid var(--err);
}

.validation-message {
    color: var(--err);
}

.blazor-error-boundary {
    background: var(--err);
    padding: 1rem 1.25rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "Something stopped working on this page. Reload to continue.";
    }
