/* TSLI Reports — brand colours carried over from the main TSLI website */
:root {
  --brand: #7B2CBF;
  --brand-600: #6420A3;
  --brand-700: #4E1683;
  --brand-50: #F6F0FC;
  --brand-100: #EADCF8;
  --accent: #FFB700;
  --accent-50: #FFF6DB;
  --ink: #1D1730;
  --muted: #6B6580;
  --line: #E7E3EE;
  --surface: #FFFFFF;
  --bg: #F7F6FA;
  --sidebar: #241036;
  --ok: #1E8E5A;
  --ok-50: #E5F6EE;
  --warn: #B26B00;
  --warn-50: #FFF4E0;
  --bad: #C0392B;
  --bad-50: #FDECEA;
  --radius: 10px;

  --bs-primary: var(--brand);
  --bs-primary-rgb: 123, 44, 191;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 123, 44, 191;
  --bs-link-hover-color: var(--brand-700);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius);
}

body { background: var(--bg); color: var(--ink); font-size: .95rem; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5 { letter-spacing: -.01em; font-weight: 650; }
.text-muted, .muted { color: var(--muted) !important; }
a, .btn-link { text-decoration: none; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn { border-radius: 8px; font-weight: 550; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600);
  --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand-100); --bs-btn-hover-bg: var(--brand-50);
  --bs-btn-hover-color: var(--brand-700); --bs-btn-hover-border-color: var(--brand-100); --bs-btn-active-bg: var(--brand-100);
  --bs-btn-active-color: var(--brand-700); --bs-btn-active-border-color: var(--brand-100); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #3A2A00; }
.btn-accent:hover { background: #F0AB00; border-color: #F0AB00; color: #3A2A00; }
.btn-light { background: #fff; border-color: var(--line); }
.form-control, .form-select { border-radius: 8px; border-color: #DAD5E3; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(123, 44, 191, .15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 550; font-size: .85rem; color: #403955; margin-bottom: .3rem; }

/* ---------- staff shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 252px; flex-shrink: 0; background: var(--sidebar); color: #D9CCEA; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: .7rem; padding: 1.25rem 1.25rem 1rem; color: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), #9D4EDD);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: .8rem; letter-spacing: .02em;
  box-shadow: inset 0 -3px 0 var(--accent); flex-shrink: 0; }
.brand-text strong { display: block; font-size: .95rem; line-height: 1.15; }
.brand-text span { font-size: .72rem; color: #B9A7D2; text-transform: uppercase; letter-spacing: .08em; }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #8E7BA9; padding: 1rem 1.25rem .35rem; }
.side-link { display: flex; align-items: center; gap: .7rem; margin: 1px .65rem; padding: .55rem .75rem; border-radius: 8px;
  color: #D9CCEA; font-weight: 500; }
.side-link i { font-size: 1.05rem; opacity: .85; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.active { background: rgba(157, 78, 221, .28); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar .user-box { margin-top: auto; padding: 1rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .85rem; }
.sidebar .user-box .name { color: #fff; font-weight: 600; }
.sidebar .user-box .btn-link { color: #B9A7D2; padding: 0; font-size: .8rem; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: .85rem 1.75rem; display: flex;
  align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 1.2rem; margin: 0; }
.topbar .crumbs { font-size: .8rem; color: var(--muted); }
.content { padding: 1.75rem; max-width: 1280px; width: 100%; }
.mobile-toggle { display: none; }

@media (max-width: 991px) {
  .sidebar { position: fixed; z-index: 40; left: -260px; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 0 100vmax rgba(20, 10, 30, .45); }
  .mobile-toggle { display: inline-flex; }
  .content { padding: 1rem; }
  .topbar { padding: .75rem 1rem; }
}

/* ---------- cards & panels ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(30, 15, 50, .04); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: .9rem 1.15rem; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card-body { padding: 1.15rem; }
.stat { display: flex; align-items: center; gap: .9rem; }
.stat .icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 1.25rem;
  background: var(--brand-50); color: var(--brand); }
.stat .icon.gold { background: var(--accent-50); color: #A26A00; }
.stat .icon.green { background: var(--ok-50); color: var(--ok); }
.stat .value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat .label { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty i { font-size: 2rem; color: #C6BBD6; display: block; margin-bottom: .5rem; }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: .7rem 1rem; border-color: var(--line); vertical-align: middle; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600;
  background: #FBFAFD; white-space: nowrap; }
.table-hover tbody tr:hover > * { background: #FAF7FD; }
.row-link { cursor: pointer; }

/* ---------- avatars, badges ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700);
  display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }
.badge-soft { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .55rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; background: #F0EEF4; color: #4A4460; }
.badge-soft.brand { background: var(--brand-50); color: var(--brand-700); }
.badge-soft.ok { background: var(--ok-50); color: var(--ok); }
.badge-soft.warn { background: var(--warn-50); color: var(--warn); }
.badge-soft.bad { background: var(--bad-50); color: var(--bad); }
.badge-soft.gold { background: var(--accent-50); color: #8A5A00; }
.grade-pill { display: inline-grid; place-items: center; min-width: 2.1rem; height: 1.7rem; padding: 0 .45rem; border-radius: 6px;
  font-weight: 700; font-size: .85rem; background: #F0EEF4; }
.grade-a { background: #E3F5EC; color: #13734A; }
.grade-b { background: #E6F0FD; color: #1D5DB8; }
.grade-c { background: #FFF4D6; color: #8A5A00; }
.grade-d { background: #FDEBDD; color: #A4511A; }
.grade-f { background: #FDE7E7; color: #B42323; }

/* ---------- progress ---------- */
.progress { height: 7px; background: #EEEAF3; border-radius: 99px; }
.progress-bar { background: var(--brand); border-radius: 99px; }
.progress-bar.done { background: var(--ok); }

/* ---------- marks / attendance entry ---------- */
.entry-table input.mark-input { width: 5.2rem; text-align: center; font-weight: 600; }
.entry-table textarea { min-height: 38px; resize: vertical; }
.entry-table input.is-invalid { background-image: none; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line); padding: .8rem 1.15rem; display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; border-radius: 0 0 var(--radius) var(--radius); z-index: 5; }
.status-group .btn { font-size: .8rem; padding: .3rem .6rem; }
.btn-check:checked + .btn-present { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-check:checked + .btn-absent { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-check:checked + .btn-late { background: #D98A00; border-color: #D98A00; color: #fff; }
.btn-check:checked + .btn-excused { background: #5B6B88; border-color: #5B6B88; color: #fff; }
.status-group .btn-outline-secondary { --bs-btn-border-color: #DAD5E3; --bs-btn-color: #4A4460; --bs-btn-hover-bg: #F3F0F7;
  --bs-btn-hover-color: #2A2340; --bs-btn-hover-border-color: #DAD5E3; }
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* ---------- profile ---------- */
.profile-head { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: .45rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; }
.id-chip { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; background: var(--brand-50); color: var(--brand-700);
  padding: .15rem .5rem; border-radius: 6px; font-weight: 600; font-size: .85rem; }
.nav-pills .nav-link { color: var(--muted); font-weight: 550; border-radius: 8px; }
.nav-pills .nav-link.active { background: var(--brand-50); color: var(--brand-700); }

/* ---------- auth / parent ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: radial-gradient(circle at 20% 20%, #9D4EDD 0, transparent 45%), linear-gradient(150deg, #3B1263, #241036);
  color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; right: -80px; bottom: -80px; width: 280px; height: 280px; border-radius: 50%;
  border: 36px solid rgba(255, 183, 0, .18); }
.auth-art h2 { font-size: 2.2rem; font-weight: 750; max-width: 26rem; }
.auth-art p { color: #D9CCEA; max-width: 26rem; }
.auth-form { display: grid; place-items: center; padding: 2rem 1.25rem; background: #fff; }
.auth-form .inner { width: 100%; max-width: 380px; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; } }

.parent-top { background: #fff; color: var(--ink); border-bottom: 4px solid var(--accent); box-shadow: 0 1px 0 var(--line); }
.parent-top .inner { max-width: 960px; margin: 0 auto; padding: .9rem 1rem; display: flex; align-items: center; gap: .8rem; }
.parent-wrap { max-width: 960px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.term-tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; }
.term-tabs a { white-space: nowrap; padding: .45rem .9rem; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  color: #4A4460; font-weight: 550; font-size: .85rem; }
.term-tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.subject-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 1rem; }
.subject-card + .subject-card { margin-top: .6rem; }
.big-mark { font-size: 1.5rem; font-weight: 750; line-height: 1; }

/* ---------- QR cards ---------- */
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }
.qr-card { background: #fff; border: 1px dashed #BDB3CC; border-radius: 12px; padding: 1.1rem; display: flex; gap: 1rem;
  break-inside: avoid; page-break-inside: avoid; }
.qr-card .qr-svg { width: 132px; height: 132px; flex-shrink: 0; }
.qr-card h6 { margin: 0 0 .15rem; font-weight: 700; }
.qr-card .small { font-size: .74rem; }
.qr-svg path { fill: #1D1730; }

/* ---------- report card (print-friendly) ---------- */
.report-doc { background: #fff; max-width: 860px; margin: 1.5rem auto; padding: 2.4rem; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(36, 16, 54, .06); }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  border-bottom: 3px solid var(--brand); padding-bottom: 1rem; margin-bottom: 1.2rem; }
.report-head h1 { font-size: 1.35rem; color: var(--brand-700); margin: 0; }
.report-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; background: var(--brand-50); border-radius: 8px;
  padding: .9rem 1rem; margin-bottom: 1.2rem; font-size: .85rem; }
.report-meta span { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.report-doc table td, .report-doc table th { font-size: .86rem; }
.report-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: 1.4rem; font-size: .82rem; }
.sig-line { border-top: 1px solid #9C94AE; margin-top: 2.6rem; padding-top: .3rem; color: var(--muted); font-size: .75rem; }
@media (max-width: 700px) { .report-doc { padding: 1.1rem; margin: 0; border-radius: 0; } .report-meta { grid-template-columns: 1fr 1fr; } }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; font-size: 11pt; }
  .no-print, .sidebar, .topbar, .parent-top, .alert { display: none !important; }
  .report-doc { box-shadow: none; border: 0; margin: 0; padding: 0; max-width: none; }
  .report-meta { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .grade-pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .qr-sheet { grid-template-columns: 1fr 1fr; gap: 6mm; }
  .content { padding: 0 !important; max-width: none; }
}

.grade-e { background: #FDEBDD; color: #A4511A; }
.grade-d { background: #FFF0D6; color: #8A5A00; }
.entry-table input.max-input { width: 5rem; font-weight: 500; }
.sidebar .brand-logo { background: #fff; border-radius: 10px; padding: .45rem .6rem; margin: 1rem 1rem .35rem; display: block; }
.sidebar .brand-logo img { width: 100%; height: auto; display: block; }
.sidebar .brand-sub { font-size: .68rem; color: #B9A7D2; text-transform: uppercase; letter-spacing: .12em; padding: 0 1.25rem; }

.gradebook .pts-input { width: 4.6rem; }
.gradebook .contrib { font-size: .7rem; margin-top: 2px; white-space: nowrap; }
.gradebook thead th { text-transform: none; letter-spacing: 0; font-size: .78rem; color: #403955; }
.class-card { transition: border-color .15s, box-shadow .15s; }
.class-card:hover { border-color: var(--brand-100); box-shadow: 0 4px 14px rgba(123, 44, 191, .08); }

/* ---------- timetable ---------- */
.tt-grid { display: grid; grid-template-columns: repeat(var(--days, 5), minmax(150px, 1fr)); gap: .6rem; overflow-x: auto; }
.tt-day { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; min-height: 120px; }
.tt-day-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: .2rem .3rem .5rem; }
.tt-lesson { display: block; border-left: 4px solid var(--brand); background: var(--brand-50); border-radius: 8px; padding: .45rem .55rem; margin-bottom: .45rem; color: var(--ink); }
.tt-lesson:hover { background: var(--brand-100); color: var(--ink); }
.tt-time { font-size: .74rem; color: var(--brand-700); font-weight: 600; }
.tt-subject { font-weight: 650; font-size: .88rem; line-height: 1.2; }
.tt-meta { font-size: .72rem; color: var(--muted); }
.tt-empty { color: #c6bbd6; text-align: center; padding-top: .8rem; }
@media (max-width: 991px) { .tt-grid { grid-template-columns: 1fr; } .tt-day { min-height: 0; } }
