/* =========================================================================
   DASHBOARD LAYOUT
   ========================================================================= */
.dashboard-body {
    background-color: var(--bg-offwhite);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* =========================================================================
   SIDEBAR
   ========================================================================= */
.sidebar {
    width: 260px;
    background-color: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
    flex-grow: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    display: block;
    padding-left: 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-fast);
    text-decoration: none;
    margin-bottom: 0.25rem;
}

.sidebar-link i {
    font-size: 1.25rem;
}

.sidebar-link:hover {
    background-color: var(--bg-offwhite);
    color: var(--text-main);
}

.sidebar-link.active {
    background-color: var(--primary-light);
    color: var(--primary-blue);
}

.sidebar-footer {
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border-color);
}

.badge-mini {
    background-color: var(--primary-blue);
    color: white;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 99px;
    margin-left: auto;
    font-weight: 600;
}

/* =========================================================================
   MAIN CONTENT
   ========================================================================= */
.main-content {
    flex-grow: 1;
    margin-left: 260px; /* offset sidebar */
    width: calc(100% - 260px);
}

/* Top Header */
.top-header {
    height: 70px;
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-offwhite);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    width: 350px;
    gap: 0.5rem;
}

.header-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-main);
}

.header-search i {
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    display: flex;
}
.icon-btn:hover { color: var(--text-main); }

.notification-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background-color: #EF4444;
    border-radius: 50%;
    border: 2px solid var(--bg-white);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.profile-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-name {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Dashboard Inner Layout */
.dashboard-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.page-heading {
    margin-bottom: 2rem;
}

.page-heading h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}
.page-heading p {
    color: var(--text-muted);
}

/* =========================================================================
   METRIC CARDS
   ========================================================================= */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.metric-title {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.icon-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.bg-green { background-color: #DCFCE7; color: #16A34A; }
.bg-blue { background-color: #DBEAFE; color: #2563EB; }
.bg-yellow { background-color: #FEF3C7; color: #D97706; }
.bg-red { background-color: #FEE2E2; color: #DC2626; }

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.metric-trend {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}
.metric-trend span { color: var(--text-muted); font-weight: 400; }
.metric-trend.positive { color: #16A34A; }
.metric-trend.negative { color: #DC2626; }

/* =========================================================================
   CARDS & TABLES
   ========================================================================= */
.card {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    padding: 1.5rem;
}

.bottom-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    background-color: var(--bg-offwhite);
}

.data-table tbody tr:hover {
    background-color: #F8FAFC;
}

.data-table td {
    font-size: 0.95rem;
    vertical-align: middle;
}

.table-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.table-user img, .avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    background-color: var(--text-muted);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.status-badge {
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 500;
}
.status-badge.success { background-color: #DCFCE7; color: #16A34A; }
.status-badge.warning { background-color: #FEF3C7; color: #D97706; }

/* Health List */
.health-list {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.health-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.health-item i {
    font-size: 1.5rem;
}

.health-info h4 {
    font-size: 0.95rem;
}

.health-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: auto;
}
.status-dot.green { background-color: #10B981; }

.link-blue { color: var(--primary-blue); font-weight: 500; font-size: 0.9rem; }
.w-100 { width: 100%; }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; width: 100%; }
    .metric-grid { grid-template-columns: 1fr; }
    .header-search { display: none; }
}
