:root {
    --report-brown: #5c2b16;
    --report-brown-deep: #2d160d;
    --report-yellow: #f2c94c;
    --report-yellow-soft: #fff4bf;
    --report-cream: #fffbea;
    --report-ink: #171717;
    --report-muted: #66554d;
    --report-line: #d9b94f;
}

body.report-open {
    overflow: hidden;
}

.plot-report-modal[hidden] {
    display: none !important;
}

.plot-report-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100vw;
    height: 100vh;
    background: #2b211c;
    color: var(--report-ink);
}

.plot-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 88px;
    padding: 16px clamp(20px, 3vw, 46px);
    color: #fff;
    background: linear-gradient(105deg, var(--report-brown-deep), var(--report-brown));
    border-bottom: 4px solid var(--report-yellow);
}

.plot-report-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--report-yellow-soft);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.plot-report-header h2 {
    margin: 0;
    color: #fff !important;
    font: 800 clamp(1.25rem, 2vw, 1.9rem)/1.15 Arial, sans-serif;
}

.plot-report-header p {
    margin: 5px 0 0;
    color: var(--report-yellow-soft) !important;
    background: transparent !important;
    font-size: 0.9rem;
}

.plot-report-header-actions {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.plot-report-header button,
.report-selector button {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 9px 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: none;
    transform: none;
}

.report-print-button,
.report-generate-button {
    color: var(--report-ink);
    background: var(--report-yellow);
}

.report-close-button {
    color: #fff;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.55) !important;
}

.plot-report-header button:hover,
.report-selector button:hover {
    transform: none;
}

.report-close-button:hover {
    color: var(--report-ink);
    background: #fff;
}

.report-print-button:hover,
.report-generate-button:hover {
    color: #fff;
    background: #7a391d;
}

.report-print-button:disabled,
.report-generate-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.report-workspace {
    display: grid;
    grid-template-columns: minmax(290px, 350px) minmax(0, 1fr);
    min-height: 0;
}

.report-selector {
    overflow-y: auto;
    padding: 22px 20px 28px;
    background: var(--report-cream);
    border-right: 1px solid var(--report-line);
}

.report-selector-heading h3 {
    margin: 0;
    color: var(--report-brown);
    font: 800 1.1rem/1.3 Arial, sans-serif;
}

.report-selector-heading p {
    margin: 6px 0 15px;
    color: var(--report-muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.report-selection-tools {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.report-selection-tools button {
    min-height: 34px;
    padding: 6px 11px;
    color: var(--report-brown);
    background: #fff;
    border-color: var(--report-line);
    font-size: 0.78rem;
}

.report-topic-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
}

.report-topic-option {
    display: grid;
    grid-template-columns: auto 28px 1fr;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 9px 10px;
    color: var(--report-ink);
    background: #fff;
    border: 1px solid #eadb9e;
    border-radius: 8px;
    cursor: pointer;
}

.report-topic-option:has(input:checked) {
    background: var(--report-yellow-soft);
    border-color: var(--report-brown);
    box-shadow: inset 4px 0 0 var(--report-brown);
}

.report-topic-option input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--report-brown);
}

.report-topic-number {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    color: #fff;
    background: var(--report-brown);
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 900;
}

.report-topic-label {
    font-size: 0.82rem;
    font-weight: 750;
    line-height: 1.25;
}

.report-selection-summary {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 16px 0 10px;
    color: var(--report-brown);
    font-size: 0.8rem;
    font-weight: 800;
}

.report-selection-error {
    min-height: 20px;
    margin: 0 0 8px;
    color: #9b2418;
    font-size: 0.79rem;
    font-weight: 700;
}

.report-generate-button {
    width: 100%;
}

.report-preview {
    overflow: auto;
    padding: 28px;
    background:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
        #2b211c;
    background-size: 22px 22px;
}

.report-empty-state {
    display: grid;
    place-items: center;
    min-height: 100%;
    color: #fff;
    text-align: center;
}

.report-empty-state[hidden] {
    display: none !important;
}

.report-empty-state div {
    max-width: 440px;
    padding: 34px;
    border: 1px dashed rgba(242, 201, 76, 0.65);
    border-radius: 14px;
    background: rgba(92, 43, 22, 0.42);
}

.report-empty-state strong {
    display: block;
    margin-bottom: 8px;
    color: var(--report-yellow);
    font-size: 1.2rem;
}

.report-empty-state p {
    margin: 0;
    color: #f6eddf !important;
    background: transparent !important;
    line-height: 1.55;
}

.report-paper[hidden] {
    display: none !important;
}

.report-paper {
    width: min(210mm, 100%);
    min-height: 297mm;
    margin: 0 auto;
    padding: 16mm 15mm 18mm;
    color: var(--report-ink);
    background: #fff;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.38);
    font: 10.5pt/1.5 Arial, sans-serif;
}

.report-document-head {
    padding-bottom: 14px;
    border-bottom: 3px solid var(--report-yellow);
}

.report-document-head .document-kicker {
    color: var(--report-brown);
    font-size: 8.5pt;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.report-document-head h1 {
    margin: 5px 0 4px;
    color: var(--report-ink) !important;
    text-align: left;
    text-shadow: none;
    font: 800 23pt/1.12 Arial, sans-serif;
}

.report-document-head h2 {
    margin: 0;
    color: var(--report-brown);
    font: 700 12pt/1.35 Arial, sans-serif;
}

.report-document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 18px;
    margin-top: 10px;
    color: var(--report-muted);
    font-size: 8.5pt;
}

.report-disclaimer {
    margin: 14px 0 0;
    padding: 10px 12px;
    color: #4a2b1d;
    background: var(--report-yellow-soft);
    border-left: 4px solid var(--report-brown);
    font-size: 8.5pt;
}

.report-section {
    margin-top: 19px;
}

.report-section-title {
    display: grid;
    grid-template-columns: 30px 1fr;
    align-items: center;
    gap: 9px;
    margin: 0 0 10px;
    color: var(--report-brown);
    font: 800 14pt/1.25 Arial, sans-serif;
    break-after: avoid;
}

.report-section-number {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: #fff;
    background: var(--report-brown);
    border-radius: 50%;
    font-size: 8.5pt;
}

.report-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin: 0 0 10px;
}

.report-fact {
    padding: 9px 10px;
    background: #fffdf5;
    border: 1px solid #e9d98f;
    break-inside: avoid;
}

.report-fact dt {
    margin: 0 0 2px;
    color: var(--report-brown);
    font-size: 8pt;
    font-weight: 900;
    text-transform: uppercase;
}

.report-fact dd {
    margin: 0;
}

.report-narrative p {
    margin: 7px 0;
}

.report-callout {
    margin: 9px 0;
    padding: 10px 12px;
    color: #fff;
    background: var(--report-brown);
    border-left: 5px solid var(--report-yellow);
    font-weight: 800;
    break-inside: avoid;
}

.report-review-card {
    margin: 9px 0;
    border: 1px solid #dfd2c8;
    break-inside: avoid;
}

.report-review-card h3 {
    margin: 0;
    padding: 7px 10px;
    color: #fff !important;
    background: var(--report-brown);
    font: 800 9.5pt/1.3 Arial, sans-serif;
}

.report-review-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-review-grid div {
    padding: 8px 9px;
    border-right: 1px solid #e7ddd6;
}

.report-review-grid div:last-child {
    border-right: 0;
}

.report-review-grid strong {
    display: block;
    margin-bottom: 3px;
    color: var(--report-brown);
    font-size: 7.5pt;
    text-transform: uppercase;
}

.report-review-grid p {
    margin: 0;
    font-size: 8.5pt;
    line-height: 1.4;
}

.report-approval-table {
    width: 100%;
    margin: 8px 0;
    border-collapse: collapse;
    font-size: 8pt;
}

.report-approval-table th,
.report-approval-table td {
    padding: 7px;
    color: var(--report-ink);
    border: 1px solid #d8c9bd;
    font-family: Arial, sans-serif;
    font-weight: 400;
    vertical-align: top;
}

.report-approval-table th {
    color: #fff;
    background: var(--report-brown);
    font-weight: 800;
}

.report-bullets-title {
    margin: 10px 0 5px;
    color: var(--report-brown);
    font-size: 9pt;
    text-transform: uppercase;
}

.report-bullets {
    margin: 0 0 0 18px;
    padding: 0;
}

.report-bullets li {
    margin: 4px 0;
}

.report-document-footer {
    margin-top: 24px;
    padding-top: 8px;
    color: var(--report-muted);
    border-top: 1px solid #d8c9bd;
    font-size: 7.5pt;
}

@media (max-width: 900px) {
    .plot-report-header {
        align-items: flex-start;
        min-height: auto;
    }

    .plot-report-header-actions {
        flex-direction: column-reverse;
    }

    .report-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(220px, 40vh) minmax(0, 1fr);
    }

    .report-selector {
        border-right: 0;
        border-bottom: 1px solid var(--report-line);
    }

    .report-topic-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-preview {
        padding: 14px;
    }
}

@media (max-width: 600px) {
    .plot-report-header {
        padding: 12px 14px;
    }

    .plot-report-header p {
        display: none;
    }

    .plot-report-header-actions button {
        min-height: 36px;
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    .report-topic-list,
    .report-facts,
    .report-review-grid {
        grid-template-columns: 1fr;
    }

    .report-review-grid div {
        border-right: 0;
        border-bottom: 1px solid #e7ddd6;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 13mm;
    }

    body.report-open {
        overflow: visible;
        background: #fff;
    }

    body.report-open > *:not(#plotReportModal) {
        display: none !important;
    }

    .plot-report-modal {
        position: static;
        display: block;
        width: auto;
        height: auto;
        background: #fff;
    }

    .plot-report-header,
    .report-selector,
    .report-empty-state {
        display: none !important;
    }

    .report-workspace,
    .report-preview {
        display: block;
        overflow: visible;
        padding: 0;
        background: #fff;
    }

    .report-paper {
        width: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    .report-review-card,
    .report-fact,
    .report-callout,
    .report-approval-table tr {
        break-inside: avoid;
    }

    .report-section-title {
        break-after: avoid;
    }
}
