@import url('https://fonts.googleapis.com/css2?family=Playpen+Sans:wght@400;600;700;800&display=swap');

:root {
  --bg: #f7fbfd;
  --card: #ffffff;
  --ink: #241815;
  --muted: #64748b;
  --primary: #0398d8;
  --primary-dark: #0077b6;
  --secondary: #f6c62f;
  --secondary-dark: #d9a915;
  --nav: #241815;
  --line: #dbe7ee;
  --success: #dcfce7;
  --error: #fee2e2;
  --warning: #fff3c4;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Playpen Sans', 'Comic Sans MS', Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(246,198,47,.25), transparent 26%),
    radial-gradient(circle at top right, rgba(3,152,216,.18), transparent 30%),
    linear-gradient(135deg, #fffdf4 0%, #f5fbff 48%, #e9f7fc 100%);
  min-height: 100vh;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: linear-gradient(90deg, var(--nav) 0%, #303030 48%, #067fb9 100%);
  color: white;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 0 8px 22px rgba(36, 24, 21, .25);
  border-bottom: 4px solid var(--secondary);
}
.brand-wrap { display: flex; align-items: center; gap: 14px; min-width: 0; }
.school-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
  background: white;
  border-radius: 50%;
  padding: 3px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.brand { font-size: 18px; font-weight: 900; line-height: 1.15; }
.subtitle { color: #d7f2ff; font-size: 12px; margin-top: 2px; }
nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
nav a { color: #e8f8ff; font-weight: 700; }
.user-pill {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
}

.container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 18px 24px 56px;
}
.hero, .panel, .login-card, .class-card, .stat {
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(219,231,238,.95);
  box-shadow: 0 14px 30px rgba(36, 24, 21, .08);
  border-radius: 22px;
}
.hero {
  padding: 28px;
  margin-bottom: 24px;
  border-left: 8px solid var(--secondary);
}
h1 { margin: 0 0 8px; font-size: 34px; color: var(--nav); }
h2 { margin: 0 0 16px; font-size: 23px; color: var(--nav); }
h3 { margin: 0 0 8px; font-size: 20px; color: var(--nav); }
p { color: var(--muted); line-height: 1.5; }

.login-card { max-width: 460px; margin: 45px auto; padding: 30px; border-top: 8px solid var(--secondary); }
.stacked-form, .grid-form { display: grid; gap: 14px; }
.grid-form { grid-template-columns: repeat(4, minmax(140px, 1fr)); align-items: end; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { min-width: 150px; }
label { display: grid; gap: 6px; font-weight: 700; font-size: 14px; color: #374151; }
input, select {
  width: 100%;
  border: 1px solid #bfd4df;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
  background: white;
}
input:focus, select:focus { outline: 3px solid rgba(3,152,216,.24); border-color: var(--primary); }
button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-weight: 800;
  padding: 11px 16px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 15px rgba(3,152,216,.22);
  white-space: nowrap;
}
button:hover, .button:hover { background: var(--primary-dark); text-decoration: none; }
.button.secondary { background: var(--secondary); color: var(--nav); box-shadow: 0 8px 15px rgba(246,198,47,.25); }
.button.secondary:hover { background: var(--secondary-dark); }
.button.danger { background: #dc2626; box-shadow: 0 8px 15px rgba(220,38,38,.18); }
.button.danger:hover { background: #b91c1c; }
.button.small { padding: 7px 10px; border-radius: 10px; font-size: 12px; box-shadow: none; }
.button.ghost { background: transparent; border: 1px solid rgba(255,255,255,.42); box-shadow: none; }
.button.ghost-dark { background: white; border: 1px solid #bfd4df; color: var(--nav); box-shadow: none; }

/* v2.6 requested action button colors */
.button.class-report-button {
  background: #32CD32;
  color: #073b07;
  border: 1px solid rgba(7, 59, 7, 0.16);
  box-shadow: 0 8px 15px rgba(50, 205, 50, .22);
}
.button.class-report-button:hover {
  background: #28b428;
  color: #052f05;
}
.button.manage-students-button {
  background: #FFD8A8;
  color: #6b3500;
  border: 1px solid rgba(107, 53, 0, 0.16);
  box-shadow: 0 8px 15px rgba(255, 216, 168, .42);
}
.button.manage-students-button:hover {
  background: #FFC57A;
  color: #5a2c00;
}
/* v2.8 Reports Centre Open Class button color */
.button.open-class-button {
  background: #32CD32;
  color: #073b07;
  border: 1px solid rgba(7, 59, 7, 0.16);
  box-shadow: 0 8px 15px rgba(50, 205, 50, .22);
}
.button.open-class-button:hover {
  background: #28b428;
  color: #052f05;
}

.note { margin-top: 18px; color: var(--muted); font-size: 13px; background: #fff9df; border-radius: 12px; padding: 12px; border: 1px solid rgba(246,198,47,.35); }

.messages { display: grid; gap: 10px; margin-bottom: 18px; }
.message { border-radius: 14px; padding: 12px 16px; font-weight: 700; }
.message.success { background: var(--success); }
.message.error { background: var(--error); }
.message.warning { background: var(--warning); }
.message.info { background: #e0f2fe; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 22px 0 30px; }
.stats-grid.small { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { padding: 22px; text-align: center; border-top: 5px solid var(--primary); }
.stat span { display: block; font-size: 34px; font-weight: 900; color: var(--primary-dark); }
.stat label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .07em; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.class-card { display: grid; gap: 14px; padding: 24px; color: inherit; transition: transform .15s ease, box-shadow .15s ease; border-top: 5px solid var(--secondary); }
.class-card:hover { transform: translateY(-2px); box-shadow: 0 18px 35px rgba(36,24,21,.12); }
.class-card-link { color: inherit; display: block; }
.class-card-link:hover { text-decoration: none; }
.class-card p { margin: 0; }
.empty { background: #fff; border: 1px dashed #bfd4df; border-radius: 16px; padding: 18px; color: var(--muted); }

.page-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.actions, .form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-actions { justify-content: flex-end; margin-top: 18px; }
.split { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; align-items: start; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 18px; margin-bottom: 18px; }
.panel { padding: 22px; overflow: auto; }
.panel.narrow { max-width: 900px; margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

table { width: 100%; border-collapse: collapse; background: white; border-radius: 14px; overflow: hidden; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #eaf7fc; color: #214f65; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
small { color: var(--muted); }
.score-input { max-width: 100px; }

@media (max-width: 900px) {
  .topbar, .page-header { flex-direction: column; align-items: flex-start; }
  .stats-grid, .split, .admin-grid, .grid-form { grid-template-columns: 1fr; }
  .brand { font-size: 17px; }
  .school-logo { width: 54px; height: 54px; }
}

.homework-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  background: #fff9df;
  border: 1px solid rgba(246,198,47,.45);
  border-radius: 16px;
  padding: 14px;
  color: var(--ink);
  font-size: 13px;
}
.homework-table th { font-size: 12px; }
.tick-cell { text-align: center; min-width: 95px; }
.tick-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: auto;
}
.tick-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tick-option span {
  width: 28px;
  height: 28px;
  border: 2px solid #9fb9c6;
  border-radius: 8px;
  background: white;
  display: inline-block;
  position: relative;
  transition: .15s ease;
}
.tick-option input:checked + span {
  background: var(--primary);
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 4px rgba(3,152,216,.16);
}
.tick-option input:checked + span::after {
  content: "✓";
  position: absolute;
  top: 0px;
  left: 6px;
  color: white;
  font-weight: 900;
  font-size: 22px;
}
.homework-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  background: #eaf7fc;
  border: 1px solid #bfd4df;
  color: #214f65;
  font-size: 12px;
  font-weight: 800;
}
.empty.mini { display: inline-block; padding: 10px 12px; }

.compact { margin-bottom: 10px; }
.print-only-block { display: none; }
.report-logo { width: 86px; height: 86px; object-fit: contain; background: white; border-radius: 50%; padding: 5px; border: 2px solid var(--line); }
.print-report-header { display: flex; align-items: center; gap: 18px; border-left: 8px solid var(--secondary); margin-bottom: 18px; }
.report-header-card { border-left: 8px solid var(--primary); margin-bottom: 18px; }
.trend-chart { width: 100%; max-width: 860px; height: auto; background: #ffffff; border: 1px solid var(--line); border-radius: 16px; padding: 8px; }
.chart-title { font-weight: 900; fill: var(--nav); font-size: 18px; }
.chart-grid { stroke: #dbe7ee; stroke-width: 1; }
.chart-label { fill: #607486; font-size: 12px; }
.small-label { font-size: 11px; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: var(--secondary); stroke: var(--primary-dark); stroke-width: 2; }
.assignment-card { border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 14px; background: #fbfdff; }
.assignment-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 12px; }
.assignment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.check-card { display: flex; align-items: flex-start; gap: 10px; border: 1px solid #bfd4df; border-radius: 14px; padding: 10px; background: #fff; font-weight: 800; }
.check-card input { width: auto; margin-top: 3px; }
.check-card:has(input:checked) { border-color: var(--primary); background: #eaf7fc; box-shadow: inset 0 0 0 2px rgba(3,152,216,.08); }

@media print {
  body { background: white; color: #111; }
  .topbar, .no-print, .messages, nav, .button, button { display: none !important; }
  .container { max-width: none; padding: 0; }
  .panel, .hero, .stat, .login-card, .class-card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .print-only-block { display: flex !important; }
  .print-report-header { display: flex !important; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  table { font-size: 11px; }
  th, td { padding: 7px; }
  h1 { font-size: 25px; }
  h2 { font-size: 18px; }
  .trend-chart { max-width: 100%; border: 1px solid #ddd; }
  a { color: #111; text-decoration: none; }
}

.admin-system-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  border: 2px solid rgba(255, 200, 61, 0.65);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
}

.admin-system-panel h3 {
  margin: 0 0 6px;
}

.admin-system-panel p {
  margin: 0 0 12px;
}

.shutdown-hero {
  text-align: center;
}

.backup-file {
  display: inline-block;
  margin: 10px auto 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff8df;
  border: 1px solid #ffc83d;
  font-weight: 700;
}

/* v2.2 updates */
body, input, select, button, .button, table, textarea {
  font-family: 'Playpen Sans', 'Comic Sans MS', Arial, Helvetica, sans-serif;
}

.class-page-header {
  align-items: flex-start;
}
.class-title-wrap {
  min-width: 0;
  flex: 1 1 auto;
}
.class-title,
.class-card h3 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.class-title {
  font-size: clamp(24px, 3vw, 34px);
}
.student-name-link {
  color: var(--primary-dark);
  text-decoration: none;
}
.student-name-link:hover {
  text-decoration: underline;
}
.student-form {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.password-helper-form {
  margin-top: 8px;
}



/* v2.3 class-page and password workflow updates */
.class-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 245px;
  gap: 22px;
  align-items: start;
}
.class-title-wrap {
  min-width: 0;
  padding-top: 4px;
}
.class-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.15;
  margin-bottom: 8px;
}
.class-side-actions {
  display: grid;
  gap: 10px;
  align-self: start;
  justify-self: end;
  width: min(245px, 100%);
}
.class-side-actions .button,
.class-side-actions form,
.class-side-actions button {
  width: 100%;
}
.warning-text {
  display: block;
  margin-top: 8px;
  color: #92400e;
  font-weight: 800;
}
@media (max-width: 820px) {
  .class-page-header {
    grid-template-columns: 1fr;
  }
  .class-side-actions {
    justify-self: stretch;
    width: 100%;
  }
  .class-title {
    white-space: normal;
  }
}

/* v2.4 class page right-side action column */
.class-page-header {
  display: block;
  margin-bottom: 16px;
}
.class-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 410px);
  gap: 22px;
  align-items: start;
}
.class-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}
.class-sidebar {
  display: grid;
  gap: 18px;
  align-self: start;
  justify-self: stretch;
  min-width: 0;
}
.class-sidebar .class-side-actions {
  justify-self: stretch;
  width: 100%;
  margin-top: 0;
}
.class-sidebar .panel {
  width: 100%;
}
.homework-side-panel table {
  font-size: 13px;
}
.homework-side-panel th,
.homework-side-panel td {
  padding: 10px 8px;
}
@media (max-width: 1050px) {
  .class-layout {
    grid-template-columns: 1fr;
  }
  .class-sidebar {
    order: -1;
  }
  .class-title {
    white-space: normal;
  }
}

/* v2.5 class page action row reset */
.class-page-header {
  display: block;
  margin-bottom: 10px;
}
.class-inline-actions {
  margin: 0 0 20px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  justify-content: flex-start;
}
.class-inline-actions form {
  display: inline-flex;
  margin: 0;
}
.class-inline-actions .button,
.class-inline-actions button {
  white-space: nowrap;
}
.class-content-split {
  align-items: start;
}
@media (max-width: 820px) {
  .class-inline-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .class-inline-actions .button,
  .class-inline-actions form,
  .class-inline-actions button {
    width: 100%;
  }
}

/* v2.7: action buttons sit directly on the page background, no white container box. */

/* v2.10 class view layout: Students + Assessments side by side, Homework underneath */
.class-top-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(520px, 1.35fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.students-panel,
.assessments-panel,
.homework-wide-panel {
  min-width: 0;
}
.compact-students-table {
  table-layout: fixed;
}
.compact-students-table th,
.compact-students-table td {
  padding: 10px 8px;
}
.compact-students-table th {
  white-space: normal;
  line-height: 1.08;
  text-align: center;
  vertical-align: middle;
  overflow-wrap: anywhere;
  letter-spacing: .02em;
}
.compact-students-table td {
  overflow-wrap: anywhere;
}
.compact-students-table .student-no-col {
  width: 72px;
}
.compact-students-table .student-report-col {
  width: 70px;
}
.compact-students-table .student-name-col {
  width: auto;
}
.assessments-panel {
  overflow-x: auto;
}
.assessments-table {
  min-width: 760px;
}
@media (max-width: 1050px) {
  .class-top-grid {
    grid-template-columns: 1fr;
  }
  .assessments-table {
    min-width: 720px;
  }
}



/* v2.11 wider working area: use the full browser width and reduce empty header space */
.topbar {
  min-height: 64px;
}
.container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding-left: clamp(12px, 1.6vw, 28px);
  padding-right: clamp(12px, 1.6vw, 28px);
  padding-top: 18px;
}
.hero,
.panel,
.login-card,
.class-card,
.stat {
  max-width: none;
}
.panel {
  padding: 18px;
}
.page-header {
  margin-bottom: 14px;
}
.class-inline-actions {
  margin-bottom: 14px;
}
.class-top-grid {
  grid-template-columns: minmax(360px, 0.85fr) minmax(640px, 1.65fr);
  gap: 16px;
}
.students-panel,
.assessments-panel,
.homework-wide-panel {
  width: 100%;
}
@media (min-width: 1500px) {
  .class-top-grid {
    grid-template-columns: minmax(420px, 0.75fr) minmax(850px, 1.9fr);
  }
}
@media (max-width: 1050px) {
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }
  .class-top-grid {
    grid-template-columns: 1fr;
  }
}

/* v2.13 Teacher Portal */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 22px;
}
.choice-card {
  display: block;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 14px 30px rgba(36,24,21,.08);
  color: var(--ink);
  min-height: 230px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.choice-card:hover { transform: translateY(-3px); box-shadow: 0 18px 35px rgba(36,24,21,.14); text-decoration: none; }
.choice-card.teacher-choice { border-top: 8px solid var(--secondary); }
.choice-card.management-choice { border-top: 8px solid var(--primary); }
.choice-icon { font-size: 44px; margin-bottom: 12px; }
.portal-grid {
  display: grid;
  grid-template-columns: minmax(320px, .85fr) minmax(520px, 1.45fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.portal-grid.bottom-grid { grid-template-columns: 1fr 1fr; }
.portal-panel h2 { margin-bottom: 12px; }
textarea {
  width: 100%;
  border: 1px solid #bfd4df;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
  background: white;
  font-family: inherit;
  resize: vertical;
}
textarea:focus { outline: 3px solid rgba(3,152,216,.24); border-color: var(--primary); }
.material-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.material-category-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  background: #f4fbff;
  border: 1px solid #cde6f2;
  border-radius: 16px;
  color: var(--ink);
}
.material-category-card:hover { text-decoration: none; border-color: var(--primary); }
.material-category-card span { font-weight: 900; color: var(--primary-dark); }
.compact-table th, .compact-table td { padding: 9px; font-size: 13px; }
.section-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.week-mini-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  gap: 10px;
}
.week-mini-day {
  background: #fff9df;
  border: 1px solid rgba(246,198,47,.45);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 3px;
  min-height: 92px;
}
.week-mini-day strong { color: var(--nav); }
.notice-card {
  background: #f4fbff;
  border-left: 5px solid var(--primary);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
}
.notice-card.large { padding: 18px; }
.notice-card p { margin: 8px 0 0; color: var(--ink); }
.notice-list { display: grid; gap: 12px; }
.week-planner-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(170px, 1fr));
  gap: 12px;
  align-items: start;
}
.planner-day { min-height: 260px; padding: 16px; }
.planner-day h3 { font-size: 17px; }
.planner-item {
  background: #fff9df;
  border: 1px solid rgba(246,198,47,.45);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 10px;
}
.planner-item p { margin: 5px 0 9px; font-size: 13px; color: var(--ink); }
.planner-item.completed {
  background: #f1f3f5;
  border-color: #d6dce2;
  opacity: .82;
}
.planner-item.completed .planner-item-main strong,
.planner-item.completed .planner-item-main p {
  text-decoration: line-through;
  color: #6b7280;
}
.planner-item-main small {
  display: block;
  margin-top: 3px;
}
.completed-note {
  color: #287a31;
  font-weight: 700;
}
.carry-over-note {
  color: #a05a00;
  font-weight: 700;
}
.planner-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}
.planner-item-actions form { margin: 0; }
.material-preview-frame {
  width: 100%;
  height: 72vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}
.material-preview-image {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  border-radius: 16px;
  border: 1px solid var(--line);
  margin: 0 auto;
}
.wide-field { grid-column: span 2; }
@media (max-width: 1100px) {
  .portal-grid, .portal-grid.bottom-grid, .week-planner-grid { grid-template-columns: 1fr; }
  .week-mini-list { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .wide-field { grid-column: auto; }
}

/* v2.14 Teacher Portal upgrades */
.admin-user-list-panel { margin-bottom: 18px; }
.teacher-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.teacher-user-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  background: #f4fbff;
  border: 1px solid #cde6f2;
  border-radius: 16px;
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(0, 75, 105, .07);
}
.teacher-user-card:hover {
  text-decoration: none;
  border-color: var(--primary);
  transform: translateY(-1px);
}
.teacher-user-card strong { color: var(--primary-dark); }
.teacher-user-card span { font-weight: 700; }
.teacher-user-card small { color: var(--muted); }
.overwrite-warning-panel {
  border-left: 8px solid var(--danger);
}
.overwrite-actions { margin-top: 18px; }
.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff9df;
  border: 1px solid rgba(246,198,47,.55);
  font-weight: 900;
  color: var(--nav);
}

/* v2.16: admin class-name editing */
.inline-class-edit-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

.inline-class-edit-form input {
  min-width: 150px;
  max-width: 240px;
}

/* v2.19 production WSGI local package and login version label */
.app-version {
  display: inline-block;
  margin-left: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--ink);
  font-size: 0.45em;
  vertical-align: middle;
  white-space: nowrap;
}
.grade-class-stack {
  display: grid;
  gap: 18px;
}
.grade-class-group {
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}
.grade-heading {
  margin: 0 0 12px;
  color: var(--primary-dark);
  font-size: 22px;
}
.grade-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* v2.20: student move/remove management */
.student-management-table th,
.student-management-table td {
  vertical-align: top;
}
.student-action-stack {
  display: grid;
  gap: 8px;
  min-width: 260px;
}
.inline-student-action {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.inline-student-action select {
  min-width: 160px;
  max-width: 220px;
}
.button.small,
button.small {
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 10px;
}
@media (max-width: 900px) {
  .inline-student-action {
    flex-wrap: wrap;
  }
  .student-action-stack {
    min-width: 180px;
  }
}

/* v2.21 assessment class summary */
.summary-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 16px;
  background: #f7fbff;
  border: 1px solid #dbe7ee;
}
.summary-box textarea,
.report-summary-box textarea {
  width: 100%;
  min-height: 110px;
}
.required { color: #d64545; font-weight: 900; }
.report-summary-box {
  background: #fff9df;
  border: 1px solid rgba(246, 198, 47, .45);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 14px 0 16px;
}
.report-summary-box h3 { margin: 0 0 8px; color: #214f65; }
.report-summary-box p { margin: 0; white-space: pre-wrap; }

/* v2.22 Excel class list import */
.student-import-form { grid-template-columns: minmax(260px, 1fr) auto; align-items: end; }
.student-import-form input[type="file"] { padding: 9px 10px; }
@media (max-width: 900px) { .student-import-form { grid-template-columns: 1fr; } }

/* v3.0 browser file previews */
.material-preview-media {
  display: block;
  width: 100%;
  max-height: 74vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}
.short-preview {
  height: 260px;
}
.small-note {
  margin-top: 10px;
  font-size: 13px;
}

/* v3.1 student detail editing and bulk move/remove */
.bulk-student-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.72);
}
.inline-note {
  margin-left: 8px;
}
.bulk-student-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.bulk-student-controls select {
  min-width: 220px;
}
.student-select-col {
  width: 52px;
  text-align: center;
  white-space: nowrap;
}
.select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}
.button.light-orange,
a.button.light-orange {
  background: #ffd6a3;
  color: #5a2e00;
  border-color: #f2af58;
}
.button.light-orange:hover,
a.button.light-orange:hover {
  background: #ffc77a;
}
@media (max-width: 900px) {
  .bulk-student-toolbar {
    align-items: stretch;
  }
  .bulk-student-controls,
  .bulk-student-controls select,
  .bulk-student-controls button {
    width: 100%;
  }
}
.translation-line {
  display: inline-block;
  margin-top: 4px;
  color: #33566a;
  font-size: 0.92em;
  font-weight: 700;
}
.report-language-note {
  background: #fff8db;
  border: 1px solid #f3d36d;
  color: #5c4700;
  padding: 10px 12px;
  border-radius: 12px;
  margin-top: 8px;
}


/* v3.3 floating admin notifications + user class creation */
.floating-notifications {
  position: fixed;
  top: 88px;
  right: 18px;
  z-index: 1200;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  background: rgba(255,255,255,.98);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(25,60,80,.22);
}
.notification-window-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #eef8fc;
  border-bottom: 1px solid var(--line);
}
.notification-window-head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f6c62f;
  color: #273b46;
  font-weight: 800;
}
.floating-notification { padding: 14px; border-bottom: 1px solid var(--line); }
.floating-notification:last-child { border-bottom: 0; }
.floating-notification p { margin: 7px 0; white-space: pre-wrap; }
.floating-notification small { display: block; margin-bottom: 10px; color: var(--muted); }
.notification-type {
  display: inline-block;
  margin-bottom: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7f6ff;
  color: #155d7a;
  font-size: 12px;
  font-weight: 800;
}
.floating-notification.admin_notice .notification-type { background: #fff4c7; color: #6a5200; }
.create-class-panel { margin-bottom: 20px; }
.create-class-form {
  display: grid;
  grid-template-columns: minmax(150px,.7fr) minmax(180px,1fr) minmax(160px,.8fr) auto;
  gap: 12px;
  align-items: end;
}
.create-class-form label { margin: 0; }
@media (max-width: 900px) {
  .floating-notifications { top: 76px; right: 10px; width: calc(100vw - 20px); }
  .create-class-form { grid-template-columns: 1fr; }
}

/* ========================================================================== */
/* v3.4 INFOGRAPHIC VISUAL REFRESH                                            */
/* Visual-only update: existing layout, Playpen Sans typography and features  */
/* are preserved while cards, forms, tables and navigation gain stronger      */
/* infographic-style hierarchy.                                               */
/* ========================================================================== */

:root {
  --info-blue: #0398d8;
  --info-blue-soft: #e9f7fd;
  --info-yellow: #f6c62f;
  --info-yellow-soft: #fff8d9;
  --info-green: #43c66f;
  --info-green-soft: #eafaf0;
  --info-orange: #ffad57;
  --info-orange-soft: #fff0df;
  --info-purple: #8d78d8;
  --info-purple-soft: #f1edff;
  --info-shadow: 0 14px 32px rgba(35, 73, 93, .10);
  --info-shadow-hover: 0 20px 42px rgba(35, 73, 93, .16);
}

body {
  background-color: #f5fbfe;
  background-image:
    radial-gradient(circle at 8% 7%, rgba(246,198,47,.22) 0 4px, transparent 5px),
    radial-gradient(circle at 94% 15%, rgba(3,152,216,.15) 0 5px, transparent 6px),
    linear-gradient(135deg, rgba(255,253,244,.96), rgba(245,251,255,.97) 46%, rgba(234,248,253,.97));
  background-size: 120px 120px, 155px 155px, auto;
}

.topbar {
  position: relative;
  overflow: hidden;
  background: linear-gradient(105deg, #241815 0%, #2f2b2a 42%, #087faf 76%, #0398d8 100%);
  box-shadow: 0 9px 28px rgba(23, 53, 69, .24);
}
.topbar::after {
  content: "";
  position: absolute;
  right: 17%;
  top: -42px;
  width: 150px;
  height: 150px;
  border: 22px solid rgba(255,255,255,.055);
  border-radius: 50%;
  pointer-events: none;
}
.topbar > * { position: relative; z-index: 1; }
nav a:not(.button) {
  padding: 7px 10px;
  border-radius: 10px;
  transition: background .16s ease, transform .16s ease;
}
nav a:not(.button):hover {
  background: rgba(255,255,255,.13);
  transform: translateY(-1px);
  text-decoration: none;
}
.user-pill { box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }

.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(112deg, rgba(255,255,255,.98) 0 62%, rgba(233,247,253,.96) 62% 100%);
  border-left: 8px solid var(--info-yellow);
  border-top: 1px solid rgba(255,255,255,.95);
  box-shadow: var(--info-shadow);
}
.hero::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -68px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(3,152,216,.12) 0 42%, transparent 43% 58%, rgba(246,198,47,.16) 59% 67%, transparent 68%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1, .page-header h1 {
  letter-spacing: -.025em;
  text-shadow: 0 2px 0 rgba(255,255,255,.85);
}

.panel, .class-card, .stat, .login-card {
  border-color: rgba(187, 215, 228, .88);
  box-shadow: var(--info-shadow);
}
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(251,254,255,.97));
  border-top: 4px solid rgba(3,152,216,.78);
}
.panel:nth-of-type(3n+2) { border-top-color: rgba(246,198,47,.92); }
.panel:nth-of-type(3n) { border-top-color: rgba(67,198,111,.78); }

.panel h2, .grade-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}
.panel h2::before, .grade-heading::before {
  content: "";
  width: 10px;
  height: 28px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--info-yellow), var(--info-blue));
  box-shadow: 0 3px 8px rgba(3,152,216,.18);
}

.stats-grid { gap: 18px; }
.stat {
  position: relative;
  overflow: hidden;
  text-align: left;
  padding: 20px 22px 21px;
  border-top-width: 6px;
  transition: transform .16s ease, box-shadow .16s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--info-shadow-hover); }
.stat::after {
  content: "";
  position: absolute;
  right: -17px;
  bottom: -22px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: rgba(3,152,216,.08);
}
.stat:nth-child(2) { border-top-color: var(--info-yellow); }
.stat:nth-child(2)::after { background: rgba(246,198,47,.14); }
.stat:nth-child(3) { border-top-color: var(--info-green); }
.stat:nth-child(3)::after { background: rgba(67,198,111,.12); }
.stat:nth-child(4) { border-top-color: var(--info-orange); }
.stat:nth-child(4)::after { background: rgba(255,173,87,.14); }
.stat span { position: relative; z-index: 1; font-size: 36px; line-height: 1.05; }
.stat label { position: relative; z-index: 1; margin-top: 7px; }

.class-card {
  position: relative;
  overflow: hidden;
  border-top: 6px solid var(--info-yellow);
  background: linear-gradient(145deg, #fff 0 76%, var(--info-yellow-soft) 76% 100%);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.class-card::before {
  content: "";
  position: absolute;
  width: 56px;
  height: 56px;
  right: 13px;
  top: 13px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(246,198,47,.19), rgba(3,152,216,.10));
  transform: rotate(8deg);
  pointer-events: none;
}
.class-card:hover { transform: translateY(-4px); box-shadow: var(--info-shadow-hover); border-top-color: var(--info-blue); }
.class-card > * { position: relative; z-index: 1; }
.class-card h3 { padding-right: 58px; }

.grade-class-group {
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 20px;
  background: rgba(255,255,255,.46);
  border: 1px dashed rgba(3,152,216,.25);
}
.grade-heading {
  margin-bottom: 14px;
  padding: 7px 12px;
  width: fit-content;
  border-radius: 999px;
  background: var(--info-blue-soft);
  color: #165b77;
}

button, .button {
  position: relative;
  overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}
button:hover, .button:hover { transform: translateY(-1px); }
button:active, .button:active { transform: translateY(0); }
.button.ghost-dark { background: rgba(255,255,255,.93); }

input, select, textarea {
  border: 1px solid #b9d3df;
  background: linear-gradient(180deg, #fff, #fcfeff);
  box-shadow: inset 0 1px 2px rgba(30,70,90,.035);
}
textarea {
  width: 100%;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
  resize: vertical;
}
label { color: #315365; }

/* Infographic-style table: strong header band + readable row cards */
table {
  border: 1px solid rgba(190,215,227,.85);
  box-shadow: 0 6px 16px rgba(41,80,99,.055);
}
th {
  background: linear-gradient(180deg, #e8f7fd, #dff2fa);
  color: #19536d;
  border-bottom: 2px solid #b8ddea;
}
tbody tr { transition: background .12s ease; }
tbody tr:nth-child(even) td { background: rgba(244,250,253,.72); }
tbody tr:hover td { background: #fff9df; }

.note, .summary-box, .report-summary-box, .homework-legend {
  position: relative;
  box-shadow: 0 6px 14px rgba(79,74,40,.05);
}
.note { border-left: 5px solid var(--info-yellow); }
.summary-box { border-left: 5px solid var(--info-blue); }
.report-summary-box { border-left: 5px solid var(--info-yellow); }

.status-pill {
  box-shadow: 0 3px 8px rgba(31,86,111,.07);
  background: linear-gradient(180deg, #eefaff, #e4f5fb);
}
.empty {
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(237,248,253,.9));
  border: 2px dashed #b8d5e2;
}

.portal-panel, .admin-user-list-panel, .create-class-panel { overflow: hidden; }
.material-category-card, .teacher-user-card, .week-mini-day, .notice-card, .assignment-card, .check-card {
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.material-category-card:hover, .teacher-user-card:hover, .week-mini-day:hover, .notice-card:hover, .assignment-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(35,73,93,.11);
  border-color: rgba(3,152,216,.45);
}

.floating-notifications {
  border-top: 6px solid var(--info-yellow);
  box-shadow: 0 22px 56px rgba(25,60,80,.27);
}
.notification-window-head {
  background: linear-gradient(90deg, var(--info-blue-soft), var(--info-yellow-soft));
}
.floating-notification.calendar_task { border-left: 5px solid var(--info-blue); }
.floating-notification.admin_notice { border-left: 5px solid var(--info-yellow); }

.login-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255,255,255,.99), rgba(242,250,254,.97));
}
.login-card::after {
  content: "";
  position: absolute;
  width: 145px;
  height: 145px;
  right: -58px;
  bottom: -58px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(3,152,216,.13) 0 46%, rgba(246,198,47,.14) 47% 61%, transparent 62%);
  pointer-events: none;
}
.login-card > * { position: relative; z-index: 1; }

/* Keep printed reports clean and ink-friendly. */
@media print {
  body { background: #fff !important; background-image: none !important; }
  .hero::after, .class-card::before, .topbar::after, .stat::after, .login-card::after { display: none !important; }
  .panel, .class-card, .stat, .hero { background: #fff !important; transform: none !important; }
  tbody tr:nth-child(even) td, tbody tr:hover td { background: #fff !important; }
}

@media (max-width: 900px) {
  .hero { background: rgba(255,255,255,.97); }
  .grade-class-group { padding: 12px; }
  .stat { text-align: center; }
}


/* v3.4.1 CACHE-BUST + INFOGRAPHIC HOTFIX */
.top-version-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f6c62f;
  color: #2f2b2a;
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.infographic-login {
  position: relative;
  overflow: hidden;
  border-top: 7px solid var(--info-blue);
  border-bottom: 7px solid var(--info-yellow);
  background:
    linear-gradient(145deg, rgba(255,255,255,.99) 0 72%, rgba(233,247,253,.96) 72% 100%);
  box-shadow: 0 22px 52px rgba(25,72,96,.18);
}
.login-visual-band {
  display: flex;
  gap: 7px;
  margin: -2px 0 18px;
}
.login-visual-band span {
  display: block;
  height: 8px;
  border-radius: 999px;
  flex: 1;
}
.login-visual-band span:nth-child(1) { background: var(--info-blue); flex: 2; }
.login-visual-band span:nth-child(2) { background: var(--info-yellow); }
.login-visual-band span:nth-child(3) { background: var(--info-green); }
.login-visual-band span:nth-child(4) { background: var(--info-orange); flex: .7; }

/* Stronger global infographic treatment so the update is immediately visible. */
.page-header {
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(110deg, rgba(255,255,255,.93), rgba(233,247,253,.78));
  border: 1px solid rgba(3,152,216,.18);
  border-left: 7px solid var(--info-blue);
  box-shadow: 0 10px 26px rgba(35,73,93,.08);
  margin-bottom: 18px;
}
.page-header h1 { margin-bottom: 3px; }

.panel {
  border-radius: 20px !important;
}
.panel > h2:first-child {
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(3,152,216,.23);
}

button, .button {
  box-shadow: 0 5px 12px rgba(17,80,108,.12);
}
button:hover, .button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17,80,108,.17);
}

table {
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(183,211,224,.45);
}
thead th {
  background: linear-gradient(180deg, #eaf7fd, #dff2fa) !important;
  border-bottom: 2px solid rgba(3,152,216,.22);
  color: #155d7a;
}
tbody tr:nth-child(even) { background: rgba(241,249,252,.76); }
tbody tr:hover { background: rgba(255,248,217,.72); }

.stacked-form, .grid-form {
  background: linear-gradient(135deg, rgba(246,250,252,.78), rgba(255,252,238,.66));
  border-radius: 16px;
  padding: 14px;
  border: 1px dashed rgba(3,152,216,.18);
}

.floating-notifications {
  box-shadow: 0 22px 48px rgba(30,68,89,.24) !important;
}

@media print {
  .top-version-badge, .login-visual-band { display: none !important; }
  .page-header { background: #fff !important; box-shadow: none !important; border-left-width: 1px !important; }
}

/* ================================================================
   v3.5 - Temporary password handouts
   ================================================================ */
.credential-tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.credential-handout-shell {
  display: flex;
  justify-content: center;
  padding: 18px 0 40px;
}

.credential-handout-card {
  width: min(760px, 100%);
  background: #ffffff;
  border: 2px solid #b9dbea;
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 18px 44px rgba(22, 87, 116, 0.13);
  position: relative;
  overflow: hidden;
}

.credential-handout-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 9px;
  background: linear-gradient(90deg, #0398d8 0 62%, #f6c62f 62% 82%, #8fd14f 82% 100%);
}

.credential-handout-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: left;
  margin-bottom: 20px;
}

.credential-handout-header h1 {
  margin: 0 0 4px;
  color: #0b5f86;
}

.credential-handout-header p {
  margin: 0;
  color: #5b7180;
  font-weight: 700;
}

.credential-handout-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.credential-user-name {
  text-align: center;
  font-size: 1.45rem;
  font-weight: 900;
  color: #213f4d;
  background: #eef8fd;
  border-radius: 16px;
  padding: 13px 18px;
  margin-bottom: 20px;
}

.credential-grid {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.7fr);
  border: 1px solid #c9e1eb;
  border-radius: 16px;
  overflow: hidden;
}

.credential-label,
.credential-value {
  padding: 14px 16px;
  border-bottom: 1px solid #dcebf1;
}

.credential-label:nth-last-child(-n+2),
.credential-value:nth-last-child(-n+2) {
  border-bottom: 0;
}

.credential-label {
  background: #eef8fd;
  color: #526978;
  font-weight: 800;
}

.credential-value {
  background: #fff;
  color: #17242d;
  font-weight: 800;
  word-break: break-word;
}

.credential-password {
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  color: #0b5f86;
}

.credential-url {
  font-size: 0.96rem;
}

.credential-first-login-note {
  margin-top: 20px;
  background: #fff7d6;
  border: 1px solid #e7c64c;
  border-left: 7px solid #f6c62f;
  border-radius: 14px;
  padding: 15px 17px;
  line-height: 1.55;
  color: #6d5106;
}

.credential-issued {
  text-align: center;
  color: #6b7f8b;
  font-size: 0.9rem;
  margin: 15px 0 0;
}

.credential-actions {
  justify-content: center;
  margin-top: 22px;
}

@media (max-width: 680px) {
  .credential-handout-card { padding: 24px 18px; }
  .credential-grid { grid-template-columns: 1fr; }
  .credential-label { border-bottom: 0; padding-bottom: 5px; }
  .credential-value { padding-top: 5px; }
}

@media print {
  .credential-handout-shell { padding: 0; display: block; }
  .credential-handout-card {
    width: auto;
    border: 1px solid #aacbd9;
    border-radius: 0;
    box-shadow: none;
    padding: 24px;
  }
  .credential-handout-card::before { height: 6px; }
}

/* ================================================================
   v3.6 - Direct-entry Weekly Lesson Objectives
   ================================================================ */
.wlo-portal-feature {
  border-left: 8px solid #f6c62f;
  background: linear-gradient(135deg, rgba(255,253,240,.96), rgba(235,248,253,.94));
}

.wlo-intro-card {
  border-top: 6px solid #0398d8;
}

.wlo-entry-form {
  margin-top: 12px;
}

.wlo-form-top-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(120px, .55fr) minmax(170px, .75fr);
  gap: 12px;
}

.wlo-type-form {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed rgba(3,152,216,.28);
}

.wlo-type-form[hidden] {
  display: none !important;
}

.wlo-text-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.wlo-text-grid textarea {
  min-height: 110px;
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.wlo-filter-panel {
  border-left: 8px solid #8fd14f;
}

.wlo-filter-form {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
}

.wlo-table-panel {
  border-top: 5px solid rgba(3,152,216,.72);
}

.wlo-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.wlo-table {
  width: 100%;
  table-layout: fixed;
  min-width: 1120px;
}

.wlo-table th,
.wlo-table td {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: normal;
  vertical-align: top;
  line-height: 1.35;
}

.wlo-table th:first-child,
.wlo-table td:first-child {
  width: 58px;
}

.wlo-table th:nth-child(2),
.wlo-table td:nth-child(2) {
  width: 120px;
}

.wlo-week-cell {
  text-align: center;
  font-size: 1.05rem;
  background: rgba(246,198,47,.14);
}

.wlo-long-text {
  min-width: 150px;
}

.empty-state-panel {
  text-align: center;
  border-style: dashed;
}

@media (max-width: 900px) {
  .wlo-form-top-row,
  .wlo-text-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .wlo-table-wrap { overflow: visible; }
  .wlo-table {
    min-width: 0;
    table-layout: auto;
    font-size: 8px;
  }
  .wlo-table th,
  .wlo-table td {
    padding: 5px !important;
  }
  .wlo-table-panel {
    break-inside: auto;
    page-break-inside: auto;
  }
  .wlo-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* ================================================================
   v3.6.1 - WLO print layout refinement
   ================================================================ */
@media print {
  /* The on-screen WLO introduction is useful while editing but should
     not consume space on the printed WLO handout/report. */
  .page-header.no-print { display: none !important; }

  .print-report-header {
    margin: 0 0 7mm !important;
    padding: 5mm 6mm !important;
    gap: 5mm !important;
    border: 1px solid #b7d9e7 !important;
    border-top: 4px solid #8fd14f !important;
    border-left: 1px solid #b7d9e7 !important;
    border-radius: 5mm !important;
    align-items: center !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-report-header .report-logo {
    width: 19mm !important;
    height: 19mm !important;
    padding: 1mm !important;
    flex: 0 0 19mm;
  }

  .print-report-header h1 {
    margin: 0 0 1.2mm !important;
    font-size: 18pt !important;
    line-height: 1.08 !important;
  }

  .print-report-header p {
    margin: 0 !important;
    font-size: 11pt !important;
    line-height: 1.2 !important;
  }

  .print-report-header small {
    display: inline-block;
    margin-top: 1.4mm;
    font-size: 8.5pt !important;
    color: #445b67 !important;
  }

  .wlo-table-panel {
    margin: 0 0 5mm !important;
    padding: 4mm !important;
    border: 1px solid #c6dfe9 !important;
    border-top: 3px solid #43add8 !important;
    border-radius: 4mm !important;
  }

  .wlo-table-panel .section-title-row {
    margin-bottom: 2.5mm !important;
  }

  .wlo-table-panel .section-title-row h2 {
    margin: 0 !important;
    font-size: 12pt !important;
  }

  .wlo-table-panel .section-title-row p {
    margin: .8mm 0 0 !important;
    font-size: 8pt !important;
  }

  .wlo-table-wrap {
    overflow: visible !important;
    width: 100% !important;
  }

  .wlo-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: 7.8pt !important;
  }

  .wlo-table th,
  .wlo-table td {
    padding: 2.1mm 1.8mm !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    line-height: 1.25 !important;
    vertical-align: top !important;
  }

  .wlo-table th {
    font-size: 7.5pt !important;
    line-height: 1.12 !important;
    text-align: left !important;
    hyphens: none !important;
    background: #dff2fa !important;
    color: #0f526f !important;
  }

  /* Keep short metadata columns readable instead of allowing headings such
     as WEEK / CLASS / DATE to collapse into one-character-wide columns. */
  .wlo-table .wlo-col-week {
    width: 6.5% !important;
    min-width: 12mm !important;
    text-align: center !important;
  }

  .wlo-table .wlo-col-selector {
    width: 10.5% !important;
    min-width: 19mm !important;
  }

  .wlo-table .wlo-col-date {
    width: 10% !important;
    min-width: 18mm !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
  }

  .wlo-table .wlo-col-user {
    width: 10% !important;
    min-width: 18mm !important;
  }

  .wlo-table .wlo-col-long {
    width: auto !important;
  }

  .wlo-week-cell {
    font-size: 10pt !important;
    vertical-align: middle !important;
    background: #fff7d8 !important;
  }

  .wlo-long-text {
    min-width: 0 !important;
  }

  .wlo-table tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}

/* =========================================================
   English - Innovation Portal v4.1 — App-style shell and collaboration UI
   ========================================================= */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 245px minmax(0, 1fr); }
.app-sidebar {
  position: sticky; top: 0; height: 100vh; padding: 18px 14px;
  background: linear-gradient(180deg, #132f3d 0%, #0a5274 55%, #0879a8 100%);
  border-right: 4px solid var(--secondary); color: white; display: flex; flex-direction: column; gap: 18px;
  box-shadow: 8px 0 26px rgba(10, 65, 89, .15); z-index: 20;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; color: white; padding: 5px 4px 13px; border-bottom: 1px solid rgba(255,255,255,.18); }
.sidebar-brand:hover { text-decoration: none; }
.sidebar-logo { width: 52px; height: 52px; border-radius: 50%; background: white; padding: 3px; object-fit: contain; }
.sidebar-brand strong { display: block; font-size: 16px; line-height: 1.15; }
.sidebar-brand small { display: inline-block; margin-top: 4px; color: #ffe378; }
.sidebar-nav { display: grid; gap: 7px; align-content: start; }
.sidebar-nav a { color: #eaf8ff; border-radius: 13px; padding: 10px 11px; display: flex; gap: 9px; align-items: center; font-weight: 700; transition: background .15s ease, transform .15s ease; }
.sidebar-nav a:hover { background: rgba(255,255,255,.13); transform: translateX(2px); text-decoration: none; }
.sidebar-user { margin-top: auto; display: grid; gap: 6px; padding: 13px; background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.16); border-radius: 16px; }
.sidebar-user small { color: #d6eff9; }
.app-main { min-width: 0; }
.mobile-topbar { display: none; }
.app-main .container { padding: 22px 28px 60px; }

/* shared/mixed student membership */
.existing-student-grid, .lesson-makeup-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 9px; margin: 12px 0 16px; }
.lesson-makeup-fieldset { border: 1px solid #b9dbea; border-radius: 16px; padding: 12px 14px; background: #f7fcff; }
.lesson-makeup-fieldset legend { font-weight: 900; color: #164e68; padding: 0 7px; }

/* forum */
.forum-thread-list { display: grid; gap: 10px; }
.forum-thread-card { display: grid; gap: 5px; padding: 14px 16px; border: 1px solid #c8dfe9; border-left: 5px solid var(--primary); border-radius: 15px; background: #fbfdff; color: var(--ink); }
.forum-thread-card:hover { text-decoration: none; background: #f1fbff; }
.forum-thread-card span, .forum-thread-card small { color: var(--muted); }
.forum-conversation { display: grid; gap: 12px; }
.forum-post { max-width: 82%; padding: 13px 15px; border-radius: 16px 16px 16px 4px; background: #f1f7fa; border: 1px solid #d8e7ee; }
.forum-post.own-post { margin-left: auto; border-radius: 16px 16px 4px 16px; background: #fff8d8; border-color: #efd67a; }
.forum-post p { margin: 7px 0 0; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.forum-post-meta { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.forum-post-meta small { color: var(--muted); }

/* shared schedule */
.availability-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.schedule-grid { display: grid; grid-template-columns: repeat(5,minmax(160px,1fr)); gap: 12px; }
.schedule-day { min-width: 0; background: #f7fbfd; border: 1px solid #d4e5ed; border-radius: 16px; padding: 10px; }
.schedule-day h3 { border-bottom: 3px solid var(--secondary); padding-bottom: 7px; }
.schedule-entry { display: grid; gap: 4px; margin-top: 9px; padding: 10px; border-radius: 12px; background: white; border-left: 4px solid var(--primary); box-shadow: 0 5px 12px rgba(20,70,90,.07); }
.schedule-entry.own-entry { border-left-color: #32CD32; background: #f2fff2; }
.schedule-entry span, .schedule-entry small { overflow-wrap: anywhere; }

/* reports: never clip long summaries/comments */
.report-header-card, .panel table td, .panel table th, .report-table td, .report-table th { overflow-wrap: anywhere; word-break: normal; white-space: normal; }
.translation-line { display: inline; overflow-wrap: anywhere; }

@media (max-width: 980px) {
  .app-shell { display: block; }
  .app-sidebar { position: static; height: auto; padding: 10px 14px; border-right: 0; border-bottom: 4px solid var(--secondary); }
  .sidebar-brand, .sidebar-user { display: none; }
  .sidebar-nav { display: flex; overflow-x: auto; gap: 7px; }
  .sidebar-nav a { flex: 0 0 auto; }
  .mobile-topbar { display: flex; padding: 8px 14px; align-items: center; justify-content: space-between; background: white; border-bottom: 1px solid var(--line); }
  .app-main .container { padding: 16px 14px 45px; }
  .schedule-grid { grid-template-columns: 1fr; }
}

@media print {
  .app-shell { display: block !important; }
  .app-sidebar, .mobile-topbar { display: none !important; }
  .app-main .container { padding: 0 !important; }
  table { table-layout: fixed !important; width: 100% !important; }
  th, td { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; overflow-wrap: anywhere !important; word-break: normal !important; height: auto !important; }
  .panel { overflow: visible !important; }
  .report-header-card, .print-report-header { break-inside: avoid; }
  .forum-post { max-width: none; }
}

/* ========================================================================== */
/* v4.1.0 UNIFIED SERVER + MOBILE / PWA STAGE 3A                             */
/* ========================================================================== */

.sidebar-nav a.active {
  background: rgba(255,255,255,.18);
  box-shadow: inset 4px 0 0 var(--secondary);
  color: #fff;
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(8,35,48,.48);
  z-index: 39;
}

.mobile-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-install-dock {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 1500;
  width: min(430px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid #c7dfe9;
  border-left: 6px solid var(--secondary);
  border-radius: 16px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 18px 46px rgba(18,67,88,.22);
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  gap: 10px;
  align-items: center;
}
.pwa-install-dock[hidden] { display: none !important; }
.pwa-install-dock strong,
.pwa-install-dock small { display: block; }
.pwa-install-dock small { margin-top: 2px; color: var(--muted); line-height: 1.35; }
.pwa-dock-close,
.pwa-help-close {
  border: 0;
  background: transparent;
  color: #526b78;
  font-size: 24px;
  line-height: 1;
  padding: 6px;
  cursor: pointer;
}
.pwa-help-dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid #c6dfe9;
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(10,55,75,.3);
}
.pwa-help-dialog::backdrop { background: rgba(7,35,48,.48); }
.pwa-help-dialog form { position: relative; padding: 24px; }
.pwa-help-dialog h2 { margin-top: 0; color: #164e68; }
.pwa-help-dialog ol { padding-left: 24px; line-height: 1.75; }
.pwa-help-close { position: absolute; top: 9px; right: 10px; }

@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
  .mobile-topbar {
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .app-sidebar {
    padding-left: max(14px, env(safe-area-inset-left));
  }
  .app-main .container {
    padding-bottom: max(60px, calc(24px + env(safe-area-inset-bottom)));
  }
}

@media (max-width: 980px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .app-shell { display: block; min-height: 100vh; }

  .app-sidebar {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 310px);
    height: 100dvh;
    padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
    border-right: 4px solid var(--secondary);
    border-bottom: 0;
    transform: translateX(-105%);
    transition: transform .22s ease;
    overflow-y: auto;
    z-index: 40;
  }
  .mobile-menu-open .app-sidebar { transform: translateX(0); }
  .mobile-menu-open .sidebar-scrim { display: block; }
  .mobile-menu-open { overflow: hidden; }

  .sidebar-brand { display: flex; }
  .sidebar-user { display: grid; }
  .sidebar-nav {
    display: grid;
    overflow: visible;
    gap: 7px;
  }
  .sidebar-nav a {
    min-height: 46px;
    flex: none;
    font-size: 15px;
  }

  .mobile-topbar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 35;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 7px 18px rgba(24,70,89,.08);
  }
  .mobile-topbar .brand-wrap { min-width: 0; }
  .mobile-topbar .school-logo { width: 38px; height: 38px; flex: 0 0 38px; }
  .mobile-topbar .brand { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
  .mobile-menu-button { min-height: 42px; }

  .app-main .container { padding: 14px 12px max(48px, calc(24px + env(safe-area-inset-bottom))); }
  .floating-notifications { top: 68px; }

  /* Touch-friendly controls */
  button, .button, input, select { min-height: 44px; }
  textarea { min-height: 110px; }
  input, select, textarea { font-size: 16px; }

  /* Wide data views remain usable without shrinking text to unreadable sizes. */
  .panel { max-width: 100%; }
  .panel > table,
  .table-scroll,
  .report-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { max-width: 100%; }

  .forum-post { max-width: 94%; }
  .schedule-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .mobile-topbar .top-version-badge { display: none; }
  .mobile-topbar .brand { max-width: 46vw; }
  .pwa-install-dock {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    grid-template-columns: minmax(0,1fr) auto;
  }
  .pwa-install-dock > .pwa-dock-close { position: absolute; right: 4px; top: 2px; }
  .pwa-install-dock > div { padding-right: 14px; }
}

@media print {
  .pwa-install-dock,
  .pwa-help-dialog,
  .sidebar-scrim { display: none !important; }
}

/* ========================================================================== */
/* v4.1.1 HERITAGE THEME RESTORATION                                          */
/* Keeps the unified v4.1 app layout/PWA while restoring the v3.6.2 palette   */
/* and Playpen Sans visual identity that preceded the major v4 update.        */
/* ========================================================================== */

/* The core document already uses the original v3.6.2 variables and
   Playpen Sans stack. These rules bring the new app shell into that theme. */
.app-sidebar {
  background: linear-gradient(180deg, var(--nav) 0%, #303030 46%, #067fb9 100%);
  border-right-color: var(--secondary);
  box-shadow: 8px 0 26px rgba(36, 24, 21, .18);
}
.sidebar-brand {
  border-bottom-color: rgba(255,255,255,.20);
}
.sidebar-brand small {
  color: #ffe78a;
}
.sidebar-nav a {
  color: #e8f8ff;
}
.sidebar-nav a:hover {
  background: rgba(3,152,216,.20);
}
.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(3,152,216,.28), rgba(255,255,255,.10));
  box-shadow: inset 4px 0 0 var(--secondary);
  color: #fff;
}
.sidebar-user {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.20);
}
.sidebar-user small {
  color: #d7f2ff;
}

/* Match the familiar dark/blue/yellow top treatment on tablets and phones. */
.mobile-topbar {
  color: white;
  background: linear-gradient(90deg, var(--nav) 0%, #303030 48%, #067fb9 100%);
  border-bottom: 4px solid var(--secondary);
  box-shadow: 0 8px 22px rgba(36,24,21,.18);
  backdrop-filter: none;
}
.mobile-topbar .brand {
  color: white;
}
.mobile-topbar .top-version-badge {
  color: #ffe78a;
}
.mobile-topbar .button.ghost-dark {
  background: rgba(255,255,255,.96);
  border-color: rgba(255,255,255,.72);
  color: var(--nav);
}

/* Keep new collaboration components calm and consistent with the old cards. */
.forum-thread-card,
.schedule-day,
.lesson-makeup-fieldset {
  border-color: #dbe7ee;
}
.forum-thread-card {
  border-left-color: var(--primary);
  background: rgba(255,255,255,.96);
}
.forum-thread-card:hover {
  background: var(--info-blue-soft);
}
.schedule-day {
  background: rgba(255,255,255,.94);
}
.schedule-entry {
  border-left-color: var(--primary);
  box-shadow: 0 8px 18px rgba(36,24,21,.07);
}
.pwa-install-dock {
  border-color: #dbe7ee;
  border-left-color: var(--secondary);
  box-shadow: 0 18px 46px rgba(36,24,21,.16);
}
.pwa-help-dialog {
  border-color: #dbe7ee;
  box-shadow: 0 24px 70px rgba(36,24,21,.25);
}
.pwa-help-dialog h2 {
  color: var(--nav);
}

@media (max-width: 980px) {
  .app-sidebar {
    border-right-color: var(--secondary);
    border-bottom: 0;
  }
  .mobile-topbar {
    background: linear-gradient(90deg, var(--nav) 0%, #303030 48%, #067fb9 100%);
    border-bottom: 4px solid var(--secondary);
  }
}

@media print {
  .mobile-topbar { background: none !important; border: 0 !important; box-shadow: none !important; }
}


/* v4.2 English - Innovation Portal developer signature */
.tjworks-signature {
  position: fixed;
  right: 18px;
  bottom: 12px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  max-width: calc(100vw - 36px);
  border: 1px solid rgba(49, 139, 190, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 6px 20px rgba(24, 61, 84, .10);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #456171;
  font-size: .72rem;
  line-height: 1;
  pointer-events: none;
}
.tjworks-signature .signature-dot { color: #e9b82f; font-weight: 900; }
.tjworks-mark {
  position: relative;
  isolation: isolate;
  color: #213d4d;
  letter-spacing: .02em;
  padding: 2px 4px;
}
.tjworks-mark::before {
  content: "⚡";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%) rotate(-8deg) scale(1.55);
  color: rgba(247, 196, 49, .68);
  font-size: 1.2rem;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.8));
}
@media (max-width: 700px) {
  .tjworks-signature {
    position: static;
    width: fit-content;
    margin: 14px auto 72px;
    font-size: .64rem;
    flex-wrap: wrap;
    justify-content: center;
  }
}
@media print { .tjworks-signature { display: none !important; } }

/* v4.3 Lesson Plan workspace */
.lesson-plan-portal-feature { border-top-color: var(--secondary); }
.lesson-plan-filter { display:grid; grid-template-columns:minmax(220px, 1fr) minmax(180px, .6fr) auto; gap:14px; align-items:end; }
.lesson-plan-filter label { margin:0; }
.filter-actions { padding-bottom:2px; }
.lesson-plan-library { display:grid; gap:12px; }
.lesson-plan-card { display:grid; grid-template-columns:170px minmax(0,1fr) auto; gap:16px; align-items:center; border:1px solid #dbe7ee; border-left:6px solid var(--primary); border-radius:16px; padding:14px 16px; background:rgba(255,255,255,.97); box-shadow:0 8px 22px rgba(36,24,21,.06); }
.lesson-plan-card-date { display:flex; flex-direction:column; gap:4px; }
.lesson-plan-card-date strong { color:var(--nav); font-size:1rem; }
.lesson-plan-card-date span { color:#5a7380; font-size:.82rem; }
.lesson-plan-card-main h3 { margin:0 0 5px; color:var(--nav); }
.lesson-plan-card-main p { margin:0 0 5px; }
.lesson-plan-card-main small { display:block; line-height:1.5; color:#526d7b; }
.lesson-plan-editor { display:grid; gap:18px; }
.lesson-plan-form-header { display:flex; gap:16px; align-items:center; margin-bottom:18px; }
.lesson-plan-form-header img { width:72px; height:72px; object-fit:contain; border-radius:50%; background:#fff; }
.lesson-plan-form-header h2 { margin:0; }
.lesson-plan-form-header p { margin:3px 0 0; }
.lesson-plan-meta-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.lesson-plan-editor-section { display:grid; gap:14px; }
.lesson-plan-editor-section label, .lesson-plan-procedure-editor label { display:grid; gap:6px; font-weight:700; color:var(--nav); }
.lesson-plan-editor-section textarea, .lesson-plan-procedure-editor textarea { font-weight:400; line-height:1.55; resize:vertical; }
.lesson-plan-topic input { font-size:1rem; }
.lesson-plan-procedure-editor { display:grid; gap:14px; }
.lesson-plan-save-actions { justify-content:flex-end; margin-bottom:28px; }
.lesson-plan-print-sheet { width:min(100%, 820px); margin:0 auto 36px; background:#fff; border:1px solid #dbe7ee; border-radius:18px; padding:26px; box-shadow:0 14px 38px rgba(36,24,21,.09); color:#111; }
.lesson-plan-print-header { display:grid; grid-template-columns:88px 1fr; gap:18px; align-items:center; padding-bottom:14px; border-bottom:3px solid var(--primary); }
.lesson-plan-print-header img { width:82px; height:82px; object-fit:contain; }
.lesson-plan-print-header h1 { margin:0; color:var(--nav); font-size:1.6rem; }
.lesson-plan-print-header p { margin:4px 0 0; color:#58717f; }
.lesson-plan-print-meta { display:grid; grid-template-columns:1fr 1fr; margin:16px 0; border:1px solid #9fc9dc; border-radius:10px; overflow:hidden; }
.lesson-plan-print-meta > div { min-height:64px; padding:9px 12px; border-right:1px solid #cce2ec; border-bottom:1px solid #cce2ec; display:flex; flex-direction:column; gap:4px; }
.lesson-plan-print-meta > div:nth-child(2n) { border-right:0; }
.lesson-plan-print-meta > div:nth-last-child(-n+2) { border-bottom:0; }
.lesson-plan-print-meta span { font-size:.75rem; text-transform:uppercase; letter-spacing:.06em; color:#527486; font-weight:700; }
.lesson-plan-print-section { border:1px solid #9fc9dc; border-radius:10px; overflow:hidden; margin:12px 0; break-inside:avoid; }
.lesson-plan-print-section > h2 { margin:0; padding:8px 11px; background:#eef8fd; color:var(--nav); font-size:.98rem; border-bottom:1px solid #cce2ec; }
.lesson-plan-print-text { min-height:78px; padding:10px 12px; white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.5; }
.topic-section .lesson-plan-print-text { min-height:42px; font-weight:700; }
.compact-print-section .lesson-plan-print-text { min-height:58px; }
.procedure-print-section { break-inside:auto; }
.procedure-print-row { display:grid; grid-template-columns:125px 1fr; border-top:1px solid #cce2ec; break-inside:avoid; }
.procedure-print-row:first-of-type { border-top:0; }
.procedure-print-row h3 { margin:0; padding:10px; font-size:.9rem; background:#fbfdfe; border-right:1px solid #cce2ec; }
.procedure-print-row .lesson-plan-print-text { min-height:68px; }
.lesson-plan-admin-note { margin-top:12px; color:#637c88; font-size:.8rem; }
@media (max-width: 800px) {
  .lesson-plan-filter, .lesson-plan-meta-grid { grid-template-columns:1fr; }
  .lesson-plan-card { grid-template-columns:1fr; }
  .lesson-plan-card .actions { justify-content:flex-start; }
  .procedure-print-row { grid-template-columns:1fr; }
  .procedure-print-row h3 { border-right:0; border-bottom:1px solid #cce2ec; }
}
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html, body { background:#fff !important; }
  .container { max-width:none !important; width:100% !important; margin:0 !important; padding:0 !important; }
  .lesson-plan-print-sheet { width:100% !important; max-width:none !important; margin:0 !important; padding:0 !important; border:0 !important; border-radius:0 !important; box-shadow:none !important; font-family:"Playpen Sans", "Segoe UI", Arial, sans-serif; }
  .lesson-plan-print-header { grid-template-columns:22mm 1fr; gap:5mm; padding-bottom:3mm; }
  .lesson-plan-print-header img { width:20mm; height:20mm; }
  .lesson-plan-print-header h1 { font-size:17pt; }
  .lesson-plan-print-header p { font-size:8.5pt; }
  .lesson-plan-print-meta { margin:4mm 0 3mm; border-color:#888; }
  .lesson-plan-print-meta > div { min-height:13mm; padding:2mm 3mm; border-color:#bbb; }
  .lesson-plan-print-meta span { font-size:7pt; }
  .lesson-plan-print-meta strong { font-size:9pt; }
  .lesson-plan-print-section { margin:2.5mm 0; border-color:#888; border-radius:2mm; }
  .lesson-plan-print-section > h2 { padding:1.8mm 2.5mm; font-size:9pt; background:#f3f3f3 !important; border-color:#bbb; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .lesson-plan-print-text { min-height:14mm; padding:2mm 3mm; font-size:8.5pt; line-height:1.35; }
  .topic-section .lesson-plan-print-text { min-height:8mm; }
  .compact-print-section .lesson-plan-print-text { min-height:10mm; }
  .procedure-print-row { grid-template-columns:28mm 1fr; border-color:#bbb; }
  .procedure-print-row h3 { padding:2mm; font-size:8.5pt; border-color:#bbb; }
  .procedure-print-row .lesson-plan-print-text { min-height:13mm; }
}

/* v4.6.0 Weekly Newsletter Builder */
.newsletter-portal-feature{border-top:4px solid var(--info-yellow,#f5c84b)}
.newsletter-builder textarea{min-height:120px;resize:vertical;white-space:pre-wrap}
.newsletter-format-fields{margin-top:1rem;padding-top:.4rem}
.newsletter-format-fields>label{display:block;margin-bottom:1rem}
.newsletter-photo-upload{margin-top:1rem;padding:1rem;border:1px dashed #b8d6ea;border-radius:16px;background:#fbfdff}
.newsletter-preview-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:1rem;margin-bottom:1rem}
.newsletter-preview-card:nth-child(4n+1){background:#f4f8e6}.newsletter-preview-card:nth-child(4n+2){background:#e9f5fc}.newsletter-preview-card:nth-child(4n+3){background:#fdf0ee}.newsletter-preview-card:nth-child(4n){background:#f4eff8}
.newsletter-photo-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:.8rem}.newsletter-photo-grid img{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:14px;border:1px solid #d9e5ee}
.prewrap{white-space:pre-wrap;overflow-wrap:anywhere}
@media(max-width:760px){.newsletter-preview-grid{grid-template-columns:1fr}.newsletter-photo-grid{grid-template-columns:1fr 1fr}}
@media(max-width:480px){.newsletter-photo-grid{grid-template-columns:1fr}}

/* ========================================================================== */
/* v4.6.6 SHARED SEMESTER SCHEDULE                                             */
/* ========================================================================== */
.schedule-control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}
.schedule-editor-panel,
.availability-panel { min-width: 0; }
.schedule-panel-heading,
.schedule-board-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.schedule-panel-heading > div,
.schedule-board-heading > div { min-width: 0; }
.schedule-help { margin: -7px 0 15px; font-size: 14px; }

.schedule-item-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  padding: 14px;
  border: 1px dashed #c9e1ea;
  border-radius: 16px;
  background: rgba(247,252,255,.72);
}
.schedule-item-form label { min-width: 0; }
.schedule-item-form input,
.schedule-item-form select { min-width: 0; width: 100%; }
.schedule-field-day { grid-column: span 2; }
.schedule-field-start { grid-column: span 2; }
.schedule-field-end { grid-column: span 2; }
.schedule-field-label { grid-column: span 3; }
.schedule-field-location { grid-column: span 3; }
.schedule-field-notes { grid-column: span 4; }
.schedule-form-actions {
  grid-column: span 2;
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}
.schedule-form-actions > * { flex: 1 1 auto; white-space: nowrap; }

.my-schedule-summary {
  margin-top: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 14px;
  background: #f3fff2;
  border: 1px solid #b9e6b5;
}
.my-schedule-summary > div { display: grid; gap: 3px; min-width: 0; }
.my-schedule-summary span { color: var(--muted); font-size: 13px; }
.my-schedule-summary form { flex: 0 0 auto; }

.availability-form {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 12px;
  align-items: end;
}
.availability-form button { grid-column: 1 / -1; }

.schedule-board-heading { margin-bottom: 12px; }
.schedule-board-heading p { margin: -8px 0 0; }
.schedule-entry-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.schedule-entry-actions form { margin: 0; }
.schedule-entry-actions .button,
.schedule-entry-actions button { min-height: 34px; padding: 7px 10px; }

@media (max-width: 1280px) {
  .schedule-control-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .schedule-item-form { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .schedule-field-day,
  .schedule-field-start,
  .schedule-field-end,
  .schedule-field-label,
  .schedule-field-location,
  .schedule-field-notes { grid-column: span 1; }
  .schedule-field-label,
  .schedule-field-notes { grid-column: 1 / -1; }
  .schedule-form-actions { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .schedule-item-form,
  .availability-form { grid-template-columns: 1fr; }
  .schedule-item-form > *,
  .availability-form > * { grid-column: 1 !important; }
  .schedule-form-actions { flex-direction: column; align-items: stretch; }
  .my-schedule-summary,
  .schedule-panel-heading,
  .schedule-board-heading { flex-direction: column; align-items: stretch; }
}

@media print {
  .schedule-page-header { margin-bottom: 10mm; }
  .schedule-board { box-shadow: none !important; border: 0 !important; padding: 0 !important; }
  .schedule-grid { grid-template-columns: repeat(5, minmax(0,1fr)) !important; gap: 5px !important; }
  .schedule-day { break-inside: avoid; padding: 7px !important; }
  .schedule-entry { box-shadow: none !important; padding: 7px !important; font-size: 10px; }
}


/* v4.6.6 STAFF FORUM REAL-TIME NOTIFICATIONS */
.floating-notification.forum_thread { border-left: 5px solid #8d63d8; }
.floating-notification.forum_mention { border-left: 5px solid #24a866; }
.floating-notification.forum_thread .notification-type { background: #f0eaff; color: #5b389e; }
.floating-notification.forum_mention .notification-type { background: #e6f8ed; color: #176b42; }
.notification-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.notification-actions form { margin: 0; }
.forum-mention-help, .forum-notification-help { display: block; margin-top: -2px; color: var(--muted); line-height: 1.45; }

/* ========================================================================== */
/* v4.7.0 NEWSLETTER PHOTOS + WLO PRINT SPACING                              */
/* ========================================================================== */
.newsletter-content-block {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #cfe4ef;
  border-radius: 18px;
  background: linear-gradient(145deg, #ffffff, #fbfdff);
  box-shadow: 0 5px 16px rgba(18, 83, 117, .05);
}
.newsletter-content-block:nth-of-type(4n+1){border-left:5px solid #f4bd31}
.newsletter-content-block:nth-of-type(4n+2){border-left:5px solid #25a9dc}
.newsletter-content-block:nth-of-type(4n+3){border-left:5px solid #75ba4a}
.newsletter-content-block:nth-of-type(4n){border-left:5px solid #ee8d7b}
.newsletter-content-heading {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.newsletter-content-heading strong,
.newsletter-content-heading h2 { display:block; margin:0 0 3px; }
.newsletter-content-heading small { display:block; color:#61778a; font-weight:500; }
.newsletter-photo-badge {
  display:inline-flex;
  align-items:center;
  flex:0 0 auto;
  padding:5px 9px;
  border-radius:999px;
  background:#e7f5fb;
  color:#126184;
  font-size:.75rem;
  font-weight:700;
}
.newsletter-photo-badge.highlight { background:#fff2c5; color:#795800; }
.newsletter-section-photo-upload {
  margin-top:10px;
  padding:11px 12px;
  border:1px dashed #bdd9e8;
  border-radius:14px;
  background:#f9fcfe;
}
.newsletter-existing-section-photos,
.newsletter-content-photo-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
  gap:8px;
  margin:10px 0;
}
.newsletter-existing-section-photos img,
.newsletter-content-photo-grid img {
  width:100%;
  aspect-ratio:4/3;
  object-fit:cover;
  border-radius:11px;
  border:1px solid #d8e6ee;
  background:#fff;
}
.newsletter-highlights-upload { border:2px dashed #e8bd42; background:#fffdf5; }

@media (max-width:700px) {
  .newsletter-content-heading { flex-direction:column; }
  .newsletter-photo-badge { align-self:flex-start; }
}

@media print {
  /* Science WLO: give the narrative columns the space teachers actually use while
     keeping the Grade/Vocabulary/Date metadata compact. */
  .wlo-type-science .wlo-col-selector {
    width: 6.5% !important;
    min-width: 11mm !important;
  }
  .wlo-type-science .wlo-field-learning-objectives {
    width: 19% !important;
  }
  .wlo-type-science .wlo-field-vocabulary {
    width: 8.5% !important;
  }
  .wlo-type-science .wlo-field-reflection {
    width: 17% !important;
  }
  .wlo-table .wlo-col-date {
    width: 6.5% !important;
    min-width: 12mm !important;
    padding-left: 1mm !important;
    padding-right: 1mm !important;
  }
  .wlo-table .wlo-col-makeup {
    width: 10% !important;
  }
}

/* Keep the same WLO proportions on screen so the preview resembles the printout. */
.wlo-type-science .wlo-col-selector { width: 78px; }
.wlo-type-science .wlo-field-learning-objectives { width: 210px; }
.wlo-type-science .wlo-field-vocabulary { width: 112px; }
.wlo-type-science .wlo-field-reflection { width: 190px; }
.wlo-type-science .wlo-col-date { width: 76px; }

/* v4.7.1 notification sound + Windows/PWA attention controls */
.portal-alert-toggle {
  width: 100%;
  justify-content: center;
}
.portal-alert-status {
  display: block;
  min-height: 1.2em;
  margin-top: -0.2rem;
  color: rgba(255,255,255,0.72);
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: center;
}

/* ========================================================================== */
/* v4.7.2 WLO PORTRAIT PRINT + RICH TEXT                                      */
/* ========================================================================== */
.wlo-rich-label { display:grid; gap:7px; font-weight:700; color:var(--nav); }
.wlo-rich-control { border:1px solid #b9d7e5; border-radius:14px; overflow:hidden; background:#fff; box-shadow:0 2px 0 rgba(37,104,145,.04); }
.wlo-rich-toolbar { display:flex; flex-wrap:wrap; gap:6px; align-items:center; padding:7px 9px; background:#f3f9fc; border-bottom:1px solid #cfe3ed; }
.wlo-format-button, .wlo-clear-format { min-height:32px; padding:4px 9px; border:1px solid #b7cfdb; border-radius:8px; background:#fff; color:var(--nav); font:inherit; cursor:pointer; }
.wlo-format-button:hover, .wlo-clear-format:hover { background:#e8f5fb; border-color:#7eb6cf; }
.wlo-toolbar-label { margin-left:4px; color:#5f7885; font-size:.78rem; font-weight:700; }
.wlo-color-button { width:26px; height:26px; padding:0; border:2px solid #fff; outline:1px solid #9bb9c8; border-radius:50%; cursor:pointer; box-shadow:0 1px 2px rgba(0,0,0,.08); }
.wlo-color-button:hover { transform:scale(1.08); }
.wlo-clear-format { margin-left:auto; font-size:.78rem; }
.wlo-rich-surface { min-height:116px; padding:11px 12px; line-height:1.55; font-weight:400; color:#1f2f38; outline:none; overflow-wrap:anywhere; white-space:normal; }
.wlo-rich-surface:focus { box-shadow:inset 0 0 0 2px rgba(43,121,165,.18); }
.wlo-rich-surface:empty::before { content:attr(data-placeholder); color:#8a9ca6; pointer-events:none; }
.wlo-rich-surface p, .wlo-rich-surface div { margin:.15em 0; }
.wlo-long-text p, .wlo-long-text div { margin:.1em 0; }

.wlo-print-sheet { width:min(100%, 820px); margin:0 auto 34px; background:#fff; border:1px solid #dbe7ee; border-radius:18px; padding:26px; box-shadow:0 14px 38px rgba(36,24,21,.09); color:#111; }
.wlo-print-header { display:grid; grid-template-columns:88px 1fr; gap:18px; align-items:center; padding-bottom:14px; border-bottom:3px solid var(--primary); }
.wlo-print-header img { width:82px; height:82px; object-fit:contain; }
.wlo-print-header h1 { margin:0; color:var(--nav); font-size:1.55rem; }
.wlo-print-header p { margin:4px 0 0; color:#58717f; }
.wlo-print-meta { display:grid; grid-template-columns:1fr 1fr; margin:16px 0; border:1px solid #9fc9dc; border-radius:10px; overflow:hidden; }
.wlo-print-meta > div { min-height:58px; padding:9px 12px; border-right:1px solid #cce2ec; border-bottom:1px solid #cce2ec; display:flex; flex-direction:column; gap:4px; }
.wlo-print-meta > div:nth-child(2n) { border-right:0; }
.wlo-print-meta > div:nth-last-child(-n+2) { border-bottom:0; }
.wlo-print-meta > div:last-child:nth-child(odd) { grid-column:1 / -1; border-right:0; }
.wlo-print-meta span { font-size:.75rem; text-transform:uppercase; letter-spacing:.06em; color:#527486; font-weight:700; }
.wlo-print-meta strong { overflow-wrap:anywhere; }
.wlo-print-section { border:1px solid #9fc9dc; border-radius:10px; overflow:hidden; margin:11px 0; break-inside:auto; }
.wlo-print-section > h2 { margin:0; padding:8px 11px; background:#eef8fd; color:var(--nav); font-size:.98rem; border-bottom:1px solid #cce2ec; break-after:avoid; }
.wlo-print-text { padding:10px 12px; overflow-wrap:anywhere; line-height:1.5; white-space:normal; }
.wlo-print-text p, .wlo-print-text div { margin:.15em 0; }
.wlo-print-sheet-multi { break-after:page; page-break-after:always; }
.wlo-print-sheet-multi:last-child { break-after:auto; page-break-after:auto; }

@media (max-width: 760px) {
  .wlo-rich-toolbar { gap:5px; }
  .wlo-clear-format { margin-left:0; }
  .wlo-print-meta { grid-template-columns:1fr; }
  .wlo-print-meta > div { border-right:0; }
  .wlo-print-meta > div:last-child:nth-child(odd) { grid-column:auto; }
}

@media print {
  @page { size:A4 portrait; margin:10mm; }
  html, body { background:#fff !important; }
  .container { max-width:none !important; width:100% !important; margin:0 !important; padding:0 !important; }
  .wlo-print-sheet { width:100% !important; max-width:none !important; margin:0 !important; padding:0 !important; border:0 !important; border-radius:0 !important; box-shadow:none !important; font-family:"Playpen Sans", "Segoe UI", Arial, sans-serif; }
  .wlo-print-header { grid-template-columns:22mm 1fr; gap:5mm; padding-bottom:3mm; }
  .wlo-print-header img { width:20mm; height:20mm; }
  .wlo-print-header h1 { font-size:16pt; }
  .wlo-print-header p { font-size:8.5pt; }
  .wlo-print-meta { margin:4mm 0 3mm; border-color:#888; }
  .wlo-print-meta > div { min-height:11mm; padding:2mm 3mm; border-color:#bbb; }
  .wlo-print-meta span { font-size:7pt; }
  .wlo-print-meta strong { font-size:9pt; }
  .wlo-print-section { margin:2.2mm 0; border-color:#888; border-radius:2mm; }
  .wlo-print-section > h2 { padding:1.8mm 2.5mm; font-size:9pt; background:#f3f3f3 !important; border-color:#bbb; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .wlo-print-text { padding:2mm 3mm; font-size:8.5pt; line-height:1.35; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .wlo-print-text span, .wlo-print-text font { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  /* Old wide WLO table is screen-only now; portrait printing uses WLO sheets. */
  .wlo-table-panel, .print-report-header { display:none !important; }
}

/* ========================================================================== */
/* v4.7.3 NEWSLETTER RICH TEXT + WLO PRINT/PDF ALIGNMENT                     */
/* ========================================================================== */
.newsletter-builder .wlo-rich-control { margin-top: 2px; }
.newsletter-builder .wlo-rich-surface { min-height: 132px; }
.newsletter-builder .wlo-rich-label { gap: 6px; }
.newsletter-rich-preview { line-height: 1.55; overflow-wrap: anywhere; color: var(--ink); }
.newsletter-rich-preview p,
.newsletter-rich-preview div { margin: .18em 0; }

/* Explicit two-column WLO metadata. The left stack is Teacher / Week / Lesson;
   the right stack is WLO Format / Date / Lesson Make-up. */
.wlo-print-meta-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #9fc9dc;
  border-radius: 10px;
  overflow: hidden;
}
.wlo-print-meta-columns > .wlo-print-meta-column {
  min-height: 0;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-rows: repeat(3, minmax(58px, auto));
  gap: 0;
}
.wlo-print-meta-columns > .wlo-print-meta-column:first-child {
  border-right: 1px solid #cce2ec;
}
.wlo-print-meta-columns .wlo-print-meta-item {
  min-height: 58px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid #cce2ec;
}
.wlo-print-meta-columns .wlo-print-meta-item:last-child { border-bottom: 0; }

@media (max-width: 760px) {
  .wlo-print-meta-columns { grid-template-columns: 1fr; }
  .wlo-print-meta-columns > .wlo-print-meta-column:first-child {
    border-right: 0;
    border-bottom: 1px solid #cce2ec;
  }
}

@media print {
  .wlo-print-meta-columns { grid-template-columns: 1fr 1fr !important; }
  .wlo-print-meta-columns > .wlo-print-meta-column {
    grid-template-rows: repeat(3, minmax(11mm, auto));
  }
  .wlo-print-meta-columns > .wlo-print-meta-column:first-child {
    border-right: 1px solid #bbb !important;
    border-bottom: 0 !important;
  }
  .wlo-print-meta-columns .wlo-print-meta-item {
    min-height: 11mm;
    padding: 2mm 3mm;
    border-bottom-color: #bbb;
  }
}

/* v4.8.0 OBSERVER + STUDENT POOL */
.observer-readonly-note {
  border-left: 4px solid var(--info-blue, #16a5d8);
  padding: .75rem 1rem;
  border-radius: 12px;
  background: rgba(230,247,255,.72);
}
.student-pool-table td { vertical-align: top; }
.pool-assign-form { display: grid; grid-template-columns: minmax(210px, 1fr) auto; gap: .55rem; align-items: center; }
.pool-assign-form select { min-width: 0; width: 100%; }
.pool-report-links { white-space: nowrap; }
@media (max-width: 820px) {
  .pool-assign-form { grid-template-columns: 1fr; }
  .student-pool-table { min-width: 880px; }
}
