@font-face{font-family:"Magilex Avenir";src:url("/fonts/AvenirNext-Regular.ttf") format("truetype");font-weight:400 600;font-display:swap}
@font-face{font-family:"Magilex Avenir";src:url("/fonts/AvenirNext-Bold.ttf") format("truetype");font-weight:700 900;font-display:swap}
/* Shared Magilex UI tokens. Keep court documents and print typography independent. */
:root {
    --ui-font: "Magilex Avenir", "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif;
    --ui-ink: #00005c;
    --ui-accent: #006f73;
    --ui-accent-hover: #00565a;
    --ui-muted: #595b70;
    --ui-line: #d5e2df;
    --ui-surface: #f0f7f5;
    --ui-selection: #e1efea;
    --ui-focus: #007b80;
    --ui-text: 16px;
    --ui-label: 14px;
    --ui-caption: 13px;
    --ui-title: clamp(28px, 2.5vw, 36px);
    --ui-section-title: 22px;
    --ui-report-amount: 20px;
    --ui-space-1: 4px;
    --ui-space-2: 8px;
    --ui-space-3: 12px;
    --ui-space-4: 16px;
    --ui-space-5: 24px;
    --ui-space-6: 32px;
    --ui-radius: 10px;
    --ui-control-height: 44px;
    --portal-font: var(--ui-font);
    --navy: var(--ui-ink);
    --accent: var(--ui-accent);
    --accent-hover: var(--ui-accent-hover);
    --muted: var(--ui-muted);
    --line: var(--ui-line);
}
@media screen {
    body { font-family: var(--ui-font); }
    .button, .workspace .button {
        min-height: var(--ui-control-height);
        font-size: var(--ui-label);
        line-height: 1.4;
        gap: var(--ui-space-2);
        padding: 10px 16px;
    }
    :where(a, button, input, select, textarea, summary):focus-visible {
        outline: 2px solid var(--ui-focus);
        outline-offset: 3px;
    }
    .workspace .workspace-sidebar .workspace-nav > a,
    .workspace .workspace-tools > summary > .workspace-tools-label { font-size: var(--ui-label); }
    .workspace .workspace-tool-links > a { font-size: var(--ui-caption); line-height: 1.45; }
    body.workspace { --workspace-selection-bg: var(--ui-selection); }
    .workspace .page-heading h1, .workspace .builder-heading h1 {
        font-size: var(--ui-title);
        line-height: 1.18;
        margin-bottom: var(--ui-space-3);
    }
    .workspace .lead { font-size: var(--ui-text); line-height: 1.65; }
    .workspace .workspace-context-back { display: none; }
    .workspace .interest-heading { padding: 0 0 var(--ui-space-5); }
    .workspace .interest-heading .lead { margin-bottom: 0; }
    .workspace .interest-heading .library-formats { display: none; }
    .workspace .interest-panel { border-radius: var(--ui-radius); }
    .workspace .interest-panel h2, .workspace .builder-questions > h2,
    .workspace .builder-preview-heading h2 { font-size: var(--ui-section-title); margin: 0 0 var(--ui-space-3); }
    .workspace-calculation .interest-panel label,
    .workspace .builder-fields label, .workspace .builder-document-name { font-size: var(--ui-label); }
    .workspace-calculation .interest-panel input,
    .workspace-calculation .interest-panel select,
    .workspace .builder-fields input, .workspace .builder-document-name input {
        min-height: var(--ui-control-height);
        font-size: var(--ui-text);
        padding: 10px 12px;
    }
    .workspace-calculation .interest-invoice-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ui-space-3); }
    .workspace-calculation .interest-invoice-fields > label:last-child { grid-column: 1 / -1; }
    .workspace-calculation .interest-panel p, .workspace-calculation .interest-panel details,
    .workspace .interest-submit p, .workspace .builder-questions > p,
    .workspace .builder-status, .workspace .builder-privacy,
    .workspace .builder-fields small { font-size: var(--ui-caption); line-height: 1.65; }
    .workspace-calculation .interest-panel .eyebrow { margin-bottom: var(--ui-space-2); }
    .workspace-calculation .interest-invoice { margin: var(--ui-space-4) 0; padding: var(--ui-space-3); }
    .workspace-calculation .interest-guide { margin-top: 0; }
    .workspace-calculation .interest-guide h2 { font-size: var(--ui-section-title); margin-bottom: var(--ui-space-3); }
    .workspace-calculation .interest-guide p, .workspace-calculation .interest-guide a,
    .workspace-calculation .interest-guide summary { font-size: var(--ui-label); line-height: 1.7; }
    .workspace .interest-settings { margin-top: var(--ui-space-4); }
    .workspace .builder-heading { display: block; }
    .workspace .builder-heading h1 { margin: 8px 0 var(--ui-space-2); }
    .workspace .builder-heading .lead { font-size: var(--ui-label); margin: 0; line-height: 1.65; }
    .workspace .document-review-note { font-size: var(--ui-caption); line-height: 1.6; }
    .workspace .builder-group legend { font-size: var(--ui-text); }
    .workspace .builder-consent, .workspace .builder-suitability > p { font-size: var(--ui-label); line-height: 1.65; }
    .workspace .builder-paper .document-text { font-size: var(--ui-text); line-height: 1.8; }
    .workspace .case-search-heading { padding-bottom: var(--ui-space-4); }
    .workspace .case-search-heading .lead { margin-bottom: 0; }
    .workspace .case-search { padding: var(--ui-space-4); border-radius: var(--ui-radius); }
    .workspace .case-search input[type=text] { min-height: var(--ui-control-height); padding: 10px 12px; }
    .workspace .case-search form > label { margin-bottom: var(--ui-space-2); }
    .workspace .case-search .case-hint { margin-top: 6px; }
    .workspace .case-coverage { margin: var(--ui-space-2) 0 var(--ui-space-4); }
    .workspace .case-coverage > summary { padding: var(--ui-space-2) 0; }
    .workspace .case-results-heading { margin-bottom: var(--ui-space-4); }
    .workspace .case-pagination { margin: var(--ui-space-3) 0; }
    .workspace .case-ai--ready { padding: var(--ui-space-4); column-gap: var(--ui-space-4); }
    .workspace .case-ai--ready h2 { font-size: 20px; line-height: 1.3; margin-bottom: var(--ui-space-1); }
    .workspace .case-ai--ready > p { font-size: var(--ui-label); line-height: 1.6; }
    .workspace .case-ai--ready > .case-hint { margin-top: var(--ui-space-2); }
    .workspace .case-ai-data { margin-top: 0; }
    .workspace .case-ai-data > summary { padding: 4px 0; }
    .workspace .case-hint, .workspace .case-search .case-hint { font-size: var(--ui-caption) !important; }
    .workspace .case-excerpt-body { font-size: var(--ui-text); line-height: 1.75; }
    .workspace .case-result .case-reading { max-width: none; }
    .workspace .case-excerpt-label, .workspace .case-result-actions a { font-size: var(--ui-caption); }
    .assistant-dialog { font-family: var(--ui-font); }
    .assistant-message { font-size: var(--ui-label); line-height: 1.65; }
}
@media screen and (max-width: 780px) {
    .workspace-menu-button, .workspace .notification-link { min-width: 44px; min-height: 44px; }
    .workspace .workspace-close { width: 44px; height: 44px; }
    .workspace .workspace-tool-links > a { min-height: var(--ui-control-height); }
    .workspace .case-ai--ready > form, .workspace .case-ai--ready > .button { margin-top: var(--ui-space-3); }
    .workspace .case-ai--ready .button { width: 100%; }
}
@media screen and (max-width: 420px) {
    .workspace-calculation .interest-invoice-fields { grid-template-columns: minmax(0, 1fr); }
}

/* A report is visible from the first keystroke; only the server supplies totals. */
@media screen {
    .workspace-calculation-result .interest-report-preview { max-width: var(--workspace-paper-max); margin-inline: auto; }
    .workspace-calculation-result .interest-report-paper { background: white; border: 1px solid var(--ui-line); padding: 28px; border-radius: 2px; box-shadow: 0 8px 25px #08045006; min-height: 620px; min-width: 0; overflow-wrap: anywhere; }
    .interest-report-letterhead { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--ui-line); padding-bottom: 20px; margin-bottom: 24px; }
    .interest-report-letterhead img { width: 105px; height: auto; flex-shrink: 0; }
    .interest-report-letterhead > span { font-size: 10px; line-height: 1.5; color: var(--ui-muted); text-align: right; letter-spacing: .06em; }
    .workspace-calculation-result .interest-report-paper .interest-result { border: 0; background: transparent; padding: 0; }
    .workspace-calculation-result .interest-report-paper h2 { font-size: 26px; line-height: 1.25; margin: 12px 0; }
    .workspace-calculation-result .interest-report-paper h3 { font-size: 18px; line-height: 1.4; }
    .workspace-calculation-result .interest-report-paper .interest-totals { margin: 24px 0; }
    .interest-result .interest-totals strong,
    .interest-result .interest-invoice-amount strong,
    .workspace-calculation-result .interest-report-paper .interest-totals strong,
    .workspace-calculation-result .interest-report-paper .interest-invoice-amount strong {
        font-family: var(--ui-font);
        font-weight: 400;
        font-size: var(--ui-report-amount);
        line-height: 1.4;
        font-variant-numeric: tabular-nums;
    }
    .interest-result .interest-totals .interest-total-highlight,
    .workspace-calculation-result .interest-report-paper .interest-totals .interest-total-highlight {
        background: #e7f2ee;
        color: var(--ui-ink);
        border-color: #c4ded4;
        box-shadow: none;
    }
    .interest-preview-badge { display: inline-block; padding: 4px 8px; background: #f9f0d8; border-radius: 5px; color: #70551e; font-size: 12px; }
    .workspace-calculation-result .interest-preview-meta, .workspace-calculation-result .interest-preview-note { font-size: 13px; color: var(--ui-muted); line-height: 1.65; }
    .interest-preview-method { font-size: 13px; padding: 0; background: none; border: 0; }
    .interest-preview-table-wrap { max-width: 100%; overflow-x: auto; }
    .interest-preview-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; text-align: left; }
    .interest-preview-table th, .interest-preview-table td { padding: 10px 6px; border-bottom: 1px solid var(--ui-line); vertical-align: top; overflow-wrap: anywhere; }
    .interest-preview-table th { font-weight: 600; background: var(--ui-surface); }
    [data-interest-preview-notes] { white-space: pre-wrap; font-size: 13px; margin-top: 20px; }
    .workspace-calculation-result .interest-report-preview > .interest-result-actions { position: sticky; top: -24px; z-index: 2; margin: 0 0 16px; padding: 12px 0; background: #f5f8f6; gap: 10px; }
    .workspace-calculation-result[data-stale] .interest-report-preview > .interest-result-actions { display: none; }
}
@media screen and (max-width: 1200px) {
    .workspace-calculation-result .interest-report-paper { padding: 20px; }
}
@media screen and (max-width: 780px) {
    .workspace-calculation-result .interest-report-paper { padding: 20px 16px; min-height: 500px; }
    .workspace-calculation-result .interest-report-preview > .interest-result-actions { position: static; }
    .interest-report-letterhead { gap: 12px; }
}

/* Compact report setup and clear export hierarchy. */
.interest-mode-choice { border:0; padding:0; margin:18px 0 12px; min-width:0; }
.interest-mode-choice legend { font-weight:700; margin-bottom:8px; font-size:14px; }
.interest-mode-buttons { display:flex; gap:3px; padding:4px; background:#f0f5f4; border:1px solid #d5e2df; border-radius:9px; }
.interest-mode-buttons label { position:relative; flex:1; margin:0; cursor:pointer; text-align:center; }
.interest-mode-buttons input { position:absolute; width:1px; height:1px; opacity:0; }
.interest-mode-buttons span { display:block; padding:9px 8px; border:1px solid transparent; border-radius:6px; font-size:13px; font-weight:600; }
.interest-mode-buttons input:checked + span { background:white; border-color:#bdcfcc; box-shadow:0 1px 3px #00005c0b; }
.interest-mode-buttons input:focus-visible + span { outline:2px solid #006f73; outline-offset:2px; }
.interest-result .interest-rate-caption, .interest-report-draft .interest-preview-method { color:#595b70; font-size:13px; line-height:1.5; margin:4px 0 20px; background:none; padding:0; }
.interest-explanations { margin-top:22px; border-top:1px solid #d5e2df; padding-top:14px; font-size:13px; color:#595b70; }
.interest-explanations summary { color:#00005c; font-weight:600; cursor:pointer; }
.interest-method-details { margin-top:12px; }
.interest-explanations p { font-size:13px; }
.interest-report-preview > .interest-result-actions { gap:10px; align-items:center; padding-block:12px; }
.interest-rate-health { margin:18px 0; padding:16px 20px; background:#f3f7f5; border:1px solid #d5e2df; border-radius:10px; font-size:13px; }
.interest-rate-health summary { cursor:pointer; font-weight:600; }
.interest-rate-warning { margin-top:12px; padding:12px 16px; color:#673b16; background:#fff4de; border:1px solid #ebd4a8; border-radius:8px; font-size:14px; }

.interest-report-draft .interest-preview-meta strong,
.interest-report-draft .interest-preview-method strong,
.interest-result .interest-result-meta strong,
.interest-result .interest-rate-caption strong { color:var(--ui-ink); font-weight:700; }

/* Keep court-fee totals readable inside the live report column. */
@media screen {
    .workspace-calculation-result .interest-report-paper .court-totals {
        display: block;
        margin: 24px 0 32px;
        border: 1px solid var(--ui-line);
    }
    .workspace-calculation-result .interest-report-paper .court-totals > div {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px 16px;
        padding: 14px 10px;
        border-radius: 0;
        background: white;
        color: var(--ui-ink);
    }
    .workspace-calculation-result .interest-report-paper .court-totals > div + div {
        border-top: 1px solid #c4ded4;
        background: #e7f2ee;
    }
    .workspace-calculation-result .interest-report-paper .court-totals span {
        font-size: 12px;
    }
    .workspace-calculation-result .interest-report-paper .court-totals strong {
        margin-left: auto;
        font-family: var(--ui-font);
        font-size: var(--ui-report-amount);
        font-weight: 600;
        line-height: 1.4;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }
}
