:root{
  --primary:#1e40af; /* dark blue */
  --primary-500:#3b82f6; /* blue */
  --primary-300:#93c5fd;
  --bg:#f5f7fb;
  --text:#0f172a;
  --muted:#64748b;
  --card:#ffffff;
  --border:#e2e8f0;
  --error:#ef4444;
  --success:#16a34a;
}

*{box-sizing:border-box}
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;color:var(--text);background:var(--bg);font-size:16px}
.app{display:flex;min-height:100vh}
.sidebar{width:260px;background:var(--primary);color:#fff;display:flex;flex-direction:column;position:sticky;top:0;height:100vh}
.sidebar .brand{display:flex;align-items:center;gap:.5rem;padding:1rem;border-bottom:1px solid rgba(255,255,255,.15)}
.sidebar .sidebar-toggle{background:transparent;color:#fff;border:1px solid rgba(255,255,255,.5);border-radius:.4rem;padding:.25rem .5rem;cursor:pointer;font-size:18px}
.sidebar nav{display:flex;flex-direction:column;padding:.5rem}
.sidebar .nav-link{color:rgba(255,255,255,.85);text-decoration:none;padding:.75rem 1rem;margin:.25rem .5rem;border-radius:8px;font-size:.9rem;display:block}
.sidebar .nav-link:hover{color:#fff;background:rgba(255,255,255,.15)}
.nav-section{margin-top:1rem}
.nav-section-title{color:rgba(255,255,255,.8);font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;padding:.5rem 1rem;margin-bottom:.25rem;border-bottom:1px solid rgba(255,255,255,.1)}
.main{flex:1;display:flex;flex-direction:column}
.header{display:flex;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--border);background:#fff;position:sticky;top:0;z-index:10}
.page-title{margin:0;font-size:1.125rem}
.user-info{display:flex;align-items:center;gap:.5rem}
.role-badge{background:var(--primary-300);color:#052c65;border-radius:999px;padding:.125rem .5rem;font-size:.75rem}
.btn{background:var(--primary);color:#fff;border:none;border-radius:.5rem;padding:.5rem .75rem;cursor:pointer;text-decoration:none;display:inline-block}
.btn:hover{background:#183285}
.btn-outline{background:#fff;color:var(--primary);border:1px solid var(--primary)}
.content{padding:1rem;max-width:1200px;margin:0 auto;width:100%}
.footer{padding:1rem;color:var(--muted);text-align:center}
.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem}
.card{background:var(--card);border:1px solid var(--border);border-radius:.75rem;padding:1rem}
.card-title{color:var(--muted);font-size:.9rem}
.card-value{font-size:2rem;font-weight:700}
.alert{padding:.75rem 1rem;border-radius:.5rem;margin:.5rem 0}
.alert-error{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}
.alert-success{background:#dcfce7;color:#166534;border:1px solid #bbf7d0}

/* Auth */
.auth-body{display:grid;place-items:center;min-height:100vh;background:linear-gradient(135deg,var(--primary),var(--primary-500))}
.auth-container{background:#fff;border-radius:1rem;padding:2rem;box-shadow:0 20px 60px rgba(0,0,0,.2);width:100%;max-width:400px}
.auth-container--compact{max-width:360px;padding:1.25rem}
.auth-container--compact .brand-title{font-size:1.1rem;margin-bottom:.25rem}
.auth-container--compact h2{font-size:1rem;margin:.25rem 0 1rem}
.auth-container--compact input[type="text"],
.auth-container--compact input[type="password"]{padding:.5rem .6rem;font-size:.95rem}
.auth-container--compact .btn{padding:.45rem .65rem;font-size:.95rem}
.auth-container--compact .alert{padding:.5rem .75rem}
.brand-title{color:var(--primary);margin-top:0}
.auth-form{display:grid;gap:.75rem}
label{display:grid;gap:.25rem;font-size:.9rem}
input[type="text"],input[type="password"]{padding:.6rem .7rem;border:1px solid var(--border);border-radius:.5rem;font-size:1rem}
.remember{display:flex;align-items:center;gap:.5rem}

/* Section/Form */
.section{background:#fff;border:1px solid var(--border);border-radius:.75rem;padding:1rem}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.375rem;
  text-align: center;
  white-space: nowrap;
}

.badge-primary {
  background-color: #3b82f6;
  color: white;
}

.badge-warning {
  background-color: #f59e0b;
  color: white;
}

.badge-success {
  background-color: #10b981;
  color: white;
}

.badge-info {
  background-color: #06b6d4;
  color: white;
}

.badge-light {
  background-color: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.badge-secondary {
  background-color: #6b7280;
  color: white;
}

/* Text Color Utilities */
.text-warning {
  color: #f59e0b !important;
}

/* Info Grid for Student Biodata */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}

/* Students Without Class Section */
.students-without-class-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-top: 2rem;
}

.section-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.section-header h2 {
  margin: 0 0 0.5rem 0;
  color: var(--primary);
  font-size: 1.5rem;
}

.grade-tabs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.grade-tab {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
}

.grade-header {
  background: var(--bg);
  padding: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid var(--border);
}

.grade-header:hover {
  background: #e2e8f0;
}

.grade-header h3 {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.1rem;
}

.student-count {
  font-weight: normal;
  color: var(--muted);
  font-size: 0.9rem;
}

.toggle-icon {
  transition: transform 0.2s;
  color: var(--muted);
}

.grade-content {
  padding: 1rem;
  background: white;
}

.no-students {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 2rem;
  background: #f8f9fa;
  border-radius: 0.5rem;
}

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.student-card {
  background: #f8f9fa;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.student-card:hover {
  background: #f1f5f9;
  border-color: var(--primary-300);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.student-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.student-info strong {
  color: var(--text);
  font-size: 0.95rem;
}

.student-info small {
  font-size: 0.8rem;
  color: var(--muted);
}

.student-actions {
  flex-shrink: 0;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .students-grid {
    grid-template-columns: 1fr;
  }
  
  .student-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .student-actions {
    align-self: flex-end;
  }
  
  .grade-header h3 {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* Page Header */
.page-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem}
.page-header h1{margin:0;font-size:1.5rem;color:var(--text)}

/* Stats Grid */
.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:1rem;margin-bottom:1.5rem}
.stat-card{background:#fff;border:1px solid var(--border);border-radius:.75rem;padding:1.5rem;text-align:center}
.stat-card i{font-size:2rem;margin-bottom:.5rem;display:block}
.stat-card h3{margin:0 0 .25rem;font-size:1.75rem;font-weight:700}
.stat-card p{margin:0;color:var(--muted);font-size:.9rem}

/* Controls */
.controls{display:flex;gap:1rem;margin-bottom:1rem;flex-wrap:wrap;align-items:center}
.controls input,.controls select{padding:.5rem;border:1px solid var(--border);border-radius:.375rem;font-size:.9rem}
.controls input{flex:1;min-width:200px}

/* Table Container */
.table-container{background:#fff;border:1px solid var(--border);border-radius:.75rem;overflow:hidden}
table{width:100%;border-collapse:collapse}
th,td{padding:.75rem;text-align:left;border-bottom:1px solid var(--border)}
th{background:#f8fafc;font-weight:600;color:var(--text);font-size:.875rem}
tbody tr:hover{background:#f8fafc}

/* Action Buttons */
.action-buttons{display:flex;gap:.25rem}
.action-buttons .btn{padding:.25rem .5rem;font-size:.75rem;border-radius:.375rem}
.btn-warning{background:#f59e0b;color:#fff}
.btn-danger{background:#ef4444;color:#fff}
.btn-warning:hover{background:#d97706}
.btn-danger:hover{background:#dc2626}

/* Badges */
.role-badge{background:var(--primary-300);color:#052c65;border-radius:999px;padding:.25rem .5rem;font-size:.75rem;display:inline-block}

/* Text utilities */
.text-center{text-align:center}
.form{display:grid;gap:.75rem;max-width:420px}

/* Empty state */
.empty{background:#fff;border:1px solid var(--border);border-radius:.75rem;padding:2rem;text-align:center}

/* Sidebar collapsed */
.sidebar.collapsed{width:85px}
.sidebar.collapsed .brand span{display:none}
.sidebar.collapsed .nav-link{padding:.75rem}

/* Page layout */
.page-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem}
.page-actions{display:flex;gap:.5rem}
.form-container,.import-container{max-width:600px;background:#fff;border:1px solid var(--border);border-radius:.75rem;padding:1.5rem}
.form-group{margin-bottom:1rem}
.form-control{width:100%;padding:.6rem;border:1px solid var(--border);border-radius:.5rem}
.form-actions{display:flex;gap:.5rem;margin-top:1.5rem}
.form-info{background:#f8f9fa;padding:.75rem;border-radius:.5rem;margin:1rem 0;color:#6c757d}

/* Filter section */
.filter-section{background:#fff;border:1px solid var(--border);border-radius:.75rem;padding:1rem;margin-bottom:1rem}
.filter-form{margin:0}
.filter-row{display:flex;gap:.5rem;align-items:center}

/* Table styles */
.table-container{background:#fff;border:1px solid var(--border);border-radius:.75rem;overflow:hidden}
.table{width:100%;border-collapse:collapse;margin:0}
.table th,.table td{padding:.75rem;border-bottom:1px solid var(--border);text-align:left}
.table th{background:#f8f9fa;font-weight:600}
.table tbody tr:hover{background:#f8f9fa}
.text-center{text-align:center}

/* Action buttons */
.action-buttons{display:flex;gap:.25rem}
.btn-sm{padding:.25rem .5rem;font-size:.8rem}
.btn-danger{background:#dc3545;color:#fff}
.btn-warning{background:#ffc107;color:#212529}

/* Role badges */
.role-badge{padding:.2rem .5rem;border-radius:.25rem;font-size:.75rem;font-weight:500}
.role-admin{background:#dc3545;color:#fff}
.role-guru{background:#28a745;color:#fff}
.role-guru_bk{background:#17a2b8;color:#fff}
.role-siswa{background:#007bff;color:#fff}
.role-pimpinan{background:#6f42c1;color:#fff}
.role-petugas_kelas{background:#fd7e14;color:#fff}

/* Pagination */
.pagination{display:flex;justify-content:space-between;align-items:center;padding:1rem;background:#fff;border:1px solid var(--border);border-radius:.75rem;margin-top:1rem}
.pagination-info{color:var(--muted);font-size:.9rem}

/* Import styles */
.import-info{background:#e7f3ff;border:1px solid #b8daff;border-radius:.5rem;padding:1rem;margin-bottom:1.5rem}
.import-info h3{margin-top:0;color:#004085}
.import-info ul{margin:.5rem 0}
.import-form{margin-bottom:1.5rem}
.sample-template{background:#f8f9fa;border:1px solid var(--border);border-radius:.5rem;padding:1rem}
.table-bordered{border:1px solid var(--border)}
.table-bordered th,.table-bordered td{border:1px solid var(--border)}

/* Inline forms */
.inline{display:inline-block;margin:0}

/* Biodata form styles */
.student-info{margin-bottom:1.5rem}
.info-card{background:#f8f9fa;border:1px solid var(--border);border-radius:.5rem;padding:1rem}
.biodata-form{background:#fff;border:1px solid var(--border);border-radius:.75rem;padding:1.5rem}
.form-section{margin-bottom:2rem;padding-bottom:1.5rem;border-bottom:1px solid #e9ecef}
.form-section:last-of-type{border-bottom:none}
.form-section h3{margin-bottom:1rem;color:var(--primary)}
.form-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:1rem;margin-bottom:1rem}
.form-group textarea{resize:vertical;min-height:80px}

/* Documents section */
.documents-section{background:#fff;border:1px solid var(--border);border-radius:.75rem;padding:1.5rem;margin-top:1.5rem}
.documents-list{display:grid;gap:.5rem}
.document-item{display:flex;justify-content:space-between;align-items:center;padding:.5rem;background:#f8f9fa;border-radius:.25rem}
.document-type{font-weight:600;text-transform:uppercase;font-size:.8rem;color:var(--primary)}

/* Validation */
.error-message{color:var(--error);font-size:0.875rem;margin-top:0.25rem}
.hidden{display:none}
.border-red-500{border-color:#ef4444!important}
.border-red-400{border-color:#f87171!important}
.border-gray-300{border-color:var(--border)}

/* Utilities */
.btn-outline{background:#fff;color:var(--primary);border:1px solid var(--primary)}
.btn-outline:hover{background:var(--primary);color:#fff}
