/* ─── Professional Clinical Healthcare Teal Palette (Matched to User Screenshot) ─── */
:root {
    --bg-body: #f4f7f9;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --border-color: #e2e8f0;
    --border-subtle: #eaeff2;
    --text-primary: #12303a;
    --text-secondary: #334e58;
    --text-muted: #5d7580;
    
    /* Primary Brand Teal (exact match #0e7c86) */
    --primary: #0e7c86;
    --primary-hover: #0b6871;
    --primary-active: #095961;
    --primary-subtle: #e0f4f5;
    --primary-subtle-border: rgba(14, 124, 134, 0.25);
    
    --accent: #0f766e;
    --accent-subtle: #ccfbf1;
    
    /* Deep Medical Petrol Teal Sidebar (exact match to user screenshot #0b3c49) */
    --sidebar-bg: #0b3c49;
    --sidebar-surface: #104855;
    --sidebar-text: #b6d7da;
    --sidebar-text-hover: #ffffff;
    --sidebar-active: #0e7c86;
    --sidebar-active-hover: #128a95;
    --sidebar-submenu-active: #24505c;
    --sidebar-category: #5f8e97;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    
    --shadow-sm: 0 1px 3px rgba(11, 60, 73, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(11, 60, 73, 0.08);
    --shadow-lg: 0 10px 25px -3px rgba(11, 60, 73, 0.12);
}

[data-theme="dark"] {
    --bg-body: #081a20;
    --bg-surface: #0e2730;
    --bg-card: #0e2730;
    --bg-card-hover: #143542;
    --border-color: #1a4250;
    --text-primary: #e6f1ef;
    --text-secondary: #b6d7da;
    --text-muted: #8fa8ae;
    --primary: #14b8a6;
    --primary-hover: #2dd4bf;
    --primary-subtle: rgba(20, 184, 166, 0.18);
    --accent: #2dd4bf;
    --accent-subtle: rgba(45, 212, 191, 0.18);
    
    --sidebar-bg: #06191f;
    --sidebar-surface: #0c252d;
    --sidebar-text: #8fa8ae;
    --sidebar-text-hover: #ffffff;
    --sidebar-active: #14b8a6;
    --sidebar-active-hover: #2dd4bf;
    --sidebar-submenu-active: #143542;
    --sidebar-category: #4d7a85;
    --sidebar-border: rgba(255, 255, 255, 0.06);
}


body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    transition: background-color 0.25s ease, color 0.25s ease;
    margin: 0;
    padding: 0;
}

/* ─── App Shell & Sidebar Slide (Full Page Mode) ─── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.app-sidebar {
    width: 270px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--sidebar-border);
    z-index: 1020;
}

/* When collapsed: sidebar slides out to the left, main takes full 100% width! */
.app-wrapper.sidebar-collapsed .app-sidebar {
    margin-left: -270px;
}

.sidebar-brand {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: #144b56;
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #22d3ee;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(11, 60, 73, 0.4);
}

.sidebar-brand .brand-text {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.sidebar-brand .brand-sub {
    font-size: 10px;
    color: #64b5bb;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.sidebar-pin-btn {
    background: transparent;
    border: 1px solid var(--sidebar-border);
    color: #64748b;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

.sidebar-pin-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

/* ─── Sidebar Navigation & Module Groups ─── */
.sidebar-menu {
    padding: 14px 10px;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.menu-category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--sidebar-category);
    padding: 14px 14px 4px;
    letter-spacing: 0.08em;
}

/* Single Menu Item */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9.5px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 2px;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.menu-item.active {
    background: var(--sidebar-active) !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(14, 124, 134, 0.35);
}

.sidebar-menu .menu-item i,
.sidebar-menu .menu-group-btn i {
    font-size: 15px;
    color: #22d3ee;
}

.sidebar-menu .menu-item.active i,
.sidebar-menu .menu-group-btn.active i,
.sidebar-menu .menu-group-btn[aria-expanded="true"] i {
    color: #ffffff !important;
}

/* Grouped Dropdown Navigation */
.menu-group {
    margin-bottom: 3px;
}

.menu-group-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9.5px 14px;
    color: var(--sidebar-text);
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.menu-group-btn:hover {
    background-color: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.menu-group-btn.active,
.menu-group-btn[aria-expanded="true"] {
    color: #ffffff;
    background-color: var(--sidebar-active);
    box-shadow: 0 4px 14px rgba(14, 124, 134, 0.35);
}

.menu-group-btn .arrow-icon {
    font-size: 11px;
    transition: transform 0.25s ease;
    color: #64b5bb;
}

.menu-group-btn.active .arrow-icon,
.menu-group-btn[aria-expanded="true"] .arrow-icon {
    transform: rotate(180deg);
    color: #ffffff;
}

/* Submenu container */
.submenu-list {
    padding-left: 12px;
    margin: 4px 0 6px 12px;
    border-left: 2px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.submenu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 12px;
    color: #b6d7da;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12.8px;
    font-weight: 500;
    transition: all 0.18s ease;
}

.submenu-item:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.submenu-item.active {
    background: var(--sidebar-submenu-active) !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(11, 60, 73, 0.4);
}

.submenu-item i {
    font-size: 13px;
    color: #64b5bb;
    opacity: 0.9;
}

.submenu-item.active i {
    color: #ffffff !important;
}


/* ─── Topbar & Full-Screen Slide Button ─── */
.app-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: all 0.3s ease;
}

.app-topbar {
    height: 62px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.sidebar-toggle-btn {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--primary);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle-btn:hover {
    background-color: var(--primary-subtle);
    border-color: var(--primary);
    color: var(--primary-hover);
    transform: scale(1.05);
}

.tenant-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--primary-subtle);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid var(--primary-subtle-border);
}

.branch-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #f0f4f6;
    color: #475569;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid #dce5e8;
}

.user-avatar-circle {
    width: 34px;
    height: 34px;
    background-color: #0b5d66;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(11, 93, 102, 0.3);
}

.host-badge {
    background-color: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid rgba(15, 118, 110, 0.2);
}


.topbar-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

/* ─── Cards & Surfaces ─── */
.erp-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 24px;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.erp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.erp-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Tables ─── */
.table-custom {
    width: 100%;
    color: var(--text-secondary);
    border-collapse: collapse;
}

.table-custom th {
    background-color: var(--bg-body);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.table-custom td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13.5px;
    vertical-align: middle;
}

.table-custom tr:hover td {
    background-color: var(--bg-card-hover);
}

/* ─── Modals in Dark/Light ─── */
.modal-content {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

.form-control, .form-select {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

/* Responsive Mobile Sidebar Backdrop */
@media (max-width: 992px) {
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        margin-left: -270px;
        box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
    }
    .app-wrapper.sidebar-mobile-open .app-sidebar {
        margin-left: 0;
    }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1015;
    }
    .app-wrapper.sidebar-mobile-open .sidebar-backdrop {
        display: block;
    }
}

/* ─── Global Clinical Teal Accent Overrides (Matched to Screenshot) ─── */
.btn-primary, .btn-teal {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-teal:hover, .btn-teal:focus, .btn-teal:active {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: #ffffff !important;
}

.btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.bg-primary-subtle {
    background-color: var(--primary-subtle) !important;
    color: var(--primary) !important;
}

.text-primary, .text-teal {
    color: var(--primary) !important;
}

.border-primary {
    border-color: var(--primary) !important;
}

/* Nav Tabs & Active Underline */
.nav-tabs .nav-link.active,
.lab-nav .nav-link.active,
.radio-nav-tabs .nav-link.active {
    color: var(--primary) !important;
    border-bottom: 3px solid var(--primary) !important;
    font-weight: 600;
}

/* Filter status pills */
.status-filter-pill.active {
    background: #0b4c55 !important;
    color: #ffffff !important;
    border-color: #0b4c55 !important;
}

/* Clinical Metric Cards (Clean rounded with subtle colored indicator tops) */
.kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(11, 60, 73, 0.03);
    transition: transform 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(11, 60, 73, 0.08);
}

