/* ==========================================================================
   Bid Intelligence — design system
   Bootstrap 5.3 underneath; this file sets the tokens, the app shell
   (top bar, desktop sidebar, phone tab bar, "More" sheet) and shared patterns.
   Phones are the primary target: everything is sized for touch below 992px.
   ========================================================================== */

/* ── 1. Tokens ─────────────────────────────────────────────────────────── */
:root,
[data-bs-theme="light"] {
    --app-bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f8f9fb;
    --border: #e2e5ea;
    --text: #15181d;
    --muted: #5b6472;            /* 5.9:1 on white */
    --brand: #1d4ed8;            /* 6.7:1 on white */
    --brand-solid: #1d4ed8;      /* filled buttons/badges */
    --brand-hover: #1e40af;
    --brand-soft: #e9effd;
    --brand-rgb: 29, 78, 216;
    --success: #15803d;
    --warning: #b45309;
    --danger: #b91c1c;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 6px rgba(16, 24, 40, .06);
    --shadow-lg: 0 -8px 30px rgba(16, 24, 40, .12);
    --cl-cheap: #2563eb;
    --cl-dear: #ea580c;
}
[data-bs-theme="dark"] {
    --app-bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1d212a;
    --border: #2b303b;
    --text: #e8eaef;
    --muted: #9ba3b1;            /* 7:1 on surface */
    --brand: #8aa6ff;            /* text/link blue on dark */
    --brand-solid: #3d64e8;      /* 4.9:1 with white text */
    --brand-hover: #5379ee;
    --brand-soft: #1c2643;
    --brand-rgb: 138, 166, 255;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .02);
    --shadow-lg: 0 -8px 30px rgba(0, 0, 0, .5);
}

/* Map the tokens onto Bootstrap's own variables. */
:root, [data-bs-theme] {
    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--text);
    --bs-emphasis-color: var(--text);
    --bs-secondary-color: var(--muted);
    --bs-border-color: var(--border);
    --bs-border-color-translucent: var(--border);
    --bs-tertiary-bg: var(--surface-2);
    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: var(--brand-rgb);
    --bs-link-hover-color: var(--brand-hover);
    --bs-primary-bg-subtle: var(--brand-soft);
    --bs-border-radius: .625rem;
    --bs-border-radius-sm: .5rem;
    --bs-border-radius-lg: .875rem;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-focus-ring-color: rgba(var(--brand-rgb), .35);
}

/* ── 2. Base & typography ──────────────────────────────────────────────── */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { background-color: var(--app-bg); color: var(--text); line-height: 1.5; }
h1, h2, h3, h4, h5, h6 { font-weight: 650; letter-spacing: -.01em; }
.h-section { font-size: 1rem; font-weight: 650; margin: 1.25rem 0 .5rem; }
a { text-underline-offset: .15em; }
.small, small { font-size: .8125rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.text-muted, .text-body-secondary { color: var(--muted) !important; }
code { color: var(--text); background: var(--surface-2); padding: .05rem .3rem; border-radius: .3rem; font-size: .85em; }

.min-w-0 { min-width: 0; }
.flex-none { flex: none; }
.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.25em; }

/* Keyboard focus is always visible; mouse/touch focus stays quiet. */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline: none; box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .35); }
.skip-link { position: absolute; left: .5rem; top: -3rem; z-index: 2000; background: var(--brand-solid); color: #fff; padding: .5rem .75rem; border-radius: .5rem; }
.skip-link:focus { top: .5rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ── 3. Components ─────────────────────────────────────────────────────── */
/* Buttons */
.btn { --bs-btn-font-weight: 550; border-radius: .625rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { border-radius: .5rem; }
.btn-primary {
    --bs-btn-bg: var(--brand-solid); --bs-btn-border-color: var(--brand-solid);
    --bs-btn-hover-bg: var(--brand-hover); --bs-btn-hover-border-color: var(--brand-hover);
    --bs-btn-active-bg: var(--brand-hover); --bs-btn-active-border-color: var(--brand-hover);
    --bs-btn-disabled-bg: var(--brand-solid); --bs-btn-disabled-border-color: var(--brand-solid);
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand); --bs-btn-border-color: rgba(var(--brand-rgb), .5);
    --bs-btn-hover-bg: var(--brand-soft); --bs-btn-hover-color: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-soft); --bs-btn-active-color: var(--brand); --bs-btn-active-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}
.btn-outline-secondary {
    --bs-btn-color: var(--text); --bs-btn-border-color: var(--border); --bs-btn-bg: var(--surface);
    --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--border);
    --bs-btn-active-bg: var(--surface-2); --bs-btn-active-color: var(--text); --bs-btn-active-border-color: var(--muted);
}
.btn-check:checked + .btn-outline-secondary { background: var(--text); color: var(--surface); border-color: var(--text); }
.btn-link { --bs-btn-color: var(--brand); --bs-btn-hover-color: var(--brand-hover); text-decoration: none; }
.text-bg-primary { background-color: var(--brand-solid) !important; color: #fff !important; }

/* Icon-only buttons (top bar, toolbars). Always have an aria-label. */
.icon-btn { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; color: var(--text); border: 0; background: transparent; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 1.4rem; height: 1.4rem; }
.icon-badge { position: absolute; top: .35rem; right: .3rem; min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.1rem; text-align: center; }

/* Cards */
.card { --bs-card-bg: var(--surface); --bs-card-border-color: var(--border); --bs-card-border-radius: .875rem; --bs-card-inner-border-radius: .875rem; box-shadow: var(--shadow-sm); }
.card-header { font-weight: 650; font-size: .9375rem; background: transparent; border-bottom-color: var(--border); padding: .8rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.card-header a { font-weight: 500; font-size: .8125rem; }
.card-body { padding: 1rem; }
.card-link-row { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; color: var(--text); text-decoration: none; border-top: 1px solid var(--border); }
.card-link-row:hover { background: var(--surface-2); color: var(--text); }

/* Stat tiles */
.kpi { border: 1px solid var(--border); border-radius: .875rem; padding: .8rem 1rem; background: var(--surface); height: 100%; box-shadow: var(--shadow-sm); }
.kpi .label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: .15rem; }
.kpi .sub { font-size: .8rem; color: var(--muted); }
/* On phones a row of stats scrolls sideways instead of stacking into a long column. */
.kpi-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(9.5rem, 1fr); gap: .75rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .25rem; margin-bottom: 1rem; scrollbar-width: none; }
.kpi-strip::-webkit-scrollbar { display: none; }
.kpi-strip > * { scroll-snap-align: start; }
/* Cards that filter a list below (My bids → Results): a button that looks like the card, highlighted while active. */
.kpi-filter { display: block; width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.kpi-filter:hover { border-color: var(--brand); }
.kpi-filter:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.kpi-filter.is-active { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.kpi-filter.is-active .label { color: var(--brand); }

/* Tables */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); --bs-table-hover-bg: var(--surface-2); --bs-table-striped-bg: var(--surface-2); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .55rem .6rem; }
.table-sm > :not(caption) > * > * { padding: .4rem .5rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; border-bottom-width: 1px; white-space: nowrap; }
.table td, .table th { vertical-align: middle; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: .5rem; }

/* Forms */
.form-label { font-size: .875rem; font-weight: 600; margin-bottom: .3rem; }
.form-control, .form-select { border-color: var(--border); background-color: var(--surface); border-radius: .625rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .25); }
.form-check-input:checked { background-color: var(--brand-solid); border-color: var(--brand-solid); }
.form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .25); }
.form-text { color: var(--muted); }
.form-section { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1rem; }
.form-section > .form-section-title { font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; margin-bottom: .75rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
/* Save button that stays reachable at the bottom of long forms. */
.sticky-actions { position: sticky; bottom: .75rem; z-index: 5; padding: .5rem; margin: 0 -.5rem; border-radius: 1rem; background: color-mix(in srgb, var(--app-bg) 85%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
@media (max-width: 991.98px) { body.has-tabbar .sticky-actions { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + .5rem); } }
@media (min-width: 768px) { .sticky-actions .btn { width: auto !important; min-width: 12rem; } }
.required::after { content: " *"; color: var(--danger); }
.input-group-text { background: var(--surface-2); border-color: var(--border); }

/* Badges, alerts, notices */
.badge { font-weight: 600; border-radius: .4rem; }
.alert { border-radius: .75rem; }
.flash { display: flex; align-items: center; gap: .5rem; }
.notice { border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); background: var(--bs-warning-bg-subtle); padding: .7rem .9rem; border-radius: .75rem; }
.pagination { --bs-pagination-active-bg: var(--brand-solid); --bs-pagination-active-border-color: var(--brand-solid); --bs-pagination-color: var(--brand); --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border); gap: .25rem; }
.pagination .page-link { border-radius: .5rem !important; min-width: 2.5rem; text-align: center; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand-solid); }
.list-group { --bs-list-group-bg: var(--surface); --bs-list-group-border-color: var(--border); --bs-list-group-border-radius: .875rem; --bs-list-group-action-hover-bg: var(--surface-2); }

/* Collapsible page help: keeps explanations without pushing content down. */
.page-help { margin-bottom: 1rem; font-size: .875rem; color: var(--muted); }
.page-help > summary { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; color: var(--brand); font-weight: 550; list-style: none; }
.page-help > summary::-webkit-details-marker { display: none; }
.page-help[open] > summary { margin-bottom: .4rem; }
.page-help > div { background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; padding: .75rem .9rem; }
.page-help p:last-child { margin-bottom: 0; }

/* Page toolbar: filters and actions just under the top bar. */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.toolbar .spacer { flex: 1; }
.chip-row { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem 1rem; padding: 0 1rem; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: .875rem; font-weight: 550; white-space: nowrap; }
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }

/* Simple list rows (settings-style menus, item lists). */
.menu-group { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; margin: 1rem .25rem .4rem; }
.menu-list { background: var(--surface); border: 1px solid var(--border); border-radius: .875rem; overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 3.25rem; padding: .6rem 1rem; color: var(--text); text-decoration: none; border: 0; background: none; text-align: left; font-size: 1rem; }
.menu-item + .menu-item, .menu-list > form + .menu-item, .menu-list > .menu-item + form { border-top: 1px solid var(--border); }
.menu-item:hover { background: var(--surface-2); color: var(--text); }
.menu-item .icon { color: var(--muted); }
.menu-item.text-danger .icon { color: inherit; }
.menu-item .meta { margin-left: auto; color: var(--muted); font-size: .875rem; }

/* Empty states */
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.empty > .icon { width: 2rem; height: 2rem; margin-bottom: .5rem; display: block; margin-left: auto; margin-right: auto; }

.chart-box { position: relative; width: 100%; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: .7rem; }
.heat td, .heat th { width: 1.6rem; height: 1.6rem; text-align: center; padding: 0; border-radius: 3px; }
.heat td.empty { background: var(--surface-2); }
.legend-swatch { display: inline-block; width: 1rem; height: .8rem; border-radius: 2px; vertical-align: middle; }

.rec-level { border: 1px solid var(--border); background: var(--surface); border-radius: .875rem; padding: .9rem 1rem; height: 100%; }
.rec-level .bid { font-size: 2.25rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rec-level.balanced { border-color: var(--brand); border-width: 2px; background: var(--brand-soft); }

/* ── 4. App shell ─────────────────────────────────────────────────────── */
:root { --tabbar-h: 4rem; --appbar-h: 3.5rem; --sidebar-w: 15.5rem; }
.app-main { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.app-content { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 1rem 1rem 1.5rem; outline: none; }
.app-footer { color: var(--muted); font-size: .75rem; padding: 0 1.5rem 1.25rem; max-width: 1360px; margin: 0 auto; width: 100%; }

/* Top bar */
.app-bar {
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: .25rem;
    min-height: var(--appbar-h); padding: env(safe-area-inset-top) .5rem 0;
    background: color-mix(in srgb, var(--app-bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--border);
}
.app-title-wrap { flex: 1; min-width: 0; margin: 0 .25rem; }
.app-title { font-size: 1.0625rem; font-weight: 650; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Live figures under the title (e.g. bid count and total on the entry page); stays visible while scrolling. */
.app-subtitle { display: flex; align-items: center; gap: .4rem; font-size: .8125rem; color: var(--muted); line-height: 1.2; white-space: nowrap; overflow: hidden; }
.app-subtitle strong { color: var(--text); font-variant-numeric: tabular-nums; }
.app-bar-actions { display: flex; align-items: center; gap: .15rem; }
.app-logo { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: .6rem; background: var(--brand-solid); color: #fff; font-weight: 800; font-size: 1rem; text-decoration: none; flex: none; }
.app-bar-logo { margin: 0 .4rem 0 .35rem; }
.app-bar-logo:hover { color: #fff; }

/* Desktop sidebar */
.app-sidebar { display: none; }
@media (min-width: 992px) {
    body.app .app-main { margin-left: var(--sidebar-w); }
    .app-sidebar {
        display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1035;
        background: var(--surface); border-right: 1px solid var(--border); padding: .75rem .75rem 1rem; overflow-y: auto;
    }
    .app-brand { display: flex; align-items: center; gap: .6rem; padding: .4rem .5rem 1rem; color: var(--text); text-decoration: none; font-weight: 700; }
    .app-brand:hover { color: var(--text); }
    .side-nav { display: flex; flex-direction: column; gap: .1rem; flex: 1; }
    .side-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: .9rem .6rem .3rem; }
    .side-link { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: .6rem; color: var(--text); text-decoration: none; font-weight: 500; font-size: .9375rem; }
    .side-link .icon { color: var(--muted); }
    .side-link:hover { background: var(--surface-2); color: var(--text); }
    .side-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
    .side-link.active .icon { color: var(--brand); }
    .side-foot { display: flex; flex-direction: column; gap: .6rem; border-top: 1px solid var(--border); padding-top: .9rem; margin-top: 1rem; }
    .app-bar { padding: 0 1rem; }
    .app-bar-logo { display: none; }
    .app-title { font-size: 1.25rem; }
    .app-content { padding: 1.5rem 1.5rem 2rem; }
}

/* Phone/tablet tab bar */
.tab-bar { display: none; }
@media (max-width: 991.98px) {
    body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
    .tab-bar {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; inset: auto 0 0 0; z-index: 1030;
        height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
        border-top: 1px solid var(--border);
    }
    .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; color: var(--muted); text-decoration: none; font-size: .6875rem; font-weight: 600; border: 0; background: none; padding: 0; }
    .tab .icon { width: 1.5rem; height: 1.5rem; }
    .tab.active { color: var(--brand); }
    .tab:active { opacity: .7; }
}

/* "More" bottom sheet */
.more-sheet.offcanvas-bottom { height: auto; max-height: 88vh; border-radius: 1.25rem 1.25rem 0 0; background: var(--app-bg); border: 0; box-shadow: var(--shadow-lg); padding-bottom: env(safe-area-inset-bottom); }
.sheet-handle { width: 2.5rem; height: .3rem; border-radius: 999px; background: var(--border); margin: .5rem auto 0; }
@media (min-width: 992px) { .more-sheet.offcanvas-bottom { max-width: 32rem; margin: 0 auto; } }

/* Signed-out pages (login, errors) */
body.auth .app-content { max-width: 26rem; padding-top: 12vh; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 1.25rem; padding: 1.75rem 1.5rem; box-shadow: var(--shadow); }

/* Admin sub-navigation: scrollable pills under the top bar */
.subnav { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; margin: -.25rem -1rem 1rem; padding: .25rem 1rem; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; padding: .45rem .85rem; border-radius: 999px; color: var(--text); text-decoration: none; font-size: .875rem; font-weight: 550; border: 1px solid var(--border); background: var(--surface); }
.subnav a.active { background: var(--text); color: var(--surface); border-color: var(--text); }

/* ── 5. Phones & tablets: touch sizing and stacked tables ─────────────── */
@media (max-width: 991.98px) {
    /* 16px text in inputs stops iOS from zooming in; 44px is the minimum comfortable touch target. */
    .form-control, .form-select, .form-control-sm, .form-select-sm, .input-group-text { font-size: 16px; min-height: 2.75rem; }
    textarea.form-control { min-height: 6rem; }
    .btn { min-height: 2.75rem; }
    .btn-sm { min-height: 2.5rem; padding-left: .8rem; padding-right: .8rem; font-size: .9rem; }
    .form-check-input { width: 1.25em; height: 1.25em; }
    .form-switch .form-check-input { width: 2.4em; }
    .card-header { padding: .75rem 1rem; }
}
@media (max-width: 767.98px) {
    .hide-sm { display: none !important; }
    .kpi .value { font-size: 1.3rem; }
    .app-content { padding: .875rem .875rem 1.25rem; }
    .chip-row, .subnav { margin-left: -.875rem; margin-right: -.875rem; padding-left: .875rem; padding-right: .875rem; }

    /* table.table-stack: each row becomes a card; site.js copies the column header into data-label. */
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { background: var(--surface); border: 1px solid var(--border); border-radius: .875rem; padding: .35rem .9rem; margin-bottom: .6rem; box-shadow: var(--shadow-sm); }
    .table-stack > :not(caption) > * > * { border: 0; padding: .3rem 0; }
    .table-stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; text-align: right; }
    .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: .8125rem; font-weight: 400; text-align: left; flex: none; max-width: 50%; }
    .table-stack td.cell-title { font-weight: 650; font-size: 1rem; text-align: left; justify-content: flex-start; align-items: center; gap: .35rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: .45rem; margin-bottom: .2rem; }
    .table-stack td.cell-title::before { display: none; }
    .table-stack td:empty, .table-stack td.stack-hide { display: none; }
    .table-stack td.num { white-space: normal; }
    .table-stack tr.table-primary, .table-stack tr.table-danger, .table-stack tr.table-warning { --bs-table-bg: transparent; }
    .table-stack tr.table-primary { border-color: var(--brand); }
    .table-stack tr.table-danger { border-color: var(--danger); }
    .table-stack tr.table-warning { border-color: var(--warning); }
}

/* ── 6. Feature styles ─────────────────────────────────────────────────── */
/* Dashboard hero */
.hero { background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; padding: 1.1rem 1.1rem 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.hero-eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.hero-title { font-size: 1.375rem; font-weight: 750; margin: .1rem 0 .15rem; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.hero-actions .btn { white-space: nowrap; padding-left: .6rem; padding-right: .6rem; }
@media (min-width: 768px) { .hero-actions { display: flex; } }

/* Bid sheet cards (phones) */
.bid-cards { display: grid; gap: .6rem; }
.bid-card { display: grid; grid-template-columns: 1fr auto; gap: .1rem .75rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: .875rem; padding: .7rem .9rem; color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); }
a.bid-card:hover { color: var(--text); border-color: var(--brand); }
.bid-card .lot { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.bid-card .cat { font-size: .8125rem; color: var(--muted); }
.bid-card .bid { grid-row: 1 / span 2; grid-column: 2; text-align: right; }
.bid-card .bid strong { display: block; font-size: 1.35rem; font-weight: 750; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1.1; }
.bid-card .bid span { font-size: .75rem; color: var(--muted); }
.bid-card .meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .25rem .75rem; font-size: .8125rem; color: var(--muted); margin-top: .35rem; }

/* Quick bid entry: stacked on phones (lot | bid | × over a full-width note), one line from md up. */
.quick-bids { max-width: 900px; }
.qb-row, .qb-head { display: grid; gap: .4rem .5rem; align-items: center; }
.qb-row {
    grid-template-columns: 2.5rem 5.25rem 1fr 2.5rem minmax(2.75rem, auto); /* lot numbers are ≤ 6 digits; the rest goes to the bid */
    grid-template-areas: "play lot bid notebtn del" "note note note note photo" "status status status status status";
    row-gap: 0; /* the note and status lines bring their own spacing, so hidden ones leave no gap */
    padding: .35rem .5rem; border: 1px solid var(--border); border-radius: .875rem; background: var(--surface); margin-bottom: .35rem;
    /* Rows scrolled into view (focus, read-back) stop clear of the pinned toolbar and the voice bar. */
    scroll-margin-top: calc(var(--appbar-h) + var(--qb-sticky-h, 0px) + .5rem); scroll-margin-bottom: 7rem;
}
/* Phones: one line per bid. The note line only shows when the bid has a note, or after tapping the note button. */
.qb-row .qb-note-btn { grid-area: notebtn; min-width: 2.5rem; min-height: 2.75rem; padding: 0; color: var(--muted); }
.qb-row .qb-note-btn .icon { width: 1.15rem; height: 1.15rem; }
.qb-row:has(.qb-note:not(:placeholder-shown)) .qb-note-btn { color: var(--brand); }
.qb-row:not(.qb-note-open):not(.qb-has-photos):not(.qb-photo-open):not(.qb-photo-busy):has(.qb-note:placeholder-shown) :is(.qb-note, .qb-photo-btn) { display: none; }
/* 📷 on the note line (phones) / its own column (wide screens): opens the lot's photos. Shows how many there are. */
.qb-row .qb-photo-btn { grid-area: photo; min-width: 2.75rem; min-height: 2.75rem; padding: 0; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: .15rem; text-decoration: none; }
.qb-row .qb-photo-btn .icon { width: 1.15rem; height: 1.15rem; }
.qb-row.qb-has-photos .qb-photo-btn { color: var(--brand); }
.qb-photo-count { font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.qb-photo-count:empty { display: none; }
/* Its photos are still uploading or being read by the AI (in the background). */
.qb-row.qb-photo-busy .qb-photo-btn { color: var(--brand); animation: qb-photo-pulse 1.2s ease-in-out infinite; }
@keyframes qb-photo-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .qb-row.qb-photo-busy .qb-photo-btn { animation: none; } }
.qb-row:has(.qb-lot:placeholder-shown) .qb-photo-btn { visibility: hidden; }

/* Ask: a chat about your data. The question box stays at the bottom of the screen (above the tab bar on phones). */
.ask { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100dvh - var(--appbar-h) - 4rem); }
.ask-log { flex: 1; display: flex; flex-direction: column; gap: .75rem; padding-bottom: .75rem; }
.ask-intro { text-align: center; padding: 1.5rem .5rem; }
.ask-intro[hidden] { display: none; }
.ask-intro-icon .icon { width: 2.25rem; height: 2.25rem; color: var(--brand); }
.ask-examples { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.ask-examples .btn { white-space: normal; text-align: left; }
.ask-msg { max-width: 92%; padding: .65rem .85rem; border-radius: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.ask-msg p { margin-bottom: .45rem; } .ask-msg p:last-child { margin-bottom: 0; }
.ask-msg ul, .ask-msg ol { margin-bottom: .45rem; padding-left: 1.25rem; }
.ask-user { align-self: flex-end; background: var(--brand-solid); color: #fff; border-bottom-right-radius: .3rem; }
.ask-assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: .3rem; }
.ask-table { margin: .3rem 0 .5rem; font-size: .85rem; }
.ask-how { margin-top: .5rem; font-size: .8rem; color: var(--muted); }
.ask-how summary { cursor: pointer; }
.ask-query { margin-top: .4rem; }
.ask-query pre { white-space: pre-wrap; font-size: .75rem; background: var(--surface-2); border-radius: .5rem; padding: .4rem .55rem; margin: .2rem 0 0; color: var(--text); }
.ask-form { position: sticky; bottom: .75rem; z-index: 5; display: flex; gap: .5rem; align-items: flex-end; padding: .5rem; border-radius: 1rem;
    background: color-mix(in srgb, var(--app-bg) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.ask-form textarea { resize: none; font-size: 16px; min-height: 2.75rem; border-radius: .9rem; }
.ask-form .btn { min-width: 2.75rem; min-height: 2.75rem; border-radius: .9rem; display: grid; place-items: center; padding: 0 .75rem; }
.ask-form .btn .icon { transform: rotate(-90deg); }
.ask-foot { text-align: center; margin-top: .25rem; }
@media (max-width: 991.98px) { body.has-tabbar .ask-form { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + .5rem); } }

/* Lot photos (add-bid form and the photos panel): thumbnails, then what the AI read and similar lots' prices. */
.lp-inline { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; }
.lp-result { flex: 1 1 100%; }
.lp-result:empty { display: none; }
.lp-thumbs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.lp-thumb { position: relative; width: 4.75rem; height: 4.75rem; border-radius: .6rem; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.lp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lp-thumb a { display: block; width: 100%; height: 100%; }
.lp-thumb button { position: absolute; top: .15rem; right: .15rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 0; padding: 0; line-height: 1;
    background: rgba(0, 0, 0, .6); color: #fff; font-size: 1rem; display: grid; place-items: center; }
.lp-thumb.lp-pending img { opacity: .45; }
.lp-busy { display: flex; align-items: center; gap: .5rem; color: var(--muted); margin-bottom: .5rem; }
.lp-product { border: 1px solid var(--border); border-radius: .875rem; padding: .75rem .9rem; background: var(--surface); }
.lp-product .lp-name { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.lp-specs { display: flex; flex-wrap: wrap; gap: .3rem; margin: .45rem 0 .2rem; }
.lp-specs span { font-size: .78rem; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.lp-text { white-space: pre-wrap; font-size: .78rem; max-height: 10rem; overflow: auto; background: var(--surface-2); border-radius: .5rem; padding: .5rem .6rem; margin: .4rem 0 0; }
.lp-estimate { margin-top: .6rem; padding: .6rem .8rem; border-radius: .75rem; background: var(--brand-soft); border: 1px solid rgba(var(--brand-rgb), .3); }
.lp-estimate strong { font-size: 1.15rem; color: var(--brand); font-variant-numeric: tabular-nums; }
.lp-seen { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .85rem; }
.lp-seen li { display: flex; justify-content: space-between; gap: .75rem; padding: .3rem 0; border-top: 1px solid var(--border); }
.lp-seen li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-seen li strong { font-variant-numeric: tabular-nums; }

/* Toolbar pinned under the top bar. */
.qb-sticky {
    position: sticky; top: calc(var(--appbar-h) + env(safe-area-inset-top)); z-index: 1010;
    margin: 0 -.875rem .5rem; padding: .5rem .875rem .1rem;
    background: color-mix(in srgb, var(--app-bg) 92%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.qb-sticky .qb-search-row { margin-bottom: .4rem; }
.qb-sticky .qb-tools { margin-bottom: .4rem; }
.qb-sticky.is-stuck { border-bottom: 1px solid var(--border); box-shadow: 0 6px 12px -10px rgba(0, 0, 0, .35); }

/* ↑ / ↓ jump buttons: in the voice bar, pinned right (mirroring ⚙ on the left), so they never cover a row. */
.qb-jump { position: absolute; right: 0; bottom: .45rem; display: flex; gap: .15rem; }
.qb-jump-btn { color: var(--muted); touch-action: manipulation; }
.qb-jump-btn[hidden] { display: none; }
.qb-jump-btn .qb-up { transform: rotate(-90deg); }
.qb-jump-btn .qb-down { transform: rotate(90deg); }
.qb-row .qb-lot { grid-area: lot; }
.qb-row .qb-bid-group { grid-area: bid; }
.qb-row .qb-note { grid-area: note; margin: .1rem 0 .3rem; }
.qb-row .qb-status { grid-area: status; color: var(--muted); min-height: 0; margin-bottom: .2rem; }
.qb-row .qb-status:empty { display: none; }
.qb-row .qb-del { grid-area: del; font-size: 1.6rem; line-height: 1; padding: .25rem; color: var(--muted); text-decoration: none; min-height: 2.75rem; }
.qb-row .qb-del:hover { color: var(--danger); }
.qb-row .qb-del { min-width: 2.75rem; justify-self: end; }
/* First tap on ×: becomes a red "Delete" button; second tap deletes. */
.qb-row .qb-del.is-confirm { background: var(--danger); color: #fff; font-size: .875rem; font-weight: 650; padding: 0 .75rem; border-radius: .6rem; }
.qb-row .qb-del.is-confirm:hover { color: #fff; }
.qb-row .form-control, .qb-row .input-group-text { font-size: 16px; }
.qb-row .qb-lot, .qb-row .qb-bid { font-variant-numeric: tabular-nums; font-weight: 600; }
.qb-row .qb-ok { color: var(--success); }
.qb-row .qb-error { color: var(--danger); }
.qb-row.qb-has-error { border-color: var(--danger); }
.qb-row.qb-has-error .form-control { border-color: var(--danger); }
.qb-search { position: relative; margin-bottom: .6rem; }
.qb-search .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.qb-search .form-control { font-size: 16px; padding-left: 2.5rem; padding-right: 5.5rem; min-height: 2.75rem; }
.qb-search-count { position: absolute; right: .9rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.qb-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; margin-bottom: .75rem; }
/* Search and the 🚩 filter share one line, half each (search takes it all when there's no filter). */
.qb-search-row { display: flex; gap: .5rem; }
.qb-search-row .qb-search { flex: 1 1 50%; min-width: 0; margin-bottom: 0; }
.qb-search-row .qb-search .form-control { padding-right: 4.5rem; }
.qb-search-row .qb-search .form-control:placeholder-shown { padding-right: .5rem; } /* the "3 of 49" count only shows while searching */
.qb-search-row #qb-flag-filter { flex: 1 1 35%; min-width: 0; min-height: 2.75rem; padding-inline: .4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Proof-sheet camera: the last 15% of the line. */
.qb-search-row .qb-proof { flex: 1 1 15%; min-width: 2.75rem; min-height: 2.75rem; padding: 0; display: grid; place-items: center; }
.qb-search-row .qb-proof .icon { width: 1.25rem; height: 1.25rem; }
.qb-sync:not(.text-danger) { display: none; }
#qb-flag-filter.active { background: var(--warning); border-color: var(--warning); color: #111; }
.qb-read { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
/* Speed stepper: − 1.0× + as one segmented control, the same height as the buttons beside it. */
.qb-rate {
    display: inline-flex; align-items: stretch; height: 2.5rem; font-size: .875rem;
    border: 1px solid var(--border); border-radius: var(--bs-border-radius-sm, .375rem); background: var(--surface); overflow: hidden;
}
.qb-rate-btn {
    width: 2.4rem; padding: 0; border: 0; background: transparent; color: var(--text);
    font-size: 1.1rem; font-weight: 500; line-height: 1; touch-action: manipulation; transition: background .15s, color .15s;
}
.qb-rate-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--brand); }
.qb-rate-btn:active:not(:disabled) { background: var(--brand-soft); }
.qb-rate-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.qb-rate-btn:disabled { color: var(--muted); opacity: .45; }
.qb-rate-value {
    display: grid; place-items: center; min-width: 3.1rem; padding: 0 .25rem;
    border-inline: 1px solid var(--border); background: var(--surface-2);
    font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text);
}
.qb-read-status:empty { display: none; }
.qb-row.qb-flagged .qb-bid-group .input-group-text { background: var(--bs-warning-bg-subtle); border-color: var(--warning); }
.qb-row.qb-flagged .qb-bid-group .input-group-text::before { content: '🚩'; margin-right: .2rem; font-size: .85em; }
.qb-row.qb-flagged .qb-bid { border-color: var(--warning); font-weight: 700; }
.qb-row.qb-reading { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); background: var(--brand-soft); }
/* ▶ on each row: read aloud from this bid on. Hidden until the row has both a lot and a bid. */
.qb-row .qb-play { grid-area: play; min-width: 2.5rem; min-height: 2.75rem; padding: 0; font-size: 1rem; color: var(--brand); text-decoration: none; }
.qb-row:has(.qb-lot:placeholder-shown) .qb-play, .qb-row:has(.qb-bid:placeholder-shown) .qb-play, .qb-no-read .qb-play { visibility: hidden; }
.qb-row.qb-dup { border-color: var(--danger); }
.qb-row.qb-dup .qb-lot { border-color: var(--danger); background: var(--bs-danger-bg-subtle); }
.qb-row.qb-flash { background: var(--bs-success-bg-subtle); transition: background .3s; }

/* Voice bar: pinned to the bottom so the mic stays under your thumb (the tab bar is hidden on this screen). */
.qb-voice {
    position: sticky; bottom: 0; z-index: 1020;
    margin: 0 -.875rem; padding: .7rem .875rem calc(.7rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.qb-voice-opts { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.qb-voice-main { display: flex; align-items: center; gap: .75rem; }
.qb-heard { flex: 1; min-height: 2.6rem; font-size: .9rem; line-height: 1.3; display: flex; align-items: center; flex-wrap: wrap; gap: 0 .25rem; color: var(--muted); }
.qb-heard-ok { color: var(--text); }
.qb-heard-ok strong { color: var(--success); }
.qb-heard-warn { color: var(--bs-warning-text-emphasis); }
.qb-heard-error { color: var(--danger); }
.qb-heard-live { color: var(--brand); }
.qb-heard .qb-ms { color: var(--muted); font-size: .8rem; }
.qb-heard .qb-missing { color: var(--bs-warning-text-emphasis); font-weight: 600; }
.qb-heard .qb-hint { color: var(--muted); font-style: italic; }
.qb-mic {
    --level: 0;
    flex: none; width: 4rem; height: 4rem; border-radius: 50%; border: 0;
    display: grid; place-items: center; color: #fff; background: var(--brand-solid);
    box-shadow: 0 0 0 calc(var(--level) * 14px) rgba(220, 53, 69, .25), 0 6px 16px rgba(var(--brand-rgb), .35);
    transition: background .15s, box-shadow .08s, transform .1s;
    touch-action: manipulation;
}
.qb-mic:active { transform: scale(.94); }
.qb-mic:disabled { background: var(--surface-2); color: var(--muted); box-shadow: none; }
.qb-mic.is-listening { background: #dc2626; }
.qb-mic.is-listening:not([style*="--level"]) { animation: qb-pulse 1.2s infinite; }
.qb-mic.is-busy { background: #64748b; cursor: progress; }
.qb-mic.is-armed { background: #16a34a; box-shadow: 0 0 0 calc(var(--level) * 14px) rgba(25, 135, 84, .25); }
.qb-mic.is-armed:not([style*="--level"]) { animation: qb-pulse-green 2s infinite; }
@keyframes qb-pulse { 0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, .45); } 100% { box-shadow: 0 0 0 16px rgba(220, 53, 69, 0); } }
@keyframes qb-pulse-green { 0% { box-shadow: 0 0 0 0 rgba(25, 135, 84, .4); } 100% { box-shadow: 0 0 0 14px rgba(25, 135, 84, 0); } }
.qb-voice-settings { border: 1px solid var(--border); border-radius: .75rem; padding: .7rem; margin-bottom: .6rem; background: var(--surface-2); max-height: 55vh; overflow-y: auto; }
.qb-voice-settings .qb-voice-opts { flex-wrap: wrap; }
/* + and mic centred; settings pinned left; the status line appears above them only when there is something to say. */
.qb-voice-main { position: relative; flex-wrap: wrap; justify-content: center; gap: .5rem 1.25rem; }
.qb-voice-gear { position: absolute; left: 0; bottom: .45rem; color: var(--muted); }
.qb-voice .qb-heard { order: -1; flex: 1 1 100%; min-height: 0; justify-content: center; text-align: center; font-size: .85rem; }
.qb-voice .qb-heard:empty { display: none; }
/* + and mic are one pair: identical size, shape and shadow; only the colour differs. */
.qb-voice .qb-add, .qb-voice .qb-mic {
    box-sizing: border-box; flex: none; width: 4rem; height: 4rem; padding: 0; border-radius: 50%;
    display: grid; place-items: center; touch-action: manipulation;
    border: 2px solid var(--brand-solid);
}
.qb-voice .qb-add { background: var(--brand-soft); color: var(--brand); box-shadow: 0 6px 16px rgba(var(--brand-rgb), .25); }
.qb-voice .qb-add .icon, .qb-voice .qb-mic svg { width: 1.75rem; height: 1.75rem; }
.qb-add .icon { stroke-width: 2.4; }
.qb-add:active { transform: scale(.94); }
.qb-voice .qb-mic.is-listening { border-color: #dc2626; }
.qb-voice .qb-mic.is-armed { border-color: #16a34a; }
.qb-voice .qb-mic.is-busy { border-color: #64748b; }
.qb-voice .qb-mic:disabled { border-color: var(--border); }
.qb-voice-log td:nth-child(2) { word-break: break-word; }
/* My settings → mic off: only the + button, centred (the bar already centres what's left); no ⚙ voice settings. */
.qb-voice.qb-no-mic .qb-mic, .qb-voice.qb-no-mic .qb-voice-gear, .qb-voice.qb-no-mic #qb-voice-settings { display: none; }
/* Admin → AI: a revealed API key is one long word; let it wrap instead of widening the page on phones. */
.key-status .key-full { word-break: break-all; user-select: all; }
@media (min-width: 768px) {
    .qb-voice { margin: 0; border: 1px solid var(--border); border-radius: 1rem; bottom: .75rem; }
    .qb-row, .qb-head { grid-template-columns: 2.5rem 7rem 9.5rem 1fr 2.75rem 8rem minmax(2.75rem, 5rem); }
    .qb-row { grid-template-areas: "play lot bid note photo status del"; padding: .4rem .6rem; margin-bottom: .35rem; }
    .qb-row .qb-status:empty { display: block; }
    .qb-row .qb-note, .qb-row .qb-status { margin: 0; }
    /* Wide screens: the note is always inline, so no note button. */
    .qb-row .qb-note-btn { display: none; }
    .qb-row:not(.qb-note-open):not(.qb-has-photos):has(.qb-note:placeholder-shown) .qb-note { display: block; }
    .qb-row:not(.qb-note-open):not(.qb-has-photos):has(.qb-note:placeholder-shown) .qb-photo-btn { display: inline-flex; }
    .qb-sticky { margin: 0 0 .5rem; padding: .5rem 0 .1rem; }
    .qb-head { padding: 0 .6rem .3rem; }
}

/* "Add bid" form with lot history */
#add-bid .modal-content { background: var(--app-bg); }
#add-bid .modal-header, #add-bid .modal-footer { background: var(--surface); border-color: var(--border); }
#add-bid .modal-footer { padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
/* Phones (full-screen form): my-bids-add.js sets --ab-vh / --ab-top to the part of the screen the keyboard leaves
   visible, so the form fits above the keyboard and Save / Done stay in view; the fields scroll inside it. */
@media (max-width: 575.98px) {
    #add-bid .modal-dialog { height: var(--ab-vh, 100%); }
    #add-bid.show .modal-dialog { transform: translateY(var(--ab-top, 0px)); }
    #add-bid .modal-content { height: 100%; }
}
#add-bid .form-control-lg, #add-bid .input-group-lg > * { font-weight: 650; font-variant-numeric: tabular-nums; }
.ab-rec { display: flex; align-items: center; justify-content: space-between; gap: .75rem; background: var(--brand-soft); border: 1px solid rgba(var(--brand-rgb), .35); border-radius: .875rem; padding: .8rem .9rem; }
.ab-rec-bid { font-size: 2rem; font-weight: 750; color: var(--brand); line-height: 1.1; font-variant-numeric: tabular-nums; }
/* The best-profit bid, under the bid to win: same card, green. */
.ab-rec-profit { margin-top: .5rem; background: var(--bs-success-bg-subtle); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.ab-rec-profit .ab-rec-bid { color: var(--success); }
.ab-mychance { margin-top: .5rem; padding: .45rem .7rem; border-radius: .6rem; }
.ab-mychance:empty { display: none; }
.ab-mychance.is-good { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.ab-mychance.is-mid { background: var(--surface-2); }
.ab-mychance.is-low { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.ab-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .75rem 0 .3rem; }
.ab-stats > div { background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; padding: .5rem .6rem; text-align: center; }
.ab-stats span { display: block; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.ab-stats strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.ab-chart { position: relative; height: 190px; margin-top: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; padding: .5rem; }

/* Proof sheet check */
.proof-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; }
.proof-thumb { position: relative; aspect-ratio: 3 / 4; border: 1px solid var(--border); border-radius: .6rem; overflow: hidden; background: var(--surface-2); }
.proof-thumb img { width: 100%; height: 100%; object-fit: cover; }
.proof-thumb-n { position: absolute; left: .25rem; top: .25rem; background: rgba(0, 0, 0, .6); color: #fff; font-size: .75rem; padding: 0 .35rem; border-radius: .25rem; }
.proof-thumb-x { position: absolute; right: .15rem; top: .1rem; border: 0; background: rgba(0, 0, 0, .6); color: #fff; width: 1.9rem; height: 1.9rem; border-radius: 50%; line-height: 1; font-size: 1.1rem; }
.proof-banner { display: flex; gap: .5rem; align-items: center; padding: .9rem 1rem; border-radius: .875rem; font-weight: 650; margin-bottom: .75rem; }
.proof-ok { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.proof-warn { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.proof-bad { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.proof-totals { max-width: 420px; }
.proof-issue-main { font-size: 1.05rem; margin: .2rem 0; font-variant-numeric: tabular-nums; }
