/* ============================================
   CSS Design System - Tech Budget Dashboard
   ============================================ */

:root {
    /* Dark Theme Colors */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a1f35;
    --bg-card-hover: #1f2545;
    --bg-surface: rgba(26, 31, 53, 0.8);
    --bg-glass: rgba(17, 24, 39, 0.6);
    
    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-primary-light: #818cf8;
    --accent-secondary: #06b6d4;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-orange: #f97316;
    
    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #818cf8;
    
    /* Borders */
    --border-color: rgba(99, 102, 241, 0.15);
    --border-subtle: rgba(148, 163, 184, 0.1);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-secondary: linear-gradient(135deg, #06b6d4, #3b82f6);
    --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #f97316);
    --gradient-danger: linear-gradient(135deg, #ef4444, #ec4899);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    
    /* Sizing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: width var(--transition-normal);
    backdrop-filter: blur(20px);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-menu {
    list-style: none;
    padding: 12px 10px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary-light);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent-primary);
    border-radius: 0 3px 3px 0;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: white;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.72rem;
    color: var(--accent-primary-light);
    font-weight: 500;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

.top-header {
    height: var(--header-height);
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
}

.menu-toggle svg {
    width: 22px;
    height: 22px;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.btn-export {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-export:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ============================================
   TAB CONTENT
   ============================================ */
.tab-content {
    display: none;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   KPI CARDS
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.kpi-total::before { background: var(--gradient-primary); }
.kpi-spent::before { background: var(--gradient-secondary); }
.kpi-contracts::before { background: var(--gradient-warning); }
.kpi-team::before { background: var(--gradient-success); }

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(99, 102, 241, 0.3);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-total .kpi-icon { background: rgba(99, 102, 241, 0.15); color: var(--accent-primary-light); }
.kpi-spent .kpi-icon { background: rgba(6, 182, 212, 0.15); color: var(--accent-secondary); }
.kpi-contracts .kpi-icon { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }
.kpi-team .kpi-icon { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }

.kpi-icon svg {
    width: 24px;
    height: 24px;
}

.kpi-content {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.5px;
}

.kpi-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-warning {
    color: var(--accent-warning) !important;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.25);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

.card-chart {
    grid-column: span 2;
}

.card-payments, .card-alerts {
    grid-column: span 2;
}

/* ============================================
   DATA TABLE
   ============================================ */
.budget-table-wrapper, .forecast-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table thead th {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.data-table tbody tr.row-category {
    background: rgba(99, 102, 241, 0.08);
    font-weight: 700;
}

.data-table tbody tr.row-ending {
    background: rgba(239, 68, 68, 0.08);
    border-left: 3px solid var(--accent-danger);
}

.data-table tbody td {
    padding: 10px 14px;
    color: var(--text-primary);
    white-space: nowrap;
}

.data-table tbody td.amount {
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    font-weight: 500;
}

.data-table tbody td.amount-highlight {
    color: var(--accent-primary-light);
    font-weight: 700;
}

/* ============================================
   BUDGET VIEW
   ============================================ */
.budget-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-group select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast);
}

.filter-group select:focus {
    border-color: var(--accent-primary);
}

.view-toggle {
    margin-left: auto;
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    padding: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.btn-view {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-view.active {
    background: var(--accent-primary);
    color: white;
}

.budget-summary-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.summary-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 180px;
}

.summary-item .label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.summary-item .value {
    font-size: 1.15rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.summary-item.highlight .value {
    color: var(--accent-primary-light);
}

.hidden {
    display: none !important;
}

.budget-cards-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
}

.budget-card-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    transition: all var(--transition-normal);
}

.budget-card-item:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

.budget-card-item.ending {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.05);
}

.budget-card-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.budget-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.budget-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
}

.budget-card-amount {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--accent-primary-light);
}

/* ============================================
   CONTRACTS
   ============================================ */
.contracts-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.contracts-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-md);
}

.stat-badge .stat-num {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 1.2rem;
}

.stat-badge .stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.contracts-filters {
    display: flex;
    gap: 8px;
}

.contracts-filters select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
}

.contracts-timeline {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.contract-row {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr 140px 140px 180px 100px;
    align-items: center;
    gap: 12px;
    transition: all var(--transition-fast);
}

.contract-row:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.contract-row.ending-soon {
    border-left: 4px solid var(--accent-danger);
    background: rgba(239, 68, 68, 0.05);
}

.contract-row.ending-soon .contract-status {
    color: var(--accent-danger);
}

.contract-name {
    font-weight: 600;
}

.contract-name .sub {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
}

.contract-vendor {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.contract-amount {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent-primary-light);
}

.contract-cycle {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.contract-status {
    font-size: 0.82rem;
    font-weight: 600;
}

.status-active { color: var(--accent-success); }
.status-ending { color: var(--accent-danger); }

.monthly-forecast-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.monthly-forecast-card .card-header {
    border-bottom: 1px solid var(--border-subtle);
}

.btn-export-sm {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-primary-light);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-export-sm:hover {
    background: rgba(99, 102, 241, 0.25);
}

.forecast-table {
    font-size: 0.82rem;
}

.forecast-table thead th {
    text-align: center;
}

.forecast-table tbody td {
    text-align: center;
}

.forecast-table .month-total {
    font-weight: 800;
    color: var(--accent-primary-light);
    background: rgba(99, 102, 241, 0.08);
}

/* ============================================
   HR
   ============================================ */
.hr-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.card-org {
    grid-column: span 2;
}

.org-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.org-level {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.org-node {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    text-align: center;
    min-width: 180px;
    transition: all var(--transition-normal);
    position: relative;
}

.org-node:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.org-node.leader {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.08);
}

.org-node.hiring {
    border-style: dashed;
    border-color: rgba(245, 158, 11, 0.5);
    opacity: 0.8;
}

.org-node .node-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.org-node .node-role {
    font-size: 0.78rem;
    color: var(--accent-primary-light);
    font-weight: 600;
}

.org-node .node-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.org-node .node-status {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.org-node .node-status.active { background: var(--accent-success); }
.org-node .node-status.hiring-status { background: var(--accent-warning); animation: pulse 2s infinite; }
.org-node .node-status.planned { background: var(--text-muted); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.org-connector {
    width: 2px;
    height: 20px;
    background: var(--border-color);
    margin: 0 auto;
}

.team-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card-hover);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.team-member:hover {
    background: rgba(99, 102, 241, 0.1);
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.member-role {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.member-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.member-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.member-status.hiring {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

.member-status.planned {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

.btn-add {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-success);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-add:hover {
    background: rgba(16, 185, 129, 0.25);
}

.hiring-plan {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hiring-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card-hover);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-warning);
}

.hiring-title {
    font-weight: 600;
}

.hiring-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.hiring-salary {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent-primary-light);
    font-size: 0.9rem;
}

.hiring-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chart-container {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-bar-label {
    width: 160px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.chart-bar-track {
    flex: 1;
    height: 24px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    transition: width 1s ease;
    min-width: fit-content;
}

.chart-bar-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--text-secondary);
    width: 100px;
    text-align: right;
    flex-shrink: 0;
}

/* Monthly Spending Bars */
.month-bar-row {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 180px;
    padding: 0 10px;
    justify-content: space-around;
}

.month-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
}

.month-bar {
    width: 100%;
    max-width: 50px;
    border-radius: 6px 6px 0 0;
    background: var(--gradient-primary);
    transition: height 1s ease;
    min-height: 4px;
    position: relative;
    cursor: pointer;
}

.month-bar:hover {
    opacity: 0.85;
}

.month-bar .tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    white-space: nowrap;
    z-index: 10;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.month-bar:hover .tooltip {
    display: block;
}

.month-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ============================================
   TIMELINE / GANTT
   ============================================ */
.timeline-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.timeline-legend {
    margin-left: auto;
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.green { background: var(--accent-success); }
.legend-dot.yellow { background: var(--accent-warning); }
.legend-dot.red { background: var(--accent-danger); }

.gantt-wrapper {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.gantt-chart {
    min-width: 1200px;
}

.gantt-header {
    display: grid;
    grid-template-columns: 50px 60px 300px 80px 200px 80px repeat(var(--weeks), 1fr);
    background: rgba(99, 102, 241, 0.1);
    border-bottom: 2px solid var(--border-color);
}

.gantt-header-cell {
    padding: 10px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
    border-right: 1px solid var(--border-subtle);
}

.gantt-header-cell.week-cell {
    font-size: 0.65rem;
    line-height: 1.3;
}

.gantt-header-cell.current-week {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary-light);
}

.gantt-row {
    display: grid;
    grid-template-columns: 50px 60px 300px 80px 200px 80px repeat(var(--weeks), 1fr);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

.gantt-row:hover {
    background: rgba(99, 102, 241, 0.03);
}

.gantt-cell {
    padding: 10px 8px;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    border-right: 1px solid var(--border-subtle);
}

.gantt-cell.center {
    justify-content: center;
}

.gantt-cell.id-cell {
    font-weight: 700;
    color: var(--text-muted);
    justify-content: center;
}

.gantt-cell.phase-cell {
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
}

.gantt-cell.phase-cell.p0 {
    color: var(--accent-danger);
}

.gantt-cell.phase-cell.p1 {
    color: var(--accent-warning);
}

.gantt-cell.project-cell {
    font-weight: 500;
    font-size: 0.8rem;
}

.gantt-cell.owner-cell {
    color: var(--text-secondary);
    font-size: 0.78rem;
    justify-content: center;
}

.gantt-cell.blocker-cell {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.gantt-cell.status-cell {
    justify-content: center;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-dot.green { background: var(--accent-success); }
.status-dot.yellow { background: var(--accent-warning); }
.status-dot.red { background: var(--accent-danger); }

.gantt-cell.week-cell {
    justify-content: center;
    padding: 4px;
}

.gantt-cell.week-cell.current-week {
    background: rgba(99, 102, 241, 0.05);
}

.week-block {
    width: 100%;
    height: 20px;
    border-radius: 4px;
}

.week-block.green { background: var(--gradient-success); opacity: 0.7; }
.week-block.yellow { background: var(--gradient-warning); opacity: 0.7; }
.week-block.red { background: var(--gradient-danger); opacity: 0.7; }

/* ============================================
   AI CHAT
   ============================================ */
.chat-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    height: calc(100vh - var(--header-height) - 48px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chat-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
}

.chat-sidebar h3 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.chat-sidebar h4 {
    font-size: 0.82rem;
    margin: 16px 0 8px;
    color: var(--text-secondary);
}

.suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.suggestion-btn {
    text-align: left;
    padding: 10px 12px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: 'Inter', sans-serif;
}

.suggestion-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-primary);
    border-color: rgba(99, 102, 241, 0.3);
}

.chat-actions {
    margin-top: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-sm);
    color: var(--accent-success);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 6px;
    font-family: 'Inter', sans-serif;
}

.action-btn:hover {
    background: rgba(16, 185, 129, 0.15);
}

.chat-main {
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.bot {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.chat-message.user .message-avatar {
    background: var(--gradient-primary);
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.message-content {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-subtle);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.6;
}

.chat-message.user .message-content {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.message-content p { margin-bottom: 8px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul { margin: 8px 0; padding-left: 20px; }
.message-content li { margin-bottom: 4px; }
.message-content strong { color: var(--accent-primary-light); }
.message-content code {
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.82rem;
}

.message-content table th,
.message-content table td {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.message-content table th {
    background: rgba(99, 102, 241, 0.1);
    font-weight: 600;
}

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input-wrapper textarea {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    resize: none;
    outline: none;
    transition: border-color var(--transition-fast);
    max-height: 120px;
}

.chat-input-wrapper textarea:focus {
    border-color: var(--accent-primary);
}

.btn-send {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.btn-send svg {
    width: 20px;
    height: 20px;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ============================================
   PAYMENT LIST
   ============================================ */
.payment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.payment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card-hover);
    border-radius: var(--radius-sm);
    border-left: 3px solid;
    transition: all var(--transition-fast);
}

.payment-item:hover {
    background: rgba(99, 102, 241, 0.08);
}

.payment-item.urgent { border-color: var(--accent-danger); }
.payment-item.upcoming { border-color: var(--accent-warning); }
.payment-item.normal { border-color: var(--accent-success); }

.payment-info .payment-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.payment-info .payment-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.payment-amount {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--accent-primary-light);
    font-size: 0.9rem;
}

/* Alerts */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
}

.alert-icon {
    font-size: 1.2rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    font-size: 0.88rem;
}

.alert-detail {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.alert-date {
    font-size: 0.78rem;
    color: var(--accent-danger);
    font-weight: 600;
}

/* Badge */
.badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-info {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary-light);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 480px;
    max-width: 95vw;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.btn-cancel {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-cancel:hover {
    background: rgba(255,255,255,0.05);
}

.btn-save {
    padding: 8px 20px;
    background: var(--gradient-primary);
    border: none;
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-save:hover {
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .card-chart {
        grid-column: span 1;
    }
    .hr-grid {
        grid-template-columns: 1fr;
    }
    .card-org {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .menu-toggle {
        display: block;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .card-chart, .card-payments, .card-alerts {
        grid-column: span 1;
    }
    .chat-container {
        grid-template-columns: 1fr;
    }
    .chat-sidebar {
        display: none;
    }
    .contract-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .budget-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .view-toggle {
        margin-left: 0;
    }
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.btn-theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-theme-toggle:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary-light);
    border-color: rgba(99, 102, 241, 0.3);
    transform: rotate(15deg);
}

/* ============================================
   LIGHT MODE THEME
   ============================================ */
body.light-mode {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fb;
    --bg-surface: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.7);
    --accent-primary: #4f46e5;
    --accent-primary-light: #4338ca;
    --accent-secondary: #0891b2;
    --accent-success: #059669;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-accent: #4338ca;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-subtle: rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.1);
}

body.light-mode .sidebar {
    background: #ffffff;
    box-shadow: 2px 0 12px rgba(0,0,0,0.05);
}

body.light-mode .top-header {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

body.light-mode .kpi-card { box-shadow: var(--shadow-sm); }
body.light-mode .kpi-card:hover { box-shadow: 0 4px 20px rgba(79, 70, 229, 0.12); }
body.light-mode .card { box-shadow: var(--shadow-sm); }
body.light-mode .nav-item.active { background: rgba(79, 70, 229, 0.08); color: var(--accent-primary); }
body.light-mode .nav-item.active::before { background: var(--accent-primary); }
body.light-mode .nav-item:hover { background: rgba(79, 70, 229, 0.06); }
body.light-mode .page-title { background: linear-gradient(135deg, #4f46e5, #7c3aed); -webkit-background-clip: text; background-clip: text; }
body.light-mode .data-table thead th { background: rgba(79, 70, 229, 0.06); color: #475569; }
body.light-mode .data-table tbody tr:hover { background: rgba(79, 70, 229, 0.03); }
body.light-mode .data-table tbody tr.row-category { background: rgba(79, 70, 229, 0.05); }
body.light-mode .data-table tbody tr.row-ending { background: rgba(220, 38, 38, 0.04); }
body.light-mode .filter-group select { background: #ffffff; border-color: #e2e8f0; }
body.light-mode .contract-row { box-shadow: var(--shadow-sm); }
body.light-mode .contract-row:hover { box-shadow: var(--shadow-md); }
body.light-mode .org-node { box-shadow: var(--shadow-sm); }
body.light-mode .org-node:hover { box-shadow: var(--shadow-md); }
body.light-mode .org-node.leader { background: rgba(79, 70, 229, 0.04); border-color: rgba(79, 70, 229, 0.3); }
body.light-mode .chat-container { box-shadow: var(--shadow-md); }
body.light-mode .message-content { background: #f1f5f9; border-color: #e2e8f0; }
body.light-mode .chat-message.user .message-content { background: rgba(79, 70, 229, 0.08); border-color: rgba(79, 70, 229, 0.2); }
body.light-mode .chat-input-wrapper textarea { background: #f8f9fb; border-color: #e2e8f0; }
body.light-mode .suggestion-btn { background: #f8f9fb; border-color: #e2e8f0; }
body.light-mode .suggestion-btn:hover { background: rgba(79, 70, 229, 0.06); border-color: rgba(79, 70, 229, 0.2); }
body.light-mode .gantt-header { background: rgba(79, 70, 229, 0.05); }
body.light-mode .gantt-header-cell.current-week { background: rgba(79, 70, 229, 0.1); }
body.light-mode .budget-card-item { box-shadow: var(--shadow-sm); }
body.light-mode .budget-card-item:hover { box-shadow: var(--shadow-md); }
body.light-mode .stat-badge { box-shadow: var(--shadow-sm); }
body.light-mode .payment-item { background: #f8f9fb; }
body.light-mode .alert-item { background: rgba(220, 38, 38, 0.03); border-color: rgba(220, 38, 38, 0.12); }
body.light-mode .summary-item { box-shadow: var(--shadow-sm); }
body.light-mode .modal { box-shadow: var(--shadow-lg); }
body.light-mode .form-group input, body.light-mode .form-group select { background: #f8f9fb; border-color: #e2e8f0; }
body.light-mode .team-member { background: #f8f9fb; }
body.light-mode .team-member:hover { background: rgba(79, 70, 229, 0.05); }
body.light-mode .hiring-item { background: #f8f9fb; }
body.light-mode .chart-bar-track { background: rgba(79, 70, 229, 0.05); }
body.light-mode ::-webkit-scrollbar-thumb { background: #cbd5e1; }
body.light-mode ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
body.light-mode .contracts-filters select { background: #ffffff; border-color: #e2e8f0; }
body.light-mode .chat-sidebar { background: #f8f9fb; }
body.light-mode .chat-input-area { background: #f8f9fb; }
body.light-mode .action-btn { background: rgba(5, 150, 105, 0.06); border-color: rgba(5, 150, 105, 0.15); }

/* Smooth transitions for theme switch */
body, .sidebar, .top-header, .kpi-card, .card, .nav-item,
.data-table thead th, .contract-row, .org-node, .chat-container,
.message-content, .suggestion-btn, .gantt-header, .payment-item,
.alert-item, .summary-item, .team-member, .hiring-item,
.btn-theme-toggle, .filter-group select, .modal {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
