/* ============================================================================
   LabNexa — feature modules
   Layered on top of app.css. Every rule here is scoped to a page family, so
   nothing in this file needs !important to win against the core system.
   1. Auth screens          5. Command centre        9. Result entry
   2. Executive analytics   6. Owner / platform     10. Reports & receipts
   3. Advanced pages        7. Charts               11. Dynamic formats
   4. KPI cards             8. Invoices
   ============================================================================ */

/* ---------- 1. Auth screens ---------------------------------------------- */
.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(900px 500px at 15% -10%, var(--brand-100), transparent 60%),
        radial-gradient(800px 460px at 100% 100%, var(--accent-50), transparent 62%),
        var(--bg);
}
.login-card {
    width: min(430px, 100%);
    padding: 36px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-4);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; text-align: left; }
.login-logo {
    width: 64px; height: 64px; flex: 0 0 64px;
    object-fit: contain; padding: 7px;
    background: var(--logo-tile); border-radius: var(--r-lg);
}
.login-brand > span { display: grid; min-width: 0; }
.login-brand strong { font-size: 22px; font-weight: 750; color: var(--primary); letter-spacing: -.02em; }
.login-brand small { margin-top: 3px; font-size: 12px; font-weight: 500; color: var(--muted); }
.login-card h1 { text-align: center; margin: 0 0 6px; font-size: 21px; }
.login-card > p { text-align: center; color: var(--muted); margin: 0 0 24px; }
.login-card form { display: grid; gap: 16px; }
.login-card > small { display: block; text-align: center; color: var(--muted); margin-top: 20px; }

.public-shell { min-height: 100vh; }

/* ---------- 2. Executive analytics heading -------------------------------- */
/* Owner dashboard reuses .page-heading; these keep its inner controls aligned. */
.owner-heading input, .owner-heading select { min-height: 38px; }
.owner-heading .btn { min-width: 140px; }
.eyebrow {
    display: block;
    font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase;
    color: var(--accent-300);
}

/* ---------- 3. Advanced pages -------------------------------------------- */
.advanced-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    flex-wrap: wrap;
    margin: 0 0 22px;
    padding: 24px 28px;
    border-radius: var(--r-xl);
    color: #fff;
    background:
        radial-gradient(1000px 300px at 90% -50%, rgba(111, 211, 212, .32), transparent 60%),
        linear-gradient(122deg, var(--brand-800), var(--brand-600) 60%, var(--accent-600) 120%);
    box-shadow: var(--sh-3);
}
.advanced-hero::after {
    content: "";
    position: absolute; right: -80px; top: -150px;
    width: 260px; height: 260px;
    border: 44px solid rgba(255, 255, 255, .07);
    border-radius: 50%;
    pointer-events: none;
}
.advanced-hero > * { position: relative; z-index: 1; }
.advanced-hero h1 { margin: 4px 0 6px; font-size: 26px; color: #fff; }
.advanced-hero p { margin: 0; color: rgba(226, 240, 253, .86); font-size: 13px; }
.advanced-eyebrow {
    display: block; margin-bottom: 5px;
    color: var(--accent-300);
    font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
}

.analyzer-hero { background: linear-gradient(122deg, #073b67, #1160a5 58%, #087d8c); }
.partner-hero  { background: linear-gradient(122deg, #153a60, #265f98 60%, #2a8190); }
.health-hero   { background: linear-gradient(122deg, #183550, #155d82 58%, #118478); }

.advanced-primary, .advanced-refresh {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: var(--r-md);
    font: inherit; font-size: 13px; font-weight: 650;
    white-space: nowrap; cursor: pointer;
    transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.advanced-primary { background: #fff; color: var(--brand-700); box-shadow: var(--sh-2); }
.advanced-primary:hover { transform: translateY(-1px); box-shadow: var(--sh-3); }
.advanced-refresh { background: rgba(255, 255, 255, .13); color: #fff; }
.advanced-refresh:hover { background: rgba(255, 255, 255, .24); }
.advanced-refresh span { font-size: 16px; }

.advanced-page .panel-header { min-height: 62px; }
.advanced-page .filters { background: var(--surface-2); }

/* ---------- 4. KPI cards -------------------------------------------------- */
.owner-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.advanced-page .owner-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.owner-kpi {
    position: relative;
    overflow: hidden;
    min-width: 0;
    padding: 18px 19px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    transition: box-shadow var(--t-med), transform var(--t-med), border-color var(--t-med);
}
.owner-kpi::before {
    content: "";
    position: absolute; inset: 0 0 auto 0; height: 3px;
    background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
}
.owner-kpi:hover { box-shadow: var(--sh-2); transform: translateY(-2px); border-color: var(--brand-200); }
.owner-kpi small, .owner-kpi strong, .owner-kpi em, .owner-kpi span { display: block; }
.owner-kpi small {
    color: var(--muted); font-size: 11px; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase;
}
.owner-kpi strong {
    margin: 8px 0 4px;
    font-size: 26px; font-weight: 700; letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.owner-kpi em, .owner-kpi span { font-size: 11px; font-style: normal; color: var(--muted); line-height: 1.5; }
.owner-kpi .up { color: var(--success-fg); font-weight: 650; }
.owner-kpi .down { color: var(--danger-fg); font-weight: 650; }
.owner-kpi-icon {
    position: absolute; right: 14px; top: 14px;
    padding: 6px 8px;
    border-radius: var(--r-md);
    background: var(--wash); color: var(--primary);
    font-weight: 800; font-size: 12px;
}

.owner-insight-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 14px 0;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: linear-gradient(120deg, var(--brand-900), var(--brand-700));
    color: #fff;
    box-shadow: var(--sh-2);
}
.owner-insight-strip > div { padding: 17px 20px; border-right: 1px solid rgba(255, 255, 255, .12); min-width: 0; }
.owner-insight-strip > div:last-child { border-right: 0; }
.owner-insight-strip small, .owner-insight-strip span { display: block; color: rgba(198, 220, 240, .9); font-size: 11.5px; }
.owner-insight-strip b { display: block; margin: 5px 0; font-size: 21px; font-variant-numeric: tabular-nums; }

.owner-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.owner-rank-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.rank-card table { font-size: 12px; }

/* ---------- 5. Command centre -------------------------------------------- */
.command-page .command-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; }

.command-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--text) !important;
    box-shadow: var(--sh-1);
    transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
}
.command-card:hover { transform: translateY(-3px); box-shadow: var(--sh-3); border-color: var(--brand-200); }
.command-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--brand-500); }
.command-card > i {
    display: grid; place-items: center;
    width: 38px; height: 38px; margin-bottom: 15px;
    border-radius: var(--r-lg);
    background: var(--wash); color: var(--primary);
    font-size: 17px; font-style: normal; font-weight: 800;
}
.command-card small {
    display: block; color: var(--muted);
    font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.command-card strong {
    display: block; margin: 5px 0 8px;
    font-size: 29px; font-weight: 700; letter-spacing: -.025em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.command-card > div > span { display: block; min-height: 36px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.command-card > b {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: auto; padding-top: 13px;
    border-top: 1px solid var(--line-soft);
    color: var(--primary); font-size: 12px; font-weight: 650;
}
.command-card em { font-size: 16px; font-style: normal; transition: transform var(--t-fast); }
.command-card:hover em { transform: translateX(3px); }

.command-card.cyan::before   { background: var(--accent-500); }
.command-card.cyan > i       { background: var(--accent-50); color: var(--accent-700); }
.command-card.red::before    { background: var(--danger); }
.command-card.red > i        { background: var(--danger-bg); color: var(--danger-fg); }
.command-card.amber::before  { background: var(--warning); }
.command-card.amber > i      { background: var(--warning-bg); color: var(--warning-fg); }
.command-card.violet::before { background: #7659bd; }
.command-card.violet > i     { background: #f0ebfc; color: #6849ad; }
.command-card.green::before  { background: var(--success); }
.command-card.green > i      { background: var(--success-bg); color: var(--success-fg); }

/* ---------- 6. Owner / platform console ---------------------------------- */
.dashboard-kpis {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px;
}
.dashboard-kpi {
    position: relative; overflow: hidden; min-width: 0;
    padding: 18px 19px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.dashboard-kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand-500); }
.dashboard-kpi.trial::before     { background: var(--warning); }
.dashboard-kpi.active::before    { background: var(--success); }
.dashboard-kpi.expired::before   { background: var(--danger); }
.dashboard-kpi.suspended::before { background: var(--n-400); }
.dashboard-kpi span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 700; }
.dashboard-kpi strong {
    display: block; margin: 8px 0 3px;
    font-size: 29px; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums;
}
.dashboard-kpi small { color: var(--muted); }

.platform-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr); gap: 18px; align-items: start; }
.dashboard-panel {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden;
}
.dashboard-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 17px 20px; border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
}
.dashboard-panel-head h2 { margin: 0; font-size: 15.5px; }
.dashboard-panel-head a { font-size: 12px; font-weight: 650; }

.subscription-bars { padding: 14px 20px 18px; }
.subscription-row { display: grid; grid-template-columns: 105px minmax(0, 1fr) 30px; gap: 12px; align-items: center; margin: 13px 0; font-size: 12px; }
.subscription-track { height: 9px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.subscription-track i { display: block; height: 100%; min-width: 4px; background: var(--brand-500); border-radius: var(--r-pill); transition: width var(--t-med); }
.subscription-row:nth-child(2) i { background: var(--success); }
.subscription-row:nth-child(3) i { background: var(--danger); }
.subscription-row:nth-child(4) i { background: var(--n-400); }

.billing-summary { padding: 20px; }
.billing-amount { font-size: 30px; font-weight: 800; color: var(--danger-fg); font-variant-numeric: tabular-nums; }
.billing-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.billing-meta > div { padding: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.billing-meta span { display: block; color: var(--muted); font-size: 11px; }
.billing-meta b { display: block; margin-top: 5px; }
.billing-period-panel { margin-bottom: 18px; }
.billing-period-toolbar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.billing-period-intro { flex: 1 1 250px; align-self: center; }
.billing-period-intro strong { display: block; font-size: 15px; }
.billing-period-intro small { display: block; margin-top: 3px; color: var(--muted); }
.billing-period-field { min-width: 170px; margin: 0; }
.billing-period-field span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.billing-period-field input { width: 100%; }
.billing-period-presets { display: flex; gap: 7px; flex-wrap: wrap; }
.billing-period-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
@media (max-width: 620px) { .billing-period-field { flex: 1 1 140px; min-width: 140px; } .billing-period-summary { align-items: flex-start; flex-direction: column; } }

.dashboard-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.dashboard-action {
    padding: 16px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); color: var(--text) !important; box-shadow: var(--sh-1);
    transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.dashboard-action b { display: block; margin-bottom: 5px; }
.dashboard-action small { color: var(--muted); }
.dashboard-action:hover { border-color: var(--brand-300); transform: translateY(-2px); box-shadow: var(--sh-2); }

/* ---------- 7. Charts ----------------------------------------------------- */
.chart-bars { height: 236px; display: flex; align-items: flex-end; gap: 4px; padding: 20px 18px 4px; }
.chart-day {
    height: 100%; flex: 1; position: relative;
    display: flex; align-items: flex-end; justify-content: center; gap: 2px;
    border-bottom: 1px solid var(--line);
}
.chart-day .bar { width: 42%; min-height: 3px; border-radius: var(--r-xs) var(--r-xs) 0 0; transition: height var(--t-med); }
.chart-day .booked, .chart-legend .booked { background: var(--brand-500); }
.chart-day .verified, .chart-legend .verified { background: var(--accent-500); }
.chart-day small { position: absolute; bottom: -19px; font-size: 9px; color: var(--muted); }
.chart-legend { display: flex; gap: 18px; justify-content: center; padding: 23px 20px 15px; font-size: 12px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; }

/* ---------- Numeric laboratory result trends ---------------------------- */
.numeric-trend-list { display: grid; gap: 12px; }
.numeric-trend-card {
    display: grid; grid-template-columns: minmax(150px, .8fr) minmax(360px, 2fr) minmax(120px, .65fr);
    align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: var(--r-sm); background: #fff; break-inside: avoid;
}
.numeric-trend-copy { display: grid; gap: 5px; }
.numeric-trend-copy > small { color: var(--muted); line-height: 1.4; }
.numeric-trend-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 10px; font-weight: 700; }
.numeric-trend-chart { display: block; width: 100%; height: 180px; overflow: visible; }
.trend-grid { stroke: #d7e0eb; stroke-width: 1; }
.trend-line { fill: none; stroke: #34465d; stroke-width: 2; stroke-dasharray: 5 4; }
.trend-point { stroke: #fff; stroke-width: 2; }
.trend-low { color: #b45309; fill: #d97706; }
.trend-normal { color: #174f91; fill: #1f67b2; }
.trend-high { color: #b42318; fill: #d92d20; }
.trend-axis, .trend-label, .trend-value { fill: #475569; font-family: Arial, sans-serif; }
.trend-axis, .trend-label { font-size: 10px; }
.trend-value { font-size: 11px; font-weight: 700; }
.numeric-trend-current { display: grid; justify-items: center; gap: 3px; text-align: center; }
.numeric-trend-current strong { font-size: 24px; line-height: 1; }
.numeric-trend-current span, .numeric-trend-current small { color: var(--muted); }
.numeric-trend-current b { font-size: 11px; text-transform: uppercase; }

@media (max-width: 800px) {
    .numeric-trend-card { grid-template-columns: 1fr; }
    .numeric-trend-chart { height: auto; }
}

@media print {
    .numeric-trend-card { grid-template-columns: 28% 52% 20%; padding: 7px 8px; gap: 8px; border-color: #8090a3; }
    .numeric-trend-chart { height: 135px; }
    .numeric-trend-current strong { font-size: 18px; }
}

.result-trends { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.result-trends h3 { margin: 0 0 8px; }
.trend-row { display: grid; grid-template-columns: 140px 90px minmax(0, 1fr) 90px minmax(0, 1fr); gap: 8px; align-items: center; font-size: 11px; margin: 5px 0; }
.trend-row i { display: block; height: 7px; background: var(--n-400); border-radius: var(--r-pill); }
.trend-row i.current { background: var(--primary); }
.trend-label { color: var(--muted); }

/* ---------- 8. Invoices & receipts ---------------------------------------- */
.payment-strip {
    display: grid; grid-template-columns: minmax(0, 1fr) 160px minmax(0, 1fr) auto auto;
    gap: 10px; align-items: center;
    padding: 14px 20px;
    background: var(--surface-2); border-bottom: 1px solid var(--line);
}

.invoice-totals { margin-left: auto; width: min(420px, 100%); }
.invoice-totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; }
.invoice-totals .grand-total { margin-top: 5px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 15px; font-weight: 650; }
.invoice-totals .balance-total {
    margin: 8px -12px -5px; padding: 12px;
    background: var(--surface-3); border-radius: var(--r-md); font-size: 16px; font-weight: 700;
}

.receipt-sheet {
    max-width: 850px; margin: 0 auto; padding: 40px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-md); box-shadow: var(--sh-2);
}
.receipt-brand { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 2px solid var(--primary); }
.receipt-brand h1 { font-size: 21px; margin: 0; }
.receipt-brand p { margin: 4px 0 0; color: var(--muted); }
.receipt-logo { width: 60px; height: 60px; flex: 0 0 60px; object-fit: contain; padding: 5px; background: var(--logo-tile); border-radius: var(--r-lg); }
.receipt-number { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; text-align: right; margin: 18px 0 28px; font-size: 12px; }
.receipt-number span { color: var(--muted); }
.receipt-patient { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 18px; background: var(--surface-2); border-radius: var(--r-md); }
.receipt-patient span, .receipt-meta div { display: block; color: var(--muted); font-size: 11px; }
.receipt-patient b, .receipt-meta b { display: block; color: var(--text); margin-top: 4px; }
.receipt-amount { text-align: center; padding: 32px 15px; }
.receipt-amount span { display: block; color: var(--muted); }
.receipt-amount strong { display: block; margin: 7px; font-size: 32px; color: var(--primary); font-variant-numeric: tabular-nums; }
.receipt-amount small { text-transform: capitalize; }
.receipt-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.receipt-notes { padding: 18px 0; }
.receipt-footer { display: flex; justify-content: space-between; gap: 16px; padding-top: 32px; color: var(--muted); font-size: 11px; }

.print-header { display: none; }
.print-logo { width: 68px; height: 68px; object-fit: contain; margin: 0 auto 6px; padding: 5px; background: var(--logo-tile); border-radius: var(--r-lg); }
.invoice-print-header { text-align: center; }

/* ---------- 9. Result entry ----------------------------------------------- */
.result-section-title {
    margin: 18px 0 8px;
    padding: 9px 13px;
    border-left: 4px solid var(--accent-500);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    background: var(--accent-50);
    color: var(--accent-700);
    font-size: 12.5px; font-weight: 800; letter-spacing: .02em;
}
.result-grid {
    display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
    border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
}
.result-grid > * { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.result-head {
    background: var(--surface-2); color: var(--muted);
    font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.preview-value { color: var(--muted); font-style: italic; }
.format-preview h3 { margin: 20px 0 8px; color: var(--primary); }

.report-test-selector { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.verification-progress { display: block; margin-top: 4px; color: var(--muted); font-weight: 500; }

.report-selector { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.report-selector > div:first-child { min-width: 150px; }
.report-selector > div:first-child small, .report-choice small { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; }
.report-choice {
    display: flex; align-items: flex-start; gap: 10px;
    min-width: 260px; padding: 12px 15px;
    border: 1px solid var(--line); border-radius: var(--r-md);
    font-weight: 400; cursor: pointer;
    transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.report-choice:hover { border-color: var(--brand-300); background: var(--wash); }
.report-choice input { margin-top: 2px; }
.report-choice.selected {
    border-color: var(--primary); background: var(--wash);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 14%, transparent);
}
.report-choice.disabled { opacity: .5; cursor: not-allowed; }

.analyzer-key code {
    display: block; margin: 10px 0; padding: 12px;
    border-radius: var(--r-md);
    background: var(--brand-900); color: var(--accent-300);
    font-size: 13px; overflow-wrap: anywhere;
}
.analyzer-key small { display: block; }

/* ---------- 10. Reports & receipts (screen) ------------------------------- */
.shared-report-sheet { max-width: 1000px; margin: auto; padding: 32px 24px; background: var(--surface); }

.test-report-block { margin-bottom: 22px; break-inside: avoid; }
.test-report-title {
    display: flex; justify-content: space-between; gap: 14px;
    padding: 8px 0; border-bottom: 2px solid var(--line);
    font-weight: 650;
}
.report-remark { margin-top: 10px; }
.column-date { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.previous-result { background: var(--wash); color: var(--brand-700); font-weight: 650; }
.comparison-note { display: block; margin: 7px 0 12px; color: var(--muted); font-style: italic; }

.classic-report-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; }
.classic-report-head h1 { margin: 0 0 5px; }
.classic-lab-identity { min-width: 0; }
.report-identifiers { display: flex; align-items: center; gap: 14px; }
.accession-bars { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; max-width: 145px; letter-spacing: 1px; }
.report-qr { width: 58px; height: 58px; object-fit: contain; }
.report-code { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 8px; }
.report-barcode { display: block; width: 155px; height: 48px; object-fit: fill; }
.report-contact { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 10px; color: var(--text-2); }
.report-contact span:first-child { flex-basis: 100%; }
.whatsapp-contact { color: #159a5b; font-weight: 700; }

.legacy-patient-grid .meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex: 1; gap: 6px 16px; }
.legacy-patient-grid .meta > div { min-width: 0; }

.report-final-footer { margin-top: 50px; break-inside: avoid; }
.report-verification{margin-bottom:2px;font-size:8px}
.report-disclaimer{margin-bottom:5px}
.report-footer-meta{break-inside:avoid;page-break-inside:avoid}
.signatory-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; align-items: end; }
.signatory-grid article { display: flex; flex-direction: column; justify-content: flex-end; min-height: 112px; font-size: 11px; }
.signatory-grid img { width: 118px; height: 42px; object-fit: contain; object-position: left bottom; margin-bottom: 4px; }
.signatory-grid span, .signatory-grid small { display: block; }
.signatory-grid span { white-space: pre-line; }
.signature-preview { display: block; width: 150px; height: 55px; object-fit: contain; margin-top: 10px; border-bottom: 1px solid var(--n-700); }
.report-disclaimer { margin-top: 12px; padding-top: 6px; border-top: 1px solid var(--n-600); text-align: center; font-size: 9px; color: var(--muted); }

/* ---------- 11. Dynamic formats ------------------------------------------ */
.dynamic-format-panel .panel-header { padding: 18px 20px; background: linear-gradient(105deg, var(--brand-50), var(--accent-50)); }
.dynamic-format-panel .panel-header h2 { margin-top: 3px; color: var(--brand-800); }
.dynamic-format-panel td { vertical-align: top; }
.dynamic-format-panel td input,
.dynamic-format-panel td select,
.dynamic-format-panel td textarea { margin-bottom: 6px; min-height: 34px; font-size: 12px; }
.dynamic-format-panel td textarea { min-height: 56px; }

.health-page .panel-body > p {
    display: flex; align-items: center; gap: 12px;
    margin: 0; padding: 14px 3px; border-bottom: 1px solid var(--line-soft);
}
.health-page .panel-body > p:last-of-type { border-bottom: 0; }
.health-page .panel-body > p.muted {
    display: block; margin-top: 12px; padding: 15px;
    background: var(--surface-2); border: 0; border-radius: var(--r-md); line-height: 1.6;
}

/* ---------- 12. Booking form ---------------------------------------------- */
/* These four hooks were in the markup but had no rule in any stylesheet, so the
   inline new-patient block rendered as unstyled, ungrouped fields. */
.inline-patient-card {
    padding: 18px;
    border: 1px solid var(--brand-200);
    border-radius: var(--r-lg);
    background: linear-gradient(180deg, var(--brand-50), var(--surface) 70%);
}
.inline-patient-heading {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 14px; flex-wrap: wrap;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--brand-200);
}
.inline-patient-heading b { display: block; font-size: 14px; color: var(--brand-800); }
.inline-patient-heading small { display: block; margin-top: 3px; color: var(--muted); }

.phone-lookup { display: flex; gap: 8px; align-items: stretch; }
.phone-lookup input { min-width: 0; }
.phone-lookup .btn { flex: 0 0 auto; min-height: 38px; }

.password-visibility {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0; font-weight: 500; color: var(--text-2); cursor: pointer;
}

.dynamic-report-section { margin-bottom: 14px; }
.dynamic-report-section h3 { margin: 12px 0 6px; color: var(--brand-800); font-size: 13px; }

.command-card.blue::before { background: var(--brand-500); }
.command-card.blue > i { background: var(--wash); color: var(--primary); }

.owner-chart .panel-body { padding-bottom: 8px; }
.platform-dashboard .page-heading { margin-bottom: 20px; }

/* ---------- Responsive ---------------------------------------------------- */
@media (max-width: 1300px) {
    .command-page .command-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .owner-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .advanced-page .owner-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1200px) {
    .owner-rank-grid { grid-template-columns: minmax(0, 1fr); }
    .owner-grid, .platform-dashboard-grid { grid-template-columns: minmax(0, 1fr); }
    .dashboard-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .owner-insight-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .payment-strip { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .advanced-hero { flex-direction: column; align-items: flex-start; padding: 22px; }
    .advanced-hero h1 { font-size: 22px; }
    .command-page .command-grid,
    .owner-kpis,
    .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .payment-strip { grid-template-columns: minmax(0, 1fr); }
    .receipt-sheet { padding: 24px 18px; }
    .receipt-number { margin-top: 12px; }
    .receipt-patient, .receipt-meta { grid-template-columns: minmax(0, 1fr); }
    .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .result-head { display: none; }
    .report-selector { flex-direction: column; align-items: stretch; }
    .report-choice { min-width: 0; }
    .signatory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .classic-report-head { grid-template-columns: auto minmax(0, 1fr); }
    .report-identifiers { grid-column: 1 / -1; }
    .trend-row { grid-template-columns: minmax(0, 1fr) 70px; }
    .chart-day:nth-child(even) small { display: none; }
}

@media (max-width: 560px) {
    .command-page .command-grid,
    .owner-kpis,
    .advanced-page .owner-kpis,
    .dashboard-kpis,
    .dashboard-actions,
    .owner-insight-strip,
    .billing-meta { grid-template-columns: minmax(0, 1fr); }
    .command-card { min-height: 180px; }
    .login-card { padding: 26px 20px; }
    .login-brand { flex-direction: column; text-align: center; }
}

/* Client support module */
.support-workspace { display:grid; grid-template-columns:minmax(0,2fr) minmax(280px,1fr); gap:20px; align-items:start; margin-bottom:20px; }
.support-create-panel, .support-summary-panel, .support-ticket-list { overflow:hidden; }
.support-summary-panel { position:sticky; top:84px; }
.support-kicker { display:block; color:var(--primary); font-size:.7rem; font-weight:800; letter-spacing:.13em; margin-bottom:4px; }
.support-kpis { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-bottom:16px; }
.support-kpis > div { background:var(--surface-2); border:1px solid var(--border); border-radius:12px; padding:14px 10px; text-align:center; }
.support-kpis span, .support-detail-meta span { display:block; color:var(--muted); font-size:.76rem; }
.support-kpis b { display:block; color:var(--primary); font-size:1.55rem; margin-top:4px; }
.support-platform-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:18px; }
.support-detail-modal, .support-admin-modal { width:min(960px,calc(100vw - 32px)); max-height:calc(100vh - 48px); overflow:auto; }
.family-phone-modal{width:min(680px,calc(100vw - 32px));max-height:calc(100vh - 48px);overflow:auto}
.family-phone-body{display:grid;gap:18px}
.family-phone-list{display:grid;gap:10px}
.family-phone-list article{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px;border:1px solid var(--line);border-radius:12px;background:var(--surface-soft,#f8fafc)}
.family-phone-list article div{display:grid;gap:3px}
.family-phone-list article small{color:var(--muted)}
@media(max-width:600px){.family-phone-list article{align-items:stretch;flex-direction:column}.family-phone-list article .btn{width:100%}}
.support-admin-modal { width:min(1100px,calc(100vw - 32px)); }
.support-detail-meta { display:flex; flex-wrap:wrap; gap:28px; padding:14px; margin-bottom:16px; background:var(--surface-2); border:1px solid var(--border); border-radius:12px; }
.support-description { padding:16px; margin-bottom:18px; background:var(--surface-2); border-left:4px solid var(--primary); border-radius:10px; }
.support-description h3 { margin-top:0; }
.support-description p, .support-timeline p { white-space:pre-wrap; overflow-wrap:anywhere; }
.support-timeline { display:grid; gap:12px; margin:12px 0 20px; }
.support-timeline article { padding:14px 16px; border:1px solid var(--border); border-radius:12px; background:var(--surface); }
.support-timeline article.internal { border-color:#e6b85c; background:#fff8e7; color:#3c3321; }
.support-timeline header { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; }
.support-timeline header small { color:var(--muted); text-align:right; }
.support-timeline a { display:inline-block; margin:4px 12px 0 0; }
.support-reply { margin-top:20px; padding-top:18px; border-top:1px solid var(--border); }
.support-reply textarea { width:100%; margin-bottom:10px; }
.support-priority-critical { color:var(--danger); font-weight:800; }
.support-priority-high { color:#b56a00; font-weight:700; }
@media (max-width:900px) { .support-workspace { grid-template-columns:1fr; } .support-summary-panel { position:static; } .support-platform-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:560px) { .support-kpis, .support-platform-kpis { grid-template-columns:1fr; } .support-timeline header { flex-direction:column; } .support-timeline header small { text-align:left; } }
/* PatientBill-inspired invoice and receipt */
.patient-bill-print{display:none}
.patient-bill-receipt{max-width:900px;color:var(--text)}
.patient-bill-brand{display:grid;grid-template-columns:76px 1fr;align-items:center;gap:16px;padding:8px 12px 14px;border-bottom:4px solid var(--primary);text-align:center}
.patient-bill-brand img{width:68px;height:68px;object-fit:contain}
.patient-bill-brand.no-logo{grid-template-columns:1fr}
.patient-bill-brand.no-logo>div{width:100%;text-align:center}
.patient-bill-receipt .patient-bill-brand:not(.no-logo){grid-template-columns:140px minmax(0,1fr)}
.patient-bill-receipt .patient-bill-brand img{width:140px;height:125px;object-fit:contain}
.patient-bill-brand h1{margin:0;color:var(--primary);font-size:25px;letter-spacing:.02em}
.patient-bill-brand p{margin:4px 0;color:var(--text-2)}
.patient-bill-brand small{color:var(--accent-700);font-weight:700}
.patient-bill-title{margin:8px 0 12px;padding:6px 12px;background:var(--primary);color:#fff;text-align:center;font-size:15px;font-weight:800;letter-spacing:.04em}
.patient-bill-trace{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:-4px 0 10px;padding:6px 9px;border:1px solid var(--line);background:var(--surface-2)}
.patient-bill-trace>div:first-child span,.patient-bill-trace>div:first-child small{display:block;color:var(--muted);font-size:9px}.patient-bill-trace>div:first-child b{display:block;margin:2px 0;font-size:12px}
.patient-bill-trace-codes{display:flex;align-items:flex-end;gap:10px;text-align:center}.patient-bill-trace-codes>div{display:grid;justify-items:center}.patient-bill-trace-codes small{display:block;margin-top:1px;color:var(--muted);font-size:7px;line-height:1}
.patient-bill-barcode{display:block;width:170px;height:30px;object-fit:fill;image-rendering:auto}.patient-bill-qr{display:block;width:60px;height:60px;object-fit:contain}
.patient-bill-details{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;border:1px solid var(--line);border-bottom:0}
.patient-bill-details>div{min-height:48px;padding:8px 10px;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}
.patient-bill-details>div:nth-child(4n){border-right:0}
.patient-bill-details .wide{grid-column:span 2}
.patient-bill-details span{display:block;color:var(--muted);font-size:10px;font-weight:700;margin-bottom:3px}
.patient-bill-details b{display:block;font-size:12px;overflow-wrap:anywhere}
.patient-bill-tests{width:100%;margin-top:12px;border-collapse:collapse}
.patient-bill-tests th{background:var(--primary)!important;color:#fff!important;font-size:10px;text-transform:uppercase;letter-spacing:.04em}
.patient-bill-tests th,.patient-bill-tests td{padding:7px 9px;border:1px solid var(--line)}
.patient-bill-tests th:first-child,.patient-bill-tests td:first-child{width:42px;text-align:center}
.patient-bill-tests th:last-child,.patient-bill-tests td:last-child{width:112px;text-align:right}
.patient-bill-tests td:nth-last-child(2){width:175px}
.patient-bill-tests small{display:block;color:var(--muted);font-size:9px;margin-top:2px}
.patient-bill-summary{width:min(330px,100%);margin:0 0 12px auto;border:1px solid var(--line);border-top:0}
.patient-bill-summary>div{display:flex;justify-content:space-between;gap:20px;padding:5px 10px;border-bottom:1px solid var(--line)}
.patient-bill-summary>div:last-child{border-bottom:0}
.patient-bill-summary .due{background:var(--surface-3);font-size:13px}
.patient-bill-payment,.patient-bill-remarks{padding:8px 10px;border:1px solid var(--line);margin:8px 0}
.patient-bill-notice{margin:14px 0 0;font-size:9px;color:var(--muted);text-align:justify}
.patient-bill-center{padding:10px 12px;border-left:4px solid var(--primary);background:var(--surface-2);font-size:11px;line-height:1.55}
.patient-bill-center h3{margin:0 0 4px;color:var(--primary)}
.patient-bill-footer{margin-top:7px;padding-top:9px;border-top:3px solid var(--primary);font-size:9px;color:var(--muted)}
.patient-bill-footer-meta{display:flex;justify-content:space-between;gap:14px;margin-top:8px;color:var(--primary);font-weight:700}
@media(max-width:760px){.patient-bill-details{grid-template-columns:repeat(2,minmax(0,1fr))}.patient-bill-details>div:nth-child(4n){border-right:1px solid var(--line)}.patient-bill-details>div:nth-child(2n){border-right:0}.patient-bill-details .wide{grid-column:span 2}.patient-bill-footer-meta{flex-direction:column;gap:3px}}
@media print{
 .print-header.letterhead-space,.case-report-head.letterhead-space,.classic-report-head.letterhead-space,.patient-bill-brand.letterhead-space,.invoice-print-header.letterhead-space{min-height:1.5in!important;box-sizing:border-box!important}
 @page{size:A4;margin:10mm}
 .invoice-screen{display:none!important}
 .patient-bill-print{display:block!important}
 .patient-bill-print,.patient-bill-receipt{width:100%!important;max-width:none!important;margin:0!important;padding:0!important;border:0!important;box-shadow:none!important;color:#111827!important;background:#fff!important}
 .patient-bill-brand{border-bottom-color:#1768b2!important}.patient-bill-brand:not(.no-logo){grid-template-columns:140px minmax(0,1fr)!important}.patient-bill-brand img{width:140px!important;height:125px!important;object-fit:contain!important}.patient-bill-brand h1,.patient-bill-center h3,.patient-bill-footer-meta{color:#1768b2!important}
 .patient-bill-title,.patient-bill-tests th{background:#1768b2!important;color:#fff!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
 .patient-bill-details,.patient-bill-details>div,.patient-bill-tests th,.patient-bill-tests td,.patient-bill-summary,.patient-bill-summary>div,.patient-bill-payment,.patient-bill-remarks,.patient-bill-trace{border-color:#9caabd!important}
 .patient-bill-trace{background:#f4f7fa!important;break-inside:avoid;-webkit-print-color-adjust:exact;print-color-adjust:exact}
 .patient-bill-barcode{display:block!important;width:205px!important;height:30px!important;image-rendering:auto!important}
 .patient-bill-qr{display:block!important;width:70px!important;height:70px!important}
 .patient-bill-details{grid-template-columns:repeat(4,minmax(0,1fr))!important}
 .patient-bill-details>div{min-height:38px;padding:5px 7px}
 .patient-bill-tests{font-size:9px;break-inside:auto}.patient-bill-tests tr{break-inside:avoid}.patient-bill-tests th,.patient-bill-tests td{padding:5px 7px!important}
 .patient-bill-summary>div{padding:4px 8px}.patient-bill-center{background:#f4f7fa!important;border-left-color:#1768b2!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
 .patient-bill-footer{border-top-color:#1768b2!important;break-inside:avoid}
}
/* PatientCaseReport-inspired laboratory report */
.case-report-department{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;padding:9px 12px;margin-bottom:5px;border-bottom:2px solid var(--primary);color:var(--text)}
.case-report-department>b{font-size:13px;color:var(--primary)}
.case-report-department>div{display:grid;gap:3px;text-align:right;color:var(--muted);font-size:10px}
.case-report-results th:nth-child(1){width:28%}.case-report-results th:nth-child(2){width:23%}.case-report-results th:nth-child(3){width:13%}.case-report-results th:nth-child(4){width:16%}
@media print{
 @page{size:A4;margin:9mm 10mm 15mm}
 .case-report-head{display:grid!important;grid-template-columns:64px minmax(0,1fr) auto!important;gap:12px!important;align-items:center!important;padding:0 0 7px!important;margin:0 0 7px!important;border-bottom:3px solid #1768b2!important;text-align:left!important}
 .case-report-head .print-logo{width:58px!important;height:54px!important;margin:0!important}
 .case-report-identity{text-align:center}.case-report-identity h1{margin:0!important;font-size:18px!important;color:#1768b2!important}.case-report-identity p{margin:2px 0!important;font-size:8px!important}.case-report-identity>div{display:flex;justify-content:center;gap:12px;font-size:7.5px;color:#526170}
 .case-report-head .report-identifiers{display:flex!important;align-items:end!important;gap:7px!important}.case-report-head .report-code{display:grid;justify-items:center;gap:2px}.case-report-head .report-barcode{width:100px!important;height:30px!important}.case-report-head .report-qr{width:34px!important;height:34px!important}
 .patient-print-summary{border:1px solid #9caabd!important;margin-bottom:7px!important;padding:0!important}
 .patient-print-summary .patient-summary{display:grid!important;grid-template-columns:125px minmax(0,1fr)!important;padding:6px 8px!important;gap:10px!important}
 .patient-print-summary .patient-summary>div:nth-child(2){border-right:1px solid #cbd5e1;padding-right:9px}.patient-print-summary h2{font-size:10px!important}.patient-print-summary a{font-size:8px!important}
 .legacy-patient-grid .meta{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:4px 10px!important}.legacy-patient-grid .meta>div{font-size:7.5px!important}.legacy-patient-grid .meta b{font-size:8.5px!important}
 .standard-report>.panel>.panel-header,.comparative-report>.panel>.panel-header{display:none!important}
 .case-report-department{display:flex!important;justify-content:space-between!important;padding:5px 0!important;margin:0 0 3px!important;border-bottom:1.5px solid #1768b2!important}.case-report-department>b{color:#1768b2!important;font-size:10px!important}.case-report-department>div{font-size:7.5px!important;line-height:1.2!important}
 .test-report-title{padding:4px 0!important;border-bottom:1px solid #222!important;font-size:9.5px!important}
 .dynamic-report-section h3{margin:3px 0!important;padding:3px 5px!important;background:#eaf4fb!important;color:#174d78!important;font-size:8px!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
 .case-report-results{width:100%!important;font-size:8px!important;line-height:1.15!important}.case-report-results th{background:#edf3f8!important;color:#1f2937!important;border-top:1px solid #91a4b8!important;border-bottom:1px solid #91a4b8!important;font-size:7.2px!important;text-transform:none!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}.case-report-results th,.case-report-results td{padding:3.5px 5px!important}.case-report-results td:nth-child(4){font-weight:800}.case-report-results tr{break-inside:avoid!important}
 .test-report-block{margin-bottom:8px!important}.test-report-block>small{font-size:7px!important}.report-remark{border-left:3px solid #1768b2!important;background:#f4f7fa!important}
 .report-final-footer{border-top:1px solid #1768b2!important;padding-top:3px!important}.signatory-grid{grid-template-columns:repeat(5,minmax(0,1fr))!important}.signatory-grid article{font-size:6.8px!important}.signatory-grid img{height:22px!important}.report-disclaimer{font-size:6px!important}
}
.report-patient-identifiers{display:none}
@media print{.patient-print-summary .patient-summary{grid-template-columns:115px minmax(0,1fr) 150px!important;align-items:center!important}.report-patient-identifiers{display:flex!important;justify-content:flex-end;align-items:flex-end;gap:8px;padding-left:9px;border-left:1px solid #cbd5e1}.report-patient-identifiers .report-code{display:grid;justify-items:center;gap:2px}.report-patient-identifiers .report-barcode{width:96px!important;height:29px!important}.report-patient-identifiers .report-qr{width:38px!important;height:38px!important}.report-patient-identifiers small{font-size:6.5px!important;white-space:nowrap}}

@media print{.patient-print-summary{position:relative!important;overflow:visible!important;border:0!important;border-radius:12px!important;box-shadow:none!important;break-inside:avoid!important;page-break-inside:avoid!important}.patient-print-summary::after{content:"";position:absolute;inset:0;border:1px solid #9caabd;border-radius:12px;pointer-events:none;z-index:10}.patient-print-summary .patient-summary{border:0!important;border-radius:12px!important;overflow:hidden!important}}

/* Report print legibility increase */
@media print{
 .case-report-identity h1{font-size:20px!important}.case-report-identity p{font-size:9px!important}.case-report-identity>div{font-size:8.5px!important}
 .legacy-patient-grid .meta>div{font-size:8.5px!important;line-height:1.25!important}.legacy-patient-grid .meta b{font-size:9.5px!important}.patient-print-summary h2{font-size:11px!important}.patient-print-summary a{font-size:9px!important}
 .case-report-department>b{font-size:11.5px!important}.case-report-department>div{font-size:8.5px!important;line-height:1.3!important}
 .test-report-title{font-size:11px!important}.dynamic-report-section h3{font-size:9.5px!important}
 .case-report-results{font-size:9.5px!important;line-height:1.3!important}.case-report-results th{font-size:8.5px!important;line-height:1.25!important}.case-report-results th,.case-report-results td{padding:5px 6px!important}
 .test-report-block>small,.comparison-note{font-size:8.25px!important;line-height:1.3!important}.report-remark,.test-report-block .alert{font-size:9px!important;line-height:1.35!important;padding:5px 7px!important}
 .badge,.status-badge{font-size:8px!important}.signatory-grid article{font-size:7.8px!important;line-height:1.2!important}.report-disclaimer{font-size:7px!important;line-height:1.25!important}
 .report-patient-identifiers small{font-size:7.25px!important}
}

.support-client-modal{width:min(920px,94vw);max-height:92vh}
.support-ticket-state{display:flex;align-items:center;gap:14px;padding:10px 0;color:var(--muted)}
.support-conversation{display:flex;flex-direction:column;gap:10px;max-height:320px;overflow-y:auto;padding:8px 2px 12px}
.support-conversation article{border:1px solid var(--border);border-radius:12px;padding:12px 14px;background:var(--surface)}
.support-conversation article.internal{border-color:#e6c36a;background:#fff8df}
.support-conversation article header{display:flex;justify-content:space-between;gap:12px;margin-bottom:6px}
.support-conversation article p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0 0 6px}
.support-message-author{display:grid;gap:1px;min-width:0}
.support-message-author span{color:var(--muted);font-size:11px;font-weight:400;line-height:1.25}
.support-reply-composer{margin-top:14px;padding:14px;border:1px solid var(--border);border-radius:12px;background:var(--surface-soft)}
.support-reply-composer>label:first-child{font-weight:700;display:block;margin-bottom:6px}
.support-reply-composer textarea{width:100%}
.support-composer-options{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-top:10px;flex-wrap:wrap}
.support-note-toggle{display:flex;align-items:center;gap:8px}
.support-note-toggle input{width:auto}
@media(max-width:700px){.support-conversation article header{display:block}.support-composer-options{display:block}.support-composer-options>label{display:block;margin-top:10px}}
/* Admin support dialog: actions stay at the top while the card remains scrollable. */
.modal-backdrop:has(.support-admin-modal){place-items:center}
.support-admin-modal{max-height:calc(100vh - 48px);overflow:auto}
.support-header-actions{display:flex;align-items:center;gap:10px;flex-shrink:0}
@media(max-width:700px){.support-admin-modal>.panel-header{align-items:flex-start}.support-header-actions{width:100%;justify-content:flex-end}}

/* Standard clinical laboratory report print format */
@media print{
 body,.app-shell,.public-shell,.shared-report-sheet,.patient-print-summary,.standard-report>.panel,.comparative-report>.panel{background:#fff!important;color:#111827!important}
 .report-barcode{display:none!important}
 .case-report-head,.classic-report-head{grid-template-columns:140px minmax(0,1fr) 140px!important;gap:14px!important;align-items:center!important;padding:0 0 10px!important;margin-bottom:10px!important;border-bottom:2px solid #1768b2!important}
 .case-report-head .print-logo,.classic-report-head .print-logo{width:140px!important;height:125px!important;object-fit:contain!important}
 .case-report-head.no-logo{grid-template-columns:1fr!important}
 .case-report-head.no-logo .case-report-identity{grid-column:1!important;width:100%!important;text-align:center!important}
 .classic-report-head.no-logo{grid-template-columns:140px minmax(0,1fr) 140px!important}
 .classic-report-head.no-logo .classic-lab-identity{grid-column:2!important;text-align:center!important}
 .classic-report-head.no-logo .report-identifiers{grid-column:3!important}
 .case-report-identity,.classic-lab-identity{text-align:center!important}
 .case-report-identity h1,.classic-lab-identity h1{font-size:21px!important;line-height:1.15!important;color:#1768b2!important;margin:0 0 4px!important;font-weight:800!important}
 .case-report-identity p,.classic-lab-identity .report-contact{font-size:9.5px!important;line-height:1.35!important;justify-content:center!important;margin:0!important;color:#374151!important}
 .report-identifiers,.report-patient-identifiers{display:flex!important;justify-content:center!important;align-items:center!important;border:0!important;padding:0!important;width:100%!important}
 .report-identifiers .report-qr{width:58px!important;height:58px!important}
 .report-patient-identifiers .report-qr{width:84px!important;height:84px!important}
 .report-identifiers small,.report-patient-identifiers small{font-size:8px!important;color:#374151!important;margin-top:3px!important}
 .patient-print-summary{border:1px solid #9caabd!important;border-radius:5px!important;margin:0 0 12px!important;box-shadow:none!important}
 .patient-print-summary::after{display:none!important}
 .patient-print-summary .patient-summary{grid-template-columns:115px minmax(0,1fr) 110px!important;gap:6px!important;padding:6px!important;border-radius:5px!important}
 .patient-print-summary .patient-summary>div:nth-child(2){border-right:1px solid #cbd5e1!important;padding-right:11px!important}
 .patient-print-summary h2{font-size:12.5px!important;line-height:1.25!important;margin-bottom:3px!important}
 .patient-print-summary a,.patient-print-summary>div span{font-size:10px!important}
 .legacy-patient-grid .meta{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:7px 14px!important}
 .legacy-patient-grid .meta>div{font-size:9.5px!important;line-height:1.3!important;color:#526170!important}
 .legacy-patient-grid .meta b{font-size:10.5px!important;line-height:1.3!important;color:#111827!important;margin-top:1px!important}
 .case-report-department{padding:7px 0!important;margin-bottom:4px!important;border-bottom:1.5px solid #1768b2!important}
 .case-report-department>b{font-size:12px!important}.case-report-department>div{font-size:9px!important;line-height:1.35!important}
 .test-report-title{font-size:12px!important;padding:6px 0!important;border-bottom:1px solid #475569!important}
 .test-report-title .badge,.test-report-title .status-badge{display:none!important}
 .dynamic-report-section h3{font-size:10.5px!important;padding:5px 7px!important;margin:5px 0 0!important;background:#eef4f8!important;color:#174d78!important}
 .case-report-results,.shared-report-sheet table{width:100%!important;font-size:10.5px!important;line-height:1.35!important;color:#111827!important}
 .case-report-results th,.shared-report-sheet table th{font-size:9.5px!important;line-height:1.3!important;padding:6px 7px!important;background:#eef3f7!important;color:#1f2937!important;border-top:1px solid #91a4b8!important;border-bottom:1px solid #91a4b8!important}
 .case-report-results td,.shared-report-sheet table td{font-size:12px!important;line-height:1.35!important;padding:6px 7px!important;border-bottom:1px solid #d8e0e8!important}
 .test-report-block>small,.comparison-note,.shared-report-sheet .panel-body>small{font-size:9px!important;line-height:1.4!important}
 .report-remark,.test-report-block .alert{font-size:10px!important;line-height:1.4!important;padding:7px 9px!important}
 .report-final-footer{margin-top:34px!important;padding-top:7px!important;border-top:1px solid #1768b2!important}
 .signatory-grid article{font-size:8.8px!important;line-height:1.3!important;min-height:82px!important}.signatory-grid img{height:32px!important}
 .report-disclaimer{font-size:8.5px!important;line-height:1.35!important}
 .shared-report-sheet{width:100%!important;max-width:none!important;padding:0!important;margin:0!important}
 .shared-report-sheet>.print-header{padding:0!important;margin-bottom:10px!important}
 .shared-report-sheet .test-report-block{border:0!important;box-shadow:none!important}
 .shared-report-sheet .test-report-block>.panel-header{padding:7px 0!important;border-bottom:1.5px solid #1768b2!important;background:#fff!important}
 .shared-report-sheet .test-report-block>.panel-header h2{font-size:12.5px!important;color:#174d78!important}
}
.support-subject-cell{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.support-unread-badge{display:inline-flex;align-items:center;padding:3px 8px;border-radius:999px;background:#1768b2;color:#fff;font-size:10px;font-weight:800;line-height:1.2;white-space:nowrap;box-shadow:0 0 0 3px rgba(23,104,178,.12)}
/* Pure white laboratory result headings for print. */
@media print{
 .dynamic-report-section h3,
 .case-report-results thead,
 .case-report-results thead tr,
 .case-report-results thead th,
 .shared-report-sheet table thead,
 .shared-report-sheet table thead tr,
 .shared-report-sheet table thead th{
  background:#fff!important;
  background-color:#fff!important;
  background-image:none!important;
  color:#111827!important;
  box-shadow:none!important;
 }
 .dynamic-report-section h3,
 .case-report-results thead th,
 .shared-report-sheet table thead th{
  border-top:1px solid #64748b!important;
  border-bottom:1px solid #64748b!important;
 }
}

.test-result-heading{display:flex;justify-content:space-between;align-items:stretch;gap:14px;margin-bottom:7px}
.test-result-heading-copy{display:flex;flex-direction:column;justify-content:center;min-width:0}
.test-result-heading-copy>b{font-size:14px;color:var(--text)}
.test-result-heading-copy>small{margin-top:3px;color:var(--muted);font-size:9px}
.test-result-ticket{display:grid;grid-template-columns:170px;justify-items:center;align-content:start;margin-right:10px;border:1px solid var(--text);background:#fff;color:#111;font-size:7px;line-height:1.1}
.test-result-ticket>b{width:100%;padding:3px 5px;border-bottom:1px solid var(--text);background:var(--surface-3);text-align:center;font-size:10px}
.test-result-ticket .report-barcode{width:164px;height:44px;margin:4px 3px 1px;object-fit:fill}
.test-result-ticket .test-barcode-value{display:block;width:100%;overflow:hidden;padding:1px 4px 0;text-align:center;font-size:6px;line-height:1;white-space:nowrap}
.test-result-ticket small{padding:0 3px 2px;white-space:nowrap}
.report-page-frame{display:block;width:100%;border:0;border-spacing:0}
.report-page-frame>thead,.report-page-frame>tfoot{display:none}
.report-page-frame>tbody,.report-page-frame>tbody>tr,.report-page-frame>tbody>tr>td{display:block;width:100%}
@media print{
 @page test-report-page{size:A4;margin:7mm 10mm}
 .report-overview-header,.report-overview-patient,.report-overview-footer{display:none!important}
 .report-page-frame{display:table!important;width:100%!important;height:283mm!important;page:test-report-page;border-collapse:collapse!important;break-after:page!important;page-break-after:always!important}
 .report-page-frame:last-of-type{break-after:auto!important;page-break-after:auto!important}
 .report-page-frame>thead{display:table-header-group!important}
 .report-page-frame>tbody{display:table-row-group!important}
 .report-page-frame>tfoot{display:table-footer-group!important}
 .report-page-frame>thead>tr,.report-page-frame>tbody>tr,.report-page-frame>tfoot>tr{display:table-row!important}
 .report-page-frame>thead>tr>td,.report-page-frame>tbody>tr>td,.report-page-frame>tfoot>tr>td{display:table-cell!important;width:100%!important;padding:0!important;border:0!important;vertical-align:top!important}
 .report-page-frame>tbody>tr>td{height:100%!important}
 .report-page-header{break-inside:avoid!important;page-break-inside:avoid!important}
 .report-page-header .case-report-head{display:grid!important;margin:0 0 7px!important}
 .report-page-header .patient-print-summary{display:block!important;margin:0 0 8px!important}
 .report-page-frame .report-final-footer{display:block!important;margin:8px 0 0!important;padding-top:0!important;border-top:0!important;break-inside:avoid!important;page-break-inside:avoid!important}
 .report-page-frame .report-footer-meta{margin-bottom:4px!important}
 .report-page-frame .report-disclaimer{margin:0!important;padding:2px 0 0!important;border-top:0!important;text-align:left!important}
 .report-page-frame .signatory-grid{padding-top:5px!important;border-top:1px solid #1768b2!important}
 .test-report-block{margin-bottom:12px!important;break-inside:auto!important;page-break-inside:auto!important}
 .test-report-block+.test-report-block{padding-top:8px!important;border-top:1px solid #1768b2!important;break-before:auto!important;page-break-before:auto!important}
 .test-result-heading{min-height:64px!important;margin:0 0 5px!important;break-inside:avoid!important;page-break-inside:avoid!important;break-after:avoid!important;page-break-after:avoid!important}
 .test-result-heading-copy>b{font-size:13px!important;color:#111!important}
 .test-result-heading-copy>small{font-size:9px!important;color:#374151!important}
 .test-result-ticket{grid-template-columns:160px!important;border-color:#111!important}
 .test-result-ticket>b{padding:2px 4px!important;background:#d1d1d1!important;color:#111!important;font-size:9px!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
 .test-result-ticket .report-barcode{display:block!important;width:126px!important;height:30px!important;margin:3px auto 1px!important;object-fit:fill!important;image-rendering:crisp-edges!important}
 .test-result-ticket .test-barcode-value{font-size:5.5px!important;padding:1px 4px 0!important}
 .test-result-ticket small{font-size:6.5px!important;padding-bottom:3px!important}
 .case-report-results{border-collapse:collapse!important}
 .case-report-results thead{display:table-header-group!important;border-top:2px solid #111!important}
 .case-report-results tr{break-inside:avoid!important;page-break-inside:avoid!important}
 .case-report-results th{padding:4px 5px!important;border-top:2px solid #111!important;border-bottom:0!important;border-left:0!important;border-right:0!important;box-shadow:inset 0 -2px #111!important;background:#c8c8c8!important;color:#111!important;text-transform:uppercase!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
 .case-report-results td{padding:4px 5px!important;border:0!important;border-bottom:1px solid #9ca3af!important;color:#111!important}
 .case-report-results tbody tr:first-child td{border-top:2px solid #111!important}
 .case-report-results tbody tr td{background:#fff!important}
 .case-report-results tbody tr.abnormal-result td{background:#ddd!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
 .case-report-results td:first-child{font-weight:700!important}
 .case-report-results .report-flag-column{display:table-cell!important}
 .dynamic-report-section h3{background:#fff!important;color:#111!important;border-bottom:1px solid #111!important;padding:3px 1px!important}
}

.report-interpretation{margin:8px 0 6px;padding-top:6px;border-top:1px solid var(--border);font-size:10px;line-height:1.45;color:var(--text)}
.report-interpretation>b{display:block;margin-bottom:3px;text-decoration:underline}
.report-interpretation>div{white-space:pre-wrap;overflow-wrap:anywhere}
.subscription-pay-to{margin:0 0 20px;padding:18px;border:1px solid #b9d4f2;border-radius:14px;background:linear-gradient(135deg,#f4f9ff 0%,#e9f4ff 100%)}
.subscription-pay-to-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin-bottom:14px}
.subscription-pay-to-heading small{display:block;margin-bottom:3px;color:#1768b2;font-size:10px;font-weight:800;letter-spacing:.12em}
.subscription-pay-to-heading h3{margin:0;color:#12395f;font-size:18px}
.subscription-pay-to-heading>span{color:#597089;font-size:12px;text-align:right}
.subscription-bank-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}
.subscription-bank-card{padding:14px 16px;border:1px solid #cfdeed;border-radius:11px;background:#fff;box-shadow:0 4px 12px rgba(16,57,96,.06)}
.subscription-bank-name{display:flex;align-items:center;gap:9px;margin-bottom:11px;color:#0e5ca8;font-size:14px}
.subscription-bank-name>span{display:grid;width:28px;height:28px;place-items:center;border-radius:8px;background:#e5f2ff;color:#1768b2}
.subscription-bank-card dl{display:grid;gap:7px;margin:0}
.subscription-bank-card dl>div{display:grid;grid-template-columns:95px minmax(0,1fr);gap:8px}
.subscription-bank-card dt{color:#6b7f93;font-size:11px}
.subscription-bank-card dd{margin:0;color:#1e344a;font-size:12px;font-weight:650;overflow-wrap:anywhere}
@media(max-width:700px){.subscription-pay-to-heading{align-items:flex-start;flex-direction:column}.subscription-pay-to-heading>span{text-align:left}.subscription-bank-grid{grid-template-columns:1fr}}
