/* ══════════════════════════════════════════════════════════════════════════════
   CEMR IPD (INPATIENT DEPARTMENT) DESIGN SYSTEM — MATERIAL 3 THEME
   Fully harmonious with Syncfusion Blazor Material 3 & CEMR Layout
   ══════════════════════════════════════════════════════════════════════════════ */

:root {
    /* ── Material 3 Primary & Brand Palette ── */
    --ipd-primary: #6750a4;
    --ipd-primary-hover: #523e85;
    --ipd-primary-light: #f3edf7;
    --ipd-primary-container: #eaddff;
    --ipd-on-primary-container: #21005d;

    /* ── Material 3 Neutral & Surface (Clean White App Background) ── */
    --ipd-surface: #ffffff;
    --ipd-surface-dim: #fdfbff;
    --ipd-surface-container: #f7f2fa;
    --ipd-surface-container-high: #f3edf7;
    --ipd-surface-container-highest: #e6e0e9;
    --ipd-border: #cac4d0;
    --ipd-border-light: #e7e0ec;
    --ipd-text-main: #1d1b20;
    --ipd-text-muted: #49454f;
    --ipd-text-subtle: #79747e;

    /* ── Bed Status Semantics (Material 3 Tonal Badges) ── */
    --ipd-vacant: #1b5e20;
    --ipd-vacant-bg: #e8f5e9;
    --ipd-vacant-border: #c8e6c9;

    --ipd-occupied: #6750a4;
    --ipd-occupied-bg: #f3edf7;
    --ipd-occupied-border: #eaddff;

    --ipd-cleaning: #b25e00;
    --ipd-cleaning-bg: #fff3e0;
    --ipd-cleaning-border: #ffe0b2;

    --ipd-blocked: #b3261e;
    --ipd-blocked-bg: #f9dedc;
    --ipd-blocked-border: #f2b8b5;

    --ipd-reserved: #00639b;
    --ipd-reserved-bg: #e1f5fe;
    --ipd-reserved-border: #b3e5fc;

    /* ── Shadows & Radius (Material 3 Standard Elevation & Shapes) ── */
    --ipd-radius-sm: 6px;
    --ipd-radius-md: 10px;
    --ipd-radius-lg: 14px;
    --ipd-radius-full: 9999px;

    --ipd-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --ipd-shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --ipd-shadow-lg: 0 10px 18px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --ipd-shadow-hover: 0 8px 20px -2px rgba(103, 80, 164, 0.16), 0 3px 6px -2px rgba(0, 0, 0, 0.05);

    --ipd-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base Container (Seamless white matching CEMR body) ── */
.ipd-page-container {
    padding: 16px 22px;
    background-color: #ffffff;
    min-height: calc(100vh - 64px);
    font-family: inherit;
    color: var(--ipd-text-main);
    box-sizing: border-box;
}

/* ── Page Header Bar ── */
.ipd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ipd-border-light);
    flex-wrap: wrap;
    gap: 16px;
}

.ipd-header-title h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 2px 0;
    color: var(--ipd-text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ipd-header-title h2 i {
    color: var(--ipd-primary);
}

.ipd-header-title p {
    font-size: 13px;
    color: var(--ipd-text-muted);
    margin: 0;
}

.ipd-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Buttons ── */
.ipd-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--ipd-radius-md);
    cursor: pointer;
    transition: var(--ipd-transition);
    border: 1px solid transparent;
    text-decoration: none;
}

.ipd-btn-primary {
    background-color: var(--ipd-primary);
    color: #ffffff;
}

.ipd-btn-primary:hover {
    background-color: var(--ipd-primary-hover);
    box-shadow: 0 4px 12px rgba(103, 80, 164, 0.3);
    color: #ffffff;
}

.ipd-btn-outline {
    background-color: #ffffff;
    border-color: var(--ipd-border);
    color: var(--ipd-text-main);
}

.ipd-btn-outline:hover {
    background-color: var(--ipd-surface-container);
    border-color: var(--ipd-primary);
    color: var(--ipd-primary);
}

.ipd-btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: var(--ipd-radius-sm);
}

/* ── Metric Summary Cards Row ── */
.ipd-metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.ipd-metric-card {
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--ipd-shadow-sm);
    transition: var(--ipd-transition);
}

.ipd-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ipd-shadow-md);
    border-color: var(--ipd-primary-container);
}

.metric-icon-box {
    width: 42px;
    height: 42px;
    border-radius: var(--ipd-radius-md);
    display: grid;
    place-items: center;
    font-size: 18px;
    flex-shrink: 0;
}

.metric-icon-box.total { background: var(--ipd-primary-light); color: var(--ipd-primary); }
.metric-icon-box.occupied { background: var(--ipd-occupied-bg); color: var(--ipd-occupied); }
.metric-icon-box.vacant { background: var(--ipd-vacant-bg); color: var(--ipd-vacant); }
.metric-icon-box.cleaning { background: var(--ipd-cleaning-bg); color: var(--ipd-cleaning); }
.metric-icon-box.blocked { background: var(--ipd-blocked-bg); color: var(--ipd-blocked); }
.metric-icon-box.reserved { background: var(--ipd-reserved-bg); color: var(--ipd-reserved); }

.metric-data {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--ipd-text-main);
}

.metric-label {
    font-size: 12px;
    color: var(--ipd-text-muted);
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════════════════
   BED BOARD 2-COLUMN LAYOUT (Ward Sidebar + Bed Grid)
   ══════════════════════════════════════════════════════════════════════════════ */

.ipd-bedboard-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1024px) {
    .ipd-bedboard-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Ward Navigation Sidebar ── */
.ipd-ward-sidebar {
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-lg);
    box-shadow: var(--ipd-shadow-sm);
    overflow: hidden;
}

.sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--ipd-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ipd-surface-container);
}

.sidebar-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ipd-text-main);
}

.ward-list {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 6px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
}

.ward-item {
    padding: 10px 8px 10px 12px;
    border-radius: var(--ipd-radius-md);
    cursor: pointer;
    transition: var(--ipd-transition);
    /* Reserve 4px left-border width always to prevent layout jitter on activation */
    border: 1px solid transparent;
    border-left-width: 4px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ward-item:hover {
    background: var(--ipd-surface-container);
}

.ward-item.active {
    background: #f3edf7;
    border: 1px solid #6750a4;
    border-left: 4px solid #6750a4;
}

.ward-item.active .ward-name {
    color: #21005d;
    font-weight: 700;
}

.ward-item.active .ward-stats-mini {
    color: #374151;
    font-weight: 600;
}

.ward-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ward-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--ipd-text-main);
}

.ward-code-badge {
    font-size: 10px;
    font-weight: 700;
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    color: #374151;
}

.ward-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.ward-progress-fill {
    height: 100%;
    background: var(--ipd-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.ward-stats-mini {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #4b5563;
    font-weight: 500;
}

/* ── Bed Board Main Area ── */
.ipd-board-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.board-filter-bar {
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-md);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: var(--ipd-shadow-sm);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-legend-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--ipd-radius-full);
    font-weight: 600;
}

.legend-pill.vacant { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.legend-pill.occupied { background: #ede9fe; color: #4c1d95; border: 1px solid #c4b5fd; }
.legend-pill.cleaning { background: #fef3c7; color: #78350f; border: 1px solid #fde68a; }
.legend-pill.blocked { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.legend-pill.reserved { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }

/* ── Bed Cards Grid ── */
.ipd-beds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.ipd-bed-card {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-left: 4px solid #d1d5db; /* left accent, overridden by status */
    border-radius: var(--ipd-radius-md);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    cursor: pointer;
    transition: var(--ipd-transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Left-border status accent — replaces top stripe visual */
.ipd-bed-card:has(.bed-card-stripe.vacant)   { border-left-color: #16a34a; }
.ipd-bed-card:has(.bed-card-stripe.occupied) { border-left-color: #6750a4; }
.ipd-bed-card:has(.bed-card-stripe.cleaning) { border-left-color: #d97706; }
.ipd-bed-card:has(.bed-card-stripe.blocked)  { border-left-color: #dc2626; }
.ipd-bed-card:has(.bed-card-stripe.reserved) { border-left-color: #0284c7; }

.ipd-bed-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ipd-shadow-hover);
    border-color: var(--ipd-primary);
    border-left-color: var(--ipd-primary);
}

.ipd-bed-card.selected {
    border-color: var(--ipd-primary);
    border-left-color: var(--ipd-primary);
    box-shadow: 0 0 0 2px rgba(103, 80, 164, 0.25);
}

/* Status stripe: hidden — left-border accent on .ipd-bed-card handles status colour */
.bed-card-stripe {
    display: none;
}

.bed-card-header {
    padding: 10px 12px 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.bed-identity {
    display: flex;
    flex-direction: column;
}

.bed-code {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 6px;
}

.room-type-tag {
    font-size: 11px;
    color: #4b5563;
    font-weight: 500;
}

.status-chip {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--ipd-radius-full);
}

.status-chip.vacant { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.status-chip.occupied { background: #ede9fe; color: #4c1d95; border: 1px solid #c4b5fd; }
.status-chip.cleaning { background: #fef3c7; color: #78350f; border: 1px solid #fde68a; }
.status-chip.blocked { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.status-chip.reserved { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }

.bed-card-body {
    padding: 8px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.vacant-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
    color: var(--ipd-vacant);
    gap: 4px;
}

.rate-badge {
    font-size: 11px;
    font-weight: 700;
    color: #15803d;
}

/* ── Room Group Banner ── */
.room-group-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #f3edf7;
    border: 1px solid #e7e0ec;
    border-radius: var(--ipd-radius-md);
}

.room-title {
    font-size: 14px;
    font-weight: 700;
    color: #1d1b20;
}

.room-category-pill {
    font-size: 11px;
    font-weight: 700;
    background: #eaddff;
    color: #21005d;
    padding: 2px 8px;
    border-radius: var(--ipd-radius-full);
}

.room-tariff-text {
    font-size: 12px;
    font-weight: 600;
    color: #49454f;
}

.room-bed-count-badge {
    font-size: 11px;
    font-weight: 700;
    background: #ffffff;
    border: 1px solid #cac4d0;
    color: #1d1b20;
    padding: 3px 10px;
    border-radius: var(--ipd-radius-full);
}

/* ── Bed Card Occupant & Vacant Layout ── */
.occupant-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.patient-name-card {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    /* Normalize ALL CAPS names from DB into clean Title Case */
    text-transform: lowercase;
}
.patient-name-card::first-letter,
.patient-name-card > *::first-letter {
    text-transform: uppercase;
}

.patient-sub-card {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #374151;
    margin: 3px 0;
}

.ip-number-badge {
    font-size: 10px;
    font-weight: 700;
    background: #ede9fe;
    color: #5b21b6;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #ddd6fe;
}

.doctor-name-card {
    font-size: 11px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
/* Normalize ALL CAPS doctor names */
.doctor-name-card span {
    text-transform: capitalize;
}

.diagnosis-chip-card {
    font-size: 11px;
    font-weight: 500;
    color: #475569;          /* calm slate, not alarm red */
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: capitalize;
}

.bed-card-actions {
    padding: 8px 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
}

/* ── Status Change Buttons (Drawer) ── */
.btn-status-vacant {
    background: #dcfce7;
    border: 1px solid #16a34a;
    color: #14532d;
    font-weight: 700;
}
.btn-status-vacant:hover { background: #16a34a; color: #ffffff; }

.btn-status-cleaning {
    background: #fef3c7;
    border: 1px solid #d97706;
    color: #78350f;
    font-weight: 700;
}
.btn-status-cleaning:hover { background: #d97706; color: #ffffff; }

.btn-status-blocked {
    background: #fee2e2;
    border: 1px solid #dc2626;
    color: #7f1d1d;
    font-weight: 700;
}
.btn-status-blocked:hover { background: #dc2626; color: #ffffff; }

.btn-status-reserved {
    background: #e0f2fe;
    border: 1px solid #0284c7;
    color: #075985;
    font-weight: 700;
}
.btn-status-reserved:hover { background: #0284c7; color: #ffffff; }

/* ══════════════════════════════════════════════════════════════════════════════
   BED DETAIL SLIDE-OUT DRAWER / OFFCANVAS
   ══════════════════════════════════════════════════════════════════════════════ */

.ipd-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(29, 27, 32, 0.45);
    z-index: 1050;
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: flex-end;
    animation: fadeIn 0.2s ease;
}

.ipd-drawer-panel {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    height: 100%;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--ipd-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ipd-surface-container);
}

.drawer-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ipd-text-main);
}

.drawer-close-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--ipd-text-muted);
}

.drawer-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.drawer-section {
    background: var(--ipd-surface-container);
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ipd-primary);
}

.drawer-kv-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.drawer-kv-key { color: var(--ipd-text-muted); }
.drawer-kv-val { font-weight: 600; color: var(--ipd-text-main); }

.drawer-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--ipd-border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--ipd-surface-container);
}

/* ══════════════════════════════════════════════════════════════════════════════
   PATIENT BANNER COMPONENT STYLES (Material 3 Card)
   ══════════════════════════════════════════════════════════════════════════════ */

.ipd-patient-banner {
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-lg);
    box-shadow: 0 2px 8px rgba(103, 80, 164, 0.06);
    margin-bottom: 18px;
    overflow: hidden;
    transition: var(--ipd-transition);
}

.ipd-banner-main {
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.ipd-banner-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ipd-primary-light);
    color: var(--ipd-primary);
    font-weight: 700;
    display: grid;
    place-items: center;
    position: relative;
    flex-shrink: 0;
}

.avatar-initials {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
}

.gender-pill {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    font-size: 11px;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.gender-pill.female { color: #d81b60; }
.gender-pill.male { color: #1e88e5; }

.ipd-banner-identity {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 220px;
    flex: 1;
}

.identity-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.patient-name {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ipd-text-main);
}

.identity-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--ipd-text-muted);
    flex-wrap: wrap;
}

.meta-separator {
    color: var(--ipd-text-subtle);
}

.meta-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.meta-badge.blood-group {
    background: #fee2e2;
    color: #dc2626;
}

.meta-badge.allergy-alert {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #ffedd5;
}

.meta-badge.patient-flag-tag {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    font-weight: 600;
}

.ipd-banner-clinical {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.clinical-stat {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 11px;
    color: var(--ipd-text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--ipd-text-main);
}

.stat-value.bed-tag {
    color: var(--ipd-primary);
    font-weight: 700;
}

.stat-sub {
    font-size: 11px;
    color: var(--ipd-text-muted);
}

.banner-toggle-btn {
    background: transparent;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-sm);
    padding: 4px 8px;
    color: var(--ipd-text-muted);
    cursor: pointer;
    transition: var(--ipd-transition);
}

.banner-toggle-btn:hover {
    background: var(--ipd-surface-container);
    color: var(--ipd-primary);
}

/* Rounding Stepper Control */
.ipd-rounding-stepper {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: var(--ipd-radius-md);
    padding: 3px 6px;
    gap: 5px;
    flex-shrink: 0;
    margin-left: auto;
}

.ipd-rounding-stepper .rounding-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.ipd-rounding-stepper .rounding-btn:hover:not(:disabled) {
    background: var(--ipd-primary);
    color: #ffffff;
    border-color: var(--ipd-primary);
}

.ipd-rounding-stepper .rounding-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #f8fafc;
}

.ipd-rounding-stepper .rounding-counter {
    font-size: 11px;
    font-weight: 700;
    color: #334155;
    padding: 0 4px;
    white-space: nowrap;
}


/* Extended Banner Details */
.ipd-banner-extended {
    padding: 12px 18px;
    background: var(--ipd-surface-container);
    border-top: 1px solid var(--ipd-border-light);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.ext-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ext-label {
    font-size: 11px;
    color: var(--ipd-text-muted);
}

.ext-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--ipd-text-main);
}

/* ── Badges ── */
.ipd-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--ipd-radius-full);
}

.ipd-badge-primary { background: var(--ipd-primary-light); color: var(--ipd-primary); }
.ipd-badge-success { background: var(--ipd-vacant-bg); color: var(--ipd-vacant); }
.ipd-badge-warning { background: var(--ipd-cleaning-bg); color: var(--ipd-cleaning); }
.ipd-badge-danger { background: var(--ipd-blocked-bg); color: var(--ipd-blocked); }
.ipd-badge-info { background: #e1f5fe; color: #00639b; }
.ipd-badge-neutral { background: var(--ipd-surface-container-high); color: var(--ipd-text-muted); }

/* ══════════════════════════════════════════════════════════════════════════════
   ADMISSION FORM STYLES & AUTO-SCROLL VALIDATION
   ══════════════════════════════════════════════════════════════════════════════ */

.ipd-form-card {
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-lg);
    box-shadow: var(--ipd-shadow-sm);
    margin-bottom: 20px;
    overflow: visible;
}

.form-card-header {
    padding: 12px 18px;
    border-bottom: 1px solid var(--ipd-border-light);
    background: var(--ipd-surface-container);
    display: flex;
    align-items: center;
    gap: 10px;
    border-top-left-radius: var(--ipd-radius-lg);
    border-top-right-radius: var(--ipd-radius-lg);
}

.form-card-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ipd-text-main);
}

.form-card-header h4 i {
    color: var(--ipd-primary);
}

.form-card-body {
    padding: 18px;
}

.ipd-form-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.ipd-form-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.ipd-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ipd-form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ipd-text-main);
}

.ipd-form-group label .required {
    color: var(--ipd-blocked);
    margin-left: 2px;
}

/* Patient Search Suggestion Dropdown */
.ipd-search-dropdown-wrapper {
    position: relative;
    z-index: 20;
}

.ipd-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--ipd-border);
    border-radius: var(--ipd-radius-md);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    z-index: 50;
    max-height: 320px;
    overflow-y: auto;
}

.search-result-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ipd-border-light);
    cursor: pointer;
    transition: var(--ipd-transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--ipd-primary-light);
    border-left: 3px solid var(--ipd-primary);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Quick Patient Registration Form in Dialog */
.quick-patient-form {
    padding: 2px 4px;
}

.form-label-sm {
    font-size: 12px;
    font-weight: 600;
    color: var(--ipd-text-main);
    margin-bottom: 4px;
    display: block;
}

.quick-patient-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.quick-patient-grid .full-span {
    grid-column: span 2;
}

.quick-patient-grid .field-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quick-patient-grid .field-item label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ipd-text-main);
    margin: 0;
}

/* Unified Validation Error Highlight */
.is-invalid,
[aria-invalid="true"],
.ipd-field-error,
.ipd-field-error.e-input-group,
.ipd-field-error.e-control-wrapper,
.ipd-field-error .e-input-group,
.e-error.e-input-group,
.e-error.e-control-wrapper {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
    animation: errorPulse 0.4s ease;
}

/* Unified Validation Message Typography */
.ipd-error-text,
.validation-message {
    font-size: 11px;
    color: #ef4444;
    margin-top: 3px;
    font-weight: 600;
    display: block;
}

/* ── Form Step Progress Indicator (Visual) ── */
.ipd-step-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-lg);
    padding: 12px 18px;
    margin-bottom: 20px;
    box-shadow: var(--ipd-shadow-sm);
    gap: 8px;
    flex-wrap: wrap;
}

.ipd-step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ipd-text-subtle);
    user-select: none;
}

.ipd-step-item.active {
    color: var(--ipd-primary);
    font-weight: 700;
}

.ipd-step-item.completed {
    color: #1b5e20;
}

.ipd-step-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    background: var(--ipd-surface-container);
    color: var(--ipd-text-muted);
}

.ipd-step-item.active .ipd-step-badge {
    background: var(--ipd-primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(103, 80, 164, 0.35);
}

.ipd-step-item.completed .ipd-step-badge {
    background: #e8f5e9;
    color: #1b5e20;
}

.ipd-step-divider {
    flex: 1;
    height: 2px;
    background: var(--ipd-border-light);
    min-width: 14px;
}

.ipd-step-divider.completed {
    background: #81c784;
}

/* ── Sticky Action Footer ── */
.ipd-form-footer-sticky {
    position: sticky;
    bottom: 0;
    z-index: 50;
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-lg);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.06);
    margin-top: 20px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   SKELETON SHIMMER LOADERS
   ══════════════════════════════════════════════════════════════════════════════ */

.ipd-skeleton-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.ipd-skeleton-card {
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ipd-skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f7f2fa 25%, #e6e0e9 50%, #f7f2fa 75%);
    background-size: 200% 100%;
    animation: ipd-pulse 1.5s infinite;
}

.ipd-skeleton-line.title { height: 18px; width: 60%; }
.ipd-skeleton-line.text { height: 12px; width: 90%; }
.ipd-skeleton-line.short { height: 12px; width: 40%; }

.ipd-skeleton-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #ffffff;
    border-radius: var(--ipd-radius-lg);
    border: 1px solid var(--ipd-border-light);
}

.ipd-skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e6e0e9;
    animation: ipd-pulse 1.5s infinite;
}

.ipd-skeleton-banner-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Keyframe Animations ── */
@keyframes ipd-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes errorPulse {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* ══════════════════════════════════════════════════════════════════════════════
   IPD NAVIGATION TABS
   ══════════════════════════════════════════════════════════════════════════════ */

.ipd-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-lg);
    padding: 6px 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    box-shadow: var(--ipd-shadow-sm);
    white-space: nowrap;
    /* Hide scrollbar on overflow — keeps tabs clean on tablets */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.ipd-tabs::-webkit-scrollbar {
    display: none;
}

.ipd-tabs a,
.ipd-tabs .ipd-tab-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ipd-text-muted);
    text-decoration: none;
    border-radius: var(--ipd-radius-md);
    transition: var(--ipd-transition);
    cursor: pointer;
}

.ipd-tabs a:hover,
.ipd-tabs .ipd-tab-link:hover {
    color: var(--ipd-primary);
    background: var(--ipd-primary-light);
}

.ipd-tabs a.active,
.ipd-tabs .ipd-tab-link.active {
    color: #ffffff;
    background: var(--ipd-primary);
    box-shadow: 0 2px 8px rgba(103, 80, 164, 0.3);
}

.ipd-tabs .ipd-tab-return {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    background: #e2e8f0;
    border-radius: var(--ipd-radius-md);
    text-decoration: none;
    transition: var(--ipd-transition);
}

.ipd-tabs .ipd-tab-return:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.ipd-tabs .ipd-nav-divider {
    width: 1px;
    height: 22px;
    background: #cbd5e1;
    margin: 0 6px;
    flex-shrink: 0;
}

.ipd-tabs .ipd-nav-right {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}


/* ── Generic IPD Card ── */
.ipd-card {
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-lg);
    box-shadow: var(--ipd-shadow-sm);
    padding: 18px 20px;
    margin-bottom: 16px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   FORM GRID UTILITIES
   ══════════════════════════════════════════════════════════════════════════════ */

.form-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 12px;
}

.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.four { grid-template-columns: repeat(4, 1fr); }
.form-grid.six { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 992px) {
    .form-grid.three,
    .form-grid.four,
    .form-grid.six {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .form-grid.two,
    .form-grid.three,
    .form-grid.four,
    .form-grid.six {
        grid-template-columns: 1fr;
    }
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ipd-text-main);
}

/* ══════════════════════════════════════════════════════════════════════════════
   DOCTOR CLINICAL ASSESSMENT & NOTES
   ══════════════════════════════════════════════════════════════════════════════ */

.doctor-note {
    padding: 0;
    overflow: hidden;
}

.note-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 20px;
    background: var(--ipd-surface-container);
    border-bottom: 1px solid var(--ipd-border-light);
}

.note-toolbar > div {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.note-toolbar h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ipd-text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ipd-text-main);
    cursor: pointer;
}

.note-toolbar label input[type="radio"] {
    accent-color: var(--ipd-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.note-toolbar label:not(:has(input)) {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 11px;
    color: var(--ipd-text-muted);
    font-weight: 600;
}

.note-toolbar label:not(:has(input)) .e-control-wrapper {
    min-width: 190px;
}

/* ── Assessment Grid Layout ── */
.assessment-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
}

@media (max-width: 1024px) {
    .assessment-grid {
        grid-template-columns: 1fr;
    }
}

.clinical-panel {
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-md);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: var(--ipd-transition);
}

.clinical-panel:hover {
    border-color: var(--ipd-border);
}

.clinical-panel h3 {
    margin: 4px 0 8px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ipd-text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--ipd-border-light);
    padding-bottom: 8px;
}

.clinical-panel h3 span {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    background: var(--ipd-primary);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
}

.clinical-panel h3 em {
    color: var(--ipd-blocked);
    font-style: normal;
}

.clinical-panel label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ipd-text-main);
}

/* ── SOAP Note Grid ── */
.clinical-panel.soap {
    grid-column: span 2;
    background: #ffffff;
}

@media (max-width: 1024px) {
    .clinical-panel.soap {
        grid-column: span 1;
    }
}

.soap-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

@media (max-width: 768px) {
    .soap-grid {
        grid-template-columns: 1fr;
    }
}

.soap-box {
    background: var(--ipd-surface-container);
    border: 1px solid var(--ipd-border-light);
    border-left: 4px solid var(--ipd-primary);
    border-radius: var(--ipd-radius-md);
    padding: 12px 14px;
}

.soap-box.s { border-left-color: #00639b; }
.soap-box.o { border-left-color: #1b5e20; }
.soap-box.a { border-left-color: #b25e00; }
.soap-box.p { border-left-color: #6750a4; }

/* ── Care Plan & Instructions ── */
.clinical-panel.plan-panel {
    grid-column: span 2;
}

@media (max-width: 1024px) {
    .clinical-panel.plan-panel {
        grid-column: span 1;
    }
}

.check-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--ipd-surface-container);
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-md);
    margin-bottom: 8px;
}

.check-row label {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--ipd-text-main);
    background: #ffffff;
    padding: 5px 12px;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-full);
    transition: var(--ipd-transition);
}

.check-row label:hover {
    border-color: var(--ipd-primary);
    background: var(--ipd-primary-light);
}

.check-row label input[type="checkbox"] {
    accent-color: var(--ipd-primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* ── Clinical Orders Table ── */
.clinical-panel.orders-panel {
    grid-column: span 2;
}

@media (max-width: 1024px) {
    .clinical-panel.orders-panel {
        grid-column: span 1;
    }
}

.clinical-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 12px 0;
    font-size: 13px;
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-md);
    overflow: hidden;
}

.clinical-table thead {
    background: var(--ipd-surface-container);
}

.clinical-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    color: var(--ipd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--ipd-border-light);
}

.clinical-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ipd-border-light);
    color: var(--ipd-text-main);
    vertical-align: middle;
}

.clinical-table tbody tr:last-child td {
    border-bottom: none;
}

.clinical-table tbody tr:hover {
    background: var(--ipd-surface-container);
}

.link-button {
    background: transparent;
    border: 1px dashed var(--ipd-primary);
    color: var(--ipd-primary);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--ipd-radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--ipd-transition);
    align-self: flex-start;
}

.link-button:hover {
    background: var(--ipd-primary-light);
    border-style: solid;
}

/* ── Progress Note Layout ── */
.progress-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    padding: 20px;
}

@media (max-width: 1024px) {
    .progress-layout {
        grid-template-columns: 1fr;
    }
}

.progress-layout > section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.condition-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.condition-choice label {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: var(--ipd-radius-full);
    border: 1px solid var(--ipd-border-light);
    background: var(--ipd-surface-container);
    font-size: 13px;
    font-weight: 600;
    transition: var(--ipd-transition);
}

.condition-choice label:hover {
    background: var(--ipd-primary-light);
    border-color: var(--ipd-primary);
}

.condition-choice label input[type="radio"] {
    accent-color: var(--ipd-primary);
    cursor: pointer;
}

.previous-note {
    padding: 12px 14px;
    background: var(--ipd-surface-container);
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-md);
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.previous-note b {
    font-size: 12px;
    color: var(--ipd-text-muted);
}

.previous-note strong {
    font-size: 13px;
    color: var(--ipd-primary);
}

.previous-note p {
    margin: 4px 0 6px 0;
    font-size: 13px;
    color: var(--ipd-text-main);
    line-height: 1.4;
}

.previous-note a {
    font-size: 12px;
    color: var(--ipd-primary);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.previous-note a:hover {
    text-decoration: underline;
}

/* ── Form Actions & Feedback ── */
.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    background: var(--ipd-surface-container);
    border-top: 1px solid var(--ipd-border-light);
}

.form-message {
    margin: 12px 20px 0;
    padding: 10px 16px;
    background: var(--ipd-vacant-bg);
    border: 1px solid var(--ipd-vacant-border);
    color: var(--ipd-vacant);
    border-radius: var(--ipd-radius-md);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   IPD VITAL SIGNS & TPR CHARTS WORKBENCH
   ══════════════════════════════════════════════════════════════════════════════ */

.vitals-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1100px) {
    .vitals-layout {
        grid-template-columns: 1fr;
    }
}

.vitals-layout main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.vitals-layout aside {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.vitals-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: #ffffff;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-lg);
    padding: 12px 18px;
    box-shadow: var(--ipd-shadow-sm);
}

.vitals-toolbar h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ipd-text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.vitals-toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ipd-text-muted);
}

.vitals-toolbar label .e-control-wrapper {
    width: 150px;
}

/* ── TPR Flowsheet Table ── */
.vitals-table-wrap {
    padding: 0;
    overflow-x: auto;
}

.vitals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.vitals-table thead {
    background: var(--ipd-surface-container);
}

.vitals-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--ipd-text-muted);
    border-bottom: 1px solid var(--ipd-border-light);
    white-space: nowrap;
}

.vitals-table tbody th {
    background: var(--ipd-surface-dim);
    color: var(--ipd-text-main);
    font-weight: 600;
    border-right: 1px solid var(--ipd-border-light);
    border-bottom: 1px solid var(--ipd-border-light);
}

.vitals-table tbody th small {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--ipd-text-muted);
}

.vitals-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ipd-border-light);
    color: var(--ipd-text-main);
    font-weight: 500;
    white-space: nowrap;
}

.vitals-table td.abnormal {
    background: var(--ipd-blocked-bg);
    color: var(--ipd-blocked);
    font-weight: 700;
}

.vitals-table td.abnormal::after {
    content: " \f071";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 10px;
    margin-left: 3px;
}

.vitals-table tbody tr:hover td {
    background: var(--ipd-surface-container);
}

.vitals-table tbody tr:hover td.abnormal {
    background: #fbd5d5;
}

/* ── Chart Grid ── */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 900px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

.chart-grid .ipd-card {
    margin-bottom: 0;
    padding: 16px;
}

.chart-grid h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ipd-text-main);
}

.notes-row {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 0;
}

.notes-row label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ipd-text-main);
}

/* ── Vitals Sidebar ── */
.latest-reading > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ipd-border-light);
}

.latest-reading h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.alert-badge {
    background: var(--ipd-blocked-bg);
    color: var(--ipd-blocked);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--ipd-radius-full);
    border: 1px solid var(--ipd-blocked-border);
}

.latest-reading p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px dashed var(--ipd-border-light);
}

.latest-reading p:last-of-type {
    border-bottom: none;
}

.latest-reading p span {
    color: var(--ipd-text-muted);
}

.latest-reading p b {
    font-weight: 700;
    color: var(--ipd-text-main);
}

.latest-reading p.danger b {
    color: var(--ipd-blocked);
    background: var(--ipd-blocked-bg);
    padding: 1px 6px;
    border-radius: 4px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--ipd-border-light);
    margin: 0;
}

.summary-row:last-of-type {
    border-bottom: none;
}

.summary-row span {
    color: var(--ipd-text-main);
    font-weight: 600;
}

.summary-row b {
    color: var(--ipd-blocked);
}

.summary-row small {
    color: var(--ipd-primary);
}

.alerts h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alerts h3 span {
    background: var(--ipd-blocked);
    color: #ffffff;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: var(--ipd-radius-full);
}

.alerts p {
    margin: 0 0 6px 0;
    padding: 6px 10px;
    background: var(--ipd-blocked-bg);
    border-left: 3px solid var(--ipd-blocked);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ipd-blocked);
}

.export-button {
    width: 100%;
}

/* ══════════════════════════════════════════════════════════════════════════════
   PATIENT BANNER — MISSING CLASS DEFINITIONS (M3, M4, P4, P5 fixes)
   ══════════════════════════════════════════════════════════════════════════════ */

/* Banner expand/collapse toggle button */
.banner-expand-btn,
.banner-toggle-btn {
    background: transparent;
    border: 1px solid var(--ipd-border-light);
    border-radius: var(--ipd-radius-sm);
    padding: 4px 10px;
    color: var(--ipd-text-muted);
    cursor: pointer;
    transition: var(--ipd-transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.banner-expand-btn:hover,
.banner-toggle-btn:hover {
    background: var(--ipd-surface-container);
    color: var(--ipd-primary);
    border-color: var(--ipd-primary);
}

/* Extended banner details grid */
.extended-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

/* Meta item in identity-sub row */
.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: var(--ipd-text-muted);
}

.meta-item strong {
    color: var(--ipd-text-main);
    font-weight: 600;
}

/* Length-of-stay badge in banner */
.stay-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--ipd-primary);
    font-weight: 600;
}

/* Payer type colour coding */
.payer-tag {
    font-weight: 600;
}
.payer-tag.insurance, .payer-tag.tpa {
    color: #00639b;
}
.payer-tag.self {
    color: var(--ipd-text-muted);
}
.payer-tag.corporate {
    color: #1b5e20;
}

/* Diagnosis text in expanded banner */
.diagnosis-text {
    color: var(--ipd-text-main);
    font-size: 13px;
    font-style: italic;
    line-height: 1.4;
}

/* Sub-text in extended banner items */
.ext-sub {
    font-size: 11px;
    color: var(--ipd-text-muted);
    margin-top: 2px;
}

/* ── Vacant Bed Card — Balanced 3-line layout ── */
.vacant-state-structured {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    padding: 6px 0;
    min-height: 72px;
}

.vacant-ready-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #14532d;
}

.vacant-ready-label i {
    color: #16a34a;
    font-size: 13px;
}

.vacant-tariff-line {
    font-size: 12px;
    font-weight: 700;
    color: #15803d;
    letter-spacing: 0.2px;
}

.vacant-sanitized-line {
    font-size: 11px;
    color: #4b5563;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.vacant-sanitized-line i {
    color: #9ca3af;
    font-size: 11px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   DOCTOR NOTE CLINICAL WORKBENCH STYLES (MATCHING DESIGN SPECIFICATION)
   ══════════════════════════════════════════════════════════════════════════════ */

.dn-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-top: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Top Toolbar */
.dn-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.dn-toolbar-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.2px;
}

.dn-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.dn-ctrl-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dn-ctrl-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: none;
}

.dn-ctrl-label em {
    color: #ef4444;
    font-style: normal;
}

.dn-datetime-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dn-input-field {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: #1e293b;
    background: #ffffff;
    outline: none;
    transition: border-color 0.15s ease-in-out;
}

.dn-input-field:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.dn-select-field {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 28px 6px 10px;
    font-size: 13px;
    color: #1e293b;
    background: #ffffff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") no-repeat right 6px center / 16px 16px;
    appearance: none;
    cursor: pointer;
    min-width: 160px;
}

.dn-select-field:focus {
    border-color: #2563eb;
    outline: none;
}

/* Syncfusion DatePicker & TimePicker Custom Outline Styling for Doctor Note */
.dn-datetime-inline .e-control-wrapper,
.dn-sf-picker.e-control-wrapper {
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    min-height: 33px !important;
    height: 33px !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    padding: 0 !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

.dn-datetime-inline .e-control-wrapper::before,
.dn-datetime-inline .e-control-wrapper::after,
.dn-sf-picker.e-control-wrapper::before,
.dn-sf-picker.e-control-wrapper::after {
    display: none !important;
}

.dn-datetime-inline .e-control-wrapper:focus-within,
.dn-datetime-inline .e-control-wrapper.e-input-focus,
.dn-sf-picker.e-control-wrapper:focus-within,
.dn-sf-picker.e-control-wrapper.e-input-focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1) !important;
    outline: none !important;
}

.dn-datetime-inline .e-control-wrapper .e-input,
.dn-sf-picker .e-input {
    font-size: 13px !important;
    color: #1e293b !important;
    height: 31px !important;
    padding: 4px 8px 4px 10px !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
}

.dn-datetime-inline .e-control-wrapper .e-input-group-icon,
.dn-sf-picker .e-input-group-icon {
    font-size: 13px !important;
    color: #64748b !important;
    min-height: 31px !important;
    height: 31px !important;
    width: 28px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
}

.dn-datetime-inline .e-control-wrapper .e-input-group-icon:hover,
.dn-sf-picker .e-input-group-icon:hover {
    color: #2563eb !important;
}

/* 2-Column Main Workspace */
.dn-workspace-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1200px) {
    .dn-workspace-grid {
        grid-template-columns: 1fr;
    }
}

.dn-left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 2-Column Clinical Grid Layout */
.dn-clinical-2col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.dn-col-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* White space & padding between Chief Complaint and History */
.dn-chief-complaint-panel {
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.dn-full-width-panel {
    width: 100%;
}

@media (max-width: 1024px) {
    .dn-clinical-2col-grid {
        grid-template-columns: 1fr;
    }
}

/* Vitals Summary Grid Table */
.dn-vitals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: #ffffff;
}

.dn-vitals-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 8px 8px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
}

.dn-vitals-table td {
    padding: 7px 8px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
    white-space: nowrap;
}

.dn-vitals-table tbody tr:hover {
    background: #f8fafc;
}

.dn-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.dn-status-badge.normal {
    background: #dcfce7;
    color: #15803d;
}

.dn-status-badge.warning {
    background: #fef3c7;
    color: #b45309;
}

.dn-status-badge.alert {
    background: #fee2e2;
    color: #b91c1c;
}

/* Numbered Section Panel */
.dn-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.dn-panel-header {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dn-panel-header .dn-num {
    color: #2563eb;
    font-weight: 700;
}

.dn-panel-header em {
    color: #ef4444;
    font-style: normal;
}

.dn-panel-header .dn-circle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid #2563eb;
    color: #2563eb;
    font-size: 11px;
    font-weight: 700;
}

/* Textarea with Character Counter */
.dn-textarea-wrapper {
    position: relative;
}

.dn-textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px 12px;
    padding-bottom: 24px;
    font-size: 13px;
    line-height: 1.5;
    color: #1e293b;
    background: #ffffff;
    box-sizing: border-box;
    resize: vertical;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s ease-in-out;
}

.dn-textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.dn-char-counter {
    position: absolute;
    bottom: 6px;
    right: 12px;
    font-size: 11px;
    color: #94a3b8;
    pointer-events: none;
    user-select: none;
}

/* History Subsections */
.dn-history-item {
    margin-bottom: 12px;
}

.dn-history-item:last-child {
    margin-bottom: 0;
}

.dn-sub-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

/* Examination Controls & Vitals */
.dn-exam-grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 14px;
}

@media (max-width: 640px) {
    .dn-exam-grid-row {
        grid-template-columns: 1fr;
    }
}

.dn-vitals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 14px;
}

@media (max-width: 768px) {
    .dn-vitals-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dn-vital-box-action {
        grid-column: span 2;
    }
}

.dn-btn-add-vitals {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    background: #2563eb;
    color: #ffffff;
    border: 1px solid #1d4ed8;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease-in-out;
    width: 100%;
}

.dn-btn-add-vitals:hover {
    background: #1d4ed8;
    border-color: #1e40af;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.dn-btn-add-vitals:active {
    background: #1e40af;
    transform: translateY(1px);
}

.dn-vital-action-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.dn-btn-update-vitals {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    background: #059669;
    color: #ffffff;
    border: 1px solid #047857;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease-in-out;
    flex: 1;
}

.dn-btn-update-vitals:hover {
    background: #047857;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25);
}

.dn-btn-update-vitals:active {
    background: #065f46;
    transform: translateY(1px);
}

.dn-btn-cancel-edit-vitals {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    width: 38px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.dn-btn-cancel-edit-vitals:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.dn-vital-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dn-input-unit-group {
    display: flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    overflow: hidden;
}

.dn-input-unit-group:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.dn-input-unit-group input {
    border: none;
    outline: none;
    padding: 6px 10px;
    font-size: 13px;
    color: #1e293b;
    width: 100%;
    min-width: 0;
}

.dn-bp-inputs {
    display: flex;
    align-items: center;
    flex: 1;
}

.dn-bp-inputs input {
    text-align: center;
    padding: 6px 4px;
}

.dn-bp-separator {
    color: #94a3b8;
    font-weight: 600;
    padding: 0 2px;
}

.dn-unit-label {
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    white-space: nowrap;
}

/* Diagnosis Section */
.dn-diag-tags-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 10px;
    background: #ffffff;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.dn-diag-tags-wrapper:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.dn-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3e8ff;
    color: #7e22ce;
    border: 1px solid #e9d5ff;
    border-radius: 14px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
}

.dn-tag-close {
    border: none;
    background: transparent;
    color: #7e22ce;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 0;
}

.dn-tag-search-input {
    border: none;
    outline: none;
    font-size: 13px;
    color: #1e293b;
    flex: 1;
    min-width: 140px;
}

.dn-icon-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.dn-icon-input-wrapper input {
    width: 100%;
    padding-right: 32px;
}

.dn-icon-input-wrapper .dn-input-icon {
    position: absolute;
    right: 10px;
    color: #94a3b8;
    pointer-events: none;
    font-size: 13px;
}

/* Syncfusion ComboBox Custom Styling for Doctor Note */
.dn-sf-combo.e-control-wrapper {
    border-radius: 6px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    min-height: 38px !important;
    box-shadow: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.dn-sf-combo.e-control-wrapper:focus-within,
.dn-sf-combo.e-control-wrapper.e-input-focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1) !important;
}

.dn-sf-combo .e-input {
    font-size: 13px !important;
    padding: 6px 12px !important;
    height: 36px !important;
    color: #1e293b !important;
}

.dn-sf-combo.dn-sf-combo-sm.e-control-wrapper {
    min-height: 30px !important;
}

.dn-sf-combo.dn-sf-combo-sm .e-input {
    height: 28px !important;
    font-size: 12px !important;
    padding: 2px 8px !important;
}

/* Syncfusion MultiSelect Custom Styling for Doctor Note */
.dn-sf-multiselect.e-control-wrapper {
    border-radius: 6px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    min-height: 38px !important;
    box-shadow: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 2px 4px !important;
}

.dn-sf-multiselect.e-control-wrapper:focus-within,
.dn-sf-multiselect.e-control-wrapper.e-input-focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1) !important;
}

.dn-sf-multiselect .e-chips {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    border: 1px solid #bfdbfe !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 2px 8px !important;
    margin: 2px 4px 2px 0 !important;
}

.dn-sf-multiselect .e-chips-close {
    color: #1d4ed8 !important;
}

.dn-sf-multiselect .e-delim-values {
    font-size: 13px !important;
    color: #1e293b !important;
}

/* Diagnosis 2-ComboBox Row */
.dn-diag-combos-grid {
   
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}

@media (max-width: 640px) {
    .dn-diag-combos-grid {
        flex-direction: column;
    }
}

/* Plan / Instructions Checkboxes */
.dn-checkboxes-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.dn-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #334155;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.dn-checkbox-label input[type="checkbox"] {
    accent-color: #2563eb;
    width: 15px;
    height: 15px;
    cursor: pointer;
    margin: 0;
}

/* New / Modified Orders Section */
.dn-order-tabs {
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 14px;
    overflow-x: auto;
}

.dn-order-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 4px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.dn-order-tab-btn:hover {
    color: #1e293b;
}

.dn-order-tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.dn-orders-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 13px;
}

.dn-orders-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.dn-orders-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.dn-orders-table input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 12px;
    color: #1e293b;
    background: #ffffff;
    box-sizing: border-box;
}

.dn-orders-table input:focus {
    border-color: #2563eb;
    outline: none;
}

.dn-btn-trash {
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.15s;
}

.dn-btn-trash:hover {
    color: #ef4444;
}

.dn-btn-edit {
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.15s;
}

.dn-btn-edit:hover {
    color: #2563eb;
}

.dn-add-order-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    transition: opacity 0.15s;
}

.dn-add-order-link:hover {
    text-decoration: underline;
}

/* Right Column: Previous Progress Notes Timeline */
.dn-timeline-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.dn-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
}

.dn-timeline-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.dn-timeline-filter {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 24px 4px 8px;
    font-size: 12px;
    color: #475569;
    background: #ffffff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") no-repeat right 4px center / 14px 14px;
    appearance: none;
    cursor: pointer;
}

.dn-timeline-list {
    position: relative;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}

.dn-timeline-list::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 16px;
    width: 2px;
    background: #e2e8f0;
}

.dn-timeline-item {
    position: relative;
}

.dn-timeline-item .dn-node {
    position: absolute;
    left: -20px;
    top: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #3b82f6;
    box-sizing: border-box;
}

.dn-timeline-item .dn-node.current {
    border-color: #16a34a;
    background: #ffffff;
    position: absolute;
    left: -20px;
    top: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dn-timeline-item .dn-node.current::after {
    content: "";
    width: 6px;
    height: 6px;
    background: #16a34a;
    border-radius: 50%;
}

.dn-timeline-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 12px;
    transition: box-shadow 0.15s ease-in-out;
}

.dn-timeline-card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dn-timeline-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.dn-note-date {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.dn-note-date.current {
    color: #15803d;
}

.dn-badge-current {
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.2;
}

.dn-doctor-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.dn-note-text {
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
    margin: 0 0 6px 0;
}

.dn-view-link {
    color: #2563eb;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.dn-view-link:hover {
    text-decoration: underline;
}

.dn-btn-all-notes {
    width: 100%;
    border: 1px solid #2563eb;
    background: #ffffff;
    color: #2563eb;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.15s;
}

.dn-btn-all-notes:hover {
    background: #eff6ff;
}

/* Bottom Action Bar */
.dn-bottom-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding-top: 18px;
    margin-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.dn-btn-cancel {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.dn-btn-cancel:hover {
    background: #f8fafc;
    color: #1e293b;
}

.dn-btn-draft {
    border: 1px solid #2563eb;
    background: #ffffff;
    color: #2563eb;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.dn-btn-draft:hover {
    background: #eff6ff;
}

.dn-btn-sign {
    border: none;
    background: #2563eb;
    color: #ffffff;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.15s;
}

.dn-btn-sign:hover {
    background: #1d4ed8;
}

.dn-btn-sign:disabled,
.dn-btn-draft:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
/* ==========================================
       Syncfusion TPR Flowsheet Grid
       Material-style design
       ========================================== */

.vitals-grid-card {
    position: relative;
    width: 100%;
    min-width: 0;
    padding: 0 !important;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e0e3e7;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

/* Legend */

.vitals-grid-legend {
    min-height: 40px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    color: var(--ipd-text-muted, #64748b);
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    font-size: 11px;
    font-weight: 500;
}

    .vitals-grid-legend span {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

.status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    display: inline-block;
    border-radius: 50%;
}

    .status-dot.normal {
        background: #16a34a;
    }

    .status-dot.abnormal {
        background: #dc2626;
    }

/* Grid container */

.ipd-vitals-grid.e-grid {
    width: 100%;
    border: 0 !important;
    border-radius: 0;
}

.ipd-vitals-grid .e-gridheader {
    border: 0 !important;
}

/* Grid headers */

.ipd-vitals-grid .e-headercell {
    height: 52px !important;
    padding: 7px 10px !important;
    color: #334155;
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    vertical-align: middle;
}

.ipd-vitals-grid .e-headercelldiv {
    padding: 0 !important;
    overflow: visible !important;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    white-space: nowrap;
}

/* Time column header */

.vitals-time-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
    white-space: nowrap;
}

    .vitals-time-header strong {
        color: #1e293b;
        font-size: 11.5px;
        font-weight: 700;
        line-height: 15px;
    }

    .vitals-time-header small {
        color: #64748b;
        font-size: 9.5px;
        font-weight: 400;
        line-height: 12px;
    }

/* Body rows */

.ipd-vitals-grid .e-row {
    height: 54px !important;
}

.ipd-vitals-grid .e-rowcell {
    height: 54px !important;
    padding: 6px 10px !important;
    vertical-align: middle;
    background: #ffffff;
    border-color: #e2e8f0 !important;
}

.ipd-vitals-grid .e-row:nth-child(even) .e-rowcell {
    background: #fcfcfd;
}

/* Frozen Parameter column */

.ipd-vitals-grid .e-leftfreeze {
    z-index: 4 !important;
    background: #ffffff !important;
    border-right: 1px solid #cbd5e1 !important;
    box-shadow: 5px 0 8px rgba(15, 23, 42, 0.06);
}

.ipd-vitals-grid .e-row:nth-child(even) .e-leftfreeze {
    background: #fcfcfd !important;
}

.ipd-vitals-grid .e-headercell.e-leftfreeze {
    z-index: 5 !important;
    background: #f1f5f9 !important;
}

/* Parameter and range */

.vitals-parameter-cell {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    white-space: nowrap;
}

    .vitals-parameter-cell strong {
        overflow: hidden;
        color: #1e293b;
        font-size: 12px;
        font-weight: 700;
        line-height: 16px;
        text-overflow: ellipsis;
    }

    .vitals-parameter-cell small {
        overflow: hidden;
        color: #64748b;
        font-size: 10px;
        font-weight: 400;
        line-height: 13px;
        text-overflow: ellipsis;
    }

/* Normal and abnormal value cells */

.vitals-value-cell {
    width: 100%;
    min-height: 34px;
    padding: 5px 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    white-space: nowrap;
}

    .vitals-value-cell strong {
        font-size: 12px;
        font-weight: 700;
        line-height: 18px;
        font-variant-numeric: tabular-nums;
    }

    /* Normal value */

    .vitals-value-cell.normal {
        color: #166534;
        background: #f0fdf4;
        border-color: #bbf7d0;
    }

    /* Abnormal value */

    .vitals-value-cell.abnormal {
        color: #b91c1c;
        background: #fef2f2;
        border-color: #fecaca;
    }

/* Horizontal scrolling */

.ipd-vitals-grid .e-gridcontent {
    overflow: hidden;
}

.ipd-vitals-grid .e-content {
    overflow-x: auto !important;
    overflow-y: hidden;
}

    .ipd-vitals-grid .e-content::-webkit-scrollbar {
        height: 8px;
    }

    .ipd-vitals-grid .e-content::-webkit-scrollbar-track {
        background: #f1f5f9;
    }

    .ipd-vitals-grid .e-content::-webkit-scrollbar-thumb {
        background: #94a3b8;
        border-radius: 8px;
    }

        .ipd-vitals-grid .e-content::-webkit-scrollbar-thumb:hover {
            background: var(--ipd-primary, #2563eb);
        }

@media (max-width: 768px) {
    .vitals-grid-legend {
        justify-content: flex-start;
    }
}

/* Room-based Material 3 vitals toolbar */

.vitals-toolbar {
    padding: 14px 16px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    background: #fffbfe;
    border: 1px solid #e7e0ec;
    border-radius: 12px;
}

.vitals-toolbar-title h3 {
    margin: 0;
    color: #1d1b20;
    font-size: 16px;
    font-weight: 600;
}

.vitals-toolbar-title small {
    display: block;
    margin-top: 4px;
    color: #6750a4;
    font-size: 11px;
    font-weight: 600;
}

.vitals-toolbar-controls {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.vital-toolbar-field {
    width: 170px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .vital-toolbar-field.room-field {
        width: 180px;
    }

    .vital-toolbar-field.frequency-field {
        width: 175px;
    }

    .vital-toolbar-field.date-field {
        width: 135px;
    }

    .vital-toolbar-field > span {
        color: #49454f;
        font-size: 10px;
        font-weight: 600;
    }

/* Grid */

.vitals-grid-card {
    width: 100%;
    min-width: 0;
    padding: 0 !important;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e7e0ec;
    border-radius: 12px;
}

.vitals-grid-topbar {
    min-height: 50px;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fffbfe;
    border-bottom: 1px solid #e7e0ec;
}

    .vitals-grid-topbar > div:first-child {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .vitals-grid-topbar strong {
        color: #1d1b20;
        font-size: 13px;
        font-weight: 600;
    }

    .vitals-grid-topbar small {
        color: #79747e;
        font-size: 10px;
    }

.vitals-status-legend {
    display: flex;
    align-items: center;
    gap: 14px;
}

    .vitals-status-legend span {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        color: #49454f;
        font-size: 10px;
    }

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

    .status-dot.normal {
        background: #188038;
    }

    .status-dot.abnormal {
        background: #ba1a1a;
    }

.ipd-vitals-grid.e-grid {
    border: 0 !important;
}

.ipd-vitals-grid .e-headercell {
    height: 52px !important;
    padding: 7px 10px !important;
    background: #f7f2fa !important;
    border-color: #e7e0ec !important;
}

.ipd-vitals-grid .e-headercelldiv {
    padding: 0 !important;
    color: #1d1b20;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.ipd-vitals-grid .e-rowcell {
    height: 58px !important;
    padding: 7px 10px !important;
    vertical-align: middle;
    background: #fff;
    border-color: #e7e0ec !important;
}

/* Frozen Time column */

.ipd-vitals-grid .e-leftfreeze {
    z-index: 4 !important;
    background: #fffbfe !important;
    border-right: 1px solid #cac4d0 !important;
    box-shadow: 4px 0 8px rgba(29, 27, 32, 0.08);
}

.ipd-vitals-grid .e-headercell.e-leftfreeze {
    z-index: 5 !important;
    background: #f3edf7 !important;
}

.vital-time-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.time-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    color: #6750a4;
    background: #eaddff;
    border-radius: 50%;
    font-size: 11px;
}

.vital-time-cell > div {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vital-time-cell strong {
    color: #1d1b20;
    font-size: 11px;
}

.vital-time-cell small {
    color: #79747e;
    font-size: 9px;
}

/* Parameter headers */

.vital-column-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    white-space: nowrap;
}

    .vital-column-header strong {
        color: #1d1b20;
        font-size: 11px;
        font-weight: 600;
    }

    .vital-column-header small {
        color: #79747e;
        font-size: 9px;
        font-weight: 400;
    }

/* Value-only status cells */

.vital-value-cell {
    min-height: 34px;
    padding: 5px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 1px solid transparent;
    border-radius: 8px;
    white-space: nowrap;
}

    .vital-value-cell strong {
        font-size: 12px;
        font-weight: 700;
        font-variant-numeric: tabular-nums;
    }

    .vital-value-cell span {
        font-size: 9px;
        font-weight: 500;
    }

    .vital-value-cell.normal {
        color: #146c2e;
        background: #e8f5e9;
        border-color: #a8d5b2;
    }

    .vital-value-cell.abnormal {
        color: #ba1a1a;
        background: #ffdad6;
        border-color: #ffb4ab;
    }

.vital-position {
    color: #49454f;
    font-size: 11px;
    white-space: nowrap;
}

.ipd-vitals-grid .e-content {
    overflow-x: auto !important;
}

@media (max-width: 900px) {
    .vitals-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .vitals-toolbar-controls {
        width: 100%;
    }
}

/* =====================================================
       COMPACT VITALS SIDEBAR UI
       CSS only — no Razor or C# changes
       ===================================================== */

.vitals-sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

    /* Remove excessive spacing between cards */

    .vitals-sidebar > .ipd-card {
        margin: 0 !important;
        padding: 12px 14px !important;
        border-radius: 12px;
        border-color: #e7e0ec;
        box-shadow: 0 1px 3px rgba(29, 27, 32, 0.08);
    }

    /* Common sidebar headings */

    .vitals-sidebar .sidebar-head,
    .vitals-sidebar .ipd-card > h3 {
        min-height: 24px;
        margin: 0 0 9px !important;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

        .vitals-sidebar .sidebar-head h3,
        .vitals-sidebar .ipd-card > h3 {
            margin: 0 !important;
            color: #1d1b20;
            font-size: 13px;
            font-weight: 700;
            line-height: 18px;
        }

    .vitals-sidebar h3 i {
        width: 17px;
        color: #6750a4;
        text-align: center;
    }

    /* Current badge */

    .vitals-sidebar .badge-primary {
        padding: 3px 7px;
        color: #ffffff;
        background: #6750a4;
        border-radius: 999px;
        font-size: 8px;
        font-weight: 700;
        line-height: 12px;
        letter-spacing: 0.2px;
    }

/* =====================================================
       Latest Reading
       ===================================================== */

.quick-vitals-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

    .quick-vitals-grid .vcard {
        min-width: 0;
        min-height: 48px;
        padding: 7px 8px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        background: #f9f7fb;
        border: 1px solid #eee8f1;
        border-radius: 8px;
    }

    .quick-vitals-grid .vcard-label {
        display: flex;
        align-items: center;
        gap: 5px;
        color: #49454f;
        font-size: 9px;
        font-weight: 600;
        line-height: 12px;
        white-space: nowrap;
    }

        .quick-vitals-grid .vcard-label i {
            width: 12px;
            color: #6750a4;
            font-size: 10px;
            text-align: center;
        }

    .quick-vitals-grid .vcard-value {
        color: #1d1b20;
        font-size: 15px;
        font-weight: 700;
        line-height: 18px;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

        .quick-vitals-grid .vcard-value small {
            margin-left: 2px;
            color: #79747e;
            font-size: 8px;
            font-weight: 500;
        }

    /* Abnormal latest value */

    .quick-vitals-grid .vcard.alert-card {
        background: #ffdad6;
        border-color: #ffb4ab;
    }

        .quick-vitals-grid .vcard.alert-card .vcard-label,
        .quick-vitals-grid .vcard.alert-card .vcard-label i,
        .quick-vitals-grid .vcard.alert-card .vcard-value,
        .quick-vitals-grid .vcard.alert-card .vcard-value small {
            color: #ba1a1a;
        }

/* =====================================================
       24-Hour Extremes
       ===================================================== */

.range-summary .summary-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.range-summary .srow {
    min-width: 0;
    min-height: 52px;
    padding: 7px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    background: #f9f7fb;
    border: 1px solid #eee8f1;
    border-radius: 8px;
}

    .range-summary .srow > span:first-child {
        overflow: hidden;
        color: #49454f;
        font-size: 9px;
        font-weight: 700;
        line-height: 12px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .range-summary .srow > div {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-wrap: wrap;
    }

.range-summary .min-tag,
.range-summary .max-tag {
    padding: 2px 5px;
    border-radius: 5px;
    font-size: 8px;
    font-weight: 700;
    line-height: 12px;
    white-space: nowrap;
}

.range-summary .min-tag {
    color: #4f378b;
    background: #eaddff;
}

.range-summary .max-tag {
    color: #7d5260;
    background: #ffd8e4;
}

/* =====================================================
       Bedside Observation Notes
       ===================================================== */

.shift-notes {
    min-height: 0 !important;
}

    .shift-notes .e-input-group,
    .shift-notes .e-input-group.e-control-wrapper {
        min-height: 70px !important;
        border: 1px solid #cac4d0 !important;
        border-radius: 8px !important;
        box-shadow: none !important;
        overflow: hidden;
    }

        .shift-notes .e-input-group.e-input-focus,
        .shift-notes .e-input-group.e-control-wrapper.e-input-focus {
            border: 2px solid #6750a4 !important;
        }

    .shift-notes textarea.e-input {
        min-height: 68px !important;
        max-height: 90px !important;
        padding: 8px 10px !important;
        color: #1d1b20;
        font-size: 10px !important;
        line-height: 15px !important;
        resize: vertical;
    }

/* =====================================================
       Alerts
       ===================================================== */

.alerts-panel .alerts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alerts-panel .alert-item {
    margin: 0 !important;
    padding: 7px 8px !important;
    display: flex;
    align-items: flex-start;
    gap: 7px;
    color: #ba1a1a;
    background: #ffdad6;
    border: 1px solid #ffb4ab;
    border-radius: 8px;
    font-size: 9px !important;
    line-height: 14px;
}

    .alerts-panel .alert-item i {
        margin-top: 2px;
        flex: 0 0 auto;
    }

/* Export button */

.vitals-sidebar .export-button {
    min-height: 36px;
    margin: 0 !important;
    font-size: 10px !important;
    border-radius: 8px !important;
}

/* =====================================================
       Tablet
       ===================================================== */

@media (min-width: 769px) and (max-width: 1100px) {
    .vitals-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

        .vitals-sidebar .export-button {
            grid-column: 1 / -1;
        }
}

/* =====================================================
       Small mobile
       ===================================================== */

@media (max-width: 380px) {
    .quick-vitals-grid, .range-summary .summary-list {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   Bootstrap 4 to Bootstrap 5 Spacing Compatibility Shims
   ===================================================== */
.mr-0 { margin-right: 0 !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.mr-4 { margin-right: 1.5rem !important; }
.mr-5 { margin-right: 3rem !important; }
.mr-auto { margin-right: auto !important; }

.ml-0 { margin-left: 0 !important; }
.ml-1 { margin-left: 0.25rem !important; }
.ml-2 { margin-left: 0.5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.ml-4 { margin-left: 1.5rem !important; }
.ml-5 { margin-left: 3rem !important; }
.ml-auto { margin-left: auto !important; }

.pr-0 { padding-right: 0 !important; }
.pr-1 { padding-right: 0.25rem !important; }
.pr-2 { padding-right: 0.5rem !important; }
.pr-3 { padding-right: 1rem !important; }
.pr-4 { padding-right: 1.5rem !important; }
.pr-5 { padding-right: 3rem !important; }

.pl-0 { padding-left: 0 !important; }
.pl-1 { padding-left: 0.25rem !important; }
.pl-2 { padding-left: 0.5rem !important; }
.pl-3 { padding-left: 1rem !important; }
.pl-4 { padding-left: 1.5rem !important; }
.pl-5 { padding-left: 3rem !important; }

/* ── Dedicated IPD Maximized Workspace Layout ── */
.ipd-maximized-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100vw;
    background-color: #f8fafc;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
}

.ipd-top-bar {
    height: 42px;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ipd-top-bar a.ipd-btn-exit-menu {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.12);
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.ipd-top-bar a.ipd-btn-exit-menu:hover {
    background: #2563eb;
    color: #ffffff;
}

.ipd-top-bar .ipd-top-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #f1f5f9;
}

.ipd-top-bar .ipd-top-brand i {
    color: #38bdf8;
    font-size: 15px;
}

.ipd-top-bar .ipd-top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ipd-top-bar .ipd-user-chip {
    font-size: 11px;
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.08);
    padding: 3px 8px;
    border-radius: 4px;
}

.ipd-top-bar .ipd-fs-toggle {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    font-size: 13px;
    border-radius: 4px;
    transition: color 0.15s;
}

.ipd-top-bar .ipd-fs-toggle:hover {
    color: #ffffff;
}

.ipd-maximized-body {
    flex: 1;
    width: 100%;
    background-color: #ffffff;
}

/* Maximized View - Ergonomic Compact Header */
.ipd-maximized-wrapper .ipd-header {
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: none;
    gap: 8px;
}

.ipd-maximized-wrapper .ipd-header-title h2 {
    font-size: 15px;
    font-weight: 600;
}

/* Suppress verbose tutorial/explanatory paragraphs for professional clinical staff */
.ipd-maximized-wrapper .ipd-header-title p {
    display: none !important;
}

/* ── Global Inpatient Quick Switcher (Alt+P / F1) ── */
.ipd-patient-switcher-wrap {
    position: relative;
    flex: 1 1 280px;
    max-width: 380px;
    min-width: 230px;
}

.ipd-patient-switcher-box {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    padding: 0 10px;
    height: 34px;
    transition: all .18s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    box-sizing: border-box;
}

.ipd-patient-switcher-box:focus-within {
    border-color: var(--ipd-primary, #0284c7);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    background: #ffffff;
}

.ipd-patient-switcher-inp {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 13px;
    color: #0f172a;
    font-weight: 500;
}

.ipd-patient-switcher-inp::placeholder {
    color: #94a3b8;
    font-size: 11.5px;
}

.ipd-kbd-tag {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    white-space: nowrap;
    user-select: none;
}

.ipd-patient-switcher-drop {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: max(100%, 380px);
    min-width: 380px;
    z-index: 3000;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    max-height: 420px;
    overflow: hidden;
}

.ipd-patient-drop-list {
    position: relative;
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: 360px;
    overscroll-behavior: contain;
}

.ipd-patient-drop-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    border-left: 3px solid transparent;
    transition: all .12s;
}

.ipd-patient-drop-item:last-child {
    border-bottom: none;
}

.ipd-patient-drop-item:hover, .ipd-patient-drop-item.active {
    background: #f0f7ff;
    border-left-color: var(--ipd-primary, #0284c7);
}

.ipd-patient-drop-item.current-patient {
    background: #f8fafc;
}

.ipd-patient-drop-item.current-patient:hover, .ipd-patient-drop-item.current-patient.active {
    background: #ecfdf5;
    border-left-color: #10b981;
}

.ipd-patient-switcher-footer {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 7px 12px;
    font-size: 11px;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.03);
    user-select: none;
}





/* ============================================================
   DOCTOR CLINICAL NOTE - RESPONSIVE CSS
   Desktop | Laptop | Tablet | Mobile
   CSS-only - No Razor or business logic changes
   ============================================================ */

/* 1. Base responsive safety */

.dn-container,
.dn-container *,
.dn-container *::before,
.dn-container *::after {
    box-sizing: border-box;
}

.dn-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: auto;
    overflow-x: clip;
    color: var(--md-sys-color-on-surface, #1d1b20);
}

    .dn-container :is( .dn-workspace-grid, .dn-left-col, .dn-right-col, .dn-clinical-2col-grid, .dn-col-stack, .dn-panel, .dn-ctrl-group, .dn-combo-wrapper, .dn-textarea-wrapper, .dn-vital-box, .dn-timeline-panel ) {
        min-width: 0;
        max-width: 100%;
    }

    .dn-container .dn-workspace-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
        align-items: start;
        gap: 16px;
    }

    .dn-container .dn-clinical-2col-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: 16px;
    }

    .dn-container .dn-col-stack {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

        .dn-container .dn-col-stack > .dn-panel {
            margin: 0;
        }

    .dn-container .dn-full-width-panel {
        width: 100%;
    }

    .dn-container .dn-panel {
        background: var(--md-sys-color-surface, #fff);
        color: var(--md-sys-color-on-surface, #1d1b20);
        border-color: var(--md-sys-color-outline-variant, #ded8e4);
    }

    /* 2. Toolbar */

    .dn-container .dn-toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        min-width: 0;
    }

        .dn-container .dn-toolbar > div {
            min-width: 0;
            max-width: 100%;
            flex-wrap: wrap;
        }

    .dn-container .dn-toolbar-controls {
        display: flex;
        flex-wrap: wrap;
        align-items: end;
        gap: 12px;
        min-width: 0;
    }

    .dn-container .dn-datetime-inline {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        min-width: 0;
    }

        .dn-container .dn-datetime-inline .dn-input-field {
            max-width: 100%;
        }

    /* 3. Form controls */

    .dn-container :is( .dn-input-field, .dn-select-field, .dn-textarea, .dn-ctrl-group select, .dn-ctrl-group input ) {
        max-width: 100%;
        min-width: 0;
    }

    .dn-container .dn-textarea {
        display: block;
        width: 100%;
        resize: vertical;
    }

    .dn-container .dn-exam-grid-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

        .dn-container .dn-exam-grid-row > * {
            min-width: 0;
        }

    /* Syncfusion controls */

    .dn-container :is( .dn-sf-multiselect, .dn-sf-combo, .e-control-wrapper, .e-input-group, .e-multi-select-wrapper ) {
        max-width: 100%;
        min-width: 0;
    }

    .dn-container .dn-combo-wrapper .e-multi-select-wrapper {
        width: 100%;
    }

    /* 4. Vitals */

    .dn-container .dn-vitals-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .dn-container .dn-vital-box {
        min-width: 0;
    }

    .dn-container .dn-input-unit-group {
        display: flex;
        align-items: center;
        min-width: 0;
        max-width: 100%;
    }

        .dn-container .dn-input-unit-group input {
            min-width: 0;
            max-width: 100%;
            flex: 1 1 auto;
        }

    .dn-container .dn-bp-inputs {
        display: flex;
        align-items: center;
        min-width: 0;
        flex: 1 1 auto;
    }

        .dn-container .dn-bp-inputs input {
            min-width: 0;
            width: 0 !important;
            flex: 1 1 0;
        }

    .dn-container .dn-unit-label {
        flex-shrink: 0;
    }

    .dn-container .dn-vital-action-btns {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
    }

    /* 5. Clinical plan checkboxes */

    .dn-container .dn-checkboxes-row {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px;
    }

    .dn-container .dn-checkbox-label {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    /* 6. Recorded vitals and medication tables */

    .dn-container .dn-vitals-table,
    .dn-container .dn-orders-table {
        width: 100%;
        border-collapse: collapse;
    }

    .dn-container .dn-vitals-table {
        min-width: 720px;
    }

    .dn-container .dn-orders-table {
        min-width: 880px;
    }

    .dn-container .dn-full-width-panel {
        overflow-x: auto;
    }

        .dn-container .dn-full-width-panel .dn-panel-header {
            min-width: 0;
        }

            .dn-container .dn-full-width-panel .dn-panel-header > div {
                flex-wrap: wrap;
                min-width: 0;
            }

    /* 7. Timeline */

    .dn-container .dn-timeline-panel,
    .dn-container .dn-timeline-list {
        min-width: 0;
        max-width: 100%;
    }

    .dn-container .dn-timeline-card {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .dn-container .dn-note-text {
        overflow-wrap: anywhere;
    }

    /* 8. Bottom action buttons */

    .dn-container .dn-bottom-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
        min-width: 0;
    }

        .dn-container .dn-bottom-actions > button {
            max-width: 100%;
            white-space: normal;
        }

/* ============================================================
   LARGE LAPTOP / SMALL DESKTOP - 1024px to 1439px
   ============================================================ */

@media (min-width: 1024px) and (max-width: 1439.98px) {

    .dn-container .dn-workspace-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .dn-container .dn-right-col {
        width: 100%;
    }

    .dn-container .dn-clinical-2col-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .dn-container .dn-vitals-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ============================================================
   TABLET - 768px to 1023px
   ============================================================ */

@media (min-width: 768px) and (max-width: 1023.98px) {

    .dn-container {
        padding: 12px;
    }

        .dn-container .dn-workspace-grid,
        .dn-container .dn-clinical-2col-grid {
            grid-template-columns: minmax(0, 1fr);
            gap: 14px;
        }

        .dn-container .dn-vitals-grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .dn-container .dn-toolbar-controls {
            width: 100%;
        }

        .dn-container .dn-bottom-actions {
            justify-content: flex-end;
        }
}

/* ============================================================
   MOBILE - up to 767px
   ============================================================ */

@media (max-width: 767.98px) {

    .dn-container {
        padding: 10px;
    }

        .dn-container .dn-workspace-grid,
        .dn-container .dn-clinical-2col-grid {
            grid-template-columns: minmax(0, 1fr);
            gap: 12px;
        }

        .dn-container .dn-col-stack {
            gap: 12px;
        }

        .dn-container .dn-toolbar {
            flex-direction: column;
            align-items: stretch;
            gap: 12px;
        }

            .dn-container .dn-toolbar > div:first-child {
                display: flex;
                flex-wrap: wrap;
                gap: 8px;
            }

        .dn-container .dn-toolbar-title {
            font-size: 18px;
            line-height: 1.3;
        }

        .dn-container .dn-toolbar-controls {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            width: 100%;
            gap: 10px;
        }

        .dn-container .dn-datetime-inline {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            width: 100%;
        }

            .dn-container .dn-datetime-inline .dn-input-field {
                width: 100% !important;
                min-width: 0;
            }

        .dn-container .dn-ctrl-group {
            width: 100%;
        }

        .dn-container .dn-select-field {
            width: 100%;
        }

        .dn-container .dn-exam-grid-row {
            grid-template-columns: minmax(0, 1fr);
        }

        .dn-container .dn-vitals-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
        }

        .dn-container .dn-panel-header {
            flex-wrap: wrap;
            gap: 6px;
        }

        .dn-container .dn-full-width-panel {
            margin-top: 12px !important;
        }

        .dn-container .dn-order-tabs {
            flex-wrap: wrap;
            gap: 8px;
        }

        .dn-container .dn-bottom-actions {
            justify-content: stretch;
            gap: 8px;
        }

            .dn-container .dn-bottom-actions > button {
                flex: 1 1 160px;
                margin: 0 !important;
                min-height: 40px;
            }
}

/* ============================================================
   SMALL MOBILE - up to 480px
   ============================================================ */

@media (max-width: 480px) {

    .dn-container {
        padding: 8px;
    }

        .dn-container .dn-panel {
            padding: 10px;
        }

        .dn-container .dn-toolbar-title {
            font-size: 17px;
        }

        .dn-container .dn-vitals-grid {
            grid-template-columns: minmax(0, 1fr);
        }

        .dn-container .dn-vital-box-action {
            width: 100%;
        }

        .dn-container .dn-vital-action-btns {
            width: 100%;
        }

            .dn-container .dn-vital-action-btns button {
                flex: 1 1 auto;
                min-height: 38px;
            }

        .dn-container .dn-bottom-actions {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
        }

            .dn-container .dn-bottom-actions > button {
                width: 100%;
                margin: 0 !important;
                min-height: 42px;
            }

        .dn-container .dn-checkboxes-row {
            align-items: stretch;
        }

        .dn-container .dn-checkbox-label {
            width: 100%;
        }

        .dn-container .dn-timeline-panel {
            width: 100%;
        }
}

/* ============================================================
   THEME COMPATIBILITY
   ============================================================ */

html.cemr-theme-dark .dn-container {
    color: var(--md-sys-color-on-surface);
}

    html.cemr-theme-dark .dn-container :is( .dn-panel, .dn-timeline-panel, .dn-timeline-card ) {
        background-color: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
        border-color: var(--md-sys-color-outline-variant);
    }

.dn-container :is( .dn-input-field, .dn-select-field, .dn-textarea ):focus {
    outline-color: var(--md-sys-color-primary);
    border-color: var(--md-sys-color-primary);
}

/* ==========================================
   DOCTOR NOTE - RIGHT SIDE PROGRESS NOTES
   Responsive for all devices
   ========================================== */

/* Main workspace */
.dn-container .dn-workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 16px;
    align-items: start;
}

/* Doctor Note Form - LEFT */
.dn-container .dn-left-col {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    width: 100%;
}

/* Previous Progress Notes - RIGHT */
.dn-container .dn-right-col {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    width: 100%;
}

/* Clinical form - two columns */
.dn-container .dn-clinical-2col-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

/* Previous Notes Panel */
.dn-container .dn-timeline-panel {
    width: 100%;
    max-width: 100%;
}

/* Laptop */
@media (min-width: 1024px) and (max-width: 1439.98px) {
    .dn-container .dn-workspace-grid {
        grid-template-columns: minmax(0, 1fr) 250px;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .dn-container .dn-workspace-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .dn-container .dn-left-col {
        grid-column: 1;
        grid-row: 1;
    }

    .dn-container .dn-right-col {
        grid-column: 1;
        grid-row: 2;
    }

    .dn-container .dn-clinical-2col-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Mobile */
@media (max-width: 767.98px) {
    .dn-container .dn-workspace-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .dn-container .dn-left-col {
        grid-column: 1;
        grid-row: 1;
    }

    .dn-container .dn-right-col {
        grid-column: 1;
        grid-row: 2;
    }

    .dn-container .dn-clinical-2col-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .dn-container .dn-timeline-panel {
        width: 100%;
    }
}
