/* ============================================================
   WILLOW'S SCHOOL — CSS
   ============================================================ */

:root {
  --sky: #7EC8E3;
  --sky-light: #EAF7FC;
  --green: #5BAD6F;
  --green-dark: #3D8A50;
  --sun: #FFD166;
  --coral: #F76C6C;
  --purple: #9B72CF;
  --orange: #FF9A3C;
  --teal: #06D6A0;
  --pink: #FF6B9D;
  --white: #FFFFFF;
  --off-white: #F9F6F0;
  --text-dark: #2C2C3E;
  --text-mid: #555570;
  --text-light: #8888A0;
  --border: #E5E2DA;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  /* Teacher palette */
  --t-bg: #1A1A2E;
  --t-surface: #16213E;
  --t-card: #0F3460;
  --t-accent: #E94560;
  --t-accent2: #533483;
  --t-text: #EAEAEA;
  --t-text-mid: #A0A0B8;
  --t-border: rgba(255,255,255,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--off-white);
  color: var(--text-dark);
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   SCREENS
   ============================================================ */
.screen { display: none; width: 100vw; height: 100vh; position: absolute; top: 0; left: 0; }
.screen.active { display: flex; }

/* ============================================================
   LOGIN
   ============================================================ */
#screen-login {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #87CEEB 0%, #B5E7F5 40%, #C8F0C0 100%);
  overflow: hidden;
}

.login-bg {
  position: absolute; inset: 0; pointer-events: none;
}

.login-container {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.login-card {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-radius: 28px;
  padding: 48px 40px;
  width: 380px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.8);
  animation: cardFloat 0.6s ease-out;
}

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

.login-sun {
  font-size: 48px;
  margin-bottom: 8px;
  animation: spin 20s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-title {
  font-family: 'Fredoka One', cursive;
  font-size: 32px;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 16px;
  color: var(--text-mid);
  margin-bottom: 28px;
}

.login-roles {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 28px;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
}

.role-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }

.student-btn:hover { border-color: var(--pink); background: #FFF0F6; }
.teacher-btn:hover { border-color: var(--sky); background: #EAF7FC; }

.role-icon { font-size: 32px; }
.role-label { font-size: 16px; font-weight: 700; color: var(--text-dark); }

.pin-entry { margin-top: 20px; }
.pin-prompt { font-size: 15px; color: var(--text-mid); margin-bottom: 16px; font-weight: 600; }

.pin-dots {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all 0.15s;
}
.dot.filled { background: var(--text-dark); border-color: var(--text-dark); }

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 240px;
  margin: 0 auto;
}

.pin-key {
  padding: 14px;
  font-size: 20px;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s;
}
.pin-key:hover { background: var(--off-white); transform: scale(0.96); }
.pin-key:active { transform: scale(0.92); }

.pin-error {
  color: var(--coral);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
  font-weight: 600;
}

/* ============================================================
   STUDENT VIEW
   ============================================================ */
#screen-student {
  flex-direction: column;
  background: linear-gradient(135deg, #FFF8F0 0%, #F0F8FF 50%, #F8F0FF 100%);
  overflow-y: auto;
}

.student-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: 
    radial-gradient(circle at 10% 20%, rgba(255,209,102,0.2) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(155,114,207,0.15) 0%, transparent 40%);
}

.student-header {
  position: sticky; top: 0; z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.student-greeting {
  display: flex;
  align-items: center;
  gap: 12px;
}

.greeting-wave {
  font-size: 32px;
  animation: wave 2s ease-in-out infinite;
}
@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(15deg); }
  75% { transform: rotate(-10deg); }
}

.student-greeting h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  color: var(--text-dark);
}

.student-date {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 600;
}

.student-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #FF9A3C, #FF6B9D);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 16px;
}

.logout-btn {
  background: none;
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}
.logout-btn:hover { background: var(--off-white); }

.student-content {
  position: relative;
  z-index: 1;
  padding: 24px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.progress-bar-wrap {
  margin-bottom: 24px;
}

.progress-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-mid);
  margin-bottom: 8px;
}

.progress-track {
  height: 14px;
  background: rgba(0,0,0,0.08);
  border-radius: 7px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--teal));
  border-radius: 7px;
  transition: width 0.5s ease;
  width: 0%;
}

.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.lesson-card {
  background: white;
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.25s;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.lesson-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: var(--subject-color, var(--sky));
}

.lesson-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.lesson-card.completed { opacity: 0.6; }
.lesson-card.completed::after {
  content: '✅';
  position: absolute;
  top: 12px; right: 12px;
  font-size: 20px;
}

.lesson-card-icon { font-size: 36px; margin-bottom: 10px; }
.lesson-card-subject { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-light); }
.lesson-card-title { font-family: 'Fredoka One', cursive; font-size: 18px; color: var(--text-dark); margin-top: 4px; }

.empty-day {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px;
  color: var(--text-light);
}
.empty-day span { font-size: 48px; display: block; margin-bottom: 12px; }

/* Lesson Modal (Student) */
.lesson-modal-card {
  background: white;
  border-radius: 24px;
  width: 90%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.3s ease-out;
}

.lesson-modal-header {
  padding: 28px 28px 16px;
  border-bottom: 1px solid var(--border);
}

.lesson-modal-body {
  padding: 20px 28px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-mid);
}

.lesson-modal-body a {
  color: var(--sky);
  font-weight: 700;
  text-decoration: none;
}

.complete-btn {
  margin: 0 28px 28px;
  width: calc(100% - 56px);
  padding: 16px;
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: white;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.complete-btn:hover { transform: scale(1.02); box-shadow: 0 6px 20px rgba(91,173,111,0.4); }
.complete-btn.done { background: linear-gradient(135deg, #aaa, #888); cursor: default; }

/* ============================================================
   TEACHER LAYOUT
   ============================================================ */
#screen-teacher {
  flex-direction: row;
  overflow: hidden;
}

#screen-admin {
  flex-direction: row;
  overflow: hidden;
}

#screen-admin .teacher-main {
  display: block;
}

#screen-admin .admin-tab-pane {
  display: none;
  padding: 32px;
  min-height: 100%;
}

#screen-admin .admin-tab-pane.active {
  display: block;
}

.sidebar {
  width: 220px;
  height: 100vh;
  flex-shrink: 0;
  background: var(--t-bg);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 16px 16px;
  border-bottom: 1px solid var(--t-border);
  margin-bottom: 4px;
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  color: var(--t-text);
  font-weight: 700;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--t-text-mid);
  font-size: 13px;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  flex-shrink: 0;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--t-text); }
.nav-item.active { background: var(--t-accent2); color: white; }
.nav-item span:first-child { font-size: 15px; }

.sidebar-logout {
  flex-shrink: 0;
  margin: 8px 12px 16px;
  background: transparent;
  border: 1px solid var(--t-border);
  border-radius: 10px;
  color: var(--t-text-mid);
  padding: 10px;
  font-size: 13px;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.sidebar-logout:hover { background: rgba(255,255,255,0.06); color: var(--t-text); }

.teacher-main {
  flex: 1;
  overflow-y: auto;
  background: #F4F4F8;
}

.module { display: none; padding: 32px; min-height: 100%; }
.module.active { display: block; }

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.module-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--text-dark);
}

.module-sub {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

.module-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 900px) { .dash-grid { grid-template-columns: repeat(2, 1fr); } }

.dash-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

.dash-card-icon { font-size: 32px; }
.dash-card-label { font-size: 12px; color: var(--text-light); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.dash-card-value { font-family: 'Playfair Display', serif; font-size: 28px; color: var(--text-dark); line-height: 1.1; }
.dash-card-of { font-size: 14px; color: var(--text-light); font-family: 'Nunito', sans-serif; }

.dash-mini-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.dash-mini-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--teal));
  border-radius: 2px;
  width: 0%;
  transition: width 0.6s ease;
}

.dash-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dash-section {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.dash-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.dash-today-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.dash-today-item:last-child { border-bottom: none; }

.dash-grade-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.dash-grade-item:last-child { border-bottom: none; }

/* ============================================================
   LESSON PLANNER
   ============================================================ */
.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.week-nav button {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px; height: 32px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.week-nav button:hover { background: var(--off-white); }
.week-nav span { font-size: 14px; font-weight: 700; color: var(--text-dark); }

.planner-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.planner-day-col {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 400px;
}

.planner-day-header {
  background: var(--t-bg);
  color: white;
  text-align: center;
  padding: 10px;
  font-weight: 700;
  font-size: 13px;
}
.planner-day-header.today { background: var(--t-accent2); }

.planner-day-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.planner-lesson-chip {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  border-left: 3px solid transparent;
}
.planner-lesson-chip:hover { transform: translateX(2px); filter: brightness(0.95); }
.planner-lesson-chip .chip-subject { font-size: 10px; opacity: 0.8; text-transform: uppercase; }
.planner-lesson-chip .chip-actions {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  gap: 4px;
}
.planner-lesson-chip:hover .chip-actions { display: flex; }
.chip-btn {
  background: rgba(255,255,255,0.6);
  border: none;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 10px;
  cursor: pointer;
}

.add-lesson-btn {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Nunito', sans-serif;
  margin: 4px 0;
}
.add-lesson-btn:hover { background: var(--off-white); color: var(--text-mid); }

/* ============================================================
   LIBRARY
   ============================================================ */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.library-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.library-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.lib-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.lib-type-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}
.lib-card-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.lib-card-sub { font-size: 12px; color: var(--text-light); }

.lib-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* ============================================================
   ATTENDANCE
   ============================================================ */
.attendance-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: white;
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
  box-shadow: var(--shadow);
}

.att-tab {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}
.att-tab.active { background: var(--t-bg); color: white; }

.att-pane { display: none; }
.att-pane.active { display: block; }

.cal-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.cal-nav button {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px; height: 32px;
  font-size: 18px;
  cursor: pointer;
}
.cal-nav span { font-size: 16px; font-weight: 700; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  max-width: 560px;
}

.cal-header-cell {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 6px 0;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: default;
}
.cal-cell.present { background: #DCFCE7; color: var(--green-dark); }
.cal-cell.absent { background: #FEE2E2; color: #B91C1C; }
.cal-cell.half { background: #FEF9C3; color: #92400E; }
.cal-cell.excused { background: #EDE9FE; color: var(--purple); }
.cal-cell.external { background: #DBEAFE; color: #1D4ED8; }
.cal-cell.today { ring: 2px solid var(--text-dark); outline: 2px solid var(--text-dark); }

.att-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.att-table th {
  background: var(--t-bg);
  color: white;
  font-size: 12px;
  padding: 12px 16px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.att-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.att-table tr:last-child td { border-bottom: none; }
.att-table tr:hover td { background: var(--off-white); }

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.status-present { background: #DCFCE7; color: var(--green-dark); }
.status-absent { background: #FEE2E2; color: #B91C1C; }
.status-half { background: #FEF9C3; color: #92400E; }
.status-excused { background: #EDE9FE; color: var(--purple); }

.external-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-mid);
}

/* ============================================================
   GRADE BOOK
   ============================================================ */
.grade-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.grade-summary-card {
  background: white;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.grade-summary-card .grade-subj { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-light); }
.grade-summary-card .grade-avg { font-family: 'Playfair Display', serif; font-size: 28px; color: var(--text-dark); }
.grade-summary-card .grade-letter { font-size: 14px; font-weight: 700; }

.grade-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.grade-table th {
  background: var(--t-bg);
  color: white;
  font-size: 12px;
  padding: 12px 16px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.grade-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.grade-table tr:last-child td { border-bottom: none; }
.grade-table tr:hover td { background: var(--off-white); }

.grade-letter-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
}
.grade-A { background: #DCFCE7; color: #166534; }
.grade-B { background: #DBEAFE; color: #1E40AF; }
.grade-C { background: #FEF9C3; color: #92400E; }
.grade-D { background: #FEE2E2; color: #991B1B; }
.grade-F { background: #F3F4F6; color: #6B7280; }

/* ============================================================
   COMPLIANCE
   ============================================================ */
.compliance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 20px;
}

@media (max-width: 1100px) { .compliance-grid { grid-template-columns: 1fr 1fr; } }

.compliance-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.comp-circle-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 12px;
}

.comp-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #E5E7EB; stroke-width: 10; }
.ring-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1s ease;
}

.comp-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.comp-ring-label span { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 700; }
.comp-ring-label small { font-size: 10px; color: var(--text-light); }

.comp-card-title { font-weight: 700; font-size: 15px; }
.comp-status { font-size: 13px; margin-top: 6px; font-weight: 600; }
.comp-on-track { color: var(--green-dark); }
.comp-behind { color: var(--coral); }
.comp-ahead { color: var(--purple); }

.comp-pace-card, .comp-subject-card { text-align: left; }
.comp-pace-card h3, .comp-subject-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.pace-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.pace-row:last-child { border-bottom: none; }

.subj-hour-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.subj-hour-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.subj-hour-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--sky), var(--purple));
}
.subj-hour-label { font-size: 12px; font-weight: 600; min-width: 80px; }
.subj-hour-val { font-size: 12px; color: var(--text-light); min-width: 40px; text-align: right; }

/* ============================================================
   MODALS (SHARED)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 20px;
}

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

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--off-white);
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--border); }

.builder-modal {
  background: white;
  border-radius: 24px;
  width: 90%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease-out;
  position: relative;
}

.entry-modal {
  background: white;
  border-radius: 24px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease-out;
  position: relative;
}

.builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}
.builder-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
}

.builder-body, .entry-body {
  padding: 24px 28px;
}

.builder-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  color: var(--text-dark);
  background: white;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--sky); }

.hours-by-subject { margin: 16px 0; }
.hours-by-subject label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  display: block;
  margin-bottom: 8px;
}

.subject-hour-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.subject-hour-input:last-child { border-bottom: none; }
.subject-hour-input label { font-size: 13px; font-weight: 600; min-width: 130px; margin: 0; text-transform: none; letter-spacing: 0; }
.subject-hour-input input { width: 80px; padding: 6px 10px; }

/* AI Section */
.ai-section {
  background: linear-gradient(135deg, #EEF2FF 0%, #F5F3FF 100%);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #DDD6FE;
}

.ai-section-header { margin-bottom: 14px; }
.ai-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--purple), #6366F1);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}
.ai-section-header p { font-size: 13px; color: var(--text-mid); }

.ai-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.ai-btn {
  padding: 8px 16px;
  border: 1px solid #DDD6FE;
  border-radius: 8px;
  background: white;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--purple);
}
.ai-btn:hover { background: #EDE9FE; }
.ai-btn-all { background: linear-gradient(135deg, var(--purple), #6366F1); color: white; border: none; }
.ai-btn-all:hover { opacity: 0.9; }

.ai-output-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: white;
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
}

.ao-tab {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.15s;
}
.ao-tab.active { background: var(--purple); color: white; }

.ai-content-area {
  background: white;
  border-radius: 10px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  min-height: 100px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #DDD6FE;
}

.ai-tab-content { display: none; }
.ai-tab-content.active { display: block; }

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  gap: 12px;
  color: var(--text-mid);
}

.ai-spinner {
  width: 32px; height: 32px;
  border: 3px solid #EDE9FE;
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spinLoader 0.7s linear infinite;
}
@keyframes spinLoader { to { transform: rotate(360deg); } }

.builder-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--t-bg);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background: white;
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--off-white); }

.btn-publish {
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-publish:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-sm:hover { background: var(--off-white); }

.btn-danger {
  background: #FEE2E2;
  color: #B91C1C;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.filter-select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  background: white;
  cursor: pointer;
  outline: none;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--t-bg);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  z-index: 9998;
  transition: transform 0.3s ease;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  color: var(--text-light);
}
.empty-state span { font-size: 48px; display: block; margin-bottom: 12px; }

/* ============================================================
   SUBJECT COLORS
   ============================================================ */
.subj-Math { --subject-color: #4F86F7; background: #EFF6FF; color: #1D4ED8; }
.subj-Reading { --subject-color: #F43F5E; background: #FFF1F2; color: #9F1239; }
.subj-Science { --subject-color: #10B981; background: #ECFDF5; color: #065F46; }
.subj-Social,
.subj-SocialStudies { --subject-color: #F59E0B; background: #FFFBEB; color: #92400E; }
.subj-Art { --subject-color: #EC4899; background: #FDF2F8; color: #9D174D; }
.subj-Music { --subject-color: #8B5CF6; background: #F5F3FF; color: #5B21B6; }
.subj-PE { --subject-color: #EF4444; background: #FEF2F2; color: #991B1B; }
.subj-Bible { --subject-color: #D97706; background: #FFFBEB; color: #78350F; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

/* ============================================================
   ALL-DONE BANNER
   ============================================================ */
.all-done-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: linear-gradient(135deg, #DCFCE7, #D1FAE5);
  border: 2px solid #6EE7B7;
  border-radius: 20px;
  padding: 18px 24px;
  margin-bottom: 20px;
  animation: bannerPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bannerPop {
  from { opacity: 0; transform: scale(0.92) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.all-done-banner strong {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: #065F46;
  display: block;
}
.all-done-banner p {
  font-size: 14px;
  color: #047857;
  margin-top: 2px;
}
.all-done-emoji { font-size: 36px; }

/* ============================================================
   SUBJECT STREAKS
   ============================================================ */
.subject-streaks {
  margin-bottom: 20px;
}

.streaks-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.streaks-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.streak-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 2px solid var(--chip-color, #888);
  border-radius: 20px;
  padding: 6px 14px 6px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform 0.15s;
}
.streak-chip:hover { transform: translateY(-2px); }

.streak-chip-icon { font-size: 18px; }
.streak-chip-count {
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  color: var(--chip-color, #888);
  line-height: 1;
}
.streak-chip-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   LESSON CARD ENHANCEMENTS
   ============================================================ */
.lesson-done-check {
  margin-top: 10px;
  font-size: 20px;
}

.lesson-tap-hint {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  opacity: 0.7;
}

/* Completed card cursor */
.lesson-card.completed {
  cursor: default;
}
.lesson-card:not(.completed) {
  cursor: pointer;
}

/* ============================================================
   PLANNER EMPTY STATE
   ============================================================ */
.planner-empty-week {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.planner-empty-week span { font-size: 48px; display: block; margin-bottom: 12px; }
.planner-empty-week h3 { font-size: 18px; color: var(--text-dark); margin-bottom: 8px; }
.planner-empty-week p { font-size: 14px; color: var(--text-light); margin-bottom: 20px; }

/* ============================================================
   AI SUGGESTIONS PANEL
   ============================================================ */

.suggestions-panel {
  background: linear-gradient(135deg, #F5F3FF 0%, #EEF2FF 100%);
  border: 1px solid #DDD6FE;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  animation: slideDown 0.25s ease-out;
}

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

.suggestions-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.suggestions-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--text-dark);
  margin-bottom: 3px;
}

.suggestions-header p {
  font-size: 13px;
  color: var(--text-mid);
}

.suggestions-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  color: var(--text-mid);
  font-size: 14px;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.suggestion-card {
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
}

.suggestion-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.suggestion-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.suggestion-icon { font-size: 22px; }

.suggestion-subject {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.suggestion-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
  line-height: 1.3;
}

.suggestion-desc {
  font-size: 12px;
  color: var(--text-mid);
  line-height: 1.55;
  margin-bottom: 10px;
}

.suggestion-bible {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 6px;
  font-size: 11px;
  color: #78350F;
  line-height: 1.4;
}

.suggestion-standard {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 10px;
  color: var(--text-light);
  margin-bottom: 12px;
  line-height: 1.4;
}

.suggestion-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.suggestion-day-select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  background: white;
  cursor: pointer;
}

.suggestion-add-btn {
  flex-shrink: 0;
  font-size: 12px !important;
  padding: 7px 14px !important;
  border-radius: 8px !important;
  white-space: nowrap;
}

/* ============================================================
   YEAR AT A GLANCE
   ============================================================ */

.year-glance-section {
  margin-top: 32px;
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.year-glance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.year-glance-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--text-dark);
}

.year-glance-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  flex-wrap: wrap;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 3px;
  vertical-align: middle;
}
.legend-dot.present  { background: #6EE7B7; }
.legend-dot.absent   { background: #FCA5A5; }
.legend-dot.half     { background: #FDE68A; }
.legend-dot.excused  { background: #C4B5FD; }
.legend-dot.external { background: #93C5FD; }

.year-glance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.yag-month {
  min-width: 140px;
  max-width: 180px;
  flex: 0 0 calc(14.28% - 14px);
}

.yag-month-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.yag-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.yag-dow {
  text-align: center;
  font-size: 8px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  padding: 2px 0;
}

.yag-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #555;
  background: #F3F4F6;
  cursor: default;
  transition: transform 0.1s;
}
.yag-cell:hover { transform: scale(1.3); z-index: 1; }

.yag-empty  { background: transparent; }
.yag-weekend { background: #F9FAFB; color: #D1D5DB; }
.yag-no-record { background: #F3F4F6; color: #9CA3AF; }

.yag-present  { background: #6EE7B7; color: #065F46; }
.yag-absent   { background: #FCA5A5; color: #7F1D1D; }
.yag-half     { background: #FDE68A; color: #78350F; }
.yag-excused  { background: #C4B5FD; color: #4C1D95; }
.yag-external { background: #93C5FD; color: #1E3A5F; }

.yag-today {
  outline: 2px solid var(--text-dark);
  outline-offset: 1px;
  font-weight: 900;
}

/* ============================================================
   PRINT PREVIEW MODAL
   ============================================================ */

.print-modal-card {
  background: white;
  border-radius: 20px;
  width: 96%;
  max-width: 900px;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.3s ease-out;
  position: relative;
}

.print-preview-body {
  overflow-y: auto;
  padding: 24px 28px 28px;
  flex: 1;
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1.5;
  color: #222;
}

@media print {
  #print-modal .builder-header { display: none; }
}

/* ============================================================
   STUDENT LOADING STATE
   ============================================================ */

.student-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: var(--text-light);
  font-size: 15px;
  font-weight: 600;
}

.student-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0,0,0,0.08);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spinLoader 0.7s linear infinite;
}

/* ============================================================
   GRADEBOOK TABS
   ============================================================ */

.gradebook-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: white;
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
  box-shadow: var(--shadow);
}

.gb-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 22px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.gb-tab.active { background: var(--t-bg); color: white; }
.gb-tab:hover:not(.active) { background: var(--off-white); }

.gb-pane { display: none; }
.gb-pane.active { display: block; }

.submissions-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--coral);
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--coral);
  color: white;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: auto;
}

.submissions-explainer {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 16px;
}

.empty-table-msg {
  text-align: center;
  color: var(--text-light);
  padding: 40px 20px;
  font-size: 14px;
}

/* ============================================================
   DASHBOARD TO-GRADE ALERT
   ============================================================ */

.dash-to-grade {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #FEF9C3, #FEF3C7);
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: 14px;
}
.dash-to-grade span:first-child { font-size: 24px; }
.dash-to-grade strong { display: block; font-size: 15px; color: #78350F; }
.dash-to-grade p { color: #92400E; font-size: 13px; }

/* ============================================================
   INTERACTIVE WORKSHEET
   ============================================================ */

.iws-wrap {
  margin-top: 16px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #E5E2DA;
}

.iws-header {
  background: linear-gradient(135deg, #1A1A2E, #16213E);
  color: white;
  padding: 16px 20px;
  text-align: center;
}

.iws-title {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  margin-bottom: 4px;
}

.iws-verse {
  font-size: 12px;
  opacity: 0.8;
  font-style: italic;
  margin-bottom: 4px;
}

.iws-points-total {
  font-size: 11px;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.iws-questions {
  background: var(--off-white);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.iws-question {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.iws-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.iws-q-num {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}

.iws-q-pts {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  background: #F5F3FF;
  padding: 2px 8px;
  border-radius: 8px;
}

.iws-q-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
  margin-bottom: 12px;
}

/* Multiple Choice */
.iws-mc-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.iws-mc-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: white;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  color: var(--text-dark);
}
.iws-mc-btn:hover { border-color: var(--sky); background: #EAF7FC; }
.iws-mc-btn.selected {
  border-color: var(--green);
  background: #DCFCE7;
  color: var(--green-dark);
}

.iws-mc-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--off-white);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.iws-mc-btn.selected .iws-mc-letter {
  background: var(--green);
  color: white;
}

/* Text input */
.iws-text-wrap { width: 100%; }
.iws-text-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s;
}
.iws-text-input:focus { border-color: var(--sky); }

/* Matching */
.iws-match-wrap {}

.iws-match-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.iws-match-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--off-white);
  border-radius: 10px;
  border: 2px dashed var(--border);
  font-size: 14px;
}

.iws-match-slot-label {
  font-weight: 700;
  color: var(--text-dark);
  min-width: 100px;
}

.iws-match-slot-answer {
  color: var(--text-light);
  font-style: italic;
}
.iws-match-slot-answer.filled {
  color: var(--green-dark);
  font-style: normal;
  font-weight: 700;
  background: #DCFCE7;
  padding: 2px 10px;
  border-radius: 6px;
}

.iws-match-left-item {
  padding: 8px 14px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.iws-match-left-item.match-active {
  border-color: var(--orange);
  background: #FFF7ED;
  color: #92400E;
}

.iws-match-right-item {
  padding: 8px 14px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.iws-match-right-item:hover { border-color: var(--sky); background: #EAF7FC; }
.iws-match-right-item.match-used {
  opacity: 0.4;
  cursor: default;
}

/* Drawing */
.iws-draw-wrap {}

.iws-canvas {
  width: 100%;
  max-width: 460px;
  height: 200px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: white;
  cursor: crosshair;
  display: block;
  touch-action: none;
}

.iws-draw-tools {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.iws-tool-btn {
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.iws-tool-btn:hover { background: var(--off-white); }
.iws-tool-btn.active { background: var(--t-bg); color: white; border-color: var(--t-bg); }

.iws-color-pick {
  width: 36px;
  height: 34px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: white;
}

/* ============================================================
   SUBMISSION RESULT MODAL (STUDENT)
   ============================================================ */

.sub-result-card {
  background: white;
  border-radius: 28px;
  width: 90%;
  max-width: 420px;
  padding: 40px 32px 20px;
  text-align: center;
  animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.sub-result-emoji { font-size: 64px; margin-bottom: 12px; }

.sub-result-title {
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.sub-result-score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 4px;
}

.sub-result-num {
  font-family: 'Playfair Display', serif;
  font-size: 52px;
  color: var(--green-dark);
  line-height: 1;
}

.sub-result-denom {
  font-size: 22px;
  color: var(--text-light);
}

.sub-result-pct {
  font-size: 16px;
  color: var(--text-mid);
  margin-bottom: 16px;
}

.sub-result-review {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FEF9C3;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #78350F;
  text-align: left;
}

.sub-result-submitted {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-dark);
  background: #DCFCE7;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 20px;
}

/* ============================================================
   GRADING MODAL (TEACHER)
   ============================================================ */

.grading-modal-card {
  background: white;
  border-radius: 24px;
  width: 95%;
  max-width: 860px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.3s ease-out;
  position: relative;
}

.grading-modal-body {
  overflow-y: auto;
  padding: 24px 28px;
  flex: 1;
}

.grading-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
  font-size: 14px;
}
.grading-meta strong { font-size: 17px; }
.grading-meta span { color: var(--text-light); }

.grading-auto-score {
  background: #DBEAFE;
  color: #1E40AF;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.grading-qa-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.grading-qa-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--off-white);
}

.grading-q-num {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grading-q-type {
  background: #E5E7EB;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 9px;
  text-transform: uppercase;
}

.grading-q-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.grading-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grading-col-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.grading-col-answer { background: #FFF8F0; border-radius: 8px; padding: 10px; }
.grading-col-key    { background: #F0FFF4; border-radius: 8px; padding: 10px; }

.grading-text-answer {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.grading-no-answer {
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
}

.grading-key-answer {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
}

.grading-match-row {
  font-size: 13px;
  margin-bottom: 3px;
  color: var(--text-mid);
}

.grading-drawing {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.grading-auto {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
}
.grading-auto.correct   { background: #DCFCE7; color: var(--green-dark); }
.grading-auto.incorrect { background: #FEE2E2; color: #991B1B; }

.grading-answer-key-full {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.grading-answer-key-full summary {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  background: var(--off-white);
}
.grading-answer-key-full pre {
  padding: 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.6;
  background: white;
}

.grading-plain-content {
  background: var(--off-white);
  border-radius: 10px;
  padding: 16px;
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.7;
  margin-bottom: 20px;
}

.grading-entry {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.grading-entry h3 {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  margin-bottom: 14px;
}

.grading-entry-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ============================================================
   MATCH QUESTION LAYOUT (missing from previous pass)
   ============================================================ */

.iws-match-cols {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: start;
  margin-bottom: 12px;
}

.iws-match-left,
.iws-match-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.iws-match-lines {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 20px;
  padding-top: 8px;
}

/* Lesson modal wider for interactive worksheets */
.lesson-modal-card {
  max-width: 680px !important;
}

.iws-match-instruction {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

/* ============================================================
   TROPHY BUTTON
   ============================================================ */

.trophy-btn {
  background: linear-gradient(135deg, #FFD166, #FF9A3C);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 10px rgba(255,154,60,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.trophy-btn:hover { transform: scale(1.1) rotate(-5deg); }
.trophy-btn:active { transform: scale(0.95); }

/* ============================================================
   MY WORK PANEL
   ============================================================ */

.mywork-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.mywork-panel {
  background: white;
  border-radius: 28px 28px 0 0;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
  overflow: hidden;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.mywork-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mywork-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mywork-title-emoji { font-size: 28px; }

.mywork-title {
  font-family: 'Fredoka One', cursive;
  font-size: 24px;
  color: var(--text-dark);
}

.mywork-close {
  background: var(--off-white);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.mywork-close:hover { background: var(--border); }

/* Stats row */
.mywork-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 16px 24px;
  background: linear-gradient(135deg, #1A1A2E, #16213E);
  flex-shrink: 0;
}

.mw-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.mw-stat-num {
  font-family: 'Fredoka One', cursive;
  font-size: 28px;
  color: #FFD166;
  line-height: 1;
}

.mw-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.6);
}

.mw-stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  margin: 0 8px;
}

/* Tabs */
.mywork-tabs {
  display: flex;
  gap: 0;
  padding: 12px 16px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mw-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.mw-tab:hover { color: var(--text-dark); }
.mw-tab.active {
  color: var(--text-dark);
  border-bottom-color: var(--green);
}

/* Panes */
.mw-pane {
  display: none;
  overflow-y: auto;
  flex: 1;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.mw-pane.active { display: block; }

.mw-loading {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.mw-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}
.mw-empty span { font-size: 48px; display: block; margin-bottom: 12px; }
.mw-empty p { font-size: 15px; line-height: 1.6; font-weight: 600; }

/* ============================================================
   DAYS TAB
   ============================================================ */

.mw-days-hero {
  text-align: center;
  background: linear-gradient(135deg, #DCFCE7, #D1FAE5);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  border: 2px solid #6EE7B7;
}

.mw-days-hero-num {
  font-family: 'Fredoka One', cursive;
  font-size: 48px;
  color: var(--green-dark);
  display: block;
  line-height: 1;
}

.mw-days-hero-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-dark);
}

.mw-cal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.mw-cal-month {
  background: var(--off-white);
  border-radius: 12px;
  padding: 10px;
}

.mw-cal-month-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
  margin-bottom: 6px;
  text-align: center;
}

.mw-cal-cells {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mw-cal-dow {
  text-align: center;
  font-size: 8px;
  font-weight: 700;
  color: var(--text-light);
  padding: 2px 0;
}

.mw-cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  border-radius: 3px;
  background: #F3F4F6;
  color: #9CA3AF;
}

.mw-cal-present  { background: #6EE7B7; color: var(--green-dark); font-size: 9px; }
.mw-cal-half     { background: #FDE68A; color: #78350F; }
.mw-cal-absent   { background: #FCA5A5; color: #7F1D1D; }
.mw-cal-weekend  { background: transparent; color: #D1D5DB; }
.mw-cal-today    { outline: 2px solid var(--text-dark); outline-offset: 1px; }

.mw-cal-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  margin-top: 8px;
}

.mw-leg {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 3px;
  vertical-align: middle;
}
.mw-leg-present { background: #6EE7B7; }
.mw-leg-half    { background: #FDE68A; }
.mw-leg-absent  { background: #FCA5A5; }

/* ============================================================
   LESSONS TAB
   ============================================================ */

.mw-lessons-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mw-day-group {}

.mw-day-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mw-day-count {
  font-size: 11px;
  background: var(--off-white);
  border-radius: 8px;
  padding: 2px 8px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.mw-lessons-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mw-lesson-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: white;
  border-radius: 12px;
  border-left: 4px solid var(--chip-color, #888);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: all 0.15s;
}
.mw-lesson-chip.clickable { cursor: pointer; }
.mw-lesson-chip.clickable:hover {
  transform: translateX(3px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

.mw-lesson-icon { font-size: 24px; flex-shrink: 0; }

.mw-lesson-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mw-lesson-subj {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}

.mw-lesson-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
}

.mw-lesson-check { font-size: 18px; flex-shrink: 0; }

/* ============================================================
   SCORES TAB
   ============================================================ */

.mw-scores-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mw-score-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 14px;
  gap: 12px;
}

.score-gold  { background: linear-gradient(135deg, #FFFBEB, #FEF3C7); border: 2px solid #FDE68A; }
.score-blue  { background: linear-gradient(135deg, #EFF6FF, #DBEAFE); border: 2px solid #93C5FD; }
.score-green { background: linear-gradient(135deg, #F0FFF4, #DCFCE7); border: 2px solid #86EFAC; }
.score-pink  { background: linear-gradient(135deg, #FFF1F2, #FFE4E6); border: 2px solid #FCA5A5; }

.mw-score-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.mw-score-icon { font-size: 28px; flex-shrink: 0; }

.mw-score-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mw-score-meta {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 600;
  margin-top: 1px;
}

.mw-score-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.mw-score-stars { font-size: 13px; letter-spacing: -1px; }
.mw-score-pct   { font-family: 'Fredoka One', cursive; font-size: 20px; color: var(--text-dark); line-height: 1; }
.mw-score-letter {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   PAST LESSON DONE BADGE
   ============================================================ */

.past-lesson-done-badge {
  background: #DCFCE7;
  color: var(--green-dark);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}

/* ============================================================
   STUDENT SCROLL LAYOUT (history below today)
   ============================================================ */

/* Override old layout — screen-student now uses a vertical scroll container */
#screen-student {
  flex-direction: column;
  overflow: hidden;
}

.student-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================
   HISTORY SCROLL SECTION
   ============================================================ */

.history-scroll-section {
  padding: 0 16px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* Trophy card */
.hist-trophy-card {
  background: linear-gradient(135deg, #1A1A2E 0%, #16213E 100%);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 8px 32px rgba(26,26,46,0.3);
}

.hist-trophy-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hist-trophy-icon { font-size: 36px; }

.hist-trophy-title {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: #FFD166;
}

.hist-trophy-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  margin-top: 2px;
}

.hist-trophy-stats {
  display: flex;
  gap: 20px;
}

.hist-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hist-stat-num {
  font-family: 'Fredoka One', cursive;
  font-size: 26px;
  color: white;
  line-height: 1;
}

.hist-stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Section headers */
.hist-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.hist-section-emoji { font-size: 22px; }

.hist-section-title {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: var(--text-dark);
}

/* Loading */
.hist-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 600;
}

/* Empty states */
.hist-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-light);
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.hist-empty span { font-size: 40px; display: block; margin-bottom: 8px; }
.hist-empty p { font-size: 14px; line-height: 1.6; font-weight: 600; }

/* ============================================================
   PAST LESSONS
   ============================================================ */

.hist-lessons-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 8px;
}

.hist-day-group {}

.hist-day-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.hist-day-count {
  background: white;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: var(--shadow);
}

.hist-lessons-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hist-lesson-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border-radius: 14px;
  border-left: 4px solid var(--chip-color, #888);
  box-shadow: var(--shadow);
  transition: all 0.15s;
}

.hist-lesson-chip.hist-tappable { cursor: pointer; }
.hist-lesson-chip.hist-tappable:active {
  transform: scale(0.98);
  box-shadow: none;
}

.hist-lesson-icon { font-size: 26px; flex-shrink: 0; }

.hist-lesson-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.hist-lesson-subj {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--chip-color, var(--text-light));
}

.hist-lesson-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-lesson-check { font-size: 20px; flex-shrink: 0; }

.hist-more-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
  padding: 12px;
}

/* ============================================================
   SCORES
   ============================================================ */

.hist-scores-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.hist-score-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.hscore-gold  { background: linear-gradient(135deg, #FFFBEB, #FEF3C7); border: 2px solid #FDE68A; }
.hscore-blue  { background: linear-gradient(135deg, #EFF6FF, #DBEAFE); border: 2px solid #93C5FD; }
.hscore-green { background: linear-gradient(135deg, #F0FFF4, #DCFCE7); border: 2px solid #86EFAC; }
.hscore-plain { background: white; border: 2px solid var(--border); }

.hist-score-icon { font-size: 30px; flex-shrink: 0; }

.hist-score-body {
  flex: 1;
  min-width: 0;
}

.hist-score-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-score-meta {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 600;
  margin: 1px 0 4px;
}

.hist-score-stars { font-size: 14px; letter-spacing: -1px; }

.hist-score-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.hist-score-pct {
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  color: var(--text-dark);
  line-height: 1;
}

.hist-score-letter {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-light);
  text-transform: uppercase;
}

/* ============================================================
   DAYS CALENDAR
   ============================================================ */

.hist-days-hero {
  background: linear-gradient(135deg, #DCFCE7, #D1FAE5);
  border: 2px solid #6EE7B7;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
  text-align: center;
}

.hist-days-num {
  font-family: 'Fredoka One', cursive;
  font-size: 52px;
  color: var(--green-dark);
  display: block;
  line-height: 1;
}

.hist-days-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-dark);
}

.hist-cal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.hist-cal-month {
  background: white;
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow);
}

.hist-cal-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
  margin-bottom: 6px;
  text-align: center;
}

.hist-cal-cells {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.hist-cal-dow {
  text-align: center;
  font-size: 7px;
  font-weight: 700;
  color: var(--text-light);
  padding: 1px 0;
}

.hist-cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 600;
  border-radius: 3px;
  background: #F3F4F6;
  color: #9CA3AF;
}

.hist-cal-present  { background: #6EE7B7; color: var(--green-dark); font-size: 9px; }
.hist-cal-half     { background: #FDE68A; color: #78350F; }
.hist-cal-absent   { background: #FCA5A5; color: #7F1D1D; }
.hist-cal-wknd     { background: transparent; color: #D1D5DB; }
.hist-cal-today    { outline: 2px solid var(--text-dark); outline-offset: 1px; }

.hist-cal-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  padding: 8px 0 4px;
}

.hist-leg {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 3px;
  vertical-align: middle;
}
.hist-leg-present { background: #6EE7B7; }
.hist-leg-half    { background: #FDE68A; }
.hist-leg-absent  { background: #FCA5A5; }

/* ============================================================
   SETTINGS MODULE
   ============================================================ */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.settings-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.settings-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 20px 0;
}

.settings-card-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }

.settings-card-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  color: var(--text-dark);
  margin-bottom: 3px;
}

.settings-card-header p {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.4;
}

.settings-card-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pin-display {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  letter-spacing: 8px;
  color: var(--text-dark);
  padding: 10px 0 4px;
}

.settings-card-info .settings-card-body {
  gap: 0;
}

.settings-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-mid);
}
.settings-info-row:last-of-type { border-bottom: none; }
.settings-info-row strong { color: var(--text-dark); }

.settings-note {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.5;
  background: var(--off-white);
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 4px;
}

.field-hint {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
  font-style: italic;
}

/* ============================================================
   LESSON MODAL — 4-SECTION LAYOUT
   ============================================================ */

.lesson-modal-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 24px 16px;
}

.lesson-modal-subj-icon { font-size: 42px; flex-shrink: 0; }

.lesson-modal-subj-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 3px;
}

.lesson-modal-title {
  font-family: 'Fredoka One', cursive;
  font-size: 24px;
  color: var(--text-dark);
  line-height: 1.2;
}

/* Sections */
.lm-section {
  padding: 0 24px 16px;
}

.lm-section-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.lm-description p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-mid);
}

/* Video embed */
.lm-video-section { padding-bottom: 12px; }

.lm-video-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.lm-video-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
}

.lm-video-direct {
  width: 100%;
  border-radius: 12px;
  display: block;
}

/* Links */
.lm-links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lm-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--off-white);
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  text-decoration: none;
  transition: all 0.15s;
}
.lm-link-btn:hover {
  background: #EAF7FC;
  border-color: var(--sky);
  color: #1D4ED8;
}

.lm-link-text {
  font-size: 13px;
  color: var(--text-mid);
}

/* Worksheet section */
.lm-worksheet-section {
  border-top: 2px dashed var(--border);
  padding-top: 16px;
}

.lm-plain-worksheet {
  background: #F9F6F0;
  border-radius: 12px;
  border-left: 4px solid var(--sky);
  padding: 16px;
  white-space: pre-line;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-mid);
}

/* ============================================================
   LESSON DAY GROUPS (student view — all lessons)
   ============================================================ */

.lesson-day-group {
  margin-bottom: 20px;
}

.lesson-day-header {
  margin-bottom: 10px;
  padding: 0 2px;
}

.day-label-today {
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  color: var(--green-dark);
  background: #DCFCE7;
  padding: 4px 14px;
  border-radius: 20px;
  display: inline-block;
}

.day-label-soon {
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  color: #1D4ED8;
  background: #DBEAFE;
  padding: 4px 14px;
  border-radius: 20px;
  display: inline-block;
}

.day-label-future {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-mid);
  display: inline-block;
}

.day-label-past {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  display: inline-block;
}

.lesson-day-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* Future lesson group — subtle differentiation */
.group-future .lesson-card {
  opacity: 0.85;
  border: 2px dashed rgba(0,0,0,0.08);
}
.group-future .lesson-card:hover {
  opacity: 1;
  border-color: var(--subject-color, var(--sky));
}

/* Past incomplete lesson */
.lesson-past-incomplete {
  border: 2px solid #FDE68A !important;
}

/* Divider between today and future */
.group-future:first-of-type {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 2px dashed var(--border);
}

/* ============================================================
   SETTINGS SAVE CONFIRMATION
   ============================================================ */

.settings-saved-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #DCFCE7;
  color: var(--green-dark);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  animation: fadeIn 0.3s ease;
}

/* ============================================================
   STUDENT LESSONS GRID — override when showing day groups
   ============================================================ */

/* When day groups are rendered, the outer grid becomes a flex column */
#student-lessons-grid:has(.lesson-day-group) {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Fallback for browsers without :has — lesson-day-group handles own layout */
.lesson-day-group + .lesson-day-group.group-future {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 2px dashed var(--border);
}

/* Remove the broken :first-of-type rule effect by resetting */
.group-future:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* First future lesson group — show divider above it */
.lesson-day-group.first-future-group {
  margin-top: 12px;
  padding-top: 20px;
  border-top: 2px dashed var(--border);
  position: relative;
}
.lesson-day-group.first-future-group::before {
  content: '⬇ Coming Up';
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
}

/* ============================================================
   STUDENT TABS
   ============================================================ */

.student-tabs {
  display: flex;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--border);
  padding: 0 8px;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.student-tabs::-webkit-scrollbar { display: none; }

.student-tab {
  flex-shrink: 0;
  padding: 12px 14px;
  border: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.student-tab:hover { color: var(--text-dark); }
.student-tab.active { color: var(--green-dark); border-bottom-color: var(--green); }

.student-tab-pane { display: none; }
.student-tab-pane.active { display: block; }

/* ============================================================
   COLLAPSIBLE DAY SECTIONS
   ============================================================ */

.lesson-day-group {
  margin-bottom: 12px;
}

.lesson-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  margin-bottom: 8px;
}
.lesson-day-header.today    { background: #DCFCE7; }
.lesson-day-header.pastdue  { background: #FEF9C3; }
.lesson-day-header.upcoming { background: white; border: 2px solid var(--border); }
.lesson-day-header:hover { filter: brightness(0.97); }

.day-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.day-toggle-icon {
  font-size: 11px;
  color: var(--text-light);
  width: 16px;
  text-align: center;
}

.day-progress-badge {
  font-size: 12px;
  font-weight: 700;
  background: rgba(0,0,0,0.07);
  padding: 3px 10px;
  border-radius: 10px;
  color: var(--text-mid);
}
.day-progress-badge.all-done { background: #DCFCE7; color: var(--green-dark); }

.day-label-today   { font-family:'Fredoka One',cursive; font-size:17px; color:var(--green-dark); }
.day-label-pastdue { font-family:'Fredoka One',cursive; font-size:15px; color:#92400E; }
.day-label-soon    { font-family:'Fredoka One',cursive; font-size:16px; color:#1D4ED8; }
.day-label-future  { font-size:14px; font-weight:700; color:var(--text-mid); }

.lesson-day-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 0 4px 8px;
}

.day-section-divider {
  text-align: center;
  padding: 16px 0 8px;
  position: relative;
}
.day-section-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--border);
}
.day-section-divider span {
  position: relative;
  background: #F4F4F8;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   STUDENTS MODULE
   ============================================================ */

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.student-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.student-card:hover { box-shadow: var(--shadow-lg); }

.student-card-avatar {
  font-size: 40px;
  flex-shrink: 0;
  background: var(--off-white);
  width: 60px; height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.student-card-info { flex: 1; }
.student-card-name  { font-family:'Playfair Display',serif; font-size:18px; font-weight:700; }
.student-card-grade { font-size:13px; color:var(--text-light); margin:2px 0; font-weight:600; }
.student-card-pin   { font-size:12px; color:var(--text-light); letter-spacing:2px; }

.student-card-actions { display:flex; flex-direction:column; gap:6px; }

.avatar-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.avatar-opt {
  font-size: 24px;
  width: 44px; height: 44px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-opt:hover { border-color: var(--sky); background: #EAF7FC; }
.avatar-opt.selected { border-color: var(--green); background: #DCFCE7; }

/* ============================================================
   GAME EMBED IN STUDENT VIEW
   ============================================================ */

.game-embed-wrap {
  background: linear-gradient(135deg, #F0FFF4, #DCFCE7);
  border: 2px solid #6EE7B7;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
}

.game-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: white;
  text-decoration: none;
  padding: 14px 28px;
  border-radius: 14px;
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(16,185,129,0.35);
  transition: all 0.2s;
  margin-bottom: 10px;
  display: inline-flex;
}
.game-play-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,185,129,0.45); }

.game-play-icon { font-size: 28px; }
.game-play-arrow { font-size: 22px; }

.game-embed-note {
  font-size: 12px;
  color: var(--green-dark);
  font-weight: 600;
  margin-top: 8px;
}

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 16px;
}

.toggle-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.toggle-wrap {
  position: relative;
  flex-shrink: 0;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  display: block;
  width: 48px;
  height: 26px;
  background: var(--border);
  border-radius: 13px;
  transition: background 0.25s;
  cursor: pointer;
  position: relative;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform 0.25s;
}

.toggle-input:checked + .toggle-track {
  background: var(--green);
}

.toggle-input:checked + .toggle-track::after {
  transform: translateX(22px);
}

/* ============================================================
   LOGIN — STUDENT PICKER
   ============================================================ */

.login-student-picker {
  width: 100%;
}

.student-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.student-picker-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  background: white;
  border: 2px solid var(--border, #E8E8F0);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: 'Nunito', sans-serif;
}
.student-picker-tile:hover {
  border-color: #6EE7B7;
  background: #F0FFF4;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16,185,129,0.18);
}
.student-picker-tile:active { transform: scale(0.97); }

.picker-avatar {
  font-size: 36px;
  line-height: 1;
}

.picker-name {
  font-size: 14px;
  font-weight: 700;
  color: #2C2C3E;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.login-back-btn {
  width: 100%;
  padding: 10px;
  border: none;
  background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #888;
  cursor: pointer;
  transition: color 0.15s;
}
.login-back-btn:hover { color: #2C2C3E; }

/* ============================================================
   ACTIVITY MODE PICKER
   ============================================================ */

.lm-activity-mode-picker {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.activity-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: white;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.18s;
}
.activity-mode-btn:hover {
  border-color: var(--sky);
  color: var(--text-dark);
}
.activity-mode-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.lm-activity-no-interactive {
  color: var(--text-light);
  font-size: 14px;
  text-align: center;
  padding: 20px;
  background: var(--off-white);
  border-radius: 12px;
}

/* ============================================================
   PRINTABLE WORKSHEET
   ============================================================ */

.printable-worksheet {
  background: white;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  font-family: 'Nunito', sans-serif;
}

.pw-header {
  border-bottom: 2px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.pw-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.pw-meta {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--text-mid);
  font-weight: 600;
}

.pw-verse {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
}

.pw-questions {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pw-question {}

.pw-q-text {
  font-size: 15px;
  color: var(--text-dark);
  margin-bottom: 10px;
  line-height: 1.5;
}

.pw-mc-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 16px;
}

.pw-mc-opt {
  font-size: 14px;
  color: var(--text-mid);
  padding: 4px 0;
}

.pw-match {
  display: flex;
  gap: 24px;
  padding-left: 16px;
}

.pw-match-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.pw-match-item {
  font-size: 14px;
  color: var(--text-mid);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.pw-text-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 16px;
}

.pw-line {
  height: 1px;
  background: var(--border);
  margin-top: 18px;
}

.pw-draw-box {
  border: 2px dashed var(--border);
  border-radius: 10px;
  height: 140px;
  margin: 6px 0 0 16px;
}

.pw-plain {
  white-space: pre-line;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-mid);
  padding-left: 8px;
}

.pw-print-btn {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.15s;
}
.pw-print-btn:hover {
  border-color: var(--text-dark);
  color: var(--text-dark);
}

/* Print styles — hide everything except the worksheet */
@media print {
  body > *:not(#screen-student) { display: none !important; }
  .student-header, .student-tabs, .progress-bar-wrap,
  .student-content, .lesson-modal-header, .lm-section:not(.lm-worksheet-section),
  .lm-activity-mode-picker, .activity-mode-btn, #activity-mode-interactive,
  .complete-btn, .modal-close, .pw-print-btn { display: none !important; }
  #activity-mode-print { display: block !important; }
  .printable-worksheet {
    border: none;
    padding: 0;
    font-size: 14pt;
  }
  .pw-draw-box { height: 200px; }
}

/* ============================================================
   GRADING MODAL IMPROVEMENTS
   ============================================================ */

.grading-student-badge {
  background: #DCFCE7;
  color: #166534;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 700;
}

.grading-q-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.grading-q-num {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-dark);
}

.grading-q-type {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--off-white);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--text-light);
}

.grading-q-points {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  margin-left: auto;
}

.grading-needs-review {
  font-size: 12px;
  font-weight: 700;
  color: #92400E;
  background: #FEF9C3;
  padding: 2px 8px;
  border-radius: 6px;
}

/* ============================================================
   WORKSHEET QUESTION IMAGES
   ============================================================ */

.iws-q-image {
  margin: 10px 0;
  text-align: center;
}

.iws-question-img {
  max-width: 100%;
  max-height: 280px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  object-fit: contain;
}

/* Image editor tab button */
.ao-tab-images {
  background: linear-gradient(135deg, #F0FFF4, #DCFCE7) !important;
  color: var(--green-dark) !important;
  border: 1.5px solid #6EE7B7 !important;
  font-weight: 700 !important;
}
.ao-tab-images:hover {
  background: #DCFCE7 !important;
}

/* ============================================================
   LESSON BUILDER — SUGGESTED RESOURCES
   ============================================================ */

.lb-suggested-resources {
  margin: 16px 0;
  border: 2px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  grid-column: 1 / -1;
}

.lb-suggested-header {
  background: linear-gradient(135deg, #F0FFF4, #DCFCE7);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 14px;
  color: var(--green-dark);
  border-bottom: 1px solid #6EE7B7;
}

.lb-suggested-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-left: auto;
}

.lb-suggested-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  padding: 12px;
}

.lb-resource-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-dark);
  transition: all 0.15s;
  font-family: 'Nunito', sans-serif;
}
.lb-resource-link:hover {
  border-color: var(--t-accent);
  background: #EEF2FF;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.lb-resource-icon { font-size: 20px; flex-shrink: 0; }

.lb-resource-body { flex: 1; min-width: 0; }

.lb-resource-site {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-resource-desc {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-resource-arrow {
  font-size: 14px;
  color: var(--text-light);
  flex-shrink: 0;
}

/* ============================================================
   COMPLIANCE — STUDENT FILTER
   ============================================================ */

#module-compliance .module-header {
  flex-wrap: wrap;
  gap: 12px;
}

/* ============================================================
   PLANNER — WEEKEND COLUMNS
   ============================================================ */

.planner-grid-weekend .planner-day {
  background: #FAFAFA;
}

.planner-day-header.weekend {
  color: var(--text-light);
  background: #F4F4F8;
}

/* ============================================================
   ADMIN PORTAL
   ============================================================ */

/* Login admin link */
.login-admin-link {
  margin-top: 20px;
  text-align: center;
}
.login-admin-link a {
  font-size: 12px;
  color: var(--text-light);
  text-decoration: none;
  font-weight: 600;
}
.login-admin-link a:hover {
  color: var(--text-dark);
  text-decoration: underline;
}

.admin-empty {
  color: #888;
  font-size: 14px;
  padding: 20px 0;
  margin: 0;
}

/* Admin cards grid */
.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.admin-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s;
}
.admin-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.admin-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-card-icon { font-size: 28px; flex-shrink: 0; }

.admin-card-title-wrap { flex: 1; min-width: 0; }

.admin-card-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-card-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-card-status {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  flex-shrink: 0;
}
.admin-card-status.active   { background: #DCFCE7; color: #166534; }
.admin-card-status.inactive { background: #F3F4F6; color: #9CA3AF; }

.admin-card-actions { display: flex; gap: 8px; }

/* Support tickets */
.admin-support-ticket {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.admin-support-ticket.open     { border-left: 4px solid #EF4444; }
.admin-support-ticket.resolved { border-left: 4px solid #10B981; opacity: 0.7; }

.support-ticket-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.support-status-badge { font-size: 12px; font-weight: 800; }

.support-ticket-school {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  background: var(--off-white);
  padding: 2px 10px;
  border-radius: 8px;
}

.support-ticket-date {
  font-size: 12px;
  color: var(--text-light);
  margin-left: auto;
}

.support-ticket-subject {
  font-size: 15px;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.support-ticket-body {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.6;
  white-space: pre-line;
}

.support-ticket-contact {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-light);
}

.login-school-picker { width: 100%; }

/* ============================================================
   LOGIN — SCHOOL DROPDOWN
   ============================================================ */

.school-picker-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border, #E8E8F0);
  border-radius: 14px;
  background: white;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #2C2C3E;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238888A0' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.school-picker-select:hover {
  border-color: #6EE7B7;
}

.school-picker-select:focus {
  outline: none;
  border-color: #10B981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.school-picker-select option {
  font-weight: 600;
  padding: 8px;
}
