:root {
    --sidebar-width: 250px;
    --bs-primary: #07A2A7;
    --bs-primary-rgb: 7, 162, 167;
    --bs-primary-bg-subtle: #e6f7f8;
    --bs-secondary: #053063;
    --bs-secondary-rgb: 5, 48, 99;
    --bs-secondary-bg-subtle: #e6ecf3;
    --bs-primary-text-emphasis: #035e61;
    --bs-secondary-text-emphasis: #02203e;
}

.btn-primary {
    --bs-btn-bg: #07A2A7;
    --bs-btn-border-color: #07A2A7;
    --bs-btn-hover-bg: #068a8e;
    --bs-btn-hover-border-color: #068a8e;
    --bs-btn-active-bg: #057377;
    --bs-btn-active-border-color: #057377;
}

.btn-outline-primary {
    --bs-btn-color: #07A2A7;
    --bs-btn-border-color: #07A2A7;
    --bs-btn-hover-bg: #07A2A7;
    --bs-btn-hover-border-color: #07A2A7;
    --bs-btn-active-bg: #068a8e;
    --bs-btn-active-border-color: #068a8e;
}

.btn-secondary {
    --bs-btn-bg: #053063;
    --bs-btn-border-color: #053063;
    --bs-btn-hover-bg: #042850;
    --bs-btn-hover-border-color: #042850;
    --bs-btn-active-bg: #03203e;
    --bs-btn-active-border-color: #03203e;
}

.btn-outline-secondary {
    --bs-btn-color: #053063;
    --bs-btn-border-color: #053063;
    --bs-btn-hover-bg: #053063;
    --bs-btn-hover-border-color: #053063;
    --bs-btn-active-bg: #042850;
    --bs-btn-active-border-color: #042850;
}

.text-primary {
    color: #07A2A7 !important;
}

.text-secondary {
    color: #053063 !important;
}

.bg-primary {
    background-color: #07A2A7 !important;
}

.bg-secondary {
    background-color: #053063 !important;
}

.border-primary {
    border-color: #07A2A7 !important;
}

.border-secondary {
    border-color: #053063 !important;
}

a {
    color: #07A2A7;
}

a:hover {
    color: #068a8e;
}

.page-link {
    color: #07A2A7;
}

.page-link:hover {
    color: #068a8e;
}

.page-item.active .page-link {
    background-color: #07A2A7;
    border-color: #07A2A7;
}

.badge.bg-primary,
.alert-primary {
    background-color: #07A2A7 !important;
}

.table thead th {
    background-color: #053063;
    color: #fff;
}

.nav-pills .nav-link.active {
    background-color: #07A2A7 !important;
}

#sidebarMenu {
    background-color: #053063 !important;
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1030;
    display: flex;
    flex-direction: column;
}

#sidebarMenu .sidebar-nav-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

#sidebarMenu .sidebar-nav-scroll::-webkit-scrollbar {
    width: 4px;
}

#sidebarMenu .sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.main-content-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
}

@media (max-width: 991.98px) {
    #sidebarMenu {
        display: none;
        position: fixed;
        z-index: 1050;
        left: 0;
        top: 0;
        height: 100vh;
    }
    #sidebarMenu.show {
        display: flex;
    }
    .main-content-wrapper {
        margin-left: 0;
        width: 100%;
    }
}

html[dir="rtl"] #sidebarMenu {
    left: auto;
    right: 0;
}

html[dir="rtl"] .main-content-wrapper {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

@media (max-width: 991.98px) {
    html[dir="rtl"] .main-content-wrapper {
        margin-right: 0;
    }
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.card {
    border-radius: 0.5rem;
}

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.pagination {
    margin-bottom: 0;
}

/* ============================================
   Dashboard Styles
   ============================================ */

.dash-welcome {
    background: linear-gradient(135deg, #053063 0%, #042850 50%, #03203e 100%);
    border-radius: 1rem;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}
.dash-welcome::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(7, 162, 167, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}
.dash-welcome::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(7, 162, 167, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}
.dash-welcome * {
    position: relative;
    z-index: 1;
}
.dash-welcome h3 {
    color: #fff;
    font-weight: 700;
}
.dash-welcome p {
    color: rgba(255,255,255,0.75);
}
.dash-welcome .btn-primary {
    background-color: #07A2A7;
    border-color: #07A2A7;
}
.dash-welcome .btn-primary:hover {
    background-color: #068a8e;
    border-color: #068a8e;
}
.dash-welcome .btn-outline-light {
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.9);
}
.dash-welcome .btn-outline-light:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}
.dash-welcome .stat-item {
    border-right: 1px solid rgba(255,255,255,0.15);
    padding: 0 1.5rem;
}
.dash-welcome .stat-item:last-child {
    border-right: none;
}
.dash-welcome .stat-value {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
}
.dash-welcome .stat-label {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dash-kpi-card {
    border: none;
    border-radius: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.dash-kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}
.dash-kpi-card .kpi-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}
.dash-kpi-card .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.dash-kpi-card .kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
}
.dash-kpi-card .kpi-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}
.dash-kpi-card .kpi-trend {
    font-size: 0.75rem;
    font-weight: 600;
}
.dash-kpi-card .kpi-trend i {
    font-size: 0.65rem;
}

.dash-quick-action {
    border: none;
    border-radius: 1rem;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
}
.dash-quick-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}
.dash-quick-action .action-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}
.dash-quick-action:hover .action-icon {
    transform: scale(1.1);
}

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.dash-section-header h5 {
    font-weight: 700;
    margin: 0;
    font-size: 1rem;
    color: #212529;
}
.dash-section-header .dash-section-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: #07A2A7;
    text-decoration: none;
}
.dash-section-header .dash-section-link:hover {
    color: #068a8e;
}

.dash-activity-timeline {
    position: relative;
    padding-left: 2rem;
}
.dash-activity-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}
.dash-activity-item {
    position: relative;
    margin-bottom: 1.25rem;
}
.dash-activity-item:last-child {
    margin-bottom: 0;
}
.dash-activity-item .timeline-dot {
    position: absolute;
    left: -2rem;
    top: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    color: #fff;
}
.dash-activity-item .activity-time {
    font-size: 0.7rem;
    color: #adb5bd;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dash-activity-item .activity-text {
    font-size: 0.85rem;
    color: #495057;
}

.dash-low-stock-item {
    border: none;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}
.dash-low-stock-item:hover {
    background-color: #f8f9fa;
}
.dash-low-stock-item .stock-progress {
    height: 6px;
    border-radius: 3px;
}

.dash-summary-card {
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}
.dash-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.dash-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}
.dash-status-indicator .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dash-status-indicator .status-dot.online {
    background-color: #28a745;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.4);
}
.dash-status-indicator .status-dot.offline {
    background-color: #dc3545;
}
.dash-status-indicator .status-dot.warning {
    background-color: #ffc107;
}

.chart-container {
    position: relative;
    height: 250px;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #adb5bd;
}
.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}
.empty-state p {
    font-size: 0.85rem;
    margin: 0;
}

@media (max-width: 767.98px) {
    .dash-welcome {
        padding: 1.5rem;
    }
    .dash-welcome .stat-item {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.15);
        padding: 0.75rem 0;
    }
    .dash-welcome .stat-item:last-child {
        border-bottom: none;
    }
    .dash-kpi-card {
        margin-bottom: 0.75rem;
    }
    .dash-kpi-card .kpi-value {
        font-size: 1.4rem;
    }
    .chart-container {
        height: 200px;
    }
}

/* ============================================
   Pharmora AI — pharmacy & CDSS components
   ============================================ */
:root {
    --ph-major: #c62828;
    --ph-major-bg: #fdecea;
    --ph-moderate: #b26a00;
    --ph-moderate-bg: #fff4e0;
    --ph-minor: #0b6e99;
    --ph-minor-bg: #e7f4fa;
    --ph-safe: #1b7f4b;
    --ph-safe-bg: #e6f5ec;
    --ph-muted: #6b7a8c;
    --ph-border: #e3e8ef;
}

.ph-kpi { border: 1px solid var(--ph-border); border-radius: .6rem; padding: 1rem 1.1rem; background: #fff; height: 100%; }
.ph-kpi .ph-kpi-label { font-size: .78rem; color: var(--ph-muted); text-transform: uppercase; letter-spacing: .03em; }
.ph-kpi .ph-kpi-value { font-size: 1.55rem; font-weight: 700; color: #053063; font-variant-numeric: tabular-nums; }
.ph-kpi .ph-kpi-sub { font-size: .8rem; color: var(--ph-muted); }
.ph-kpi-icon { width: 38px; height: 38px; border-radius: .5rem; display: inline-flex; align-items: center; justify-content: center; background: var(--bs-primary-bg-subtle); color: #07A2A7; }

.sev-badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: .15rem .45rem; border-radius: .3rem; text-transform: uppercase; letter-spacing: .03em; }
.sev-major { background: var(--ph-major-bg); color: var(--ph-major); }
.sev-moderate { background: var(--ph-moderate-bg); color: var(--ph-moderate); }
.sev-minor, .sev-info { background: var(--ph-minor-bg); color: var(--ph-minor); }
.sev-safe { background: var(--ph-safe-bg); color: var(--ph-safe); }

.ph-alert { border-left: 4px solid; border-radius: .4rem; padding: .6rem .75rem; margin-bottom: .5rem; font-size: .88rem; }
.ph-alert.major { border-color: var(--ph-major); background: var(--ph-major-bg); }
.ph-alert.moderate { border-color: var(--ph-moderate); background: var(--ph-moderate-bg); }
.ph-alert.minor { border-color: var(--ph-minor); background: var(--ph-minor-bg); }
.ph-alert .ph-alert-title { font-weight: 600; }
.ph-alert .ph-alert-meta { font-size: .75rem; color: var(--ph-muted); }

.ph-steps { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.ph-step { flex: 1 1 140px; border: 1px solid var(--ph-border); border-radius: .5rem; padding: .5rem .75rem; background: #fff; font-size: .85rem; color: var(--ph-muted); cursor: default; }
.ph-step .n { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; background: #eef2f6; font-weight: 700; margin-right: .4rem; font-size: .75rem; }
.ph-step.active { border-color: #07A2A7; color: #053063; font-weight: 600; box-shadow: 0 0 0 2px rgba(7,162,167,.15); }
.ph-step.active .n { background: #07A2A7; color: #fff; }
.ph-step.done .n { background: var(--ph-safe); color: #fff; }

.ph-chip { display: inline-flex; align-items: center; gap: .35rem; border-radius: 1rem; padding: .25rem .65rem; background: #eef6f7; color: #035e61; font-size: .82rem; margin: 0 .3rem .3rem 0; border: 1px solid #cfe9ea; }
.ph-chip button { border: 0; background: none; color: inherit; padding: 0; line-height: 1; }
.ph-typeahead { position: relative; }
.ph-typeahead .ph-menu { position: absolute; z-index: 1060; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--ph-border); border-radius: .4rem; box-shadow: 0 8px 24px rgba(5,48,99,.12); max-height: 280px; overflow-y: auto; display: none; }
.ph-typeahead .ph-menu.show { display: block; }
.ph-typeahead .ph-menu a { display: block; padding: .45rem .7rem; color: #1f2d3d; text-decoration: none; font-size: .88rem; border-bottom: 1px solid #f3f5f8; }
.ph-typeahead .ph-menu a:hover, .ph-typeahead .ph-menu a.hl { background: #eef6f7; }

.ph-dx-card { border: 1px solid var(--ph-border); border-radius: .5rem; padding: .7rem .85rem; margin-bottom: .5rem; cursor: pointer; background: #fff; transition: border-color .15s, box-shadow .15s; }
.ph-dx-card:hover { border-color: #07A2A7; }
.ph-dx-card.selected { border-color: #07A2A7; box-shadow: 0 0 0 2px rgba(7,162,167,.2); }
.ph-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; background: #eef2f6; color: #053063; padding: .1rem .4rem; border-radius: .25rem; }
.ph-score { height: 6px; border-radius: 3px; background: #eef2f6; overflow: hidden; }
.ph-score > span { display: block; height: 100%; background: #07A2A7; }

.ph-option { border: 1px solid var(--ph-border); border-radius: .55rem; padding: .8rem .9rem; margin-bottom: .6rem; background: #fff; }
.ph-option.status-contraindicated { border-left: 4px solid var(--ph-major); }
.ph-option.status-caution { border-left: 4px solid var(--ph-moderate); }
.ph-option.status-safe, .ph-option.status-info { border-left: 4px solid var(--ph-safe); }
.ph-option.chosen { box-shadow: 0 0 0 2px rgba(7,162,167,.35); }
.ph-option .ph-meta { font-size: .8rem; color: var(--ph-muted); }

.ph-redflag { border: 1px solid var(--ph-border); border-radius: .4rem; padding: .45rem .6rem; margin-bottom: .35rem; font-size: .87rem; background: #fff; }
.ph-redflag:has(input:checked) { border-color: var(--ph-major); background: var(--ph-major-bg); }

.ph-sticky { position: sticky; top: 1rem; }
.ph-muted { color: var(--ph-muted); }
.tabular { font-variant-numeric: tabular-nums; }
.ph-support-banner { background: #fff4e0; border-bottom: 1px solid #f0d9a8; color: #6b4500; font-size: .85rem; padding: .4rem 1rem; }
.sidebar-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.45); margin: .9rem 0 .25rem .75rem; }

@media print {
    #sidebarMenu, .navbar, .breadcrumb, .no-print, footer { display: none !important; }
    .main-content-wrapper { margin: 0 !important; width: 100% !important; }
}
