/* COG Pharma Sales Portal theme. Loaded after app.css. */
:root {
    --brand: #0f766e;
    --brand-hover: #115e59;
    --brand-soft: #ccfbf1;
    --brand-rgb: 15, 118, 110;
    --ink: #0f172a;
    --muted: #64748b;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --sidebar: #0b1220;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, .08);

    --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-body-color: var(--ink);
    --bs-border-color: var(--border);
    --bs-border-radius: 10px;
    --bs-border-radius-lg: 12px;
}

html, body {
    font-family: "Segoe UI Variable Text", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { font-weight: 650; letter-spacing: -.01em; }

a, .btn-link { color: var(--brand); }
a:hover { color: var(--brand-hover); }

/* Buttons */
.btn { border-radius: 10px; font-weight: 550; }
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: #fff;
    --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);
    --bs-btn-disabled-border-color: var(--brand);
    color: #fff;
    background-color: var(--brand);
    border-color: var(--brand);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-hover);
}
.btn-success { --bs-btn-bg: #16a34a; --bs-btn-border-color: #16a34a; --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d; }
.btn-outline-secondary { --bs-btn-color: #334155; --bs-btn-border-color: var(--border); --bs-btn-hover-bg: #f8fafc; --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #cbd5e1; --bs-btn-active-bg: #f1f5f9; --bs-btn-active-color: var(--ink); background: #fff; }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 .22rem rgba(var(--brand-rgb), .22);
    border-color: var(--brand);
}

/* Forms */
.form-control, .form-select { border-radius: 10px; border-color: #cbd5e1; }
.form-label { font-weight: 550; font-size: .875rem; color: #334155; margin-bottom: .35rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.valid.modified:not([type=checkbox]) { outline: none; border-color: #16a34a; }
.invalid { outline: none; border-color: #dc2626 !important; }
.validation-message { color: #dc2626; font-size: .85rem; }
.code-input { letter-spacing: .5em; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Cards, tables, alerts */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.25rem; margin-bottom: 1.5rem; }
.panel > :last-child { margin-bottom: 0; }
.panel > h2:first-child, .panel > .h5:first-child { margin-bottom: 1rem; }

.table { --bs-table-bg: transparent; --bs-table-striped-bg: #f8fafc; margin-bottom: 0; }
.table > thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); background: #f8fafc; white-space: nowrap; }
.table > :not(caption) > * > * { padding: .8rem 1rem; }
.table-responsive { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel .table-responsive { border: 0; box-shadow: none; border-radius: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f0fdfa; }

.alert { border: 0; border-radius: 12px; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info { background: #eff6ff; color: #1e40af; }

.badge { font-weight: 600; border-radius: 999px; padding: .4em .75em; }
.badge[class*="status-"] { background: #e2e8f0; color: #334155; }
.badge.status-active, .badge.status-submitted { background: #d1fae5; color: #065f46; }
.badge.status-inactive, .badge.status-cancelled { background: #fee2e2; color: #991b1b; }
.badge.role-badge { background: #ccfbf1; color: #115e59; }
.nav-pills .nav-link { color: #334155; border-radius: 10px; }
.nav-pills .nav-link.active { background: var(--brand); color: #fff; }
.badge.bg-secondary { background: #e2e8f0 !important; color: #334155; }

/* Page header and stat tiles */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.5rem; }
.page-header h1 { margin: 0; font-size: 1.6rem; }
.page-header .sub { color: var(--muted); font-size: .95rem; margin: .15rem 0 0; }

.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.1rem 1.25rem; height: 100%; }
.stat-card .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-card .value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: .25rem; }

.blazor-error-boundary { border-radius: 10px; }
h1:focus { outline: none; }

/* App shell */
.shell { display: flex; min-height: 100vh; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.sidebar { width: 264px; flex-shrink: 0; background: var(--sidebar); color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 1040; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1280px; margin: 0 auto; padding: 2rem 2rem 3rem; }
.topbar { display: none; align-items: center; gap: .75rem; padding: .7rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1030; }
.topbar-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 650; }
.hamburger { display: inline-flex; padding: .35rem; border-radius: 8px; cursor: pointer; color: var(--ink); margin: 0; }
.hamburger:hover { background: var(--bg); }
.scrim { display: none; }

.side-brand { display: flex; align-items: center; gap: .75rem; padding: 1.4rem 1.25rem 1.1rem; color: #fff; text-decoration: none; }
.side-brand:hover { color: #fff; }
.side-brand strong { display: block; font-size: 1.02rem; line-height: 1.2; }
.side-brand small { color: #94a3b8; font-size: .78rem; }

.side-nav { flex: 1; overflow-y: auto; padding: .25rem .75rem 1rem; }
.side-heading { text-transform: uppercase; letter-spacing: .09em; font-size: .68rem; font-weight: 700; color: #64748b; padding: 1.1rem .75rem .4rem; }
.side-link { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .6rem .75rem; border-radius: 10px; color: #cbd5e1; text-decoration: none; font-weight: 500; font-size: .94rem; border: 0; background: transparent; text-align: left; transition: background .12s, color .12s; }
.side-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-link.active { background: rgba(20, 184, 166, .16); color: #5eead4; }
.side-link .icon { opacity: .9; }

.side-footer { padding: .75rem; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: .25rem; }
.side-user { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem; border-radius: 10px; color: #e2e8f0; text-decoration: none; min-width: 0; }
.side-user:hover, .side-user.active { background: rgba(255, 255, 255, .07); color: #fff; }
.side-user-text { min-width: 0; line-height: 1.25; }
.side-user-text strong { display: block; font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text small { color: #94a3b8; font-size: .74rem; }
.avatar { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; }
.side-logout { color: #94a3b8; }
.side-logout:hover { color: #fca5a5; background: rgba(239, 68, 68, .12); }

@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-md); }
    .nav-toggle:checked ~ .sidebar { transform: none; }
    .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 1035; }
    .topbar { display: flex; }
    .content { padding: 1.25rem 1rem 2.5rem; }
}

/* Logo */
.brand-mark { display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; box-shadow: 0 4px 14px rgba(20, 184, 166, .35); flex-shrink: 0; }

.icon { flex-shrink: 0; vertical-align: -.2em; }

/* Sign-in screens */
.auth-shell { min-height: 100vh; display: flex; }
.auth-brand { flex: 1 1 46%; background: radial-gradient(1200px 600px at 0% 0%, #14b8a6 0%, transparent 55%), linear-gradient(160deg, #0f766e 0%, #0b1220 100%); color: #fff; display: none; align-items: center; padding: 3rem; }
.auth-brand-inner { max-width: 440px; margin: 0 auto; }
.auth-headline { font-size: 2.6rem; font-weight: 700; line-height: 1.1; letter-spacing: -.03em; margin-bottom: 1rem; }
.auth-sub { color: rgba(255,255,255,.8); font-size: 1.05rem; margin-bottom: 2rem; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; color: rgba(255,255,255,.9); }
.auth-points li { display: flex; align-items: center; gap: .6rem; }
.auth-points .icon { color: #5eead4; }
.auth-panel { flex: 1 1 54%; display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-mobile-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 2rem; }
.auth-title { font-size: 1.75rem; font-weight: 700; margin-bottom: .35rem; }
.auth-lead { color: var(--muted); margin-bottom: 1.75rem; }
.auth-divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin: 1.25rem 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-footnote { color: var(--muted); font-size: .9rem; text-align: center; margin-top: 1.5rem; }
.auth-card .btn-lg { font-size: 1rem; padding: .7rem 1rem; }

@media (min-width: 992px) {
    .auth-brand { display: flex; }
    .auth-mobile-brand { display: none; }
}

/* List toolbar: search + segmented filter */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.search-box { position: relative; flex: 1 1 280px; max-width: 460px; display: flex; align-items: center; }
.search-box > .icon { position: absolute; left: .9rem; color: var(--muted); pointer-events: none; }
.search-box .form-control { padding: .6rem 2.5rem .6rem 2.6rem; background: var(--surface); }
.search-clear { position: absolute; right: .45rem; border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: .3rem; display: inline-flex; cursor: pointer; }
.search-clear:hover { background: var(--bg); color: var(--ink); }
.seg { display: inline-flex; background: #e8edf3; border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: .4rem .85rem; border-radius: 9px; font-weight: 550; font-size: .875rem; color: #475569; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.seg .count { margin-left: .35rem; font-size: .75rem; color: var(--muted); font-weight: 600; }
.seg button.on .count { color: var(--brand); }

/* Data tables */
.th-sort { border: 0; background: transparent; padding: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
.th-sort:hover { color: var(--ink); }
.th-sort .arrow { font-size: .7rem; opacity: .8; }
.sku { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; color: #334155; background: #f1f5f9; border-radius: 6px; padding: .15rem .45rem; white-space: nowrap; }
.cell-strong { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: .8rem; }
.num { font-variant-numeric: tabular-nums; }
tr.is-inactive > td { color: #94a3b8; }
tr.is-inactive .sku { background: #f8fafc; color: #94a3b8; }
.table-foot { padding: .65rem 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem; background: #f8fafc; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .icon { color: #cbd5e1; margin-bottom: .75rem; }
.empty-state h3 { font-size: 1.05rem; color: var(--ink); margin-bottom: .25rem; }

.typeahead { position: relative; }
.typeahead-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: .6rem; box-shadow: 0 10px 25px rgba(15, 23, 42, .12); overflow: hidden; }
.typeahead-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: .55rem .85rem; border: 0; background: transparent; text-align: left; }
.typeahead-item:hover, .typeahead-item:focus { background: var(--brand-soft); outline: none; }
.typeahead-empty { padding: .65rem .85rem; color: var(--muted); font-size: .9rem; }
.picked-customer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .85rem; border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: .6rem; background: var(--surface); }

.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; gap: 1rem; align-items: start; }
.order-side { position: sticky; top: 1rem; }
@media (max-width: 991.98px) { .order-grid { grid-template-columns: 1fr; } .order-side { position: static; } }
.search-hint { padding: .85rem .25rem 0; color: var(--muted); font-size: .88rem; }
.product-results { margin-top: .75rem; border: 1px solid var(--border); border-radius: .6rem; overflow: hidden; }
.product-result { display: flex; align-items: center; gap: .85rem; padding: .6rem .85rem; border-bottom: 1px solid var(--border); }
.product-result:last-of-type { border-bottom: 0; }
.product-result:hover { background: #f8fafc; }
.product-result-main { flex: 1; min-width: 0; }
.product-result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .2rem; font-size: .8rem; }
.product-result-price { font-weight: 600; white-space: nowrap; }
.product-results .search-hint { padding: .6rem .85rem; background: #f8fafc; border-top: 1px solid var(--border); }
.stock-ok { color: #065f46; }
.in-order { color: var(--brand); font-weight: 600; }
.cart-line { padding: .7rem 0; border-bottom: 1px solid var(--border); }
.cart-line-top { display: flex; justify-content: space-between; gap: .5rem; }
.cart-line-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; }
.cart-line-total { font-weight: 600; }
.qty { display: inline-flex; gap: .3rem; align-items: center; }
.qty input { width: 4.5rem; text-align: center; }
.cart-warn { margin-top: .4rem; font-size: .8rem; color: #b45309; background: #fef3c7; border-radius: .4rem; padding: .2rem .5rem; display: inline-block; }
.cart-total { display: flex; justify-content: space-between; padding-top: .8rem; font-weight: 700; font-size: 1.05rem; }
.btn-icon { border: 0; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 0 .35rem; border-radius: .4rem; }
.btn-icon:hover { background: #fee2e2; color: #991b1b; }

.form-section { margin: 1.5rem 0 .75rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.form-section:first-of-type { margin-top: 0; }
.form-section .text-none { text-transform: none; letter-spacing: 0; font-size: .9rem; }
.req { color: #dc2626; }

.modal-overlay { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px); }
.modal-card { width: 100%; max-width: 54rem; max-height: calc(100vh - 2rem); display: flex; flex-direction: column; background: var(--surface); border-radius: .9rem; box-shadow: 0 25px 60px rgba(15, 23, 42, .35); overflow: hidden; }
.modal-form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 2rem); }
.modal-header-bar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-body-scroll { padding: 1.25rem; overflow-y: auto; min-height: 0; }
.modal-footer-bar { display: flex; justify-content: flex-end; gap: .5rem; padding: .85rem 1.25rem; border-top: 1px solid var(--border); background: #f8fafc; }
body:has(.modal-overlay) { overflow: hidden; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.info-card { border: 1px solid var(--border); border-radius: .6rem; padding: .75rem .9rem; background: #f8fafc; }
.info-card h3 { margin: 0 0 .4rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.info-card .line { font-size: .92rem; }
.info-card .missing { color: #b45309; font-size: .88rem; }

/* New order: per-order ship-to override and editable sales price */
.ship-toggle { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; font-size: .85rem; cursor: pointer; }
.ship-override { display: grid; gap: .4rem; }
.ship-override-row { display: grid; grid-template-columns: 1.4fr .8fr 1fr; gap: .4rem; }
.cart-price { display: flex; justify-content: space-between; align-items: flex-end; gap: .75rem; margin-top: .5rem; }
.cart-price-ref, .cart-price-edit { display: flex; flex-direction: column; gap: .15rem; }
.cart-price-edit input { width: 7rem; text-align: right; }
.muted-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cart-note { margin-top: .35rem; font-size: .78rem; color: var(--brand); display: flex; gap: .6rem; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; font-size: .78rem; cursor: pointer; }
.cart-margin { margin-top: .35rem; font-size: .78rem; color: var(--muted); }

.pre-line { white-space: pre-line; }
.order-done { max-width: 720px; }
.link-btn.mt-1 { display: inline-block; }


/* Larger customer dialog: fixed height so the address suggestions always have room below the search box */
.modal-card-lg { max-width: 68rem; height: min(52rem, calc(100vh - 2rem)); }
.modal-card-lg .modal-form { height: 100%; }
.modal-card-lg .modal-body-scroll { flex: 1 1 auto; padding-bottom: 6rem; }
.modal-card-lg .typeahead-list { max-height: 16rem; overflow-y: auto; }
.addr-hint { font-size: .8rem; color: var(--muted); background: #f8fafc; border: 1px dashed var(--border); border-radius: .5rem; padding: .4rem .65rem; margin-bottom: .75rem; }
.save-address-btn { margin-top: .6rem; width: 100%; font-weight: 600; }
.ship-saved { font-size: .82rem; color: #047857; background: #ecfdf5; border-radius: .4rem; padding: .3rem .5rem; margin-bottom: .5rem; }

.product-result-disabled { opacity: .55; }
.product-result-disabled .btn { cursor: not-allowed; }

/* Customer editor: tabbed dialog with a fixed height so switching tabs doesn't resize it */
.modal-card-lg { max-width: 46rem; width: 96vw; height: min(40rem, calc(100vh - 2rem)); }
.modal-card-lg .modal-body-scroll { padding-bottom: 1.25rem; }
.editor-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin: -.25rem 0 1rem; overflow-x: auto; }
.editor-tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: .55rem .85rem; font-size: .9rem; font-weight: 500; color: var(--muted); white-space: nowrap; cursor: pointer; }
.editor-tab:hover { color: var(--brand); }
.editor-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.addr-search .form-control { font-size: .85rem; padding-top: .3rem; padding-bottom: .3rem; }
.addr-search .typeahead-item { font-size: .85rem; }

/* Customer cards on the order page: billing and ship-to side by side, contact and terms below */
.cust-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.cust-grid .info-card { background: var(--surface); padding: .9rem 1rem; min-width: 0; }
.cust-billing { order: 1; }
.cust-ship { order: 2; border-left: 3px solid var(--brand); }
.cust-contact { order: 3; }
.cust-terms { order: 4; }
.cust-wide { grid-column: 1 / -1; order: 5; }
.cust-grid .ship-override { max-width: 34rem; }
.cust-grid .addr-search { max-width: 34rem; }
.cust-grid .save-address-btn { width: auto; max-width: 34rem; padding-left: 1rem; padding-right: 1rem; }
.cust-grid .line { overflow-wrap: anywhere; }
@media (max-width: 767.98px) { .cust-grid { grid-template-columns: 1fr; } .cust-grid .info-card { order: 0; } .cust-wide { grid-column: auto; } }

/* One customer card: header, facts strip, then billing and ship-to */
.qb-badge { background: var(--brand-soft); color: var(--brand-hover); font-weight: 600; font-size: .68rem; vertical-align: middle; margin-left: .35rem; }
.cust-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .6rem 1rem; padding: .7rem .9rem; background: #f8fafc; border: 1px solid var(--border); border-radius: .6rem; }
.cust-fact { font-size: .9rem; font-weight: 500; overflow-wrap: anywhere; }
.cust-fact span { display: block; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* Order draft banner and recent orders */
.draft-banner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.recent-orders { border: 1px solid var(--border); border-radius: .6rem; padding: .6rem .9rem; background: var(--surface); }
.recent-orders h3 { margin: 0 0 .35rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.recent-order { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .4rem 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.recent-order:first-of-type { border-top: 0; }
.recent-order .small { margin-left: .5rem; }

/* Leads */
.badge.status-new { background: #dbeafe; color: #1e40af; }
.badge.status-contacted { background: #e0e7ff; color: #3730a3; }
.badge.status-qualified { background: #fef3c7; color: #92400e; }
.badge.status-negotiating { background: #ede9fe; color: #5b21b6; }
.badge.status-converted { background: #d1fae5; color: #065f46; }
.badge.status-lost { background: #e5e7eb; color: #4b5563; }
.lead-table tr.clickable { cursor: pointer; }
.stage-steps { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stage-steps button { flex: 1 1 0; border: 0; border-right: 1px solid var(--border); background: var(--surface); padding: .55rem .5rem; font-weight: 600; font-size: .85rem; color: #64748b; cursor: pointer; }
.stage-steps button:last-child { border-right: 0; }
.stage-steps button:hover:not(:disabled) { background: #f1f5f9; color: var(--ink); }
.stage-steps button.on { background: var(--brand); color: #fff; }
.lead-facts { display: grid; gap: .25rem; font-size: .93rem; }
.lead-notes { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem; white-space: pre-wrap; font-size: .9rem; }
.log-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: .8rem; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 .9rem; border-left: 2px solid var(--border); display: grid; gap: .8rem; }
.timeline-item { position: relative; }
.timeline-item::before { content: ""; position: absolute; left: -1.28rem; top: .35rem; width: .6rem; height: .6rem; border-radius: 50%; background: #94a3b8; border: 2px solid var(--surface); }
.timeline-item.t-call::before { background: #2563eb; }
.timeline-item.t-email::before { background: #7c3aed; }
.timeline-item.t-meeting::before { background: #059669; }
.timeline-item.t-system .timeline-text { color: #64748b; font-style: italic; }
.timeline-head { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.timeline-type { font-weight: 650; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.timeline-text { white-space: pre-wrap; }
.followup-list { list-style: none; margin: 0; padding: 0; }
.followup-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); }
.followup-list li:last-child { border-bottom: 0; }
.badge.status-stale { background: #ffedd5; color: #9a3412; }
.import-list { margin: 0 0 1rem; padding-left: 1.1rem; max-height: 12rem; overflow: auto; }
.qbo-status { display: flex; gap: .75rem; align-items: center; padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; border: 1px solid; }
.qbo-dot { width: .8rem; height: .8rem; border-radius: 50%; flex: none; }
.qbo-ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.qbo-ok .qbo-dot { background: #10b981; box-shadow: 0 0 0 4px #a7f3d0; }
.qbo-bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.qbo-bad .qbo-dot { background: #ef4444; box-shadow: 0 0 0 4px #fecaca; }
/* Blazor unhandled-error banner: hidden until the framework shows it. */
#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    padding: .6rem 3rem .6rem 1.25rem;
    background: #fff3cd;
    color: #664d03;
    border-top: 1px solid #ffe69c;
    box-shadow: 0 -2px 8px rgba(0,0,0,.15);
}
#blazor-error-ui .reload { margin-left: .5rem; }
#blazor-error-ui .dismiss { position: absolute; right: 1rem; top: .5rem; cursor: pointer; }