[x-cloak] { display: none !important; }

:root {
    --color-primary: #1c74bc;
    --color-primary-soft: #e8f3fa;
    --color-primary-strong: #14578d;
    --color-primary-500: #2b8fd4;
    --color-primary-600: #1868a8;
}

html.dark {
    --color-primary: #3d9ee0;
    --color-primary-soft: rgb(12 55 90 / 0.35);
    --color-primary-strong: #7ec8f5;
}

.his-shell {
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-text);
}

.his-shell.is-consult #sidebar,
.his-shell.is-consult #topbar,
.his-shell.is-consult #mobile-sidebar,
.his-shell.is-consult #mobile-sidebar-overlay {
    display: none !important;
}

.his-shell.is-consult #main-content {
    margin-left: 0 !important;
    padding-top: 0;
}

.his-shell.is-consult .his-page {
    max-width: none;
    height: 100vh;
}

@media (min-width: 992px) {
    .his-mobile-only { display: none !important; }
}

@media (max-width: 991px) {
    .his-desktop-only { display: none !important; }
}

.his-nav-badge {
    margin-left: auto;
    background: var(--color-danger);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 10px;
    padding: 0 5px;
    min-width: 16px;
    text-align: center;
    line-height: 16px;
}

.his-shell #sidebar nav .nav-item,
.his-shell #mobile-sidebar nav .mobile-nav-item {
    margin-top: 0.45rem;
}
.his-shell #sidebar nav .nav-section {
    padding-top: 12px;
    padding-bottom: 8px;
}

.his-page { max-width: 1440px; }
.his-page > .p-3.sm\:p-4,
.dash-neg-pad { margin: -1rem; }
@media (min-width: 992px) {
    .dash-neg-pad { margin: -1.5rem; }
}
.his-flash { position: sticky; top: 0; z-index: 20; }
.his-chat-flash {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    width: min(32rem, calc(100% - 2rem));
    pointer-events: none;
}
.his-chat-flash p { pointer-events: auto; }
.his-flash p { border-radius: var(--radius-xl); padding: 10px 14px; font-size: 13px; }
.his-flash .is-ok { background: var(--color-success-soft); color: var(--color-success); }
.his-flash .is-err { background: var(--color-danger-soft); color: var(--color-danger); }

.his-empty { padding: 40px 20px; text-align: center; color: var(--color-faint); font-size: 13px; }

.cx-field { display: block; }
.cx-field > span {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-heading);
    margin-bottom: 8px;
}
.cx-input {
    width: 100%;
    height: 2.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 0 0.875rem;
    background: var(--color-w1);
    color: var(--color-heading);
    font-size: 12px;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
.cx-input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--color-primary) 50%, transparent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 10%, transparent);
}
select.cx-input { appearance: auto; }
textarea.cx-input { height: auto; min-height: 5.5rem; padding: 0.625rem 0.875rem; }
.cx-input-settings {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--color-border);
    background: var(--color-w1);
    color: var(--color-text);
    font-size: 0.875rem;
}
.cx-input-settings:focus {
    outline: none;
    border-color: var(--color-primary);
}
textarea.cx-input-settings { resize: none; }

.cx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.25rem;
    padding: 0 1rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    background: var(--color-w1);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-heading);
    transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}
.cx-btn:hover {
    border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
    color: var(--color-primary);
}
.cx-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.25rem;
    padding: 0 1rem;
    border-radius: var(--radius-xl);
    border: 0;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-size: 12px;
    font-weight: 600;
    transition: background-color 150ms ease;
}
.cx-btn-primary:hover { background: var(--color-primary-strong); }
.cx-btn-crit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.25rem;
    padding: 0 1rem;
    border-radius: var(--radius-xl);
    border: 0;
    background: var(--color-danger);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.cx-search { position: relative; }
.cx-search > i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-faint);
    font-size: 0.875rem;
    pointer-events: none;
}
.cx-search > input {
    height: 2.25rem;
    width: 15rem;
    max-width: 100%;
    padding: 0 0.75rem 0 2.25rem;
    border-radius: var(--radius-xl);
    background: var(--color-subtle);
    border: 1px solid transparent;
    font-size: 0.875rem;
    color: var(--color-text);
}
.cx-search > input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--color-primary) 40%, transparent);
    background: var(--color-w1);
}
.cx-search.is-wide > input { width: 100%; }

.cx-person { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.cx-person-av {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-xl);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.cx-person-name { font-size: 13px; font-weight: 600; color: var(--color-heading); line-height: 1.25; }
.cx-person-meta { font-size: 11px; color: var(--color-faint); margin-top: 2px; }
.cx-link { color: var(--color-primary); font-size: 12px; font-weight: 600; }
.cx-link.is-crit { color: var(--color-danger); }
.cx-dl { display: grid; gap: 10px; }
@media (min-width: 768px) { .cx-dl { grid-template-columns: 1fr 1fr; } }
.cx-dl > div > span { display: block; font-size: 11px; color: var(--color-faint); margin-bottom: 2px; }

.cx-table { width: 100%; font-size: 0.875rem; border-collapse: collapse; min-width: 700px; }
.cx-table th {
    text-align: left;
    padding: 0.75rem 1.25rem;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-faint);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--color-subtle);
    border-bottom: 1px solid var(--color-border-subtle);
    white-space: nowrap;
}
.cx-table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--color-border-subtle);
    vertical-align: middle;
    color: var(--color-text);
    font-size: 13px;
}
.cx-table tbody tr { transition: background-color 150ms ease; }
.cx-table tbody tr:hover { background: color-mix(in srgb, var(--color-primary) 3%, transparent); }
.cx-table tr.is-click { cursor: pointer; }
.cx-table tbody tr:last-child td { border-bottom: 0; }

.cx-badge {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-full);
    padding: 2px 8px;
    font-size: 12px;
}
.cx-badge.is-ok { background: var(--color-success-soft); color: var(--color-success); }
.cx-badge.is-warn { background: var(--color-warning-soft); color: #b45309; }
.cx-badge.is-crit { background: var(--color-danger-soft); color: var(--color-danger); }
.cx-badge.is-info { background: var(--color-info-soft); color: var(--color-info); }
.cx-badge.is-mute { background: var(--color-subtle); color: var(--color-muted); }
html.dark .cx-badge.is-warn { color: var(--color-warning); }

.filter-tab.is-pill {
    flex-shrink: 0;
    height: 2rem;
    padding: 0 0.875rem;
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 500;
    color: var(--color-muted);
    transition: color 150ms ease, background-color 150ms ease;
}
.filter-tab.is-pill:hover { color: var(--color-text); background: var(--color-subtle); }
.filter-tab.is-pill.active {
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.appt-filter-pill {
    padding: 0.375rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
    white-space: nowrap;
    transition: color 150ms ease, background-color 150ms ease;
}
.appt-filter-pill:hover { color: var(--color-text); background: var(--color-subtle); }
.appt-filter-pill.active {
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.settings-tab {
    flex-shrink: 0;
    flex-grow: 1;
    flex-basis: 0;
    min-width: 100px;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
    border-bottom: 2px solid transparent;
    transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}
.settings-tab:hover { color: var(--color-heading); background: color-mix(in srgb, var(--color-primary) 4%, transparent); }
.settings-tab.is-on {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.his-patientbar {
    margin-bottom: 0;
    padding: 14px 18px;
    background: var(--color-w1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.03);
}
.his-msg {
    max-width: 78%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--color-w1);
}
.his-msg.is-mine { margin-left: auto; background: var(--color-primary-soft); }
.his-thread {
    width: 100%;
    text-align: left;
    border-bottom: 1px solid var(--color-border-subtle);
}
.his-thread.is-active {
    background: color-mix(in srgb, var(--color-primary) 5%, transparent);
    border-left-color: var(--color-primary) !important;
}
.his-matrix th, .his-matrix td { text-align: center; }
.his-matrix td:first-child, .his-matrix th:first-child { text-align: left; }

.brand-wordmark-img { height: 28px; width: auto; max-width: 168px; object-fit: contain; object-position: left center; }
.brand-mark-sq { width: 36px; height: 36px; object-fit: cover; object-position: left center; flex-shrink: 0; }
html:not(.sidebar-collapsed) #sidebar .brand-mark-sq { display: none; }

.his-chip { display: flex; flex-direction: column; gap: 2px; }
.his-chip span { color: var(--color-muted); font-size: 11px; }
.his-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.dash-ring {
    width: 112px;
    height: 112px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    background: conic-gradient(var(--color-subtle) 0deg 360deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 16px), #000 calc(100% - 15px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 16px), #000 calc(100% - 15px));
}

.doc-card-avatar:not(img) {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.doc-card-initials {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--color-border);
}

.doctor-card {
    display: flex;
    flex-direction: column;
    background: var(--color-w1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    padding: 1.25rem;
    transition: background-color 150ms ease, border-color 150ms ease;
}
.doctor-card:hover { background: color-mix(in srgb, var(--color-primary) 2%, var(--color-w1)); }

.appt-card {
    background: var(--color-w1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.appt-card:hover {
    border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
    box-shadow: 0 4px 12px -6px rgba(15, 23, 42, 0.15);
}

.doctor-card .doctor-stat {
    border: 1px solid var(--color-border-subtle, var(--color-border));
    border-radius: var(--radius-xl);
    padding: 0.5rem 0.625rem;
}
.doctor-card .doctor-stat p:first-child {
    font-size: 10px;
    color: var(--color-faint);
}
.doctor-card .doctor-stat p:last-child {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-heading);
}

.pat-hero {
    background: var(--color-w1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    padding: 22px 24px;
}
.pat-next {
    background: var(--color-heading);
    color: #fff;
    border-radius: var(--radius-2xl);
    padding: 22px 24px;
}
.pat-next .mute { color: rgba(255,255,255,.72); }
.pat-next .cx-btn { border-color: rgba(255,255,255,.28); background: transparent; color: #fff; }
.pat-next .cx-btn-primary { background: #fff; color: var(--color-heading); }
.pat-next.is-empty {
    background: var(--color-w1);
    color: var(--color-heading);
    border: 1px solid var(--color-border);
}
.pat-next.is-empty .mute { color: var(--color-muted); }
.pat-next.is-empty .cx-btn {
    border-color: var(--color-border);
    background: var(--color-w1);
    color: var(--color-heading);
}
.pat-next.is-empty .cx-btn-primary {
    background: var(--color-primary);
    color: var(--color-on-primary);
}
html.dark .pat-next { background: var(--color-subtle); }

.pat-home {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--color-w1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.03);
    overflow: hidden;
}
.pat-home-next {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.pat-home-next .mute { color: var(--color-muted); }
.pat-home.is-next .pat-home-next {
    background: var(--color-heading);
    color: #fff;
}
.pat-home.is-next .pat-home-next .mute { color: rgba(255, 255, 255, 0.72); }
.pat-home.is-next .pat-home-next .cx-btn {
    border-color: rgba(255, 255, 255, 0.28);
    background: transparent;
    color: #fff;
}
.pat-home.is-next .pat-home-next .cx-btn-primary {
    background: #fff;
    color: var(--color-heading);
}
.pat-home-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--color-border-subtle);
    border-top: 1px solid var(--color-border);
}
.pat-home-stat {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 6.75rem;
    padding: 1rem 1.1rem;
    text-align: left;
    background: var(--color-w1);
    border: 0;
    cursor: pointer;
    transition: background var(--transition-normal, 0.2s ease);
}
.pat-home-stat:hover { background: var(--color-subtle); }
@media (min-width: 768px) {
    .pat-home {
        grid-template-columns: minmax(17rem, 0.92fr) minmax(0, 1.58fr);
        align-items: stretch;
    }
    .pat-home-stats {
        grid-template-columns: repeat(auto-fit, minmax(7.75rem, 1fr));
        border-top: 0;
        border-left: 1px solid var(--color-border);
    }
}
html.dark .pat-home.is-next .pat-home-next { background: var(--color-subtle); color: var(--color-heading); }
html.dark .pat-home.is-next .pat-home-next .mute { color: var(--color-muted); }
html.dark .pat-home.is-next .pat-home-next .cx-btn {
    border-color: var(--color-border);
    color: var(--color-heading);
}
html.dark .pat-home.is-next .pat-home-next .cx-btn-primary {
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.pat-home-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
@media (min-width: 768px) {
    .pat-home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
    .pat-home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.pat-home-alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-2xl);
    border: 1px solid color-mix(in srgb, var(--color-danger, #dc2626) 35%, var(--color-border));
    background: color-mix(in srgb, var(--color-danger, #dc2626) 8%, var(--color-w1));
    color: var(--color-heading);
    font-size: 0.8125rem;
    font-weight: 600;
}
.pat-home-nudge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--color-border);
    background: var(--color-w1);
}
.pat-home-nudge.is-video {
    border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
    background: var(--color-primary-soft);
}
.pat-home-grid .dash-panel {
    min-height: 100%;
}

.pat-home-rail {
    padding: 0.25rem 0 0.35rem;
}
.pat-home-rail-day {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: 0 0.25rem;
    padding: 1rem 1.15rem 1.15rem;
}
.pat-home-rail-day + .pat-home-rail-day {
    border-top: 1px solid var(--color-border-subtle);
}
.pat-home-rail-date {
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--color-heading);
    padding: 0.85rem 0.75rem 0 0;
}
.pat-home-rail-slots {
    border-left: 2px solid color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
    padding-left: 0.15rem;
}
.pat-home-rail-row {
    display: grid;
    grid-template-columns: 4.35rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    padding: 0.7rem 0.9rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: inherit;
    border-radius: 0 0.85rem 0.85rem 0;
}
.pat-home-rail-row:hover {
    background: var(--color-subtle);
}
.pat-home-rail-time {
    font-size: 0.9375rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary);
}

.cx-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.cx-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 0.3);
    backdrop-filter: blur(4px);
}
html.dark .cx-modal-backdrop { background: rgb(0 0 0 / 0.5); }
.cx-modal-panel {
    position: relative;
    width: 100%;
    max-width: 36rem;
    background: var(--color-w1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    overflow: hidden;
}
.cx-modal-panel.is-md { max-width: 28rem; }
.cx-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 8rem;
    padding: 1.25rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-2xl);
    background: var(--color-subtle);
    cursor: pointer;
    transition: border-color 150ms ease, background 150ms ease;
}
.cx-dropzone:hover {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 4%, var(--color-w1));
}
.cx-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border-subtle);
}
.cx-modal-body {
    padding: 1rem 1.25rem;
    max-height: 68vh;
    overflow-y: auto;
}
.cx-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border-subtle);
}
.cx-icon-btn {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-xl);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-faint);
    transition: background-color 150ms ease, color 150ms ease;
}
.cx-icon-btn:hover { background: var(--color-subtle); color: var(--color-text); }

#lk-local video, #lk-remote video { width: 100%; height: 100%; object-fit: cover; }
#lk-remote audio { position: absolute; width: 0; height: 0; opacity: 0; }
.is-consult-root { overflow: hidden; height: 100vh; }
.consult-stage { display: grid; grid-template-columns: minmax(0, 1fr) 440px; height: 100vh; background: #0c1718; }
.consult-stage.is-desk-off { grid-template-columns: minmax(0, 1fr); }
.consult-video { position: relative; min-width: 0; background: #0c1718; }
.consult-remote { position: absolute; inset: 0; background: #101c1d; }
.consult-remote video { border-radius: 0; }
.consult-local {
    position: absolute;
    right: 20px;
    bottom: 108px;
    width: 196px;
    height: 140px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 2px solid rgba(255,255,255,.42);
    box-shadow: 0 12px 32px rgba(0,0,0,.45);
    z-index: 4;
    background: #1A2A2C;
    transition: transform .16s ease;
}
.consult-local:hover { transform: scale(1.04); }
.consult-local-tag {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 5;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(12,23,24,.72);
    color: #fff;
}
.consult-overlay { position: absolute; left: 0; right: 0; z-index: 3; pointer-events: none; }
.consult-overlay > * { pointer-events: auto; }
.consult-top {
    top: 0;
    padding: 16px 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(180deg, rgba(12,23,24,.72), transparent);
}
.consult-bottom {
    bottom: 0;
    padding: 18px;
    display: flex;
    justify-content: center;
    background: linear-gradient(0deg, rgba(12,23,24,.78), transparent);
}
.consult-wait {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    z-index: 2;
}
.consult-ctrl {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,.14);
    color: #fff;
    border: 1px solid rgba(255,255,255,.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 11px;
}
.consult-ctrl.is-on { background: #fff; color: #1A2A2C; }
.consult-ctrl.is-off { background: #3a2a2a; color: #fff; }
.consult-ctrl.is-rec { background: #C45C4A; color: #fff; animation: consult-pulse 1.4s ease-in-out infinite; }
.consult-ctrl.is-end { background: #C45C4A; color: #fff; width: 64px; }
@keyframes consult-pulse { 50% { box-shadow: 0 0 0 8px rgba(196,92,74,.18); } }
.consult-desk {
    background: var(--color-bg);
    color: var(--color-heading);
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}
.consult-desk-head {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-w1);
}
.consult-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-w1);
}
.consult-tab {
    padding: 6px 10px;
    border-radius: var(--radius-full);
    background: var(--color-primary-soft);
    font-size: 12px;
}
.consult-tab.is-on { background: var(--color-primary); color: #fff; }
.consult-desk-body { flex: 1; overflow: auto; padding: 14px 16px 28px; }
.consult-prep { max-width: 920px; }

.auth-shell {
    width: 100%;
    min-height: 100dvh;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow-x: clip;
}
.auth-panel {
    position: relative;
    isolation: isolate;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    min-width: 0;
    padding: 1.5rem 1.25rem 1.25rem;
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    background: var(--color-bg);
}
.auth-panel::before {
    content: "";
    position: absolute;
    inset: -18%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 46% 38% at 8% 0%, color-mix(in srgb, var(--color-primary) 12%, transparent), transparent 72%),
        radial-gradient(ellipse 40% 32% at 96% 88%, color-mix(in srgb, var(--color-primary) 9%, transparent), transparent 70%);
    animation: auth-panel-drift 22s ease-in-out infinite alternate;
}
.auth-panel > * { position: relative; z-index: 1; }
.auth-col {
    width: 100%;
    max-width: 26.5rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.auth-wordmark {
    display: block;
    height: 32px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
}
.auth-form {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    padding: 1.5rem 0 0.75rem;
}
.auth-fields { display: flex; flex-direction: column; gap: 1rem; }
.auth-field { display: block; min-width: 0; }
.auth-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-heading);
    margin-bottom: 0.45rem;
}
.auth-input {
    width: 100%;
    min-width: 0;
    height: 3rem;
    padding: 0 0.95rem;
    border-radius: 0.5rem;
    background: var(--color-w1);
    border: 1px solid var(--color-border);
    font-size: 0.875rem;
    color: var(--color-heading);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}
.auth-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 16%, transparent);
}
.auth-eye {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-faint);
}
.auth-submit {
    width: 100%;
    height: 3rem;
    border-radius: 0.5rem;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 180ms ease, transform 180ms ease;
}
.auth-submit:hover { background: var(--color-primary-strong); transform: translateY(-1px); }
.auth-gate-bar {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    margin-bottom: 1.35rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    background: var(--color-subtle);
}
.auth-gate {
    flex: 1;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 0.375rem;
    font-size: 12px;
    font-weight: 600;
    border: 0;
    color: var(--color-muted);
    background: transparent;
    transition: background-color 180ms ease, color 180ms ease;
}
.auth-gate.is-on {
    background: var(--color-primary);
    color: var(--color-on-primary);
}
.auth-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.auth-captcha {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}
.auth-captcha-visual {
    height: 3.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-border);
    background: var(--color-subtle);
    overflow: hidden;
}
.auth-captcha-visual img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.auth-captcha-answer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 3rem;
    gap: 0.5rem;
    align-items: stretch;
}
.auth-captcha-refresh {
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-border);
    background: var(--color-w1);
    color: var(--color-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}
.auth-captcha-refresh:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}
.auth-code {
    position: relative;
    min-width: 0;
}
.auth-code-sensor {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: text;
}
.auth-code-slots {
    display: grid;
    grid-template-columns: repeat(var(--auth-code-n), minmax(0, 1fr));
    gap: 0.5rem;
}
.auth-code-slot {
    height: 3rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-border);
    background: var(--color-w1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--color-heading);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}
.auth-code-slot.is-on {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 16%, transparent);
}
.auth-note {
    border-radius: 0.5rem;
    border: 1px solid var(--color-border);
    background: var(--color-primary-soft);
    padding: 0.875rem 1rem;
}
.auth-legal {
    text-align: center;
    font-size: 11px;
    color: var(--color-muted);
    width: 100%;
    margin: 0.75rem 0 0;
    padding: 0;
}
.auth-legal a { color: var(--color-primary); font-weight: 600; }
.auth-register-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
.auth-register-grid .col-span-2 { grid-column: 1 / -1; }
.auth-hero {
    display: none;
    position: relative;
    overflow: hidden;
    min-width: 0;
    background: var(--color-subtle);
}
.auth-hero-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: 50% 18%;
    opacity: 0;
    transition: opacity 700ms ease;
    animation: auth-ken 26s ease-in-out infinite alternate;
}
.auth-hero-photo.is-on { opacity: 1; }
.auth-hero-photo.is-mirror { transform: scaleX(-1); }
.auth-hero-photo.is-on.is-mirror {
    animation-name: auth-ken-mirror;
}
.auth-hero-wash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 58% 44% at 10% 90%, color-mix(in srgb, var(--color-primary) 18%, transparent), transparent 70%),
        radial-gradient(ellipse 44% 38% at 94% 8%, color-mix(in srgb, var(--color-primary) 12%, transparent), transparent 68%);
    animation: auth-wash 14s ease-in-out infinite alternate;
}
.auth-orb {
    position: absolute;
    border-radius: 9999px;
    pointer-events: none;
    filter: blur(40px);
    background: color-mix(in srgb, var(--color-primary) 16%, transparent);
    animation: auth-orb 18s ease-in-out infinite;
}
.auth-orb-a { width: 17rem; height: 17rem; left: -4rem; bottom: 8%; }
.auth-orb-b { width: 13rem; height: 13rem; right: -3rem; top: 6%; animation-delay: -7s; }
.auth-orb-c { width: 9rem; height: 9rem; right: 18%; bottom: -2rem; animation-delay: -13s; background: color-mix(in srgb, var(--color-primary) 14%, #fff); }
@keyframes auth-ken {
    from { transform: scale(1.04) translate3d(0, 0, 0); }
    to { transform: scale(1.1) translate3d(-1.6%, 1.2%, 0); }
}
@keyframes auth-ken-mirror {
    from { transform: scaleX(-1) scale(1.04) translate3d(0, 0, 0); }
    to { transform: scaleX(-1) scale(1.1) translate3d(1.6%, 1.2%, 0); }
}
@keyframes auth-wash {
    from { opacity: 0.22; }
    to { opacity: 0.55; }
}
@keyframes auth-orb {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(22px, -26px, 0); }
}
@keyframes auth-panel-drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(-2.2%, 1.6%, 0) scale(1.04); }
}
@media (min-width: 480px) {
    .auth-register-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem 0.75rem; }
}
@media (max-width: 379px) {
    .auth-code-slots { gap: 0.35rem; }
    .auth-code-slot { height: 2.75rem; font-size: 0.95rem; }
    .auth-captcha-refresh { width: 2.75rem; height: 2.75rem; }
    .auth-gate { font-size: 11px; }
}
@media (min-width: 1024px) {
    .auth-shell {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        height: 100dvh;
        min-height: 100dvh;
        overflow: hidden;
    }
    .auth-panel {
        height: 100dvh;
        min-height: 0;
        padding: 2rem clamp(2rem, 5.5vw, 4.5rem) 1.5rem;
    }
    .auth-form { padding-top: 2rem; }
    .auth-hero {
        display: block;
        height: 100dvh;
        min-height: 100dvh;
    }
}
@media (prefers-reduced-motion: reduce) {
    .auth-panel::before,
    .auth-hero-photo,
    .auth-hero-wash,
    .auth-orb,
    .auth-submit { animation: none; transform: none; }
}

.bg-mint { background: var(--color-primary-soft); }
.text-teal { color: var(--color-primary); }

.his-file-full { max-width: none; }
.his-file-page { min-height: calc(100vh - 4rem); }
.his-file-full .his-file-head,
.his-file-full .his-file-body {
    padding: 1.25rem 1.25rem 0;
}
@media (min-width: 992px) {
    .his-file-full .his-file-head,
    .his-file-full .his-file-body {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}
.his-file-head {
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--color-w1);
}
.his-file-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1.25rem;
}
@media (min-width: 768px) {
    .his-file-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
    .his-file-facts { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.his-file-fact {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-xl);
    background: var(--color-subtle);
}
.his-file-fact span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-faint);
    font-weight: 600;
}
.his-file-fact strong {
    font-size: 13px;
    color: var(--color-heading);
    font-weight: 600;
}
.his-file-body { padding-top: 1.25rem; padding-bottom: 1.5rem; }
.his-file-cards {
    display: grid;
    gap: 1rem;
}
@media (min-width: 992px) {
    .his-file-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.his-file-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    background: var(--color-w1);
}
.his-file-card header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-border-subtle);
}
.his-file-card header h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-heading);
}
.his-file-stack {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem;
}
.his-file-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    text-align: left;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-xl);
    background: var(--color-subtle);
    border: 1px solid transparent;
}
.his-file-row.is-wide { gap: 0.3rem; }
.his-file-row.is-click { cursor: pointer; }
.his-file-row.is-click:hover {
    border-color: color-mix(in srgb, var(--color-primary) 35%, transparent);
    background: color-mix(in srgb, var(--color-primary) 6%, var(--color-subtle));
}
.his-file-row strong { font-size: 13px; color: var(--color-heading); }
.his-file-row p { font-size: 12px; color: var(--color-text); margin: 0; }
.his-file-row .mute { color: var(--color-faint); }

.consent-grid {
    display: grid;
    gap: 1rem;
}
@media (min-width: 900px) {
    .consent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.consent-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.15rem 1.2rem;
    background: var(--color-w1);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.consent-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.consent-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.35rem;
}

.account-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.15rem 2rem;
}
@media (min-width: 640px) {
    .account-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media print {
    #sidebar,
    #topbar,
    #mobile-sidebar,
    #mobile-sidebar-overlay,
    .his-patientbar,
    .his-flash,
    .his-nav-badge {
        display: none !important;
    }
    #main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}

.pat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border-subtle);
    transition: background-color 150ms ease;
}
.pat-card:hover { background: color-mix(in srgb, var(--color-primary) 4%, transparent); }
.pat-card.pat-active { background: color-mix(in srgb, var(--color-primary) 8%, transparent); }
