/* Proposal document themes: shared content, distinct page compositions. */

.proposal-doc {
    --theme-accent: #1f6f4a;
    --theme-accent-strong: #134e34;
    --theme-soft: #e6f4ec;
    --theme-cover-bg: #1f6f4a;
    --theme-cover-fg: #ffffff;
    --theme-cover-muted: #cde9d8;
    --theme-pattern-color: rgb(255 255 255 / 0.12);
    --theme-heading-font: var(--font-sans);
    --theme-heading-transform: none;
    max-width: 62rem;
    margin: 0 auto;
}

.proposal-doc[data-theme="modern_green"] {
    --theme-accent: #1f6f4a;
    --theme-accent-strong: #134e34;
    --theme-soft: #e6f4ec;
    --theme-cover-bg: #1f6f4a;
    --theme-cover-fg: #ffffff;
    --theme-cover-muted: #cde9d8;
    background-image: linear-gradient(90deg, transparent 0 96%, var(--theme-soft) 96%);
}

.proposal-doc[data-theme="executive_purple"] {
    --theme-accent: #7b1e6b;
    --theme-accent-strong: #5a1450;
    --theme-soft: #f4e3f1;
    --theme-cover-bg: #492044;
    --theme-cover-fg: #ffffff;
    --theme-cover-muted: #e7c3e1;
    --theme-pattern-color: rgb(231 195 225 / 0.16);
    --theme-heading-transform: uppercase;
}

.proposal-doc[data-theme="minimal"] {
    --theme-accent: #111827;
    --theme-accent-strong: #000000;
    --theme-soft: #f3f4f6;
    --theme-cover-bg: #ffffff;
    --theme-cover-fg: #111827;
    --theme-cover-muted: #6b7280;
    --theme-pattern-color: rgb(17 24 39 / 0.12);
}

.proposal-doc[data-theme="corporate_blue"] {
    --theme-accent: #1e3a8a;
    --theme-accent-strong: #152a63;
    --theme-soft: #dbeafe;
    --theme-cover-bg: #142654;
    --theme-cover-fg: #ffffff;
    --theme-cover-muted: #bed0f5;
    --theme-pattern-color: rgb(190 208 245 / 0.16);
}

.proposal-doc[data-theme="elegant"] {
    --theme-accent: #8a6d3b;
    --theme-accent-strong: #5f4a25;
    --theme-soft: #f5efe6;
    --theme-cover-bg: #f5efe6;
    --theme-cover-fg: #2f2a25;
    --theme-cover-muted: #6d5e48;
    --theme-pattern-color: rgb(138 109 59 / 0.18);
    --theme-heading-font: Georgia, 'Times New Roman', serif;
}

.proposal-doc[data-theme="contrast"] {
    --theme-accent: #0f172a;
    --theme-accent-strong: #020617;
    --theme-soft: #e2e8f0;
    --theme-cover-bg: #0f172a;
    --theme-cover-fg: #ffffff;
    --theme-cover-muted: #cbd5e1;
    --theme-pattern-color: rgb(255 255 255 / 0.2);
    --theme-heading-transform: uppercase;
}

.proposal-doc[data-theme="trade_orange"] {
    --theme-accent: #ea580c;
    --theme-accent-strong: #b23f06;
    --theme-soft: #ffedd5;
    --theme-cover-bg: #1f2937;
    --theme-cover-fg: #ffffff;
    --theme-cover-muted: #f8b384;
    --theme-pattern-color: rgb(248 179 132 / 0.2);
}

.proposal-doc[data-theme="azulejo"] {
    --theme-accent: #1d4ed8;
    --theme-accent-strong: #153a9e;
    --theme-soft: #e0ecff;
    --theme-cover-bg: #f7faff;
    --theme-cover-fg: #153a9e;
    --theme-cover-muted: #31579d;
    --theme-pattern-color: rgb(29 78 216 / 0.16);
}

.proposal-document-page {
    position: relative;
    overflow: hidden;
    margin: var(--space-5) 0;
    padding: var(--space-7);
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--theme-accent);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.proposal-doc .proposal-card {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.proposal-cover {
    display: flex;
    min-height: 68vh;
    flex-direction: column;
    justify-content: space-between;
    margin: var(--space-5) 0;
    padding: var(--space-7);
    overflow: hidden;
    position: relative;
    isolation: isolate;
    border: 0;
    border-radius: var(--radius-md);
    background-color: var(--theme-cover-bg);
    background-image: linear-gradient(135deg, transparent 48%, var(--theme-pattern-color) 48% 49%, transparent 49%);
    color: var(--theme-cover-fg);
    font-family: var(--theme-heading-font);
}

.proposal-cover::after {
    position: absolute;
    z-index: -1;
    top: -18%;
    right: -9%;
    width: 36rem;
    aspect-ratio: 1;
    border: 1px solid var(--theme-pattern-color);
    border-radius: 50%;
    box-shadow: 0 0 0 2rem var(--theme-pattern-color), 0 0 0 4rem transparent;
    content: '';
    pointer-events: none;
}

.proposal-doc[data-theme="modern_green"] .proposal-cover {
    background-image: linear-gradient(110deg, transparent 62%, var(--theme-pattern-color) 62% 63%, transparent 63%);
}

.proposal-doc[data-theme="executive_purple"] .proposal-cover {
    background-image: linear-gradient(135deg, transparent 58%, var(--theme-pattern-color) 58% 59%, transparent 59%);
}

.proposal-doc[data-theme="executive_purple"] .proposal-cover::after {
    top: 22%;
    right: -12%;
    width: 30rem;
    border-radius: 28% 72% 58% 42%;
    transform: rotate(-18deg);
}

.proposal-doc[data-theme="minimal"] .proposal-cover {
    border: 1px solid var(--theme-pattern-color);
    border-left: 0.75rem solid var(--theme-accent);
    background-image: linear-gradient(90deg, transparent 0 75%, var(--theme-soft) 75%);
}

.proposal-doc[data-theme="minimal"] .proposal-cover::after {
    top: auto;
    right: 7%;
    bottom: 8%;
    width: 12rem;
    box-shadow: none;
}

.proposal-doc[data-theme="corporate_blue"] .proposal-cover {
    background-image: linear-gradient(125deg, transparent 58%, var(--theme-pattern-color) 58% 74%, transparent 74%);
}

.proposal-doc[data-theme="corporate_blue"] .proposal-cover::after {
    top: 14%;
    right: -5%;
    width: 25rem;
    border-radius: 0;
    transform: rotate(35deg);
}

.proposal-doc[data-theme="elegant"] .proposal-cover {
    border: 1px solid var(--theme-accent);
    background-image: radial-gradient(ellipse at 100% 0, var(--theme-pattern-color), transparent 55%);
}

.proposal-doc[data-theme="elegant"] .proposal-cover::after {
    top: 12%;
    right: 6%;
    width: 22rem;
    box-shadow: 0 0 0 1rem transparent, 0 0 0 1.1rem var(--theme-pattern-color);
}

.proposal-doc[data-theme="contrast"] .proposal-cover {
    border-bottom: 0.8rem solid var(--theme-accent);
    background-image: linear-gradient(0deg, transparent 0 18%, var(--theme-pattern-color) 18% 19%, transparent 19%);
}

.proposal-doc[data-theme="contrast"] .proposal-cover::after {
    top: 8%;
    right: -8%;
    width: 31rem;
    border-width: 0.75rem;
}

.proposal-doc[data-theme="trade_orange"] .proposal-cover {
    background-image: repeating-linear-gradient(135deg, transparent 0 1.5rem, var(--theme-pattern-color) 1.5rem 1.7rem, transparent 1.7rem 3.2rem);
}

.proposal-doc[data-theme="trade_orange"] .proposal-cover::after {
    top: -28%;
    right: -7%;
    width: 25rem;
    border-radius: 0;
    transform: rotate(45deg);
}

.proposal-doc[data-theme="azulejo"] .proposal-cover {
    border: 0.5rem double var(--theme-accent);
    background-image:
        linear-gradient(45deg, transparent 47%, var(--theme-pattern-color) 47% 53%, transparent 53%),
        linear-gradient(-45deg, transparent 47%, var(--theme-pattern-color) 47% 53%, transparent 53%);
    background-size: 3.5rem 3.5rem;
}

.proposal-doc[data-theme="azulejo"] .proposal-cover::after {
    top: -20%;
    right: -6%;
    width: 32rem;
    border: 0.6rem double var(--theme-accent);
    border-radius: 0;
    box-shadow: inset 0 0 0 1.2rem var(--theme-pattern-color);
    transform: rotate(45deg);
}

.proposal-cover__top {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    color: var(--theme-cover-muted);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.proposal-cover__title {
    max-width: 12ch;
    margin: auto 0;
    font-size: clamp(2.5rem, 7vw, 5.25rem);
    font-weight: 700;
    line-height: 1.02;
    text-transform: var(--theme-heading-transform);
}

.proposal-cover__number {
    margin: 0;
    color: var(--theme-cover-muted);
    font-size: 1rem;
}

.proposal-cover__parties {
    display: flex;
    gap: var(--space-8);
    flex-wrap: wrap;
    margin-top: var(--space-6);
}

.proposal-cover__label {
    display: block;
    margin-bottom: var(--space-1);
    color: var(--theme-cover-muted);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.proposal-cover__value {
    font-size: 1.15rem;
    font-weight: 600;
}

.proposal-cover--bordered {
    border-bottom: 4px solid var(--theme-accent);
}

.proposal-doc .proposal-header {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--theme-accent);
}

.proposal-doc[data-theme="modern_green"] .proposal-document-page--content {
    border-left: 0.6rem solid var(--theme-accent);
}

.proposal-doc[data-theme="executive_purple"] .proposal-header {
    padding: var(--space-4);
    border: 0;
    background-color: var(--theme-soft);
}

.proposal-doc[data-theme="executive_purple"] .proposal-narrative-section {
    border: 0;
    border-bottom: 2px solid var(--theme-accent);
    border-radius: 0;
    background-color: transparent;
}

.proposal-doc[data-theme="minimal"] .proposal-document-page {
    border-radius: 0;
    box-shadow: none;
}

.proposal-doc[data-theme="minimal"] .proposal-document-page--content {
    border-top: 1px solid var(--theme-accent);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
}

.proposal-doc[data-theme="minimal"] .proposal-narrative-section {
    padding-inline: 0;
    border: 0;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
}

.proposal-doc[data-theme="corporate_blue"] .proposal-document-page--content {
    border-top-width: 0.75rem;
    background-image: linear-gradient(90deg, var(--theme-soft) 0 0.5rem, transparent 0.5rem);
}

.proposal-doc[data-theme="elegant"] .proposal-document-page {
    border: 1px solid var(--theme-accent);
    border-radius: 0;
    box-shadow: none;
}

.proposal-doc[data-theme="elegant"] .proposal-narrative-section {
    padding-inline: 0;
    border: 0;
    border-bottom: 1px solid var(--theme-accent);
    border-radius: 0;
    background-color: transparent;
}

.proposal-doc[data-theme="contrast"] .proposal-document-page--content {
    border-left: 0.8rem solid var(--theme-accent);
}

.proposal-doc[data-theme="contrast"] .proposal-header {
    padding: var(--space-4);
    background-color: var(--theme-soft);
}

.proposal-doc[data-theme="trade_orange"] .proposal-document-page--content {
    border-top: 0;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    border-left: 0.75rem solid var(--theme-accent);
}

.proposal-doc[data-theme="trade_orange"] .proposal-document-page--investment {
    background-image: linear-gradient(180deg, var(--theme-soft) 0 0.6rem, transparent 0.6rem);
}

.proposal-doc[data-theme="azulejo"] .proposal-document-page--content {
    border: 0.35rem double var(--theme-accent);
    background-image:
        linear-gradient(45deg, transparent 49%, var(--theme-pattern-color) 49% 51%, transparent 51%),
        linear-gradient(-45deg, transparent 49%, var(--theme-pattern-color) 49% 51%, transparent 51%);
    background-size: 3rem 3rem;
}

.proposal-doc .proposal-number {
    color: var(--theme-accent);
}

.proposal-doc .proposal-title,
.proposal-doc .proposal-items__heading,
.proposal-doc .proposal-customer__heading,
.proposal-doc .proposal-narrative-section__title {
    font-family: var(--theme-heading-font);
}

.proposal-doc .proposal-title {
    color: var(--theme-accent-strong);
}

.proposal-doc .proposal-customer {
    border-left: 4px solid var(--theme-accent);
    background-color: var(--theme-soft);
}

.proposal-narrative {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.proposal-narrative-section {
    position: relative;
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--theme-accent);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface);
}

.proposal-narrative-section__title {
    margin: 0 0 var(--space-3);
    color: var(--theme-accent-strong);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: var(--theme-heading-transform);
}

.proposal-narrative-section__content {
    color: var(--color-text);
    font-size: 1rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

.proposal-doc .proposal-document-page--investment {
    border-top-width: 0.75rem;
}

.proposal-doc .proposal-items-table thead th {
    border-bottom: 2px solid var(--theme-accent);
}

.proposal-doc .proposal-items-table tfoot .row-total {
    background-color: var(--theme-soft);
    color: var(--theme-accent-strong);
}

.proposal-doc .proposal-items-table tfoot .row-total td:last-child {
    color: var(--theme-accent-strong);
}

.proposal-doc .proposal-terms .card {
    border-top: 3px solid var(--theme-accent);
}

.proposal-closing-page {
    display: flex;
    min-height: 24rem;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    background-color: var(--theme-soft);
    background-image: linear-gradient(135deg, transparent 70%, var(--theme-pattern-color) 70% 71%, transparent 71%);
}

.proposal-closing-page__brand {
    margin: 0 0 var(--space-3);
    color: var(--theme-accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.proposal-closing-page__title {
    max-width: 14ch;
    margin: 0 0 var(--space-3);
    color: var(--theme-accent-strong);
    font-family: var(--theme-heading-font);
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.1;
    text-transform: var(--theme-heading-transform);
}

.proposal-closing-page__text {
    max-width: 38rem;
    margin: 0;
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

.proposal-doc[data-theme="executive_purple"] .proposal-closing-page,
.proposal-doc[data-theme="contrast"] .proposal-closing-page {
    background-color: var(--theme-cover-bg);
    color: var(--theme-cover-fg);
}

.proposal-doc[data-theme="executive_purple"] .proposal-closing-page__brand,
.proposal-doc[data-theme="contrast"] .proposal-closing-page__brand {
    color: var(--theme-cover-muted);
}

.proposal-doc[data-theme="executive_purple"] .proposal-closing-page__title,
.proposal-doc[data-theme="contrast"] .proposal-closing-page__title {
    color: var(--theme-cover-fg);
}

.proposal-doc[data-theme="executive_purple"] .proposal-closing-page__text,
.proposal-doc[data-theme="contrast"] .proposal-closing-page__text {
    color: var(--theme-cover-muted);
}

.proposal-doc[data-theme="azulejo"] .proposal-closing-page {
    border: 0.5rem double var(--theme-accent);
    background-image:
        linear-gradient(45deg, transparent 47%, var(--theme-pattern-color) 47% 53%, transparent 53%),
        linear-gradient(-45deg, transparent 47%, var(--theme-pattern-color) 47% 53%, transparent 53%);
    background-size: 3.5rem 3.5rem;
}

.proposal-doc .button {
    background-color: var(--theme-accent);
    color: #ffffff;
}

.proposal-doc .button:hover {
    background-color: var(--theme-accent-strong);
}

.proposal-doc .button--secondary {
    border-color: var(--theme-accent);
    background-color: var(--color-surface);
    color: var(--theme-accent-strong);
}

@media (max-width: 640px) {
    .proposal-document-page {
        margin: var(--space-3) 0;
        padding: var(--space-4);
        border-radius: var(--radius-sm);
    }

    .proposal-cover {
        min-height: 62vh;
        padding: var(--space-5);
    }

    .proposal-cover__title {
        font-size: clamp(2.25rem, 12vw, 3.5rem);
    }

    .proposal-cover::after {
        right: -48%;
        width: 28rem;
    }
}
