﻿.auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
}

.card {
    width: 100%;
    max-width: 515px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-body {
    padding: 32px;
    min-height: 470px;
    display: flex;
    flex-direction: column;
}

.card-footer {
    padding: 16px;
    border-top: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 32px;
}

.brand-logo {
    height: 48px;
    width: auto;
    max-width: 100%;
}

.brand-text {
    color: var(--brand);
    font-size: 34px;
    font-weight: 700;
    line-height: 1.4;
}

.card-title {
    margin: 0 0 24px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    color: var(--text);
}

.card-text {
    margin: 0 0 28px;
    font-size: 14px;
    color: var(--muted);
    text-align: center;
    line-height: 2;
}

.card-text strong {
    color: var(--text);
    font-weight: 600;
}

.card-spacer {
    flex: 1 1 auto;
}

.error-code {
    margin: 0 0 4px;
    color: var(--brand);
    font-size: 44px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.form-error {
    margin: 0 0 20px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 13px;
    line-height: 1.9;
}

.form-error ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.form-error.validation-summary-valid {
    display: none;
}

/* A message written as prose rather than assembled from validation errors: its own line
   breaks are meaningful, and it reads at body size rather than as fine print. */
.form-prose {
    font-size: 14px;
    text-align: start;
    white-space: pre-line;
}

.form-notice {
    margin: 0 0 20px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 13px;
    line-height: 1.9;
}

.field {
    position: relative;
    display: flex;
    align-items: center;
    height: 64px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: border-color .15s, box-shadow .15s;
}

/* A field holding prose rather than a single value — an address runs past one line,
   and the fixed 64px row cut it off mid-street. Auto height instead of a taller fixed
   one so it still looks right when the value is short. */
.field-tall {
    height: auto;
    min-height: 104px;
    align-items: stretch;
    padding: 16px 14px 12px;
}

.field-tall .field-input {
    /* start, not left: this is Persian prose, and left-aligning it in an RTL card
       only looked acceptable while it was one short line. */
    text-align: start;
    line-height: 2;
    resize: vertical;
    min-height: 72px;
}

.field:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.field.is-error {
    border-color: var(--danger);
}

.field.is-error:focus-within {
    box-shadow: 0 0 0 3px var(--focus-ring-danger);
}

.field-label {
    position: absolute;
    top: -9px;
    right: 12px;
    padding: 0 6px;
    background: var(--card);
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
}

.field:focus-within .field-label {
    color: var(--brand);
}

.field.is-error .field-label {
    color: var(--danger);
}

.field-tel {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    direction: ltr;
}

.field-prefix {
    flex: 0 0 auto;
    color: var(--text);
    font-size: 15px;
    user-select: none;
}

.field-sep {
    flex: 0 0 auto;
    width: 1px;
    height: 26px;
    background: var(--line);
}

.field-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    letter-spacing: .04em;
    text-align: left;
}

.field-input:focus {
    outline: none;
}

.field-input::placeholder {
    color: var(--placeholder);
    letter-spacing: .12em;
}

.field-otp {
    justify-content: center;
}

.otp-input {
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: .7em;

    text-indent: .7em;
    text-align: center;
    direction: ltr;
}

.otp-input:focus {
    outline: none;
}

.otp-input::placeholder {
    color: var(--placeholder);
    font-weight: 400;
}

.form-meta {
    margin: 20px 0 0;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.countdown {
    font-variant-numeric: tabular-nums;
    color: var(--text);
    font-weight: 600;
}

.form-meta-alt {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.link {
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.link:hover {
    text-decoration: underline;
}

.link[disabled],
.link[aria-disabled="true"] {
    color: var(--disabled-ink);
    cursor: not-allowed;
    text-decoration: none;
    pointer-events: none;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: var(--brand-ink);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s;
}

.btn:hover:not(:disabled) {
    background: var(--brand-dark);
}

.btn:disabled {
    background: var(--disabled-bg);
    color: var(--disabled-ink);
    cursor: not-allowed;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-family: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}

.choice:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.choice-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.choice-title {
    font-size: 15px;
    font-weight: 600;
}

.choice-desc {
    color: var(--muted);
    font-size: 13px;
}

.choice-arrow {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    color: var(--muted);
}

.choice:hover .choice-arrow {
    color: var(--brand);
}

.auth-aside {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 40px 32px;
    background: var(--aside-bg);
    color: var(--aside-ink);
    text-align: center;
}

.aside-title {
    margin: 0;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.6;
}

.aside-figure {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 24px 0;
}

.aside-figure img {
    max-width: 390px;
    width: 100%;
    height: auto;
}

.aside-heading {
    margin: 0 0 12px;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.6;
}

.aside-body {
    margin: 0;
    max-width: 740px;
    font-size: 15px;
    line-height: 2.1;
    opacity: .95;
}

/* An announcement on the brand-coloured aside. The panel is already a solid colour, so
   the notice is carved out of it with translucency and an edge rather than given a tint
   of its own — a red or amber box here would fight the background. */
.aside-notice {
    box-sizing: border-box;
    margin: 24px 0 0;
    padding: 14px 16px;
    max-width: 740px;
    border-radius: 10px;
    border-inline-start: 4px solid var(--aside-ink);
    background: rgba(0, 0, 0, .18);
    color: var(--aside-ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 2.1;
    text-align: start;
    /* The text is admin-written prose; its line breaks are part of the message. */
    white-space: pre-line;
}

.aside-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
}

.aside-dots span {
    width: 6px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .45);
}

.aside-dots span.is-active {
    width: 18px;
    background: var(--aside-ink);
}

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

    .auth-aside {
        display: none;
    }
}

@media (max-width: 520px) {
    .auth-main {
        padding: 16px 12px;
    }

    .card-body {
        padding: 24px 20px;
        min-height: 0;
    }

    .brand {
        margin-bottom: 24px;
    }

    .brand-logo {
        height: 38px;
    }

    .brand-text {
        font-size: 28px;
    }
}

.card-wide {
    max-width: 760px;
}

.steps {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
}

.steps li {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    text-align: center;
}

.steps li:not(:first-child)::before {
    content: "";
    position: absolute;
    top: 13px;

    inset-inline-end: 50%;
    width: 100%;
    height: 2px;
    background: var(--line);
}

.steps li.is-done:not(:first-child)::before,
.steps li.is-current:not(:first-child)::before {
    background: var(--brand);
}

.step-bullet {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--line);
    background: var(--card);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.steps li.is-done .step-bullet {
    border-color: var(--brand);
    background: var(--brand);
    color: var(--brand-ink);
}

.steps li.is-current .step-bullet {
    border-color: var(--brand);
    color: var(--brand);
}

.step-label {
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
}

.steps li.is-current .step-label {
    color: var(--text);
    font-weight: 600;
}

/* Nine steps in the width that used to hold four. */
.steps-compact {
    gap: 2px;
}

.steps-compact .step-bullet {
    width: 24px;
    height: 24px;
    font-size: 11px;
}

.steps-compact li:not(:first-child)::before {
    top: 11px;
}

.steps-compact .step-label {
    font-size: 11px;
    line-height: 1.5;
}

/* Below this the labels stop being readable, so only the current one is named. */
@media (max-width: 620px) {
    .steps-compact .step-label {
        display: none;
    }

    .steps-compact li.is-current .step-label {
        display: block;
        position: absolute;
        top: 30px;
        inset-inline: -20px;
        white-space: nowrap;
    }

    .steps-compact {
        margin-bottom: 44px;
    }
}

.child-row {
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.child-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.child-row-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.child-remove {
    color: var(--danger);
}

.child-hint {
    margin-inline-start: 12px;
    color: var(--danger);
    font-size: 12px;
}

.field-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px 16px;
}

@media (min-width: 560px) {
    .field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-grid .field-full {
        grid-column: 1 / -1;
    }
}

/* An admin-written document — terms, service description — shown to the applicant.
   The body is plain text, so newlines are the only formatting it carries. */
.document {
    max-height: 340px;
    overflow-y: auto;
    margin: 0 0 20px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    line-height: 2.1;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.document:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 2;
    color: var(--text);
    cursor: pointer;
}

.consent input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 6px;
    accent-color: var(--brand);
}

.summary {
    margin: 0 0 24px;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    font-size: 13px;
}

.summary-row + .summary-row {
    border-top: 1px solid var(--line);
}

.summary-row dt {
    margin: 0;
    color: var(--muted);
}

.summary-row dd {
    margin: 0;
    color: var(--text);
    font-weight: 600;
    text-align: end;
    word-break: break-word;
}

.summary-row.is-total {
    background: var(--brand-soft);
}

.summary-row.is-total dt,
.summary-row.is-total dd {
    color: var(--brand-dark);
    font-size: 15px;
    font-weight: 700;
}

/* A price with a caption under it. The row itself is a centred flex line, so the cell
   has to become its own column for the caption to sit below the figure rather than
   beside it. Scoped to this class on purpose — the plain .summary-row dd rule is shared
   with the payment and receipt pages. */
.price-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

/* Deliberately quieter than the price above it: this reframes the figure, it does not
   compete with it. */
.price-note {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.9;
    opacity: .85;
}

.receipt-state {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.9;
}

.receipt-state svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.receipt-state.is-paid {
    background: var(--success-bg);
    color: var(--success);
}

.receipt-state.is-unpaid {
    background: var(--warning-bg);
    color: var(--warning-ink);
}

.field-input:not([dir="ltr"]) {
    text-align: start;
    letter-spacing: normal;
}

select.field-input {
    width: 100%;
    height: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding-inline-end: 22px;
    color: var(--text);
    cursor: pointer;
    background-repeat: no-repeat;
    background-size: 16px;
    background-position: left center;

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

select.field-input:focus {
    outline: none;
}

select.field-input:has(option[value=""]:checked) {
    color: var(--placeholder);
}

.field-validation-error {
    display: block;
    margin: 6px 2px 0;
    color: var(--danger);
    font-size: 12px;
    line-height: 1.8;
}

.btn-secondary {
    background: var(--page);
    color: var(--text);
    border: 1px solid var(--line);
}

.btn-secondary:hover {
    background: var(--disabled-bg);
}

/* --------------------------------------------------------------------------
   Print — the receipt is the only page anyone prints, and browsers turn this
   into a PDF via their own "Save as PDF", which is why no PDF library is
   involved. Everything that is navigation or chrome is dropped; what remains
   is the record itself.
   -------------------------------------------------------------------------- */

@media print {

    .auth {
        display: block;
        min-height: 0;
    }

    .auth-aside,
    .theme-toggle-floating,
    .steps,
    .card-footer,
    .no-print {
        display: none !important;
    }

    .auth-main {
        display: block;
        padding: 0;
    }

    .card,
    .card-wide {
        max-width: none;
        width: 100%;
        margin: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: #fff;
    }

    .card-body {
        padding: 0;
    }

    body {
        background: #fff;
        color: #000;
    }

    /* A receipt split mid-row is unreadable as a record. */
    .summary,
    .child-row,
    .receipt-state {
        break-inside: avoid;
    }

    a[href]::after {
        content: "";
    }
}
