/* policy-documents.css — the documents' visual language: the public download center (/d/{token},
   PolicyDocumentsPage), the policy summary (PolicyOverviewCard) and the downloads list (PolicyDocumentList), which the
   signed-in policy and downloads pages share. Every rule is scoped to a .pdoc-* class; colours come only from
   theme.tokens.css. Arabic (RTL) first: logical properties throughout, so nothing here flips by hand.

   Accent text uses the deep brand green (--brand-green-hover, 7.8:1 on white): the brand teal itself measures 3.7:1,
   enough for an icon, not for words. In the dark theme the light brand green takes its place. */

/* Tokens on the two page columns; the summary and the downloads list only ever render inside one of them. */
.pdoc,
.pdoc-detail {
    --pdoc-accent: var(--brand-green-hover);
    --pdoc-accent-soft: color-mix(in srgb, var(--brand-green) 10%, var(--n0));
    --pdoc-surface: var(--n0);
    --pdoc-line: var(--n30);
    --pdoc-ink: var(--n800);
    --pdoc-ink-muted: var(--n400);
    --pdoc-ink-faint: var(--n300);
    --pdoc-radius: var(--radius-md);
    --pdoc-focus: 0 0 0 3px color-mix(in srgb, var(--brand-green) 45%, transparent);
    --pdoc-positive: var(--success);
    --pdoc-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* wizard.css mutes --success to grey in the dark theme for the wizard's own use; a policy in force still shows green. */
[data-theme="dark"] .pdoc,
[data-theme="dark"] .pdoc-detail {
    --pdoc-accent: var(--brand-green-lighter);
    --pdoc-accent-soft: color-mix(in srgb, var(--brand-green) 18%, var(--n0));
    --pdoc-positive: var(--brand-green-lighter);
}

.pdoc ::selection,
.pdoc-detail ::selection {
    background: color-mix(in srgb, var(--brand-green) 24%, transparent);
    color: inherit;
}

/* ─── The page column ─────────────────────────────────────────────── */

.pdoc {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 40rem;
    margin-inline: auto;
    padding-block: 4px 24px;
    font-family: var(--font-body);
    color: var(--pdoc-ink);
    line-height: 1.55;
}

.pdoc-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-block: 8px 4px;
    text-align: center;
}

.pdoc-hero__mark {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-block-end: 6px;
    border-radius: var(--radius-full);
    background: var(--pdoc-accent-soft);
    color: var(--pdoc-accent);
}

.pdoc-hero__title {
    margin: 0;
    font-size: clamp(1.5rem, 1.25rem + 1.2vw, 2rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    text-wrap: balance;
    color: var(--pdoc-ink);
}

.pdoc-hero__lead {
    max-width: 32rem;
    margin: 0;
    font-size: 1rem;
    color: var(--pdoc-ink-muted);
    text-wrap: pretty;
}

.pdoc-keep {
    margin: 0;
    font-size: 0.875rem;
    text-align: center;
    color: var(--pdoc-ink-faint);
}

/* ─── Notice (the PDF is being prepared) ──────────────────────────── */

.pdoc-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--amber) 9%, var(--n0));
    font-size: 0.9375rem;
    color: var(--pdoc-ink);
}

.pdoc-notice__icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--amber);
}

/* ─── Policy summary ──────────────────────────────────────────────── */

.pdoc-summary {
    padding: 20px;
    border: 1px solid var(--pdoc-line);
    border-radius: var(--pdoc-radius);
    background: var(--pdoc-surface);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--n900) 6%, transparent),
                0 6px 20px -8px color-mix(in srgb, var(--n900) 14%, transparent);
    color: var(--pdoc-ink);
}

.pdoc-summary__head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pdoc-summary__logo {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    padding: 6px;
    border: 1px solid var(--pdoc-line);
    border-radius: 12px;
    background: var(--brand-white);
}

.pdoc-summary__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pdoc-summary__names {
    flex: 1 1 auto;
    min-width: 0;
}

.pdoc-summary__insurer {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.pdoc-summary__product {
    margin: 2px 0 0;
    font-size: 0.9375rem;
    color: var(--pdoc-ink-muted);
}

.pdoc-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--n20);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--pdoc-ink);
}

.pdoc-status__dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--n80);
}

.pdoc-status--active { background: color-mix(in srgb, var(--pdoc-positive) 12%, var(--n0)); }
.pdoc-status--active .pdoc-status__dot { background: var(--pdoc-positive); }
.pdoc-status--pending { background: color-mix(in srgb, var(--brand-blue) 10%, var(--n0)); }
.pdoc-status--pending .pdoc-status__dot { background: var(--brand-blue); }
.pdoc-status--attention { background: color-mix(in srgb, var(--amber) 12%, var(--n0)); }
.pdoc-status--attention .pdoc-status__dot { background: var(--amber); }

.pdoc-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    margin: 0;
}

.pdoc-summary__facts {
    margin-block-start: 18px;
    padding-block-start: 16px;
    border-block-start: 1px solid var(--pdoc-line);
}

.pdoc-fact {
    min-width: 0;
}

.pdoc-fact--wide {
    grid-column: 1 / -1;
}

.pdoc-fact dt {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--pdoc-ink-faint);
}

.pdoc-fact dd {
    margin: 2px 0 0;
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.pdoc-fact__number {
    letter-spacing: 0.04em;
}

/* ─── Downloads ───────────────────────────────────────────────────── */

.pdoc-downloads {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pdoc-primary {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 72px;
    padding: 14px 16px;
    border-radius: var(--pdoc-radius);
    background: var(--brand-green-hover);
    color: var(--brand-white);
    text-decoration: none;
    box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--brand-green-dark) 70%, transparent);
    transition: background-color 160ms var(--pdoc-ease),
                box-shadow 160ms var(--pdoc-ease),
                transform 160ms var(--pdoc-ease);
}

.pdoc-primary:hover {
    background: var(--brand-green-dark);
    box-shadow: 0 12px 26px -12px color-mix(in srgb, var(--brand-green-dark) 80%, transparent);
}

.pdoc-primary:active {
    transform: translateY(1px);
}

.pdoc-primary:focus-visible {
    outline: 2px solid var(--brand-white);
    outline-offset: -4px;
    box-shadow: var(--pdoc-focus);
}

.pdoc-primary__icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--brand-white) 16%, transparent);
}

.pdoc-primary__text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.pdoc-primary__title {
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.3;
}

.pdoc-primary__hint {
    font-size: 0.8125rem;
    color: color-mix(in srgb, var(--brand-white) 82%, transparent);
}

.pdoc-primary__action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    background: var(--brand-white);
    color: var(--brand-green-dark);
    font-size: 0.875rem;
    font-weight: 700;
}

.pdoc-docs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pdoc-docs__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 12px;
}

.pdoc-docs__title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--pdoc-ink);
}

.pdoc-docs__hint {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--pdoc-ink-faint);
}

.pdoc-docs__list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--pdoc-line);
    border-radius: var(--pdoc-radius);
    background: var(--pdoc-surface);
    overflow: hidden;
}

.pdoc-docs__list > li + li {
    border-block-start: 1px solid var(--pdoc-line);
}

.pdoc-doc {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 10px 14px;
    color: var(--pdoc-ink);
    text-decoration: none;
    transition: background-color 140ms var(--pdoc-ease);
}

.pdoc-doc:hover {
    background: var(--n10);
}

.pdoc-doc:focus-visible {
    outline: none;
    box-shadow: inset var(--pdoc-focus);
}

.pdoc-doc__icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--pdoc-accent-soft);
    color: var(--pdoc-accent);
}

.pdoc-doc__name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.pdoc-doc__lang {
    flex: 0 0 auto;
    padding: 2px 8px;
    border: 1px solid var(--pdoc-line);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    white-space: nowrap;
    color: var(--pdoc-ink-muted);
}

.pdoc-doc__go {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--pdoc-accent);
}

.pdoc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 32px 20px;
    border: 1px dashed var(--n40);
    border-radius: var(--pdoc-radius);
    background: var(--pdoc-surface);
    text-align: center;
}

.pdoc-empty__icon {
    display: inline-flex;
    color: var(--pdoc-ink-faint);
}

.pdoc-empty__title {
    margin: 0;
    font-weight: 700;
    color: var(--pdoc-ink);
}

.pdoc-empty__hint {
    margin: 0;
    font-size: 0.875rem;
    color: var(--pdoc-ink-muted);
}

/* ─── The refusal and failure states ──────────────────────────────── */

.pdoc-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 32px 20px;
    border: 1px solid var(--pdoc-line);
    border-radius: var(--pdoc-radius);
    background: var(--pdoc-surface);
    text-align: center;
}

.pdoc-state__icon {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-block-end: 4px;
    border-radius: var(--radius-full);
    background: var(--n20);
    color: var(--pdoc-ink-muted);
}

.pdoc-state__icon--warn {
    background: color-mix(in srgb, var(--amber) 12%, var(--n0));
    color: var(--amber);
}

.pdoc-state__title {
    margin: 0;
    font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
    font-weight: 700;
    line-height: 1.3;
    text-wrap: balance;
    color: var(--pdoc-ink);
}

.pdoc-state__body {
    max-width: 30rem;
    margin: 0;
    color: var(--pdoc-ink-muted);
    text-wrap: pretty;
}

.pdoc-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-block-start: 6px;
    padding: 10px 22px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: var(--brand-green-hover);
    color: var(--brand-white);
    font-weight: 700;
    text-decoration: none;
    transition: background-color 160ms var(--pdoc-ease);
}

.pdoc-button:hover {
    background: var(--brand-green-dark);
}

.pdoc-button--quiet {
    border-color: var(--pdoc-line);
    background: transparent;
    color: var(--pdoc-accent);
}

.pdoc-button--quiet:hover {
    background: var(--pdoc-accent-soft);
}

.pdoc-button:focus-visible,
.pdoc-help:focus-visible,
.pdoc-back:focus-visible {
    outline: none;
    box-shadow: var(--pdoc-focus);
}

/* ─── Help line ───────────────────────────────────────────────────── */

.pdoc-help {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 10px;
    align-self: center;
    max-width: 100%;
    padding: 10px 16px;
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    color: var(--pdoc-ink-muted);
    text-decoration: none;
    transition: background-color 140ms var(--pdoc-ease);
}

.pdoc-help:hover {
    background: var(--pdoc-accent-soft);
}

.pdoc-help__icon {
    display: inline-flex;
    color: var(--pdoc-accent);
}

.pdoc-help__call {
    font-weight: 700;
    color: var(--pdoc-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

/* ─── The signed-in policy and downloads pages ────────────────────── */

.pdoc-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 48rem;
    padding-block-end: 32px;
    font-family: var(--font-body);
    color: var(--pdoc-ink);
}

.pdoc-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    min-height: 40px;
    padding: 6px 10px;
    margin-inline-start: -10px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--pdoc-accent);
    text-decoration: none;
}

.pdoc-back:hover {
    background: var(--pdoc-accent-soft);
}

/* The arrow points the way back: towards the start edge, so it turns over in RTL. */
[dir="rtl"] .pdoc-back__arrow {
    transform: scaleX(-1);
}

.pdoc-detail__head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pdoc-detail__title {
    margin: 0;
    font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
    font-weight: 700;
    line-height: 1.3;
    color: var(--pdoc-ink);
}

.pdoc-detail__lead {
    margin: 0;
    color: var(--pdoc-ink-muted);
}

.pdoc-panel {
    padding: 20px;
    border: 1px solid var(--pdoc-line);
    border-radius: var(--pdoc-radius);
    background: var(--pdoc-surface);
}

.pdoc-panel__title {
    margin: 0 0 14px;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--pdoc-ink);
}

.pdoc-fact__problem {
    color: var(--error);
}

.pdoc-detail__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* ─── Phones ──────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    /* The service shell leaves 12px a side here; this brings the gutter to 16px. */
    .pdoc,
    .pdoc-detail {
        padding-inline: 4px;
    }

    .pdoc-summary,
    .pdoc-panel {
        padding: 16px;
    }

    .pdoc-summary__head {
        flex-wrap: wrap;
    }

    .pdoc-summary__names {
        flex-basis: calc(100% - 70px);
    }

    .pdoc-primary {
        flex-wrap: wrap;
    }

    .pdoc-primary__text {
        flex-basis: calc(100% - 58px);
    }

    .pdoc-primary__action {
        justify-content: center;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pdoc-primary,
    .pdoc-doc,
    .pdoc-button,
    .pdoc-help {
        transition: none;
    }
}
