 :root {
  --primary: #075f45;
  --primary-dark: #044a36;
  --primary-soft: #eef7f3;
  --accent: #8e7958;
  --accent-soft: #f4efe7;
  --sidebar: #081f19;
  --sidebar-muted: #9fb7ad;
  --bg: #f5f3ee;
  --panel: #ffffff;
  --text: #17251f;
  --muted: #67756f;
  --border: #e4e5df;
  --success: #2f855a;
  --danger: #b23a3a;
  --warning: #a86e22;
  --shadow: 0 14px 34px rgba(22, 46, 37, .07);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; background: var(--sidebar); color: white; display: flex; flex-direction: column; z-index: 30; transition: transform .25s ease; }
.brand { display: flex; align-items: center; gap: 12px; padding: 26px 22px 22px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(135deg, #60a5fa, #2563eb); font-weight: 800; box-shadow: 0 8px 25px rgba(37,99,235,.35); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; }
.brand span { margin-top: 3px; color: var(--sidebar-muted); font-size: 11px; }
.nav-menu { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; padding: 19px 12px 8px; }
.nav-item { width: 100%; border: 0; background: transparent; color: #cbd5e1; border-radius: 10px; display: flex; align-items: center; gap: 12px; padding: 11px 12px; text-align: left; margin: 2px 0; transition: .2s; }
.nav-item span { width: 20px; text-align: center; font-size: 17px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: linear-gradient(135deg, var(--primary), #0b7658); color: white; box-shadow: 0 8px 22px rgba(7,95,69,.28); }
.sidebar-footer { padding: 18px 22px; display: flex; align-items: center; gap: 9px; color: var(--sidebar-muted); font-size: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 5px rgba(34,197,94,.12); }
.main-content { margin-left: 260px; width: calc(100% - 260px); min-height: 100vh; padding: 0 28px 40px; }
.topbar { min-height: 88px; display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.topbar h1 { margin: 0; font-size: 24px; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-badge { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--primary); font-weight: 800; font-size: 12px; }
.menu-toggle { display: none; border: 0; background: white; border-radius: 10px; width: 42px; height: 42px; box-shadow: var(--shadow); }
.page { display: none; animation: fade .22s ease; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-grid.six { grid-template-columns: repeat(6, minmax(0,1fr)); }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; }
.stat-card.compact { justify-content: center; text-align: center; padding: 16px 10px; }
.stat-card span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat-card strong { display: block; font-size: 25px; }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; }
.stat-icon.blue { background: #dbeafe; color: #2563eb; }.stat-icon.green { background: #dcfce7; color: #16a34a; }.stat-icon.orange { background: #ffedd5; color: #ea580c; }.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); gap: 18px; margin-bottom: 18px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.panel-header { min-height: 72px; padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); gap: 12px; }
.panel-header h3 { margin: 0; font-size: 16px; }.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.chart-panel { min-height: 390px; }.chart-wrap { position: relative; height: 300px; padding: 20px; }
.achievement-ring { width: 170px; height: 170px; margin: 26px auto 18px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--primary) 0deg, #e2e8f0 0deg); position: relative; }
.achievement-ring::after { content: ""; position: absolute; inset: 15px; background: white; border-radius: 50%; }
.achievement-ring > div { position: relative; z-index: 1; text-align: center; }.achievement-ring strong, .achievement-ring span { display: block; }.achievement-ring strong { font-size: 30px; }.achievement-ring span { color: var(--muted); font-size: 12px; }
.mini-stats { display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid var(--border); }.mini-stats div { padding: 14px 8px; text-align: center; border-right: 1px solid var(--border); }.mini-stats div:last-child { border: 0; }.mini-stats span, .mini-stats strong { display: block; }.mini-stats span { color: var(--muted); font-size: 10px; margin-bottom: 5px; }.mini-stats strong { font-size: 16px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.search-box { background: white; border: 1px solid var(--border); border-radius: 11px; min-width: 320px; display: flex; align-items: center; padding: 0 12px; box-shadow: 0 5px 15px rgba(15,23,42,.03); }
.search-box span { color: var(--muted); }.search-box input { border: 0; outline: 0; width: 100%; padding: 11px; background: transparent; }
.btn { border: 1px solid transparent; border-radius: 10px; padding: 10px 14px; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: .2s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }.btn-primary { color: white; background: var(--primary); box-shadow: 0 6px 16px rgba(7,95,69,.22); }.btn-primary:hover { background: var(--primary-dark); }.btn-soft { background: white; color: #34443d; border-color: var(--border); }.btn-danger { color: var(--danger); background: #fff1f2; border-color: #fecdd3; }
.file-button input { display: none; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; } th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: middle; } th { color: #59665f; background: #f7f7f3; font-size: 11px; letter-spacing: .02em; text-transform: uppercase; } tbody tr:hover { background: #f8faf7; } tbody tr:last-child td { border-bottom: 0; }
.action-group { display: flex; gap: 6px; }.icon-btn { width: 31px; height: 31px; border: 1px solid var(--border); border-radius: 8px; background: white; display: grid; place-items: center; }.icon-btn.edit { color: var(--primary); }.icon-btn.delete { color: var(--danger); }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; background: var(--primary-soft); color: var(--primary); }.badge.success { background: #dcfce7; color: #15803d; }.badge.warning { background: #ffedd5; color: #c2410c; }.badge.danger { background: #fee2e2; color: #b91c1c; }
.empty-row { text-align: center; color: var(--muted); padding: 38px !important; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.class-card { background: white; border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }.class-card-top { display: flex; justify-content: space-between; gap: 12px; }.class-card h3 { margin: 0; font-size: 22px; }.class-card p { color: var(--muted); margin: 6px 0 18px; font-size: 12px; }.class-meta { border-top: 1px solid var(--border); padding-top: 14px; display: flex; justify-content: space-between; align-items: flex-end; }.class-meta span { color: var(--muted); display: block; font-size: 10px; }.class-meta strong { display: block; margin-top: 4px; font-size: 12px; }
.filter-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }.filter-row select, .filter-panel select, .report-controls select { min-width: 180px; }
select, input, textarea { border: 1px solid var(--border); border-radius: 9px; padding: 10px 11px; outline: none; background: white; color: var(--text); } select:focus, input:focus, textarea:focus { border-color: #7db6a4; box-shadow: 0 0 0 3px rgba(7,95,69,.09); }
.filter-panel { background: white; border: 1px solid var(--border); border-radius: 15px; box-shadow: var(--shadow); padding: 16px; display: flex; gap: 12px; align-items: flex-end; margin-bottom: 16px; flex-wrap: wrap; }.filter-panel > div { display: grid; gap: 6px; }.filter-panel label, .report-controls label, .field label { color: #59665f; font-size: 11px; font-weight: 800; }
.report-controls { padding: 18px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }.report-controls > div { display: grid; gap: 6px; }
.empty-state { min-height: 380px; background: white; border: 1px dashed #c9cec8; border-radius: 16px; display: grid; place-content: center; text-align: center; padding: 40px; color: var(--muted); }.empty-state h3 { margin: 10px 0 5px; color: #34443d; }.empty-state p { max-width: 520px; margin: 0; line-height: 1.6; font-size: 13px; }.empty-icon { font-size: 42px; color: #9a8664; }
.report-sheet { background: white; max-width: 900px; margin: 0 auto; padding: 45px 55px; border: 1px solid var(--border); box-shadow: var(--shadow); min-height: 1120px; }.report-header { text-align: center; border-bottom: 3px double #0f172a; padding-bottom: 15px; margin-bottom: 22px; }.report-header h2 { margin: 0 0 6px; font-size: 22px; }.report-header p { margin: 3px 0; font-size: 12px; }.report-title { text-align: center; margin: 22px 0; }.report-title h3 { margin: 0; font-size: 17px; }.report-title p { margin: 5px 0 0; font-size: 12px; }.identity-table { width: auto; min-width: 520px; margin-bottom: 18px; }.identity-table td { border: 0; padding: 3px 8px; font-size: 12px; }.report-table { min-width: 0; }.report-table th, .report-table td { border: 1px solid #9ba69f; padding: 8px; }.report-table th { text-align: center; background: #f3f3ef; }.report-signatures { display: grid; grid-template-columns: repeat(3,1fr); gap: 40px; margin-top: 45px; text-align: center; font-size: 12px; }.signature-space { height: 70px; }.hidden { display: none !important; }
.settings-panel { max-width: 780px; }.settings-grid { padding: 22px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px); }.modal-backdrop.open { display: flex; }.modal { width: min(820px, 100%); max-height: 92vh; overflow: auto; background: white; border-radius: 18px; box-shadow: 0 30px 90px rgba(15,23,42,.25); }.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 24px; border-bottom: 1px solid var(--border); }.modal-header h2 { margin: 0; font-size: 20px; }.modal-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }.icon-button { border: 0; background: #f3f3ef; border-radius: 50%; width: 34px; height: 34px; font-size: 22px; color: #59665f; }
#entityForm { padding: 22px 24px; }.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }.field { display: grid; gap: 7px; }.field.full, .form-actions.full { grid-column: 1 / -1; }.field small { color: var(--muted); font-size: 10px; }.checkbox-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; max-height: 160px; overflow: auto; }.checkbox-grid label { display: flex; align-items: center; gap: 8px; font-weight: 500; }.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 9px; }.toast { min-width: 280px; max-width: 420px; background: #0f172a; color: white; padding: 13px 15px; border-radius: 11px; box-shadow: 0 18px 40px rgba(15,23,42,.25); font-size: 12px; animation: toastIn .2s ease; }.toast.error { background: #991b1b; }.toast.success { background: #166534; } @keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 1100px) { .stat-grid.six { grid-template-columns: repeat(3,1fr); }.card-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 900px) { .sidebar { transform: translateX(-100%); }.sidebar.open { transform: translateX(0); }.main-content { margin-left: 0; width: 100%; padding: 0 16px 30px; }.menu-toggle { display: block; }.topbar { justify-content: flex-start; }.top-actions { margin-left: auto; }.dashboard-grid { grid-template-columns: 1fr; }.stat-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 620px) { .topbar { min-height: 78px; }.topbar h1 { font-size: 20px; }.topbar p { display: none; }.stat-grid, .stat-grid.six, .card-grid { grid-template-columns: 1fr; }.toolbar { align-items: stretch; }.search-box { min-width: 100%; }.toolbar-actions { width: 100%; }.toolbar-actions .btn { flex: 1; }.form-grid { grid-template-columns: 1fr; }.field.full { grid-column: auto; }.filter-panel > div, .filter-panel select, .report-controls > div, .report-controls select { width: 100%; }.filter-panel .btn, .report-controls .btn { width: 100%; }.report-sheet { padding: 28px 20px; }.identity-table { min-width: 0; width: 100%; }.report-signatures { grid-template-columns: 1fr; gap: 20px; }.chart-wrap { height: 250px; }.chart-panel { min-height: 340px; } }
@media print { body { background: white; }.sidebar, .topbar, .report-controls, #reportEmpty, .toast-container { display: none !important; }.main-content { margin: 0; padding: 0; width: 100%; }.page { display: none !important; }.page#page-reports { display: block !important; }.report-sheet { display: block !important; border: 0; box-shadow: none; max-width: none; min-height: auto; padding: 10mm 12mm; }.report-table th, .report-table td { font-size: 10px; }.report-signatures { break-inside: avoid; } }
.table-summary { padding: 11px 16px; border-bottom: 1px solid var(--border); background: #f7f7f3; color: var(--muted); font-size: 11px; }
.chapter-list { margin: 0; padding-left: 18px; min-width: 250px; line-height: 1.55; }
.chapter-list li + li { margin-top: 3px; }
.sub-meta { margin-top: 6px !important; font-size: 9px !important; color: var(--muted); }
.report-section-title { margin: 24px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.report-note { margin: 0 0 8px; color: #59665f; font-size: 11px; line-height: 1.5; }
.report-sheet small { color: var(--muted); }
@media (max-width: 1350px) { .stat-grid.six { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media print {
  .report-section-title { break-after: avoid; }
  .report-table { break-inside: auto; }
  .report-table tr { break-inside: avoid; break-after: auto; }
  .report-sheet { font-size: 10px; }
}


/* THIVAL CHAMP brand refinements */
body { background: radial-gradient(circle at top right, rgba(142,121,88,.08), transparent 30%), var(--bg); }
.sidebar { background: linear-gradient(180deg, #0a251e 0%, #061712 100%); border-right: 1px solid rgba(142,121,88,.2); }
.brand { min-height: 102px; padding: 18px 16px; gap: 10px; }
.brand-logo { width: 72px; height: 48px; object-fit: contain; flex: 0 0 auto; filter: drop-shadow(0 7px 15px rgba(0,0,0,.22)); }
.brand strong { font-size: 16px; letter-spacing: .04em; color: #fff; }
.brand span { color: #b7c8c0; font-size: 10px; line-height: 1.35; }
.nav-label { color: #82978e; }
.nav-item.active { background: linear-gradient(135deg, var(--primary), #0d7759); }
.topbar h1 { color: #183128; letter-spacing: -.02em; }
.user-badge { background: var(--accent-soft); color: var(--accent); border: 1px solid #ded1bd; }
.btn-primary { background: linear-gradient(135deg, var(--primary), #0b7658); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), #075f45); }
.btn-soft:hover { border-color: #c7b99f; background: #faf8f3; }
.stat-card, .panel, .class-card, .filter-panel, .report-controls { border-color: #e6e3da; }
.stat-icon.blue { background: #e9f3ef; color: var(--primary); }
.stat-icon.green { background: #eaf4ed; color: #2f855a; }
.stat-icon.orange { background: #f6eee2; color: #a86e22; }
.stat-icon.purple { background: #f1ece4; color: var(--accent); }
th { color: #4e5f57; }
.badge { background: #eaf4ef; color: var(--primary); }
.badge.success { background: #e5f3e9; color: #287549; }
.badge.warning { background: #f7eddd; color: #94601e; }
.badge.danger { background: #f7e7e5; color: #a33535; }

.report-sheet { position: relative; isolation: isolate; overflow: hidden; border-top: 5px solid var(--primary); }
.report-sheet > *:not(.report-watermark) { position: relative; z-index: 1; }
.report-watermark { position: absolute; z-index: 0; width: 72%; height: auto; left: 14%; top: 33%; opacity: .035; pointer-events: none; filter: grayscale(.2); }
.report-letterhead { display: grid; grid-template-columns: 145px 1fr 145px; align-items: center; text-align: center; padding: 0 0 15px; }
.report-letterhead::after { content: ''; }
.report-letterhead > img { width: 135px; max-height: 80px; object-fit: contain; justify-self: start; }
.report-letterhead h2 { color: #173d31; font-size: 20px; text-transform: uppercase; letter-spacing: .02em; }
.report-letterhead p { color: #4e5f57; }
.report-app-name { display: inline-block; color: var(--primary); background: var(--primary-soft); border: 1px solid #cfe2da; border-radius: 999px; padding: 4px 10px; margin-bottom: 8px; font-size: 9px; font-weight: 900; letter-spacing: .14em; }
.report-title h3 { color: #263d34; }
.report-section-title { color: var(--primary); padding-bottom: 5px; border-bottom: 1px solid #d9e3de; }
.report-table th { background: #eef5f1; color: #25483b; }
.report-table tfoot td { background: #f7f4ed; }
.report-two-column { display: grid; grid-template-columns: minmax(260px,.75fr) minmax(0,1.45fr); gap: 18px; align-items: start; }
.attendance-report td:last-child { text-align: center; width: 100px; }

@media (max-width: 760px) {
  .brand-logo { width: 65px; }
  .report-letterhead { grid-template-columns: 92px 1fr; text-align: left; }
  .report-letterhead::after { display: none; }
  .report-letterhead > img { width: 84px; }
  .report-two-column { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4; margin: 9mm 10mm; }
  .report-sheet { overflow: visible; border-top: 0; padding: 0; }
  .report-watermark { position: fixed; width: 70%; left: 15%; top: 32%; opacity: .035; }
  .report-letterhead { grid-template-columns: 125px 1fr 125px; }
  .report-letterhead > img { width: 115px; }
  .report-two-column { grid-template-columns: .8fr 1.4fr; gap: 12px; break-inside: avoid; }
  .report-section-title { margin-top: 16px; }
}

/* Login & role access — THIVAL CHAMP V4 */
.auth-hidden { display: none !important; }
body.teacher-role .admin-only { display: none !important; }
.login-screen {
  position: fixed; inset: 0; z-index: 1000; min-height: 100vh; overflow: auto;
  display: grid; place-items: center; padding: 32px 18px;
  background:
    linear-gradient(135deg, rgba(4, 35, 27, .98), rgba(5, 76, 56, .94)),
    radial-gradient(circle at 20% 10%, rgba(177, 151, 105, .26), transparent 38%);
}
.login-screen.hidden { display: none !important; }
.login-screen::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .09;
  background-image: linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}
.login-orb { position: fixed; border-radius: 50%; filter: blur(4px); pointer-events: none; }
.login-orb-one { width: 360px; height: 360px; right: -100px; top: -100px; background: rgba(183, 154, 105, .17); }
.login-orb-two { width: 300px; height: 300px; left: -100px; bottom: -110px; background: rgba(33, 151, 111, .14); }
.login-card {
  position: relative; z-index: 1; width: min(470px, 100%); padding: 34px 38px 28px;
  background: rgba(255, 255, 255, .975); border: 1px solid rgba(222, 209, 189, .9);
  border-radius: 26px; box-shadow: 0 34px 100px rgba(0, 0, 0, .32);
}
.login-brand { display: flex; align-items: center; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid #e9e3d8; }
.login-brand img { width: 92px; height: 62px; object-fit: contain; }
.login-brand div { display: grid; gap: 2px; }
.login-brand span { color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.login-brand strong { color: #113d30; font-size: 23px; letter-spacing: .035em; }
.login-brand small { color: #67766f; font-size: 11px; }
.login-copy { padding: 25px 0 19px; }
.login-eyebrow { margin: 0 0 7px; color: var(--primary); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.login-copy h1 { margin: 0 0 8px; color: #172e26; font-size: 29px; letter-spacing: -.035em; }
.login-copy > p:last-child { margin: 0; color: #69776f; line-height: 1.6; font-size: 12px; }
.login-form { display: grid; gap: 15px; }
.login-form > label:not(.show-pin) { display: grid; gap: 7px; color: #31473e; font-size: 12px; font-weight: 800; }
.login-input { display: flex; align-items: center; min-height: 48px; padding: 0 14px; border: 1px solid #d9ded9; border-radius: 12px; background: #fbfcfa; transition: .2s ease; }
.login-input:focus-within { border-color: #178262; background: white; box-shadow: 0 0 0 4px rgba(15, 121, 87, .1); }
.login-input span { width: 24px; color: #8b7654; font-size: 13px; }
.login-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #20352c; font-size: 14px; font-weight: 700; text-transform: none; }
.login-form label:first-child input { text-transform: uppercase; }
.show-pin { display: flex; align-items: center; gap: 8px; color: #67756e; font-size: 11px; font-weight: 600; cursor: pointer; }
.show-pin input { accent-color: var(--primary); }
.login-submit { width: 100%; min-height: 49px; margin-top: 1px; font-size: 13px; letter-spacing: .02em; }
.login-error { min-height: 17px; margin: -4px 0 0; color: #b42318; font-size: 11px; text-align: center; }
.login-help { display: flex; gap: 10px; align-items: flex-start; margin-top: 19px; padding: 12px 14px; border-radius: 12px; background: #f4f1ea; color: #675e50; }
.login-help p { margin: 0; font-size: 10px; line-height: 1.5; }
.login-footer { margin: 22px 0 0; color: #8e7958; font-size: 10px; font-weight: 800; text-align: center; letter-spacing: .08em; text-transform: uppercase; }
.user-session { display: flex; align-items: center; gap: 9px; }
.user-badge { display: grid; min-width: 165px; padding: 8px 12px; border-radius: 12px; line-height: 1.25; }
.user-badge strong { color: #5f4c31; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.user-badge span { color: #8d7858; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.logout-button { min-height: 36px; padding: 0 12px; border: 1px solid #ded6c8; border-radius: 10px; background: white; color: #725e3e; font-size: 10px; font-weight: 800; cursor: pointer; transition: .2s ease; }
.logout-button:hover { background: #f7f3eb; border-color: #cdbfaa; }
.account-notice { display: flex; gap: 15px; align-items: center; margin-bottom: 17px; padding: 18px 20px; border: 1px solid #d7e5df; border-radius: 16px; background: linear-gradient(135deg, #edf7f2, #fbf8f1); }
.account-notice-icon { display: grid; place-items: center; flex: 0 0 45px; height: 45px; border-radius: 13px; background: var(--primary); color: white; font-size: 21px; box-shadow: 0 8px 20px rgba(7,95,69,.18); }
.account-notice h3 { margin: 0 0 4px; color: #20483a; font-size: 15px; }
.account-notice p { margin: 0; color: #66756e; font-size: 11px; line-height: 1.55; }
.login-code, .login-pin-code { display: inline-block; padding: 6px 9px; border-radius: 8px; font-family: Consolas, 'Courier New', monospace; font-size: 11px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.login-code { background: #e7f3ee; color: #075f45; }
.login-pin-code { background: #f3ede3; color: #785d32; }
.account-actions { display: flex; gap: 5px; flex-wrap: nowrap; }
.copy-account, .reset-pin { border: 1px solid #d8ded9; border-radius: 8px; background: white; padding: 6px 8px; color: #53655d; font-size: 10px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.copy-account:hover, .reset-pin:hover { border-color: #aebdb5; background: #f6faf8; }

@media (max-width: 700px) {
  .login-card { padding: 27px 23px 23px; border-radius: 20px; }
  .login-brand img { width: 75px; height: 52px; }
  .login-brand strong { font-size: 20px; }
  .login-copy h1 { font-size: 25px; }
  .user-badge { display: none; }
  .logout-button { padding: 0 10px; }
}
.locked-select { background: #f3f6f4 !important; color: #52645c; border-color: #d6ddd9 !important; }

/* THIVAL CHAMP V6 — Multi-school, unit isolation, bilingual, supermaster */
.director-only { display: none !important; }
body.director-role .director-only { display: block !important; }
body.director-role .school-only { display: none !important; }
body.teacher-role .admin-only { display: none !important; }
body.director-role .nav-menu > .director-only { display: block !important; }
.login-input select { flex: 1; width: 100%; border: 0; outline: 0; box-shadow: none; padding: 0; background: transparent; color: #20352c; font-size: 13px; font-weight: 700; }
.multi-login-card { width: min(500px, 100%); }
.icon-button.danger { color: var(--danger); }
.icon-button { display: inline-grid; place-items: center; cursor: pointer; font-size: 15px; }
.center { text-align: center !important; }
.chart-wrap.tall { height: 365px; }

body[data-school="sdit_thi"] { --primary:#b91c1c; --primary-dark:#7f1d1d; --primary-soft:#fff1f2; --accent:#a8672c; --accent-soft:#fff7ed; --sidebar:#4c1015; --bg:#fff7f7; --text:#3b1719; }
body[data-school="sdit_thi"] .sidebar { background:linear-gradient(180deg,#4c1015,#28080c); }
body[data-school="sdit_thi"] .nav-item.active, body[data-school="sdit_thi"] .btn-primary { background:linear-gradient(135deg,#b91c1c,#7f1d1d); }
body[data-school="sdit_thi"] .login-screen { background:linear-gradient(135deg,#3d0c11,#b91c1c); }
body[data-school="smpit_thi"] { --primary:#1d4ed8; --primary-dark:#1e3a8a; --primary-soft:#eff6ff; --accent:#9a7339; --accent-soft:#f8f3e8; --sidebar:#0b1f3a; --bg:#f3f7fc; --text:#16243a; }
body[data-school="smpit_thi"] .sidebar { background:linear-gradient(180deg,#0b1f3a,#071426); }
body[data-school="smpit_thi"] .nav-item.active, body[data-school="smpit_thi"] .btn-primary { background:linear-gradient(135deg,#1d4ed8,#1e3a8a); }
body[data-school="smpit_thi"] .login-screen { background:linear-gradient(135deg,#071426,#1d4ed8); }
body[data-school="smpit_hathi"] { --primary:#0284c7; --primary-dark:#075985; --primary-soft:#f0f9ff; --accent:#258db5; --accent-soft:#e8f7fd; --sidebar:#0c4a6e; --bg:#f2fbff; --text:#12364a; }
body[data-school="smpit_hathi"] .sidebar { background:linear-gradient(180deg,#0c4a6e,#082f49); }
body[data-school="smpit_hathi"] .nav-item.active, body[data-school="smpit_hathi"] .btn-primary { background:linear-gradient(135deg,#0284c7,#075985); }
body[data-school="smpit_hathi"] .login-screen { background:linear-gradient(135deg,#082f49,#0284c7); }
body[data-school="smait_thi"] { --primary:#075f45; --primary-dark:#044a36; --primary-soft:#eef7f3; --accent:#8e7958; --accent-soft:#f4efe7; --sidebar:#081f19; --bg:#f5f3ee; --text:#17251f; }
body[data-school="director"] { --primary:#5b3f91; --primary-dark:#34205e; --primary-soft:#f3effa; --accent:#aa8244; --accent-soft:#faf4e8; --sidebar:#221538; --bg:#f7f5fb; --text:#261d34; }
body[data-school="director"] .sidebar { background:linear-gradient(180deg,#2d1b49,#160d27); }
body[data-school="director"] .nav-item.active, body[data-school="director"] .btn-primary { background:linear-gradient(135deg,#6848a6,#3d256f); }

.unit-banner, .supermaster-hero { border-radius:20px; padding:24px 28px; margin-bottom:18px; display:flex; align-items:center; justify-content:space-between; gap:18px; color:white; box-shadow:var(--shadow); overflow:hidden; position:relative; }
.unit-banner { background:linear-gradient(135deg,var(--primary),var(--primary-dark)); }
.unit-banner::after, .supermaster-hero::after { content:""; position:absolute; width:220px; height:220px; border-radius:50%; right:-70px; top:-100px; background:rgba(255,255,255,.09); }
.unit-banner span, .supermaster-hero span { font-size:10px; font-weight:900; letter-spacing:.16em; opacity:.78; }
.unit-banner h2, .supermaster-hero h2 { margin:5px 0 4px; font-size:25px; }
.unit-banner p, .supermaster-hero p { margin:0; font-size:12px; opacity:.84; max-width:750px; line-height:1.55; }
.unit-lock { position:relative; z-index:1; min-width:115px; height:74px; border:1px solid rgba(255,255,255,.25); background:rgba(255,255,255,.12); border-radius:16px; display:grid; place-items:center; font-size:24px; }
.unit-lock small { display:block; font-size:9px; font-weight:800; letter-spacing:.08em; margin-top:-12px; }
.supermaster-hero { background:linear-gradient(135deg,#2d1b49,#6848a6); }
.supermaster-seal { position:relative; z-index:1; min-width:112px; height:90px; border:1px solid rgba(255,255,255,.24); background:rgba(255,255,255,.1); border-radius:18px; display:grid; place-items:center; text-align:center; font-size:10px; letter-spacing:.15em; }
.supermaster-seal strong { display:block; font-size:28px; letter-spacing:.05em; }
body.director-role #page-supermaster.page.active { display:block !important; }
body.director-role .topbar h1 { color:#34205e; }
.rank-badge { display:inline-grid; place-items:center; width:28px; height:28px; border-radius:50%; background:var(--primary-soft); color:var(--primary); font-weight:900; }
.score-badge { display:inline-grid; min-width:38px; place-items:center; padding:6px 8px; border-radius:9px; background:var(--primary-soft); color:var(--primary); font-weight:900; }
.score-badge.success { background:#dcfce7; color:#15803d; }
.score-badge.danger { background:#fee2e2; color:#b91c1c; }
.sub-meta { margin-top:4px; }

@media (max-width:900px){ .supermaster-hero,.unit-banner{padding:20px}.supermaster-seal,.unit-lock{display:none}.chart-wrap.tall{height:300px} }
@media print { body.director-role { display:none; } .report-table th,.report-table td{font-size:9px;padding:6px 7px}.report-section-title{break-after:avoid}.report-table{break-inside:auto}.report-table tr{break-inside:avoid}.report-sheet{font-size:10px} }

/* THIVAL CHAMP V7 — Director analytics and two-year history */
.supermaster-filter-panel { margin-bottom:18px; }
.supermaster-filters { display:grid; grid-template-columns:repeat(6,minmax(145px,1fr)); gap:12px; padding:18px 20px 14px; }
.supermaster-filters > div { display:grid; gap:6px; }
.supermaster-filters label { color:#5f5670; font-size:10px; font-weight:900; letter-spacing:.045em; text-transform:uppercase; }
.supermaster-filters select { width:100%; min-width:0; }
.school-scope-tabs { display:flex; gap:8px; flex-wrap:wrap; padding:0 20px 18px; }
.scope-tab { border:1px solid #ded8e9; border-radius:999px; background:#fff; color:#5d536d; padding:8px 13px; font-size:11px; font-weight:800; transition:.2s; }
.scope-tab:hover { border-color:#9e8dbe; transform:translateY(-1px); }
.scope-tab.active { background:#5b3f91; color:#fff; border-color:#5b3f91; box-shadow:0 7px 18px rgba(91,63,145,.22); }
.supermaster-main-stats .stat-card { border-top:3px solid #6848a6; }
.domain-stat-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:14px; margin-bottom:18px; }
.domain-stat-card { min-width:0; display:flex; align-items:flex-start; gap:12px; padding:17px; background:#fff; border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow); cursor:pointer; transition:.2s; }
.domain-stat-card:hover { transform:translateY(-2px); border-color:#b8a7d4; }
.domain-stat-card.selected { border-color:#6848a6; box-shadow:0 12px 28px rgba(91,63,145,.16); background:linear-gradient(145deg,#fff,#f6f1fc); }
.domain-icon { display:grid; place-items:center; flex:0 0 38px; height:38px; border-radius:11px; background:#f2edfa; color:#5b3f91; font-weight:900; font-size:17px; }
.domain-stat-card small { display:block; color:#766b85; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.06em; }
.domain-stat-card strong { display:block; margin:3px 0 2px; font-size:23px; color:#30243e; }
.domain-stat-card p { margin:0; color:#7b7188; font-size:9px; line-height:1.45; }
.director-chart-grid { grid-template-columns:minmax(0,1.25fr) minmax(360px,.85fr); }
.compact-table table { min-width:650px; }
.btn-small { padding:7px 10px; font-size:10px; }
.selected-row { background:#f5f0fb !important; box-shadow:inset 3px 0 #6848a6; }
.muted { color:var(--muted); }
#smDetailBody td:nth-child(3) { min-width:210px; }
#smDetailBody td:nth-child(6), #smAnnualBody td:not(:first-child) { white-space:nowrap; }
body.director-role .panel { border-color:#e5dfec; }
body.director-role .panel-header { background:linear-gradient(180deg,#fff,#fcfafd); }
body.director-role th { background:#f5f1f9; color:#594c68; }
body.director-role tbody tr:hover { background:#faf7fd; }

@media (max-width:1250px) {
  .supermaster-filters { grid-template-columns:repeat(3,minmax(170px,1fr)); }
  .domain-stat-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:900px) {
  .supermaster-filters { grid-template-columns:repeat(2,minmax(0,1fr)); padding:15px; }
  .school-scope-tabs { padding:0 15px 15px; }
  .domain-stat-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .director-chart-grid { grid-template-columns:1fr; }
  .supermaster-main-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:560px) {
  .supermaster-filters { grid-template-columns:1fr; }
  .domain-stat-grid { grid-template-columns:1fr; }
  .scope-tab { flex:1 1 45%; }
  .supermaster-main-stats { grid-template-columns:1fr 1fr; }
  .supermaster-main-stats .stat-card strong { font-size:20px; }
}


/* THIVAL CHAMP V8 — Integration Center */
.integration-hero{border-radius:20px;padding:24px 28px;margin-bottom:18px;display:flex;align-items:center;justify-content:space-between;gap:18px;color:#fff;background:linear-gradient(135deg,#063f31,#07805e);box-shadow:var(--shadow);position:relative;overflow:hidden}.integration-hero:after{content:"";position:absolute;width:240px;height:240px;border-radius:50%;right:-80px;top:-120px;background:rgba(255,255,255,.09)}.integration-hero span{font-size:10px;font-weight:900;letter-spacing:.16em;opacity:.8}.integration-hero h2{margin:5px 0 4px;font-size:25px}.integration-hero p{margin:0;max-width:820px;font-size:12px;line-height:1.6;opacity:.86}.integration-lock{position:relative;z-index:1;min-width:108px;height:76px;border:1px solid rgba(255,255,255,.25);background:rgba(255,255,255,.12);border-radius:16px;display:grid;place-items:center;font-size:28px}.integration-lock small{display:block;font-size:9px;font-weight:900;letter-spacing:.08em;margin-top:-14px}.integration-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px}.integration-summary article{background:#fff;border:1px solid var(--border);border-top:3px solid var(--primary);border-radius:16px;padding:16px 18px;box-shadow:var(--shadow)}.integration-summary span,.integration-summary small{display:block;color:var(--muted);font-size:9px;font-weight:900;letter-spacing:.07em}.integration-summary strong{display:block;margin:4px 0;font-size:25px;color:var(--text)}.integration-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-bottom:18px}.integration-source-card{padding:20px}.integration-source-head{display:flex;gap:12px;align-items:center}.integration-source-head h3{margin:0 0 3px}.integration-source-head p{margin:0;color:var(--muted);font-size:11px}.integration-source-icon{width:44px;height:44px;border-radius:13px;display:grid;place-items:center;background:var(--primary-soft);color:var(--primary);font-weight:950}.integration-source-card ol{margin:18px 0;padding-left:19px;color:var(--muted);font-size:11px;line-height:1.7}.integration-actions{display:flex;gap:8px;flex-wrap:wrap}.integration-actions .btn{flex:1;justify-content:center}.integration-result-panel{margin-bottom:18px}.integration-result{padding:20px}.integration-result-stats{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px}.integration-result-stats span{background:var(--primary-soft);border-radius:12px;padding:12px;text-align:center;font-size:10px;color:var(--muted)}.integration-result-stats b{display:block;font-size:20px;color:var(--primary);margin-bottom:2px}.integration-result details{margin-top:14px;border:1px solid #f3c8c8;background:#fff8f8;border-radius:12px;padding:12px}.integration-result summary{cursor:pointer;font-weight:800;color:#9f3232}.integration-result ul{margin:10px 0 0;padding-left:20px;color:#7d4848;font-size:11px;line-height:1.6}.integration-ok{margin:14px 0 0;color:#15803d;font-weight:800}.file-button.loading{opacity:.65;pointer-events:none}@media(max-width:1100px){.integration-grid{grid-template-columns:1fr}.integration-summary{grid-template-columns:repeat(2,1fr)}.integration-result-stats{grid-template-columns:repeat(3,1fr)}}@media(max-width:600px){.integration-summary{grid-template-columns:1fr 1fr}.integration-result-stats{grid-template-columns:repeat(2,1fr)}.integration-lock{display:none}}
