/* =====================================================
   Hajmi Dashboard Theme — Light / Dark / Mobile
   ===================================================== */

:root {
    --hajmi-primary: #5b6bf9;
    --hajmi-primary-dark: #4a56d4;
    --hajmi-primary-light: rgba(91, 107, 249, 0.12);
    --hajmi-bg: #f0f2f8;
    --hajmi-surface: #ffffff;
    --hajmi-surface-2: #f8f9fc;
    --hajmi-sidebar: #ffffff;
    --hajmi-text: #1a1d2e;
    --hajmi-text-secondary: #6b7280;
    --hajmi-text-muted: #9ca3af;
    --hajmi-border: #e5e7ef;
    --hajmi-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
    --hajmi-shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.1);
    --hajmi-radius: 14px;
    --hajmi-radius-sm: 10px;
    --hajmi-success: #22c55e;
    --hajmi-warning: #f59e0b;
    --hajmi-danger: #ef4444;
    --hajmi-info: #3b82f6;
    --hajmi-orange: #f97316;
    --hajmi-purple: #8b5cf6;
    --hajmi-green: #10b981;
    --hajmi-sidebar-width: 260px;
}

html[data-theme-mode="dark"] {
    --hajmi-bg: #0b0e14;
    --hajmi-surface: #161b28;
    --hajmi-surface-2: #1a2030;
    --hajmi-sidebar: #12151f;
    --hajmi-text: #f1f5f9;
    --hajmi-text-secondary: #94a3b8;
    --hajmi-text-muted: #64748b;
    --hajmi-border: rgba(255, 255, 255, 0.08);
    --hajmi-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --hajmi-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --hajmi-primary-light: rgba(91, 107, 249, 0.2);
    --bg-primary: #0b0e14;
    --bg-secondary: #161b28;
    --bg-card: #161b28;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
}

/* ---- Layout Override ---- */
body {
    background: var(--hajmi-bg) !important;
    color: var(--hajmi-text);
}

.admin-wrapper {
    min-height: 100vh;
    background: var(--hajmi-bg);
    overflow: visible;
}

.admin-container {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    overflow: visible !important;
    align-items: stretch;
}

.admin-content-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

/* ---- Sidebar ---- */
.admin-sidebar {
    width: var(--hajmi-sidebar-width);
    background: var(--hajmi-sidebar) !important;
    color: var(--hajmi-text);
    border-left: 1px solid var(--hajmi-border);
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    position: relative;
    top: auto;
    height: auto;
    min-height: 100vh;
    z-index: 100;
    flex-shrink: 0;
    overflow: visible;
}

.sidebar-header {
    padding: 24px 20px 16px !important;
    border-bottom: 1px solid var(--hajmi-border) !important;
}

.sidebar-header .site-brand__title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--hajmi-text) !important;
    line-height: 1.4 !important;
}

.sidebar-header .site-brand__logo {
    width: 42px !important;
    height: 42px !important;
    border-radius: 10px !important;
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--hajmi-text-muted);
    margin-top: 2px;
    padding-right: 52px;
}

.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 20px;
    left: 16px;
    background: var(--hajmi-surface-2);
    border: 1px solid var(--hajmi-border);
    color: var(--hajmi-text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 12px !important;
    overflow: visible;
}

.nav-item {
    padding: 11px 14px !important;
    color: var(--hajmi-text-secondary) !important;
    border-radius: var(--hajmi-radius-sm);
    margin-bottom: 4px;
    font-weight: 500;
    gap: 10px !important;
}

.nav-item i:first-child {
    width: 22px !important;
    font-size: 16px !important;
    color: var(--hajmi-text-muted);
}

.nav-item:hover {
    background: var(--hajmi-primary-light) !important;
    color: var(--hajmi-primary) !important;
}

.nav-item:hover i:first-child {
    color: var(--hajmi-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--hajmi-primary) 0%, #7c3aed 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(91, 107, 249, 0.35);
}

.nav-item.active i:first-child {
    color: #fff !important;
}

.nav-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--hajmi-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 14px 8px;
}

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

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--hajmi-danger);
    text-decoration: none;
    border-radius: var(--hajmi-radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    transition: background 0.2s;
}

.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--hajmi-danger);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--hajmi-surface-2);
    border-radius: var(--hajmi-radius-sm);
    border: 1px solid var(--hajmi-border);
}

.sidebar-user-card .sidebar-avatar-circle {
    width: 40px !important;
    height: 40px !important;
    font-size: 14px !important;
    background: linear-gradient(135deg, var(--hajmi-primary), #7c3aed) !important;
    color: #fff !important;
    margin-bottom: 0 !important;
    flex-shrink: 0;
}

.sidebar-user-info-text {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--hajmi-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--hajmi-text-muted);
}

.sidebar-version {
    text-align: center;
    font-size: 11px;
    color: var(--hajmi-text-muted);
    margin-top: 12px;
}

/* ---- Top Header (ثابت در همه صفحات) ---- */
.admin-header.hajmi-header {
    background: #2f80ed !important;
    color: #ffffff !important;
    padding: 10px 20px !important;
    box-shadow: none !important;
    border-bottom: none !important;
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 58px;
}

html[data-theme-mode="dark"] .admin-header.hajmi-header {
    background: #12151f !important;
}

.header-start {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.header-end {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-page-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hajmi-header .menu-toggle {
    color: #ffffff !important;
    background: transparent !important;
    border: none !important;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    font-size: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.hajmi-header .menu-toggle:hover {
    background: rgba(255, 255, 255, 0.12) !important;
}

.header-actions-pill {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 999px;
    padding: 4px 6px;
}

html[data-theme-mode="dark"] .header-actions-pill {
    background: rgba(255, 255, 255, 0.08);
}

.header-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    text-decoration: none;
    border: none;
    background: transparent;
    border-radius: 50%;
    font-size: 17px;
    position: relative;
    transition: background 0.2s;
    cursor: pointer;
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff !important;
}

.header-theme-switch {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 999px;
    padding: 3px;
    flex-shrink: 0;
}

html[data-theme-mode="dark"] .header-theme-switch {
    background: rgba(0, 0, 0, 0.45);
}

.header-theme-option {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.75) !important;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.header-theme-option i {
    font-size: 12px;
}

.header-theme-option:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1);
}

.header-theme-option.is-active {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #2f80ed !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

html[data-theme-mode="dark"] .header-theme-option.is-active {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

.header-badge {
    position: absolute;
    top: 0;
    left: 0;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    background: #8b5cf6 !important;
    color: #ffffff !important;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #2f80ed;
    line-height: 1;
}

html[data-theme-mode="dark"] .header-badge {
    border-color: #12151f;
}

.header-user-block {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff !important;
    flex-shrink: 0;
}

.header-user-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    min-width: 0;
}

.header-user-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.header-user-role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.78) !important;
    white-space: nowrap;
}

.header-user-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: contain;
    background: #e74c3c;
    flex-shrink: 0;
}

/* legacy header classes — hidden when using hajmi-header */
.hajmi-header .header-left,
.hajmi-header .header-right,
.hajmi-header .header-date,
.hajmi-header .header-search,
.hajmi-header .header-icon-btn,
.hajmi-header .header-user-chip {
    display: none !important;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.menu-toggle {
    color: var(--hajmi-text) !important;
    background: var(--hajmi-surface-2);
    border: 1px solid var(--hajmi-border);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}

.header-date {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--hajmi-surface-2);
    border: 1px solid var(--hajmi-border);
    border-radius: var(--hajmi-radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--hajmi-text-secondary);
    white-space: nowrap;
}

.header-date i {
    color: var(--hajmi-primary);
}

.header-search {
    position: relative;
    display: none;
}

.header-search input {
    width: 220px;
    padding: 9px 14px 9px 36px;
    border: 1px solid var(--hajmi-border);
    border-radius: var(--hajmi-radius-sm);
    background: var(--hajmi-surface-2);
    color: var(--hajmi-text);
    font-size: 13px;
    font-family: inherit;
}

.header-search input:focus {
    outline: none;
    border-color: var(--hajmi-primary);
}

.header-search i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--hajmi-text-muted);
    font-size: 14px;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--hajmi-surface-2);
    border: 1px solid var(--hajmi-border);
    color: var(--hajmi-text-secondary);
    text-decoration: none;
    font-size: 16px;
    transition: all 0.2s;
    position: relative;
}

.header-icon-btn:hover {
    background: var(--hajmi-primary-light);
    color: var(--hajmi-primary);
    border-color: transparent;
}

.header-icon-btn .notification-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: var(--hajmi-danger) !important;
    border: 2px solid var(--hajmi-surface) !important;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--hajmi-surface-2);
    border: 1px solid var(--hajmi-border);
    border-radius: 50px;
    text-decoration: none;
    color: inherit;
}

.header-user-chip .user-avatar-circle {
    width: 34px !important;
    height: 34px !important;
    font-size: 12px !important;
    background: linear-gradient(135deg, var(--hajmi-primary), #7c3aed) !important;
}

.header-user-chip .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--hajmi-text);
}

.header-user-role {
    font-size: 11px;
    color: var(--hajmi-text-muted);
}

.dashboard-title {
    display: none;
}

.site-brand--header {
    display: none;
}

.admin-main {
    background: var(--hajmi-bg) !important;
    padding: 24px 28px !important;
    flex: 1;
    overflow: visible !important;
    overflow-x: hidden;
}

.admin-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--hajmi-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--hajmi-text-muted);
    background: var(--hajmi-surface);
}

/* ---- Dashboard ---- */
.hajmi-dashboard {
    max-width: 1440px;
    margin: 0 auto;
}

.hajmi-welcome {
    margin-bottom: 24px;
}

.hajmi-welcome h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--hajmi-text);
    margin-bottom: 4px;
}

.hajmi-welcome p {
    font-size: 13px;
    color: var(--hajmi-text-secondary);
}

.hajmi-welcome-date {
    font-size: 13px;
    color: var(--hajmi-text-muted);
    margin-top: 8px;
}

/* Stat Cards Row 1 */
.hajmi-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.hajmi-stat-card {
    background: var(--hajmi-surface);
    border: 1px solid var(--hajmi-border);
    border-radius: var(--hajmi-radius);
    padding: 20px;
    box-shadow: var(--hajmi-shadow);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.hajmi-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--hajmi-shadow-lg);
}

.hajmi-stat-card.clickable {
    cursor: pointer;
}

.hajmi-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 14px;
}

.hajmi-stat-icon.orange { background: rgba(249, 115, 22, 0.12); color: var(--hajmi-orange); }
.hajmi-stat-icon.blue { background: rgba(59, 130, 246, 0.12); color: var(--hajmi-info); }
.hajmi-stat-icon.green { background: rgba(16, 185, 129, 0.12); color: var(--hajmi-green); }
.hajmi-stat-icon.purple { background: rgba(139, 92, 246, 0.12); color: var(--hajmi-purple); }

.hajmi-stat-label {
    font-size: 13px;
    color: var(--hajmi-text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.hajmi-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--hajmi-text);
    line-height: 1.2;
}

.hajmi-stat-value .unit {
    font-size: 12px;
    font-weight: 500;
    color: var(--hajmi-text-muted);
}

.hajmi-stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
    padding: 4px 10px;
    border-radius: 20px;
}

.hajmi-stat-trend.up {
    background: rgba(34, 197, 94, 0.12);
    color: var(--hajmi-success);
}

.hajmi-stat-trend.down {
    background: rgba(239, 68, 68, 0.12);
    color: var(--hajmi-danger);
}

/* Row 2: 3 columns */
.hajmi-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 16px;
    margin-bottom: 20px;
}

.hajmi-panel {
    background: var(--hajmi-surface);
    border: 1px solid var(--hajmi-border);
    border-radius: var(--hajmi-radius);
    padding: 20px;
    box-shadow: var(--hajmi-shadow);
}

.hajmi-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.hajmi-panel-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--hajmi-text);
}

.hajmi-panel-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--hajmi-primary-light);
    color: var(--hajmi-primary);
    font-weight: 600;
}

/* Unit list */
.hajmi-unit-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hajmi-unit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--hajmi-surface-2);
    border-radius: var(--hajmi-radius-sm);
    border: 1px solid var(--hajmi-border);
}

.hajmi-unit-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hajmi-unit-dot.c1 { background: var(--hajmi-success); }
.hajmi-unit-dot.c2 { background: var(--hajmi-warning); }
.hajmi-unit-dot.c3 { background: var(--hajmi-danger); }
.hajmi-unit-dot.c4 { background: var(--hajmi-info); }

.hajmi-unit-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--hajmi-text);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hajmi-unit-amount {
    font-size: 13px;
    font-weight: 700;
    color: var(--hajmi-text);
    white-space: nowrap;
}

.hajmi-branch-filter-panel {
    margin-bottom: 18px;
}

.hajmi-branch-compare-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.hajmi-branch-compare-titlewrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.hajmi-branch-compare-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    font-size: 18px;
    flex-shrink: 0;
}

.hajmi-branch-compare-sub {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--hajmi-text-muted);
    font-weight: 500;
}

.hajmi-branch-manage-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.28);
    color: #6d28d9 !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.hajmi-branch-manage-btn:hover {
    background: rgba(124, 58, 237, 0.16);
    color: #5b21b6 !important;
}

.hajmi-branch-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.hajmi-branch-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--hajmi-border);
    background: var(--hajmi-surface);
    color: var(--hajmi-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background .15s, border-color .15s, color .15s;
}

.hajmi-branch-chip:hover {
    border-color: #7c3aed;
    color: #6d28d9;
}

.hajmi-branch-chip.active {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}

.hajmi-branch-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hajmi-branch-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    text-decoration: none !important;
    color: inherit;
    border-radius: 10px;
    min-width: 0;
}

.hajmi-branch-bar-row:hover,
.hajmi-branch-bar-row.is-active {
    background: var(--hajmi-surface-2);
}

.hajmi-branch-bar-ico {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.hajmi-branch-bar-row.tone-green .hajmi-branch-bar-ico { background: #dcfce7; color: #16a34a; }
.hajmi-branch-bar-row.tone-orange .hajmi-branch-bar-ico { background: #ffedd5; color: #ea580c; }
.hajmi-branch-bar-row.tone-blue .hajmi-branch-bar-ico { background: #dbeafe; color: #2563eb; }
.hajmi-branch-bar-row.tone-rose .hajmi-branch-bar-ico { background: #fce7f3; color: #db2777; }

.hajmi-branch-bar-label {
    width: 140px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--hajmi-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hajmi-branch-bar-label small {
    font-weight: 500;
    color: var(--hajmi-text-muted);
    margin-right: 4px;
}

.hajmi-branch-bar-track {
    flex: 1;
    min-width: 48px;
    height: 10px;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
}

.hajmi-branch-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    max-width: 100%;
}

.hajmi-branch-bar-row.tone-green .hajmi-branch-bar-fill { background: #22c55e; }
.hajmi-branch-bar-row.tone-orange .hajmi-branch-bar-fill { background: #f97316; }
.hajmi-branch-bar-row.tone-blue .hajmi-branch-bar-fill { background: #3b82f6; }
.hajmi-branch-bar-row.tone-rose .hajmi-branch-bar-fill { background: #f43f5e; }

.hajmi-branch-bar-pct {
    width: 52px;
    flex-shrink: 0;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    padding: 3px 0;
    border-radius: 999px;
}

.hajmi-branch-bar-row.tone-green .hajmi-branch-bar-pct { color: #16a34a; background: #dcfce7; }
.hajmi-branch-bar-row.tone-orange .hajmi-branch-bar-pct { color: #c2410c; background: #ffedd5; }
.hajmi-branch-bar-row.tone-blue .hajmi-branch-bar-pct { color: #1d4ed8; background: #dbeafe; }
.hajmi-branch-bar-row.tone-rose .hajmi-branch-bar-pct { color: #be123c; background: #ffe4e6; }

.hajmi-branch-bar-amount {
    width: 148px;
    flex-shrink: 0;
    text-align: left;
    font-size: 13px;
    font-weight: 800;
    color: var(--hajmi-text);
    white-space: nowrap;
}

.hajmi-branch-bar-amount small {
    font-size: 11px;
    font-weight: 600;
    color: var(--hajmi-text-muted);
}

.hajmi-branch-foot {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--hajmi-border);
}

.hajmi-branch-foot-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--hajmi-text-secondary);
    margin-bottom: 10px;
}

.hajmi-branch-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.hajmi-branch-kpi {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--hajmi-surface-2);
    border: 1px solid var(--hajmi-border);
    border-radius: 12px;
    min-width: 0;
}

.hajmi-branch-kpi-ico {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.hajmi-branch-kpi-ico.purple { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.hajmi-branch-kpi-ico.blue { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.hajmi-branch-kpi-ico.green { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.hajmi-branch-kpi-ico.rose { background: rgba(244, 63, 94, 0.12); color: #e11d48; }

.hajmi-branch-kpi-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--hajmi-text-muted);
    margin-bottom: 2px;
}

.hajmi-branch-kpi strong {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: var(--hajmi-text);
    line-height: 1.3;
}

.hajmi-branch-kpi strong small {
    font-size: 11px;
    font-weight: 600;
    color: var(--hajmi-text-muted);
}

html[data-theme-mode="dark"] .hajmi-branch-compare-icon {
    background: rgba(167, 139, 250, 0.18);
    color: #c4b5fd;
}

html[data-theme-mode="dark"] .hajmi-branch-manage-btn {
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 0.35);
    color: #c4b5fd !important;
}

html[data-theme-mode="dark"] .hajmi-branch-chip.active {
    background: #7c3aed;
    color: #fff;
}

html[data-theme-mode="dark"] .hajmi-branch-bar-track {
    background: rgba(255, 255, 255, 0.08);
}

html[data-theme-mode="dark"] .hajmi-branch-bar-row.tone-green .hajmi-branch-bar-ico { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
html[data-theme-mode="dark"] .hajmi-branch-bar-row.tone-orange .hajmi-branch-bar-ico { background: rgba(249, 115, 22, 0.18); color: #fb923c; }
html[data-theme-mode="dark"] .hajmi-branch-bar-row.tone-blue .hajmi-branch-bar-ico { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }
html[data-theme-mode="dark"] .hajmi-branch-bar-row.tone-rose .hajmi-branch-bar-ico { background: rgba(244, 63, 94, 0.18); color: #fb7185; }

html[data-theme-mode="dark"] .hajmi-branch-bar-row.tone-green .hajmi-branch-bar-pct { background: rgba(34, 197, 94, 0.18); color: #86efac; }
html[data-theme-mode="dark"] .hajmi-branch-bar-row.tone-orange .hajmi-branch-bar-pct { background: rgba(249, 115, 22, 0.18); color: #fdba74; }
html[data-theme-mode="dark"] .hajmi-branch-bar-row.tone-blue .hajmi-branch-bar-pct { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
html[data-theme-mode="dark"] .hajmi-branch-bar-row.tone-rose .hajmi-branch-bar-pct { background: rgba(244, 63, 94, 0.18); color: #fda4af; }

@media (max-width: 991px) {
    .hajmi-branch-kpis {
        grid-template-columns: 1fr 1fr;
    }

    .hajmi-branch-bar-label {
        width: 110px;
    }

    .hajmi-branch-bar-amount {
        width: 120px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .hajmi-branch-compare-head {
        flex-direction: column;
        align-items: stretch;
    }

    .hajmi-branch-manage-btn {
        justify-content: center;
    }

    .hajmi-branch-bar-row {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 8px;
    }

    .hajmi-branch-bar-label {
        width: auto;
        flex: 1;
    }

    .hajmi-branch-bar-track {
        order: 5;
        flex: 1 1 100%;
    }

    .hajmi-branch-bar-pct,
    .hajmi-branch-bar-amount {
        width: auto;
    }

    .hajmi-branch-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.hajmi-view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--hajmi-primary);
    text-decoration: none;
}

.hajmi-view-all:hover {
    text-decoration: underline;
}

/* Employee stats */
.hajmi-emp-total {
    text-align: center;
    margin-bottom: 16px;
}

.hajmi-emp-total-num {
    font-size: 48px;
    font-weight: 800;
    color: var(--hajmi-text);
    line-height: 1;
}

.hajmi-emp-total-label {
    font-size: 13px;
    color: var(--hajmi-text-secondary);
    margin-top: 4px;
}

.hajmi-emp-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hajmi-emp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--hajmi-surface-2);
    border-radius: var(--hajmi-radius-sm);
    font-size: 13px;
}

.hajmi-emp-row .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.hajmi-emp-row .dot.green { background: var(--hajmi-success); }
.hajmi-emp-row .dot.yellow { background: var(--hajmi-warning); }
.hajmi-emp-row .dot.red { background: var(--hajmi-danger); }

.hajmi-emp-row .label { flex: 1; color: var(--hajmi-text-secondary); }
.hajmi-emp-row .count { font-weight: 700; color: var(--hajmi-text); }

/* Chart */
.hajmi-chart-wrap {
    height: 260px;
    position: relative;
}

.hajmi-chart-wrap canvas {
    max-height: 260px;
}

/* Row 3: mini stats */
.hajmi-mini-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.hajmi-mini-card {
    background: var(--hajmi-surface);
    border: 1px solid var(--hajmi-border);
    border-radius: var(--hajmi-radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--hajmi-shadow);
}

.hajmi-mini-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.hajmi-mini-icon.blue { background: rgba(59, 130, 246, 0.12); color: var(--hajmi-info); }
.hajmi-mini-icon.red { background: rgba(239, 68, 68, 0.12); color: var(--hajmi-danger); }
.hajmi-mini-icon.green { background: rgba(16, 185, 129, 0.12); color: var(--hajmi-green); }
.hajmi-mini-icon.purple { background: rgba(139, 92, 246, 0.12); color: var(--hajmi-purple); }

.hajmi-mini-label {
    font-size: 11px;
    color: var(--hajmi-text-muted);
    margin-bottom: 2px;
}

.hajmi-mini-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--hajmi-text);
}

/* Row 4: bottom panels */
.hajmi-row-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 16px;
    margin-bottom: 20px;
}

/* Reminders */
.hajmi-reminder-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hajmi-reminder-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--hajmi-surface-2);
    border-radius: var(--hajmi-radius-sm);
    border: 1px solid var(--hajmi-border);
}

.hajmi-reminder-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.hajmi-reminder-icon.orange { background: rgba(249, 115, 22, 0.12); color: var(--hajmi-orange); }
.hajmi-reminder-icon.purple { background: rgba(139, 92, 246, 0.12); color: var(--hajmi-purple); }
.hajmi-reminder-icon.blue { background: rgba(59, 130, 246, 0.12); color: var(--hajmi-info); }
.hajmi-reminder-icon.green { background: rgba(16, 185, 129, 0.12); color: var(--hajmi-green); }
.hajmi-reminder-icon.red { background: rgba(239, 68, 68, 0.12); color: var(--hajmi-danger); }

.hajmi-reminder-text {
    flex: 1;
    min-width: 0;
}

.hajmi-reminder-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--hajmi-text);
    margin-bottom: 2px;
}

.hajmi-reminder-desc {
    font-size: 12px;
    color: var(--hajmi-text-muted);
}

/* Donut chart */
.hajmi-donut-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hajmi-donut-chart {
    width: 160px;
    height: 160px;
    flex-shrink: 0;
    position: relative;
}

.hajmi-donut-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hajmi-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.hajmi-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.hajmi-legend-name {
    flex: 1;
    color: var(--hajmi-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hajmi-legend-pct {
    font-weight: 700;
    color: var(--hajmi-text);
}

/* Payments table */
.hajmi-table-wrap {
    overflow-x: auto;
}

.hajmi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.hajmi-table th {
    text-align: right;
    padding: 10px 8px;
    color: var(--hajmi-text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--hajmi-border);
    white-space: nowrap;
}

.hajmi-table td {
    padding: 10px 8px;
    color: var(--hajmi-text);
    border-bottom: 1px solid var(--hajmi-border);
}

.hajmi-table tr:last-child td {
    border-bottom: none;
}

.hajmi-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.hajmi-status.paid {
    background: rgba(34, 197, 94, 0.12);
    color: var(--hajmi-success);
}

.hajmi-status.pending {
    background: rgba(245, 158, 11, 0.12);
    color: var(--hajmi-warning);
}

/* Payroll detail expandable (mobile) */
.hajmi-payroll-detail {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--hajmi-border);
    font-size: 12px;
    color: var(--hajmi-text-secondary);
}

.hajmi-payroll-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.hajmi-empty {
    text-align: center;
    padding: 24px;
    color: var(--hajmi-text-muted);
    font-size: 13px;
}

/* Dashboard payments — mobile accordion */
.hajmi-dash-mobile-list {
    display: none;
}

/* ---- Responsive ---- */
@media (min-width: 992px) {
    .header-search {
        display: block;
    }

    .hajmi-welcome-date {
        display: none;
    }
}

@media (max-width: 1200px) {
    .hajmi-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hajmi-row-3 {
        grid-template-columns: 1fr;
    }

    .hajmi-mini-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .hajmi-row-bottom {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991px) {
    .admin-container {
        display: block;
    }

    .admin-sidebar {
        position: fixed !important;
        top: 0;
        bottom: 0;
        left: auto !important;
        right: calc(-1 * min(280px, 85vw)) !important;
        z-index: 1001;
        width: min(280px, 85vw) !important;
        max-width: min(280px, 85vw) !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        transform: none !important;
        transition: right 0.3s ease !important;
        box-shadow: var(--hajmi-shadow-lg) !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .admin-sidebar.active {
        right: 0 !important;
    }

    .admin-sidebar .sidebar-nav {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .admin-sidebar .sidebar-footer {
        flex-shrink: 0;
    }

    body.admin-sidebar-open {
        overflow: hidden !important;
        touch-action: none;
    }

    .sidebar-close-btn {
        display: flex;
    }

    .sidebar-header {
        position: relative;
        padding-top: 20px !important;
        flex-shrink: 0;
    }

    .header-theme-option span {
        display: none;
    }

    .header-theme-option {
        width: 32px;
        height: 32px;
        padding: 0;
        justify-content: center;
    }

    .hajmi-header .header-user-text {
        display: none;
    }

    .hajmi-header .header-page-title {
        font-size: 14px;
    }

    .admin-main {
        padding: 16px !important;
    }

    .admin-footer {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    .hajmi-welcome {
        margin-bottom: 16px;
    }

    .hajmi-welcome h2 {
        font-size: 17px;
        margin-bottom: 2px;
    }

    .hajmi-welcome p {
        font-size: 12px;
        line-height: 1.5;
    }

    .hajmi-welcome-date {
        display: block;
        font-size: 11px;
        margin-top: 4px;
    }

    .hajmi-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .hajmi-stat-card {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
        padding: 12px 10px;
    }

    .hajmi-stat-value {
        font-size: 14px;
        line-height: 1.35;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .hajmi-mini-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hajmi-donut-wrap {
        flex-direction: column;
    }

    .admin-wrapper.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .hajmi-dashboard .hajmi-table-wrap.hajmi-dash-desktop-table {
        display: none !important;
    }

    .hajmi-dash-mobile-list {
        display: block;
        background: var(--hajmi-surface);
        border: 1px solid var(--hajmi-border);
        border-radius: var(--hajmi-radius-sm);
        overflow: hidden;
    }

    .hajmi-dash-mobile-head {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) auto 32px;
        gap: 8px;
        padding: 10px 12px;
        background: var(--hajmi-surface-2);
        border-bottom: 1px solid var(--hajmi-border);
        font-size: 10px;
        font-weight: 700;
        color: var(--hajmi-text-muted);
    }

    .hajmi-dash-acc-item {
        border-bottom: 1px solid var(--hajmi-border);
    }

    .hajmi-dash-acc-item:last-child {
        border-bottom: none;
    }

    .hajmi-dash-acc-summary {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr) auto 32px;
        gap: 8px;
        align-items: center;
        padding: 10px 12px;
        font-size: 12px;
    }

    .hajmi-dash-acc-item.is-open .hajmi-dash-acc-summary {
        background: var(--hajmi-surface-2);
    }

    .hajmi-dash-m-name {
        font-weight: 700;
        color: var(--hajmi-text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hajmi-dash-m-amount {
        font-weight: 700;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    .hajmi-dash-m-date {
        font-size: 11px;
        color: var(--hajmi-text-muted);
        white-space: nowrap;
    }

    .hajmi-dash-acc-toggle {
        width: 28px;
        height: 28px;
        border: 1px solid var(--hajmi-border);
        border-radius: 8px;
        background: var(--hajmi-surface);
        color: var(--hajmi-text-muted);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .hajmi-dash-acc-panel {
        display: none;
        padding: 0 12px 12px;
    }

    .hajmi-dash-acc-item.is-open .hajmi-dash-acc-panel {
        display: block;
    }

    .hajmi-dash-acc-meta {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 10px;
        background: var(--hajmi-surface-2);
        border-radius: var(--hajmi-radius-sm);
        font-size: 11px;
    }

    .hajmi-dash-acc-meta-row {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .hajmi-dash-acc-label {
        color: var(--hajmi-text-muted);
        font-weight: 600;
    }

    .hajmi-dash-acc-value {
        color: var(--hajmi-text);
        font-weight: 700;
    }

    .hajmi-payroll-detail {
        margin-top: 8px;
        padding-top: 8px;
    }
}

@media (max-width: 480px) {
    .hajmi-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hajmi-mini-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hajmi-stat-card {
        padding: 14px 12px;
    }

    .hajmi-stat-value {
        font-size: 14px;
    }

    .hajmi-stat-label {
        font-size: 11px;
    }

    .hajmi-mini-card {
        padding: 10px 12px;
    }

    .hajmi-mini-value {
        font-size: 12px;
    }
}

/* Dark mode chart adjustments */
html[data-theme-mode="dark"] .hajmi-panel,
html[data-theme-mode="dark"] .hajmi-stat-card,
html[data-theme-mode="dark"] .hajmi-mini-card {
    border-color: var(--hajmi-border);
}

html[data-theme-mode="dark"] .admin-footer {
    background: var(--hajmi-surface) !important;
    color: var(--hajmi-text) !important;
    border-color: var(--hajmi-border) !important;
}

html[data-theme-mode="dark"] body,
html[data-theme-mode="dark"] .admin-wrapper,
html[data-theme-mode="dark"] .admin-main {
    background: var(--hajmi-bg) !important;
    color: var(--hajmi-text);
}

html[data-theme-mode="dark"] .admin-sidebar {
    background: var(--hajmi-sidebar) !important;
}

.admin-sidebar {
    background: var(--hajmi-sidebar) !important;
}

.admin-main {
    background: var(--hajmi-bg) !important;
}

/* Employee Rubika connect CTA */
.emp-rubika-dash-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 0 0 20px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid #dbe4f0;
    background: linear-gradient(135deg, #f0f7ff 0%, #f8fafc 100%);
}
.emp-rubika-dash-cta.is-connected {
    border-color: #bbf7d0;
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
}
.emp-rubika-dash-cta__icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #fff;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.emp-rubika-dash-cta.is-connected .emp-rubika-dash-cta__icon {
    background: #16a34a;
}
.emp-rubika-dash-cta__body {
    flex: 1 1 180px;
    min-width: 0;
}
.emp-rubika-dash-cta__body h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}
.emp-rubika-dash-cta__body p {
    margin: 0;
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.5;
}
.emp-rubika-dash-cta__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 10px;
    background: #2563eb;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}
.emp-rubika-dash-cta.is-connected .emp-rubika-dash-cta__btn {
    background: #0f766e;
}
.emp-rubika-dash-cta__btn:hover {
    filter: brightness(1.05);
}
