﻿@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.status-bar-safe-area {
    display: none;
}

@supports (-webkit-touch-callout: none) {
    .status-bar-safe-area {
        display: flex;
        position: sticky;
        top: 0;
        height: env(safe-area-inset-top);
        background-color: #f7f7f7;
        width: 100%;
        z-index: 1;
    }

    .flex-column, .navbar-brand {
        padding-left: env(safe-area-inset-left);
    }
}

tbody {
    display: block;
    max-height: 700px;
    overflow: auto;
}

    thead, tbody tr {
        display: table;
        width: 100%;
        table-layout: fixed; /* even columns width , fix width of table too*/
    }

thead {
    width: calc( 100% - 1em ) /* scrollbar is average 1em/16px width, remove it from thead width */
}

table {
    width: 400px;
}

.spinner {
    border: 16px solid silver;
    border-top: 16px solid #337AB7;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    animation: spin 700ms linear infinite;
    top: 40%;
    left: 55%;
    position: absolute;
}

@keyframes spin {
    0% {
        transform: rotate(0deg)
    }

    100% {
        transform: rotate(360deg)
    }
}

.clear:after, .pagination:after, .clear:before, .pagination:before {
    content: "";
    display: table;
}

.clear:after, .pagination:after {
    clear: both;
}

.pagination__wrapper {
    background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, white 17%, white 83%, rgba(255, 255, 255, 0) 100%);
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, white 17%, white 83%, rgba(255, 255, 255, 0) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#00ffffff',GradientType=1 );
    height: 50px;
    left: 50%;
    position: absolute;
    text-align: center;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    /*top: 50%;*/
    width: 700px;
    background: transparent;
}

    .pagination__wrapper:before, .pagination__wrapper:after {
        background: -webkit-linear-gradient(left, transparent 0%, rgba(0, 0, 0, 0.1) 17%, rgba(0, 0, 0, 0.1) 83%, transparent 100%);
        background: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.1) 17%, rgba(0, 0, 0, 0.1) 83%, transparent 100%);
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#00000000',GradientType=1 );
        content: "";
        height: 1px;
        left: 0;
        position: absolute;
        width: 100%;
    }

    .pagination__wrapper:before {
        top: -1px;
    }

    .pagination__wrapper:after {
        bottom: -1px;
    }

@-webkit-keyframes hoverAnimation {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes hoverAnimation {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.pagination {
    display: inline-block;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination li {
    display: block;
    float: left;
    padding: 5px;
}

.pagination li:first-child {
    border: none;
}

.pagination button,
.pagination span {
    background: none;
    border: none;
    border-radius: 50%;
    box-sizing: border-box;
    color: rgba(0, 0, 0, 0.6);
    display: block;
    font-size: 16px;
    height: 40px;
    line-height: 40px;
    min-width: 40px;
    padding: 0;
}

.pagination button {
    outline: none;
    position: relative;
    -webkit-transition: all 170ms linear;
    transition: all 170ms linear;
}

.pagination button:before {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    content: "";
    cursor: pointer;
    height: 0;
    left: 50%;
    opacity: 0;
    position: absolute;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    -webkit-transition: all 170ms linear;
    transition: all 170ms linear;
    top: 50%;
    width: 0;
}

.pagination button:hover:not(.active) {
    color: black;
}

.pagination button:hover:not(.active):before {
    -webkit-animation: hoverAnimation 510ms linear forwards;
    animation: hoverAnimation 510ms linear forwards;
    height: 40px;
    width: 40px;
}

.pagination button.active {
    background: rgba(0, 0, 0, 0.1);
    color: black;
}

.pagination .prev,
.pagination .next {
    font-size: 14px;
}

.expand-menu {
    margin-left: 17px;
}

.scroll-container {
    overflow: auto;
    margin-bottom: 40px;
    border-left: 1px solid;
    border-right: 1px solid;
}

.scroll {
    margin: 0;
}

    .scroll td:first-of-type {
        position: sticky;
        left: 0;
        border-left: none;
        background: #f4f4f4;
        color: #212121;
        font-weight: bold;
        &:after

{
    content: "";
    position: absolute;
    top: 0;
    right: -1px;
    height: 100%;
    width: 1px;
    background: #000;
}

}

.scroll td:last-of-type {
    border-right: none;
}

@media screen and (max-width: 600px) 
{
    .responsive thead {
        visibility: hidden;
        height: 0;
        position: absolute;
    }

    .responsive tr {
        display: block;
        margin-bottom: .625em;
    }

    .responsive td {
        border: 1px solid;
        border-bottom: none;
        display: block;
        font-size: .8em;
        text-align: right;
        min-height: 27px;
    }

    .responsive td::before {
        content: attr(data-label);
        float: left;
        font-weight: bold;
        text-transform: uppercase;
    }

    .responsive td:last-child {
        border-bottom: 1px solid;
    }
    .language-option {
        display: block;
    }
}

@media screen and (min-width:600px) {
    /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */
    .language-option{
        display:none;
    }
}

@media only screen and (min-width: 1025px) {
    /*...your desktop-only style...*/
    .col-desktop-250 {
        width: 250px;
    }
    .col-desktop-230 {
        width: 230px;
    }
    .col-desktop-190 {
        width: 190px;
    }
    .col-desktop-100 {
        width: 100px;
    }
    .col-desktop-120 {
        width: 120px;
    }
    .col-desktop-10 {
        width: 10px;
    }
}

.Holiday {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.Holiday:after {
    content: attr(after-text);
}

.tooltiptext {
    position: relative; /* Needed for positioning */
}

.tooltiptext::after {
    content: attr(title); /* Display the title attribute as tooltip text */
    position: absolute;
    top: 10%; /* Position below the content */
    left: 0;
    background-color: #f9f9f9;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap; /* Prevent line breaks */
    visibility: hidden; /* Initially hidden */
}

.tooltiptext:hover::after {
    visibility: visible; /* Show tooltip on hover */
}


.rz-numeric-input.rz-state-disabled.rz-inputtext.rz-text-align-left {
    background-color: #f0f0f0 !important;
    color: #443535 !important;
    border: 1px solid #ccc !important;
}

.rz-dropdown-label.rz-inputtext {
    color: #443535 !important;
}

#PdfViewer {
    width: 100%; /* take full width of modal body */
    height: 70vh; /* 70% of viewport height */
    border: none; /* optional: remove border */
}

@media (min-width: 600px) {
    .modal-dialog {
        max-width: 900px;
        margin: 1.75rem auto;
    }
}

@media (max-width: 600px) {
    .modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }
}

#listImage img {
    width: 100%;
    height: auto;
    margin-bottom: 1px;
}

.rz-dropdown-tree-multi-popup {
    display: none;
    position: absolute;
    overflow: hidden;
    width: 300px;
    border: var(--rz-panel-border);
    background-color: var(--rz-panel-background-color);
    box-shadow: var(--rz-panel-shadow);
    border-radius: var(--rz-border-radius);
}

/* Shared clinical workspace primitives (visits list and visit detail). */
.clinical-workspace,
.visit-dashboard {
    --clinical-accent: #176b87;
    --clinical-accent-dark: #10566e;
    --clinical-accent-soft: #e8f4f7;
    --clinical-border: #dbe4e8;
    --clinical-muted: #61747d;
    --clinical-surface: #fff;
    --clinical-page: #f6f9fa;
    --clinical-shadow: 0 4px 18px rgba(20, 48, 60, .07);
    color: #1d2a31;
}

.clinical-workspace {
    max-width: 1680px;
    margin: 0 auto;
    padding: 0 .75rem 3rem;
}

.clinical-page-heading,
.clinical-heading-title {
    display: flex;
    align-items: center;
}

.clinical-page-heading {
    min-height: 4.5rem;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
}

.clinical-heading-title {
    min-width: 0;
    gap: .75rem;
}

.clinical-page-heading h1 {
    margin: 0;
    font-size: clamp(1.35rem, 2.5vw, 2rem);
    font-weight: 750;
    letter-spacing: -.025em;
}

.clinical-heading-icon {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 2.75rem;
    place-items: center;
    border-radius: .8rem;
    background: var(--clinical-accent-soft);
    color: var(--clinical-accent);
    font-size: 1.15rem;
}

.clinical-heading-meta {
    display: block;
    margin-top: .1rem;
    color: var(--clinical-muted);
    font-size: .82rem;
}

.clinical-primary-action {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding-inline: 1rem;
    white-space: nowrap;
}

.clinical-filter-panel,
.clinical-table-shell,
.clinical-stat-card,
.clinical-empty-state {
    border: 1px solid var(--clinical-border);
    background: var(--clinical-surface);
    box-shadow: var(--clinical-shadow);
}

.clinical-filter-panel {
    margin-bottom: 1rem;
    padding: .75rem;
    border-radius: .85rem;
}

.clinical-search-box {
    position: relative;
    min-width: 0;
}

.clinical-search-box > i {
    position: absolute;
    top: 50%;
    left: .9rem;
    z-index: 2;
    color: #758891;
    transform: translateY(-50%);
    pointer-events: none;
}

.clinical-search-box .form-control {
    min-height: 2.75rem;
    padding-left: 2.55rem;
    border-color: var(--clinical-border);
}

.clinical-workspace :is(input, select, textarea, button, [role="button"]):focus-visible,
.visit-dashboard :is(input, select, textarea, button, a):focus-visible,
.clinical-workspace .rz-dropdown:focus-within,
.visit-dashboard .rz-dropdown:focus-within {
    outline: 3px solid rgba(23, 107, 135, .22);
    outline-offset: 2px;
}

.clinical-stat-card {
    display: flex;
    min-width: min(100%, 15rem);
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    border-radius: .75rem;
}

.clinical-stat-card > span:last-child {
    min-width: 0;
}

.clinical-stat-card small,
.clinical-stat-card strong {
    display: block;
}

.clinical-stat-card small {
    color: var(--clinical-muted);
    font-size: .77rem;
}

.clinical-stat-card strong {
    margin-top: .08rem;
    font-size: 1.15rem;
    line-height: 1.25;
}

.clinical-stat-icon {
    display: grid;
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 2.35rem;
    place-items: center;
    border-radius: .65rem;
    background: var(--clinical-accent-soft);
    color: var(--clinical-accent);
}

.clinical-stat-icon-money {
    background: #ecf7ef;
    color: #26733e;
}

.clinical-status {
    display: inline-flex;
    min-height: 1.75rem;
    align-items: center;
    padding: .25rem .58rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
}

.status-scheduled { border-color: #bed4ee; background: #edf5ff; color: #205d9f; }
.status-checked-in { border-color: #c4d6f7; background: #eef2ff; color: #3e52a3; }
.status-in-progress { border-color: #d8c5f0; background: #f5effd; color: #7044a3; }
.status-waiting { border-color: #f0d29e; background: #fff7e6; color: #8a5a08; }
.status-completed { border-color: #b9dfc4; background: #edf8f0; color: #256b38; }
.status-cancelled { border-color: #edc2c2; background: #fff0f0; color: #a33434; }
.status-neutral { border-color: #d8e0e3; background: #f3f6f7; color: #566a73; }

.clinical-loading-state,
.clinical-empty-state {
    display: grid;
    min-height: 14rem;
    place-items: center;
    align-content: center;
    gap: .75rem;
    color: var(--clinical-muted);
}

.clinical-empty-state {
    padding: 2rem;
    border-radius: .85rem;
    text-align: center;
}

.clinical-empty-state h2,
.clinical-empty-state p {
    margin: 0;
}

.clinical-empty-state h2 {
    color: #2a414b;
    font-size: 1.1rem;
}

.clinical-empty-icon {
    display: grid;
    width: 3.5rem;
    height: 3.5rem;
    place-items: center;
    border-radius: 50%;
    background: var(--clinical-accent-soft);
    color: var(--clinical-accent);
    font-size: 1.4rem;
}

/* Visit list */
.orders-barcode {
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    margin-bottom: .55rem;
}

.orders-barcode label {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin: 0;
    padding: 0 .85rem;
    border: 1px solid var(--clinical-border);
    border-right: 0;
    border-radius: .5rem 0 0 .5rem;
    background: var(--clinical-accent-soft);
    color: var(--clinical-accent);
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
}

.orders-barcode label i { color: inherit; }

.orders-barcode input {
    min-width: 0;
    min-height: 2.75rem;
    margin-left: -1px;
    border-color: var(--clinical-border);
    border-radius: 0 .5rem .5rem 0;
    font-size: 1rem;
}

.orders-barcode input:read-only {
    background: #f3f6f7;
    color: var(--clinical-muted);
}

.orders-barcode p {
    grid-column: 1 / -1;
    margin: .5rem 0 0;
    padding: .5rem .65rem;
    border: 1px solid #edc2c2;
    border-radius: .5rem;
    background: #fff0f0;
    color: #a33434;
    font-size: .82rem;
}

.orders-quick-search {
    display: grid;
    grid-template-columns: minmax(14rem, 1fr) auto auto auto;
    gap: .55rem;
}

.orders-quick-search-web { grid-template-columns: minmax(14rem, 1fr) auto auto; }

.orders-filter-toggle,
.orders-scan-button,
.orders-search-button {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}

.orders-filter-count {
    display: inline-grid;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 .25rem;
    place-items: center;
    border-radius: 999px;
    background: var(--clinical-accent);
    color: #fff;
    font-size: .7rem;
    font-weight: 750;
}

.orders-advanced-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(10rem, 1fr)) auto;
    gap: .75rem;
    align-items: end;
    margin-top: .8rem;
    padding-top: .8rem;
    border-top: 1px solid var(--clinical-border);
}

.orders-filter-field {
    min-width: 0;
}

.orders-filter-field .form-label,
.orders-filter-field .rz-label {
    display: block;
    margin-bottom: .35rem;
    color: #344b55;
    font-size: .8rem;
    font-weight: 650;
}

.orders-filter-field .rz-datepicker,
.orders-filter-field .rz-dropdown {
    width: 100%;
    min-height: 2.65rem;
}

.orders-filter-actions .btn {
    min-height: 2.65rem;
    color: var(--clinical-accent-dark);
    text-decoration: none;
    white-space: nowrap;
}

.orders-filter-error {
    margin: .65rem 0 0;
}

.orders-summary {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: .85rem;
}

.clinical-table-shell {
    overflow: auto;
    border-radius: .85rem;
}

.visit-list-table {
    width: 100%;
    min-width: 760px;
    margin: 0;
    table-layout: auto;
}

.visit-list-table thead {
    display: table-header-group;
    width: auto;
    background: #f1f6f7;
}

.visit-list-table tbody {
    display: table-row-group;
    max-height: none;
    overflow: visible;
}

.visit-list-table thead tr,
.visit-list-table tbody tr {
    display: table-row;
    width: auto;
    table-layout: auto;
}

.visit-list-table th,
.visit-list-table td {
    padding: .8rem .85rem;
    vertical-align: middle;
    border-color: #e8eef0;
}

.visit-list-table th {
    border-bottom-color: var(--clinical-border);
    color: #40565f;
    font-size: .76rem;
    font-weight: 750;
    letter-spacing: .02em;
    white-space: nowrap;
}

.visit-list-table tbody tr {
    cursor: pointer;
    transition: background-color 140ms ease, box-shadow 140ms ease;
}

.visit-list-table tbody tr:hover,
.visit-list-table tbody tr:focus-visible {
    background: #f2f8fa;
}

.visit-table-person,
.visit-list-table td small {
    display: block;
}

.visit-list-table td small {
    margin-top: .15rem;
    color: var(--clinical-muted);
    font-size: .76rem;
}

.visit-table-date,
.visit-table-money {
    white-space: nowrap;
}

.visit-action-column {
    width: 3.75rem;
    text-align: center;
}

.visit-delete-button {
    display: inline-grid;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    place-items: center;
}

.visit-card-list {
    display: grid;
    gap: .7rem;
}

.visit-card {
    position: relative;
    padding: .9rem;
    border: 1px solid var(--clinical-border);
    border-radius: .85rem;
    background: var(--clinical-surface);
    box-shadow: 0 3px 14px rgba(20, 48, 60, .07);
    cursor: pointer;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.visit-card:active {
    transform: scale(.992);
}

.visit-card-heading,
.visit-card-footer {
    display: flex;
    align-items: center;
}

.visit-card-heading {
    justify-content: space-between;
    gap: .75rem;
}

.visit-card-identity {
    min-width: 0;
}

.visit-card-identity strong,
.visit-card-identity span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visit-card-identity strong {
    font-size: 1rem;
}

.visit-card-identity span {
    margin-top: .1rem;
    color: var(--clinical-muted);
    font-size: .78rem;
}

.visit-card-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem .9rem;
    margin-top: .75rem;
    color: #41565f;
    font-size: .84rem;
}

.visit-card-details span {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .45rem;
}

.visit-card-details i {
    width: 1rem;
    flex: 0 0 1rem;
    color: var(--clinical-accent);
    text-align: center;
}

.visit-card-footer {
    min-height: 1.75rem;
    justify-content: flex-end;
    gap: .55rem;
    margin-top: .7rem;
    padding-top: .65rem;
    border-top: 1px solid #edf1f2;
}

.visit-card-footer > strong,
.visit-card-footer > span:first-child {
    margin-right: auto;
}

.visit-card-open {
    color: #81929a;
    font-size: .78rem;
}

.orders-pagination {
    display: flex;
    min-height: 4.25rem;
    justify-content: center;
    padding-top: 1.25rem;
}

/* Visit detail workspace. Kept global so future clinical components can reuse it. */
.visit-dashboard {
    --visit-accent: var(--clinical-accent);
    --visit-accent-soft: var(--clinical-accent-soft);
    --visit-border: var(--clinical-border);
    --visit-surface: var(--clinical-surface);
    max-width: 1680px;
    margin: 0 auto;
    padding: 0 .75rem 5.75rem;
}

.visit-heading { display: flex; align-items: center; gap: .75rem; margin: .75rem 0; }
.visit-heading h1 { margin: 0; font-size: clamp(1.35rem, 2.5vw, 2rem); font-weight: 700; letter-spacing: -.025em; }
.visit-heading-icon { display: grid; width: 2.5rem; height: 2.5rem; flex: 0 0 2.5rem; place-items: center; border-radius: .75rem; background: var(--visit-accent-soft); color: var(--visit-accent); }
.visit-method { margin-left: auto; padding: .35rem .7rem; border: 1px solid #b9d9e2; border-radius: 999px; background: var(--visit-accent-soft); color: #15566c; font-size: .8rem; font-weight: 700; }

.visit-navigation { position: sticky; top: 0; z-index: 20; display: flex; gap: .25rem; margin-bottom: .75rem; padding: .4rem; overflow-x: auto; border: 1px solid var(--visit-border); border-radius: .75rem; background: rgba(255, 255, 255, .96); box-shadow: 0 4px 16px rgba(20, 48, 60, .06); scrollbar-width: thin; }
.visit-navigation a { min-height: 2.5rem; padding: .55rem .8rem; border-radius: .5rem; color: #31444d; font-size: .88rem; font-weight: 650; line-height: 1.35; text-decoration: none; white-space: nowrap; }
.visit-navigation a:hover, .visit-navigation a:focus-visible { background: var(--visit-accent-soft); color: var(--visit-accent); outline: none; }

.visit-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 240px); gap: 1rem; align-items: start; }
.visit-main, .visit-treatment, .visit-tabs { min-width: 0; }
.visit-history { position: sticky; top: 4.25rem; min-width: 0; padding: .75rem; border: 1px solid var(--visit-border); border-radius: .75rem; background: var(--visit-surface); }
.visit-section { scroll-margin-top: 4.5rem; border: 1px solid var(--visit-border); border-radius: .85rem; box-shadow: 0 4px 18px rgba(20, 48, 60, .055); }
.visit-section h2, .visit-section h3, .visit-prescription h3 { color: #1b5265; }
.visit-field { margin-bottom: .75rem; }
.visit-field .form-label, .visit-prescription .form-label { display: block; margin-bottom: .35rem; color: #344b55; font-size: .84rem; font-weight: 650; }
.visit-dashboard textarea.form-control { min-height: 5.75rem; resize: vertical; }
.visit-treatment { scroll-margin-top: 4.5rem; }
.visit-tabs .rz-tabview-nav { overflow-x: auto; scrollbar-width: thin; }
.visit-tabs .rz-tabview-nav li { flex: 0 0 auto; }
.visit-tabs .rz-tabview-panel { overflow-x: auto; }

.visit-prescription { border-left: 4px solid var(--visit-accent); overflow-x: auto; }
.visit-prescription-heading { position: sticky; left: 0; display: flex; justify-content: space-between; align-items: center; gap: .75rem; min-width: min(100%, 19rem); margin-bottom: .75rem; background: var(--visit-surface); }
.visit-prescription table, .visit-treatment table { vertical-align: middle; }
.visit-prescription table { min-width: 860px; }
.visit-prescription :is(input, select), .visit-prescription .rz-dropdown, .visit-prescription .rz-numeric { min-height: 2.5rem; }
.visit-line-card { border-color: var(--visit-border); border-radius: .75rem; overflow: hidden; }
.visit-icon-button { display: inline-grid; width: 2.5rem; min-width: 2.5rem; height: 2.5rem; padding: 0; place-items: center; }

.visit-secondary-actions, .visit-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; }
.visit-secondary-actions { margin: 1rem 0; }
.visit-secondary-actions .btn, .visit-actions .btn { min-width: 9rem; min-height: 2.75rem; }
.visit-actions-bar { position: sticky; bottom: 0; z-index: 20; margin-top: 1rem; padding: .65rem; border: 0; border-top: 1px solid var(--visit-border); background: rgba(255, 255, 255, .96); box-shadow: 0 -5px 18px rgba(20, 48, 60, .1); backdrop-filter: blur(8px); }
.visit-actions-bar .visit-actions { max-width: 1680px; margin: 0 auto; }

.chat-fixed-wrapper { position: fixed; right: 0; top: 140px; z-index: 1050; display: flex; align-items: flex-start; transition: width 300ms ease, height 300ms ease; pointer-events: auto; box-shadow: 0 4px 12px rgba(0,0,0,.15); border-radius: 8px 0 0 8px; overflow: hidden; background: transparent; }
.chat-toggle-button { writing-mode: vertical-rl; transform: rotate(180deg); background-color: #0d6efd; color: #fff; border: none; padding: 7px 10px; cursor: pointer; font-weight: 600; border-radius: 8px 0 0 8px; outline: none; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.chat-fixed-wrapper.expanded { width: min(700px, calc(100vw - 3rem)); height: min(520px, calc(100vh - 9rem)); right: 24px; background: white; }
.chat-fixed-wrapper.expanded .chat-panel { width: auto; min-width: 0; height: 100%; flex: 1 1 auto; padding: 8px; box-sizing: border-box; display: block; min-height: 0; }
.chat-fixed-wrapper.collapsed { width: 42px; height: 120px; right: 0; background: transparent; }
.chat-fixed-wrapper .chat-panel { transition: opacity 200ms ease; opacity: 1; }

@media (max-width: 1199.98px) {
    .orders-advanced-filters { grid-template-columns: repeat(3, minmax(10rem, 1fr)); }
    .orders-filter-actions { justify-self: end; }
    .orders-finance-column { display: none; }
}

@media (max-width: 991.98px) {
    .visit-layout { grid-template-columns: minmax(0, 1fr); }
    .visit-history { position: static; order: 2; }
}

@media (max-width: 767.98px) {
    .clinical-workspace { padding-right: .5rem; padding-left: .5rem; }
    .clinical-page-heading { min-height: 4rem; }
    .clinical-primary-action { width: 2.75rem; padding: 0; }
    .clinical-primary-action span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .orders-quick-search { grid-template-columns: minmax(0, 1fr) 2.75rem; }
    .orders-filter-toggle { grid-column: 2; grid-row: 1; width: 2.75rem; padding: 0; }
    .orders-filter-toggle .orders-filter-count { position: absolute; margin: -2rem 0 0 2rem; }
    .orders-filter-toggle .fa-chevron-down, .orders-filter-toggle .fa-chevron-up { display: none; }
    .orders-scan-button { grid-column: 1 / -1; grid-row: 2; }
    .orders-search-button { grid-column: 1 / -1; grid-row: 3; }
    .orders-quick-search-web .orders-search-button { grid-row: 2; }
    .orders-advanced-filters { grid-template-columns: minmax(0, 1fr); }
    .orders-filter-actions { justify-self: stretch; }
    .orders-filter-actions .btn { width: 100%; }
    .orders-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .clinical-stat-card { min-width: 0; padding: .65rem .75rem; }
    .clinical-stat-icon { display: none; }
}

@media (max-width: 600px) {
    .visit-dashboard { padding-right: .5rem; padding-bottom: 9.5rem; padding-left: .5rem; }
    .visit-actions-bar { position: fixed; right: 0; bottom: 0; left: 0; margin-top: 0; padding: .65rem max(1rem, env(safe-area-inset-right)) calc(.65rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); }
    .visit-method { max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .visit-navigation { margin-right: -.5rem; margin-left: -.5rem; border-right: 0; border-left: 0; border-radius: 0; }
    .visit-section { border-radius: .65rem; }
    .visit-dashboard :is(.form-control, .btn), .visit-dashboard :is(.rz-dropdown, .rz-numeric) { min-height: 2.75rem; }
    .visit-prescription table { min-width: 780px; }
    .visit-actions, .visit-secondary-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .visit-actions .btn, .visit-secondary-actions .btn { width: 100%; min-width: 0; }
    .visit-actions .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .chat-fixed-wrapper.expanded { flex-direction: column; width: 100%; right: 0; left: 0; bottom: 0; top: auto; height: min(70vh, 560px); border-radius: 8px 8px 0 0; }
    .chat-toggle-button { align-self: flex-start; writing-mode: horizontal-tb; transform: none; border-radius: 8px 8px 0 0; }
}

@media (max-width: 420px) {
    .orders-barcode label { width: 2.75rem; padding: 0; }
    .orders-barcode label span { display: none; }
    .orders-summary { grid-template-columns: minmax(0, 1fr); }
    .visit-card-details { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .visit-card,
    .visit-list-table tbody tr,
    .chat-fixed-wrapper,
    .chat-fixed-wrapper .chat-panel { transition: none; }
}

/* Patient list and detail */
.patients-heading-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.patients-heading-actions .btn { min-height: 2.75rem; }
.patients-search-row { display: flex; align-items: center; gap: .6rem; }
.patients-search-row .clinical-search-box { flex: 1 1 18rem; }
.patients-search-row > .btn { min-height: 2.75rem; }
.patients-table { min-width: 760px; }
.patients-table td { overflow-wrap: anywhere; }
.patients-table td:nth-child(2) { font-weight: 650; }
.patients-table td:nth-child(4) { white-space: nowrap; }
.patients-page .clinical-table-shell { position: relative; }
.patients-page .clinical-table-shell[aria-busy="true"]::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .55);
    pointer-events: none;
}
.patient-detail { max-width: 1680px; padding-bottom: 5rem; }
.patient-tabs .rz-tabview-nav { overflow-x: auto; scrollbar-width: thin; }
.patient-tabs .rz-tabview-nav li { flex: 0 0 auto; }
.patient-tabs .rz-tabview-panels { overflow: visible; }
.patient-tabs .rz-tabview-panel { padding: 1rem 0; }
.patient-section {
    margin-bottom: 1rem;
    padding: 1.15rem;
    border: 1px solid var(--clinical-border);
    border-radius: .85rem;
    background: var(--clinical-surface);
    box-shadow: var(--clinical-shadow);
}
.patient-section h2 {
    margin: 0 0 1rem;
    padding-bottom: .7rem;
    border-bottom: 1px solid var(--clinical-border);
    color: var(--clinical-accent-dark);
    font-size: 1.05rem;
    font-weight: 700;
}
.patient-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.1rem; }
.patient-field { min-width: 0; }
.patient-field > label { display: block; margin-bottom: .35rem; color: #344b55; font-size: .83rem; font-weight: 650; }
.patient-field .form-control { width: 100%; min-height: 2.65rem; border-color: var(--clinical-border); }
.patient-field textarea.form-control { min-height: 5.5rem; resize: vertical; }
.patient-field .validation-message { display: block; margin-top: .25rem; }
.patient-checkbox { display: flex; min-height: 2.65rem; align-items: center; }
.patient-checkbox input { width: 1.15rem; height: 1.15rem; }
.patient-validation-summary { margin-bottom: 1rem; color: #a33434; }
.patient-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    padding: .75rem;
    border-top: 1px solid var(--clinical-border);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -5px 18px rgba(20, 48, 60, .08);
}
.patient-actions .btn { min-width: 8rem; min-height: 2.75rem; }
.patient-detail :is(input, textarea, button):focus-visible { outline: 3px solid rgba(23, 107, 135, .22); outline-offset: 2px; }

@media (max-width: 767.98px) {
    .patients-heading-actions .btn { width: 2.75rem; padding: 0; }
    .patients-heading-actions .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
    .patients-search-row { flex-wrap: wrap; }
    .patients-search-row .clinical-search-box { flex-basis: 100%; }
    .patients-search-row > .btn { flex: 1; }
    .patients-table { min-width: 0; }
    .patients-table thead { display: none; }
    .patients-table tbody { display: grid; gap: .7rem; padding: .7rem; }
    .patients-table tbody tr {
        display: grid;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .45rem .75rem;
        padding: .8rem;
        border: 1px solid var(--clinical-border);
        border-radius: .7rem;
        background: #fff;
    }
    .patients-table td { display: block; padding: 0; border: 0; font-size: .84rem; }
    .patients-table td::before { content: attr(data-label); display: block; margin-bottom: .1rem; color: var(--clinical-muted); font-size: .72rem; font-weight: 600; }
    .patients-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 1; font-size: 1rem; }
    .patients-table td:nth-child(5), .patients-table td:nth-child(6) { grid-column: 1 / -1; }
    .patient-field-grid { grid-template-columns: minmax(0, 1fr); }
    .patient-section { padding: .9rem; }
}

@media (max-width: 420px) {
    .patient-actions { margin: 0 -.5rem; padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
    .patient-actions .btn { flex: 1; min-width: 0; }
}
/* Drug catalog and entry */
.drug-workspace { --drug-border: var(--clinical-border); }
.drug-create-button, .drug-search-button { min-height: 2.75rem; }
.drug-search-form { display: flex; align-items: end; gap: .75rem; }
.drug-search-field { flex: 1 1 20rem; max-width: 36rem; min-width: 0; }
.drug-search-field > label,
.drug-form-field > label { display: block; margin-bottom: .35rem; color: #40565f; font-size: .85rem; font-weight: 700; }
.drug-search-form .clinical-search-box .form-control { width: 100%; }
.drug-table-shell { position: relative; }
.drug-table-shell[aria-busy="true"]::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.55); pointer-events: none; }
.drug-list-table, .drug-strength-table { width: 100%; margin: 0; table-layout: auto; }
.drug-list-table thead, .drug-strength-table thead { display: table-header-group; width: auto; background: #f1f6f7; }
.drug-list-table tbody, .drug-strength-table tbody { display: table-row-group; max-height: none; overflow: visible; }
.drug-list-table thead tr, .drug-list-table tbody tr,
.drug-strength-table thead tr, .drug-strength-table tbody tr { display: table-row; width: auto; table-layout: auto; }
.drug-list-table th, .drug-list-table td,
.drug-strength-table th, .drug-strength-table td { padding: .75rem .85rem; vertical-align: middle; border-color: #e8eef0; }
.drug-list-table th, .drug-strength-table th { color: #40565f; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.drug-list-table td { overflow-wrap: anywhere; }
.drug-list-table td:first-child { width: 30%; font-weight: 700; }
.drug-list-table td:nth-child(2) { width: 15%; }
.drug-list-table td:last-child { width: 8rem; }
.drug-list-table tbody tr:hover { background: #f2f8fa; }
.drug-name-button { padding: .2rem 0; border: 0; background: transparent; color: #10566e; font: inherit; font-weight: inherit; text-align: left; cursor: pointer; }
.drug-name-button:hover { text-decoration: underline; }
.drug-description { max-width: 28rem; }
.drug-pagination { margin-top: 1rem; }
.drug-entry { max-width: 1380px; }
.drug-entry-title { margin: 0 0 1rem; font-size: 1.15rem; font-weight: 700; }
.drug-entry-panel { margin-bottom: 1rem; padding: 1.1rem; border: 1px solid var(--drug-border); border-radius: .85rem; background: #fff; box-shadow: var(--clinical-shadow); }
.drug-entry-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.drug-form-field { min-width: 0; }
.drug-form-field .form-control { width: 100%; min-height: 2.75rem; }
.drug-description-field { grid-column: 1 / -1; }
.drug-active-field { display: flex; align-items: center; gap: .75rem; }
.drug-active-field > label { margin: 0; }
.drug-active-field .form-check-input, .drug-liquid-label .form-check-input { width: 1.2rem; height: 1.2rem; margin: 0; }
.drug-section-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.drug-section-heading h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.drug-section-heading .btn { min-height: 2.5rem; }
.drug-strength-scroll { overflow-x: auto; }
.drug-strength-table { min-width: 850px; }
.drug-strength-table td { padding: .6rem .4rem; }
.drug-strength-table th { padding: .65rem .4rem; }
.drug-strength-table th:nth-child(4), .drug-strength-table td:nth-child(4) { text-align: center; }
.drug-strength-label { display: block; font-size: 0; }
.drug-strength-label :is(.form-control, .form-select) { width: 100%; min-width: 0; min-height: 2.5rem; font-size: .9rem; }
.drug-strength-table td:nth-child(4) .drug-strength-label { display: flex; justify-content: center; }
.drug-strength-action-header, .drug-strength-action { width: 3rem; }
.drug-remove-button { display: grid; width: 2.5rem; height: 2.5rem; padding: 0; place-items: center; }
.drug-entry-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.25rem; }
.drug-entry-actions .btn { min-width: 8rem; min-height: 2.75rem; }

@media (max-width: 700px) {
    .drug-workspace .clinical-page-heading { align-items: flex-start; flex-wrap: wrap; }
    .drug-search-form { align-items: stretch; flex-direction: column; }
    .drug-search-field { flex-basis: auto; width: 100%; max-width: none; }
    .drug-search-button { width: 100%; }
    .drug-list-table, .drug-strength-table { min-width: 0; }
    .drug-list-table thead, .drug-strength-table thead { display: none; }
    .drug-list-table tbody, .drug-strength-table tbody { display: grid; gap: .7rem; }
    .drug-list-table tbody tr, .drug-strength-table tbody tr { display: grid; width: 100%; border: 1px solid var(--drug-border); border-radius: .75rem; background: #fff; }
    .drug-list-table tbody tr { grid-template-columns: repeat(2, minmax(0,1fr)); padding: .8rem; }
    .drug-list-table td { display: block; width: auto !important; max-width: none; padding: .3rem .2rem; border: 0; }
    .drug-list-table td:first-child, .drug-list-table td:nth-child(3) { grid-column: 1 / -1; }
    .drug-list-table td::before { content: attr(data-label); display: block; margin-bottom: .15rem; color: #61747d; font-size: .72rem; font-weight: 700; }
    .drug-list-table td:first-child::before { display: none; }
    .drug-list-table .drug-name-button { font-size: 1rem; }
    .drug-entry-grid { grid-template-columns: minmax(0,1fr); }
    .drug-description-field { grid-column: auto; }
    .drug-entry-panel { padding: .85rem; }
    .drug-strength-scroll { overflow: visible; }
    .drug-strength-table tbody tr { grid-template-columns: repeat(2, minmax(0,1fr)); gap: .4rem .7rem; padding: .75rem; }
    .drug-strength-table td { display: block; width: auto !important; padding: 0; border: 0; }
    .drug-strength-table td:nth-child(4) { text-align: left; }
    .drug-strength-label { font-size: .76rem; font-weight: 700; color: #40565f; }
    .drug-strength-label :is(.form-control, .form-select) { margin-top: .25rem; font-weight: 400; }
    .drug-strength-table td:nth-child(4) .drug-strength-label { display: flex; min-height: 2.75rem; align-items: center; justify-content: flex-start; gap: .6rem; }
    .drug-strength-action { display: flex !important; grid-column: 1 / -1; justify-content: flex-end; }
    .drug-entry-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
    .drug-entry-actions .btn { width: 100%; min-width: 0; }
}

@media (max-width: 420px) {
    .drug-strength-table tbody tr { grid-template-columns: minmax(0,1fr); }
    .drug-workspace .clinical-heading-icon { display: none; }
}
