:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --line-strong: #d1d5db;
    --accent: #0f5fa8;
    --accent-ink: #ffffff;
    --accent-soft: #e8f1fb;
    --ok: #15803d;
    --ok-soft: #e7f6ec;
    --warn: #b45309;
    --warn-soft: #fef3e2;
    --bad: #b91c1c;
    --bad-soft: #fdecec;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --bs-primary: #0f5fa8;
    --bs-primary-rgb: 15, 95, 168;
}

* { box-sizing: border-box; }

html, body {
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 14px;
}

a { color: var(--accent); }
h1 { font-size: 1.45rem; font-weight: 650; margin: 0; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.small { font-size: .85rem; }

.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover, .btn-primary:focus { background: #0b4f8d; border-color: #0b4f8d; }
.btn-outline-primary { color: var(--accent); border-color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: inherit; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.form-control, .form-select { font-size: .9rem; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: .2rem; text-transform: uppercase; letter-spacing: .02em; }
.form-check-label { font-size: .9rem; }

/* App shell: a white bar, so the fox logo shows clearly */
.app-bar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 1.5rem;
    padding: 0 1.25rem; height: 56px;
    background: var(--surface); color: var(--ink);
    border-bottom: 1px solid var(--line); box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.brand:hover { color: var(--ink); }
.brand-logo { height: 42px; width: auto; display: block; }
.brand-logo.lg { height: 88px; }
.app-nav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.app-nav a { color: var(--muted); text-decoration: none; padding: .45rem .75rem; border-radius: 8px; font-weight: 600; }
.app-nav a:hover { color: var(--ink); background: var(--surface-2); }
.app-nav a.active { color: var(--accent); background: var(--accent-soft); }
.nav-spacer { flex: 1; }
.nav-user { display: flex; align-items: center; gap: .5rem; }
.app-nav a.nav-user { color: var(--ink); font-weight: 500; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .8rem; font-weight: 700; }
.role-chip { font-size: .7rem; padding: .1rem .45rem; border-radius: 999px; background: #eef0f3; color: #4b5563; font-weight: 600; }
.nav-toggle, .nav-burger { display: none; }

.app-main { padding: 1.25rem 1.5rem 3rem; max-width: 1600px; margin: 0 auto; }
/* Who made the app: a quiet line under every page (at the window's foot on a short page) and under the sign-in card */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-shell > .app-main { flex: 1 0 auto; width: 100%; }
.app-footer { text-align: center; font-size: .75rem; color: var(--muted); padding: 0 1rem 1.25rem; margin-top: -1.5rem; }
.quote-list td.iref { max-width: 9rem; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .quote-list-card { overflow-x: auto; } }
.bare-stack { display: grid; justify-items: center; gap: 1rem; width: 100%; }
.bare-footer { font-size: .75rem; color: rgba(255, 255, 255, .7); text-align: center; }
.bare-main { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, #10233d, #1b4a7c); }

@media (max-width: 860px) {
    .app-bar { gap: .75rem; }
    .nav-burger { display: flex; flex-direction: column; gap: 4px; margin-left: auto; cursor: pointer; padding: .5rem; }
    .nav-burger span { width: 20px; height: 2px; background: var(--ink); display: block; }
    .app-nav { display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); padding: .5rem 1rem 1rem;
        border-bottom: 1px solid var(--line); box-shadow: 0 8px 20px rgba(16, 24, 40, .08); }
    .nav-toggle:checked ~ .app-nav { display: flex; }
    .nav-spacer { display: none; }
    .app-main { padding: 1rem .75rem 3rem; }
}

/* Costing banner */
.status-banner { display: flex; align-items: center; gap: .75rem; background: var(--warn-soft); color: #7c3d06; border: 1px solid #f3d19b;
    border-radius: var(--radius); padding: .6rem .9rem; margin-bottom: 1rem; font-size: .9rem; }
.status-banner > span:nth-child(2) { flex: 1; }
.status-banner-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--warn); color: #fff; font-weight: 700; flex: none; }
.price-flag { display: inline-block; margin-left: .3rem; color: var(--warn); font-weight: 700; cursor: help; }
.alert-list { margin: .4rem 0 0; padding-left: 1.1rem; }

/* Cards, headers */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.card-panel + .card-panel { margin-top: 1rem; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.card-title h2 { margin: 0; }
.auth-card { width: min(400px, 100%); background: var(--surface); border-radius: 16px; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card h1 { margin-top: .75rem; }

.status { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; }
.status.draft { background: var(--warn-soft); color: var(--warn); }
.status.issued { background: var(--ok-soft); color: var(--ok); }
.chip { display: inline-block; font-size: .72rem; padding: .1rem .45rem; border-radius: 6px; background: var(--accent-soft); color: var(--accent); margin: 0 .2rem .2rem 0; white-space: nowrap; }
.chip.grey { background: #eef0f3; color: #4b5563; }
.alert-inline { padding: .5rem .75rem; border-radius: 8px; font-size: .85rem; }
.alert-inline.bad { background: var(--bad-soft); color: var(--bad); }
.alert-inline.warn { background: var(--warn-soft); color: var(--warn); }
.alert-inline.ok { background: var(--ok-soft); color: var(--ok); }

/* Tables */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 650; background: var(--surface-2); border-bottom: 1px solid var(--line); padding: .5rem .6rem; text-align: left; white-space: nowrap; }
.data-table td { border-bottom: 1px solid var(--line); padding: .45rem .6rem; vertical-align: middle; }
/* Number columns: the heading and its numbers centred on one axis (the heading style would otherwise left-align it) */
.data-table th.num, .data-table td.num { text-align: center; }
.data-table td.num > .form-control { margin: 0 auto; }
.data-table tbody tr:hover { background: #fafcff; }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.selected { background: var(--accent-soft) !important; }
.data-table tfoot td { font-weight: 650; background: var(--surface-2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table-wrap .data-table th:first-child, .table-wrap .data-table td:first-child { padding-left: .9rem; }

/* Item grid editing */
.item-grid td { padding: .3rem .35rem; }
.item-grid .form-control, .item-grid .form-select { padding: .25rem .4rem; font-size: .85rem; min-width: 0; }
.item-grid .w-tag { width: 78px; }
.item-grid .w-size { width: 92px; }
.item-grid .w-panel { width: 82px; }
.item-grid .w-sel { width: 108px; }
.item-grid .w-fan { width: 168px; }
.item-grid .w-motor { width: 86px; }
.item-grid .w-num { width: 74px; }
.item-grid .w-esp { width: 60px; }
.item-grid .w-qty { width: 52px; }
.item-grid .chips { max-width: 150px; line-height: 1.1; }
.item-grid .form-select { padding-right: 1.4rem; background-position: right .3rem center; }
.price-cell { font-weight: 650; }
.price-error { color: var(--bad); font-size: .78rem; max-width: 220px; white-space: normal; }

/* Editor layout with side panel */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start;
    min-height: calc(100vh - 128px); /* room for the options panel to stay under the quote header on a short quote */ }
.side-panel { position: sticky; top: 140px; max-height: calc(100vh - 152px); overflow-y: auto; border-radius: var(--radius); }
.side-panel .card-panel { padding: .9rem; }
.opt-group { border-top: 1px solid var(--line); padding: .55rem 0 .3rem; }
.opt-group:first-of-type { border-top: 0; padding-top: 0; }
.opt-group > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; user-select: none;
    font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); font-weight: 700; margin: 0 0 .5rem; }
.opt-group > summary::-webkit-details-marker { display: none; }
.opt-group > summary::after { content: "▾"; color: var(--muted); font-size: .9rem; transition: transform .15s; }
.opt-group:not([open]) > summary { margin-bottom: .2rem; }
.opt-group:not([open]) > summary::after { transform: rotate(-90deg); }
.opt-group > summary:hover::after { color: var(--accent); }
.opt-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, 45%); gap: .4rem; align-items: center; margin-bottom: .35rem; }
.opt-row label { font-size: .86rem; }
.opt-row .form-control, .opt-row .form-select { padding: .2rem .4rem; font-size: .85rem; }
.opt-check { display: flex; align-items: center; gap: .45rem; margin-bottom: .3rem; font-size: .86rem; }
.opt-check input { margin: 0; }
.opt-pair { display: grid; grid-template-columns: 1fr 90px; gap: .4rem; align-items: center; margin-bottom: .3rem; }
.layout-list { list-style: none; padding: 0; margin: 0; counter-reset: sec; }
.layout-section { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: .4rem; align-items: center; padding: .15rem 0;
    counter-increment: sec; font-size: .86rem; }
.layout-section .layout-name::before { content: counter(sec) ". "; color: var(--muted); }
.layout-move { display: inline-flex; gap: .2rem; }
.layout-move .btn { padding: 0 .4rem; line-height: 1.3; }
.layout-side { width: auto; min-width: 7.5rem; padding-top: .1rem; padding-bottom: .1rem; }
.layout-joint { padding: 0 0 0 1.2rem; border-left: 2px dotted var(--line); margin-left: .35rem; }
.header-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem 1rem; }
.header-grid .span-2 { grid-column: span 2; }
.totals { display: grid; grid-template-columns: auto auto; gap: .2rem 1.5rem; justify-content: end; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--line-strong); padding-top: .3rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs button, .tabs a { white-space: nowrap; background: none; border: 0; padding: .55rem .9rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; text-decoration: none; }
.tabs button.active, .tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
.kpi .label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kpi .value { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.saved-indicator { font-size: .8rem; color: var(--muted); }
.code { font-family: Consolas, "Cascadia Mono", monospace; font-size: .8rem; }
.search { max-width: 320px; }

@media (max-width: 1350px) {
    /* minmax(0, ...): the item table scrolls inside its own box instead of widening the page and pushing the
       options' drop-downs out of sight. Below the table, the option groups flow into columns. */
    .editor { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .side-panel { position: static; max-height: none; }
    .side-panel fieldset { columns: 300px 3; column-gap: 1.75rem; }
    .side-panel .opt-group { break-inside: avoid; }
    .side-panel .opt-group:first-of-type { border-top: 1px solid var(--line); padding-top: .7rem; }
    .panel-head { position: static; }
}
@media (max-width: 860px) {
    .quote-head { position: static; }
    .quote-total { justify-items: start; }
}
@media (max-width: 720px) {
    .header-grid { grid-template-columns: 1fr 1fr; }
    .header-grid .span-2 { grid-column: span 2; }
}

#blazor-error-ui {
    background: #fff4d6; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.blazor-error-boundary { background: var(--bad-soft); padding: 1rem; color: var(--bad); border-radius: 8px; }
.blazor-error-boundary::after { content: "Something went wrong on this part of the page."; }
.valid.modified:not([type=checkbox]) { outline: none; }
.invalid { outline: 1px solid var(--bad); }
.validation-message { color: var(--bad); }

.fan-check { border-left: 3px solid var(--accent); background: var(--surface-2, #f5f8fc); padding: .4rem .6rem; border-radius: 4px; line-height: 1.45; }
.fan-check.warn { border-left-color: #d08a00; background: #fff7e6; }

/* Bill of materials: a section header row per unit section */
.data-table.bom tr.bom-section td { background: var(--surface-2); font-weight: 650; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding-top: .55rem; }
.data-table tr.changed td { background: #fff7e0; }
.data-table.bom tr.bom-section .normal-case { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Quote editor: a header that stays in view with the offer total, the pricing basis, the offer details as a summary */
.quote-head { position: sticky; top: 56px; z-index: 20; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
    background: var(--bg); padding: .7rem 0 .6rem; margin-bottom: .1rem; }
.quote-head h1 { font-size: 1.4rem; }
.quote-title { flex: 1 1 260px; min-width: 0; }
.quote-sub { margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote-total { display: grid; justify-items: end; line-height: 1.2; padding: .4rem .9rem; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.quote-total .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.quote-total .value { font-size: 1.35rem; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--ink); }
.quote-total .value small { font-size: .75rem; font-weight: 600; color: var(--muted); }
.quote-total .sub { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.quote-head .actions { display: flex; gap: .5rem; align-items: center; }
.quote-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.meta-chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; color: var(--muted); padding: .15rem .6rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.meta-chip strong { color: var(--ink); font-weight: 600; }
.callout { display: flex; align-items: center; gap: .65rem; padding: .55rem .8rem; border-radius: var(--radius); margin-bottom: .8rem; font-size: .88rem; }
.callout > span:nth-child(2) { flex: 1; }
.callout.warn { background: var(--warn-soft); border: 1px solid #f3d19b; color: #7c3d06; }
.callout-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--warn); color: #fff; font-weight: 700; flex: none; }
.btn-warning { background: #f59e0b; border-color: #f59e0b; color: #1f1300; font-weight: 600; }
.details-card { padding: .7rem 1rem; }
.details-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 2rem; }
.details-summary > div { display: flex; flex-direction: column; min-width: 0; }
.details-summary > div.wide { max-width: 360px; }
.details-summary > div > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.details-summary .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.details-summary > button { margin-left: auto; }
.tab-count { display: inline-block; min-width: 1.4em; padding: 0 .4em; margin-left: .25rem; border-radius: 999px; font-size: .72rem;
    background: var(--line); color: var(--ink); text-align: center; }
.tabs button.active .tab-count { background: var(--accent); color: #fff; }

/* Quote items: one compact row per unit and a line of its options under it; the selected unit is marked */
.item-grid tbody.item { cursor: pointer; }
.item-grid tbody.item > tr:first-child > td { border-bottom: 0; padding-top: .45rem; }
.item-grid tbody.item:hover > tr > td { background: #fafcff; }
.item-grid tbody.item.selected > tr > td { background: var(--accent-soft); }
.item-grid tbody.item.selected > tr > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.item-grid tr.item-sub > td { padding: 0 .35rem .45rem .9rem; font-size: .78rem; line-height: 1.7; }
.item-grid tr.item-sub .spec { color: var(--muted); margin-right: .45rem; }
.item-grid tr.item-sub .chip { margin-bottom: 0; }
.item-grid .edit-hint { color: var(--muted); font-style: italic; margin-left: .35rem; visibility: hidden; }
.item-grid tbody.item:hover .edit-hint { visibility: visible; }
.tag-cell { display: flex; align-items: center; gap: .35rem; }
.kind { display: inline-block; font-size: .65rem; font-weight: 700; letter-spacing: .03em; padding: .12rem .38rem; border-radius: 5px; }
.kind.fs { background: #eef0f3; color: #4b5563; }
.kind.ahu { background: var(--accent-soft); color: var(--accent); }
.badge-bad { display: inline-block; font-size: .72rem; font-weight: 650; padding: .1rem .5rem; border-radius: 999px; background: var(--bad-soft); color: var(--bad); cursor: help; }
.row-actions .btn { opacity: .55; padding: .1rem .4rem; }
.item-grid tbody.item:hover .row-actions .btn, .row-actions .btn:focus { opacity: 1; }

/* The selected unit's options: its tag and price stay at the top, previous / next unit */
.panel-head { position: sticky; top: -.9rem; z-index: 2; display: flex; align-items: center; gap: .45rem; background: var(--surface);
    margin: -.9rem -.9rem .7rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.panel-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: .4rem; }
.panel-title h2 { margin: 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-head .btn { padding: .05rem .5rem; }

/* Quotes list */
.search-box { position: relative; }
.search-box .form-control { padding-left: 1.9rem; width: 300px; max-width: 70vw; }
.search-icon { position: absolute; left: .65rem; top: 50%; transform: translateY(-52%); color: var(--muted); pointer-events: none; }
.filter-pills { display: flex; gap: .35rem; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .25rem .75rem; font-size: .85rem; font-weight: 600; }
.pill:hover { border-color: var(--line-strong); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill-count { display: inline-block; min-width: 1.4em; margin-left: .25rem; padding: 0 .35em; border-radius: 999px; font-size: .72rem; background: rgba(0,0,0,.07); text-align: center; }
.pill.active .pill-count { background: rgba(255,255,255,.25); }
.quote-list td { padding-top: .6rem; padding-bottom: .6rem; }
.quote-list .ref { font-weight: 650; text-decoration: none; }
.quote-list .ref:hover { text-decoration: underline; }
.quote-list .client { min-width: 200px; }

/* Bill of materials tab: a toolbar, one unit at a time, a section index to jump to and fold sections */
.bom-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.bom-toolbar .search-box .form-control { width: 260px; }
/* BOM tab: the Excel export menu, each file with what it holds and who it is for */
.xl-badge { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 3px; background: #1d6f42; color: #fff;
    font-size: .62rem; font-weight: 800; line-height: 1; margin-right: .3rem; vertical-align: -2px; }
.xl-badge.lg { width: 30px; height: 30px; border-radius: 7px; font-size: .9rem; margin: 0; flex: none; }
.xl-badge.internal { background: var(--warn); }
.export-menu { position: relative; }
.export-menu > summary { list-style: none; cursor: pointer; user-select: none; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu > summary .caret { font-size: .7rem; color: var(--muted); margin-left: .15rem; }
.export-menu[open] > summary { background: var(--accent-soft); border-color: var(--accent) !important; }
.export-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 360px; max-width: calc(100vw - 32px);
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(16, 24, 40, .16); padding: .4rem; }
.export-head { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .35rem .55rem .25rem; }
.export-opt { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem .55rem; border-radius: 8px; color: var(--ink); text-decoration: none; }
.export-opt:hover, .export-opt:focus-visible { background: var(--surface-2); outline: 1px solid var(--line); color: var(--ink); }
.export-opt.internal:hover, .export-opt.internal:focus-visible { background: var(--warn-soft); outline-color: #f3d19b; }
.export-opt .body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.export-opt .title { font-weight: 650; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.export-opt .file { font-family: ui-monospace, Consolas, monospace; font-size: .74rem; color: var(--muted); overflow-wrap: anywhere; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.cost-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; }
.cost-toolbar .chip { margin-bottom: 0; }
.export-head .chip { text-transform: none; letter-spacing: 0; }
.export-foot { border-top: 1px solid var(--line); margin-top: .3rem; padding: .5rem .55rem .3rem; font-size: .78rem; color: var(--muted); }
.seg { display: inline-flex; background: #e9edf2; border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: .3rem .8rem; border-radius: 7px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.switch { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 600; cursor: pointer; margin: 0; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 34px; height: 19px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { left: 17px; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.unit-cards { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.unit-card { display: grid; gap: .1rem; text-align: left; min-width: 170px; padding: .5rem .8rem; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); }
.unit-card:hover { border-color: var(--line-strong); }
.unit-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.bom-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1rem; align-items: start; }
.bom-index { position: sticky; top: 140px; max-height: calc(100vh - 152px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: .6rem .5rem; font-size: .84rem; }
.bom-index-head { display: flex; justify-content: space-between; align-items: center; padding: 0 .35rem .4rem; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted); font-weight: 650; }
.bom-index-head .btn-link { font-size: .72rem; text-transform: none; letter-spacing: 0; }
.bom-index-item { display: flex; align-items: center; gap: .45rem; width: 100%; text-align: left; border: 0; background: none; padding: .3rem .4rem; border-radius: 6px; }
.bom-index-item:hover { background: var(--accent-soft); }
.bom-index-item .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bom-index-item .muted { font-size: .75rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bom-index-item.folded .name { color: var(--muted); }
.bom-legend { border-top: 1px solid var(--line); margin-top: .4rem; padding: .45rem .35rem 0; font-size: .72rem; color: var(--muted); }
.side-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; vertical-align: middle; }
.side-dot.main { background: var(--accent); }
.side-dot.acc { background: #9ca3af; }
.side-dot.unit { background: transparent; border: 1.5px solid #9ca3af; }
.bom-card { padding-top: .8rem; }
.bom-sticky thead th { position: sticky; top: 134px; z-index: 3; box-shadow: 0 1px 0 var(--line); }
.data-table.bom tr.bom-section { cursor: pointer; scroll-margin-top: 175px; }
.data-table.bom tr.bom-section:hover td { background: #eef3fa; }
.data-table.bom tr.bom-section .fold { display: inline-block; width: 1em; color: var(--accent); }
.data-table.bom tr.bom-section .chip { text-transform: none; letter-spacing: 0; font-weight: 600; }
.line-note { color: var(--muted); font-size: .76rem; margin-top: .1rem; }
.line-note.cost { color: #7c5a12; }
.weights .bar-col { width: 22%; min-width: 120px; }
.kg-bar { height: 8px; border-radius: 999px; background: #eef1f5; overflow: hidden; }
.kg-bar span { display: block; height: 100%; background: linear-gradient(90deg, #1b7fd6, #0f5fa8); border-radius: 999px; }
.kg-bar.unit span { background: #9ca3af; }
.weights tr.part-row td { color: var(--muted); font-style: italic; background: var(--surface-2); }
@media (max-width: 1100px) {
    .bom-layout { grid-template-columns: minmax(0, 1fr); }
    .bom-index { position: static; max-height: 240px; }
    .bom-sticky thead th { position: static; }
    .bom-card { overflow-x: auto; }
}

/* Cost tab: the quote's figures, one unit at a time, its price build-up and where its cost goes */
.cost-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.cost-kpis .kpi { background: var(--surface); box-shadow: var(--shadow); }
.kpi .value small { font-size: .72rem; font-weight: 600; color: var(--muted); }
.kpi .value.neg { color: var(--bad); }
.kpi .value.small-value { font-size: .92rem; padding-top: .2rem; }
.cost-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.cost-layout > .card-panel + .card-panel { margin-top: 0; }
.buildup { display: grid; gap: .1rem; font-variant-numeric: tabular-nums; }
.buildup .step { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem .1rem; border-bottom: 1px dashed var(--line); }
.buildup .step .num { text-align: right; }
.buildup .step.sum { font-weight: 650; border-bottom-style: solid; }
.buildup .step.op { color: var(--accent); font-weight: 600; }
.buildup .step.note { color: var(--muted); font-size: .8rem; border-bottom: 0; padding-top: .1rem; }
.buildup .step.total { font-weight: 750; font-size: 1.05rem; border-top: 1px solid var(--line-strong); border-bottom: 0; margin-top: .2rem; padding-top: .45rem; }
.buildup .step.margin { color: var(--ok); font-weight: 650; border-bottom: 0; }
.buildup .step.margin.neg { color: var(--bad); }
.cost-bars { display: grid; gap: .15rem; }
.cost-bar { display: grid; grid-template-columns: minmax(130px, 200px) minmax(0, 1fr) 90px 56px; align-items: center; gap: .6rem; width: 100%;
    border: 0; background: none; padding: .25rem .35rem; border-radius: 6px; text-align: left; font-size: .84rem; }
.cost-bar:hover { background: var(--accent-soft); }
.cost-bar.active { background: var(--accent-soft); font-weight: 650; }
.cost-bar.dim { opacity: .45; }
.cost-bar .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cost-bar .bar { height: 10px; border-radius: 999px; background: #eef1f5; overflow: hidden; }
.cost-bar .bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #1b7fd6, #0f5fa8); }
.cost-bar .num { text-align: center; font-variant-numeric: tabular-nums; }
.cost-lines td .line-note { font-size: .72rem; }
@media (max-width: 1100px) {
    .cost-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Taxes & notes tab: the taxes with their amounts, the pricing basis, the offer notes, and the offer total beside them */
.terms-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.terms-layout > div > .card-panel + .card-panel { margin-top: 1rem; }
.terms-summary { position: sticky; top: 140px; }
.tax-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 120px 130px; align-items: center; gap: .9rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.tax-row:first-of-type { border-top: 0; padding-top: .2rem; }
.tax-text { display: grid; gap: .1rem; min-width: 0; }
.tax-amount { text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.basis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)) minmax(0, 1fr); gap: .75rem 1rem; align-items: start; }
.basis-grid > div { display: grid; gap: .25rem; justify-items: start; }
.basis-grid .form-control, .basis-grid .form-select { width: 100%; }
.basis-grid .span-2 { grid-column: span 1; }
.notes-box { font-size: .9rem; line-height: 1.5; resize: vertical; }
@media (max-width: 1100px) {
    .terms-layout { grid-template-columns: minmax(0, 1fr); }
    .terms-summary { position: static; }
    .basis-grid { grid-template-columns: 1fr 1fr; }
    .basis-grid .span-2 { grid-column: span 2; }
}
@media (max-width: 600px) {
    .tax-row { grid-template-columns: auto minmax(0, 1fr); }
    .tax-row .tax-pct, .tax-row .tax-amount { grid-column: 2; justify-self: start; }
}

/* Revisions tab: a timeline, newest first, each revision with what changed since the one before */
.rev-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .6rem; }
.rev-timeline { list-style: none; margin: 0; padding: 0 0 0 1.4rem; position: relative; }
.rev-timeline::before { content: ""; position: absolute; left: .45rem; top: .6rem; bottom: .6rem; width: 2px; background: var(--line); }
.rev { position: relative; margin-bottom: .75rem; }
.rev-dot { position: absolute; left: -1.25rem; top: 1.05rem; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--warn); }
.rev.issued .rev-dot { border-color: var(--ok); background: var(--ok); }
.rev.current .rev-card { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.rev-card { padding: .75rem 1rem; }
.rev-top { display: flex; align-items: flex-start; gap: 1rem; }
.rev-top > div:first-child { flex: 1; min-width: 0; }
.rev-ref { font-size: 1.02rem; }
.rev-total { display: grid; justify-items: end; line-height: 1.25; font-variant-numeric: tabular-nums; }
.rev-total .value { font-weight: 750; font-size: 1.1rem; }
.rev-total .value small { font-size: .72rem; color: var(--muted); font-weight: 600; }
.rev-delta { font-size: .78rem; font-weight: 650; color: var(--muted); }
.rev-delta.up { color: var(--warn); }
.rev-delta.down { color: var(--ok); }
.rev-changes { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed var(--line); }
.rev-changes ul { margin: .25rem 0 0; padding-left: 1.1rem; font-size: .86rem; }
.rev-changes li { margin-bottom: .1rem; }
@media (max-width: 720px) {
    .rev-top { flex-wrap: wrap; }
    .rev-total { justify-items: start; }
}

/* Prices page: status cards, one section at a time, price checks with filters and a selection bar */
.price-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem; margin-bottom: .9rem; }
.kpi-card { display: grid; gap: .05rem; text-align: left; padding: .6rem .85rem; background: var(--surface); border: 1px solid var(--line);
    border-left: 4px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi-card:hover { border-color: var(--line-strong); }
.kpi-card .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }
.kpi-card .value { font-size: 1.25rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.kpi-card .sub { font-size: .76rem; color: var(--muted); }
.kpi-card.ok { border-left-color: var(--ok); }
.kpi-card.warn { border-left-color: var(--warn); }
.kpi-card.warn .value { color: var(--warn); }
.kpi-card.bad { border-left-color: var(--bad); }
.kpi-card.bad .value { color: var(--bad); }
.empty-ok { padding: 1.5rem; text-align: center; color: var(--ok); font-weight: 600; background: var(--ok-soft); border-radius: var(--radius); }
.check-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .6rem; }
.seg .pill-count { background: rgba(0,0,0,.07); }
.kind-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.kind-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .15rem .6rem; font-size: .78rem; font-weight: 600; color: #4b5563; }
.kind-chip.static { cursor: default; white-space: nowrap; }
.kind-chip.bad { color: var(--bad); border-color: #f3c4c4; background: var(--bad-soft); }
.kind-chip.series { color: #6d28d9; border-color: #ddd0fb; background: #f3effe; }
.kind-chip.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.select-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem .7rem; margin-bottom: .6rem; border-radius: var(--radius);
    background: var(--accent-soft); border: 1px solid #c9dcf3; }
.select-bar .form-control { max-width: 300px; }
.scroll-box { max-height: 62vh; overflow: auto; }
.sticky-head thead th { position: sticky; top: 0; z-index: 2; }
.sync-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.sync-cards > .card-panel + .card-panel { margin-top: 0; }
.facts { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: .3rem .75rem; font-size: .86rem; margin: 0 0 .5rem; }
.facts dt { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; padding-top: .1rem; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.run-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.run-dot.ok { background: var(--ok); }
.run-dot.bad { background: var(--bad); }
.manual-form { display: grid; grid-template-columns: 1.2fr 2fr .6fr .8fr .7fr 2fr; gap: .6rem; align-items: end; }
@media (max-width: 1000px) { .manual-form { grid-template-columns: 1fr 1fr; } .manual-form .wide { grid-column: span 2; } }
.dropzone { position: relative; display: grid; justify-items: center; gap: .25rem; padding: 1.6rem; border: 2px dashed var(--line-strong);
    border-radius: var(--radius); background: var(--surface-2); cursor: pointer; text-align: center; }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-icon { font-size: 1.6rem; color: var(--accent); line-height: 1; }
.upload-preview { margin-top: .8rem; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }

/* Settings page: a section menu, one section at a time, each setting as a row, a save bar when something changed */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; align-items: start; padding-bottom: 3rem; }
.settings-nav { position: sticky; top: 72px; display: grid; gap: .1rem; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: .6rem .45rem; }
.settings-nav .nav-head { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: .2rem .55rem; }
.settings-nav button, .settings-nav a { text-align: left; border: 0; background: none; padding: .4rem .55rem; border-radius: 7px; color: var(--ink);
    text-decoration: none; font-size: .9rem; }
.settings-nav button:hover, .settings-nav a:hover { background: var(--accent-soft); }
.settings-nav button.active { background: var(--accent); color: #fff; font-weight: 600; }
.settings-nav a::after { content: " ›"; color: var(--muted); }
.settings-body { max-width: 900px; }
.set-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; padding: .9rem 0 .2rem; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 260px); gap: 1.25rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--line); }
.card-title + .set-row, .set-group + .set-row { border-top: 0; }
.set-label { display: grid; gap: .1rem; }
.set-label span { color: var(--muted); font-size: .82rem; }
.set-control { display: flex; align-items: center; gap: .6rem; }
.set-control .input-group { flex: 1; }
.set-control.wide { min-width: 0; }
.set-control.stack { flex-direction: column; align-items: stretch; gap: .3rem; }
.set-row:has(.set-control.wide) { grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); align-items: start; }
.ref-preview { display: flex; flex-wrap: wrap; gap: .5rem 2rem; padding: .7rem .9rem; border-radius: var(--radius); background: var(--accent-soft); margin-top: .4rem; }
.ref-preview > div { display: grid; }
.ref-preview .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }
.ref-preview.bad { background: var(--bad-soft); color: var(--bad); }
.save-bar { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: .6rem;
    padding: .55rem .6rem .55rem 1rem; background: #10233d; color: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(16,24,40,.3); font-size: .9rem; }
.save-bar.done { background: var(--ok); padding-right: 1rem; }
@media (max-width: 900px) {
    .settings-layout { grid-template-columns: minmax(0, 1fr); }
    .settings-nav { position: static; grid-auto-flow: column; overflow-x: auto; }
    .settings-nav .nav-head, .settings-nav p { display: none; }
    .set-row, .set-row:has(.set-control.wide) { grid-template-columns: minmax(0, 1fr); gap: .4rem; }
}

/* Users page: role cards that filter, an add panel with role choices, one row per user */
.role-badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .03em; padding: .15rem .55rem; border-radius: 999px; }
.role-badge.admin { background: #fde8e8; color: #9b1c1c; }
.role-badge.costing { background: #fef3e2; color: #92400e; }
.role-badge.user { background: var(--accent-soft); color: var(--accent); }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.role-card { display: grid; gap: .35rem; text-align: left; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); }
.role-card:hover { border-color: var(--line-strong); }
.role-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.role-card .count { font-size: 1.3rem; }
.add-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.add-grid > div { display: grid; gap: .2rem; align-content: start; }
.role-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.role-option { display: grid; gap: .3rem; justify-items: start; text-align: left; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.role-option.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.user-list { padding-bottom: .4rem; }
.user-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 150px auto; gap: .9rem; align-items: center; padding: .65rem 0; border-top: 1px solid var(--line); }
.user-list .card-title + .user-row { border-top: 0; }
.avatar.lg { width: 36px; height: 36px; font-size: .85rem; background: var(--accent-soft); color: var(--accent); }
.who { min-width: 0; }
.who .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions-cell { display: flex; gap: .35rem; align-items: center; justify-content: flex-end; }
.actions-cell .form-control { width: 170px; }
@media (max-width: 760px) {
    .add-grid, .role-pick { grid-template-columns: minmax(0, 1fr); }
    .user-row { grid-template-columns: auto minmax(0, 1fr); }
    .role-cell, .actions-cell { grid-column: 2; justify-content: flex-start; }
}

/* Costing rules page: a side menu with the tables, changed values marked, corrections as cards */
.seg a { display: inline-block; padding: .3rem .8rem; border-radius: 7px; font-size: .85rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.seg a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.rules-layout { grid-template-columns: 250px minmax(0, 1fr); }
.wide-body { max-width: none; }
.nav-count { display: inline-block; min-width: 1.6em; padding: 0 .35em; margin-left: .2rem; border-radius: 999px; font-size: .7rem; background: var(--line);
    color: var(--ink); text-align: center; }
.settings-nav button.active .nav-count { background: rgba(255,255,255,.25); color: #fff; }
.nav-sub { display: block; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-nav button.active .nav-sub { color: rgba(255,255,255,.8); }
.nav-scroll { display: grid; grid-template-columns: minmax(0, 1fr); gap: .1rem; max-height: calc(100vh - 430px); min-height: 160px; overflow-y: auto; overflow-x: hidden; }
.nav-scroll button { min-width: 0; }
.rules-layout .settings-nav { top: 64px; }
.data-table td.changed-cell { background: #fff7e0; }
.data-table td.changed-cell .form-control { border-color: #f3c76b; }
.data-table td.expr { word-break: break-word; }
.lookup td { padding: .2rem .25rem; }
.corrections { display: grid; gap: .5rem; }
.correction { border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .75rem; display: grid; gap: .25rem; }
.correction .diff { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .5rem; align-items: start; font-size: .78rem; }
.correction .was, .correction .now { padding: .25rem .45rem; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; word-break: break-all; }
.correction .was { background: var(--bad-soft); color: #7f1d1d; }
.correction .now { background: var(--ok-soft); color: #14532d; }
.correction .arrow { color: var(--muted); padding-top: .2rem; }
.save-bar .form-control { background: #fff; }

/* BOM structure page: sections as two columns to move between, bill lines folded by section, a preview beside them */
.bomstruct-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; padding-bottom: 3rem; }
.preview-panel { position: sticky; top: 72px; }
.side-board { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.side-board > .card-panel + .card-panel { margin-top: 0; }
.side-col.main { border-top: 3px solid var(--accent); }
.side-col.accessories { border-top: 3px solid #9ca3af; }
.side-col .card-title h2 { display: flex; align-items: center; gap: .45rem; }
.side-item { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem .4rem; border-radius: 7px; font-size: .9rem; }
.side-item:hover { background: var(--surface-2); }
.side-item.changed { background: #fff7e0; }
.side-item .btn { padding: .05rem .5rem; font-size: .78rem; opacity: .7; }
.side-item:hover .btn { opacity: 1; }
@media (max-width: 1150px) {
    .bomstruct-layout { grid-template-columns: minmax(0, 1fr); }
    .preview-panel { position: static; }
}
@media (max-width: 700px) { .side-board { grid-template-columns: minmax(0, 1fr); } }

/* Nicotra backup page: series rates with the ERP's range, a progress line while refreshing */
.rate-head, .rate-row { display: grid; grid-template-columns: 160px 130px minmax(0, 1fr); gap: 1rem; align-items: center; }
.rate-head { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: 0 .4rem .3rem; }
.rate-row { padding: .55rem .4rem; border-top: 1px solid var(--line); }
.rate-row.changed { background: #fff7e0; }
.rate-row.missing .input-group .form-control { border-color: #f3c76b; }
.rate-seen { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.range-bar { position: relative; width: 200px; height: 10px; border-radius: 999px; background: #eef1f5; flex: none; }
.range-bar .span { position: absolute; top: 0; bottom: 0; background: #bcd3ef; border-radius: 999px; min-width: 3px; }
.range-bar .median { position: absolute; top: -3px; width: 3px; height: 16px; background: var(--accent); transform: translateX(-50%); border-radius: 2px; }
.range-bar .rate { position: absolute; top: -4px; width: 12px; height: 12px; margin-top: 3px; background: #f59e0b; border: 2px solid #fff; border-radius: 50%;
    transform: translateX(-50%); box-shadow: 0 0 0 1px #b45309; }
.legend { display: inline-block; vertical-align: middle; margin-right: .25rem; }
.legend.span { width: 18px; height: 8px; border-radius: 999px; background: #bcd3ef; }
.legend.median { width: 3px; height: 12px; background: var(--accent); }
.legend.rate { width: 10px; height: 10px; border-radius: 50%; background: #f59e0b; }
.progress-line { position: relative; height: 26px; border-radius: 999px; background: #eef1f5; overflow: hidden; }
.progress-line span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #1b7fd6, #0f5fa8); transition: width .3s; }
.progress-line em { position: relative; display: block; text-align: center; line-height: 26px; font-size: .8rem; font-style: normal; font-weight: 600; color: var(--ink); }
.kpi-card .value small { font-size: .8rem; font-weight: 600; }
@media (max-width: 800px) { .rate-head { display: none; } .rate-row { grid-template-columns: 1fr 120px; } .rate-seen { grid-column: span 2; } }

/* Quotes list: cards that filter, a toolbar, a totals line */
.kpi-card.active-card { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.quote-list-card { padding-top: .75rem; }
.quote-list-card .sticky-head thead th { top: 56px; }
.quote-list tfoot td { font-size: .85rem; }
.quote-list .row-actions .btn { opacity: .6; padding: .1rem .5rem; }
.quote-list tr:hover .row-actions .btn { opacity: 1; }
