:root {
  --primary: #1a56a0;
  --primary-dark: #0f3d7a;
  --primary-light: #e8f0fb;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar-w: 260px;
  --header-h: 64px;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: transform .25s;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px; background: var(--primary);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff; margin-bottom: 8px;
}
.sidebar-brand .school-name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.sidebar-brand .school-sub { font-size: 11px; color: rgba(255,255,255,.45); }

.sidebar-section {
  padding: 16px 12px 8px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: rgba(255,255,255,.35);
}

.sidebar-nav { padding: 0 8px; flex: 1; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: rgba(255,255,255,.65); font-size: 13.5px;
  font-weight: 500; margin-bottom: 2px; cursor: pointer;
  transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 99px; }

.sidebar-footer {
  padding: 12px 8px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; background: rgba(255,255,255,.05);
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: #fff; }
.user-role { font-size: 11px; color: rgba(255,255,255,.4); }

/* ─── MAIN ─── */
.main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }

.topbar {
  height: var(--header-h); background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 600; color: var(--text); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 24px 28px; }

/* ─── CARDS ─── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ─── STAT CARDS ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.blue  { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green { background: #d1fae5; color: #065f46; }
.stat-icon.amber { background: #fef3c7; color: #92400e; }
.stat-icon.red   { background: #fee2e2; color: #991b1b; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-label span.req { color: var(--danger); }
.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 14px; color: var(--text);
  background: #fff; transition: border .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,160,.12); }
.form-control::placeholder { color: #a0aec0; }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 7px; font-size: 13.5px;
  font-weight: 500; border: none; cursor: pointer; transition: all .15s;
  text-decoration: none !important; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }
.btn-outline {
  background: transparent; border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 7px; border-radius: 6px; }

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
  background: #f8fafc; color: var(--text-muted);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px;
  padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr:hover { background: #fafbfc; }
table.tbl tbody tr:last-child td { border-bottom: none; }

/* ─── BADGES ─── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 500; }
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-green   { background: #d1fae5; color: #065f46; }
.badge-amber   { background: #fef3c7; color: #92400e; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* ─── ALERTS ─── */
.alert {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ─── MISC ─── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.w-full { width: 100%; }

/* ─── LOGIN PAGE ─── */
.login-page {
  min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px;
  width: 100%; max-width: 420px; box-shadow: 0 20px 40px rgba(0,0,0,.25);
}
.login-logo {
  width: 56px; height: 56px; background: var(--primary); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff; margin: 0 auto 16px;
}
.login-title { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }

/* ─── MARKS ENTRY ─── */
.paste-area {
  width: 100%; min-height: 180px; padding: 12px; border: 1.5px dashed var(--border);
  border-radius: 8px; font-family: monospace; font-size: 13px; resize: vertical;
  background: #f8fafc; outline: none; transition: border .15s;
}
.paste-area:focus { border-color: var(--primary); background: #fff; }

/* ─── PRINT ─── */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: #fff; }
}

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

/* ─── ANNOUNCEMENT/HW CARDS ─── */
.item-card {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; margin-bottom: 10px; background: var(--card);
  transition: box-shadow .15s;
}
.item-card:hover { box-shadow: var(--shadow-md); }
.item-card-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.item-card-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.item-card-body { margin-top: 8px; font-size: 13px; color: var(--text-muted); }

/* Grade colors */
.grade-A { color: #15803d; font-weight: 600; }
.grade-B { color: #1d4ed8; font-weight: 600; }
.grade-C { color: #a16207; font-weight: 600; }
.grade-D { color: #b91c1c; font-weight: 600; }
