/* Man-Con brand system (from the company letterhead): Arial, navy #071D50, gray #6E6E73, navy rules. */
:root {
    --brand: #071d50;
    --brand-tint: #eef1f7;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #1b2230;
    --muted: #6e6e73;
    --line: #e1e4ea;
    --line-strong: #c9ced8;
    --accent: #071d50;
    --accent-ink: #ffffff;
    --danger: #b42318;
    --sel: #eef1f7;
    --hover: #f3f5f8;
    --good: #1a7f37;
    --warn: #9a6700;
    --warn-bg: #fff8e1;
    --low: #e6f4ea;
    --input: #ffffff;
    --head: #f4f6f9;
    --radius: 4px;
    font-size: 13px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --brand-tint: #1a2440;
        --bg: #12151b;
        --panel: #1a1e25;
        --ink: #e6e9ee;
        --muted: #9aa1ab;
        --line: #2a3039;
        --line-strong: #3a414c;
        --accent: #a9bbf2;
        --accent-ink: #0b1230;
        --danger: #f97066;
        --sel: #1d2747;
        --hover: #222832;
        --good: #5cc97a;
        --warn: #e0b341;
        --warn-bg: #2e2717;
        --low: #1c3324;
        --input: #12151b;
        --head: #20252d;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Arial, Helvetica, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
body { display: flex; flex-direction: column; min-height: 100vh; }
h1:focus { outline: none; }
h1 { font-size: 20px; margin: 0 0 12px; font-weight: 700; letter-spacing: -.01em; color: var(--brand); }
h2 { font-size: 14px; margin: 0 0 8px; font-weight: 700; color: var(--brand); }
h3 { font-size: 11px; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
@media (prefers-color-scheme: dark) { h1, h2 { color: var(--ink); } }
a { color: var(--accent); }
table.grid a { text-decoration: none; font-weight: 700; }
table.grid a:hover { text-decoration: underline; }

/* Header: white bar with the navy logo and a navy rule, as on the letterhead. */
.topbar { display: flex; align-items: center; gap: 36px; padding: 0 24px; height: 66px; background: var(--panel); border-bottom: 2px solid var(--brand); position: relative; z-index: 5; }
.topbar .brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.topbar .brand img { height: 32px; display: block; }
.topbar .brand .logo-dark { display: none; }
.topbar .brand .product { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); border-left: 1px solid var(--line-strong); padding-left: 14px; }
.topbar nav { display: flex; gap: 4px; height: 100%; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: 0 12px; display: flex; align-items: center; border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 600; }
.topbar nav a:hover { color: var(--brand); }
.topbar nav a.active { color: var(--brand); border-bottom-color: var(--brand); }
@media (prefers-color-scheme: dark) {
    .topbar { background: var(--brand); border-bottom-color: #2d4580; }
    .topbar .brand .logo-light { display: none; }
    .topbar .brand .logo-dark { display: block; }
    .topbar .brand .product { color: rgba(255,255,255,.7); border-left-color: rgba(255,255,255,.3); }
    .topbar nav a { color: rgba(255,255,255,.7); }
    .topbar nav a:hover, .topbar nav a.active { color: #fff; border-bottom-color: #fff; }
}

.page { padding: 20px 24px; flex: 1; }

/* Footer: navy rule and gray type, as on the letterhead. */
.sitefoot { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; padding: 10px 24px 14px; border-top: 2px solid var(--brand); color: var(--muted); font-size: 11px; background: var(--panel); }
.sitefoot .tagline { color: var(--brand); font-weight: 700; letter-spacing: .02em; margin-right: auto; }
@media (prefers-color-scheme: dark) { .sitefoot .tagline { color: var(--accent); } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.good { color: var(--good); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.b { font-weight: 700; }

button, .btn {
    font: inherit; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
    padding: 4px 10px; border-radius: 4px; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: var(--hover); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.1); }
button.danger { color: var(--danger); }
button:disabled { opacity: .45; cursor: default; }
button.sm { padding: 1px 6px; font-size: 12px; }

input, select, textarea {
    font: inherit; color: var(--ink); background: var(--input); border: 1px solid var(--line-strong);
    border-radius: var(--radius); padding: 4px 7px;
}
input[type=number] { text-align: right; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label.field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
label.field input, label.field select { color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; }

/* Spreadsheet-style tables */
table.grid { border-collapse: collapse; width: 100%; background: var(--panel); }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 4px 7px; }
table.grid th { background: var(--head); font-weight: 700; font-size: 11px; letter-spacing: .02em; color: var(--brand); text-align: left; position: sticky; top: 0; z-index: 1; white-space: nowrap; border-bottom: 1px solid var(--line-strong); }
@media (prefers-color-scheme: dark) { table.grid th { color: var(--ink); } }
table.grid th.num { text-align: right; }
table.grid tbody tr:hover { background: var(--hover); }
table.grid td.edit { padding: 0; }
table.grid td.edit input, table.grid td.edit select {
    width: 100%; border: none; border-radius: 0; background: transparent; padding: 3px 6px;
}
table.grid tfoot td { background: var(--head); font-weight: 700; border-top: 1px solid var(--line-strong); }
table.grid tr.sel { background: var(--sel); }
table.grid tr.hdr td { background: var(--brand-tint); font-weight: 700; }
.scroll { overflow: auto; }

/* Estimate workspace */
.est-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.est-head .code { font-weight: 700; color: var(--accent-ink); background: var(--brand); padding: 3px 8px; border-radius: 2px; letter-spacing: .03em; }
.est-head .total { margin-left: auto; font-size: 15px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
@media (prefers-color-scheme: dark) { .tabs a.active { color: var(--ink); border-bottom-color: var(--accent); } }
.tabs a:hover { color: var(--ink); }
.tabs .sep { flex: 1; }
/* Estimating tree */
.tree-layout { display: grid; grid-template-columns: minmax(380px, 38%) 1fr; gap: 12px; height: calc(100vh - 150px); }
.tree { overflow: auto; padding: 0; }
.tree .toolbar { position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--line); padding: 6px; display: flex; gap: 4px; flex-wrap: wrap; z-index: 2; }
.node { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 4px; padding: 3px 6px; cursor: pointer; border-bottom: 1px solid transparent; white-space: nowrap; }
.node:hover { background: var(--hover); }
.node.sel { background: var(--sel); }
.node .tw { color: var(--muted); text-align: center; font-size: 10px; }
.node .lbl { overflow: hidden; text-overflow: ellipsis; }
.node .lbl .c { font-weight: 600; margin-right: 6px; }
.node .amt { font-variant-numeric: tabular-nums; color: var(--muted); }
.node.l1 { font-weight: 500; border-bottom-color: var(--line); }
.node.l1.indirect .c::after { content: " IND"; color: var(--warn); font-size: 10px; }
.node.l2 { padding-left: 22px; }
.node.l3 { padding-left: 40px; color: var(--muted); }
.kind { display: inline-block; width: 18px; text-align: center; font-size: 10px; font-weight: 700; border-radius: 3px; margin-right: 4px; }
.kind.Labor { background: #dbeafe; color: #1e40af; }
.kind.Equipment { background: #fef3c7; color: #92400e; }
.kind.PermMaterial { background: #dcfce7; color: #166534; }
.kind.ConstMaterial { background: #e0f2f1; color: #115e59; }
.kind.Subcontract { background: #ede9fe; color: #5b21b6; }
.detail { overflow: auto; }

.stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 2px; padding: 6px 12px; min-width: 120px; }
.stat .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.stat .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }

.warnings { background: var(--warn-bg); border: 1px solid var(--warn); color: var(--warn); border-radius: 4px; padding: 6px 10px; margin-bottom: 8px; }
.warnings ul { margin: 4px 0 0; padding-left: 18px; }

/* Quote folder */
.quote-layout { display: grid; grid-template-columns: 220px 1fr; gap: 12px; }
/* Estimate tabs: upper tier (sections) and lower tier (work screens), as on HeavyBid */
.tier1 { display: flex; gap: 28px; border-bottom: 2px solid var(--brand); margin: 4px 0 0; }
.tier1 a { padding: 6px 0 7px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tier1 a:hover { color: var(--ink); }
.tier1 a.active { color: var(--brand); border-bottom-color: var(--brand); }
@media (prefers-color-scheme: dark) { .tier1 { border-bottom-color: var(--accent); } .tier1 a.active { color: var(--ink); border-bottom-color: var(--accent); } }
.tier1 + .tabs { margin-top: 0; gap: 0; background: var(--brand-tint); border-bottom: 1px solid var(--line); padding: 0 4px; }
.tier1 + .tabs a { padding: 7px 14px; font-size: 12.5px; font-weight: 600; border-bottom-width: 2px; }
.tier1 + .tabs a.active { background: var(--panel); }
.tier1.solo { margin-bottom: 14px; }
.folder-list a { display: block; padding: 5px 8px; border-radius: 4px; text-decoration: none; color: var(--ink); }
.folder-list a.active { background: var(--sel); font-weight: 600; }
.folder-list a:hover { background: var(--hover); }
td.low { background: var(--low); }
td.chosen { outline: 2px solid var(--good); outline-offset: -2px; }

.setup-grid { display: grid; grid-template-columns: 320px 1fr; gap: 12px; align-items: start; }
.setup-grid > .panel { min-width: 0; overflow: auto; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .setup-grid, .summary-grid { grid-template-columns: 1fr; } }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 2px; background: var(--brand-tint); color: var(--brand); }
@media (prefers-color-scheme: dark) { .tag { color: var(--accent); } }
.tag.alt { color: var(--warn); background: var(--warn-bg); }
.bigtotal { font-size: 22px; font-weight: 700; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    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; }

/* ---------- shared controls ---------- */
input.search { flex: 1; min-width: 260px; font-size: 15px; padding: 7px 10px; border-radius: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.seg button { border: none; border-radius: 0; padding: 5px 12px; background: var(--panel); color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.notice { background: var(--sel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.tb-sep { width: 1px; background: var(--line); margin: 0 4px; align-self: stretch; }
table.grid.compact td, table.grid.compact th { padding: 3px 6px; }
table.grid tfoot tr.sub td { font-weight: 400; color: var(--muted); background: var(--panel); }

/* ---------- estimate header ---------- */
.est-head .kv { display: inline-flex; flex-direction: column; align-items: flex-end; margin-left: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.est-head .kv span { font-size: 11px; font-weight: 400; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- bid review ---------- */
.review-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.review-status { font-size: 16px; font-weight: 600; padding: 6px 12px; border-radius: 6px; }
.review-status.ok { background: var(--low); color: var(--good); }
.review-status.meh { background: var(--warn-bg); color: var(--warn); }
.review-status.bad { background: #fde8e7; color: var(--danger); }
.sev { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; }
.sev.error { background: #fde8e7; color: var(--danger); }
.sev.warning { background: var(--warn-bg); color: var(--warn); }
.sev.info { background: var(--sel); color: var(--accent); }

/* ---------- reports: company letterhead (Arial, navy #071D50 rules, gray #6E6E73) ---------- */
.report { background: #fff; color: #111; border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 44px 28px; max-width: 1100px; font-family: Arial, Helvetica, sans-serif; box-shadow: 0 1px 2px rgba(7,29,80,.06); }
.report-head { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 2px solid #071d50; padding-bottom: 10px; }
.report-head img { height: 34px; }
.report-head span { color: #071d50; font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.report-meta { margin: 18px 0 16px; }
.report-title { font-size: 18px; font-weight: 700; color: #071d50; letter-spacing: .01em; }
.report-project { font-weight: 700; margin-top: 2px; }
.report .muted { color: #6e6e73; }
.report h3 { color: #071d50; }
table.report-table { background: #fff; }
table.report-table th, table.report-table td { border-color: #dfe2e8; color: #111; }
table.report-table th { color: #071d50; background: #f3f5f9; }
table.report-table tfoot td, table.report-table tr.hdr td { background: #f3f5f9; }
.report-foot { display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: center; margin-top: 28px; padding-top: 10px; border-top: 2px solid #071d50; font-size: 10px; color: #6e6e73; line-height: 1.45; }
.report-foot b { color: #071d50; }
.report-tagline { text-align: center; color: #071d50; font-weight: 700; font-size: 11px; letter-spacing: .03em; }
/* ---------- HeavyBid-style screens (Bid Summary / Bid Pricing) ---------- */
.subtabs { display: flex; gap: 2px; margin: -6px 0 14px; border-bottom: 1px solid var(--line); }
.subtabs a { padding: 6px 12px; color: var(--muted); text-decoration: none; border: 1px solid transparent; border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -1px; font-size: 12px; font-weight: 600; }
.subtabs a.active { background: var(--panel); color: var(--brand); border-color: var(--line); }
@media (prefers-color-scheme: dark) { .subtabs a.active { color: var(--ink); } }
.hb-grid3 { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr) minmax(380px, 1.1fr); gap: 14px; align-items: start; }
@media (max-width: 1300px) { .hb-grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .hb-grid3 { grid-template-columns: 1fr; } }
.hb-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px 12px; margin-bottom: 12px; }
.hb-title { margin: 0 -12px 10px; padding: 9px 12px 7px; background: var(--panel); border-bottom: 2px solid var(--brand); font-weight: 700; color: var(--brand); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
@media (prefers-color-scheme: dark) { .hb-title { color: var(--accent); border-bottom-color: var(--accent); } }
.hb-run { display: grid; grid-template-columns: auto auto auto auto; gap: 4px 10px; justify-content: center; align-items: baseline; }
.hb-run span { color: var(--muted); }
.hb-spreads { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
td.hl, b.hl, .hl { background: #fff3b0; color: #111; font-weight: 700; padding: 1px 6px; }
.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-row { display: grid; grid-template-columns: 1fr 14px 1fr 14px 1fr; gap: 6px; align-items: end; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.kpi-row:last-child { border-bottom: none; }
.kpi-row .k { font-size: 10.5px; color: var(--muted); line-height: 1.25; min-height: 26px; display: flex; align-items: flex-end; }
.kpi-row .v { font-variant-numeric: tabular-nums; text-align: right; border: 1px solid var(--line); background: var(--head); padding: 3px 7px; border-radius: 2px; font-weight: 700; }
.kpi-row .op { text-align: center; color: var(--muted); padding-bottom: 4px; }

.pricing-grid { max-height: calc(100vh - 440px); min-height: 220px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.pricing-grid table.grid { border: none; }
.pricing-grid td.desc { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pricing-grid tbody tr { cursor: pointer; }
.pricing-grid tfoot td { position: sticky; bottom: 0; }
/* Off-balance visuals: changed bid prices are tinted and bold; differences are red (under) / green (over). */
/* Bid Price column: very light gray throughout; prices changed from balanced are bold. */
.pricing-grid td.bidcol { background: #f3f4f6; }
.pricing-grid td.bidcol input { background: transparent; }
.pricing-grid td.changed, .pricing-grid td.changed input { font-weight: 700; }
@media (prefers-color-scheme: dark) { .pricing-grid td.bidcol { background: #22262d; } }
.pricing-grid td.neg, .kv-grid b.neg { color: #b42318; font-weight: 700; }
.pricing-grid td.pos, .kv-grid b.pos { color: #1a7f37; font-weight: 700; }
.kv-grid b.zero { color: #1a7f37; }
.pricing-grid td.neg { background: #fdecea; }
.pricing-grid td.pos { background: #e8f5ec; }
@media (prefers-color-scheme: dark) { .pricing-grid td.neg { background: #3b1a17; color: #f97066; } .pricing-grid td.pos { background: #16301f; color: #5cc97a; } }
.st { display: inline-block; min-width: 18px; font-weight: 700; }
.st-u { color: var(--warn); } .st-f { color: #1565c0; } .st-c { color: var(--good); } .st-p { color: #8e24aa; }
.pricing-foot { display: grid; grid-template-columns: 1fr 1.1fr 1.1fr; gap: 12px; margin-top: 12px; align-items: start; }
.foot-stack { display: flex; flex-direction: column; gap: 12px; }
.minority { display: grid; grid-template-columns: auto 90px 1fr; gap: 4px 10px; align-items: center; margin-bottom: 6px; }
.minority b { text-align: right; font-variant-numeric: tabular-nums; }
.minority input { padding: 2px 6px; }
button.icon { padding: 0 6px; font-size: 12px; line-height: 18px; margin-left: 4px; }
.pricing-grid td.edit input.num { text-align: right; }
@media (max-width: 1100px) { .pricing-foot { grid-template-columns: 1fr; } }
.pricing-foot .hb-section { margin-bottom: 0; }
.kv-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: baseline; }
.kv-grid span { color: var(--muted); font-size: 12px; }
.kv-grid b { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.pricing-bar { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; margin-top: 12px; padding: 9px 12px; background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--brand); border-radius: var(--radius); }
.pricing-bar a { text-decoration: none; font-weight: 600; }
.pricing-bar a:hover { text-decoration: underline; }
.drawer { margin-top: 10px; }
.col-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; }
@media print {
    .topbar, .sitefoot, .tabs, .subtabs, .est-head, .no-print, .pricing-bar, details.warnings, #blazor-error-ui { display: none !important; }
    .report { box-shadow: none; }
    @page { margin: 0.6in; }
    .pricing-grid { max-height: none; border: none; }
    html, body, .page { background: #fff; padding: 0; }
    .report { border: none; padding: 0; max-width: none; }
    table.grid th { position: static; }
    tr { break-inside: avoid; }
}
/* Quote Summary (HeavyBid layout): folder cards, right-hand panel, minority totals */
.qs-layout { display: grid; grid-template-columns: 1fr 210px; gap: 12px; align-items: start; }
.qs-main { min-width: 0; }
.qs-cards { display: flex; flex-wrap: wrap; gap: 14px 10px; padding-top: 10px; }
.qf { width: 186px; position: relative; }
.qf-tab { position: absolute; top: -9px; left: 10px; width: 46px; height: 10px; border: 1px solid #b9bec8; border-bottom: none; border-radius: 4px 4px 0 0; background: inherit; }
.qf.mat .qf-tab, .qf.mat .qf-body { background: #fffbdb; }
.qf.sub .qf-tab, .qf.sub .qf-body { background: #f4f5f7; }
.qf-body { border: 1px solid #b9bec8; box-shadow: 2px 2px 0 #d5d8de; display: flex; flex-direction: column; height: 132px; }
.qf-head { display: flex; justify-content: space-between; gap: 4px; padding: 3px 5px 2px; font-weight: 700; font-size: 12px; color: #111; white-space: nowrap; overflow: hidden; }
.qf-desc { padding: 0 5px; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qf-list { flex: 1; margin: 0 4px; background: #fff; border: 1px solid #d5d8de; overflow-y: auto; }
.qf-v { display: grid; grid-template-columns: 1fr auto 16px; gap: 4px; align-items: center; font-size: 10.5px; padding: 0 3px; line-height: 15px; color: #111; }
.qf-v .n { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.qf-v .a { font-variant-numeric: tabular-nums; text-align: right; }
.qf-v input { margin: 0; width: 12px; height: 12px; }
.qf-v.used { background: #b8f5b0; }
.qf-est { font-size: 10px; color: #444; padding: 1px 5px 0; text-align: right; }
.qf-links { display: flex; justify-content: space-between; padding: 1px 5px 3px; font-size: 10.5px; }
.qf-links a { color: #1d4ed8; }
.qs-side { border-left: 1px solid var(--line); padding-left: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.qs-side .field { display: flex; flex-direction: column; gap: 2px; }
.qs-links { display: flex; flex-direction: column; gap: 5px; border-top: 1px solid var(--line); padding-top: 8px; }
.qs-links a { color: #1d4ed8; }
.qs-total { border-top: 1px solid var(--line); padding-top: 8px; }
.qs-minority { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 8px; }
@media (max-width: 900px) { .qs-layout { grid-template-columns: 1fr; } .qs-side { border-left: none; padding-left: 0; } }

/* Bid Pricing Other Options: HeavyBid's button list on the left, the routine on the right */
.opt-layout { display: grid; grid-template-columns: 230px 1fr; gap: 16px; align-items: start; }
.opt-menu { display: flex; flex-direction: column; gap: 5px; border-right: 1px solid var(--line); padding-right: 14px; }
.opt-menu button { width: 100%; text-align: center; }
.opt-menu button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.opt-menu button.close { width: auto; align-self: center; margin-top: 6px; }
.opt-body { min-width: 0; }
.opt-form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.opt-form label { display: flex; align-items: center; gap: 6px; }
@media (max-width: 900px) { .opt-layout { grid-template-columns: 1fr; } .opt-menu { border-right: none; padding-right: 0; } }

.grid-toolbar { display: flex; align-items: center; gap: 14px; margin: -4px 0 8px; font-size: 12px; color: var(--muted); }
.grid-toolbar label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.grid-toolbar select { font-size: 12px; padding: 3px 6px; }

/* Bid Summary sections: tabs along the bottom of the screen, as on HeavyBid */
.bottomtabs { display: flex; gap: 2px; margin-top: 14px; border-top: 1px solid var(--line); }
.bottomtabs a { padding: 6px 14px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; border: 1px solid transparent; border-top: none; border-radius: 0 0 var(--radius) var(--radius); margin-top: -1px; }
.bottomtabs a.active { background: var(--panel); color: var(--brand); border-color: var(--line); }
.bottomtabs a:hover { color: var(--ink); }

/* Proposal (bid form): Man-Con proposal template layout */
.prop-cover { display: flex; justify-content: space-between; gap: 20px; margin: 6px 0; }
.prop-kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; align-items: baseline; }
.prop-kv span { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--brand); }
.prop-statement { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.report-table tr.prop-group td { font-weight: 700; color: var(--brand); background: var(--brand-tint); }
.report-table tr.prop-sub td { font-weight: 700; border-top: 1px solid var(--line); }
.prop-basis { margin-top: 16px; }
.prop-basis ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
.prop-basis li { margin-bottom: 4px; }
.prop-sign { margin-top: 26px; font-size: 12px; }
.prop-sign .line { width: 260px; border-bottom: 1px solid var(--ink); height: 34px; margin-bottom: 4px; }
.prop-edit { margin-bottom: 12px; }
.prop-edit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.prop-edit label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.prop-edit label:has(input[type=checkbox]) { flex-direction: row; align-items: center; gap: 6px; }
.prop-edit input:not([type=checkbox]), .prop-edit textarea { width: 100%; }
@media (max-width: 1000px) { .prop-edit-grid { grid-template-columns: 1fr; } }

/* Signed-in user and access */
.topbar .who { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
th.perm, td.perm { text-align: center; width: 92px; font-size: 11px; }
fieldset.lock { border: 0; padding: 0; margin: 0; min-width: 0; }
.readonly-note { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); border-radius: 4px; padding: 6px 10px; margin-bottom: 10px; font-size: 12px; }
.topbar .who .signout { margin-left: 10px; font-weight: 600; color: var(--muted); }

/* ---------------- Administration: Users & Access ---------------- */
.adm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 2px solid var(--brand); flex-wrap: wrap; }
.adm-eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.adm-head h1 { font-size: 24px; margin: 0; }
.adm-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; max-width: 620px; }
.adm-figures { display: flex; margin: 0; border: 1px solid var(--line); background: var(--panel); }
.adm-figures div { padding: 8px 18px; border-left: 1px solid var(--line); text-align: center; }
.adm-figures div:first-child { border-left: none; }
.adm-figures dt { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.adm-figures dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .adm-figures dd { color: var(--ink); } }

.adm-card { background: var(--panel); border: 1px solid var(--line); margin-bottom: 18px; }
.adm-card-head { display: flex; align-items: baseline; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.adm-card-head h2 { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); }
@media (prefers-color-scheme: dark) { .adm-card-head h2 { color: var(--accent); } }
.adm-card-head span { font-size: 12px; color: var(--muted); }
.adm-empty { padding: 18px; margin: 0; color: var(--muted); }

.adm-form { display: grid; grid-template-columns: 1.4fr 1.2fr .8fr auto; gap: 14px; align-items: end; padding: 16px 18px 6px; }
.adm-form label { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.adm-form input, .adm-form select { font-size: 13px; padding: 7px 9px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.adm-form button { padding: 8px 20px; }
.adm-hint { margin: 0; padding: 4px 18px 14px; font-size: 12px; color: var(--muted); }
.adm-error { margin: 0 18px 14px; padding: 7px 10px; border-left: 3px solid var(--danger); background: var(--warn-bg); color: var(--danger); font-size: 12px; }
@media (max-width: 900px) { .adm-form { grid-template-columns: 1fr; } }

.adm-table, .adm-matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th, .adm-matrix th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 9px 18px; border-bottom: 1px solid var(--line); background: var(--head); }
.adm-table td { padding: 10px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tr.inactive td { opacity: .55; }
.adm-user { display: flex; align-items: center; gap: 12px; }
.adm-user > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.adm-avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.adm-name { border: 1px solid transparent; background: transparent; padding: 1px 4px; margin-left: -5px; font-size: 13.5px; font-weight: 700; color: var(--ink); width: 240px; }
.adm-name:hover, .adm-name:focus { border-color: var(--line-strong); background: var(--input); }
.adm-email { font-size: 12px; color: var(--muted); }
.adm-you { margin-left: 8px; font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); border: 1px solid var(--brand); padding: 0 5px; }
@media (prefers-color-scheme: dark) { .adm-you { color: var(--accent); border-color: var(--accent); } }

.adm-role, .adm-role-select { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); }
.adm-role-select { cursor: pointer; }
.adm-role.role-admin, .adm-role-select.role-admin { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.adm-role-select.role-estimator { border-color: var(--line-strong); }
.adm-role-select.role-viewer { color: var(--muted); }
@media (prefers-color-scheme: dark) { .adm-role.role-admin, .adm-role-select.role-admin { color: var(--accent); border-color: var(--accent); } }

.adm-status { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 3px 10px; border-radius: 999px; border: 1px solid; background: transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
span.adm-status { cursor: default; }
.adm-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.adm-status.on { color: var(--good); border-color: var(--good); }
.adm-status.off { color: var(--danger); border-color: var(--danger); }
.adm-muted { color: var(--muted); font-size: 12px; white-space: nowrap; }
.adm-actions { text-align: right; }
.adm-link { border: none; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; padding: 0; cursor: pointer; }
.adm-link:hover { color: var(--danger); background: none; }
.adm-confirm td { background: var(--warn-bg); font-size: 12.5px; }
.adm-confirm button { margin-left: 8px; }

.adm-matrix td { padding: 8px 18px; border-bottom: 1px solid var(--line); }
.adm-matrix tr:last-child td { border-bottom: none; }
.adm-matrix th:not(:first-child), .adm-matrix td:not(:first-child) { text-align: center; width: 150px; }
.adm-matrix td.yes { color: var(--good); font-weight: 700; }
.adm-matrix td.no { color: var(--line-strong); }
.adm-card-head .spacer { flex: 1; }
.adm-newrole { font-size: 12.5px; padding: 5px 8px; width: 240px; }
.adm-matrix-wrap { overflow-x: auto; }
.adm-matrix td:first-child b { display: block; font-weight: 700; font-size: 13px; }
.adm-matrix td:first-child span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.adm-matrix tr.adm-fixed td { background: var(--head); }
.adm-matrix .yes { color: var(--good); font-weight: 700; }
.adm-check { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.adm-rolename { width: 130px; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border: 1px solid transparent; background: transparent; color: var(--ink); padding: 3px 4px; }
.adm-rolename:hover, .adm-rolename:focus { border-color: var(--line-strong); background: var(--input); }
.adm-matrix tfoot td { padding: 8px 18px; border-top: 1px solid var(--line); background: var(--head); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.adm-matrix tfoot td:not(:first-child) { text-transform: none; letter-spacing: 0; }
.adm-count { font-size: 13px; color: var(--ink); margin-right: 8px; }
.adm-link:disabled { opacity: .35; text-decoration: none; cursor: default; }

/* Assemble from past bids */
.asm-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 2px solid var(--brand); margin-bottom: 10px; }
.asm-head h2 { color: var(--brand); }
.asm-note { font-size: 12px; color: var(--muted); background: var(--head); border-left: 3px solid var(--line-strong); padding: 6px 10px; }
.asm-item { border: 1px solid var(--line); background: var(--panel); padding: 10px 12px; margin-bottom: 10px; }
.asm-item.done { border-left: 3px solid var(--good); }
.asm-item > header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.asm-no { font-size: 11px; font-weight: 700; background: var(--brand); color: #fff; padding: 1px 7px; }
.asm-table tr.asm-aipick td { box-shadow: inset 0 -1px 0 var(--brand); }
.asm-ai { font-size: 12.5px; padding: 7px 10px; margin-bottom: 6px; background: var(--brand-tint); border-left: 3px solid var(--brand); }
.asm-ai.conf-low { border-left-color: var(--warn); }
.asm-ai ul { margin: 4px 0 0; padding-left: 18px; }
.asm-ai-tag { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-right: 6px; }
.asm-preview { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ai-review { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brand); padding: 10px 14px; margin-bottom: 12px; }
.ai-review p { margin: 6px 0 8px; }
