:root {
    --primary: #1a4e8a;
    --primary-dark: #0f2f5a;
    --primary-light: #2563b0;
    --accent: #e8a020;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #2d3748;
    --text-muted: #718096;
    --border: #e2e8f0;
    --success: #38a169;
    --danger: #e53e3e;
    --warning: #d69e2e;
    --info: #3182ce;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--primary-dark);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 16px 20px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .brand-logo {
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 18px; color: #fff;
    flex-shrink: 0;
}

.sidebar-brand .brand-text { flex: 1; }
.sidebar-brand .brand-title { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.sidebar-brand .brand-sub { font-size: 10px; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-menu { flex: 1; padding: 10px 0; }

.menu-section {
    padding: 16px 16px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 13.5px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar a:hover, .sidebar a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--accent);
}

.sidebar a i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

/* ---- TOPBAR ---- */
.topbar {
    position: fixed;
    left: var(--sidebar-width);
    right: 0;
    top: 0;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.topbar-title { font-size: 16px; font-weight: 600; color: var(--primary); }
.topbar-title span { color: var(--text-muted); font-weight: 400; font-size: 13px; margin-left: 8px; }

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

.topbar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 13px;
}

.topbar-user .avatar {
    width: 32px; height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}

.topbar-user a { color: var(--danger); text-decoration: none; font-size: 12px; }

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    padding: 24px;
}

/* ---- PAGE HEADER ---- */
.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.breadcrumb { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.breadcrumb a { color: var(--primary-light); text-decoration: none; }
.breadcrumb span { margin: 0 6px; }

/* ---- STAT CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

.stat-card.accent  { border-left-color: var(--accent); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.danger  { border-left-color: var(--danger); }
.stat-card.info    { border-left-color: var(--info); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-card          .stat-icon { background: #e8f0fb; color: var(--primary); }
.stat-card.accent   .stat-icon { background: #fef3dc; color: var(--accent); }
.stat-card.success  .stat-icon { background: #e6f4ec; color: var(--success); }
.stat-card.danger   .stat-icon { background: #fdecea; color: var(--danger); }
.stat-card.info     .stat-icon { background: #e3f0fb; color: var(--info); }

.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.3px; }

/* ---- CARDS ---- */
.card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.card-header h3 { font-size: 15px; font-weight: 600; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* ---- TABLE ---- */
.table-responsive { overflow-x: auto; }

table.dsis-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.dsis-table th {
    background: var(--primary);
    color: #fff;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

table.dsis-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

table.dsis-table tr:last-child td { border-bottom: none; }
table.dsis-table tr:hover td { background: #f7fafc; }
table.dsis-table tr:nth-child(even) td { background: #fafbfc; }
table.dsis-table tr:nth-child(even):hover td { background: #f7fafc; }

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary { background: #e8f0fb; color: var(--primary); }
.badge-success { background: #e6f4ec; color: var(--success); }
.badge-warning { background: #fef3dc; color: var(--warning); }
.badge-danger  { background: #fdecea; color: var(--danger); }
.badge-info    { background: #e3f0fb; color: var(--info); }
.badge-muted   { background: #f0f0f0; color: #666; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #c8880f; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); color: #fff; }

/* ---- FORM ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s;
    outline: none;
}
.form-control:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* ---- FILTERS ---- */
.filter-bar {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ---- CHART CONTAINER ---- */
.chart-container { position: relative; height: 300px; }

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-circle {
    width: 72px; height: 72px;
    background: var(--primary);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}

.login-logo .logo-circle span { font-size: 28px; font-weight: 900; color: #fff; }
.login-logo h2 { font-size: 20px; font-weight: 800; color: var(--primary); }
.login-logo p { font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-top: 4px; }

.login-card .btn-primary {
    width: 100%;
    padding: 11px;
    font-size: 15px;
    justify-content: center;
    border-radius: 8px;
    margin-top: 4px;
}

.alert-danger { background: #fdecea; color: #c0392b; border: 1px solid #f5c6c6; border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 16px; }
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    color: var(--primary);
    background: #fff;
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination span.current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- SCHOOL DETAIL ---- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.detail-item { background: #f7fafc; border-radius: 8px; padding: 14px 16px; }
.detail-item dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.detail-item dd { font-size: 14px; font-weight: 600; color: var(--text); }

/* ---- SEARCH HIGHLIGHT ---- */
mark { background: #fff3cc; padding: 0 2px; border-radius: 2px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .topbar, .main-content { left: 0; margin-left: 0; }
    .topbar { left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- PROGRESS BAR ---- */
.progress-bar-wrap { background: #e2e8f0; border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 20px; background: var(--primary); transition: width 0.4s; }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* ---- TABS ---- */
.tab-nav { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 0; flex-wrap: wrap; }
.tab-nav a {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab-nav a:hover { color: var(--primary); }
.tab-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }
