/* ==========================================================================
   HEADWAY INTERNATIONAL — FULL CRM & ERP MASTER STYLESHEET (ALL MODULES)
   ========================================================================== */

:root {
    /* Color Palette */
    --sidebar-bg: #090e23;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --sidebar-active: #1d284e;
    --sidebar-section-title: #64748b;

    --bg-main: #f4f6fa;
    --card-bg: #ffffff;
    --border-color: #eaecf0;
    --border-hover: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --primary-blue: #2563eb;
    --primary-dark: #0f172a;
    --accent-teal: #0d9488;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --accent-purple: #6366f1;

    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(16, 24, 40, 0.08), 0 2px 4px -1px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(16, 24, 40, 0.1), 0 4px 6px -2px rgba(16, 24, 40, 0.05);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; outline: none; }

/* Text Utility Classes */
.text-success { color: #10b981 !important; }
.text-danger { color: #ef4444 !important; }
.text-orange { color: #f59e0b !important; }
.text-purple { color: #8b5cf6 !important; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary-blue) !important; }
.w-full { width: 100% !important; }

/* --- App Layout --- */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* --- Sidebar Navigation --- */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99; opacity: 0; visibility: hidden;
    transition: var(--transition);
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.sidebar {
    width: 240px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex; flex-direction: column; flex-shrink: 0;
    height: 100vh; position: relative; z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition); overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }

.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .brand-info,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-arrow { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 1.25rem 0.5rem; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.75rem 0; }

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.25rem 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-logo { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: #ffffff; font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.brand-info { display: flex; flex-direction: column; }
.brand-name { font-size: 1.15rem; font-weight: 700; color: #ffffff; letter-spacing: -0.02em; line-height: 1.1; }
.brand-subtitle { font-size: 0.65rem; font-weight: 600; color: #94a3b8; letter-spacing: 0.12em; margin-top: 1px; }

.sidebar-collapse-toggle { color: var(--sidebar-text); font-size: 0.85rem; padding: 4px 8px; border-radius: 4px; }
.sidebar-collapse-toggle:hover { background-color: var(--sidebar-hover); color: #ffffff; }
.sidebar-close-btn { display: none; color: var(--sidebar-text); font-size: 1.2rem; }

.sidebar-nav { padding: 1.25rem 0.75rem; display: flex; flex-direction: column; gap: 1.5rem; }
.nav-section { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-section-title { font-size: 0.68rem; font-weight: 700; color: var(--sidebar-section-title); letter-spacing: 0.08em; padding: 0.25rem 0.75rem; margin-bottom: 0.25rem; }
.nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 0.75rem; font-size: 0.875rem; font-weight: 500;
    color: var(--sidebar-text); border-radius: var(--radius-md); transition: var(--transition);
}
.nav-item:hover { background-color: var(--sidebar-hover); color: #ffffff; }
.nav-item.active {
    background: linear-gradient(90deg, #1e293b, #1d284e);
    color: #ffffff; font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.nav-icon { font-size: 0.95rem; width: 20px; text-align: center; }
.nav-arrow { margin-left: auto; font-size: 0.65rem; opacity: 0.6; }

/* --- Main Wrapper & Header --- */
.main-wrapper { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow-y: auto; }

.top-header {
    background-color: #ffffff; height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem; border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 90; flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 1rem; flex: 1; max-width: 550px; }
.mobile-toggle-btn { display: none; font-size: 1.25rem; color: var(--text-secondary); padding: 0.4rem; }

.header-search {
    display: flex; align-items: center;
    background-color: #f1f5f9; border: 1px solid #e2e8f0;
    border-radius: var(--radius-full); padding: 0.45rem 0.9rem;
    width: 100%; gap: 0.6rem; transition: var(--transition);
}
.header-search:focus-within { background-color: #ffffff; border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.search-icon { color: var(--text-muted); font-size: 0.85rem; }
.header-search input { border: none; background: transparent; width: 100%; font-size: 0.85rem; color: var(--text-primary); }
.search-shortcut { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); background: #ffffff; border: 1px solid #cbd5e1; border-radius: 4px; padding: 2px 6px; flex-shrink: 0; }

.header-right { display: flex; align-items: center; gap: 1rem; }
.branch-selector {
    display: flex; align-items: center; gap: 0.5rem;
    background-color: #ffffff; border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 0.45rem 0.85rem;
    font-size: 0.85rem; font-weight: 600; color: var(--text-primary);
    cursor: pointer; transition: var(--transition);
}
.branch-selector:hover { border-color: var(--border-hover); background-color: #f8fafc; }
.branch-icon { color: var(--primary-blue); }
.font-xs { font-size: 0.7rem; }

.btn-create {
    display: flex; align-items: center; gap: 0.4rem;
    background-color: #0f172a; color: #ffffff;
    font-size: 0.85rem; font-weight: 600;
    padding: 0.45rem 0.95rem; border-radius: var(--radius-md);
    transition: var(--transition); box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}
.btn-create:hover { background-color: #1e293b; transform: translateY(-1px); }

.header-icon-btn {
    position: relative; width: 36px; height: 36px;
    border-radius: var(--radius-full); display: flex;
    align-items: center; justify-content: center;
    color: var(--text-secondary); font-size: 1rem; cursor: pointer; transition: var(--transition);
}
.header-icon-btn:hover { background-color: #f1f5f9; color: var(--text-primary); }
.badge-count {
    position: absolute; top: 2px; right: 2px;
    background-color: #3b82f6; color: #ffffff;
    font-size: 0.65rem; font-weight: 700; width: 16px; height: 16px;
    border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; border: 2px solid #ffffff;
}
.count-red { background-color: var(--accent-red); }

.user-profile { display: flex; align-items: center; gap: 0.6rem; padding-left: 0.5rem; border-left: 1px solid var(--border-color); cursor: pointer; }
.avatar {
    width: 34px; height: 34px; border-radius: var(--radius-full);
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff; font-size: 0.8rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); line-height: 1.1; }
.user-role { font-size: 0.7rem; color: var(--text-muted); }

/* --- Dashboard Container --- */
.dashboard-container { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; max-width: 1600px; margin: 0 auto; width: 100%; flex: 1; }

/* --- Header Banner --- */
.dashboard-banner, .page-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.banner-text .overview-tag, .page-header-text .page-tag { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.1em; }
.banner-text h1, .page-header-text h1 { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; margin: 0.1rem 0; }
.banner-text p, .page-header-text p { font-size: 0.875rem; color: var(--text-muted); }

.banner-actions, .page-header-actions { display: flex; align-items: center; gap: 0.6rem; }
.btn-secondary {
    display: flex; align-items: center; gap: 0.4rem;
    background-color: #ffffff; border: 1px solid var(--border-color);
    color: var(--text-secondary); font-size: 0.85rem; font-weight: 600;
    padding: 0.5rem 0.9rem; border-radius: var(--radius-md);
    transition: var(--transition); box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background-color: #f8fafc; border-color: var(--border-hover); color: var(--text-primary); }

.btn-primary {
    display: flex; align-items: center; gap: 0.4rem;
    background-color: var(--primary-blue); color: #ffffff;
    font-size: 0.85rem; font-weight: 600; padding: 0.5rem 1rem;
    border-radius: var(--radius-md); transition: var(--transition);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover { background-color: #1d4ed8; transform: translateY(-1px); }

.btn-ai-insights {
    display: flex; align-items: center; gap: 0.4rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    color: #ffffff; font-size: 0.85rem; font-weight: 600;
    padding: 0.5rem 1rem; border-radius: var(--radius-md);
    transition: var(--transition); box-shadow: 0 4px 12px rgba(49, 46, 129, 0.35);
}
.btn-ai-insights:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(49, 46, 129, 0.45); }
.btn-ai-insights i { color: #a78bfa; }

/* --- Stats Row & Stat Cards --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

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

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 0.15rem;
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
    color: var(--text-muted);
}

.stat-icon-circle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* --- KPI Cards Grid --- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.kpi-card {
    background-color: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 1.15rem; display: flex;
    flex-direction: column; justify-content: space-between; box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden; transition: var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-hover); }

.kpi-header { display: flex; align-items: center; justify-content: space-between; }
.kpi-title { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.06em; }

.kpi-icon {
    width: 42px; height: 42px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.icon-purple { background-color: #f1f5f9; color: #64748b; }
.icon-blue { background-color: #e0f2fe; color: #0284c7; }
.icon-teal { background-color: #d1fae5; color: #059669; }
.icon-orange { background-color: #ffedd5; color: #ea580c; }

.kpi-value-row { margin-top: 0.5rem; }
.kpi-value { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; }
.kpi-badge-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.35rem; font-size: 0.75rem; }
.trend-badge { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 700; padding: 2px 6px; border-radius: var(--radius-sm); }
.badge-green { background-color: #d1fae5; color: #047857; }
.badge-red { background-color: #fee2e2; color: #b91c1c; }
.kpi-subtext { color: var(--text-muted); font-size: 0.75rem; }
.kpi-chart-wrapper { height: 45px; margin-top: 0.75rem; margin-bottom: -0.5rem; margin-left: -0.5rem; margin-right: -0.5rem; }

/* --- Analytics & Charts Grid --- */
.card { background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.card-title-group h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.card-title-group p { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.analytics-grid { display: grid; grid-template-columns: 8fr 4fr; gap: 1.25rem; }
.time-tabs { display: flex; background-color: #f1f5f9; padding: 3px; border-radius: var(--radius-md); gap: 2px; }
.tab-btn { padding: 3px 10px; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); border-radius: var(--radius-sm); }
.tab-btn.active { background-color: #0f172a; color: #ffffff; }

.chart-legend-row { display: flex; align-items: center; gap: 1.25rem; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.75rem; }
.justify-end { justify-content: flex-end; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-dot { width: 8px; height: 8px; border-radius: var(--radius-full); }
.dot-collected { background-color: #1e1b4b; }
.dot-target { background-color: #94a3b8; }
.legend-box { width: 10px; height: 10px; border-radius: 2px; }
.box-admissions { background-color: #1e293b; }
.box-revenue { background-color: #3b82f6; }
.main-chart-wrapper { height: 280px; width: 100%; position: relative; }

.donut-chart-container { position: relative; height: 190px; display: flex; align-items: center; justify-content: center; margin: 0.5rem 0; }
.donut-center-info { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.center-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }
.center-val { font-size: 1.25rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.donut-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; justify-content: center; font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); margin-top: 0.5rem; }
.legend-chip { display: flex; align-items: center; gap: 0.35rem; }
.dot { width: 8px; height: 8px; border-radius: var(--radius-full); }
.legend-converted { background-color: #10b981; }
.legend-negotiating { background-color: #f59e0b; }
.legend-contacted { background-color: #06b6d4; }
.legend-new { background-color: #3b82f6; }
.legend-lost { background-color: #ef4444; }

.conversion-footer-metrics { display: flex; align-items: center; justify-content: space-around; border-top: 1px solid var(--border-color); padding-top: 0.75rem; margin-top: 1rem; }
.metric-item { display: flex; flex-direction: column; align-items: center; }
.metric-lbl { font-size: 0.72rem; color: var(--text-muted); }
.metric-val { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.metric-divider { width: 1px; height: 24px; background-color: var(--border-color); }

.secondary-grid { display: grid; grid-template-columns: 8fr 4fr; gap: 1.25rem; }
.bar-chart-wrapper { height: 260px; width: 100%; }
.view-all-link { font-size: 0.78rem; font-weight: 600; color: var(--primary-blue); }
.admissions-list { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 0.5rem; }
.admission-item { display: flex; align-items: center; gap: 0.75rem; }
.student-avatar { width: 34px; height: 34px; border-radius: var(--radius-full); color: #ffffff; font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bg-navy { background-color: #0f172a; }
.bg-blue { background-color: #0284c7; }
.bg-teal { background-color: #0d9488; }
.bg-purple { background-color: #7c3aed; }
.bg-darkblue { background-color: #1e3a8a; }
.student-info { flex: 1; min-width: 0; }
.student-name { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.student-details { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-pill { font-size: 0.68rem; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-full); }
.status-paid { background-color: #d1fae5; color: #047857; }
.status-pending { background-color: #fef3c7; color: #b45309; }

.bottom-widgets-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.lectures-list { display: flex; flex-direction: column; gap: 0.75rem; }
.lecture-item { display: flex; gap: 0.75rem; background-color: #f8fafc; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.75rem; }
.lecture-icon-box { width: 36px; height: 36px; border-radius: var(--radius-md); background-color: #e2e8f0; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; font-size: 0.95rem; flex-shrink: 0; }
.lecture-details { display: flex; flex-direction: column; gap: 0.15rem; }
.lecture-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.lecture-meta { font-size: 0.72rem; color: var(--text-muted); }
.lecture-pills { display: flex; gap: 0.4rem; margin-top: 0.2rem; }
.pill-time { font-size: 0.68rem; font-weight: 700; background-color: #e0f2fe; color: #0369a1; padding: 1px 6px; border-radius: 4px; }
.pill-room { font-size: 0.68rem; font-weight: 600; background-color: #f1f5f9; color: var(--text-muted); padding: 1px 6px; border-radius: 4px; }

.tasks-list { display: flex; flex-direction: column; gap: 0.85rem; }
.task-item { display: flex; flex-direction: column; gap: 0.35rem; }
.task-row { display: flex; align-items: center; justify-content: space-between; }
.checkbox-container { display: flex; align-items: center; gap: 0.5rem; position: relative; cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.checkbox-container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark { height: 16px; width: 16px; background-color: #ffffff; border: 1.5px solid #cbd5e1; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.checkbox-container input:checked ~ .checkmark { background-color: var(--primary-blue); border-color: var(--primary-blue); }
.checkmark::after { content: ""; display: none; width: 4px; height: 8px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checkbox-container input:checked ~ .checkmark::after { display: block; }
.text-done { text-decoration: line-through; color: var(--text-light); }
.task-percent { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); }
.progress-bar-bg { width: 100%; height: 6px; background-color: #f1f5f9; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background-color: #0f172a; border-radius: 3px; }
.fill-complete { background-color: #10b981; }

.trophy-icon { color: #f59e0b; font-size: 1rem; }
.leaderboard-list { display: flex; flex-direction: column; gap: 0.7rem; }
.leader-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.35rem 0; }
.rank-badge { width: 24px; height: 24px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800; flex-shrink: 0; }
.rank-1 { background-color: #fef3c7; color: #d97706; }
.rank-2 { background-color: #e2e8f0; color: #475569; }
.rank-3 { background-color: #ffedd5; color: #c2410c; }
.rank-default { background-color: #f1f5f9; color: #94a3b8; }
.leader-info { flex: 1; }
.leader-name { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
.leader-branch { font-size: 0.7rem; color: var(--text-muted); }
.leader-stats { display: flex; flex-direction: column; align-items: flex-end; }
.stat-count { font-size: 0.85rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.stat-rev { font-size: 0.68rem; color: var(--text-muted); }

/* --- Courses Grid --- */
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; }
.course-card { background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; justify-content: space-between; gap: 1rem; transition: var(--transition); }
.course-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-hover); }
.course-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.course-icon-badge { width: 44px; height: 44px; border-radius: var(--radius-md); background-color: #eff6ff; color: var(--primary-blue); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.course-meta-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; padding: 0.75rem 0; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); text-align: center; }
.meta-box .lbl { font-size: 0.68rem; color: var(--text-muted); }
.meta-box .val { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }

/* --- Tables & Filters --- */
.table-card { background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-toolbar { padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--border-color); background-color: #ffffff; flex-wrap: wrap; }
.search-box-sm { display: flex; align-items: center; gap: 0.5rem; background-color: #f8fafc; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.4rem 0.75rem; width: 280px; }
.search-box-sm input { border: none; background: transparent; width: 100%; font-size: 0.85rem; }
.table-filters { display: flex; align-items: center; gap: 0.6rem; }
.filter-select { background-color: #f8fafc; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.4rem 0.75rem; font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }

.table-wrapper { width: 100%; overflow-x: auto; }
.custom-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; text-align: left; }
.custom-table th { background-color: #f8fafc; color: var(--text-muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border-color); }
.custom-table td { padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border-color); color: var(--text-secondary); vertical-align: middle; }
.custom-table tr:hover td { background-color: #f8fafc; }

.user-cell { display: flex; align-items: center; gap: 0.75rem; }
.user-cell-avatar { width: 34px; height: 34px; border-radius: var(--radius-full); background-color: var(--primary-blue); color: #ffffff; font-size: 0.78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.user-cell-title { font-weight: 700; color: var(--text-primary); font-size: 0.875rem; }
.user-cell-sub { font-size: 0.72rem; color: var(--text-muted); }

.badge-pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 3px 10px; border-radius: var(--radius-full); font-size: 0.72rem; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.badge-hot { background-color: #fee2e2; color: #dc2626; }
.badge-warm { background-color: #fef3c7; color: #d97706; }
.badge-cold { background-color: #e0f2fe; color: #0284c7; }
.badge-converted { background-color: #d1fae5; color: #059669; }
.badge-active { background-color: #d1fae5; color: #059669; }
.badge-pending { background-color: #fef3c7; color: #b45309; }

.action-btn { width: 30px; height: 30px; border-radius: var(--radius-md); color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; transition: var(--transition); }
.action-btn:hover { background-color: #f1f5f9; color: var(--text-primary); }

.table-pagination { padding: 0.85rem 1.25rem; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border-color); font-size: 0.8rem; color: var(--text-muted); }
.pagination-controls { display: flex; gap: 0.3rem; }
.page-num { width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.78rem; border: 1px solid var(--border-color); }
.page-num.active { background-color: var(--primary-dark); color: #ffffff; border-color: var(--primary-dark); }

/* --- UNIVERSAL MODAL DIALOG --- */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.active {
    display: flex !important;
}

.modal-container {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalSlide 0.25s ease-out;
}

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

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

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

.modal-close-btn {
    font-size: 1.2rem;
    color: var(--text-muted);
    padding: 4px;
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.form-control {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-footer {
    padding: 1rem 1.5rem;
    background-color: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
}

/* --- Responsive Media Queries --- */
@media (max-width: 1400px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1100px) { .analytics-grid, .secondary-grid { grid-template-columns: 1fr; } .bottom-widgets-grid { grid-template-columns: repeat(1, 1fr); } }
@media (max-width: 850px) {
    .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; box-shadow: 4px 0 20px rgba(0,0,0,0.3); }
    .sidebar.active { left: 0; }
    .sidebar-close-btn { display: block; }
    .mobile-toggle-btn { display: block; }
    .header-left { max-width: none; }
    .search-shortcut { display: none; }
    .branch-selector span { display: none; }
}
@media (max-width: 600px) {
    .dashboard-container { padding: 1rem; }
    .kpi-grid { grid-template-columns: 1fr; }
    .dashboard-banner, .page-header { flex-direction: column; align-items: flex-start; }
    .banner-actions, .page-header-actions { width: 100%; justify-content: flex-start; }
    .user-info { display: none; }
}

/* ==========================================================================
   STUDENT PROFILE PAGE
   ========================================================================== */

.admission-item { border-radius: var(--radius-md); transition: var(--transition); }
.admission-item[href] { cursor: pointer; }
.admission-item[href]:hover { background-color: #f8fafc; }

.back-link { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.5rem; transition: var(--transition); }
.back-link:hover { color: var(--primary-blue); }

.profile-header-card {
    background-color: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow-sm); display: flex; align-items: center;
    justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
    position: relative; overflow: hidden;
}
.profile-header-card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, #1e293b, #3b82f6, #0d9488);
}
.profile-header-main { display: flex; align-items: center; gap: 1.25rem; }
.profile-avatar-lg {
    width: 76px; height: 76px; border-radius: var(--radius-full);
    color: #ffffff; font-size: 1.6rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25); flex-shrink: 0;
}
.profile-name-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.profile-name-row h2 { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; }
.profile-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.15rem; font-weight: 500; }
.profile-contact-row { display: flex; gap: 1.25rem; margin-top: 0.6rem; flex-wrap: wrap; }
.profile-contact-row span { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.profile-contact-row i { color: var(--primary-blue); font-size: 0.85rem; }
.profile-header-actions { display: flex; gap: 0.6rem; }
.icon-action-btn {
    width: 40px; height: 40px; border-radius: var(--radius-md);
    border: 1px solid var(--border-color); background-color: #ffffff;
    color: var(--text-secondary); display: flex; align-items: center;
    justify-content: center; font-size: 1rem; transition: var(--transition);
}
.icon-action-btn:hover { background-color: #f8fafc; border-color: var(--border-hover); color: var(--primary-blue); }

.profile-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border-color); padding: 0 0.25rem; overflow-x: auto; }
.profile-tab-btn { padding: 0.75rem 1.1rem; font-size: 0.85rem; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid transparent; transition: var(--transition); white-space: nowrap; }
.profile-tab-btn:hover { color: var(--text-primary); }
.profile-tab-btn.active { color: var(--primary-blue); border-bottom-color: var(--primary-blue); }

.tab-panel { display: none; flex-direction: column; gap: 1.25rem; }
.tab-panel.active { display: flex; }

.overview-grid { display: grid; grid-template-columns: 5fr 7fr; gap: 1.25rem; align-items: start; }
.info-list { display: flex; flex-direction: column; gap: 0.9rem; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding-bottom: 0.75rem; border-bottom: 1px dashed var(--border-color); }
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.info-value { font-size: 0.85rem; color: var(--text-primary); font-weight: 700; text-align: right; }

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 0.9rem; }
.timeline-dot-col { display: flex; flex-direction: column; align-items: center; }
.timeline-dot { width: 10px; height: 10px; border-radius: var(--radius-full); background-color: var(--primary-blue); flex-shrink: 0; margin-top: 4px; }
.timeline-line { flex: 1; width: 2px; background-color: var(--border-color); margin-top: 4px; min-height: 20px; }
.timeline-content { flex: 1; padding-bottom: 1.25rem; }
.timeline-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.timeline-date { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.timeline-desc { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.25rem; }

.attendance-summary-grid { display: grid; grid-template-columns: 4fr 8fr; gap: 1.25rem; align-items: start; }
.attendance-ring-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; }
.attendance-sessions-list { display: flex; flex-direction: column; gap: 0.6rem; }
.session-row { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0.75rem; background-color: #f8fafc; border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.session-date { font-size: 0.8rem; font-weight: 700; color: var(--text-primary); }
.session-topic { font-size: 0.72rem; color: var(--text-muted); }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.1rem; }
.doc-card { background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 1.1rem; display: flex; flex-direction: column; gap: 0.75rem; transition: var(--transition); }
.doc-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-hover); }
.doc-icon { width: 42px; height: 42px; border-radius: var(--radius-md); background-color: #eff6ff; color: var(--primary-blue); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.doc-name { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.doc-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.doc-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }

@media (max-width: 1100px) {
    .overview-grid, .attendance-summary-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .profile-header-card { flex-direction: column; align-items: flex-start; }
    .profile-header-actions { width: 100%; }
}

/* ==========================================================================
   STUDENT FOLLOW-UP MODULE
   ========================================================================== */

.toolbar-bar {
    background-color: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 1rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; box-shadow: var(--shadow-sm);
}

.followup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; }
.followup-card {
    background-color: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; gap: 0.9rem; transition: var(--transition);
}
.followup-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-hover); }
.followup-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.followup-reason { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; gap: 0.4rem; }
.followup-reason i { color: var(--primary-blue); }

.followup-meta-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; padding: 0.75rem 0; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.followup-meta-box { display: flex; flex-direction: column; gap: 2px; }
.followup-meta-box .lbl { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; }
.followup-meta-box .val { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }

.followup-note { font-size: 0.78rem; color: var(--text-secondary); font-style: italic; line-height: 1.5; }

.followup-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: auto; }
.followup-actions { display: flex; gap: 0.4rem; }
.followup-actions .icon-action-btn { width: 34px; height: 34px; font-size: 0.85rem; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; }

.empty-state { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2rem; opacity: 0.4; }

/* Follow-up tab inside Student Profile */
.followup-tab-grid { display: grid; grid-template-columns: 4fr 8fr; gap: 1.25rem; align-items: start; }
.risk-score-box { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 1rem 0; }
.risk-score-val { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; }
.risk-score-lbl { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.05em; }
.reminder-box { display: flex; align-items: center; gap: 0.75rem; background-color: #f8fafc; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.85rem 1rem; margin-top: 0.75rem; }
.reminder-icon { width: 38px; height: 38px; border-radius: var(--radius-md); background-color: #eff6ff; color: var(--primary-blue); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.reminder-title { font-size: 0.8rem; font-weight: 700; color: var(--text-primary); }
.reminder-sub { font-size: 0.72rem; color: var(--text-muted); }

@media (max-width: 1100px) {
    .followup-tab-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .followup-meta-row { grid-template-columns: 1fr; gap: 0.35rem; }
    .followup-card-footer { flex-direction: column; align-items: stretch; }
}

/* ==========================================================================
   BRANCH MANAGEMENT MODULE
   ========================================================================== */

.branch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.branch-card {
    background-color: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; gap: 0.85rem; transition: var(--transition);
}
.branch-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-hover); }
.branch-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.branch-icon-badge { width: 44px; height: 44px; border-radius: var(--radius-md); background-color: #eff6ff; color: var(--primary-blue); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.branch-card h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.branch-manager-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; color: var(--text-secondary); }
.branch-manager-row strong { color: var(--text-primary); }

/* ==========================================================================
   USERS & ROLES / PERMISSIONS MODULE
   ========================================================================== */

.bg-orange { background-color: #ea580c; }

.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.role-card {
    background-color: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; gap: 0.85rem; transition: var(--transition);
}
.role-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-hover); }
.role-card.active { border-color: var(--primary-blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.role-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.role-icon-badge { width: 44px; height: 44px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.role-card h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.role-perm-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.perm-badge { font-size: 0.68rem; font-weight: 600; color: var(--text-secondary); background-color: #f1f5f9; border-radius: var(--radius-sm); padding: 3px 8px; }

.permission-matrix th, .permission-matrix td { text-align: center; }
.permission-matrix th:first-child, .permission-matrix td:first-child { text-align: left; }
.perm-check { color: var(--accent-green); font-size: 0.95rem; }
.perm-cross { color: var(--text-light); font-size: 0.85rem; opacity: 0.5; }

/* ==========================================================================
   ACCOUNTS & EXPENSE LEDGER
   ========================================================================== */

.expense-category-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.25rem; }
.expense-category-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.expense-category-name { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.expense-category-amount { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }

/* ==========================================================================
   ATTENDANCE REPORT
   ========================================================================== */

.report-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.report-filter-mode { display: flex; background-color: #f1f5f9; padding: 3px; border-radius: var(--radius-md); gap: 2px; }
.report-filter-inputs { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.filter-input-group { display: flex; align-items: center; gap: 0.5rem; }
.filter-input-group .form-control { padding: 0.5rem 0.75rem; font-size: 0.82rem; }
.range-separator { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

@media (max-width: 700px) {
    .report-filter-row { flex-direction: column; align-items: stretch; }
    .report-filter-inputs { flex-direction: column; align-items: stretch; }
    .filter-input-group { flex-direction: column; align-items: stretch; }
}
