:root {
  --blue: #0b3d91;
  --blue-dark: #072a66;
  --blue-light: #e8eef9;
  --accent: #f2b705;
  --text: #1c2333;
  --muted: #6b7280;
  --line: #e3e7ef;
  --bg: #f5f7fb;
  --card: #ffffff;
  --green: #1e9e5a;
  --red: #d64545;
  --orange: #e08a00;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }

/* layout */
.topbar { background: var(--blue); color: #fff; display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.4rem; }
.topbar .brand { font-weight: 700; font-size: 1.15rem; color: #fff; display: flex; align-items: center; gap: .6rem; }
.topbar .brand .badge-logo { background: #fff; color: var(--blue); border-radius: 50%; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: .8rem; }
.topbar nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.topbar nav a { color: #dfe7f8; padding: .35rem .7rem; border-radius: 6px; font-weight: 500; }
.topbar nav a:hover, .topbar nav a.active { background: rgba(255,255,255,.14); color: #fff; text-decoration: none; }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: .8rem; font-size: .9rem; color: #dfe7f8; }
.topbar .user .role { background: var(--accent); color: #222; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.topbar form { margin: 0; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 1.4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }

/* cards / grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.stat .n { font-size: 1.9rem; font-weight: 700; color: var(--blue); line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat.warn .n { color: var(--orange); }
.stat.bad .n { color: var(--red); }
.stat.good .n { color: var(--green); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfe; }
tr:hover td { background: #fafbff; }
td.num, th.num { text-align: right; }
td.c, th.c { text-align: center; }
.table-wrap { overflow-x: auto; }

/* badges */
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.blue { background: var(--blue-light); color: var(--blue); }
.badge.green { background: #dff5e8; color: #157a44; }
.badge.red { background: #fde3e3; color: #a52a2a; }
.badge.orange { background: #fff1d6; color: #9a5b00; }
.badge.gray { background: #eceff4; color: #4b5563; }
.badge.gold { background: #fff5c2; color: #7a5a00; }

/* attendance cells */
.att { display: inline-block; width: 26px; height: 26px; line-height: 26px; text-align: center; border-radius: 6px; font-weight: 700; font-size: .78rem; }
.att.present { background: #dff5e8; color: #157a44; }
.att.late { background: #fff1d6; color: #9a5b00; }
.att.absent { background: #fde3e3; color: #a52a2a; }
.att.excused { background: #e8eef9; color: var(--blue); }
.att.none { background: #f1f3f7; color: #b0b6c2; }

/* mark chips */
.mark { display: inline-block; min-width: 2.2rem; text-align: center; padding: .1rem .4rem; border-radius: 6px; font-weight: 700; }
.mark.m4, .mark.m5 { background: #fde3e3; color: #a52a2a; }
.mark.m6 { background: #fff1d6; color: #9a5b00; }
.mark.m7 { background: #eef6e6; color: #4d7a1e; }
.mark.m8 { background: #dff5e8; color: #157a44; }
.mark.m9, .mark.m10 { background: #d6ecff; color: #0b3d91; }
.big-mark { font-size: 2.6rem; font-weight: 800; color: var(--blue); line-height: 1; }

/* buttons */
.btn { display: inline-block; padding: .45rem .9rem; border-radius: 7px; border: 1px solid var(--blue); background: var(--blue); color: #fff; font-weight: 600; font-size: .9rem; cursor: pointer; line-height: 1.2; }
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--blue); }
.btn.secondary:hover { background: var(--blue-light); }
.btn.sm { padding: .25rem .6rem; font-size: .8rem; }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: #fde3e3; }
.btn.success { background: var(--green); border-color: var(--green); }
.btn.success:hover { background: #157a44; }
.btn.gold { background: var(--accent); border-color: var(--accent); color: #222; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }

/* forms */
.form-row { margin-bottom: .85rem; }
.form-row label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .25rem; }
.form-control { width: 100%; padding: .48rem .6rem; border: 1px solid #cfd6e2; border-radius: 7px; font: inherit; background: #fff; }
.form-control:focus { outline: 2px solid #b9cbf2; border-color: var(--blue); }
.form-control-sm { padding: .25rem .4rem; font-size: .85rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.help { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.errorlist { color: var(--red); font-size: .82rem; margin: .2rem 0 0; padding-left: 1rem; }
.errorlist.nonfield { padding: .5rem .8rem; background: #fde3e3; border-radius: 7px; list-style: none; margin-bottom: .8rem; }
ul.radio { list-style: none; margin: 0; padding: 0; display: flex; gap: .8rem; flex-wrap: wrap; }
ul.radio label { font-weight: 500; display: flex; align-items: center; gap: .3rem; }
.form-check { width: 18px; height: 18px; }
.auth-box { max-width: 460px; margin: 3rem auto; }

/* score card grid */
.score-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.score-cat { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.score-cat header { background: var(--blue); color: #fff; padding: .55rem .8rem; display: flex; justify-content: space-between; align-items: center; }
.score-cat header small { opacity: .8; }
.score-cat .row { display: flex; justify-content: space-between; align-items: center; padding: .38rem .8rem; border-bottom: 1px solid var(--line); gap: .5rem; }
.score-cat .row:last-child { border-bottom: 0; }
.score-cat .row .n { font-size: .88rem; }
.score-cat .row .n small { display: block; color: var(--muted); font-size: .74rem; }
.mark-select { width: 5.5rem; }
.legend { font-size: .8rem; color: var(--muted); }
.bar { height: 8px; background: #eceff4; border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue); }

/* messages */
.messages { list-style: none; margin: 0 0 1rem; padding: 0; }
.messages li { padding: .6rem .9rem; border-radius: 8px; margin-bottom: .5rem; border: 1px solid; }
.messages .success { background: #dff5e8; border-color: #b6e5c8; color: #157a44; }
.messages .error { background: #fde3e3; border-color: #f5b5b5; color: #a52a2a; }
.messages .warning { background: #fff1d6; border-color: #f5d79b; color: #9a5b00; }
.messages .info { background: var(--blue-light); border-color: #c4d3f0; color: var(--blue); }

/* landing */
.hero { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%); color: #fff; border-radius: 14px; padding: 2.6rem 2.2rem; margin-bottom: 1.4rem; }
.hero h1 { font-size: 2.2rem; }
.hero p { font-size: 1.05rem; opacity: .9; max-width: 640px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.empty { color: var(--muted); padding: 1rem; text-align: center; font-style: italic; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .8rem; }
.filters .form-control { width: auto; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .85rem; } dl.kv dd { margin: 0; }
.demo-accounts { font-size: .85rem; }
.demo-accounts code { background: #eef1f6; padding: .05rem .3rem; border-radius: 4px; }
