/* ============================================
   HUMAND PEOPLE COMPASS — Modern HR Dashboard
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;

    /* Colors */
    --primary: #367c2b;
    --primary-light: #4f9a40;
    --primary-dark: #24581d;
    --primary-bg: rgba(54, 124, 43, 0.1);

    --accent: #f2b705;
    --accent-light: #ffd85a;

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Sidebar */
    --sidebar-bg: #121915;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-active: rgba(242, 183, 5, 0.12);
    --sidebar-text: #9fb2a0;
    --sidebar-text-active: #f3f7f1;
    --sidebar-border: rgba(255, 255, 255, 0.06);

    /* Content */
    --bg: #eef2eb;
    --bg-card: #ffffff;
    --bg-card-hover: #fbfcfa;
    --text-primary: #152218;
    --text-secondary: #425647;
    --text-muted: #75867a;
    --border: #d7e1d5;
    --border-light: #edf2eb;

    --ag-green-bg: rgba(54, 124, 43, 0.08);
    --ag-surface: #f9fbf8;
    --ag-panel: #ffffff;
    --ag-border: rgba(21, 34, 24, 0.08);
    --ag-border-strong: rgba(21, 34, 24, 0.14);
    --ag-border-faint: rgba(54, 124, 43, 0.06);
    --ag-text: #152218;
    --ag-text-muted: #5a6a5f;
    --ag-text-subtle: #78877c;
    --ag-green: #367c2b;
    --ag-green-dk: #24581d;
    --ag-green-focus: rgba(54, 124, 43, 0.18);
    --ag-text-inverse: #ffffff;
    --ag-error-bg: rgba(191, 54, 38, 0.08);
    --ag-error-border: rgba(191, 54, 38, 0.2);
    --ag-error-text: #9f2f23;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    /* Radius */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========== RESET & BASE =========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background:
        radial-gradient(circle at top right, rgba(242, 183, 5, 0.12), transparent 26%),
        linear-gradient(180deg, rgba(54, 124, 43, 0.04), rgba(54, 124, 43, 0.01) 220px),
        var(--bg);
    overflow-x: hidden;
}

/* =========== LAYOUT =========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* =========== SIDEBAR =========== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand .brand-name {
    color: #f1f5f9;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Titillium Web', 'Inter', sans-serif;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.sidebar-brand .brand-sub {
    color: var(--sidebar-text);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.sidebar-nav .nav-section {
    margin-bottom: 8px;
}

.sidebar-nav .nav-section-title {
    color: var(--sidebar-text);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 12px 14px 6px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

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

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

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

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

.sidebar-footer p {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-align: center;
    opacity: 0.6;
}

/* =========== MAIN CONTENT =========== */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition-slow);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========== TOPBAR =========== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
}

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

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.topbar-title h1 {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Titillium Web', 'Inter', sans-serif;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.topbar-title p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: -2px;
}

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

.topbar-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-bg);
    color: var(--primary);
}

.topbar-badge i {
    font-size: 0.7rem;
}

/* =========== PAGE CONTENT =========== */
.page-content {
    flex: 1;
    padding: 24px 28px 40px;
}

/* =========== KPI CARDS =========== */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kpi-card.kpi-primary::before { background: var(--primary); }
.kpi-card.kpi-success::before { background: var(--success); }
.kpi-card.kpi-warning::before { background: var(--warning); }
.kpi-card.kpi-danger::before { background: var(--danger); }
.kpi-card.kpi-info::before { background: var(--info); }
.kpi-card.kpi-accent::before { background: var(--accent); }

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.kpi-header .kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-header .kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.kpi-icon.icon-primary { background: var(--primary-bg); color: var(--primary); }
.kpi-icon.icon-success { background: var(--success-bg); color: var(--success); }
.kpi-icon.icon-warning { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.icon-danger { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.icon-info { background: var(--info-bg); color: var(--info); }
.kpi-icon.icon-accent { background: rgba(139, 92, 246, 0.1); color: var(--accent); }

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.kpi-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 8px;
}

.kpi-trend.up { background: var(--success-bg); color: var(--success); }
.kpi-trend.down { background: var(--danger-bg); color: var(--danger); }
.kpi-trend.stable { background: var(--border-light); color: var(--text-muted); }

/* =========== CARDS / PANELS =========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

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

.card-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.card-header h2 i {
    color: var(--primary);
    font-size: 0.9rem;
}

.card-header .card-actions {
    display: flex;
    gap: 8px;
}

.card-body {
    padding: 22px;
}

.card-body.compact {
    padding: 16px 22px;
}

/* =========== FILTER BAR =========== */
.filter-bar {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg);
    transition: var(--transition);
    outline: none;
}

.filter-group select:focus,
.filter-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

/* =========== BUTTONS =========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
}

.btn-ghost:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.78rem;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border: 1.5px solid var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: white;
}

/* =========== CHARTS =========== */
.chart-container {
    width: 100%;
    height: 300px;
    position: relative;
}

.chart-container.chart-sm { height: 200px; }
.chart-container.chart-lg { height: 400px; }

.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
}

.chart-empty i {
    font-size: 2.5rem;
    opacity: 0.3;
}

.chart-empty p {
    font-size: 0.85rem;
}

/* =========== DATA TABLES =========== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td {
    padding: 11px 16px;
    text-align: left;
    font-size: 0.85rem;
}

.data-table thead th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tbody td {
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

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

.data-table tbody tr {
    transition: var(--transition);
}

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

.data-table .cell-strong {
    font-weight: 600;
    color: var(--text-primary);
}

/* =========== PROGRESS BAR =========== */
.progress-bar {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    width: 100%;
}

.progress-bar .progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.fill-primary { background: var(--primary); }
.progress-fill.fill-success { background: var(--success); }
.progress-fill.fill-warning { background: var(--warning); }
.progress-fill.fill-danger { background: var(--danger); }
.progress-fill.fill-info { background: var(--info); }

.progress-bar-lg {
    height: 10px;
    border-radius: 999px;
}

.progress-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* =========== BADGES / TAGS =========== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--border-light); color: var(--text-muted); }

/* =========== ALERTS =========== */
.alert-card {
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px solid;
    margin-bottom: 12px;
    transition: var(--transition);
}

.alert-card:last-child {
    margin-bottom: 0;
}

.alert-card:hover {
    transform: translateX(2px);
}

.alert-card.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.04), rgba(239, 68, 68, 0.01));
    border-color: rgba(239, 68, 68, 0.2);
    border-left: 4px solid var(--danger);
}

.alert-card.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.04), rgba(245, 158, 11, 0.01));
    border-color: rgba(245, 158, 11, 0.2);
    border-left: 4px solid var(--warning);
}

.alert-card.alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.04), rgba(59, 130, 246, 0.01));
    border-color: rgba(59, 130, 246, 0.2);
    border-left: 4px solid var(--info);
}

.alert-card.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.04), rgba(16, 185, 129, 0.01));
    border-color: rgba(16, 185, 129, 0.2);
    border-left: 4px solid var(--success);
}

.alert-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.alert-card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.alert-card-tags {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.alert-card-body p {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
}

.alert-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.alert-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.alert-card-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

/* =========== METRIC GRID (for detail pages) =========== */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}

.metric-mini {
    text-align: center;
    padding: 16px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.metric-mini .metric-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.metric-mini .metric-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
}

.metric-mini .metric-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* =========== EMPTY STATE =========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    color: var(--border);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 300px;
}

/* =========== FORM ELEMENTS =========== */
.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-group textarea {
    min-height: 90px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* =========== LOADING STATES =========== */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.loading-skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--bg) 50%, var(--border-light) 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
    height: 20px;
}

.loading-value {
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

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

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* =========== TOAST NOTIFICATIONS =========== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 320px;
    max-width: 420px;
    padding: 14px 18px;
    border-radius: var(--radius);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 9999;
    box-shadow: var(--shadow-xl);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: #1a1a1a; }
.toast-info { background: var(--info); }

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0.7;
    transition: var(--transition);
}

.toast-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }

/* =========== COMPARISON SECTION =========== */
.comparison-result {
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-top: 14px;
}

.comparison-details h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.comparison-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.comparison-row:last-child {
    border-bottom: none;
}

.comparison-row.positive { color: var(--success); font-weight: 600; }
.comparison-row.negative { color: var(--danger); font-weight: 600; }

/* =========== CHART NOTES =========== */
.chart-notes {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--info-bg);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--info);
    line-height: 1.5;
}

.chart-notes i { margin-right: 6px; }

/* =========== PAGE SPECIFIC: INDEX QUICK LINKS =========== */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.quick-link:hover {
    background: var(--primary-bg);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    transform: translateY(-1px);
}

.quick-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* =========== AUTH / LOGIN =========== */
.topbar-inline-form {
    margin: 0;
}

.topbar-user-badge {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-page {
    min-height: 100vh;
    background:
        linear-gradient(115deg, rgba(54, 124, 43, 0.06), rgba(54, 124, 43, 0.01) 50%),
        linear-gradient(0deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.88)),
        repeating-linear-gradient(90deg, var(--ag-border-faint) 0, var(--ag-border-faint) 1px, transparent 1px, transparent 42px);
    display: grid;
    place-items: center;
    padding: 32px 20px;
}

.auth-grid {
    width: min(1160px, 100%);
    min-height: 680px;
    display: grid;
    grid-template-columns: 1.2fr 0.9fr;
    border: 1px solid var(--ag-border-strong);
    box-shadow: 0 28px 80px rgba(17, 24, 18, 0.14);
    background: var(--ag-panel);
}

.auth-brand-panel {
    padding: 56px;
    border-right: 1px solid var(--ag-border);
    background: linear-gradient(155deg, rgba(54, 124, 43, 0.1), rgba(255, 255, 255, 0.9) 48%, rgba(242, 183, 5, 0.08));
    display: grid;
    align-content: space-between;
    gap: 32px;
}

.auth-brand-lockup {
    display: flex;
    align-items: center;
    gap: 18px;
}

.auth-brand-mark {
    width: 84px;
    height: 84px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--primary), #2e6c23);
    color: white;
    font-family: 'Titillium Web', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    box-shadow: 0 20px 40px rgba(54, 124, 43, 0.22);
}

.auth-brand-name,
.auth-brand-copy h1,
.auth-form-panel h2 {
    font-family: 'Titillium Web', 'Inter', sans-serif;
}

.auth-brand-name {
    margin: 0;
    font-size: 2.6rem;
    line-height: 0.95;
    font-weight: 700;
}

.auth-brand-sub {
    margin: 6px 0 0;
    color: var(--ag-text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.auth-kicker {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--primary);
}

.auth-brand-copy h1 {
    margin: 0;
    font-size: clamp(2.8rem, 5vw, 4.4rem);
    line-height: 0.96;
}

.auth-brand-copy p,
.auth-panel-copy {
    margin: 18px 0 0;
    color: var(--ag-text-muted);
    max-width: 560px;
    font-size: 1rem;
}

.auth-feature-list {
    margin-top: 28px;
    display: grid;
    gap: 14px;
}

.auth-feature-item {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ag-text);
    font-weight: 600;
}

.auth-feature-item i {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(54, 124, 43, 0.1);
    color: var(--primary);
}

.auth-form-panel {
    padding: 56px 44px 38px;
    display: grid;
    align-content: start;
    gap: 28px;
    background: rgba(255, 255, 255, 0.94);
}

.auth-form-panel h2 {
    margin: 0;
    font-size: 2.2rem;
    line-height: 1;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.auth-form-row {
    display: grid;
    gap: 8px;
}

.auth-form-row label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ag-text);
}

.auth-input-wrap {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ag-text-subtle);
}

.auth-input-wrap input {
    width: 100%;
    height: 48px;
    border-radius: 10px;
    border: 1px solid var(--ag-border-strong);
    background: var(--ag-surface);
    color: var(--ag-text);
    padding: 0 14px 0 44px;
    font-size: 0.97rem;
}

.auth-input-wrap input:focus {
    outline: none;
    border-color: var(--ag-green);
    box-shadow: 0 0 0 4px var(--ag-green-focus);
}

.auth-submit {
    height: 46px;
    border: 1px solid var(--ag-green-dk);
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 16px 34px rgba(54, 124, 43, 0.22);
}

.auth-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.ag-error-banner {
    border: 1px solid var(--ag-error-border);
    background: var(--ag-error-bg);
    color: var(--ag-error-text);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.84rem;
    font-weight: 600;
}

.auth-footer-note {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ag-text-subtle);
    font-size: 0.8rem;
}

.auth-footer-line {
    flex: 1;
    height: 1px;
    background: var(--ag-border);
}

.dashboard-hero,
.dashboard-pulse-grid {
    display: grid;
    gap: 18px;
}

.dashboard-hero {
    grid-template-columns: 1.5fr 1fr;
    margin-bottom: 22px;
}

.hero-card,
.stat-strip {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
}

.hero-card {
    position: relative;
    overflow: hidden;
    padding: 28px;
    background:
        radial-gradient(circle at top right, rgba(242, 183, 5, 0.18), transparent 28%),
        linear-gradient(135deg, rgba(54, 124, 43, 0.12), rgba(255, 255, 255, 0.96) 46%);
}

.hero-card::after {
    content: '';
    position: absolute;
    inset: auto -60px -100px auto;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: rgba(54, 124, 43, 0.08);
}

.hero-eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.74rem;
    font-weight: 700;
}

.hero-title {
    margin: 0;
    font-family: 'Titillium Web', 'Inter', sans-serif;
    font-size: clamp(2.1rem, 4vw, 3.1rem);
    line-height: 0.96;
}

.hero-copy {
    margin: 14px 0 0;
    max-width: 640px;
    color: var(--text-secondary);
    font-size: 0.98rem;
}

.hero-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(54, 124, 43, 0.1);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
}

.stat-strip {
    padding: 18px;
    display: grid;
    gap: 12px;
    align-content: start;
}

.stat-strip-item {
    padding: 16px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(54, 124, 43, 0.06), rgba(255, 255, 255, 0.98));
    border: 1px solid rgba(54, 124, 43, 0.08);
}

.stat-strip-label {
    display: block;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    font-weight: 700;
}

.stat-strip-value {
    display: block;
    margin-top: 8px;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-strip-sub {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* =========== RESPONSIVE =========== */

/* Tablet */
@media (max-width: 1024px) {
    .col-8, .col-6, .col-4, .col-3 {
        grid-column: span 12;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .auth-grid {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .auth-brand-panel {
        border-right: 0;
        border-bottom: 1px solid var(--ag-border);
        padding: 32px 28px;
    }

    .auth-form-panel {
        padding: 32px 28px;
    }

    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .topbar {
        padding: 0 16px;
    }

    .page-content {
        padding: 16px;
    }

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

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        min-width: 100%;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .col-12, .col-8, .col-6, .col-4, .col-3 {
        grid-column: span 1;
    }

    .alert-card-header {
        flex-direction: column;
    }

    .quick-links {
        grid-template-columns: 1fr;
    }

    .auth-page {
        padding: 14px;
    }

    .auth-brand-panel,
    .auth-form-panel {
        padding: 24px 18px;
    }

    .auth-brand-name {
        font-size: 2rem;
    }

    .topbar-right {
        gap: 8px;
    }

    .topbar-user-badge {
        max-width: 180px;
    }
}

/* =========== CHART.JS OVERRIDES =========== */
canvas {
    border-radius: var(--radius-sm);
}

/* =========== SCROLLBAR =========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

/* =========== UTILITIES =========== */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }
