/* EAS payment page (03 §3.1). Brand colour — EAS blue #005f93. No external fonts (CSP 04 §1.6). */

:root {
    --brand: #005f93;
    --brand-strong: #004a73;
    --brand-deep: #00324f;
    --brand-soft: #e8f2f8;
    --brand-softer: #f3f8fb;
    --ink: #142230;
    --ink-2: #364756;
    --muted: #677785;
    --line: #dde4ea;
    --line-soft: #edf1f4;
    --bg: #f2f5f8;
    --card: #ffffff;
    --success: #18805a;
    --success-soft: #e6f5ee;
    --warning: #9a6200;
    --warning-soft: #fff4dc;
    --error: #b8342c;
    --error-soft: #fdecea;
    --radius: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(10, 37, 58, 0.06), 0 12px 32px rgba(10, 37, 58, 0.08);
    --focus: 0 0 0 3px rgba(0, 95, 147, 0.28);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    color-scheme: light;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-width: 320px;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
    text-underline-offset: 2px;
}

a:hover {
    color: var(--brand-strong);
}

a:focus-visible,
button:focus-visible {
    outline: none;
    box-shadow: var(--focus);
    border-radius: var(--radius-sm);
}

h1,
p,
dl,
dd {
    margin: 0;
}

.icon {
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---- Layout ---- */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 320px at 50% -120px, rgba(255, 255, 255, 0.14), transparent 70%),
        linear-gradient(160deg, var(--brand-deep) 0%, var(--brand) 55%, #0a77b1 100%) top / 100% 260px no-repeat,
        var(--bg);
}

.topbar__inner,
.footer__inner {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 72px;
    padding-top: max(0px, env(safe-area-inset-top));
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    min-width: 0;
}

.brand__logo-wrap {
    display: inline-flex;
    padding: 3px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.brand__logo {
    display: block;
    width: 34px;
    height: 34px;
}

.brand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.brand__name {
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand__tagline {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.78);
}

.secure-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    white-space: nowrap;
}

.main {
    flex: 1 0 auto;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 12px 16px 48px;
}

/* ---- Cards ---- */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(10, 37, 58, 0.04);
}

.card + .card {
    margin-top: 16px;
}

.pay-card__head {
    padding: 28px 28px 22px;
    border-bottom: 1px solid var(--line-soft);
}

.pay-card__body {
    padding: 22px 28px 28px;
}

.eyebrow {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--muted);
    margin-bottom: 4px;
}

.pay-card__title {
    font-size: 24px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.amount-due {
    display: flex;
    flex-direction: column;
    margin: 18px 0 18px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--brand-soft), var(--brand-softer));
}

.amount-due__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-strong);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.amount-due__value {
    font-size: 34px;
    line-height: 1.15;
    font-weight: 750;
    color: var(--brand-deep);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px 20px;
}

.facts__item dt {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.facts__item dd {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-2);
    overflow-wrap: anywhere;
}

.facts--compact {
    margin: 20px auto 0;
    padding: 14px 16px;
    max-width: 420px;
    border-radius: var(--radius-md);
    background: var(--brand-softer);
    text-align: left;
}

/* ---- Payment methods ---- */

.methods {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.section-title {
    padding: 0;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
}

.method {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.method:hover {
    border-color: #b9c9d6;
}

.method__input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* .is-selected / .is-focused / .is-disabled ставит paypage.js (браузеры без :has); :has — те же стили без JS-задержки. */
.method.is-selected {
    border-color: var(--brand);
    background: var(--brand-softer);
    box-shadow: 0 0 0 1px var(--brand) inset;
}

.method.is-focused {
    box-shadow: var(--focus);
}

.method.is-disabled {
    cursor: default;
    opacity: 0.7;
}

.method.is-selected .method__check {
    opacity: 1;
    transform: scale(1);
}

.method:has(.method__input:checked) {
    border-color: var(--brand);
    background: var(--brand-softer);
    box-shadow: 0 0 0 1px var(--brand) inset;
}

.method:has(.method__input:focus-visible) {
    box-shadow: var(--focus);
}

.method:has(.method__input:disabled) {
    cursor: default;
    opacity: 0.7;
}

.method__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    color: var(--brand);
    background: var(--brand-soft);
}

.method__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.method__name {
    font-weight: 650;
    color: var(--ink);
}

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

.method__price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.method__total {
    font-weight: 700;
    color: var(--ink);
}

.method__fee {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.method__check {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 2px #fff;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.method__check::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 4px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.method:has(.method__input:checked) .method__check {
    opacity: 1;
    transform: scale(1);
}

/* ---- Save checkbox and consent (04 §1.3) ---- */

.save {
    margin: 6px 0 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: #f8fafb;
    border: 1px solid var(--line-soft);
}

.checkbox {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--ink);
}

.checkbox__input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.checkbox__box {
    flex: none;
    position: relative;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border: 1.5px solid #9fb1bf;
    border-radius: 6px;
    background: #fff;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.checkbox__input:checked + .checkbox__box {
    background: var(--brand);
    border-color: var(--brand);
}

.checkbox__input:checked + .checkbox__box::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox__input:focus-visible + .checkbox__box {
    box-shadow: var(--focus);
}

.checkbox__input:disabled + .checkbox__box {
    opacity: 0.6;
}

.save__consent {
    margin: 8px 0 0 30px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

/* ---- Summary (amounts from api/pay/intent or the DD quote only) ---- */

.summary {
    margin: 4px 0 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px dashed #c8d5df;
    font-variant-numeric: tabular-nums;
}

.summary__row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 0;
    font-size: 14px;
    color: var(--ink-2);
}

.summary__row--total {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
}

.summary__row--gbp {
    font-weight: 700;
    color: var(--brand-strong);
}

/* ---- Notice, loader, Drop-in ---- */

.notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    border: 1px solid transparent;
    background: var(--brand-soft);
    color: var(--brand-deep);
}

.notice--error {
    background: var(--error-soft);
    border-color: #f5c9c4;
    color: #7d221c;
}

.notice--warning {
    background: var(--warning-soft);
    border-color: #f3dca6;
    color: #6b4500;
}

.notice--static {
    padding: 16px 18px;
}

.notice__text {
    flex: 1 1 220px;
}

.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.loader__logo {
    width: 40px;
    height: 40px;
}

.dropin {
    min-height: 0;
}

.dropin:not(:empty) {
    margin: 4px 0 8px;
}

/* ---- Direct Debit quote (04 §1.5) ---- */

.dd {
    margin: 0 0 8px;
    padding: 16px 18px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: #fff;
}

.dd__lead {
    font-weight: 650;
    color: var(--ink);
}

.dd__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px 16px;
    margin: 14px 0;
}

.dd__fact dt {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.dd__fact dd {
    font-weight: 600;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

.dd__warning {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    color: #6b4500;
    font-size: 13px;
}

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 12px;
    border: 1.5px solid transparent;
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    cursor: default;
    opacity: 0.6;
    transform: none;
}

.btn--primary {
    color: #fff;
    background: var(--brand);
}

.btn--primary:hover:not(:disabled) {
    background: var(--brand-strong);
    color: #fff;
}

.btn--secondary {
    color: var(--brand);
    background: #fff;
    border-color: #b7cfdf;
}

.btn--secondary:hover {
    border-color: var(--brand);
    color: var(--brand-strong);
}

.btn--link {
    min-height: 0;
    padding: 4px 2px;
    border: 0;
    background: none;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.btn--block {
    width: 100%;
}

.hint {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--muted);
    text-align: center;
}

.secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line-soft);
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.secure-note .icon {
    color: var(--success);
}

/* ---- State cards (03 §3.1 states and results) ---- */

.state-card {
    padding: 36px 28px 30px;
    text-align: center;
    outline: none;
}

.state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: 50%;
    color: var(--brand);
    background: var(--brand-soft);
}

.state-icon__svg {
    display: none;
}

.tone-success .state-icon {
    color: var(--success);
    background: var(--success-soft);
}

.tone-warning .state-icon {
    color: var(--warning);
    background: var(--warning-soft);
}

.tone-error .state-icon {
    color: var(--error);
    background: var(--error-soft);
}

.tone-success .state-icon__svg--success,
.tone-progress .state-icon__svg--progress,
.tone-warning .state-icon__svg--warning,
.tone-error .state-icon__svg--error {
    display: block;
}

.tone-progress .state-icon {
    animation: pulse 2s ease-in-out infinite;
}

.state-card__title {
    font-size: 22px;
    line-height: 1.3;
    font-weight: 700;
}

.state-card__message {
    max-width: 440px;
    margin: 10px auto 0;
    color: var(--ink-2);
}

.state-card__note {
    margin-top: 14px;
    font-size: 14px;
    color: var(--muted);
}

.state-card__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.state-card__actions:empty {
    display: none;
}

.state-card__help {
    margin-top: 22px;
    font-size: 14px;
    color: var(--muted);
}

.state-card__ref {
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

/* ---- Footer (legal entity from the database) ---- */

.footer {
    flex: none;
    margin-top: auto;
    color: var(--muted);
    font-size: 13px;
    background: #fff;
    border-top: 1px solid var(--line);
}

.footer > .footer__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px 32px;
    padding-top: 24px;
    padding-bottom: 20px;
}

.footer__entity {
    display: flex;
    gap: 12px;
    min-width: 0;
}

.footer__logo {
    flex: none;
    width: 32px;
    height: 32px;
}

.footer__details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.footer__name {
    color: var(--ink-2);
}

.footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    align-items: flex-start;
}

.footer__links a {
    color: var(--muted);
    text-decoration: none;
}

.footer__links a:hover {
    color: var(--brand);
    text-decoration: underline;
}

.footer__bottom {
    padding: 12px 0 max(12px, env(safe-area-inset-bottom));
    color: rgba(255, 255, 255, 0.85);
    background: var(--brand-deep);
    font-size: 12px;
}

/* ---- Busy state ---- */

.main.is-busy .methods,
.main.is-busy .save {
    pointer-events: none;
}

@keyframes pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 95, 147, 0.22);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(0, 95, 147, 0);
    }
}

/* ---- Small screens ---- */

@media (max-width: 520px) {
    .topbar__inner {
        min-height: 64px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .brand__tagline {
        display: none;
    }

    .secure-badge {
        padding: 5px 10px;
        font-size: 12px;
    }

    .main {
        padding: 8px 12px 32px;
    }

    .pay-card__head {
        padding: 22px 18px 18px;
    }

    .pay-card__body {
        padding: 18px 18px 22px;
    }

    .pay-card__title {
        font-size: 21px;
    }

    .amount-due__value {
        font-size: 30px;
    }

    .method {
        grid-template-columns: auto 1fr;
        gap: 4px 12px;
        padding: 12px 14px;
    }

    .method__icon {
        width: 38px;
        height: 38px;
        grid-row: span 2;
    }

    .method__price {
        grid-column: 2;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: flex-start;
        gap: 0 8px;
        text-align: left;
    }

    .state-card {
        padding: 28px 18px 24px;
    }

    .footer__inner {
        padding-left: 16px;
        padding-right: 16px;
    }

    .btn {
        width: 100%;
    }

    .btn--link {
        width: auto;
    }
}

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