@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --ink: #142238;
  --ink-2: #1c3057;
  --gold: #b8902f;
  --gold-light: #f4ecd8;
  --bg: #f6f4ef;
  --card: #ffffff;
  --border: #e6e1d3;
  --muted: #766f5e;
  --text: #241f14;
  --good: #1f7a4d;
  --good-bg: #eaf5ee;
  --watch: #a3671a;
  --watch-bg: #fbf1e0;
  --bad: #ab2f26;
  --bad-bg: #fbeae8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,34,56,.06), 0 6px 20px rgba(20,34,56,.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  animation: pageFade .35s ease;
}

@keyframes pageFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

h1, h2, h3, .display {
  font-family: 'Fraunces', serif;
  color: var(--ink);
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }

.mono { font-family: 'IBM Plex Mono', monospace; }

/* ---------- Shell layout ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--ink);
  color: #e9e6db;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width .2s ease;
}
.sidebar .brand {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}
.sidebar .brand small { display: block; font-family: 'Inter'; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-top: 4px; }
.sidebar nav { margin-top: 36px; display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  padding: 10px 12px; border-radius: 8px; font-size: 14px; color: #cfd2dc;
  display: flex; align-items: center; gap: 10px;
  transition: background .15s ease, color .15s ease, transform .15s ease, padding-left .15s ease;
  position: relative;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; padding-left: 16px; }
.sidebar nav a.active { background: rgba(184,144,47,.18); color: #fff; }
.sidebar nav a.active::before {
  content: ""; position: absolute; left: -20px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 60%; background: var(--gold); border-radius: 0 4px 4px 0;
}
.sidebar .userbox {
  margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12);
  font-size: 13px; color: #b7bccb;
}
.sidebar .userbox .name { color: #fff; font-weight: 600; }
.sidebar .logout { display: inline-block; margin-top: 10px; font-size: 12px; color: var(--gold); transition: opacity .15s ease, transform .15s ease; }
.sidebar .logout:hover { opacity: .75; transform: translateX(2px); }

.main { flex: 1; padding: 32px 40px; max-width: 1200px; }

.topline { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 6px; }
.page-title { font-size: 30px; margin: 0; }
.page-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: #fff; color: var(--ink); cursor: pointer;
  transition: all .18s cubic-bezier(.2,.8,.2,1);
}
.btn:hover { border-color: var(--ink); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(20,34,56,.1); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); box-shadow: 0 6px 16px rgba(20,34,56,.25); }
.btn-gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn-gold:hover { background: #a17c26; box-shadow: 0 6px 16px rgba(184,144,47,.35); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow .2s ease, transform .2s ease;
}
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat-card { padding: 18px 20px; animation: riseIn .4s ease backwards; }
.stat-card:nth-child(1) { animation-delay: .02s; }
.stat-card:nth-child(2) { animation-delay: .07s; }
.stat-card:nth-child(3) { animation-delay: .12s; }
.stat-card:nth-child(4) { animation-delay: .17s; }
.stat-card:hover { box-shadow: 0 4px 16px rgba(20,34,56,.1); transform: translateY(-2px); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.stat-value { font-family: 'Fraunces', serif; font-size: 28px; margin-top: 6px; color: var(--ink); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* seal badge for rating band */
.seal {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 13px;
  border: 2px solid currentColor;
}
.band-Excellent, .band-Strong { color: var(--good); }
.band-Good { color: var(--good); }
.band-Satisfactory, .band-Watch { color: var(--watch); }
.band-Needs.Improvement, .band-Critical { color: var(--bad); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-watch { background: var(--watch-bg); color: var(--watch); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- Row list (teacher / department cards) ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
  animation: riseIn .35s ease backwards;
}
.list .row-card:nth-child(1) { animation-delay: .01s; }
.list .row-card:nth-child(2) { animation-delay: .04s; }
.list .row-card:nth-child(3) { animation-delay: .07s; }
.list .row-card:nth-child(4) { animation-delay: .10s; }
.list .row-card:nth-child(5) { animation-delay: .13s; }
.list .row-card:nth-child(n+6) { animation-delay: .15s; }
.row-card:hover { box-shadow: 0 6px 20px rgba(20,34,56,.08); transform: translateY(-2px); border-color: #d8d2c0; }
.row-left { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--gold-light); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-family: 'Fraunces', serif; font-weight: 600;
  transition: transform .2s ease;
}
.row-card:hover .avatar { transform: scale(1.08) rotate(-3deg); }
.row-title { font-weight: 600; color: var(--ink); font-size: 15px; }
.row-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Search / toolbar ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; max-width: 360px; }
.search-box input {
  width: 100%; padding: 10px 14px 10px 36px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 14px; background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-box::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; transition: color .15s ease; }
.search-box input:focus + *::before {}
.search-box:focus-within::before { color: var(--gold); }

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #1c3057 0%, #142238 55%, #0e1830 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  animation: riseIn .45s cubic-bezier(.2,.8,.2,1);
}
.login-card .brand { font-family: 'Fraunces', serif; font-size: 24px; color: var(--ink); }
.login-card .brand small { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-top: 6px; font-family: 'Inter'; }
.field { margin-top: 20px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 14px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .search-box input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-light); }
.error-box { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-top: 16px; animation: riseIn .25s ease; }
.login-btn { width: 100%; margin-top: 22px; justify-content: center; padding: 12px; font-size: 14px; }
.hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 18px; }

/* ---------- Tables ---------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th { text-align: left; padding: 10px 12px; background: var(--gold-light); color: var(--ink); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr { transition: background .15s ease; }
table.data-table tbody tr:hover { background: #faf8f2; }

.badge { transition: transform .15s ease; }
.badge:hover { transform: scale(1.05); }

/* button ripple-ish press feedback already via .btn:active; add subtle focus ring for accessibility */
.btn:focus-visible, .search-box input:focus-visible, .field input:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}

/* section title with rule */
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 14px; }
.section-title h3 { margin: 0; font-size: 17px; }
.section-title .rule { flex: 1; height: 1px; background: var(--border); }

.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); animation: riseIn .3s ease; }
.empty-state .glyph { font-size: 36px; margin-bottom: 10px; animation: riseIn .5s ease .1s backwards; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 20px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .row-card { flex-direction: column; align-items: flex-start; gap: 10px; }
}
