/* ===========================================================================
   app.css — hand-written additions on top of the Vite-built styles.css.
   Add new component + utility classes here; never edit styles.css by hand.
   =========================================================================== */

/* ── Utilities ─────────────────────────────────────────────────────────── */
/* No !important — jQuery .show()/.toggle() needs to override at runtime. */
.u-hidden { display: none; }
.u-block { display: block; }
.u-inline-block { display: inline-block; }
.u-flex { display: flex; }
.u-flex-wrap { flex-wrap: wrap; }
.u-full-width { width: 100%; }
.u-gap-8 { gap: 8px; }
.u-gap-10 { gap: 10px; }
.u-relative { position: relative; }
.u-mt-2 { margin-top: 2px; }
.u-mt-3 { margin-top: 3px; }
.u-mt-4 { margin-top: 4px; }
.u-mt-12 { margin-top: 12px; }
.u-mt-16 { margin-top: 16px; }
.u-mb-8 { margin-bottom: 8px; }
.u-mb-12 { margin-bottom: 12px; }
.u-mb-16 { margin-bottom: 16px; }
.u-text-left { text-align: left; }
.u-text-center { text-align: center; }
.u-text-right { text-align: right; }
.u-font-mono { font-family: 'DM Mono', monospace; }
.u-font-mono-700 { font-family: 'DM Mono', monospace; font-weight: 700; }
.u-muted-xs { font-size: 10px; color: var(--g400); }
.u-text-navy { color: var(--navy); }
.u-text-red { color: var(--red); }

/* ── Builder: editing banner ───────────────────────────────────────────── */
.editing-banner {
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 12px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.editing-banner.is-editing {
    background: var(--blue-bg);
    border: 1.5px solid var(--blue-bd);
}
.editing-banner.is-revising {
    background: #f5f3ff;
    border: 1.5px solid #c4b5fd;
}
.editing-banner .id-tag {
    font-family: 'DM Mono', monospace;
    color: var(--g400);
}

/* ── Builder: inline error / alert banner ──────────────────────────────── */
.builder-error,
.alert-error {
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #991b1b;
}

/* ── Builder: action-bar dot variants ──────────────────────────────────── */
.action-bar-dot { background: #64748b; }
.action-bar-dot.is-saved { background: #22c55e; }
.action-bar-dot.is-dirty { background: #f59e0b; }

/* ── Builder: customer picker ──────────────────────────────────────────── */
.customer-picker-wrap { position: relative; }
.customer-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1.5px solid var(--g200);
    border-radius: 8px;
    margin-top: 2px;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
}
.customer-result {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 12px;
}
.customer-result:hover { background: var(--g50); }
.customer-result .name { font-weight: 600; }
.customer-result .country { font-size: 10px; color: var(--g400); }
.customer-result-empty,
.customer-result-error {
    padding: 8px 12px;
    font-size: 11px;
}
.customer-result-empty { color: var(--g400); }
.customer-result-error { color: #b91c1c; }

/* ── Builder: discount/qty tables — placeholder + zone colors ─────────── */
.net-price.is-empty { color: var(--g300); }
.net-price.zone-green { color: var(--green-d); }
.net-price.zone-amber { color: var(--amber); }
.net-price.zone-red { color: var(--red); }

/* ── Builder: agreed pricing (customer default discounts) ─────────────── */
/* A discount row prefilled from the customer's agreed pricing is read-only
   (amber) until the user confirms an overwrite; the badge flags it. */
.disc-input.agreed-locked {
    background: #fff7e6;
    border-color: #f0c36d;
    cursor: pointer;
}
.agreed-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #8a5a00;
    background: #fff2cc;
    border: 1px solid #f0c36d;
}

/* ── Disc table column widths (mirrors the original HTML layout) ──────── */
/* Body text-align for cols 2-6 is already set in styles.css; we only      */
/* need column widths + matching header alignment.                         */
.disc-table th:nth-child(1), .disc-table td:nth-child(1) { width: 20%; }
.disc-table th:nth-child(2), .disc-table td:nth-child(2) { width: 10%; }
.disc-table th:nth-child(3), .disc-table td:nth-child(3) { width: 10%; }
.disc-table th:nth-child(4), .disc-table td:nth-child(4) { width: 10%; }
.disc-table th:nth-child(5), .disc-table td:nth-child(5) { width: 10%; }
.disc-table th:nth-child(6), .disc-table td:nth-child(6) { width: 10%; }
.disc-table th:nth-child(7), .disc-table td:nth-child(7) { width: 30%; }

.disc-table th:nth-child(2),
.disc-table th:nth-child(3),
.disc-table th:nth-child(4),
.disc-table th:nth-child(5),
.disc-table th:nth-child(6) { text-align: right; }
.disc-table th:nth-child(7) { text-align: left; }

/* ── Qty table column widths (mirrors original HTML layout) ───────────── */
.qty-table { table-layout: fixed; width: 100%; }
.qty-table th:nth-child(1), .qty-table td:nth-child(1) { width: 26%; }
.qty-table th:nth-child(2), .qty-table td:nth-child(2) { width: 11%; text-align: center; }
.qty-table th:nth-child(3), .qty-table td:nth-child(3) { width: 13%; text-align: right; }
.qty-table th:nth-child(4), .qty-table td:nth-child(4) { width: 14%; text-align: right; }
.qty-table th:nth-child(5), .qty-table td:nth-child(5) { width: 12%; text-align: center; }
.qty-table th:nth-child(6), .qty-table td:nth-child(6) { width: 12%; text-align: right; }
.qty-table th:nth-child(7), .qty-table td:nth-child(7) { width: 12%; text-align: right; }

.qty-table th:nth-child(2) { text-align: center; }
.qty-table th:nth-child(3),
.qty-table th:nth-child(4),
.qty-table th:nth-child(6),
.qty-table th:nth-child(7) { text-align: right; }
.qty-table th:nth-child(5) { text-align: center; }

/* Per-cell styling that matches the original inline styles */
.qty-units-per-pack {
    font-family: 'DM Mono', monospace;
    font-weight: 700;
    color: var(--navy);
}
.qty-price-unit {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    color: var(--g600);
}
.qty-price-pack {
    font-family: 'DM Mono', monospace;
    font-weight: 700;
    color: var(--navy);
}
.qty-packs-label {
    font-size: 9px;
    color: var(--g400);
    margin-top: 2px;
    text-align: center;
}

/* ── Recon: per-product accounting table ──────────────────────────────── */
.recon-table.acct-table { table-layout: fixed; width: 100%; }
.recon-table.acct-table th:nth-child(1), .recon-table.acct-table td:nth-child(1) { width: 22%; }
.recon-table.acct-table th:nth-child(2), .recon-table.acct-table td:nth-child(2) { width: 11%; text-align: right; }
.recon-table.acct-table th:nth-child(3), .recon-table.acct-table td:nth-child(3) { width: 11%; text-align: right; }
.recon-table.acct-table th:nth-child(4), .recon-table.acct-table td:nth-child(4) { width: 13%; text-align: right; }
.recon-table.acct-table th:nth-child(5), .recon-table.acct-table td:nth-child(5) { width: 11%; text-align: right; }
.recon-table.acct-table th:nth-child(6), .recon-table.acct-table td:nth-child(6) { width: 11%; text-align: right; }
.recon-table.acct-table th:nth-child(7), .recon-table.acct-table td:nth-child(7) { width: 11%; text-align: right; }
.recon-table.acct-table th:nth-child(8), .recon-table.acct-table td:nth-child(8) { width: 10%; text-align: right; }

/* ── Recon: per-SKU cash table ────────────────────────────────────────── */
.recon-table.cash-table { table-layout: fixed; width: 100%; }
.recon-table.cash-table th:nth-child(1), .recon-table.cash-table td:nth-child(1) { width: 32%; }
.recon-table.cash-table th:nth-child(2), .recon-table.cash-table td:nth-child(2) { width: 17%; text-align: right; }
.recon-table.cash-table th:nth-child(3), .recon-table.cash-table td:nth-child(3) { width: 17%; text-align: right; }
.recon-table.cash-table th:nth-child(4), .recon-table.cash-table td:nth-child(4) { width: 17%; text-align: right; }
.recon-table.cash-table th:nth-child(5), .recon-table.cash-table td:nth-child(5) { width: 17%; text-align: right; }

.recon-table .mono { font-family: 'DM Mono', monospace; }
.recon-table .cell-sub { font-size: 9px; color: var(--g400); font-weight: 400; margin-top: 1px; }
.recon-table .cell-name { font-weight: 600; font-size: 12px; }
.recon-table .cell-meta { font-size: 10px; color: var(--g400); }

/* Cash table row variants */
.cash-row-product { background: var(--g100); border-top: 2px solid var(--g300); }
.cash-row-besure { background: #eef4ff; }
.cash-row-fit { background: #f0fbe8; border-bottom: 2px solid var(--g300); }
.cash-row-indent { padding-left: 20px; }
.party-besure { font-size: 11px; font-weight: 700; color: var(--navy); }
.party-fit { font-size: 11px; font-weight: 700; color: var(--green-d); }

/* ── Recon: 8-column cash-owed grid (overrides flex default) ──────────── */
.cash-owed-box.cash-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0;
    padding: 0;
    overflow: hidden;
    align-items: stretch;
}
.cash-grid .cash-cell {
    padding: 12px 10px;
    border-right: 1px solid #bfdbfe;
    text-align: center;
}
.cash-grid .cash-cell:last-child { border-right: none; }
.cash-grid .cash-cell .cash-owed-val { font-size: 14px; }
.cash-cell--besure { background: #eef4ff; }
.cash-cell--besure .cash-owed-label,
.cash-cell--besure .cash-owed-sub { color: var(--navy); }
.cash-cell--besure .cash-owed-val { color: var(--navy); }
.cash-cell--fit { background: #f0fbe8; }
.cash-cell--fit .cash-owed-label,
.cash-cell--fit .cash-owed-sub { color: var(--green-d); }
.cash-cell--fit .cash-owed-val { color: var(--green-d); }
.cash-cell--owed { background: var(--navy); }
.cash-cell--owed .cash-owed-label,
.cash-cell--owed .cash-owed-sub { color: rgba(255, 255, 255, .7); }
.cash-cell--owed .cash-owed-val { color: white; }
.cash-cell--owed .fit-retains-val { color: var(--green); }
.cash-cell--owed .cell-divider {
    border-top: 1px solid rgba(255, 255, 255, .2);
    margin-top: 6px;
    padding-top: 6px;
}

/* ── Recon: traffic-light coloring ────────────────────────────────────── */
.gm-green { color: var(--green-d); font-weight: 700; }
.gm-amber { color: var(--amber); font-weight: 700; }
.gm-red { color: var(--red); font-weight: 700; }
.freight-pct-good { color: var(--green-d); font-weight: 700; }
.freight-pct-amber { color: var(--amber); font-weight: 700; }
.gp-positive { color: var(--green-d); }
.gp-negative { color: var(--red); }

/* Recon - detail toggle/section reveal (.detail-section.open already in styles.css) */
.detail-toggle { cursor: pointer; }

/* ── Quote View / Razor preview ────────────────────────────────────────── */
.preview-header-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.action-toolbar {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.status-pill {
    padding: 6px 10px;
    background: var(--g50);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}
.status-pill.status-draft    { background: var(--g100); color: var(--g600); }
.status-pill.status-locked   { background: #fef3c7; color: #92400e; }
.status-pill.status-accepted { background: var(--green-bg); color: var(--green-d); }
.status-pill.status-rejected { background: #fee2e2; color: #991b1b; }
.status-pill.status-closed   { background: var(--g200); color: var(--g600); }

/* Invoices listing — invoice type pill */
.invoice-type-pill {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.invoice-type-pill.invoice-type-quote { background: #e0e7ff; color: #3730a3; }
.invoice-type-pill.invoice-type-fit   { background: #cffafe; color: #155e75; }
.kes-rate-stamp {
    font-size: 9px;
    color: #6b7280;
    margin-left: auto;
}
.kes-block { margin-top: 16px; }
.kes-rate-banner { margin-bottom: 14px; }
.payment-terms-bar { background: #f8fafc; }
.payment-terms-bar .q-delivery-val { font-size: 11px; font-weight: 600; }

/* ── Shipment Setup card ───────────────────────────────────────────────── */
.shipment-list { display: flex; flex-direction: column; gap: 16px; }
.shipment-card {
    background: var(--g50);
    border: 1.5px solid var(--g200);
    border-radius: 10px;
    padding: 12px 16px;
}
.shipment-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.shipment-card-index {
    font-size: 10px;
    font-weight: 700;
    color: var(--g400);
    min-width: 20px;
}
.ship-field-name {
    flex: 2;
    min-width: 200px;
    text-align: left;
    font-size: 11px;
}
.ship-type-toggle {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--g200);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.ship-type-btn {
    padding: 5px 12px;
    border: none;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    background: var(--g50);
    color: var(--g600);
}
.ship-type-btn.is-active-air { background: #0369a1; color: white; }
.ship-type-btn.is-active-sea { background: #0f766e; color: white; }
.ship-num-field {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.ship-num-label {
    font-size: 10px;
    color: var(--g400);
}
.ship-num-label.is-fit {
    color: #0369a1;
    font-weight: 600;
}
.ship-num-input { width: 70px; }
.ship-num-input.is-wide { width: 80px; }
.ship-num-input.is-fit { width: 72px; border-color: #0369a1; }
.ship-remove-btn {
    font-size: 11px;
    padding: 4px 10px;
    color: var(--red);
    border-color: var(--red-bd);
    flex-shrink: 0;
}
.ship-saving-status {
    font-size: 10px;
    color: var(--g400);
    margin-top: 4px;
    display: block;
}
.shipment-product-table { margin-top: 12px; }
.shipment-empty-msg {
    font-size: 11px;
    color: var(--g400);
    padding: 10px 0;
}
.ship-receive-btn { font-size: 11px; padding: 4px 10px; flex-shrink: 0; }

/* Customer contacts repeater — left-aligned text inputs (override fm-input's right/mono) */
#contactTable .fm-input { text-align: left; font-family: 'DM Sans', sans-serif; font-weight: 400; }
#contactTable th { font-size: 10px; }

/* Agreed pricing — default discount table (left-aligned like the other repeaters) */
#defaultDiscountTable th { font-size: 10px; }
#defaultDiscountTable .fm-input { text-align: left; font-family: 'DM Sans', sans-serif; font-weight: 400; }

/* Checkboxes inside .field must stay native — the global .field input rule
   (appearance:none; width:100%) otherwise strips their checkbox look. */
.field input[type="checkbox"] {
    width: auto;
    appearance: auto;
    -webkit-appearance: auto;
    background: none;
    box-shadow: none;
    padding: 0;
    margin-right: 6px;
    vertical-align: middle;
}

/* ── Linked quotes (shipment ↔ quote, many-to-many) ─────────────────────── */
.linked-quotes {
    margin: 8px 0 18px 0;
    padding: 12px 14px;
    background: var(--g50);
    border: 1px solid var(--g200);
    border-radius: 10px;
}
.linked-quotes-head {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--g600);
    margin-bottom: 8px;
}
.linked-quotes-head .lq-count {
    display: inline-block;
    min-width: 18px;
    padding: 0 6px;
    margin-left: 4px;
    border-radius: 10px;
    background: var(--navy);
    color: #fff;
    font-size: 10px;
    text-align: center;
}
.lq-empty { font-size: 11px; color: var(--g400); margin-bottom: 8px; }
.lq-table { width: 100%; margin-bottom: 8px; }
.lq-table .is-muted { color: var(--g400); }
.lq-add { display: flex; gap: 8px; align-items: center; }
.lq-add .js-lq-select { max-width: 380px; }
.lq-add #freightShipmentSelect { max-width: 420px; }
/* Left-align the link-quote dropdown (fm-input defaults to right-aligned mono) */
.linked-quotes .fm-input,
#freightSetupsCard .fm-input { text-align: left; font-family: 'DM Sans', sans-serif; font-weight: 400; }

/* Freight Setup card on the quote builder — keep contents left-aligned */
#freightSetupsCard .lq-add { justify-content: flex-start; }

/* Quote view — "On shipments" chips */
.lq-ship-list { display: flex; flex-wrap: wrap; gap: 8px; }
.lq-ship-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 16px;
    background: var(--g100);
    border: 1px solid var(--g200);
    font-size: 12px;
    color: var(--navy);
}
.lq-ship-chip .lq-ship-status {
    font-size: 10px;
    font-weight: 700;
    color: var(--g600);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Freight setup — per-shipment summary (type, products, units, est. freight) */
#freightShipmentChips { flex-direction: column; align-items: stretch; gap: 12px; }
.lq-ship-summary {
    border: 1px solid var(--g200);
    border-radius: 10px;
    background: #fff;
    padding: 12px 14px;
}
.lq-ship-summary-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.lq-ship-summary-head .lq-ship-name { font-weight: 700; color: var(--navy); }
.lq-ship-summary-head .lq-ship-type { font-size: 12px; color: var(--g600); }
.lq-ship-summary-head .lq-ship-status {
    font-size: 10px;
    font-weight: 700;
    color: var(--g600);
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--g100);
    border-radius: 12px;
    padding: 2px 8px;
}
.lq-ship-summary-head .lq-ship-remove { margin-left: auto; }
.lq-ship-prod-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lq-ship-prod-table th,
.lq-ship-prod-table td { padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--g100); }
.lq-ship-prod-table th.num,
.lq-ship-prod-table td.num { text-align: right; }
.lq-ship-prod-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--g600); }
.lq-ship-prod-table tfoot td { font-weight: 700; color: var(--navy); border-top: 1px solid var(--g200); border-bottom: none; }
.lq-ship-empty { font-size: 13px; color: var(--g600); }

/* Quantification — kit table + projection */
.card-stripe.stripe-purple { background: #7c3aed; }
#kitTable th { font-size: 10px; }
#kitTable .ck-product, #kitTable .ck-pricepoint { text-align: left; font-family: 'DM Sans', sans-serif; font-weight: 400; }
.proj-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.proj-cell { background: #faf7ff; border: 1.5px solid #d8c9f5; border-radius: 8px; padding: 12px 14px; }
.proj-k { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--g600); font-weight: 700; }
.proj-v { margin-top: 4px; font-family: 'DM Mono', monospace; font-size: 17px; font-weight: 800; color: var(--navy); }

/* ── Received Shipments (actual landed cost) ───────────────────────────── */
.received-card { border: 1.5px solid #a3d98a; background: #f6fbf1; }
.received-list { display: flex; flex-direction: column; gap: 12px; }
.received-shipment {
    border: 1.5px solid #a3d98a;
    border-radius: 10px;
    padding: 12px 14px;
    background: #fff;
}
.received-shipment.is-unlocked { border-color: #fdba74; background: #fffdf7; }
.received-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.received-name { font-size: 12px; font-weight: 800; color: var(--navy); }
.received-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}
.received-badge.is-locked { background: #e7f6e7; color: #2f7d32; }
.received-badge.is-unlocked { background: #fff1dd; color: #9a3412; }
.received-meta { font-size: 10px; color: var(--g400); }
.received-spacer { flex: 1; }
.received-remove-btn {
    font-size: 11px;
    padding: 4px 8px;
    color: var(--red);
    border-color: var(--red-bd);
}
.received-rates { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.ship-est-note { display: block; font-size: 10px; color: var(--g600); margin-top: 2px; }
.ship-rate-banner { display: inline-block; font-size: 11px; font-weight: 600; color: var(--navy); background: #eef0fa; border: 1px solid #d6dbf2; border-radius: 6px; padding: 4px 10px; margin: 2px 0 10px; }
.received-table { min-width: 520px; margin-top: 4px; }
.received-foot { margin-top: 8px; font-size: 10px; color: var(--g600); }
.received-foot .is-good { color: #2f7d32; }
.received-foot .is-warn { color: #b45309; }

/* ── Shipments page: 3-step layout (Step 1 / Step 2 / Step 3) ──────────── */
.card-stripe.stripe-blue  { background: #0369a1; }
.card-stripe.stripe-green { background: #166534; }

.shipment-add-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.shipment-add-note { font-size: 10px; color: var(--g400); }

/* Step 2 — Assignment table */
.assign-table { table-layout: fixed; width: 100%; min-width: 620px; }
.assign-table th:nth-child(1), .assign-table td:nth-child(1) { width: 28%; }
.assign-table th:nth-child(2), .assign-table td:nth-child(2) { width: 22%; }
.assign-table th:nth-child(3), .assign-table td:nth-child(3) { width: 13%; text-align: right; }
.assign-table th:nth-child(4), .assign-table td:nth-child(4) { width: 13%; text-align: right; }
.assign-table th:nth-child(5), .assign-table td:nth-child(5) { width: 14%; text-align: right; }
.assign-table .fm-ref { font-size: 10px; color: var(--g500); margin-top: 2px; }
.fm-input.num-narrow { width: 100%; }
.fm-input.js-assign-shipment { width: 100%; text-align: left; font-family: 'Inter', Arial, sans-serif; font-size: 11px; }

/* Step 3 — Calculation table */
.calc-table { table-layout: fixed; width: 100%; min-width: 760px; }
.calc-table th:nth-child(1), .calc-table td:nth-child(1) { width: 22%; }
.calc-table th:nth-child(2), .calc-table td:nth-child(2) { width: 9%;  text-align: right; }
.calc-table th:nth-child(3), .calc-table td:nth-child(3) { width: 9%;  text-align: right; }
.calc-table th:nth-child(4), .calc-table td:nth-child(4) { width: 12%; text-align: right; }
.calc-table th:nth-child(5), .calc-table td:nth-child(5) { width: 14%; text-align: right; }
.calc-table th:nth-child(6), .calc-table td:nth-child(6) { width: 13%; text-align: right; }
.calc-table th:nth-child(7) { width: 11%; text-align: right; }
.calc-table td:nth-child(7) { width: 11%; text-align: right; background: #dcfce7; }
.calc-table th:nth-child(8), .calc-table td:nth-child(8) { width: 10%; text-align: center; }
.calc-table .fm-calc { color: var(--g600); }
.calc-table .fm-calc.is-emph { font-weight: 800; color: var(--green-d); }
.calc-table td:nth-child(6) { font-weight: 700; color: var(--navy); }
.calc-method { font-size: 10px; }

/* Horizontal-scroll wrapper for wide tables inside cards (calc table, product table).
   overflow-x:auto only scrolls when the table is wider than the available space. */
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Step 3 shipment-total footer (verify vs FiT invoice) ──────────────── */
.shipment-total-foot td { background: var(--navy); color: #fff; padding: 8px 10px; vertical-align: top; }
.shipment-total-label { font-size: 11px; font-weight: 700; color: #fff; }
.shipment-total-val { text-align: right; font-family: 'DM Mono', monospace; }
.shipment-total-note { font-size: 10px; color: rgba(255, 255, 255, 0.6); text-align: right; vertical-align: middle; }
.shipment-total-empty { color: rgba(255, 255, 255, 0.4); }
.shipment-total-amount { font-size: 13px; font-weight: 800; color: #fff; }
.shipment-total-name { font-size: 9px; color: rgba(255, 255, 255, 0.6); }
.shipment-total-diff { font-size: 9px; margin-top: 2px; }
.shipment-total-diff.is-good { color: #86efac; }
.shipment-total-diff.is-warn { color: #fcd34d; }
.shipment-total-pct { font-size: 9px; margin-top: 3px; padding-top: 3px; border-top: 1px solid rgba(255, 255, 255, 0.15); }
.shipment-total-pct.is-good { color: #86efac; }
.shipment-total-pct.is-warn { color: #fcd34d; }
.shipment-total-sep { border: none; border-top: 1px solid rgba(255, 255, 255, 0.2); margin: 4px 0; }

/* ── Average freight summary box (Shipments page) ──────────────────────── */
.fm-summary-box {
    background: #f0fdf4;
    border: 1.5px solid #4ade80;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.fm-summary-title { font-size: 11px; font-weight: 700; color: var(--green-d); margin-bottom: 2px; }
.fm-summary-sub { font-size: 10px; color: var(--g600); margin-bottom: 10px; line-height: 1.5; }
.fm-summary-grid { display: flex; gap: 24px; flex-wrap: wrap; }
.fm-summary-cell { min-width: 130px; }
.fm-summary-label { font-size: 9px; color: var(--g400); text-transform: uppercase; letter-spacing: 0.08em; }
.fm-summary-val { font-size: 18px; font-weight: 800; font-family: 'DM Mono', monospace; color: var(--navy); }
.fm-summary-val.is-good { color: var(--green-d); }
.fm-summary-val.is-warn { color: var(--amber); }
.fm-summary-sublabel { font-size: 9px; color: var(--g400); }
.fm-summary-sublabel.is-good { color: var(--green-d); }
.fm-summary-sublabel.is-warn { color: var(--amber); }
.fm-summary-count { font-size: 11px; font-weight: 600; color: var(--navy); }
.fm-summary-count.is-muted { color: var(--g600); }

/* ── Shipments index table ─────────────────────────────────────────────── */
.shipments-index-table { width: 100%; border-collapse: collapse; }
.shipments-index-table th,
.shipments-index-table td { padding: 10px 14px; vertical-align: middle; }
.shipments-index-table th { white-space: nowrap; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--g600); border-bottom: 1px solid var(--g200); }
.shipments-index-table td { font-size: 12px; border-bottom: 1px solid var(--g100); }
.shipments-index-table tbody tr:hover { background: var(--g50); }
.shipments-index-table .num { text-align: right; white-space: nowrap; }
.shipments-index-table th.num { text-align: right; }

/* ── Shipments page footer (Save & Apply / Reset) ─────────────────────── */
.freight-footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--g50);
    border: 1px solid var(--g200);
    border-radius: 8px;
}
.freight-footer-saved { font-size: 10px; color: var(--g400); }
.freight-footer-btns { display: flex; gap: 8px; }

/* ── Freight setup warning banners on /Quotes/Edit ─────────────────────── */
.freight-warning-banner,
.freight-info-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}
.freight-warning-banner { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; }
.freight-info-banner    { background: #eef4ff; border: 1px solid #c7d6f5; color: #1b1464; }
.freight-warning-icon   { font-size: 20px; line-height: 1; }
.freight-warning-body   { flex: 1; font-size: 12px; line-height: 1.5; }
.freight-warning-body strong { font-weight: 700; }

/* ── Quotes list-page action buttons (compact) ─────────────────────────── */
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.row-actions .btn { padding: 4px 10px; font-size: 11px; }

/* ── Account / auth pages (Login) ──────────────────────────────────────── */
/* The login screen drops the navy topbar and shows the full BeSure logo on
   the lavender background, per the Figma "Login" design. */
body.auth-page .topbar { display: none; }

.auth-logo-wrap { padding: 40px 0 26px; }
.auth-logo {
    display: block;
    width: 340px;
    max-width: 82%;
    height: auto;
}

.auth-page .web-form label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 6px;
}
.auth-page .web-form .fm-input {
    background: #e9edfb;
    border: 1.5px solid #d9e0f5;
    border-radius: 8px;
    padding: 10px 12px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: var(--navy);
}
.auth-page .web-form .fm-input:focus {
    border-color: var(--navy);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(27, 20, 100, .12);
    outline: none;
}
.auth-page .web-form .btn { padding: 10px 20px; }

/* ── Topbar: inverse brand logo + logged-in user menu ──────────────────── */
.topbar-logo-link { display: inline-flex; align-items: center; }
.topbar-logo { display: block; width: auto; height: 26px; }

/* topbar-right base in styles.css is uppercase text styling; this row holds
   buttons + the user menu, so reset it to a simple flex container. */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: none;
    letter-spacing: normal;
}

.user-menu { position: relative; }
.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eceefb;
    color: var(--navy);
    border: none;
    border-radius: 20px;
    padding: 7px 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.user-menu-trigger:hover { background: #fff; }
.user-menu-chevron { width: 12px; height: 7px; transition: transform .2s; }
.user-menu.open .user-menu-chevron { transform: rotate(180deg); }

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid var(--g200);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(27, 20, 100, .18);
    padding: 6px;
    z-index: 200;
}
.user-menu.open .user-menu-dropdown { display: block; }

.user-menu-info { padding: 12px 14px 14px; }
.user-menu-fullname { font-size: 14px; font-weight: 700; color: var(--navy); }
.user-menu-email { font-size: 12px; color: var(--g400); margin-top: 2px; word-break: break-all; }
.user-menu-role {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 9px;
    border-radius: 20px;
    background: var(--g100);
    color: var(--g600);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.user-menu-divider { height: 1px; background: var(--g200); margin: 0 6px; }
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--navy);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.user-menu-item:hover { background: var(--g100); }
.user-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.user-menu-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--red);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.user-menu-logout:hover { background: var(--red-bg); }
.user-menu-logout svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Modal (e.g. final-freight confirmation on shipment arrival) ───────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(27, 20, 100, .45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 20px;
}
.modal-overlay.is-open { display: flex; }
.modal-card {
    background: #fff;
    border-radius: 12px;
    padding: 22px 24px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 50px rgba(27, 20, 100, .3);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ── App shell: sidebar + main (logged-in layout) ──────────────────────── */
.topbar { min-height: 58px; }

.app-shell { display: flex; align-items: flex-start; }

.sidenav {
    flex-shrink: 0;
    width: 262px;
    background: #eaecf7;
    border-right: 1px solid var(--g200);
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 58px;
    height: calc(100vh - 58px);
    overflow-y: auto;
}

.app-main { flex: 1; min-width: 0; }

.sidenav-section { display: flex; flex-direction: column; gap: 4px; }
.sidenav-section-label {
    padding: 0 8px;
    margin-bottom: 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--g400);
}

.sidenav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 8px;
    border-radius: 6px;
    color: var(--navy);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background .15s;
}
.sidenav-item:hover { background: #dde2f5; }
.sidenav-item.active,
.sidenav-item.active-parent { background: #cad2ff; font-weight: 700; }

.sidenav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.sidenav-label { flex: 1; min-width: 0; }

.sidenav-caret { width: 16px; height: 16px; flex-shrink: 0; transition: transform .2s; }
.sidenav-group.open .sidenav-caret { transform: rotate(180deg); }

.sidenav-subitems { display: none; flex-direction: column; gap: 2px; margin: 2px 0 2px 32px; }
.sidenav-group.open .sidenav-subitems { display: flex; }

.sidenav-subitem {
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--g600);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.sidenav-subitem:hover { background: #dde2f5; color: var(--navy); }
.sidenav-subitem.active { background: #cad2ff; color: var(--navy); font-weight: 700; }

/* ── Mobile hamburger nav (drawer) ─────────────────────────────────────── */
/* Toggle button + scrim are desktop-hidden; the drawer rules live in the
   media query below so desktop layout is untouched. */
.nav-toggle { display: none; }
.nav-scrim { display: none; }

@media (max-width: 768px) {
    /* Keep the topbar (and its hamburger) pinned while the drawer is open. */
    .topbar { position: sticky; top: 0; z-index: 120; }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin-right: 4px;
        padding: 0;
        background: none;
        border: none;
        border-radius: 8px;
        color: #fff;
        cursor: pointer;
        flex-shrink: 0;
    }
    .nav-toggle:hover { background: rgba(255, 255, 255, .14); }
    .nav-toggle-icon { width: 24px; height: 24px; }
    .nav-toggle-close { display: none; }
    body.nav-open .nav-toggle-open { display: none; }
    body.nav-open .nav-toggle-close { display: block; }

    /* Centre the brand between the hamburger and the user menu. */
    .topbar-brand { flex: 1; display: flex; justify-content: center; }

    /* Column flex: keep cross-axis stretch so .app-main fills the viewport width
       (default align-items:flex-start would size it to content and overflow). */
    .app-shell { flex-direction: column; align-items: stretch; }
    .app-main { width: 100%; }

    /* Multi-column form rows stack into a single column on mobile. */
    .form-row.cols-2,
    .form-row.cols-3 { grid-template-columns: 1fr; }
    /* Drop empty placeholder columns so stacked rows don't leave a gap. */
    .form-row > div:empty { display: none; }

    /* Wide listing tables scroll horizontally within their card (like the dashboard),
       so the page itself stays within the viewport. */
    .quotes-results,
    .list-results { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .quotes-table th, .quotes-table td,
    .list-table th, .list-table td { white-space: nowrap; }

    /* Quote builder/view tables keep a readable width and scroll horizontally
       within their .table-scroll / .qv-table-wrap container rather than
       squashing their columns on small screens. */
    .disc-table, .qty-table, .recon-table, .qv-table { min-width: 680px; }
    .channel-price-table { min-width: 520px; }
    #contactTable { min-width: 720px; }
    #kitTable { min-width: 640px; }
    #defaultDiscountTable { min-width: 420px; }

    /* Projection summary cells stack one per line instead of a 4-up grid. */
    .proj-grid { grid-template-columns: 1fr; }

    /* Quote editor action bar: rest at the bottom of the page instead of
       floating/sticking over the content, with status on top and buttons
       stacked full-width under each other. */
    .sticky-action-bar { position: static; box-shadow: none; }
    .action-bar-inner { flex-direction: column; align-items: stretch; }
    .action-bar-btns { flex-direction: column; }
    .action-bar-btns .btn { width: 100%; }

    /* Shipment detail fields stack one per line (name, type, Rate/KG, Additional, FiT KG). */
    .shipment-card-head { flex-direction: column; align-items: stretch; }
    .ship-field-name { width: 100%; min-width: 0; }
    .ship-type-toggle { align-self: flex-start; }
    .ship-num-field { justify-content: space-between; }
    .ship-num-input,
    .ship-num-input.is-wide,
    .ship-num-input.is-fit { flex: 1; width: auto; min-width: 0; }

    /* Sidebar becomes an off-canvas drawer that slides in under the topbar. */
    .sidenav {
        position: fixed;
        top: 58px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: auto;
        z-index: 110;
        background: #fcfcff;
        border-right: none;
        border-bottom: none;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    body.nav-open .sidenav { transform: translateX(0); }

    .nav-scrim {
        position: fixed;
        inset: 58px 0 0 0;
        background: rgba(27, 20, 100, .4);
        z-index: 105;
    }
    body.nav-open .nav-scrim { display: block; }

    /* Stop the page behind the drawer from scrolling. */
    body.nav-open { overflow: hidden; }
}

/* ── Shared listing pages (filter card + navy table) ───────────────────── */
/* First used by the Desktop - Quotes design; .list-* are the generic names
   for Products/Customers/Channels/Users, with .quotes-* kept as aliases. */
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 16px;
}
.quotes-toolbar, .page-toolbar { margin-bottom: 16px; }

.filter-actions { display: flex; gap: 8px; margin-top: 4px; }

.quotes-results, .list-results {
    background: #fff;
    border: 1px solid var(--g200);
    border-radius: 10px;
    /* Scroll wide tables horizontally instead of clipping them; keep the
       rounded corners by clipping the vertical axis. */
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 1px 4px #1b14640f;
}
.quotes-table, .list-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.quotes-table thead th, .list-table thead th {
    background: var(--navy);
    color: #fff;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: 11px;
    font-weight: 700;
    padding: 12px 14px;
    white-space: nowrap;
}
.quotes-table tbody td, .list-table tbody td {
    padding: 11px 14px;
    font-size: 13px;
    color: var(--navy);
    border-bottom: 1px solid var(--g100);
    vertical-align: middle;
}
.quotes-table tbody tr:last-child td, .list-table tbody tr:last-child td { border-bottom: none; }
.quotes-table tbody tr:hover td, .list-table tbody tr:hover td { background: var(--g50); }
.quotes-empty, .list-empty { color: var(--g400); font-style: italic; }

/* Dashboard pipeline tables */
.pipeline-table thead th,
.pipeline-table tbody td,
.pipeline-table tfoot td { text-align: center; }
.pipeline-table tfoot td {
    padding: 11px 14px;
    border-top: 2px solid var(--g300);
    font-weight: 700;
}
.pipeline-heading { font-size: 1.25rem; margin-top: 1.75rem; }
.pipeline-filter { max-width: 280px; }

.quotes-actions, .list-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.quotes-actions .btn, .list-actions .btn { padding: 5px 12px; font-size: 12px; }
.quotes-actions-col, .list-actions-col { text-align: right; }

/* Icon-only edit button in a table row (pencil) */
.list-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--navy);
    transition: color .15s;
}
.list-edit:hover { color: var(--green-d); }
.list-edit svg { width: 18px; height: 18px; }

/* Square letter badge (e.g. "C" for customer) — mirrors the Dentwerx box-time square */
.letter-square {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    /* explicit equal width/height = a true square, sized to the Reorder
       button's height (.btn = 9px vertical padding + 13px text ≈ 34px) */
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: var(--navy);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.list-edit:hover .letter-square { background: var(--green-d); }

.quotes-pagination, .list-pagination { margin-top: 12px; }

/* Pagination control (page tabs + arrows) */
.w-pagination { display: flex; flex-direction: column; gap: 8px; }
.w-pagination > p { margin: 0; }
.w-pagination > p small { color: var(--g400); font-size: 12px; }
.w-pagination ul { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; padding: 0; margin: 0; }
.w-pagination li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--g200);
    border-radius: 6px;
    font-size: 13px;
    color: var(--navy);
    text-decoration: none;
    background: #fff;
    transition: background .15s, border-color .15s;
}
.w-pagination li a:hover { background: var(--g50); border-color: var(--g300); }
.w-pagination li a.w-current { background: var(--navy); border-color: var(--navy); color: #fff; }
.w-pagination li span { display: inline-flex; align-items: center; padding: 0 6px; color: var(--g400); }

/* Sortable column headers */
.sortable thead th .sort-th {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
}
.sortable thead th .sort-th:hover { color: var(--navy); }
.sort-ind { font-size: 10px; min-width: 10px; }

/* ── Dashboard (Desktop - Dashboard 1 design) ──────────────────────────── */
.dashboard-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 40px;
}

.dash-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

/* Pending Quotes card */
.dash-pending {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 311px;
}
.dash-pending-head { text-align: center; }
.dash-bignum {
    font-size: 64px;
    font-weight: 500;
    line-height: 1.05;
    color: #000;
}
.dash-pending-label { font-size: 16px; font-weight: 500; color: #000; }

.dash-quote-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}
.dash-quote-item + .dash-quote-item { border-top: 1px solid var(--g200); padding-top: 10px; }
.dash-quote-cust { font-size: 12px; font-weight: 700; color: #000; margin-bottom: 4px; }
.dash-quote-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: #000;
}
.dash-quote-ref { flex: 1; min-width: 0; }
.dash-quote-date { flex-shrink: 0; text-align: right; white-space: nowrap; }
.dash-empty { font-size: 13px; color: var(--g400); font-style: italic; text-align: center; }

.dash-card-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}
.dash-card-actions .btn { width: 100%; justify-content: center; }

/* Shared section header (white cards) */
.dash-section-head { display: flex; flex-direction: column; gap: 8px; }
.dash-section-title { font-size: 16px; font-weight: 700; color: #000; }
.dash-section-sub { font-size: 12px; font-weight: 400; color: #000; }

/* Quotes Pipeline card */
.dash-pipeline {
    flex: 1;
    min-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.pipeline-flow {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pipeline-stage {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 131px;
    padding: 16px;
    background: #eaecf7;
    border: 1px solid #dfe2ed;
    border-radius: 8px;
    text-align: center;
}
.pipeline-stage-label { font-size: 16px; font-weight: 500; color: #000; }
.pipeline-stage-num { font-size: 48px; font-weight: 500; line-height: 1.1; color: #000; }
.pipeline-chevron { flex-shrink: 0; width: 18px; height: 18px; color: var(--g400); transform: rotate(-90deg); }

/* Retain & Grow nav button in the flow row */
.pipeline-stage-link {
    gap: 12px;
    text-decoration: none;
    background: var(--navy);
    border-color: var(--navy);
    transition: filter .15s;
}
.pipeline-stage-link:hover { filter: brightness(1.15); }
.pipeline-stage-link .pipeline-stage-label { color: #fff; }
.pipeline-stage-link-icon { width: 28px; height: 28px; color: #cad2ff; }
.pipeline-stage-link-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #cad2ff;
}
.pipeline-stage-link-arrow { width: 14px; height: 14px; transform: rotate(-90deg); }

.pipeline-terminal { display: flex; gap: 16px; }
.pipeline-term {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #eaecf7;
    border: 1px solid #dfe2ed;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    color: #000;
}
.pipeline-term-label { flex: 1; min-width: 0; }
.pipeline-term-num { flex-shrink: 0; text-align: right; white-space: nowrap; }
/* Terminal statuses use the same green/red already used elsewhere (bid bars,
   status pills), filling the whole box with white text. */
.pipeline-term--accepted   { background: var(--green); border-color: var(--green); color: #fff; }
.pipeline-term--closedlost { background: var(--red);   border-color: var(--red);   color: #fff; }

/* Full-width stacked sections below the top grid */
.dash-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 40px;
}
.dash-section-narrow { width: 478px; max-width: 100%; }

/* Bids-by-customer column chart (customers on x, money on y, coloured by stage) */
.bar-draft    { background: #9aa0b8; }
.bar-proposed { background: #d97706; }
.bar-won      { background: #6dad54; }
.bar-lost     { background: #dc2626; }

.bidcust-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: #000; }
.bidcust-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bidcust-legend i { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.bidcust { display: flex; gap: 10px; width: 100%; }
.bidcust-yaxis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 240px;
    padding-bottom: 20px;          /* aligns the $0 mark with the bar baseline (above labels) */
    font-size: 10px;
    color: var(--g400);
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}
.bidcust-chart {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
    gap: 1.2%;                      /* scales with the chart width */
    height: 240px;
    padding-top: 4px;
}
.bidcust-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bidcust-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 12%; }
.bidcust-bar { flex: 1; max-width: 18px; min-width: 0; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .3s ease; }
.bidcust-label {
    height: 14px;
    max-width: 100%;
    font-size: 10px;
    color: var(--g400);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    /* Keep the dashboard within the viewport; wide stat tables scroll inside their
       own card (.list-results) so this only clips stray horizontal overflow. */
    .dash-page { overflow-x: hidden; padding-left: 16px; padding-right: 16px; }

    /* Cards stack full-width in a single column (Mobile - Dashboard 1 design). */
    .dashboard-grid { gap: 20px; max-width: 100%; }
    .dash-card { max-width: 100%; }
    .dash-pending { width: 100%; }
    .dash-pipeline { min-width: 0; width: 100%; }

    /* Quotes Pipeline becomes a 2×2 grid; chevrons drop out. */
    .pipeline-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .pipeline-chevron { display: none; }
    .pipeline-stage { min-height: 110px; }
    .pipeline-stage-link { min-height: 110px; flex-direction: column; gap: 6px; }
    .pipeline-stage-link-icon { width: 22px; height: 22px; }

    /* Accepted / Rejected / Closed Lost stack full-width. */
    .pipeline-terminal { flex-direction: column; gap: 12px; }

    .dash-section { margin-top: 20px; }
    .dash-section-narrow { width: 100%; }

    /* Wide stat tables scroll horizontally inside their card instead of clipping. */
    .dash-section .list-results { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .dash-section .list-results .pipeline-table { min-width: 680px; }

    /* Slightly tighter bid-by-customer chart on small screens. */
    .bidcust-yaxis, .bidcust-chart { height: 200px; }
}

/* ── My Account / My Details (Desktop - User Settings 2 design) ────────── */
.account-card { max-width: 740px; }
.account-actions { margin-top: 4px; }

/* ── Quote View (Desktop - Quotes View Page design) ────────────────────── */
.qv { display: flex; flex-direction: column; gap: 16px; }

.qv-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    color: #1b1464;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}
.qv-back:hover { text-decoration: underline; }

.qv-card { background: #fff; border: 1px solid #dfe2ed; border-radius: 8px; padding: 16px; }

/* Buttons */
.qv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1.5px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: filter .15s, background .15s;
}
.qv-btn-outline { background: #fff; border-color: #1b1464; color: #1b1464; }
.qv-btn-outline:hover { background: #f3f4fb; }
.qv-btn-primary { background: #1b1464; color: #fff; }
.qv-btn-primary:hover { filter: brightness(1.18); }
.qv-btn:disabled { opacity: .5; cursor: default; filter: none; }

/* Header card */
.qv-head { display: flex; flex-direction: column; gap: 16px; }
.qv-head-top { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.qv-head-title { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.qv-title { margin: 0; font-size: 24px; font-weight: 700; color: #1b1464; }
.qv-head-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    font-weight: 500;
    color: #1b1464;
}
.qv-vline-sm { width: 1px; height: 14px; background: #cbd2e6; }
.qv-status-line { display: inline-flex; align-items: center; gap: 8px; }
.qv-status-badge { background: #eef0f6; color: #1b1464; font-size: 11px; font-weight: 500; padding: 4px 8px; border-radius: 6px; }
.qv-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

/* Info card */
.qv-info { display: flex; flex-direction: column; gap: 16px; }
.qv-info-row { display: flex; gap: 16px; align-items: stretch; }
.qv-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: #1b1464; }
.qv-field-label { font-size: 11px; font-weight: 500; }
.qv-field-val { font-size: 14px; font-weight: 700; }
.qv-vline { width: 1px; align-self: stretch; background: #dfe2ed; flex-shrink: 0; }
.qv-info-boxes { display: flex; gap: 16px; }
.qv-box {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px;
    background: #f5f9fe;
    border: 1px solid #c6deff;
    border-radius: 6px;
}

/* Pricing card */
.qv-pricing { display: flex; flex-direction: column; gap: 20px; }
.qv-pricing-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.qv-pricing-title { font-size: 16px; font-weight: 700; color: #000; }
.qv-rate-badge { background: #eaf4ff; color: #1b1464; font-size: 11px; font-weight: 500; padding: 4px 8px; border-radius: 6px; }

.qv-table-wrap { border: 1px solid #dfe2ed; border-radius: 8px; overflow: hidden; }
.qv-table { width: 100%; border-collapse: collapse; }
.qv-table thead th {
    background: #1b1464;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .6px;
    text-align: left;
    padding: 12px;
    white-space: nowrap;
}
.qv-table tbody td { padding: 12px; font-size: 14px; font-weight: 500; color: #000; border-bottom: 1px solid #dfe2ed; }
.qv-table tbody tr:last-child td { border-bottom: none; }
.qv-table .u-text-right { text-align: right; }
.qv-col-product { width: 180px; }
.qv-empty { color: var(--g400); font-style: italic; text-align: center; }

.qv-totals {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: #f7f8fb;
    border: 1px solid #dfe2ed;
    border-radius: 6px;
}
.qv-totals-top { display: flex; justify-content: space-between; gap: 16px; }
.qv-totals-labels, .qv-totals-amounts { display: flex; flex-direction: column; gap: 2px; color: #1b1464; }
.qv-totals-amounts { text-align: right; }
.qv-totals-top span { font-size: 11px; font-weight: 500; }
.qv-totals-top .qv-vat { font-size: 12px; font-weight: 700; color: #d97706; }
.qv-totals-divider { height: 1px; background: #dfe2ed; }
.qv-grand { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; font-weight: 700; color: #1b1464; }

@media (max-width: 768px) {
    .qv-info-row { flex-wrap: wrap; }
    .qv-vline { display: none; }
    .qv-info-boxes { flex-direction: column; }
    .qv-table-wrap { overflow-x: auto; }
}

/* ── Public (anonymous, email-linked) pages ───────────────────────────── */
/* Used by Pages/Public/* via _PublicLayout. No CMS nav or links in — the
   brand logo is a plain image, not a link, so recipients cannot reach the app. */
.public-topbar {
    display: flex;
    align-items: center;
    background: #1b1464;
    padding: 14px 24px;
}
.public-logo { display: block; width: auto; height: 26px; }

/* ── Credit terms panel (Quote builder, card 4) ───────────────────────── */
/* Revealed when the selected payment term pays less than 100% up-front. */
.credit-terms-panel {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #c8cedf;
}
.credit-terms-panel .field { max-width: 360px; }

/* ── Quotes index tabs (Normal vs Consignment) ────────────────────────── */
.quotes-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #dfe2ed;
    margin: 4px 0 16px;
}
.quotes-tab {
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #5a6180;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.quotes-tab:hover { color: #1b1464; }
.quotes-tab.is-active { color: #1b1464; border-bottom-color: #1b1464; }

/* ── Consignment invoice qty (Quote View) ─────────────────────────────── */
/* Flags an "Invoice now" quantity that exceeds the remaining supply. */
.js-consign-qty.is-over { border-color: var(--red-bd); color: var(--red); }
#consignmentMsg.is-error { color: var(--red); font-weight: 600; }

/* ── Consignment AUD/USD baseline (Quote View) ────────────────────────── */
/* Locked-at-creation home-currency rate vs the live rate, for invoicing decisions. */
.aud-baseline {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 14px;
}
.aud-baseline-item {
    flex: 1 1 200px;
    padding: 10px 14px;
    background: var(--g50);
    border: 1px solid var(--g200);
    border-radius: 8px;
}
.aud-baseline-val { font-family: 'DM Mono', monospace; font-size: 15px; font-weight: 700; color: var(--navy); margin-top: 3px; }
.aud-baseline-date { font-size: 10px; color: var(--g400); margin-top: 2px; }
.aud-baseline-delta { font-size: 11px; font-weight: 700; margin-top: 3px; }
.aud-baseline-delta.is-up { color: var(--green-d); }
.aud-baseline-delta.is-down { color: var(--red); }
.aud-baseline-delta.is-flat { color: var(--g600); }
