:root {
    --bg: #eef4f9;
    --panel: #ffffff;
    --border: #d8e4ef;
    --text: #17324d;
    --muted: #5d7186;
    --primary: #0056b3;
    --primary-deep: #003b73;
    --success: #0d7b61;
    --danger: #a43737;
    --shadow: 0 24px 50px rgba(15, 40, 70, 0.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #f4f8fc 0%, var(--bg) 100%);
    color: var(--text);
}

.page-shell {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 24px;
}

.page-shell.narrow {
    width: min(760px, 100%);
}

.mail-preview-shell {
    width: min(760px, 100%);
}

.hero, .two-column {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    align-items: start;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.muted-panel {
    background: #f8fbfe;
}

.center {
    text-align: center;
}

.logo {
    width: 140px;
    height: auto;
}

.logo.small {
    width: 112px;
}

.eyebrow {
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 10px;
}

h1, h2 {
    margin: 0 0 12px;
    color: var(--primary-deep);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.lead {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
    font-size: 1rem;
}

.lead.compact {
    max-width: 42rem;
    margin: 0 auto;
}

.lead + .info-banner,
.lead + .mail-card,
.lead + .success-grid {
    margin-top: 18px;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span {
    font-size: 0.95rem;
    font-weight: 600;
}

.section-intro {
    padding-top: 8px;
}

.section-intro h2, .support-card h3 {
    margin: 0 0 6px;
    font-size: 1.08rem;
}

.section-intro p, .support-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

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

.mobile-contract-summary {
    padding: 18px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #f8fbfe;
}

input:not([type="checkbox"]), select {
    min-height: 48px;
    border: 1px solid #cfdbe6;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 1rem;
    background: #fbfdff;
}

input[readonly]:not([type="checkbox"]) {
    background: #f1f5f9;
    color: #516577;
}

.info-banner,
.note-card,
.support-card,
.mail-card,
.price-card {
    border: 1px solid var(--border);
    border-radius: 14px;
}

.info-banner {
    margin-top: 18px;
    padding: 14px 16px;
    background: #f4f8fd;
    color: var(--muted);
    line-height: 1.6;
}

.note-card,
.support-card {
    padding: 16px;
    background: #f8fbfe;
    color: var(--muted);
    line-height: 1.6;
}

.action-card {
    background: #fbfcfe;
}

.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.account-menu {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fbfe;
    color: var(--text);
    text-decoration: none;
}

.account-menu svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
    flex: 0 0 auto;
}

.account-menu span {
    display: grid;
    gap: 2px;
    text-align: left;
}

.account-menu strong {
    font-size: 0.92rem;
    line-height: 1.1;
}

.account-menu small {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.1;
}

.auth-choice-list {
    display: grid;
    gap: 16px;
}

.auth-start-panel {
    display: grid;
    gap: 24px;
}

.auth-start-intro {
    display: grid;
    gap: 0;
}

.existing-policy-start-panel {
    gap: 18px;
}

.existing-policy-start-intro {
    gap: 10px;
    max-width: 540px;
}

.existing-policy-start-intro .eyebrow {
    margin-top: 2px;
}

.existing-policy-start-intro h1 {
    margin: 0;
}

.existing-policy-start-intro .lead {
    margin: 0;
}

.existing-policy-start-form {
    margin: 0;
}

.existing-policy-contracts-panel .lead {
    max-width: 32rem;
}

.auth-choice-row {
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fbfdff;
}

.auth-choice-copy {
    display: flex;
    gap: 14px;
    align-items: center;
}

.auth-choice-copy h2 {
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.auth-choice-copy p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.auth-choice-row form {
    margin: 0;
}

.auth-choice-button {
    min-width: 180px;
}

.contract-start-form {
    margin-top: 0;
}

.contract-price-preview {
    display: grid;
    gap: 6px;
    box-shadow: none;
}

.identify-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

@media (max-width: 860px) {
    .auth-choice-row {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-choice-copy {
        align-items: flex-start;
    }

    .auth-choice-button {
        width: 100%;
        min-width: 0;
    }

    .identify-actions {
        grid-template-columns: 1fr;
        gap: 22px;
    }
}

.selection-grid,
.contracts-grid {
    display: grid;
    gap: 16px;
}

.compact-contracts-grid {
    gap: 12px;
}

.choice-card,
.contract-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fbfdff;
    padding: 18px;
}

.choice-card h2,
.contract-card h2,
.contract-card h3 {
    margin: 0 0 8px;
    font-size: 1.15rem;
}

.choice-card p,
.contract-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.compact-contracts-grid .contract-card {
    padding: 14px 16px 16px;
}

.compact-contracts-grid .contract-card-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compact-contracts-grid .card-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 0;
    flex: 0 0 auto;
    border-radius: 10px;
}

.compact-contracts-grid .contract-copy {
    min-width: 0;
}

.compact-contracts-grid .contract-card h3 {
    margin-bottom: 2px;
    font-size: 1.03rem;
    line-height: 1.3;
}

.compact-contracts-grid .contract-card p {
    line-height: 1.4;
}

.compact-contracts-grid .button-link {
    margin-top: 10px;
    padding-top: 11px;
    padding-bottom: 11px;
}

.card-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef5fd;
    color: var(--primary);
}

.card-icon svg {
    width: 22px;
    height: 22px;
}

.contract-copy {
    display: grid;
    gap: 8px;
}

.contract-highlight {
    font-weight: 600;
    color: var(--text);
}

.contract-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 2px;
}

.contract-meta span {
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef5fd;
    color: var(--primary-deep);
    font-size: 0.86rem;
    font-weight: 700;
}

.full-width {
    width: 100%;
}

.compact-note {
    margin-top: 16px;
    padding: 12px 14px;
}

.muted-card {
    background: #f8fbfe;
}

.action-row {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
}

.action-row form {
    margin: 0;
}

.action-link {
    width: auto;
}

.action-row .primary {
    width: 100%;
}

.checkbox-row {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 12px;
    align-items: start;
    font-size: 0.95rem;
    line-height: 1.5;
}

.confirmation-box {
    display: grid;
    gap: 12px;
}

.confirmation-note {
    margin: 0 0 2px;
    color: var(--muted);
    line-height: 1.6;
}

.confirmation-row {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    padding: 0;
    border: 1px solid #aebfd1;
    border-radius: 4px;
    background: #ffffff;
    justify-self: start;
}

.checkbox-row label {
    display: block;
    color: var(--text);
    cursor: pointer;
}

.primary, .button-link, .wallet-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 1rem;
    line-height: 1.2;
    font-weight: 700;
    font-family: inherit;
    text-align: center;
    white-space: normal;
    padding: 0 18px;
    box-sizing: border-box;
    vertical-align: middle;
}

.primary, .button-link {
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, #0a79da 100%);
    color: white;
    cursor: pointer;
}

.primary:disabled {
    background: #b7c6d8;
    color: #f6f8fb;
    cursor: not-allowed;
}

.wallet-link {
    width: 100%;
    background: #f1f7fd;
    color: var(--primary-deep);
    border: 1px solid var(--border);
}

.primary-wallet-link {
    margin-top: 18px;
    background: linear-gradient(135deg, var(--primary) 0%, #0a79da 100%);
    color: white;
    border: none;
    box-shadow: 0 14px 30px rgba(0, 86, 179, 0.20);
}

.same-device-hint {
    display: none;
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #eef6ff;
    border: 1px solid #cfe0f3;
    color: var(--primary-deep);
    line-height: 1.5;
    font-weight: 600;
}

.qr-box {
    margin: 22px auto 18px;
    padding: 14px;
    border-radius: 16px;
    background: white;
    border: 1px solid var(--border);
    display: inline-block;
}

.qr-box img {
    width: min(100%, 320px);
    height: auto;
    display: block;
}

.qr-disclosure {
    margin-top: 22px;
}

.qr-disclosure summary {
    display: none;
}

.qr-disclosure summary::-webkit-details-marker {
    display: none;
}

.status {
    margin-top: 16px;
    border-radius: 12px;
    padding: 14px 16px;
    font-weight: 600;
}

.status.waiting {
    background: #eaf3ff;
    color: var(--primary);
}

.status.success {
    background: #e6f6f1;
    color: var(--success);
}

.status.failed {
    background: #fceaea;
    color: var(--danger);
}

.success-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8fbfe;
}

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

.success-card .label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 6px;
}

.success-card .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-deep);
}

.summary {
    display: grid;
    gap: 0;
}

.detail-type-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.detail-type-badge,
.detail-type-subtitle {
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.detail-type-badge {
    background: #eef5fd;
    color: var(--primary-deep);
    font-weight: 700;
}

.detail-type-subtitle {
    background: #f5f8fb;
    color: var(--muted);
    font-weight: 600;
}

.detailed-summary {
    margin-top: 22px;
}

.summary div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.summary dt {
    color: var(--muted);
    line-height: 1.35;
}

.summary dd {
    margin: 0;
    font-weight: 650;
    text-align: right;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.price-card {
    margin-top: 22px;
    padding: 18px;
    background: linear-gradient(135deg, #f7fbff 0%, #edf5ff 100%);
}

.price-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.price-main {
    margin-top: 10px;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-deep);
}

.price-main span {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--muted);
}

.price-sub {
    margin-top: 8px;
    color: var(--muted);
}

.plain-list {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--text);
}

.plain-list li + li {
    margin-top: 8px;
}

.mail-card {
    margin-top: 24px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: none;
}

.mail-meta {
    display: grid;
    gap: 0;
    padding: 8px 18px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
}

.mail-row {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 14px;
    padding: 12px 0;
    align-items: start;
}

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

.mail-key {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.mail-value {
    color: var(--text);
    font-weight: 600;
}

.mail-body {
    padding: 20px 18px;
    line-height: 1.7;
    color: var(--text);
    font-size: 1rem;
}

.mail-body p {
    margin: 0 0 14px;
}

.top-gap {
    margin-top: 24px;
}

.mail-action {
    display: grid;
    gap: 16px;
}

.mail-action .wallet-link {
    width: 100%;
}

.mail-action .qr-box {
    margin: 0 auto;
}

.qr-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: center;
    margin-top: 20px;
}

.subtle-link {
    color: var(--muted);
    word-break: break-all;
    line-height: 1.6;
}

@media (max-width: 860px) {
    .hero, .two-column, .qr-layout, .success-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding: 10px;
    }

    .panel {
        padding: 18px 12px;
        border-radius: 16px;
    }

    .eyebrow {
        margin-bottom: 8px;
        font-size: 0.76rem;
        letter-spacing: 0.06em;
    }

    h1 {
        margin-bottom: 8px;
        font-size: 1.55rem;
        line-height: 1.12;
    }

    .lead {
        font-size: 0.96rem;
        line-height: 1.5;
    }

    .center .logo.small {
        width: 92px;
    }

    .info-banner {
        margin-top: 14px;
        padding: 12px 14px;
        line-height: 1.45;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .full {
        grid-column: auto;
    }

    input, select {
        font-size: 16px;
    }

    .logo {
        width: 116px;
    }

    .portal-header {
        align-items: center;
        gap: 10px;
        margin-bottom: 14px;
    }

    .account-menu {
        min-height: 40px;
        padding: 6px 9px;
        gap: 8px;
    }

    .account-menu svg {
        width: 20px;
        height: 20px;
    }

    .account-menu strong {
        max-width: 9rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.86rem;
    }

    .account-menu small {
        font-size: 0.74rem;
    }

    .summary div {
        gap: 10px;
        padding: 8px 0;
    }

    .summary dt,
    .summary dd {
        font-size: 0.92rem;
    }

    .summary dt {
        flex: 0 0 43%;
    }

    .summary dd {
        flex: 1 1 auto;
    }

    .action-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .action-link {
        width: 100%;
    }

    .mail-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .qr-disclosure {
        margin-top: 18px;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: #f8fbfe;
        overflow: hidden;
    }

    .qr-disclosure summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px;
        cursor: pointer;
        font-weight: 700;
        color: var(--primary-deep);
        list-style: none;
    }

    .qr-disclosure summary::after {
        content: "+";
        font-size: 1.2rem;
        line-height: 1;
        color: var(--primary);
    }

    .qr-disclosure[open] summary::after {
        content: "−";
    }

    .qr-disclosure .qr-box {
        margin: 0 auto 16px;
    }

    .same-device-hint {
        display: block;
    }
}
