/* DeloChat policy experience: uses the shared design-system tokens only. */
.policy-lock {
    overflow: hidden !important;
}

.policy-consent-overlay {
    position: fixed;
    inset: 0;
    /* The acceptance gate is intentionally above authentication, viewers,
       and action sheets: no authenticated screen may obscure it. */
    z-index: 210000;
    display: grid;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
    overflow: auto;
    background:
        radial-gradient(circle at 50% 0%, var(--accent-soft), transparent 42%),
        color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(18px);
}

.policy-consent-overlay[hidden] {
    display: none !important;
}

.policy-consent-card {
    width: min(100%, 880px);
    margin: auto;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-xl);
    overflow: hidden;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-xl);
}

.policy-consent-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-5);
    padding: 28px 30px 22px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(145deg, var(--surface-2), var(--surface));
}

.policy-consent-kicker,
.policy-page-kicker,
.policy-card-kicker {
    margin: 0 0 8px;
    color: var(--accent);
    font: 700 11px/1.3 var(--font-mono);
    letter-spacing: .13em;
    text-transform: uppercase;
}

.policy-consent-title {
    margin: 0;
    color: var(--text);
    font: 780 clamp(25px, 5vw, 38px)/1.08 var(--font-ui);
    letter-spacing: -.035em;
}

.policy-consent-lead {
    max-width: 620px;
    margin: 10px 0 0;
    color: var(--text-2);
    font: 500 14px/1.6 var(--font-ui);
}

.policy-version-badge {
    align-self: start;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    color: var(--muted);
    background: var(--bg);
    font: 650 10px/1 var(--font-mono);
    white-space: nowrap;
}

.policy-consent-body {
    padding: 22px 30px 28px;
}

.policy-truth-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.policy-truth-card {
    min-height: 138px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.policy-truth-card svg {
    width: 22px;
    height: 22px;
    margin-bottom: 12px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.policy-truth-card strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font: 700 14px/1.3 var(--font-ui);
}

.policy-truth-card span {
    display: block;
    color: var(--muted);
    font: 500 12px/1.5 var(--font-ui);
}

.policy-consent-links {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
}

.policy-consent-links a {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-size);
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-md);
    color: var(--text);
    text-decoration: none;
    background: var(--bg);
    font: 650 12px/1 var(--font-ui);
}

.policy-consent-links a:active,
.policy-consent-submit:active,
.policy-language-button:active,
.policy-index a:active {
    transform: scale(.97);
}

.policy-checks {
    display: grid;
    gap: 8px;
}

.policy-check {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 11px;
    align-items: start;
    min-height: 52px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--text-2);
    background: var(--bg);
    cursor: pointer;
    font: 550 12px/1.5 var(--font-ui);
}

.policy-check input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--accent);
}

.policy-check a {
    color: var(--accent);
}

.policy-consent-error {
    min-height: 20px;
    margin: 10px 2px 0;
    color: var(--danger);
    font: 600 11px/1.5 var(--font-ui);
}

.policy-consent-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 10px;
}

.policy-consent-note {
    max-width: 520px;
    margin: 0;
    color: var(--muted);
    font: 500 10px/1.5 var(--font-ui);
}

.policy-consent-submit {
    min-width: 190px;
    min-height: 50px;
    border: 0;
    border-radius: var(--radius-md);
    color: var(--on-accent);
    background: var(--accent);
    font: 760 14px/1 var(--font-ui);
    transition: transform var(--motion-fast), opacity var(--motion-fast), background var(--motion-fast);
}

.policy-consent-submit:disabled {
    color: var(--muted);
    background: var(--elev);
    cursor: not-allowed;
    opacity: .72;
}

.policy-consent-submit:not(:disabled):hover {
    background: color-mix(in srgb, var(--accent) 88%, white);
}

/* Standalone public policy page. */
body.policy-page {
    min-height: 100svh;
    margin: 0;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 20% -10%, var(--accent-soft), transparent 34%),
        var(--bg);
    font-family: var(--font-ui);
}

.policy-page-shell {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
}

.policy-page-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 72px;
    padding-top: env(safe-area-inset-top);
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(18px);
}

.policy-brand {
    margin-right: auto;
    color: var(--text);
    text-decoration: none;
    font: 800 21px/1 var(--font-ui);
    letter-spacing: -.04em;
}

.policy-brand span {
    color: var(--accent);
}

.policy-language-switch {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
}

.policy-language-button {
    min-width: 38px;
    min-height: 34px;
    border: 0;
    border-radius: var(--radius-pill);
    color: var(--muted);
    background: transparent;
    font: 700 10px/1 var(--font-mono);
}

.policy-language-button[aria-pressed="true"] {
    color: var(--on-accent);
    background: var(--accent);
}

.policy-back-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-size);
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--text-2);
    text-decoration: none;
    background: var(--surface);
    font-size: 12px;
    font-weight: 650;
}

.policy-page-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
    gap: 42px;
    padding: 90px 0 54px;
}

.policy-page-title {
    max-width: 760px;
    margin: 0;
    color: var(--text);
    font: 820 clamp(42px, 7vw, 82px)/.97 var(--font-ui);
    letter-spacing: -.065em;
}

.policy-page-title span {
    color: var(--accent);
}

.policy-page-lead {
    max-width: 700px;
    margin: 24px 0 0;
    color: var(--text-2);
    font-size: clamp(15px, 2vw, 19px);
    line-height: 1.6;
}

.policy-receipt-card {
    align-self: end;
    padding: 20px;
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.policy-receipt-card dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin: 0;
}

.policy-receipt-card dt {
    color: var(--muted);
    font: 600 11px/1.4 var(--font-ui);
}

.policy-receipt-card dd {
    margin: 0;
    color: var(--text);
    font: 650 11px/1.4 var(--font-mono);
}

.policy-snapshot {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 54px;
}

.policy-snapshot article {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.policy-snapshot article:nth-child(2) {
    background: var(--surface-2);
}

.policy-snapshot h2 {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 18px;
}

.policy-snapshot p {
    margin: 0;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.65;
}

.policy-content-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 34px;
    align-items: start;
}

.policy-index {
    position: sticky;
    top: 94px;
    display: grid;
    gap: 5px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.policy-index a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 650;
}

.policy-index a:hover,
.policy-index a:focus-visible {
    color: var(--text);
    background: var(--accent-soft);
}

.policy-sections {
    display: grid;
    gap: 14px;
    padding-bottom: 90px;
}

.policy-section {
    scroll-margin-top: 96px;
    padding: 26px 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.policy-section h2 {
    margin: 0 0 14px;
    color: var(--text);
    font-size: clamp(20px, 3vw, 28px);
    letter-spacing: -.025em;
}

.policy-section h3 {
    margin: 22px 0 8px;
    color: var(--text);
    font-size: 15px;
}

.policy-section p,
.policy-section li {
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.72;
}

.policy-section p {
    margin: 0 0 12px;
}

.policy-section ul {
    margin: 8px 0 16px;
    padding-left: 20px;
}

.policy-section li + li {
    margin-top: 7px;
}

.policy-section strong {
    color: var(--text);
}

.policy-section a,
.policy-page-footer a {
    color: var(--accent);
}

.policy-callout {
    margin: 16px 0;
    padding: 16px 18px;
    border: 1px solid color-mix(in srgb, var(--amber) 38%, transparent);
    border-radius: var(--radius-md);
    color: var(--text-2);
    background: color-mix(in srgb, var(--amber) 9%, var(--surface));
    font-size: 12px;
    line-height: 1.65;
}

.policy-page-footer {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
}

@media (max-width: 760px) {
    .policy-consent-overlay {
        display: block;
        padding: 0;
        background: var(--bg);
    }

    .policy-consent-card {
        min-height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .policy-consent-hero {
        grid-template-columns: 1fr;
        padding: calc(24px + env(safe-area-inset-top)) 20px 20px;
    }

    .policy-version-badge {
        position: absolute;
        top: calc(16px + env(safe-area-inset-top));
        right: 16px;
    }

    .policy-consent-title {
        padding-right: 74px;
    }

    .policy-consent-body {
        padding: 18px 20px calc(24px + env(safe-area-inset-bottom));
    }

    .policy-truth-grid {
        grid-template-columns: 1fr;
    }

    .policy-truth-card {
        min-height: 0;
    }

    .policy-consent-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .policy-consent-submit {
        width: 100%;
    }

    .policy-page-shell {
        width: min(100% - 28px, 1180px);
    }

    .policy-page-nav {
        min-height: 64px;
        gap: 8px;
    }

    .policy-back-link {
        width: 44px;
        padding: 0;
        justify-content: center;
        font-size: 0;
    }

    .policy-back-link::before {
        content: '←';
        font-size: 18px;
    }

    .policy-page-hero {
        grid-template-columns: 1fr;
        gap: 26px;
        padding: 62px 0 34px;
    }

    .policy-snapshot {
        grid-template-columns: 1fr;
        margin-bottom: 34px;
    }

    .policy-content-layout {
        grid-template-columns: 1fr;
    }

    .policy-index {
        position: static;
        display: flex;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .policy-index a {
        flex: 0 0 auto;
    }

    .policy-section {
        padding: 22px 20px;
    }

    .policy-page-footer {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .policy-consent-links a,
    .policy-consent-submit,
    .policy-language-button,
    .policy-index a {
        transition: none !important;
    }
}
