.bi-shell {
    --bi-bg: #f2f6f6;
    --bi-paper: #ffffff;
    --bi-ink: #102e37;
    --bi-muted: #4c6269;
    --bi-border: #cbdadb;
    --bi-accent: #075f5e;
    --bi-accent-dark: #064748;
    --bi-soft: #edf8f6;
    --bi-error: #8b2525;
    --bi-error-bg: #fff3f1;
    --bi-warn: #72470b;
    --bi-warn-bg: #fff7e7;
}
html[data-theme="dark"] .bi-shell {
    --bi-bg: #111e24;
    --bi-paper: #192b32;
    --bi-ink: #eff6f6;
    --bi-muted: #b7cacc;
    --bi-border: #3e565d;
    --bi-accent: #94e1d4;
    --bi-accent-dark: #075454;
    --bi-soft: #203b41;
    --bi-error: #ffbdb3;
    --bi-error-bg: #442728;
    --bi-warn: #ffd89b;
    --bi-warn-bg: #423522;
}
.bi-shell [hidden] { display: none !important; }
.bi-shell :is(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid #d79535;
    outline-offset: 2px;
}
.bi-shell {
    max-width: 1200px;
    margin-inline: auto;
    padding: 1.4rem clamp(1rem, 4vw, 2rem) 3rem;
    line-height: 1.52;
    color: var(--bi-ink);
}
.bi-shell h1, .bi-shell h2, .bi-shell p { margin: 0; }
.bi-shell a { color: var(--bi-accent); text-underline-offset: .17em; }
.bi-hero {
    padding: clamp(1.35rem, 4.4vw, 3rem);
    margin-bottom: 1.35rem;
    border-radius: 1.2rem;
    color: #fff;
    background: linear-gradient(115deg, #092d39, #075c59);
}
.bi-breadcrumb { display: flex; flex-wrap: wrap; gap: .55rem; font-size: .83rem; }
.bi-breadcrumb a { color: #c6f2ea; }
.bi-hero h1 {
    margin-top: .65rem;
    font-size: clamp(2rem, 4.7vw, 3.7rem);
    line-height: 1.07;
    letter-spacing: -.045em;
}
.bi-hero p { max-width: 44ch; margin-top: .75rem; color: #d6efee; font-size: clamp(1rem, 2vw, 1.15rem); }
.bi-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.bi-side { display: grid; gap: 1.2rem; min-width: 0; }
.bi-card {
    min-width: 0;
    padding: clamp(1rem, 2.4vw, 1.6rem);
    border: 1px solid var(--bi-border);
    border-radius: 1rem;
    background: var(--bi-paper);
    box-shadow: 0 4px 12px #102e3709;
}
.bi-card h2 { font-size: clamp(1.18rem, 2.3vw, 1.55rem); line-height: 1.25; letter-spacing: -.025em; }
.bi-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 1rem; }
.bi-choices button {
    padding: .95rem;
    background: var(--bi-paper);
    color: var(--bi-ink);
    border: 1px solid var(--bi-border);
    border-radius: .75rem;
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.bi-choices button:hover, .bi-choices button[aria-pressed="true"] { border-color: var(--bi-accent); background: var(--bi-soft); }
.bi-choices button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--bi-accent); }
.bi-choices strong, .bi-choices span { display: block; }
.bi-choices span, .bi-hint, .bi-fields small, .bi-support p { color: var(--bi-muted); font-size: .89rem; }
.bi-choices span { margin-top: .3rem; }
.bi-section { min-width: 0; margin: 1.5rem 0 0; padding: .55rem 0 0; border: 0; border-top: 1px solid var(--bi-border); }
.bi-section legend { padding: 0 .6rem 0 0; font-weight: 750; }
.bi-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; align-items: start; }
.bi-fields:not(:first-child), .bi-hint:not(:first-child) { margin-top: .75rem; }
.bi-wide { grid-column: 1 / -1; }
.bi-shell label { display: grid; min-width: 0; gap: .28rem; font-size: .91rem; font-weight: 630; }
.bi-shell small { font-weight: 400; }
.bi-shell input:not([type=checkbox]), .bi-shell select, .bi-shell textarea {
    min-width: 0;
    display: block;
    width: 100%;
    min-height: 2.75rem;
    padding: .42rem .55rem;
    border: 1px solid var(--bi-border);
    border-radius: .5rem;
    background: var(--bi-paper);
    color: var(--bi-ink);
    font: inherit;
    font-size: 1rem;
}
.bi-shell textarea { resize: vertical; }
.bi-shell [aria-invalid=true] { border-color: var(--bi-error); }
.bi-shell .bi-check { display: flex; align-items: flex-start; gap: .55rem; margin-top: .55rem; }
.bi-check input { width: 1.1rem; height: 1.1rem; flex-shrink: 0; accent-color: #075f5e; }
.bi-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }
.bi-button {
    min-height: 2.65rem;
    padding: .5rem .8rem;
    border: 1px solid var(--bi-border);
    border-radius: .55rem;
    background: var(--bi-paper);
    color: var(--bi-accent);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.bi-button:hover { background: var(--bi-soft); }
.bi-button.bi-primary { background: #075f5e; color: #fff; border-color: #075f5e; }
.bi-button.bi-primary:hover { background: #064748; }
.bi-button:disabled { opacity: .64; cursor: wait; }
.bi-details { margin-top: .7rem; border: 1px solid var(--bi-border); border-radius: .65rem; padding: .55rem .75rem; }
.bi-details > summary { font-weight: 700; cursor: pointer; }
.bi-details > p, .bi-details .bi-button, #bi-history-preview { margin-top: .7rem; }
.bi-months { margin-top: .7rem; }
.bi-month {
    display: grid;
    grid-template-columns: minmax(5.5rem, .7fr) minmax(0, 1.1fr) minmax(0, 1fr);
    gap: .55rem;
    align-items: start;
    padding: .6rem 0;
    border-bottom: 1px solid var(--bi-border);
}
.bi-month small { display: block; color: var(--bi-muted); }
.bi-month label { font-size: .79rem; }
.bi-note { margin-top: 1rem; padding: .75rem; border-radius: .65rem; }
.bi-error { color: var(--bi-error); background: var(--bi-error-bg); }
.bi-note ul, .bi-warnings { margin: .35rem 0; padding-inline-start: 1.2rem; }
.bi-result { padding: 0; overflow: hidden; }
.bi-result-header { padding: 1.25rem; background: #074d4e; color: #fff; }
.bi-result-header h2 { font-size: 1.1rem; }
#bi-rmi { font-size: clamp(1.9rem, 4.4vw, 2.8rem); line-height: 1.15; letter-spacing: -.05em; font-weight: 800; margin: .35rem 0; }
#bi-result-condition { font-size: .89rem; color: #d9f1eb; }
.bi-result-body { padding: 1.2rem; }
.bi-result-data { margin: 0; }
.bi-result-data div { padding: .4rem 0; border-bottom: 1px solid var(--bi-border); }
.bi-result-data dt { color: var(--bi-muted); font-size: .82rem; }
.bi-result-data dd { margin: 0; font-weight: 690; }
.bi-warnings { margin-top: .75rem; padding: .55rem .65rem .55rem 1.65rem; border-radius: .55rem; color: var(--bi-warn); background: var(--bi-warn-bg); font-size: .88rem; }
.bi-result-links { margin-top: .65rem; display: flex; flex-wrap: wrap; gap: .45rem 1rem; font-size: .86rem; }
.bi-support { background: var(--bi-soft); }
.bi-support p, .bi-faq > p { margin-top: .6rem; }
.bi-faq { margin-top: 1.2rem; }
.bi-table-wrap { overflow-x: auto; margin-top: .55rem; }
.bi-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.bi-table th, .bi-table td { border-bottom: 1px solid var(--bi-border); padding: .4rem; text-align: left; }
.bi-table th { background: var(--bi-soft); }
#bi-memory-content p { margin-top: .6rem; font-size: .89rem; overflow-wrap: anywhere; }
@media (max-width: 900px) {
    .bi-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .bi-choices, .bi-fields { grid-template-columns: minmax(0, 1fr); }
    .bi-month { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bi-month > strong { grid-column: 1 / -1; }
}
@media print {
    .bi-shell, .bi-layout, .bi-side, #bi-result {
        display: block !important;
        margin: 0;
        padding: 0;
        background: white !important;
        color: black !important;
    }
    body > header, body > footer, .bi-shell .no-print, #bi-result[hidden] { display: none !important; }
    #bi-result { border: 0; box-shadow: none; overflow: visible; }
    .bi-result-header, .bi-result-body { padding: .25rem 0; background: white; color: black; }
    #bi-result-condition, .bi-result-data dt, .bi-hint, .bi-warnings { color: black; }
    .bi-table-wrap { overflow: visible; }
    .bi-table tr { break-inside: avoid; }
}
