:root {
  --sidebar-width: 260px;
  --app-primary: #4059d8;
  --app-primary-soft: #eef1ff;
  --app-border: #e7e9f0;
}

body { color: #252a34; }
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width);
  background: #fff; border-right: 1px solid var(--app-border); padding: 22px 18px; z-index: 1030;
}
.brand { display: flex; align-items: center; gap: 12px; color: #242936; }
.brand small { display: block; color: #8b91a1; font-size: 11px; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--app-primary); color: white; font-weight: 800; }
.sidebar .nav-link { display: flex; align-items: center; color: #646b7b; padding: 10px 12px; border-radius: 10px; font-weight: 500; }
.sidebar .nav-link:hover { background: #f6f7fb; color: #2d3340; }
.sidebar .nav-link.active { background: var(--app-primary-soft); color: var(--app-primary); font-weight: 700; }
.nav-section-label { padding: 8px 12px 3px; color: #a0a6b3; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.offcanvas .nav-section-label { padding-left: 0; }
.sidebar-bottom { padding: 14px; background: #f8f9fc; border-radius: 12px; }
.app-main { min-height: 100vh; }
@media (min-width: 992px) { .app-main { margin-left: var(--sidebar-width); } }
.navbar { min-height: 70px; }
.page-content { max-width: 1500px; }
.teacher-avatar, .student-avatar { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--app-primary-soft); color: var(--app-primary); font-weight: 800; flex: 0 0 auto; }
.student-avatar.small { width: 32px; height: 32px; font-size: 12px; }
.metric-card { height: 100%; padding: 20px; background: #fff; border: 1px solid var(--app-border); border-radius: 16px; }
.metric-label { color: #7f8696; font-size: 13px; font-weight: 600; }
.metric-value { font-size: clamp(27px, 4vw, 36px); font-weight: 800; letter-spacing: -1px; margin: 5px 0; }
.metric-meta { color: #9aa0ad; font-size: 12px; }
.app-card, .class-card { border: 1px solid var(--app-border); border-radius: 16px; overflow: hidden; box-shadow: 0 2px 12px rgba(31, 38, 62, .03); }
.app-card .card-header { background: #fff; border-bottom: 1px solid var(--app-border); padding: 16px 20px; }
.class-card { color: inherit; transition: transform .15s ease, box-shadow .15s ease; }
.class-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(31,38,62,.08); }
.grade-pill { width: 42px; height: 42px; border-radius: 13px; display: inline-grid; place-items: center; background: #eef1ff; color: var(--app-primary); font-weight: 800; }
.grade-pill.large { width: 50px; height: 50px; font-size: 17px; }
.attention-item { padding: 13px 0; border-bottom: 1px solid #f0f1f5; }
.attention-item:last-child { border-bottom: 0; }
.score-badge { display: inline-block; min-width: 38px; text-align: center; background: #f3f4f7; padding: 5px 8px; border-radius: 8px; font-weight: 700; }
.score-badge.good { background: #e9f8ef; color: #18794e; }
.score-badge.warn { background: #fff4e5; color: #a85d00; }
.class-hero { background: linear-gradient(135deg, #fff, #f3f5ff); border: 1px solid var(--app-border); border-radius: 18px; }
.table-search { max-width: 250px; }
.table > :not(caption) > * > * { padding: .9rem 1rem; }
.table thead th { background: #fafbfc; color: #767d8b; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.login-page { min-height: 100vh; background: #f0f2f8; }
.login-card { width: min(980px, 100%); border-radius: 24px; }
.login-intro { min-height: 480px; background: linear-gradient(145deg, #3346ba, #576eea); display: flex; flex-direction: column; justify-content: center; }
.demo-hint { background: #f8f9fc; border: 1px solid var(--app-border); }
.btn-primary { --bs-btn-bg: var(--app-primary); --bs-btn-border-color: var(--app-primary); --bs-btn-hover-bg: #3348bd; --bs-btn-hover-border-color: #3348bd; }
@media (max-width: 767.98px) {
  .metric-card { padding: 16px; }
  .table-search { max-width: 180px; }
  .login-intro { min-height: auto; }
}

@media (max-width: 991.98px) {
  .offcanvas .nav-link.active { color: var(--app-primary); background: var(--app-primary-soft); font-weight: 700; }
}

/* v0.2 portals */
.parent-avatar { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 50%; background: #fff2dc; color: #a96100; font-weight: 800; flex: 0 0 auto; }
.portal-hero { padding: 24px; border: 1px solid var(--app-border); border-radius: 20px; background: #fff; }
.student-hero { background: linear-gradient(135deg, #ffffff 10%, #f0f4ff 100%); }
.eyebrow { color: var(--app-primary); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.portal-list-item { padding: 15px 20px; border-bottom: 1px solid #f0f1f5; }
.portal-list-item:last-child { border-bottom: 0; }
.task-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #eef1ff; color: var(--app-primary); font-weight: 800; flex: 0 0 auto; }
.task-icon.large { width: 48px; height: 48px; border-radius: 14px; }
.quote-note { padding: 16px; border-radius: 14px; background: #f8f9fc; color: #505767; line-height: 1.65; border-left: 4px solid var(--app-primary); }
.skill-row + .skill-row { margin-top: 16px; }
.skill-progress { height: 8px; background: #edf0f6; }
.skill-progress.lg { height: 10px; }
.skill-progress .progress-bar { background: var(--app-primary); border-radius: 999px; }
.class-chip { background: #eef1ff; color: var(--app-primary); border-radius: 999px; padding: 8px 13px; font-size: 13px; font-weight: 700; }
.assignment-card-row { border-bottom: 1px solid #f0f1f5; }
.assignment-card-row:last-child { border-bottom: 0; }
.material-card { border: 1px solid var(--app-border); border-radius: 16px; box-shadow: 0 2px 12px rgba(31,38,62,.03); }
.material-type { display: inline-flex; padding: 6px 9px; border-radius: 8px; background: #f1f3f8; color: #6e7584; font-size: 11px; font-weight: 800; }
.child-switcher { min-width: min(300px, 100%); }
.parent-alert { padding: 16px 18px; border-radius: 14px; background: #fff5e7; color: #8a5200; border: 1px solid #ffe1b2; }
.notification-list { overflow: hidden; }
.notification-item { display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px; color: inherit; border-bottom: 1px solid #f0f1f5; }
.notification-item:last-child { border-bottom: 0; }
.notification-item:hover { background: #fafbff; }
.notification-link { color: inherit; text-decoration: none; }
.notification-item.is-read { opacity: .68; }
.notification-dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--app-primary); flex: 0 0 auto; }
.notification-warning .notification-dot { background: #d78300; }
.notification-success .notification-dot { background: #198754; }
.notification-note .notification-dot { background: #7b61c9; }
.report-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.report-header > div:first-child { min-width: 0; }
.report-filter { display: flex; align-items: end; gap: .5rem; width: min(100%, 520px); min-width: 0; }
.report-filter > * { min-width: 0; }
.report-filter .btn { white-space: nowrap; }
.report-skill-value { font-size: clamp(19px, 3vw, 28px); }
.report-chart { height: 210px; display: flex; align-items: end; gap: clamp(10px, 3vw, 24px); padding: 16px 10px 0; border-bottom: 1px solid var(--app-border); }
.report-bar-item { height: 100%; flex: 1; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 6px; }
.report-bar { width: min(52px, 75%); min-height: 8px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, #5b70df, #4059d8); position: relative; }
.report-bar span { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); color: #4059d8; font-size: 11px; font-weight: 800; }
.report-bar-label { color: #8b91a1; font-size: 11px; }
@media (max-width: 767.98px) {
  .report-header { align-items: stretch; flex-direction: column; }
  .report-filter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; }
  .report-filter .form-select { grid-column: 1 / -1; }
  .report-filter .form-control { grid-column: 1 / -1; }
  .report-filter .btn-primary { grid-column: 1 / -1; }
  .report-filter .btn-outline-secondary { width: 100%; }
  .report-chart { gap: 7px; }
  .portal-hero { padding: 18px; }
  .portal-list-item { padding: 14px 16px; }
  .assignment-card-row .btn { width: 100%; }
}

/* v0.3.0 - class sessions / attendance */
.session-hero {
  background: linear-gradient(135deg, #fff 0%, #f4f7ff 100%);
  border: 1px solid var(--app-border);
  border-radius: 20px;
}
.session-date-block {
  width: 76px;
  min-width: 76px;
  min-height: 88px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--app-primary);
  color: #fff;
  line-height: 1.05;
}
.session-date-block .display-6 { line-height: 1; }
.session-topic-preview { max-width: 340px; }
.session-text { white-space: pre-line; line-height: 1.65; }
.session-mini-date { min-width: 105px; }
.attendance-table select { min-width: 160px; }
.attendance-table tbody tr:has(.attendance-status[value="ABSENT"]) { background: #fff8f8; }
.empty-state-icon { font-size: 42px; }
@media (max-width: 767.98px) {
  .session-date-block { width: 66px; min-width: 66px; min-height: 76px; }
  .session-topic-preview { max-width: 220px; }
}

/* v0.4.0 - lessons, assignments, grading and version */
.app-footer { min-height: 34px; }
.lesson-card { transition: transform .15s ease, box-shadow .15s ease; }
.lesson-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(31, 38, 62, .08); }
.lesson-unit { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border-radius: 999px; background: var(--app-primary-soft); color: var(--app-primary); font-size: 12px; font-weight: 800; }
.lesson-summary { min-height: 42px; }
.lesson-content, .assignment-instructions, .submission-box, .teacher-feedback { white-space: pre-wrap; line-height: 1.65; }
.material-type { display: inline-grid; place-items: center; min-width: 46px; height: 32px; padding: 0 9px; border-radius: 9px; background: #f1f3f8; color: #626a7a; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.assignment-progress { width: 120px; height: 6px; }
.assignment-student:last-child { border-bottom: 0 !important; }
.submission-box { background: #f8f9fc; border: 1px solid var(--app-border); border-radius: 12px; padding: 12px 14px; max-width: 760px; }
.teacher-feedback { background: #eef8f1; border: 1px solid #cfe9d8; border-radius: 12px; padding: 14px; color: #245b38; }
.grade-form { width: min(320px, 100%); flex: 0 0 auto; }
@media (max-width: 991.98px) { .grade-form { width: 100%; } .assignment-progress { width: 100px; } }

/* v0.5.0 - question bank and online exams */
.exam-hero, .result-hero {
  border: 1px solid var(--app-border);
  border-radius: 20px;
  background: linear-gradient(135deg, #fff 0%, #f2f5ff 100%);
}
.question-pick-row { cursor: pointer; transition: background .15s ease; }
.question-pick-row:hover { background: #f8f9fc; }
.exam-question-picker { max-height: 650px; overflow-y: auto; }
.exam-question-preview + .exam-question-preview { border-top: 1px solid var(--app-border); }
.exam-timer {
  min-width: 88px; padding: 7px 12px; border-radius: 10px; text-align: center;
  background: #202737; color: #fff; font-weight: 800; font-variant-numeric: tabular-nums;
}
.exam-option {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--app-border); border-radius: 12px; cursor: pointer;
}
.exam-option:hover { background: #f8f9fc; border-color: #cfd5e5; }
.exam-option:has(input:checked) { background: var(--app-primary-soft); border-color: #b7c0f5; }
.exam-question-card { scroll-margin-top: 165px; }
@media (max-width: 767.98px) {
  .exam-taking-bar { top: 72px !important; }
  .exam-question-card .card-body { padding: 18px !important; }
}

/* v0.6.0 - bulk question import and manual essay grading */
textarea.exam-answer-input { min-height: 150px; resize: vertical; }

@media print {
  .sidebar, .navbar, .offcanvas, .report-filter, .app-footer { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .page-content { max-width: none; padding: 0 !important; }
  .app-card, .metric-card { box-shadow: none; break-inside: avoid; }
  .report-chart { break-inside: avoid; }
}

/* v0.14.1 - account security */
.account-security-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-weight: 900;
  letter-spacing: .08em;
}
.password-form { max-width: 620px; }

/* v0.15.0 - Teacher Report Center */
.teacher-report-filter {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.teacher-report-table td { white-space: nowrap; }
.teacher-attention-row + .teacher-attention-row { border-top: 1px solid #f0f1f5; }
.teacher-attention-row:hover { background: #fafbff; }
@media (max-width: 767.98px) {
  .teacher-report-filter { grid-template-columns: 1fr; }
  .teacher-report-filter > * { min-width: 0; }
  .teacher-report-filter .d-flex { width: 100%; }
  .teacher-report-filter .btn { flex: 1 1 auto; white-space: nowrap; }
}
@media print {
  .no-print { display: none !important; }
  .teacher-report-header { margin-bottom: 12px !important; }
}

/* v0.23.1 - compact navigation + top-right account menu */
.sidebar > .nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
}
.account-menu-toggle {
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #252a34;
}
.account-menu-toggle:hover,
.account-menu-toggle:focus,
.account-menu-toggle.show {
  background: #f7f8fc;
  border-color: var(--app-border);
  color: #252a34;
  box-shadow: none;
}
.account-menu-summary {
  max-width: 190px;
  line-height: 1.15;
}
.account-menu-name,
.account-menu-role {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu-name { font-size: 13px; font-weight: 700; }
.account-menu-role { margin-top: 3px; color: #8b91a1; font-size: 10px; letter-spacing: .04em; }
.account-menu-caret { color: #8b91a1; font-size: 16px; line-height: 1; transform: translateY(-1px); }
.account-dropdown {
  width: min(280px, calc(100vw - 24px));
  padding: 7px;
  border-color: var(--app-border);
  border-radius: 14px;
}
.account-dropdown .dropdown-item {
  border-radius: 9px;
  padding: 9px 11px;
}
.account-dropdown .dropdown-item.active {
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-weight: 700;
}
.account-dropdown .dropdown-divider { margin: 5px 4px; }
@media (max-width: 575.98px) {
  .navbar { min-height: 64px; }
  .account-menu-toggle { padding: 3px; }
  .account-menu-caret { display: none; }
}
