:root {
    --app-primary: #0b1f3b;
    --app-primary-2: #12325a;
    --app-primary-3: #1b4a7a;
    --app-accent: #0d6efd;
    --app-success: #16a34a;
    --app-warning: #f59e0b;
    --app-danger: #dc2626;
    --app-bg: #f4f7fb;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fafc;
    --app-border: #e2e8f0;
    --app-muted: #64748b;
    --app-text: #0f172a;
    --sidebar-width: 284px;
    --topbar-height: 76px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --shadow-sm: 0 8px 22px rgba(15, 23, 42, .06);
    --shadow-md: 0 18px 45px rgba(15, 23, 42, .10);
}

* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

body {
    min-height: 100vh;
    background: var(--app-bg);
    color: var(--app-text);
    font-size: .95rem;
}

body.app-shell-body {
    overflow-x: hidden;
}

a {
    color: var(--app-primary-3);
}

a:hover {
    color: var(--app-primary);
}

.min-w-0 {
    min-width: 0;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    height: 100vh;
    max-height: 100vh;
    padding: 22px 18px;
    background:
        radial-gradient(circle at top left, rgba(13, 110, 253, .18), transparent 20rem),
        linear-gradient(180deg, var(--app-primary), #071629 78%);
    color: #fff;
    z-index: 1030;
    box-shadow: 18px 0 45px rgba(15, 23, 42, .18);
    overflow: hidden;
}

.app-main {
    min-width: 0;
    flex: 1;
    margin-left: var(--sidebar-width);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    padding: 8px 10px 20px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    flex: 0 0 auto;
}

.sidebar-brand:hover {
    color: #fff;
}

.sidebar-brand-mark,
.brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffffff, #dbeafe);
    color: var(--app-primary);
    font-weight: 900;
    font-size: 1.35rem;
    box-shadow: 0 12px 30px rgba(13, 110, 253, .22);
}

.sidebar-brand-title {
    display: block;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.02em;
}

.sidebar-brand-subtitle {
    display: block;
    color: rgba(255, 255, 255, .68);
    font-size: .78rem;
    margin-top: 3px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
    padding-right: 4px;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

.sidebar-nav::-webkit-scrollbar {
    width: 7px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .26);
    border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .40);
}


.sidebar-section-label {
    margin: 14px 12px 6px;
    color: rgba(255, 255, 255, .46);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .10em;
    text-transform: uppercase;
}

.sidebar-section-label:first-child {
    margin-top: 4px;
}

.app-progress {
    height: .45rem;
    border-radius: 999px;
    background: rgba(13, 110, 253, .10);
}

.app-progress .progress-bar {
    border-radius: 999px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, .76);
    text-decoration: none;
    padding: 12px 13px;
    border-radius: 15px;
    font-weight: 650;
    transition: .18s ease;
}

.sidebar-link i {
    width: 22px;
    font-size: 1.08rem;
    opacity: .95;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, .09);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-link.active {
    background: #fff;
    color: var(--app-primary);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .16);
}

.sidebar-footer {
    padding: 18px 6px 4px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    flex: 0 0 auto;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .10);
}

.avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e0efff;
    color: var(--app-primary);
    font-weight: 850;
    flex: 0 0 auto;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: .78rem;
}

.sidebar-user-name {
    color: #fff;
    font-weight: 750;
    line-height: 1.1;
}

.sidebar-user-role {
    color: rgba(255, 255, 255, .64);
    font-size: .78rem;
    margin-top: 3px;
    text-transform: capitalize;
}

.btn-sidebar-logout {
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .14);
    color: #fff;
    border-radius: 14px;
    font-weight: 650;
}

.btn-sidebar-logout:hover {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.app-topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 30px;
    background: rgba(244, 247, 251, .82);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, .82);
    z-index: 1010;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--app-text);
    line-height: 1.1;
}

.topbar-subtitle {
    color: var(--app-muted);
    font-size: .82rem;
    margin-top: 2px;
}

.topbar-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    padding: 5px 12px 5px 5px;
    color: #334155;
    font-weight: 650;
    max-width: 260px;
    box-shadow: var(--shadow-sm);
}

.app-content {
    padding: 30px;
}

.app-alert {
    border: 0;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.mobile-sidebar {
    --bs-offcanvas-width: 292px;
    background:
        radial-gradient(circle at top left, rgba(13, 110, 253, .18), transparent 18rem),
        linear-gradient(180deg, var(--app-primary), #071629 78%);
    color: #fff;
}

.mobile-sidebar .offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    flex: 0 0 auto;
}

.mobile-sidebar .offcanvas-body {
    min-height: 0;
    overflow: hidden;
}

.mobile-sidebar .sidebar-nav {
    max-height: none;
}

/* Bootstrap refinement */
.card {
    border-radius: var(--radius-lg);
    border-color: var(--app-border) !important;
    box-shadow: var(--shadow-sm) !important;
}

.card-header {
    border-bottom: 1px solid var(--app-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    padding: 1rem 1.25rem;
}

.card-body {
    border-radius: inherit;
}

.btn {
    border-radius: 12px;
    font-weight: 650;
}

.btn-sm {
    border-radius: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-2));
    border-color: var(--app-primary);
    box-shadow: 0 10px 22px rgba(11, 31, 59, .16);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #071629, var(--app-primary));
    border-color: #071629;
}

.btn-outline-primary {
    color: var(--app-primary);
    border-color: #b8c7dc;
}

.btn-outline-primary:hover {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-outline-secondary {
    border-color: #cbd5e1;
    color: #475569;
}

.form-control,
.form-select,
.input-group-text {
    border-color: #dbe3ef;
    border-radius: 12px;
}

.input-group > .form-control,
.input-group > .form-select,
.input-group > .input-group-text {
    border-radius: 12px;
}

.form-control:focus,
.form-select:focus {
    border-color: #93b5fd;
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .10);
}

.form-label {
    color: #334155;
    font-weight: 700;
    font-size: .86rem;
}

.badge {
    font-weight: 700;
    letter-spacing: .01em;
}

.table-responsive {
    border-radius: var(--radius-md);
}

.table {
    --bs-table-bg: #fff;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: .95rem 1rem;
    border-bottom-color: #edf2f7;
}

.table thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--app-border);
    white-space: nowrap;
}

.table-hover tbody tr:hover {
    --bs-table-hover-bg: #f8fbff;
}

.table-bordered {
    border-color: var(--app-border);
}

.display-6,
.h1,
.h2,
.h3,
.h4,
.h5,
h1,
h2,
h3,
h4,
h5 {
    letter-spacing: -.025em;
}

.text-muted {
    color: var(--app-muted) !important;
}

.metric-card {
    min-height: 132px;
    overflow: hidden;
    position: relative;
}

.metric-card::after {
    content: "";
    position: absolute;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    right: -22px;
    top: -28px;
    background: rgba(13, 110, 253, .10);
}

.metric-card .card-body {
    position: relative;
    z-index: 1;
}

.module-pill {
    position: relative;
    min-height: 92px;
    display: block;
    background: #fff;
    border: 1px solid var(--app-border);
    padding: 1rem;
    border-radius: 18px;
    font-weight: 750;
    color: #334155;
    box-shadow: var(--shadow-sm);
    transition: .18s ease;
}

.module-pill:hover {
    border-color: #b8c7dc;
    background: #ffffff;
    color: var(--app-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.detail-label {
    font-size: .74rem;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: .06em;
    font-weight: 800;
    margin-bottom: .25rem;
}

.detail-value {
    font-weight: 700;
    color: #111827;
}

.text-preline {
    white-space: pre-line;
}

.list-group-item {
    border-color: var(--app-border);
}

.alert-info {
    background: #eff6ff;
    color: #1e3a8a;
}

.alert-success {
    background: #ecfdf5;
    color: #166534;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
}

/* Auth page */
.auth-body {
    background:
        radial-gradient(circle at 90% 10%, rgba(13, 110, 253, .12), transparent 24rem),
        linear-gradient(135deg, #f8fafc, #eef4fb);
}

.auth-page {
    min-height: 100vh;
}

.auth-hero-panel {
    min-height: 100vh;
    align-items: center;
    padding: 64px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 15%, rgba(96, 165, 250, .28), transparent 24rem),
        linear-gradient(145deg, var(--app-primary), #071629 78%);
}

.auth-hero-content {
    max-width: 680px;
}

.auth-hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .14);
    color: rgba(255, 255, 255, .86);
    font-weight: 700;
    margin-bottom: 28px;
}

.auth-hero-content h1 {
    font-weight: 900;
    font-size: clamp(2.4rem, 4vw, 4.5rem);
    line-height: .96;
    margin-bottom: 22px;
    letter-spacing: -.055em;
}

.auth-hero-content p {
    max-width: 560px;
    color: rgba(255, 255, 255, .72);
    font-size: 1.08rem;
    line-height: 1.7;
}

.auth-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 34px;
    max-width: 520px;
}

.auth-feature-grid div {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .11);
    font-weight: 750;
}

.auth-feature-grid i {
    font-size: 1.1rem;
    color: #bfdbfe;
}

.auth-card {
    max-width: 460px;
    padding: 38px;
    border-radius: 28px;
    background: rgba(255, 255, 255, .90);
    border: 1px solid rgba(226, 232, 240, .92);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
}

.auth-form .input-group-text {
    background: #f8fafc;
    color: #64748b;
}

.auth-note {
    display: flex;
    align-items: flex-start;
    padding: 13px 14px;
    border-radius: 15px;
    background: #f8fafc;
    color: #64748b;
    font-size: .88rem;
}

/* Useful page-level polish without changing every view */
.d-flex.justify-content-between.align-items-center.mb-4 > div > .h3,
.d-flex.justify-content-between.align-items-center.mb-4 > div > h1 {
    font-weight: 850 !important;
}

.d-flex.justify-content-between.align-items-center.mb-4 {
    gap: 16px;
}

@media (max-width: 991.98px) {
    .app-main {
        margin-left: 0;
    }

    .app-topbar {
        height: auto;
        min-height: 70px;
        padding: 14px 16px;
    }

    .app-content {
        padding: 18px 14px 26px;
    }

    .topbar-subtitle {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        align-items: stretch !important;
    }

    .d-flex.justify-content-between.align-items-center.mb-4 > .d-flex,
    .d-flex.justify-content-between.align-items-center.mb-4 > a,
    .d-flex.justify-content-between.align-items-center.mb-4 > div:last-child {
        width: 100%;
    }

    .d-flex.justify-content-between.align-items-center.mb-4 .btn {
        width: 100%;
    }

    .auth-card {
        padding: 26px;
        border-radius: 22px;
    }
}

.metric-icon,
.import-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e0efff;
    color: var(--app-primary);
    font-size: 1.25rem;
    flex: 0 0 auto;
}

.import-card {
    transition: transform .18s ease, box-shadow .18s ease;
}

.import-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) !important;
}

.import-card code {
    color: #0f4c81;
    background: #eef6ff;
    padding: .08rem .28rem;
    border-radius: .35rem;
}

.profile-avatar-xl {
    width: 76px;
    height: 76px;
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f4c81, #1d72b8);
    color: #fff;
    font-weight: 850;
    font-size: 1.55rem;
    box-shadow: 0 14px 30px rgba(15, 76, 129, .22);
}

.topbar-user-chip:hover {
    color: var(--app-primary);
    border-color: rgba(15, 76, 129, .18);
    background: #f7fbff;
}

/* Dashboard finance section */
.finance-card::after {
    background: rgba(22, 163, 74, .10);
}

.finance-icon {
    background: #eafaf0;
    color: #166534;
}

.mini-finance-card {
    background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.mini-finance-card .card-body {
    padding: 1.15rem 1.2rem;
}

/* Patient picker on sample creation */
.patient-picker {
    background: linear-gradient(180deg, #ffffff, #f8fbff) !important;
    border-color: #dbe7f5 !important;
}

.patient-mode-toggle .btn {
    white-space: nowrap;
}

.patient-last-info {
    min-height: 52px;
    padding: .85rem 1rem;
    border-radius: 14px;
    background: #fff;
    border: 1px dashed #cbd5e1;
    line-height: 1.55;
}

/* Multi-test sample creation */
.sample-total-box {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: .375rem .75rem;
    border: 1px solid #dbe7f5;
    border-radius: .75rem;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    color: var(--app-primary);
    font-weight: 800;
}

#selectedTestsTable tbody tr[data-id] td {
    vertical-align: middle;
}

.audit-json-block pre {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    color: #334155;
    font-size: 0.78rem;
    max-height: 220px;
    overflow: auto;
    padding: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* SMS LabTrack branding + mobile-first refinements */
:root {
    --app-teal: #10a7ad;
    --app-orange: #ff7a00;
    --touch-target: 44px;
}

.sidebar-brand-logo {
    width: 50px;
    height: 54px;
    object-fit: contain;
    flex: 0 0 auto;
    filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .18));
}

.sidebar-brand-text {
    min-width: 0;
}

.topbar-mobile-logo {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, .95);
    box-shadow: var(--shadow-sm);
    flex: 0 0 auto;
}

.topbar-mobile-logo img {
    width: 34px;
    height: 36px;
    object-fit: contain;
}

.topbar-menu-button {
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    border-radius: 14px;
    border-color: rgba(226, 232, 240, .95);
    box-shadow: var(--shadow-sm);
}

.topbar-copy {
    min-width: 0;
}

.mobile-primary-action {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: linear-gradient(135deg, var(--app-teal), var(--app-primary-3));
    box-shadow: 0 18px 34px rgba(11, 31, 59, .28);
    z-index: 1020;
    text-decoration: none;
    font-size: 1.35rem;
}

.mobile-primary-action:hover {
    color: #ffffff;
    transform: translateY(-1px);
}

.sidebar-link,
.btn,
.form-control,
.form-select,
.input-group-text {
    min-height: var(--touch-target);
}

.auth-card-logo img {
    width: min(100%, 310px);
    max-height: 150px;
    object-fit: contain;
}

.auth-logo-panel {
    display: inline-flex;
    padding: 18px 24px;
    border-radius: 28px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255, 255, 255, .80);
    box-shadow: 0 22px 50px rgba(0, 0, 0, .18);
}

.auth-logo-panel img {
    width: min(100%, 430px);
    max-height: 190px;
    object-fit: contain;
}

.auth-card-column {
    min-height: 100vh;
}

/* Keep views pleasant on small screens without rewriting every table/form */
@media (max-width: 575.98px) {
    body {
        font-size: .92rem;
    }

    .app-topbar {
        padding: 10px 12px;
        gap: 10px;
        background: rgba(255, 255, 255, .92);
    }

    .topbar-title {
        max-width: 44vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: .95rem;
    }

    .app-content {
        padding: 14px 10px 88px;
    }

    .card {
        border-radius: 18px;
    }

    .card-header,
    .card-body {
        padding: 1rem;
    }

    .table > :not(caption) > * > * {
        padding: .78rem .82rem;
    }

    .table thead th {
        font-size: .68rem;
    }

    .auth-page {
        background: radial-gradient(circle at 90% 0%, rgba(16, 167, 173, .16), transparent 18rem), #f8fafc;
    }

    .auth-card {
        padding: 24px 18px;
        border-radius: 24px;
        box-shadow: 0 18px 42px rgba(15, 23, 42, .10);
    }

    .auth-card-logo img {
        width: min(100%, 275px);
    }

    .input-group-lg > .form-control,
    .input-group-lg > .input-group-text {
        font-size: 1rem;
        padding: .72rem .9rem;
    }
}

@media (min-width: 992px) {
    .sidebar-brand {
        padding-top: 4px;
    }
}

/* Better scrolling behavior on mobile sidebar */
.mobile-sidebar .offcanvas-body {
    overflow-y: auto;
}

.mobile-sidebar .sidebar-brand {
    margin-bottom: 0;
    padding-bottom: 8px;
    border-bottom: 0;
}

/* Searchable test picker on sample creation */
.sample-tests-search-panel {
    background: #ffffff;
}

.test-search-card {
    background: linear-gradient(180deg, rgba(16, 167, 173, .06), rgba(248, 250, 252, .9));
}

.test-search-results {
    display: grid;
    gap: .55rem;
    max-height: 360px;
    overflow-y: auto;
    padding-right: .2rem;
}

.test-result-item {
    width: 100%;
    border: 1px solid rgba(15, 23, 42, .10);
    background: rgba(255, 255, 255, .96);
    border-radius: 16px;
    padding: .8rem .9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    text-align: left;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, background .16s ease;
}

.test-result-item:hover,
.test-result-item:focus {
    border-color: rgba(16, 167, 173, .55);
    box-shadow: 0 12px 26px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
    outline: none;
}

.test-result-item.is-selected {
    border-color: rgba(16, 167, 173, .85);
    background: rgba(16, 167, 173, .08);
}

.test-result-item.is-added {
    opacity: .76;
}

.test-result-main {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: .75rem;
    min-width: 0;
}

.test-result-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: .28rem .48rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: .78rem;
    color: #0b4a6f;
    background: rgba(16, 167, 173, .12);
    border: 1px solid rgba(16, 167, 173, .25);
}

.test-result-name {
    display: block;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.test-result-meta {
    display: block;
    color: #64748b;
    font-size: .83rem;
    margin-top: .15rem;
}

.test-search-empty {
    padding: 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, .9);
    color: #64748b;
    text-align: center;
    border: 1px dashed rgba(100, 116, 139, .35);
}

.selected-test-preview {
    border: 1px solid rgba(16, 167, 173, .25);
    border-radius: 18px;
    padding: .95rem;
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(16, 167, 173, .08);
}

@media (max-width: 575.98px) {
    .test-search-results {
        max-height: 420px;
    }

    .test-result-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .test-result-main {
        grid-template-columns: 1fr;
        gap: .42rem;
        width: 100%;
    }

    .test-result-code {
        min-width: 0;
        width: fit-content;
    }
}

/* Direct add button in test search results */
.test-result-add-btn {
    white-space: nowrap;
    min-width: 154px;
}

.test-result-conditions {
    display: block;
    color: #64748b;
    font-size: .78rem;
    margin-top: .16rem;
    max-width: 760px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .test-result-add-btn {
        width: 100%;
        min-width: 0;
        justify-content: center;
    }

    .test-result-conditions {
        white-space: normal;
    }
}

/* Tableaux larges : barre de défilement accessible en haut + glissement horizontal sur les lignes */
.table-scroll-hint {
    display: none;
    align-items: center;
    gap: .4rem;
    width: fit-content;
    max-width: 100%;
    margin: .25rem 0 .45rem;
    padding: .32rem .62rem;
    border-radius: 999px;
    color: #0b4a6f;
    background: rgba(16, 167, 173, .10);
    border: 1px solid rgba(16, 167, 173, .18);
    font-size: .78rem;
    font-weight: 700;
}

.table-scroll-hint.is-visible {
    display: inline-flex;
}

.table-scroll-top {
    display: none;
    overflow-x: auto;
    overflow-y: hidden;
    height: 14px;
    margin-bottom: .45rem;
    border-radius: 999px;
    background: rgba(226, 232, 240, .55);
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 167, 173, .72) rgba(226, 232, 240, .55);
}

.table-scroll-top.is-visible {
    display: block;
}

.table-scroll-top-inner {
    height: 1px;
}

.table-scroll-top::-webkit-scrollbar,
.enhanced-table-scroll::-webkit-scrollbar {
    height: 11px;
}

.table-scroll-top::-webkit-scrollbar-track,
.enhanced-table-scroll::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, .68);
    border-radius: 999px;
}

.table-scroll-top::-webkit-scrollbar-thumb,
.enhanced-table-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #10a7ad, #0b4a6f);
    border-radius: 999px;
    border: 2px solid rgba(226, 232, 240, .68);
}

.enhanced-table-scroll {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 167, 173, .72) rgba(226, 232, 240, .55);
    cursor: default;
}

.enhanced-table-scroll.has-horizontal-overflow {
    cursor: grab;
}

.enhanced-table-scroll.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.enhanced-table-scroll.has-horizontal-overflow::after {
    content: "";
    position: sticky;
    right: 0;
    top: 0;
    display: block;
    width: 28px;
    height: 1px;
    float: right;
    pointer-events: none;
    box-shadow: -18px 0 20px rgba(15, 23, 42, .10);
}

.enhanced-table-scroll table {
    min-width: max-content;
}

@media (max-width: 767.98px) {
    .table-scroll-hint {
        display: none !important;
    }

    .table-scroll-top {
        display: none !important;
    }

    .enhanced-table-scroll.has-horizontal-overflow {
        border-radius: 16px;
    }
}

/* Report secure WhatsApp sharing */
.whatsapp-share-card textarea[readonly],
.whatsapp-share-card input[readonly] {
    background-color: #f8fafc;
}

.public-report-card {
    max-width: 520px;
}
