* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --green: #2ecc71;
    --orange: #f39c12;
    --red: #e74c3c;
    --purple: #9b59b6;
    --blue: #3498db;
    --pink: #fd79a8;
    --gray: #95a5a6;
    --bg: #f5f7fa;
    --card-bg: #fff;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --sidebar-w: 240px;
}
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}
.sidebar-header { padding: 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.logo-icon { font-size: 28px; }
.sidebar-title { font-size: 18px; font-weight: 700; }
.sidebar-subtitle { font-size: 11px; opacity: 0.7; }
.sidebar-menu { padding: 10px 0; }
.sidebar-menu a {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}
.sidebar-menu a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-menu a.active { background: rgba(255,255,255,0.12); border-left-color: var(--accent); color: #fff; }
.menu-section {
    padding: 15px 20px 5px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
}
.text-danger { color: #ff7675; }

/* Main area */
.main-area { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
    background: #fff;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: sticky; top: 0; z-index: 50;
}
.menu-toggle { background: none; border: none; font-size: 22px; cursor: pointer; margin-right: 15px; display: none; }
.topbar-title { font-size: 18px; font-weight: 600; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 500; }

.content { padding: 25px; flex: 1; }
.footer {
    padding: 12px 25px;
    background: #fff;
    border-top: 1px solid #eee;
    font-size: 12px;
    color: var(--text-muted);
    display: flex; justify-content: space-between;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 15px; margin-bottom: 25px; }
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-left: 4px solid var(--accent);
}
.stat-card.stat-green { border-color: var(--green); }
.stat-card.stat-orange { border-color: var(--orange); }
.stat-card.stat-red { border-color: var(--red); }
.stat-card.stat-blue { border-color: var(--blue); }
.stat-card.stat-purple { border-color: var(--purple); }
.stat-card.stat-pink { border-color: var(--pink); }
.stat-card.stat-gray { border-color: var(--gray); }
.stat-icon { font-size: 28px; }
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-value { font-size: 26px; font-weight: 700; }

/* Form */
.filter-bar {
    background: #fff;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}
.filter-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-row input, .form-row select, .form-row textarea {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    min-width: 130px;
}
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    padding: 9px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.form-actions { grid-column: 1 / -1; }

/* Buttons */
.btn {
    padding: 9px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: transparent; border: 1px solid #ddd; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-block { width: 100%; justify-content: center; }

/* Table */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    background: #f8f9fa;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid #eee;
}
.table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; }
.table tbody tr:hover { background: #fafbfc; }
.table a { color: var(--accent); text-decoration: none; }

/* Badges */
.badge { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; display: inline-block; }
.badge-green { background: #d4edda; color: #155724; }
.badge-orange { background: #fff3cd; color: #856404; }
.badge-red { background: #f8d7da; color: #721c24; }
.badge-blue { background: #d1ecf1; color: #0c5460; }
.badge-purple { background: #e2d5ed; color: #4a235a; }
.badge-gray { background: #e9ecef; color: #383d41; }
.badge-light { background: #f1f2f6; color: #2c3e50; }
.badge-pink { background: #fce4ec; color: #880e4f; }

/* Alerts */
.alert { padding: 12px 18px; border-radius: 8px; margin-bottom: 15px; font-size: 13px; }
.alert-danger { background: #f8d7da; color: #721c24; }
.alert-success { background: #d4edda; color: #155724; }
.alert-warning { background: #fff3cd; color: #856404; }

/* Pagination */
.pagination { display: flex; gap: 5px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a {
    padding: 8px 13px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
}
.pagination a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a.disabled { opacity: 0.4; pointer-events: none; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-style: italic;
}

/* Text colors */
.text-green { color: var(--green); font-weight: 600; }
.text-orange { color: var(--orange); font-weight: 600; }
.text-blue { color: var(--blue); font-weight: 600; }
.text-purple { color: var(--purple); font-weight: 600; }
.text-red { color: var(--red); font-weight: 600; }
.text-muted { color: var(--text-muted); }
.text-warning { color: var(--orange); }

/* Sync info */
.sync-info { display: flex; flex-direction: column; gap: 12px; }
.sync-item { padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.sync-item strong { display: inline-block; min-width: 180px; }
code { background: #f1f2f6; padding: 2px 8px; border-radius: 4px; font-family: monospace; }

/* Siswa info */
.siswa-info { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
.siswa-info > div { padding: 10px; background: #f8f9fa; border-radius: 6px; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-item { display: flex; gap: 15px; padding: 12px; background: #f8f9fa; border-radius: 8px; border-left: 4px solid var(--gray); }
.timeline-item.status-hadir { border-color: var(--green); }
.timeline-item.status-terlambat { border-color: var(--orange); }
.timeline-item.status-izin { border-color: var(--blue); }
.timeline-item.status-sakit { border-color: var(--purple); }
.timeline-item.status-alpa { border-color: var(--red); }
.timeline-date { font-weight: 600; min-width: 120px; }
.timeline-content { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Login */
.login-page {
    background: linear-gradient(135deg, #2c3e50 0%, #4a69bd 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-wrapper { width: 100%; max-width: 400px; }
.login-card {
    background: #fff;
    padding: 35px;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-logo { text-align: center; margin-bottom: 25px; }
.login-logo .logo-icon { font-size: 50px; margin-bottom: 8px; }
.login-logo h1 { font-size: 26px; color: var(--primary); }
.login-logo p { color: var(--text-muted); font-size: 13px; }
.login-footer { text-align: center; margin-top: 20px; color: var(--text-muted); }
.form-check label { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* Overlay (mobile) */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}
body.sidebar-open .sidebar { transform: translateX(0); }
body.sidebar-open .overlay { display: block; }

/* Responsive */
@media (max-width: 992px) {
    .grid-2 { grid-template-columns: 1fr; }
    .siswa-info { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-area { margin-left: 0; }
    .menu-toggle { display: block; }
    .content { padding: 15px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-form { flex-direction: column; align-items: stretch; }
    .form-row input, .form-row select { min-width: 0; }
    .topbar-user .user-name { display: none; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 22px; }
}

/* Print */
@media print {
    .sidebar, .topbar, .footer, .no-print, .overlay, .menu-toggle { display: none !important; }
    .main-area { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    body { background: #fff; }
    .table { font-size: 11px; }
    .table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .badge { border: 1px solid #ccc; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}