*, *::before, *::after {
    box-sizing: border-box;
    /* Tailwind's border-*/border utilities only set width/color; normally
       preflight gives every element border-style:solid as a baseline so
       those utilities actually render. With preflight disabled, elements
       default to border-style:none (the CSS initial value) and every
       border border-slate-200 in this app is invisible — width and color
       set, but nothing to draw. Worst on white inputs sitting on white
       cards (zero background contrast either), but it affects every
       bordered element the same way. */
    border-style: solid;
    border-width: 0;
}

/* Tailwind's preflight reset is disabled (see App.razor), so the browser's
   default body margin is still active. Without this, a fixed h-screen shell
   ends up a few pixels taller than the viewport and the whole page scrolls
   alongside the intended inner-content scroll (MainLayout's <main>). Leaving
   body's own overflow untouched (not forced hidden) so pages that don't use
   a bounded h-screen shell, like the auth screens, can still scroll normally
   if their content ever exceeds the viewport. */
html, body {
    height: 100%;
    margin: 0;
}

/* More of Tailwind's disabled preflight, restored by hand: without this,
   every <a> gets the browser's default underline (including ones styled as
   buttons) and every <ul>/<ol> gets default bullets/numbering and indent. */
a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Buttons, inputs, and selects render with the OS's native "soft" 3D/embossed
   widget chrome (a gradient/bevel look, most visible on Windows) unless the
   browser's default appearance is explicitly turned off. Tailwind's own
   utility classes (bg-*, border-*, rounded-*) then become the only visible
   styling, giving a flat look instead of the native embossed one. Border
   width/color still come from Tailwind classes — only the border-style
   baseline is handled globally above. */
button, input, select, textarea {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: 0;
    font: inherit;
    color: inherit;
}

button {
    background-color: transparent;
    cursor: pointer;
}

/* Most input/select fields in this app don't set an explicit Tailwind bg-*
   class (they rely on the browser's default white field background), so
   forcing them transparent (as buttons are, above) made them nearly
   invisible against white cards — just a faint 1px border with nothing
   behind it. Give them an explicit white fill instead. */
input, select, textarea {
    background-color: #fff;
}

/* Chrome/Edge paint their own background + inset shadow on autofilled
   fields (the classic light-blue/yellow autofill look) — most likely to
   show up on Email/Password since those are exactly what gets autofilled.
   That's the "embossed" look surviving even after the resets above; this
   is the standard override: force it back to a flat white field with a
   very long transition-delay trick so the browser's own repaint never
   shows through. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    -webkit-text-fill-color: #0f172a;
    transition: background-color 9999s ease-in-out 0s;
}

/* appearance:none above strips <select>'s native dropdown arrow along with
   the embossed chrome, so redraw a plain chevron by hand. */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2394a3b8' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 32px;
}

h1 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin: 0 0 var(--space-1) 0;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.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."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* App shell */

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

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-header {
    height: 52px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    flex-shrink: 0;
}

.app-header-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-muted);
}

    .app-header-breadcrumb strong {
        color: var(--text);
        font-weight: 600;
    }

    .app-header-breadcrumb .divider {
        color: var(--border);
    }

.app-header-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-2xs);
    font-weight: 600;
    color: var(--success-text);
    background: var(--success-subtle);
    padding: 2px var(--space-2);
    border-radius: 999px;
}

.app-header-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.app-content {
    flex: 1;
    padding: var(--space-5);
    max-width: 1100px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin: 0 0 var(--space-4) 0;
}

/* Sidebar */

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-subtle);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--space-4) var(--space-3);
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: var(--text-lg);
    letter-spacing: -0.025em;
    padding: 0 var(--space-2);
    margin-bottom: var(--space-4);
}

.sidebar-brand-icon {
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: var(--text-sm);
    transition: background-color 0.1s ease, color 0.1s ease;
}

    .sidebar-link:hover {
        background: var(--surface-hover);
        color: var(--text);
    }

    .sidebar-link.active {
        background: var(--border);
        color: var(--text);
        font-weight: 500;
    }

.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: var(--space-3);
}

.sidebar-user-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-2);
    margin-bottom: var(--space-3);
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    font-size: var(--text-xs);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    font-size: var(--text-2xs);
    color: var(--text-muted);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all 0.1s ease;
}

    .sidebar-logout:hover {
        background: var(--danger-subtle);
        border-color: var(--danger-border);
        color: var(--danger);
    }

/* Cards */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
}

.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-title {
    font-weight: 600;
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
}

.card p {
    flex-grow: 1;
    margin-top: 0;
    margin-bottom: var(--space-3);
}

.card + .card:not(.dashboard-grid > *) {
    margin-top: var(--space-4);
}

.record-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm);
}

    .record-row:last-child {
        border-bottom: none;
    }

    .record-row select {
        margin-left: auto;
        padding: var(--space-1) var(--space-2);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        font-size: var(--text-xs);
    }

/* Badges */

.badge {
    display: inline-block;
    padding: 2px var(--space-2);
    border-radius: 999px;
    font-size: var(--text-xs);
    font-weight: 600;
}

.badge-neutral { background: var(--bg-subtle); color: var(--text-muted); }
.badge-pending { background: var(--warning-subtle); color: var(--warning-text); }
.badge-accepted, .badge-completed, .badge-scheduled { background: var(--accent-subtle); color: var(--accent); }
.badge-intransit { background: var(--info-subtle); color: var(--info-text); }
.badge-cancelled, .badge-noshow { background: var(--danger-subtle); color: var(--danger); }

.stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.stat-tile {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.stat-tile-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
}

    .stat-tile-icon svg {
        width: 18px;
        height: 18px;
    }

.stat-tile-icon-accent { background: var(--accent-subtle); color: var(--accent); }
.stat-tile-icon-warning { background: var(--warning-subtle); color: var(--warning-text); }
.stat-tile-icon-success { background: var(--success-subtle); color: var(--success-text); }

.stat-tile-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: 2px;
}

.stat-tile-value {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text);
}

.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-4);
}

.tab-button {
    padding: var(--space-2) var(--space-3);
    border: none;
    background: none;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

    .tab-button:hover {
        color: var(--text);
    }

    .tab-button.active {
        color: var(--accent);
        font-weight: 600;
        border-bottom-color: var(--accent);
    }

.search-box {
    width: 100%;
    box-sizing: border-box;
    padding: var(--space-2) var(--space-3) var(--space-2) 36px;
    margin-bottom: var(--space-3);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-subtle) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") no-repeat 12px center;
    background-size: 16px;
    font-size: var(--text-sm);
    font-family: var(--font-sans);
}

    .search-box:focus {
        outline: none;
        border-color: var(--accent);
        background: var(--bg);
    }

/* Forms and buttons */

.field {
    margin-bottom: var(--space-3);
}

    .field label {
        display: block;
        font-size: var(--text-sm);
        font-weight: 600;
        margin-bottom: var(--space-1);
    }

    .field input, .field select {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid var(--border-strong);
        border-radius: 6px;
        font-size: var(--text-sm);
        font-family: var(--font-sans);
        box-sizing: border-box;
        background-color: var(--bg);
        transition: border-color 0.1s ease, box-shadow 0.1s ease;
    }

        .field input:focus, .field select:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
        }

.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    text-align: center;
    transition: all 0.1s ease;
}

    .btn-primary:hover {
        background: var(--accent-hover);
        color: white;
    }

    .btn-primary:active {
        transform: scale(0.98);
    }

    .btn-primary:disabled {
        background: var(--text-muted);
        cursor: not-allowed;
    }

/* Auth pages */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-subtle);
}

.auth-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: var(--space-5);
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-md);
}

    .auth-card h1 {
        font-size: var(--text-xl);
        font-weight: 700;
        margin-bottom: var(--space-1);
    }

    .auth-card button[type="submit"] {
        width: 100%;
        margin-top: var(--space-2);
    }

.auth-subtitle {
    color: var(--text-muted);
    margin-top: 0;
    margin-bottom: var(--space-4);
}

.auth-error {
    color: var(--danger);
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
}

.record-row-link {
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}

    .record-row-link:hover {
        background: var(--accent-subtle);
    }

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

    .inline-form input, .inline-form select {
        padding: var(--space-1) var(--space-2);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        font-size: var(--text-sm);
    }

.auth-footer {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-align: center;
}

/* Live update banner */

.live-banner {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--accent-subtle);
    border-bottom: 1px solid var(--border);
    color: var(--accent);
    font-size: var(--text-xs);
    animation: live-banner-in 0.2s ease-out;
}

.live-banner-message {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.live-banner-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.live-banner-dismiss {
    background: none;
    border: none;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    padding: 0 var(--space-1);
    line-height: 1;
}

@keyframes live-banner-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Spotlight quick search (/spotlight) */

.spotlight {
    max-width: 800px;
    margin: 0 auto;
}

.spotlight-search {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.spotlight-search-bar {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}

    .spotlight-search-bar svg {
        width: 20px;
        height: 20px;
        color: var(--text-muted);
        margin-right: var(--space-2);
        flex-shrink: 0;
    }

    .spotlight-search-bar input {
        width: 100%;
        border: none;
        outline: none;
        font-size: var(--text-base);
        color: var(--text);
        font-family: var(--font-sans);
    }

.spotlight-hint {
    font-size: var(--text-2xs);
    color: var(--text-faint);
    background: var(--surface-hover);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    flex-shrink: 0;
}

.spotlight-status {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.spotlight-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spotlight-spin 0.8s linear infinite;
}

@keyframes spotlight-spin {
    to { transform: rotate(360deg); }
}

.spotlight-results {
    max-height: 250px;
    overflow-y: auto;
    padding: var(--space-2) 0;
}

.spotlight-result-row {
    padding: var(--space-2) var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

    .spotlight-result-row:hover, .spotlight-result-row.selected {
        background: var(--surface-hover);
    }

    .spotlight-result-row .name {
        font-weight: 500;
        font-size: var(--text-sm);
        color: var(--text);
    }

    .spotlight-result-row .nhis {
        font-size: var(--text-xs);
        color: var(--text-muted);
    }

    .spotlight-result-row .select-hint {
        font-size: var(--text-xs);
        color: var(--accent);
        font-weight: 500;
    }

.spotlight-detail {
    margin-top: var(--space-4);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
}

.spotlight-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-3);
}

    .spotlight-detail-header h2 {
        font-size: var(--text-lg);
        font-weight: 600;
        color: var(--text);
        margin: 0;
    }

    .spotlight-detail-header p {
        font-size: var(--text-xs);
        color: var(--text-muted);
        margin: 2px 0 0 0;
    }

.vitals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-3);
}

.vitals-card {
    background: var(--surface-sunken);
    padding: var(--space-3);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

    .vitals-card .label {
        font-size: var(--text-xs);
        color: var(--text-muted);
    }

    .vitals-card .value {
        font-size: var(--text-lg);
        font-weight: 600;
        color: var(--text);
        margin-top: 4px;
    }

    .vitals-card .note {
        font-size: var(--text-2xs);
        color: var(--text-muted);
        margin-top: 2px;
    }

    .vitals-card .note.normal {
        color: var(--success-text);
    }

    .vitals-card .note.warning {
        color: var(--warning-text);
    }

    .vitals-card .note.critical {
        color: var(--danger);
    }

.vitals-disclaimer {
    margin-top: var(--space-3);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Chat (/chat) */

.chat-container {
    display: flex;
    height: 70vh;
    min-height: 480px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.chat-sidebar {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--surface-sunken);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-sidebar-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: var(--text-sm);
}

.chat-conversation-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.chat-conversation-empty {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.chat-conversation-row {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

    .chat-conversation-row:hover {
        background: var(--surface-hover);
    }

    .chat-conversation-row.selected {
        background: var(--border);
    }

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
    flex-shrink: 0;
}

.chat-conversation-info {
    flex: 1;
    min-width: 0;
}

.chat-conversation-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

    .chat-conversation-top .name {
        font-weight: 600;
        font-size: var(--text-xs);
        color: var(--text);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .chat-conversation-top .time {
        font-size: var(--text-2xs);
        color: var(--text-faint);
        flex-shrink: 0;
    }

.chat-conversation-role {
    font-size: var(--text-2xs);
    color: var(--accent);
    margin-bottom: 2px;
}

.chat-conversation-preview {
    font-size: var(--text-xs);
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.chat-main-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
}

    .chat-main-header .name {
        font-weight: 600;
        font-size: var(--text-sm);
        color: var(--text);
    }

    .chat-main-header .role {
        font-size: var(--text-2xs);
        color: var(--text-muted);
    }

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.chat-message-row {
    display: flex;
}

    .chat-message-row.mine {
        justify-content: flex-end;
    }

.chat-bubble-wrap {
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

    .chat-message-row.mine .chat-bubble-wrap {
        align-items: flex-end;
    }

.chat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: var(--text-sm);
    line-height: 1.4;
    background: var(--surface-hover);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chat-message-row.mine .chat-bubble {
    background: var(--accent);
    color: white;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
}

.chat-attachment {
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-2xs);
    font-weight: 500;
}

    .chat-attachment svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: var(--text-2xs);
    color: var(--text-faint);
}

    .chat-message-meta svg {
        width: 12px;
        height: 12px;
        color: var(--accent);
    }

.chat-input-row {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

    .chat-input-row input {
        flex: 1;
        padding: 10px 14px;
        border: 1px solid var(--border-strong);
        border-radius: 20px;
        font-size: var(--text-xs);
        outline: none;
        font-family: var(--font-sans);
    }

.chat-send-button {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .chat-send-button svg {
        width: 16px;
        height: 16px;
        transform: rotate(45deg);
        margin-left: 2px;
    }

.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

    .chat-empty-state svg {
        width: 48px;
        height: 48px;
        color: var(--border-strong);
        margin-bottom: var(--space-2);
    }

    .chat-empty-state .message {
        font-size: var(--text-sm);
        font-weight: 500;
    }