/* ================================
   PASSFAN Admin App
   Clean Production Stylesheet
================================ */

/* ========= Root Variables ========= */

:root {
  --bg: #0b0f18;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;

  --red: #b91c1c;
  --red2: #7f1d1d;

  --border: #1f2937;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);

  /* Calendar */
  --calHeaderH: 44px;
  --calSlotH: 40px;
  --calTimeW: 64px;
}

/* ========= Base ========= */

.authLoginPage .trustedMobileRestore { display: none; }
.trustedMobileRestorePending .authLoginPage main > .authCard:not(.trustedMobileRestore) { display: none; }
.trustedMobileRestorePending .authLoginPage .trustedMobileRestore { display: block; }

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ========= Top Bar ========= */

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: linear-gradient(90deg, var(--red), var(--red2));
  color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, .55);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  font-weight: 800;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appVersion {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  background: rgba(0, 0, 0, .24);
  color: rgba(255, 255, 255, .88);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.btnLatestApp {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.btnLatestApp:disabled {
  cursor: wait;
  opacity: .7;
}

.systemHealth {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--pf-text-muted, #64748b);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.systemHealthLight {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .15);
}

.systemHealth.isOnline .systemHealthLight {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .16);
}

#btnNotifications.notificationsOn {
  color: #15803d;
  border-color: rgba(22, 163, 74, .32);
  background: rgba(22, 163, 74, .12);
}

#btnNotifications.notificationsOff {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, .28);
  background: rgba(220, 38, 38, .1);
}

.backupSettingsBlock {
  margin-top: 22px;
}

.backupList {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.backupRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
}

.backupRow > div {
  min-width: 0;
}

.backupActions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.dangerBtn {
  border-color: rgba(255, 110, 110, .55);
  color: #ffd0d0;
}

/* ========= Buttons ========= */

.btn {
  border: 1px solid transparent;
  background: var(--pf-primary, #2563eb);
  color: var(--pf-text-on-primary, #fff);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btnSecondary {
  border-color: var(--pf-border, #e2e8f0);
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #0f172a);
}

.btn:active {
  transform: translateY(1px);
}

.menuToggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .25);
  color: #fff;
  font-size: 14px;
  padding: 0;
}

/* ========= Layout ========= */

.layout {
  display: flex;
  gap: 16px;
  padding: 16px;
  align-items: flex-start;
}

.sidebar {
  width: 240px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  padding: 12px;
  height: fit-content;
}

.navItem {
  width: 100%;
  padding: 14px 12px;
  margin: 6px 0;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(229, 231, 235, .92);
  cursor: pointer;
}

.navItem:hover {
  background: rgba(255, 255, 255, .06);
}

.navItem.active {
  background: rgba(185, 28, 28, .30);
  border-color: rgba(185, 28, 28, .55);
  color: #fff;
}

.main {
  flex: 1;
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* ========= Typography ========= */

h2 {
  margin: 8px 0 12px;
  font-size: 36px;
}

.muted {
  margin: 0 0 12px;
  color: rgba(229, 231, 235, .70);
}

/* ========= Cards ========= */

.card {
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.cardValue {
  font-size: 28px;
  font-weight: 900;
  margin-top: 6px;
}

/* ========= Forms ========= */

.formGrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 16px 0;
}

label {
  font-size: 13px;
  color: rgba(229, 231, 235, .80);
}

input,
select {
  width: 100%;
  margin-top: 6px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--pf-border, #e2e8f0);
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #0f172a);
}

.actionsRow {
  display: flex;
  gap: 10px;
  margin: 10px 0;
}

.hidden {
  display: none !important;
}

.msg {
  margin: 8px 0 12px;
  min-height: 20px;
}

.msgOk {
  color: #86efac;
}

.msgError {
  color: #fca5a5;
}

.authPage {
  max-width: 860px;
  padding-top: 28px;
}

.authCard h1 {
  margin-top: 0;
}

.loginStep {
  display: grid;
  gap: 16px;
  margin: 16px 0;
}

.checkboxLine {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkboxLine input {
  width: auto;
  margin: 0;
}

.span2 {
  grid-column: span 2;
}

@media (max-width: 720px) {
  .span2 {
    grid-column: span 1;
  }
}

/* ========= Tables ========= */

.tableWrap {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  background: rgba(255, 255, 255, .02);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: 14px;
}

th {
  text-align: left;
  color: rgba(229, 231, 235, .70);
  font-weight: 700;
}

.lessonPaymentReconcileReview {
  display: grid;
  gap: 10px;
  margin: 12px 0 18px;
}

.lessonPaymentReconcileReview.hidden { display: none; }

.lessonPaymentReconcileReview h3,
.lessonPaymentReconcileItem p { margin: 0; }

.lessonPaymentReconcileItem {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border, rgba(15, 23, 42, .12));
  border-radius: 14px;
  background: var(--card, #fff);
}

.lessonPaymentReconcileItem label {
  display: grid;
  gap: 5px;
}

@media (min-width: 700px) {
  .lessonListTable {
    min-width: 720px;
    table-layout: auto;
  }

  .lessonListTable th {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
  }

  .lessonListTable :is(th, td):nth-child(1) { min-width: 92px; }
  .lessonListTable :is(th, td):nth-child(2) { min-width: 62px; }
  .lessonListTable :is(th, td):nth-child(4) { min-width: 54px; }
  .lessonListTable :is(th, td):nth-child(5) { min-width: 64px; }
  .lessonListTable :is(th, td):nth-child(6) { min-width: 82px; }
  .lessonListTable :is(th, td):nth-child(3),
  .lessonListTable :is(th, td):nth-child(7) { min-width: 104px; }
}

@media (max-width: 699px) {
  .lessonPaymentReconcileItem {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.summaryRow {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  background: rgba(255, 255, 255, .02);
  font-weight: 700;
}

#view-pupils .pupilsTableWrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#view-pupils .pupilsTable {
  min-width: 1240px;
  table-layout: auto;
}

#view-pupils .pupilsTable th {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

#view-pupils .pupilsTable td {
  vertical-align: middle;
}

#view-pupils .pupilsTable td:nth-child(1) {
  min-width: 130px;
}

#view-pupils .pupilsTable td:nth-child(2) {
  min-width: 118px;
}

#view-pupils .pupilsTable td:nth-child(3) {
  min-width: 210px;
}

#view-pupils .pupilsTable th:nth-child(7),
#view-pupils .pupilsTable td:nth-child(7) {
  min-width: 112px;
}

#view-pupils .pupilsTable th:nth-child(8),
#view-pupils .pupilsTable td:nth-child(8),
#view-pupils .pupilsTable th:nth-child(9),
#view-pupils .pupilsTable td:nth-child(9),
#view-pupils .pupilsTable th:nth-child(10),
#view-pupils .pupilsTable td:nth-child(10) {
  min-width: 86px;
}

#view-pupils .pupilsTable th:nth-child(11),
#view-pupils .pupilsTable td:nth-child(11) {
  min-width: 270px;
}

#view-pupils .pupilsTable td:nth-child(11) .btn {
  margin: 0 6px 6px 0 !important;
}

/* ========= Modal ========= */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}

.modalCard {
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #0f172a);
  padding: 24px;
  border: 1px solid var(--pf-border, #e2e8f0);
  border-radius: var(--pf-radius-lg, 16px);
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--pf-shadow-lg, 0 16px 40px rgba(15, 23, 42, .10));
  box-sizing: border-box;
}

/* ========= Accounts Summary ========= */
.expTopRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

@media (max-width: 520px) {
  .expTopRow {
    flex-direction: column;
    align-items: stretch;
  }

  .expTopRow .btn {
    width: 100%;
  }
}

.accountsSummaryCard {
  background: linear-gradient(145deg, #1b2742, #162138);
  padding: 22px;
  border-radius: 14px;
  margin-bottom: 22px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .05);
}

.summaryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
}

.posProfit {
  color: #4ade80;
}

.negProfit {
  color: #f87171;
}

/* ========= Dashboard ========= */

.dash-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 25px;
}

.dash-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 25px;
}

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

.dash-card {
  background: #1c2333;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}

.dashboardMetricGrid {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dashboardMetricGrid .dashboardMetricCard {
  appearance: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 82px;
  padding: 10px 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  color: inherit;
  text-align: left;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dashboardMetricCard:hover { border-color: rgba(255, 255, 255, .28); }
.dashboardMetricCard:focus-visible { outline: 3px solid #60a5fa; outline-offset: 2px; }
.dashboardMetricCard .dash-label { min-height: 2.3em; margin-bottom: 0; font-size: 13px; line-height: 1.15; white-space: normal; overflow-wrap: anywhere; }
.dashboardMetricCard .dash-value { margin-top: 2px; font-size: clamp(28px, 7.2vw, 32px); line-height: 1; white-space: normal; overflow-wrap: anywhere; }
.dashboardMetricCard .dashboardMetricValueLong { font-size: clamp(20px, 5.25vw, 25px); letter-spacing: -.02em; }
.dashboardMetricCard .dash-subvalue { margin-top: 2px; font-size: 10.5px; line-height: 1.12; white-space: normal; overflow-wrap: anywhere; }

.normalHomeDashboard,
.weeklySnapshot,
.waitingListSection { width: 100%; max-width: 100%; min-width: 0; }
.weeklySnapshot { margin-top: 12px; padding: 14px; }
.weeklySnapshotHeader { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.weeklySnapshotHeader h3, .weeklySnapshotHeader p { margin: 0; }
.weeklySnapshotHeader p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.weeklySnapshotTabs { display: flex; flex: 0 0 auto; gap: 4px; padding: 3px; border-radius: 9px; background: rgba(255,255,255,.07); }
.weeklySnapshotTabs button { min-height: 34px; padding: 6px 9px; border-radius: 7px; font-size: 12px; }
.weeklySnapshotTabs button[aria-selected="true"] { background: #fff; color: #111827; }
.weeklySnapshotValues { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; }
.weeklySnapshotValues div { min-width: 0; padding: 8px; border-radius: 8px; background: rgba(255,255,255,.05); }
.weeklySnapshotValues dt { color: var(--muted); font-size: 11px; line-height: 1.15; }
.weeklySnapshotValues dd { margin: 4px 0 0; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.teachingModeHome { display: none; }
.teachingModeBadge { display: inline-flex; margin-bottom: 10px; padding: 6px 10px; border-radius: 999px; background: #fef3c7; color: #78350f; font-weight: 800; }
body.teachingModeActive #view-dashboard .normalHomeDashboard,
body.teachingModeActive #view-dashboard .dashboardPrimaryAction,
body.teachingModeActive #view-dashboard #lessonSummaryNotice { display: none !important; }
body.teachingModeActive #view-dashboard .teachingModeHome { display: block; }
body.homePrivacyPending:not(.teachingModeActive) #view-dashboard .normalHomeDashboard { display: block; }
body.homePrivacyPending:not(.teachingModeActive) #view-dashboard .dashboardPrimaryAction { display: flex; }
body.homePrivacyPending #view-dashboard #dashIncome,
body.homePrivacyPending #view-dashboard #dashDue,
body.homePrivacyPending #view-dashboard .weeklySnapshotValues { visibility: hidden; }
body.homePrivacyPending #view-dashboard #lessonSummaryNotice { display: none !important; }
.homeLocalStatus { margin: 0 0 10px; padding: 9px 10px; border-radius: 8px; background: rgba(255,255,255,.06); }
.teachingModeLessonGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.teachingModeLessonGrid section { padding: 10px; border-radius: 8px; background: rgba(255,255,255,.05); }
.teachingModeLessonGrid h4, .teachingModeLessonGrid p { margin: 0; }
.teachingModeLessonGrid p { margin-top: 4px; }

.dash-value {
  font-size: 28px;
  font-weight: 600;
}

.dash-subvalue {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.waitingListSection {
  width: 100%;
  margin-top: 25px;
}

.waitingListHeader,
.waitingListHeaderActions,
.waitingListMain,
.waitingListActions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.waitingListHeader {
  justify-content: space-between;
  flex-wrap: wrap;
}

.waitingListHeader h3,
.waitingListHeader p {
  margin: 0;
}

.waitingListHeaderActions {
  flex-wrap: wrap;
}

.waitingListHeaderActions label {
  display: grid;
  gap: 4px;
}

.waitingListAddForm {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.waitingListAddForm label {
  display: grid;
  gap: 5px;
}

.waitingListAddForm .waitingPreferred {
  grid-column: span 2;
}

.waitingListRows {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.waitingListRow {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
}

.waitingListMain {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.waitingStatus,
.waitingAttention {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 700;
}

.waitingStatus {
  background: rgba(37, 99, 235, .18);
  color: #93c5fd;
}

.waitingAttention {
  background: rgba(239, 68, 68, .18);
  color: #fca5a5;
}

.waitingListDetails {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.waitingListDetails div {
  min-width: 0;
}

.waitingListDetails dt {
  color: var(--muted);
  font-size: 13px;
}

.waitingListDetails dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.waitingListActions {
  flex-wrap: wrap;
}

.waitingListHeaderActions button,
.waitingListActions button {
  min-height: 44px;
  border: 1px solid var(--pf-border, #d9e1ec);
  border-radius: 10px;
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #0f172a);
  padding: 9px 12px;
  font: inherit;
  font-weight: 700;
}

.waitingListEmpty {
  color: var(--muted);
  padding: 18px 0;
}

#view-pupils .studentsWaitingRow > td {
  padding: 10px 0;
  white-space: normal;
}

#view-pupils .studentsWaitingRow .waitingListRow {
  min-width: 0;
  overflow-wrap: anywhere;
}

#view-pupils .studentsWaitingRow .waitingListActions {
  display: flex;
  min-width: 0;
}

/* ========= Mobile ========= */

@media (max-width:860px) {

  .waitingListAddForm,
  .waitingListDetails {
    grid-template-columns: 1fr;
  }

  .waitingListAddForm .waitingPreferred {
    grid-column: auto;
  }

  .waitingListHeaderActions,
  .waitingListHeaderActions label,
  .waitingListHeaderActions select,
  .waitingListHeaderActions button,
  .waitingListActions button {
    width: 100%;
    min-height: 44px;
  }

  .weeklySnapshotTabs button {
    min-height: 44px;
  }

  .pCalWeek {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .menuToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .layout {
    padding: 12px;
    gap: 12px;
  }

  .sidebar {
    position: fixed;
    left: 12px;
    top: 68px;
    bottom: 12px;
    width: min(320px, calc(100vw - 24px));
    z-index: 90;
    transform: translateX(-120%);
    transition: transform .2s ease;
    background: rgba(17, 24, 39, .98);
  }

  body.sidebarOpen .sidebar {
    transform: translateX(0);
  }

  body.sidebarOpen::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 85;
  }

  :root {
    --calTimeW: 52px;
    --calSlotH: 20px;
    --calHeaderH: 38px;
  }

}



/* ===== Grid ===== */

.pCalGridWrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
}

.pCalGrid {
  position: relative;
  display: grid;
  width: 100%;
  min-height: calc(var(--calSlotH) * 56);
}

/* week / day views */

.pCalWeek {
  grid-template-columns: repeat(7, minmax(140px, 1fr));
}

.pCalDay {
  grid-template-columns: 1fr;
}

/* ===== Columns ===== */

.pCalCol {
  position: relative;
  min-height: calc(var(--calSlotH) * 56);
  border-right: 1px solid rgba(255, 255, 255, 0.22);
  background: #11161d;
}

.pCalCol:last-child {
  border-right: none;
}

/* ===== Sticky header ===== */

.pCalColHeader {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #0b1220;
}

/* ===== Slots ===== */

.pCalSlots {
  position: relative;
}

.pCalSlotRow {
  height: var(--calSlotH);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===== Events ===== */

.pCalEvent {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 6px;
  z-index: 10;
  touch-action: pan-x pan-y;

  background-image: linear-gradient(to bottom,
      rgba(255, 255, 255, 0.18) 0%,
      rgba(255, 255, 255, 0.06) 35%,
      rgba(0, 0, 0, 0.15) 100%);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -3px 5px rgba(0, 0, 0, 0.45),
    0 4px 10px rgba(0, 0, 0, 0.45);
}

.pCalEventTitle {
  font-size: 12px;
  font-weight: 700;
}

.pCalEventTime {
  font-size: 11px;
  opacity: 0.9;
}

.pCalBadge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

/* ===== Event colours ===== */

.pCalEvent.isPaid {
  background: rgba(34, 197, 94, 0.18);
  border: 2px solid rgba(34, 197, 94, 0.35);
}

.pCalEvent.isPaid .pCalBadge {
  background: rgba(34, 197, 94, 0.55);
  color: #06130a;
}

.pCalEvent.isUnpaid {
  background: rgba(220, 40, 60, 0.22);
  border: 2px solid rgba(220, 40, 60, 0.55);
}

.pCalEvent.isUnpaid .pCalBadge {
  background: rgba(255, 0, 90, 0.55);
}

.pCalEvent.isTest {
  background: rgba(245, 158, 11, 0.20);
  border: 2px solid rgba(245, 158, 11, 0.45);
}

.pCalEvent.isTest .pCalBadge {
  background: rgba(245, 158, 11, 0.75);
  color: #1a1200;
}

/* ===== Now line ===== */

.pCalNowLine {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--red);
  z-index: 25;
}

.pCalNowLabel {
  position: absolute;
  right: 8px;
  top: -10px;
  font-size: 11px;
  font-weight: 800;
  background: var(--red);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ===== Mobile ===== */

@media (max-width:860px) {

  :root {
    --calTimeW: 52px;
    --calSlotH: 20px;
    --calHeaderH: 38px;
  }

  .pCalColHeader {
    font-size: 11px;
  }

  .pCalEventTitle {
    font-size: 10px;
  }

  .pCalEventTime {
    font-size: 10px;
  }

}

@media (max-width:600px) {

  :root {
    --calTimeW: 40px;
  }

}

/* Highlight lesson being dragged */
.draggingLesson .pCalEvent {
  opacity: 0.85;
}


.draggingLesson .pCalEvent:active,
.draggingLesson .pCalEvent.dragging {
  transform: scale(1.04);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 50;
}

/* Disable text selection in calendar */
.pCal {
  -webkit-user-select: none;
  user-select: none;
}

/* ========= Accounts Tabs (matches accounts.js) ========= */

.accountsTabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.aTab {
  padding: 6px 12px;
  background: #1e2a3b;
  border: 1px solid #2f4058;
  color: #fff;
  cursor: pointer;
  border-radius: 999px;
}

.aTab:hover {
  background: #2a3a50;
}

.aTab.isActive {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.accountsBody {
  overflow: auto;
}

@media (max-width: 860px) {

  .dash-grid-4,
  .dash-grid-3,
  .dash-grid-2 {
    gap: 12px;
  }

  .dash-card {
    padding: 14px;
  }

  .dashboardMetricCard {
    padding: 10px 8px;
  }

  .dash-value {
    font-size: 22px;
  }

  h2 {
    font-size: 28px;
  }

}

@media (max-width: 560px) {
  .weeklySnapshotHeader { display: block; }
  .weeklySnapshotTabs { margin-top: 10px; width: 100%; }
  .weeklySnapshotTabs button { flex: 1; }
  .weeklySnapshotValues { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 340px) {
  .dashboardMetricGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Accounts filter layout tidy */
.accountsFilters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  max-width: 700px;
  margin-bottom: 24px;
}

.accountsFilters .aLabel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.accountsFilters input[type="date"] {
  width: 150px;
  max-width: 100%;
}

.dateWrap {
  position: relative;
  display: inline-block;
}

.dateWrap input[type="date"] {
  padding-right: 36px;
}

.dateIcon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 16px;
  opacity: 0.8;
}

.dateIcon:hover {
  opacity: 1;
}

/* Mobile layout fix for Accounts date filters */
@media (max-width: 600px) {

  .accountsFilters {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .accountsFilters input[type="date"] {
    width: 100%;
  }

  .accountsFilters .btnSecondary,
  .accountsFilters .btnPrimary {
    width: 100%;
  }

}

.accountsTwoCol {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 30px;
  margin-top: 25px;
  width: 100%;
  max-width: 100%;
}

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

.accountsTwoCol .table {
  width: 100%;
  table-layout: fixed;
}

.accountsTwoCol th,
.accountsTwoCol td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accountsBody {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Accounts two column tables, stop sideways scroll, allow vertical scroll */
.accountsTwoCol>div {
  min-width: 0;
}

.accountsTwoCol .tableWrap {
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 420px;
}

.accountsTwoCol .table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
}

/* Floating Add Button */
.fabAdd {
  position: fixed;
  right: 25px;
  bottom: 25px;
  width: 56px;
  height: 56px;
  background: #ed0000;
  color: white;
  font-size: 28px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 999;
  border: 0;
  padding: 0;
  font-family: inherit;
}

.fabAdd:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .55);
  outline-offset: 3px;
}

.fabAdd.isDragging {
  cursor: grabbing;
  transform: scale(1.03);
}

body.modalOpen .fabAdd {
  display: none;
}

.fabAdd:hover {
  transform: translateY(-2px);
}

/* Overlay */
.fabOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 998;
}

.fabOverlay.hidden {
  display: none;
}

.fabPanel {
  background: #1a2332;
  width: 90%;
  max-width: 420px;
  padding: 25px;
  border-radius: 14px;
}

.fabPrimaryShortcut {
  width: 100%;
  min-height: 40px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  background: #243049;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.fabPrimaryShortcut:hover {
  background: #2f3d5c;
}

.fabGrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.fabGrid button {
  background: #243049;
  border: none;
  color: white;
  padding: 18px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}

.fabGrid button:hover {
  background: #2f3d5c;
}

.userIdentity {
  margin-left: auto;
  margin-right: 16px;
  text-align: right;
  font-size: 14px;
  opacity: 0.85;
}

.userIdentity strong {
  display: block;
  font-weight: 600;
}

/* ===== Logo ===== */


.brandLogo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

/* ========= Mobile Topbar Tidy ========= */
@media (max-width: 860px) {

  .brandLogo {
    height: 22px;
  }

  .userIdentity {
    display: none;
  }

  .appVersion {
    padding: 4px 7px;
    font-size: 11px;
  }

  .btnLatestApp {
    padding: 4px 7px;
    font-size: 11px;
  }

  .backupRow {
    align-items: stretch;
    flex-direction: column;
  }

  .backupActions {
    width: 100%;
  }

  .backupActions .btn {
    flex: 1;
  }

}

.accountsTopRow {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}

.accountsPresets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.accountsDateInline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.accountsExportActions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.accountsExportActions .btnPrimary,
.accountsExportActions .btn {
  min-height: 44px;
  white-space: normal;
}

.expenseSplitToggle {
  margin-top: 12px;
}

.expenseSplitFields {
  margin-top: 8px;
}

.receiptCropCard {
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.receiptCropCanvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 68vh;
  margin-inline: auto;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: #05070b;
  touch-action: none;
}

.receiptCropActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.receiptCropActions .btn {
  min-height: 44px;
}

.dash-card.lessonSummaryNotice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 0;
  margin: 0 0 10px;
  padding: 11px 14px;
  border-color: rgba(251, 191, 36, .45);
  background: rgba(251, 191, 36, .10);
}

.lessonSummaryNotice h3 {
  margin: 0 0 2px;
  font-size: 1rem;
  line-height: 1.2;
}

.pf-secondary-text,
.lessonSummaryNotice p {
  margin: 0;
  color: var(--pf-text-muted, #64748b);
  line-height: 1.3;
}

.lessonSummaryNotice .btn {
  min-width: 112px;
  min-height: 44px;
  padding: 8px 12px;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .dash-card.lessonSummaryNotice {
    grid-template-columns: minmax(0, 1fr) minmax(96px, auto);
    padding-inline: 11px;
  }

  .lessonSummaryNotice .btn {
    min-width: 96px;
  }
}

.lessonSummaryCard {
  width: min(880px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.lessonSummaryCard label {
  display: block;
  margin-top: 14px;
  font-weight: 700;
}

.lessonSummaryCard textarea,
.lessonSummaryCard input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(0, 0, 0, .28);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

.lessonSummaryPrimaryLabel {
  margin-top: 18px;
  font-size: 15px;
}

.lessonSummaryPrimaryInput {
  min-height: 200px;
  resize: none;
}

.lessonSummaryPrimaryInput::placeholder {
  color: rgba(229, 231, 235, .52);
  white-space: pre-line;
}

.lessonSummaryGenerateActions {
  margin-top: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.lessonSummaryGeneratedSection {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}

.lessonSummaryGeneratedSection h4 {
  margin: 0 0 8px;
}

.lessonSummaryGeneratedSection textarea {
  min-height: 120px;
  resize: none;
}

.lessonSummaryGeneratedSection input {
  min-height: 46px;
}

.lessonNoteStage h4,
.lessonSummaryGeneratedSection h4 {
  margin: 0 0 8px;
}

.lessonNoteReviewActions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lessonNoteReviewActions .btn {
  width: 100%;
  min-width: 0;
}

.lessonNoteNextPlan {
  margin-top: 12px;
}

.lessonSummaryCard textarea[readonly] {
  background: color-mix(in srgb, var(--pf-surface-2, #182235) 82%, transparent);
}

.lessonSummaryFooter {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
  flex-wrap: wrap;
}

.lessonPupilLoadState {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--muted, #64748b);
  font-size: 14px;
}

.lessonHomeworkChoices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.lessonHomeworkChoice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 12px;
}

.lessonAssistantChips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lessonAssistantChipField { margin-top: 12px; }
.lessonAssistantChipField h4 { margin: 0 0 6px; }
.lessonAssistantChipRow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.lessonAssistantChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 36px;
  padding: 4px 7px 4px 10px;
  border: 1px solid var(--line, #d8e1ee);
  border-radius: 999px;
  background: #eef5ff;
  color: var(--ink, #0c1730);
}

.lessonAssistantChip > span { min-width: 0; overflow-wrap: normal; word-break: normal; }

.lessonAssistantChip button {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
}

.lessonAssistantAddChip {
  min-height: 44px;
  padding: 5px 11px;
  border: 1px dashed var(--line, #b8c6da);
  border-radius: 999px;
  background: transparent;
  color: var(--primary, #2563eb);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.lessonSummaryCard { width: min(94vw, 560px); max-height: min(92vh, 760px); }
.lessonSummaryBody { overflow-y: auto; }
.lessonSummaryBody > h3 { margin-bottom: 2px; }
.lessonSummaryBody #lessonSummaryLessonLine { margin: 0 0 10px; }
.lessonSummaryOptionalLabel { display: block; margin-top: 10px; }
.lessonSummaryOptionalInput { min-height: 64px; }
#lessonSummaryStudent { min-height: 76px; }
.lessonSubjectPicker { z-index: 10020; }
.lessonSubjectPickerCard { width: min(94vw, 520px); max-height: min(88vh, 720px); display: flex; flex-direction: column; padding: 16px; }
.lessonSubjectPickerHeader { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lessonSubjectPickerHeader h3, .lessonSubjectPickerHeader p { margin: 0 0 4px; }
.lessonSubjectPickerHeader button { min-height: 44px; border: 0; background: transparent; color: var(--primary, #2563eb); font-weight: 700; }
.lessonSubjectSearch { display: grid; gap: 5px; margin: 8px 0 10px; font-weight: 700; }
.lessonSubjectSearch input { min-height: 44px; }
.lessonSubjectOptions { overflow-y: auto; border-block: 1px solid var(--line, #d8e1ee); padding: 6px 0; }
.lessonSubjectOptions section + section { margin-top: 10px; }
.lessonSubjectOptions h4 { margin: 4px 8px; color: var(--muted, #64748b); font-size: 13px; }
.lessonSubjectOption { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 7px 8px; border-radius: 10px; }
.lessonSubjectOption:has(input:checked) { background: #eef5ff; color: var(--primary, #2563eb); font-weight: 700; }
.lessonSubjectOption input { width: 20px; height: 20px; flex: 0 0 auto; }
.lessonSubjectPickerDone { width: 100%; min-height: 48px; margin-top: 12px; }
@media (max-width: 430px) {
  .lessonAssistantChip { max-width: min(100%, 290px); }
  .lessonAssistantChip button { min-width: 36px; min-height: 36px; margin: -4px -4px -4px 0; }
}

.lessonAssistantSecondaryActions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 2px;
  color: var(--muted, #64748b);
}

.lessonAssistantSecondaryActions button {
  min-height: 36px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--primary, #2563eb);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.lessonSummaryPrivateSection { margin-top: 10px; }
.lessonSummaryPrivateSection .fieldHelp { color: var(--muted, #64748b); }

#lessonSummaryStudent {
  min-height: 96px;
  max-height: 240px;
  overflow-y: auto;
  resize: vertical;
}

#lessonAssistantSuggestions {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line, #d8e1ee);
  border-radius: 14px;
}

#lessonAssistantSuggestions > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 700;
  cursor: pointer;
}

.lessonPupilLoadState .btn {
  min-height: 32px;
  padding: 5px 12px;
}

.lessonPupilSpinner {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--primary, #2563eb);
  border-radius: 50%;
  animation: lessonPupilSpin .7s linear infinite;
}

@keyframes lessonPupilSpin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .lessonPupilSpinner { animation: none; }
}

.fieldHelp {
  margin-top: 4px;
  color: var(--pf-text-muted, #64748b);
  font-size: 12px;
}

@media (max-width: 768px) {
  .lessonSummaryCard {
    width: min(100%, calc(100vw - 24px));
    padding: 16px;
  }

  .lessonSummaryPrimaryInput {
    min-height: 180px;
  }

  .lessonSummaryFooter button,
  .lessonSummaryGenerateActions button {
    min-height: 44px;
  }

  .lessonNoteReviewActions {
    grid-template-columns: 1fr;
  }
}

.dateField {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--pf-text-muted, #64748b);
}

.dateField input {
  min-width: 140px;
}

@media (max-width: 768px) {

  .accountsTopRow {
    flex-direction: column;
    align-items: stretch;
  }

  .accountsDateInline {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .dateField {
    flex: 1;
    min-width: 130px;
  }

  .accountsExportActions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  .accountsExportActions .btnPrimary,
  .accountsExportActions .btn {
    width: 100%;
    min-height: 48px;
  }

}

.modal,
.modal * {
  -webkit-user-select: none;
  user-select: none;
}

/* ===== Final mobile calendar width override ===== */





.lessonGrid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.lessonGrid input,
.lessonGrid select {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #3a3f55;
  background: #232838;
  color: white;
}

.dayView {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: #f3f4f6;
}

.dayViewPupil {
  display: inline-block;
  background: #1f7a3a;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 6px;
}

.dayViewTimes {
  position: relative;
  height: 24px;
  background: #1f1f1f;
  border-radius: 6px;
  padding: 4px;
  z-index: 0;
  overflow: hidden;
}

.dayViewTimes span {
  position: absolute;
  font-size: 11px;
  transform: translateX(-50%);
  white-space: nowrap;
  opacity: 0.9;
  color: var(--pf-text-muted, #64748b);
  z-index: 2;
  pointer-events: none;
}



.timelineBusy {
  position: absolute;
  height: 10px;
  top: 7px;
  background: #ff4d4d;
  border-radius: 4px;
  opacity: 0.9;
  z-index: 1;
  opacity: 0.85;
}

.dayViewWrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dayViewTimes {
  position: relative;
  height: 16px;
}

.dayViewTimes span {
  position: absolute;
  font-size: 11px;
  transform: translateX(-50%);
  color: #aaa;
}

.dayViewBar {
  position: relative;
  height: 12px;
  background: #1f1f1f;
  border-radius: 6px;
  overflow: hidden;
}

.timelineBusy {
  position: absolute;
  height: 100%;
  border-radius: 4px;
  opacity: 0.85;
}

/* MOBILE MODAL LAYOUT */

@media (max-width: 700px) {

  .modalCard {
    width: 95%;
    max-width: 420px;
    padding: 18px;
  }

  .formGrid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .formGrid label {
    margin-top: 6px;
  }

  #creditInfo {
    order: 2;
    font-size: 0.9rem;
    opacity: 0.8;
  }

  .dayViewTimes {
    margin-top: 4px;
  }

  .modalCard button {
    width: 100%;
    margin-top: 6px;
  }

}

/* v10.4.67 PF-UI-004: compact Calendar chrome without changing Calendar state. */
#view-calendar .calendarControls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 4px;
}

#view-calendar .calendarControls .calNav,
#view-calendar .calendarControls .calModes {
  display: flex;
  flex: 0 1 240px;
  flex-wrap: nowrap;
  gap: 3px;
  min-width: 0;
}

#view-calendar .calendarControls .calNav button,
#view-calendar .calendarControls .calModes button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 42px;
  height: 42px;
  padding: 5px 4px;
}

#view-calendar .calendarControls .calendarTeachingMode {
  flex: 0 0 auto;
  min-height: 42px;
  height: 42px;
  max-height: 42px;
  margin-left: auto;
  padding: 5px 10px;
}

#view-calendar .calendarControls .calendarTeachingMode[hidden] {
  display: none !important;
}

#view-calendar .calendarSummaryMount {
  position: relative;
  margin-top: 3px;
  padding: 0;
}

#view-calendar .calendarSummaryMount:not(.isCollapsed) .calendarSummaryHeader {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  display: flex;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
}

#view-calendar .calendarSummaryMount:not(.isCollapsed) .calendarSummaryToggle {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
}

#view-calendar .calendarSummaryMount:not(.isCollapsed) .calendarSummaryStrip {
  padding-top: 0;
}

#view-calendar .calendarSummaryMount.isCollapsed {
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  margin: 0;
  overflow: hidden;
  border-top: 1px solid var(--pf-border, #d8dee9);
}

#view-calendar .calendarSummaryMount.isCollapsed .calendarSummaryHeader {
  position: static;
  display: flex;
  justify-content: center;
  width: 100%;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
}

#view-calendar .calendarSummaryMount.isCollapsed .calendarSummaryToggle {
  width: 52px;
  min-width: 52px;
  height: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0 12px;
}

#view-calendar .calendarSummaryMount.isCollapsed .calendarSummaryStrip {
  display: none;
}

@media (max-width: 430px) {
  #view-calendar .calendarControls {
    flex-wrap: nowrap;
  }

  #view-calendar .calendarControls:has(.calendarTeachingMode:not([hidden])) {
    flex-wrap: wrap;
  }

  #view-calendar .calendarControls .calNav,
  #view-calendar .calendarControls .calModes {
    flex: 1 1 0;
  }

  #view-calendar .calendarControls:has(.calendarTeachingMode:not([hidden])) .calendarTeachingMode {
    flex-basis: auto;
  }

  #view-calendar .calendarControls:has(.calendarTeachingMode:not([hidden])) .calNav,
  #view-calendar .calendarControls:has(.calendarTeachingMode:not([hidden])) .calModes {
    flex: 0 0 calc(50% - 2px);
  }

  #view-calendar .calendarControls button {
    font-size: .8rem;
  }
}

.modalActions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.modalActions button {
  flex: 1;
}


/* MOBILE MODAL */

@media (max-width: 700px) {

  .modal {
    align-items: center;
    justify-content: center;
    padding: 16px;
  }

  .modalCard {
    width: 94%;
    max-width: 420px;
    max-height: calc(100vh - 80px);
    padding: 18px;
  }

}

@media (max-width: 700px) {

  .modalCard {
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .formGrid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .actionsRow {
    flex-direction: column;
  }

  .actionsRow .btn {
    width: 100%;
  }

}

/* =========================
   Modal Base
   ========================= */

.modal {
  backdrop-filter: blur(6px);
}

/* iOS style grab handle (mobile only) */

@media (max-width: 700px) {

  .modalCard::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    margin: 0 auto 12px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.35);
  }

}


/* =========================
   Income Modal Layout
   ========================= */

#incomeModal .modalCard {
  width: min(920px, 92vw);
}

#incomeModal .formGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

#incomeModal label {
  font-size: 18px;
}

#incomeModal input,
#incomeModal select {
  min-height: 48px;
  font-size: 18px;
}

#incomeModal .actionsRow {
  margin-top: 20px;
}


/* =========================
   Income Modal Mobile
   ========================= */

@media (max-width: 700px) {

  #incomeModal .modalCard {
    width: 94vw;
    padding: 20px;
  }

  #incomeModal .formGrid {
    grid-template-columns: 1fr;
  }

  #incomeModal label {
    font-size: 16px;
  }

  #incomeModal input,
  #incomeModal select {
    min-height: 46px;
    font-size: 16px;
  }

}


/* =========================
   Form Helpers
   ========================= */

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row select {
  flex: 1;
}

.btnSmall {
  width: 36px;
  padding: 0;
  font-weight: bold;
}

.expensesTable .moneyCell {
  white-space: nowrap;
}

.expensesTable .expenseActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.expensesTable .expenseActions .btnSmall {
  width: auto;
  min-width: 70px;
  padding: 0 10px;
}

.lessonHistoryRow {
  cursor: pointer;
}

.lessonSummaryAction {
  width: auto;
  min-width: 148px;
  padding: 8px 12px;
  white-space: normal;
}


/* =========================
   Modal Stacking
   ========================= */

#categoryModal {
  z-index: 9999;
}


/* =========================
   Calendar Grid
   ========================= */

/* subtle horizontal slot lines */

.pCalSlotRow {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}


/* =========================
   Calendar Mobile Layout
   ========================= */

@media (max-width: 700px) {

  .pCalCol {
    min-width: 90px;
  }

}

.dragGhost {
  border-radius: 6px;
  cursor: grabbing !important;
  will-change: transform, top, left;
  transform: translateZ(0);
}

.dragGhost {
  border-radius: 6px;
  cursor: grabbing !important;
}

body.draggingLesson * {
  cursor: grabbing !important;
  user-select: none;
}

/* Snap line feel â€” optional */
.dragGhost .pCalEventTitle,
.dragGhost .pCalEventTime {
  opacity: 0.9;
}

.lessonSelected {
  outline: 2px solid #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* Fix lesson shrinking during drag */
.draggingLesson .pCalEvent {
  width: auto !important;
}

.pCalGhost {
  position: absolute;
  left: 4px;
  right: 4px;
  border: 2px dashed #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  border-radius: 8px;
  pointer-events: none;
}

.pCalDragTimeLabel {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

/* move bar */
.moveBar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  display: flex;
  justify-content: center;
  gap: 12px;
  background: #111;
  border-top: 1px solid #333;
  z-index: 2000;
}

.moveBar.hidden {
  display: none;
}

.lessonEditing #moveBar {
  display: flex;
}

@media (max-width: 600px) {

  :root {
    --calTimeW: 40px;
  }

  .pCalGrid {
    width: 100%;
  }

  .pCalWeek {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .pCalCol {
    min-width: 0;
  }

  .pCalColHeader {
    font-size: 8px;
  }

  .pCalEvent {
    padding: 2px 3px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
  }

  .pCalEventTitle {
    font-size: 7px;
  }

  .pCalEventTime {
    font-size: 6px;
  }

  .pCalBadge {
    font-size: 8px;
    padding: 1px 2px;
    letter-spacing: 0;
  }

}

/* Keep week columns readable */

.pCalWeek {
  grid-template-columns: repeat(7, minmax(140px, 1fr));
}

/* Sticky day headers */

.pCalColHeader {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #0b1220;
}

/* Make sure lesson blocks sit under header */

.pCalEvent {
  z-index: 10;
}


.calendarControls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.calNav {
  display: flex;
  gap: 8px;
}

.calModes {
  display: flex;
  gap: 8px;
}


/* Checkbox label layout you had before */
label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}

label.check input {
  width: auto;
  margin: 0;
}

.calendarFeedSettings {
  margin-top: 24px;
}

.calendarFeedSettings fieldset {
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  padding: 12px;
}

.calendarFeedSettings legend {
  color: rgba(229, 231, 235, .80);
  font-size: 13px;
  padding: 0 6px;
}

.calendarFeedSettings label.check {
  margin-top: 10px;
}

/* PF-UI-002: compact, component-owned Calendar Feed presentation */
.calendarFeedSettings {
  width: 100%;
  min-width: 0;
  margin-top: 24px;
  margin-bottom: 92px;
  padding: 18px;
  color: var(--pf-text, #0f172a);
}

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

.calendarFeedHeader h3,
.calendarFeedSection h4 {
  margin: 0;
  color: var(--pf-text, #0f172a);
}

.calendarFeedHeader h3 { font-size: 22px; }
.calendarFeedSection h4 { font-size: 15px; }

.calendarFeedHeader p,
.calendarFeedSection > p {
  margin: 4px 0 0;
  color: var(--pf-text-muted, #64748b);
  font-size: 13px;
  line-height: 1.4;
}

.calendarFeedSwitch {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  color: var(--pf-text, #0f172a);
  font-weight: 700;
  cursor: pointer;
}

.calendarFeedSwitch input,
.calendarFeedSegments input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.calendarFeedSwitchTrack {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--pf-border-strong, #cbd5e1);
  transition: background .18s ease;
}

.calendarFeedSwitchTrack::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .28);
  transition: transform .18s ease;
}

.calendarFeedSwitch input:checked + .calendarFeedSwitchTrack { background: var(--pf-primary, #2563eb); }
.calendarFeedSwitch input:checked + .calendarFeedSwitchTrack::after { transform: translateX(18px); }
.calendarFeedSwitch input:focus-visible + .calendarFeedSwitchTrack { outline: 3px solid var(--pf-primary-soft, #dbeafe); outline-offset: 2px; }

.calendarFeedSection {
  min-width: 0;
  margin-top: 12px;
  padding: 11px 14px;
  border: 1px solid var(--pf-border, #e2e8f0);
  border-radius: 14px;
  background: var(--pf-surface, #fff);
}

.calendarFeedUrlRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}

.calendarFeedUrlRow input {
  width: 100%;
  min-width: 0;
  height: 44px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendarFeedCopyButton {
  min-width: 72px;
  min-height: 44px;
  border: 1px solid var(--pf-border-strong, #cbd5e1);
  border-radius: 11px;
  background: var(--pf-surface, #fff);
  color: var(--pf-primary, #2563eb);
  font-weight: 800;
  cursor: pointer;
}

.calendarFeedRegenerate {
  min-height: 44px;
  margin: 0 0 -9px -8px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--pf-primary, #2563eb);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.calendarFeedSettings .calendarFeedSegments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  margin: 8px 0 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--pf-border, #e2e8f0);
  border-radius: 12px;
}

.calendarFeedSegments label { min-width: 0; cursor: pointer; }
.calendarFeedSegments label + label { border-left: 1px solid var(--pf-border, #e2e8f0); }

.calendarFeedSegments span {
  display: flex;
  min-height: 48px;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 6px;
  color: var(--pf-text, #0f172a);
  text-align: center;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.15;
}

.calendarFeedSegments input:checked + span {
  background: var(--pf-primary, #2563eb);
  color: var(--pf-text-on-primary, #fff);
}

.calendarFeedSegments input:focus-visible + span { box-shadow: inset 0 0 0 3px var(--pf-primary-soft, #dbeafe); }

.calendarFeedPreview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
  min-height: 52px;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid var(--pf-border, #e2e8f0);
  border-radius: 11px;
  background: var(--pf-surface-subtle, #f8fafc);
}

.calendarFeedPreview strong {
  color: var(--pf-primary, #2563eb);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.calendarFeedPreview span {
  min-width: 0;
  color: var(--pf-text, #0f172a);
  font-size: 14px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.calendarFeedChecks { margin-top: 3px; }

.calendarFeedChecks label {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  color: var(--pf-text, #0f172a);
  cursor: pointer;
}

.calendarFeedChecks label + label { border-top: 1px solid var(--pf-border, #e2e8f0); }
.calendarFeedChecks input { width: 20px; height: 20px; margin: 0; accent-color: var(--pf-primary, #2563eb); }

.calendarFeedSettings .calendarFeedSave {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  font-size: 15px;
}

.calendarFeedSave:disabled { opacity: .48; cursor: default; }
.calendarFeedSettings > .msg:empty { display: none; }
.calendarFeedSettings > .msg { margin-top: 10px; }

@media (max-width: 480px) {
  .calendarFeedSettings { padding: 16px; }
  .calendarFeedHeader { gap: 10px; }
  .calendarFeedHeader h3 { font-size: 20px; }
  .calendarFeedSection { margin-top: 10px; padding: 10px 12px; }
  .calendarFeedUrlSection > p { font-size: 12px; }

  .calendarFeedUrlSection {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 8px;
  }

  .calendarFeedUrlSection > h4,
  .calendarFeedUrlSection > .calendarFeedUrlRow {
    grid-column: 1 / -1;
  }

  .calendarFeedUrlSection > p,
  .calendarFeedUrlSection > .calendarFeedRegenerate {
    align-self: center;
  }

  .calendarFeedUrlSection > .calendarFeedRegenerate {
    margin: -2px -8px -8px 0;
    white-space: nowrap;
  }
}

@media (max-width: 350px) {
  .calendarFeedUrlSection { grid-template-columns: 1fr; }
  .calendarFeedUrlSection > .calendarFeedRegenerate { justify-self: start; margin-left: -8px; }
}

@media (max-width: 350px) {
  .calendarFeedHeader { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .calendarFeedSwitch { gap: 5px; font-size: 13px; }
  .calendarFeedSwitchTrack { width: 40px; }
  .calendarFeedSwitch input:checked + .calendarFeedSwitchTrack::after { transform: translateX(14px); }
  .calendarFeedSegments span { padding: 5px 3px; font-size: 11px; }
  .calendarFeedCopyButton { min-width: 60px; padding-inline: 8px; }
}

/* Mobile calendar tightening */
@media (max-width:860px) {

  .pCalTimes {
    position: sticky;
    left: 0;
    z-index: 30;
    background: rgba(10, 14, 22, 0.96);
  }

  .pCalColHeader {
    font-size: 13px;
    font-weight: 600;
    padding: 0 6px;
    letter-spacing: 0.2px;
    line-height: 1.2;
    text-align: center;
  }

  .pCalTimeRow {
    font-size: 10px;
    font-weight: 500;
    padding: 3px 6px;
    opacity: 0.85;
  }

  .pCalEvent {
    left: 0;
    right: 0;
    padding: 2px 2px 26px 2px;
  }

  .pCalEventTitle {
    font-size: 8px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: 0.2px;
  }

  .pCalEventTime {
    font-size: 10px;
  }

  .pCalBadge {
    height: 18px;
    font-size: 10px;
    bottom: 5px;
  }
}

/* Highlight lesson being dragged */
.draggingLesson .pCalEvent {
  opacity: 0.85;
}


.draggingLesson .pCalEvent:active,
.draggingLesson .pCalEvent.dragging {
  transform: scale(1.04);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 50;
}

/* Disable text selection in calendar */
.pCal,
.pCal * {
  -webkit-user-select: none;
  user-select: none;
}


/* ===== Final mobile calendar width override ===== */

@media (max-width:860px) {

  .pCalWeek {
    grid-template-columns: repeat(7, 1fr);
    min-width: 0;
  }

}

.pCalGridWrap {
  position: relative;
  overflow: hidden;
}

.lessonGrid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.lessonGrid input,
.lessonGrid select {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #3a3f55;
  background: #232838;
  color: white;
}

.dayView {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: #f3f4f6;
}

.dayViewPupil {
  display: inline-block;
  background: #1f7a3a;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 6px;
}



.dayViewTimes span {
  border-left: 1px solid #bbb;
  padding-left: 6px;
}


.timelineBusy {
  position: absolute;
  height: 10px;
  top: 7px;
  background: #ff4d4d;
  border-radius: 4px;
  opacity: 0.9;
}

/* PASSFAN calendar cell background */

.pCalCol {
  background: #141a22;
}

.pCalSlotRow {
  background: #141a22;
}

/* subtle row lines */
.pCalSlotRow {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* vertical day separators */
.pCalCol {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.pCalDays {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 14, 22, 0.98);
}

.pCalEvent {
  pointer-events: auto;
  z-index: 20;
}

.navSub {
  font-size: 13px;
  opacity: 0.7;
  margin-top: -6px;
  margin-bottom: 6px;
  padding: 8px 12px;
}

.navSub:hover {
  opacity: 1;
}

.navSub.active {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

/* ===== V2 CALENDAR ===== */

.pCalV2 {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ===== HEADER ===== */
.pCalV2Header {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  position: sticky;
  top: 0;
  z-index: 5;
  background: #0f172a;
  border-bottom: 1px solid #2a2a2a;
}

.pCalV2ColHeader {
  padding: 8px;
  text-align: center;
  font-weight: 600;
}

.calendarWrap {
  height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ===== BODY ===== */
.pCalV2Body {
  display: grid;
  grid-template-columns: 60px 1fr;
}

/* ===== TIME COLUMN ===== */
.pCalV2TimeCol {
  border-right: 1px solid #2a2a2a;
  height: 1440px;
  position: relative;
}

/* time rows */
.pCalV2TimeRow {
  position: relative;
  height: 60px;
  font-size: 12px;
  color: #aaa;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* main hour */
.timeHour {
  position: absolute;
  top: -6px;
  left: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pf-text-muted, #64748b);
}

/* half hour */
.timeHalf {
  position: absolute;
  top: 30px;
  left: 6px;
  font-size: 10px;
  color: var(--pf-text-muted, #64748b);
}

/* ===== GRID ===== */
.pCalV2Grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  position: relative;
  height: 1440px;

  transition: transform 0.25s ease;
  will-change: transform;
}

/* ===== DAY COLUMN ===== */
.pCalV2Col {
  position: relative;
  border-right: 1px solid #2a2a2a;
  overflow: hidden;
}

/* ===== SLOT CONTAINER ===== */
.pCalV2Slots {
  position: relative;
  height: 100%;
}

/* ===== EVENTS ===== */
.pCalV2Event {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 2px;
  z-index: 3;
  padding: 6px;
  font-size: 12px;
  color: white;
  background: rgba(59, 130, 246, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-sizing: border-box;
}

.pCalV2Event.isPaid {
  background: rgba(17, 116, 53, 0.85);
}

.pCalV2Event.isUnpaid {
  background: rgba(248, 44, 44, 0.85);
}

/* ===== GRID LINES (15 MIN) ===== */
.pCalV2Col::before {
  content: "";
  position: absolute;
  inset: 0;

  background-image:
    repeating-linear-gradient(to bottom,
      rgba(15, 23, 42, 0.14) 0,
      rgba(15, 23, 42, 0.14) 1px,
      transparent 1px,
      transparent 30px,
      rgba(15, 23, 42, 0.07) 30px,
      rgba(15, 23, 42, 0.07) 31px,
      transparent 31px,
      transparent 60px);

  pointer-events: none;
  z-index: 1;
}

.pCalV2EventTime {
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.pCalNowLine {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #2421e9;
  z-index: 5;
}

.pCalNowLine {
  box-shadow: 0 0 6px rgba(91, 68, 239, 0.6);
}

.pCalNowDot {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  background: #2421e9;
  border-radius: 50%;
}

.pCalV2Col.today {
  background: rgba(255, 255, 255, 0.03);
}

.pCalNowLabel {
  position: absolute;
  left: 8px;
  top: -10px;

  font-size: 12px;
  padding: 2px 6px;

  background: #ef4444;
  color: white;

  border-radius: 4px;
  white-space: nowrap;

  pointer-events: none;
  /* 👈 IMPORTANT */
}

/* ===== CLEAN STACKING SYSTEM ===== */

.pCalV2 {
  position: relative;
  z-index: 1;
}

.pCalV2Grid {
  position: relative;
  z-index: 1;
}

.pCalV2Col {
  position: relative;
  z-index: 1;
}

.pCalV2Event {
  z-index: 2;
}

.pCalNowLine {
  z-index: 3;
}

/* modal ALWAYS wins */
.modal {
  z-index: 9999;
}

/* prevent any floating drag ghost above modal */
body.modalOpen .pCalV2Event {
  z-index: 1 !important;
}

body.modalOpen .pCalV2Grid,
body.modalOpen .pCalV2Col {
  z-index: 1 !important;
}

.pCalV2Event {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.pCalV2Slots {
  user-select: none;
  -webkit-user-select: none;
}

/* ===== MOBILE CALENDAR TIGHTEN ===== */
@media (max-width: 768px) {

  .pCalV2Event {
    font-size: 9px;
    padding: 0px 0px;
  }

  .pCalV2EventTitle {
    font-size: 9px;
    line-height: 1.1;
  }

  .pCalV2EventTime {
    font-size: 8px;
    line-height: 1.1;
  }

  .pCalResizeHandle {
    height: 14px;
  }
}

.pCalResizeHandle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  background: rgba(255, 255, 255, 0.3);
}

.pCalV2Event {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.pCalV2 {
  -webkit-user-select: none;
  user-select: none;
}

.pCalV2Grid,
.pCalV2Slots {
  touch-action: none;
}

.pCalResizeHandle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;

  height: 18px;
  /* bigger grab area */
  cursor: ns-resize;

  z-index: 10;

  /* invisible but clickable */
  background: transparent;
}

.pCalResizeHandle::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 4px;

  width: 30px;
  height: 4px;
  border-radius: 2px;

  background: rgba(255, 255, 255, 0.6);
}

.pCalResizeHandle {
  background: red;
}

.pCalV2Event {
  position: absolute;
  box-sizing: border-box;
}

.pCalGridWrap {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.pCalV2Grid,
.pCalV2Slots {
  touch-action: pan-y;
}

.fieldRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fieldRow .inputFull {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 44px;
  font-size: 16px;
}

.expenseCategoryUnselected { color: #9f1239; }
.expenseFieldInvalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}
.expenseFieldError {
  margin-top: 6px;
  color: #dc2626;
  font-size: 0.9rem;
  font-weight: 700;
}

.receiptViewerModal { z-index: 10050; }
.modalCard.receiptViewerCard {
  width: min(94vw, 920px);
  height: min(90dvh, 980px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.receiptViewerHeader {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
  background: var(--pf-surface, #fff);
}
.receiptViewerBody {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: block;
  background: #111827;
  border-radius: 12px;
  position: relative;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.receiptViewerLoading,
.receiptViewerError {
  color: white;
  padding: 24px;
  text-align: center;
}
.receiptViewerPdfFallback {
  position: absolute;
  right: 12px;
  bottom: 12px;
}
.receiptViewerImage {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: none;
  margin: 0 auto;
}
.receiptViewerFrame {
  width: 100%;
  height: 100%;
  min-height: 60dvh;
  border: 0;
  background: white;
}

.fieldRow .btnIcon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 20px;
  line-height: 1;
}

.lvDirectionsWrap {
  margin-top: 10px;
}

.lvDirections {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.lvDirections button,
.lvActions button {
  flex: 1;
  width: 100%;

  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;

  border-radius: 4px;
  border: 1px solid #cbd5e1;

  background: linear-gradient(to bottom, #f9fafb, #e5e7eb);
  color: #111;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.15);
}

.lvDirections button,
.lvActions button {
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.lvDirections button:active,
.lvActions button:active {
  transform: translateY(1px);
}

/* MOBILE ACTION BAR */
.lvActions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* ACTIVE PRESS FEEL */
.lvDirections button:active,
.lvActions button:active {
  background: #d1d5db;
}

/*modal add pupils*/

.pfModal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(12px, calc(var(--safe-top, 0px) + 8px))
    max(12px, calc(var(--safe-right, 0px) + 8px))
    max(12px, calc(var(--safe-bottom, 0px) + 8px))
    max(12px, calc(var(--safe-left, 0px) + 8px));
  overflow: hidden;
}

.pfModal.hidden {
  display: none;
}

.pfModalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(8px);
}

.pfModalCard {
  position: relative;
  width: min(100%, 560px);
  max-height: calc(var(--app-height, 100dvh) - var(--safe-top, 0px) - var(--safe-bottom, 0px) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--pf-space-5);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  background: var(--pf-surface);
  color: var(--pf-text);
  box-shadow: var(--pf-shadow-lg);
  z-index: 1;
}

.pfModalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--pf-space-3);
  margin-bottom: var(--pf-space-4);
  color: var(--pf-text);
  font-weight: 750;
}

.pfModalBody {
  display: grid;
  gap: var(--pf-space-3);
}

.pfField {
  display: flex;
  flex-direction: column;
}

.pfField input {
  min-height: var(--pf-control-height);
  padding: 10px 12px;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
  background: var(--pf-surface);
  color: var(--pf-text);
}

.pfModalFooter {
  position: sticky;
  bottom: 0;
  margin-top: var(--pf-space-4);
  padding-top: var(--pf-space-3);
  padding-bottom: max(var(--pf-space-2), var(--safe-bottom, 0px));
  background: var(--pf-surface);
}

.pfModalFooter button {
  width: 100%;
  min-height: var(--pf-control-height);
}

.pfModalBody {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pfField.full {
  grid-column: span 2;
}

.pfField input,
.pfField select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;

  background: #0f1115;
  /* slightly darker */
  border: 1px solid #2a2f36;
  /* visible edge */

  color: #fff;
  font-size: 14px;

  outline: none;
}

.pfField input,
.pfField select {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.pfField input:focus,
.pfField select:focus {
  border-color: #e63946;
  /* your red */
  box-shadow:
    0 0 0 1px rgba(230, 57, 70, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.pfField label {
  font-size: 13px;
  color: var(--pf-text-muted);
}

#lessonViewPanel {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: block;
  background: var(--pf-surface-soft, #f1f5f9);
  overflow-y: auto;
}

#lessonViewPanel .modalCard {
  width: 100%;
  height: auto;
  min-height: 100%;
  max-width: none;

  border-radius: 0;
  padding: 16px;
}

.chartCard {
  background: var(--pf-surface, #fff);
  border: 1px solid var(--pf-border, #e2e8f0);
  border-radius: var(--pf-radius-lg, 16px);
  padding: 14px;
  max-width: 820px;
  margin-top: 14px;
}

.lineChart {
  width: 100%;
  overflow-x: auto;
}

.profitSvg {
  width: 100%;
  min-width: 520px;
  height: auto;
}

.zeroLine {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1;
}

.profitLine {
  stroke: #22c55e;
  stroke-width: 3;
}

.profitPoint {
  fill: #22c55e;
}

.axisText,
.valueText {
  fill: #fff;
  font-size: 12px;
}

#view-pupilProfile .card {
  max-width: 100%;
  min-width: 0;
  padding: 20px;
  border-radius: 18px;
  overflow: hidden;
}

#view-pupilProfile .card>div {
  margin-bottom: 6px;
  line-height: 1.25;
}

#phActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 24px;
}

.studentAccessPanel {
  margin: 18px 0 22px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  background: rgba(0, 0, 0, .18);
}

.studentAccessPanel h3 {
  margin: 0 0 10px;
}

.studentAccessGrid {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.studentAccessLink {
  overflow-wrap: anywhere;
  color: #93c5fd;
}

.messagesPage {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.messagesThreadList,
.messagesConversationPanel {
  min-width: 0;
}

.messageThreadBtn {
  display: grid;
  width: 100%;
  gap: 6px;
  padding: 12px;
  margin-bottom: 10px;
  text-align: left;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  cursor: pointer;
}

.messageThreadBtn.active {
  border-color: rgba(220, 38, 38, .75);
  background: rgba(220, 38, 38, .18);
}

.messageThreadTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
}

.messageThreadLatest {
  overflow: hidden;
  color: rgba(229, 231, 235, .84);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 820px) {
  #view-pupilProfile h2 {
    font-size: clamp(34px, 10vw, 48px);
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  #view-pupilProfile .card {
    padding: 16px;
  }

  .messagesPage {
    grid-template-columns: 1fr;
  }
}

.messageList {
  display: grid;
  gap: 10px;
  margin: 10px 0 14px;
}

.messageItem {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
}

.messageMeta {
  margin-bottom: 5px;
  color: rgba(229, 231, 235, .70);
  font-size: 12px;
  font-weight: 700;
}

.messageBadge {
  display: inline-flex;
  min-width: 22px;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.messageToast {
  position: fixed;
  right: 16px;
  bottom: 88px;
  z-index: 9999;
  max-width: min(340px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 14px;
  background: rgba(15, 23, 42, .96);
  color: #fff;
  box-shadow: 0 14px 35px rgba(0, 0, 0, .35);
}

#phActions .btn {
  min-width: auto;
  padding: 10px 16px;
  border-radius: 14px;
}

#view-pupilProfile h2 {
  font-size: clamp(30px, 8vw, 52px);
  line-height: 1.05;
}

#phTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  max-width: 100%;
}

.phTab {
  border-radius: 999px;
  padding: 6px 14px;
}

#phContent {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

#phContent .card {
  width: 100%;
}

.pupilHubTableWrap {
  width: 100%;
  max-width: 100%;
  margin-top: 10px;
  border: 1px solid var(--pf-border, rgba(148, 163, 184, .28));
  border-radius: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.pupilHubTable {
  width: max-content;
  min-width: 760px;
  max-width: none;
  margin: 0;
  table-layout: auto;
}

.pupilHubLearningTable {
  min-width: 520px;
}

.pupilHubTable th,
.pupilHubTable td {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  vertical-align: middle;
}

.pupilHubTable th:nth-child(6),
.pupilHubTable td:nth-child(6) {
  min-width: 150px;
  max-width: 220px;
  white-space: normal;
  overflow-wrap: anywhere;
}

#view-pupilProfile .formGrid {
  gap: 14px;
}

#view-pupilProfile input,
#view-pupilProfile select {
  min-height: 54px;
  border-radius: 14px;
}

#pupilTableBody tr.selectedPupil {
  background: rgba(220, 38, 38, 0.12);
}

/* ==========================================================
   PASSFAN Premium SaaS visual layer
   Controlled CSS-only refinement. Existing selectors preserved.
========================================================== */

:root {
  --pf-bg: #f7f8fa;
  --pf-surface: #ffffff;
  --pf-surface-soft: #f1f5f9;
  --pf-surface-hover: #f8fafc;

  --pf-text: #0f172a;
  --pf-text-muted: #64748b;
  --pf-text-soft: #94a3b8;
  --pf-text-on-primary: #ffffff;

  --pf-primary: #2563eb;
  --pf-primary-hover: #1d4ed8;
  --pf-primary-active: #1e40af;
  --pf-primary-soft: #dbeafe;

  --pf-success: #16a34a;
  --pf-success-soft: #dcfce7;

  --pf-warning: #f59e0b;
  --pf-warning-soft: #fef3c7;

  --pf-danger: #dc2626;
  --pf-danger-hover: #b91c1c;
  --pf-danger-soft: #fee2e2;

  --pf-border: #e2e8f0;
  --pf-border-strong: #cbd5e1;
  --pf-focus: rgba(37, 99, 235, .22);

  --pf-radius-sm: 8px;
  --pf-radius-md: 12px;
  --pf-radius-lg: 16px;
  --pf-radius-pill: 999px;

  --pf-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --pf-shadow-md: 0 8px 24px rgba(15, 23, 42, .08);
  --pf-shadow-lg: 0 16px 40px rgba(15, 23, 42, .10);

  --pf-space-1: 4px;
  --pf-space-2: 8px;
  --pf-space-3: 12px;
  --pf-space-4: 16px;
  --pf-space-5: 20px;
  --pf-space-6: 24px;
  --pf-space-8: 32px;
  --pf-space-10: 40px;
  --pf-space-12: 48px;

  --pf-control-height: 44px;
  --pf-sidebar-width: 248px;
  --pf-content-max: 1440px;

  --pf-transition-fast: 120ms ease;
  --pf-transition-normal: 180ms ease;

  --bg: var(--pf-bg);
  --card: var(--pf-surface);
  --text: var(--pf-text);
  --muted: var(--pf-text-muted);
  --red: var(--pf-primary);
  --red2: var(--pf-primary-active);
  --border: var(--pf-border);
  --shadow: var(--pf-shadow-sm);
}

html,
body {
  background: var(--pf-bg);
  color: var(--pf-text);
}

body.app {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .08), transparent 32rem),
    var(--pf-bg);
}

/* ===== v10.4.03 shared visual-viewport text entry ===== */
html.keyboardOpen body.viewportShell:not(.naturalDocumentScroll) {
  height: var(--app-height);
  max-height: var(--app-height);
}

html.keyboardOpen.textEntryActive .layout,
html.keyboardOpen.textEntryActive .main {
  min-height: 0;
  max-height: 100%;
}

html.keyboardOpen.textEntryActive .modal {
  height: var(--app-height);
  max-height: var(--app-height);
  align-items: flex-start;
  padding-top: max(8px, calc(var(--visual-viewport-top, 0px) + 8px));
  padding-bottom: max(8px, calc(var(--app-height) - var(--visual-viewport-bottom, var(--app-height)) + 8px));
}

html.keyboardOpen.textEntryActive .modalCard,
html.keyboardOpen.textEntryActive .receiptCropCard,
html.keyboardOpen.textEntryActive .lessonSummaryCard,
html.keyboardOpen.textEntryActive .instructorOnboardingCard {
  max-height: calc(var(--app-visible-height, var(--app-height)) - 16px);
}

html.keyboardOpen.textEntryActive .fabAdd {
  display: none;
}

@media (max-width: 900px) {
  html.keyboardOpen.textEntryActive #view-messages.active {
    height: 100%;
    overflow: hidden;
  }

  html.keyboardOpen.textEntryActive #view-messages > .muted,
  html.keyboardOpen.textEntryActive #view-messages .messagesThreadList {
    display: none;
  }

  html.keyboardOpen.textEntryActive #view-messages .messagesPage {
    display: block;
    height: 100%;
    overflow: hidden;
  }

  html.keyboardOpen.textEntryActive #view-messages .messagesConversationPanel {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto auto;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    padding-bottom: max(8px, var(--safe-bottom));
  }

  html.keyboardOpen.textEntryActive #view-messages .messageList {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  html.keyboardOpen.textEntryActive #view-messages label,
  html.keyboardOpen.textEntryActive #view-messages .actionsRow {
    margin-block: 6px 0;
  }

  html.keyboardOpen.textEntryActive #messagesReplyText {
    min-height: 72px;
    max-height: min(30vh, 150px);
    overflow-y: auto;
  }
}

@media (max-width: 860px) {
  html.authLoginDocument,
  body.authLoginPage {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
  }

  body.authLoginPage {
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  body.authLoginPage .container {
    width: min(100%, 760px);
    margin-inline: auto;
  }

  body.authLoginPage .authCard {
    max-height: none;
    overflow: visible;
  }
}

.topbar {
  height: 64px;
  padding: 0 var(--pf-space-6);
  background: rgba(255, 255, 255, .92);
  color: var(--pf-text);
  border-bottom: 1px solid var(--pf-border);
  box-shadow: var(--pf-shadow-sm);
  backdrop-filter: blur(14px);
}

.brandLogo {
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-sm);
  box-shadow: var(--pf-shadow-sm);
}

.appVersion,
.userIdentity {
  color: var(--pf-text-muted);
}

.appVersion {
  border-color: var(--pf-border);
  background: var(--pf-surface-soft);
}

.btnLatestApp {
  border-color: var(--pf-primary-soft);
  background: var(--pf-primary-soft);
  color: var(--pf-primary-active);
}

.layout {
  width: 100%;
  max-width: var(--pf-content-max);
  margin: 0 auto;
  padding: var(--pf-space-6);
  gap: var(--pf-space-6);
}

.sidebar {
  width: var(--pf-sidebar-width);
  padding: var(--pf-space-3);
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  box-shadow: var(--pf-shadow-sm);
}

.navItem {
  min-height: var(--pf-control-height);
  color: var(--pf-text-muted);
  border-radius: var(--pf-radius-md);
  transition:
    background var(--pf-transition-fast),
    color var(--pf-transition-fast),
    border-color var(--pf-transition-fast);
}

.navItem:hover {
  background: var(--pf-surface-hover);
  color: var(--pf-text);
}

.navItem.active {
  background: var(--pf-primary-soft);
  border-color: rgba(37, 99, 235, .22);
  color: var(--pf-primary-active);
}

h2 {
  margin: 0 0 var(--pf-space-5);
  color: var(--pf-text);
  font-weight: 760;
  letter-spacing: 0;
}

h3,
h4 {
  color: var(--pf-text);
  letter-spacing: 0;
}

.muted,
.dash-label,
.messageMeta,
th,
label,
.calendarFeedSettings legend {
  color: var(--pf-text-muted);
}

.pf-page {
  width: 100%;
  max-width: var(--pf-content-max);
  margin: 0 auto;
  padding: var(--pf-space-6);
}

.pf-card,
.card,
.dash-card,
.accountsSummaryCard,
.tableWrap,
.summaryRow,
.backupRow,
.calendarFeedSettings,
.studentAccessPanel,
.messagesConversationPanel,
.chartCard,
.lessonSummaryNotice,
.lessonSummaryCard {
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  box-shadow: var(--pf-shadow-sm);
}

.pf-card {
  padding: var(--pf-space-5);
}

.pf-card--interactive {
  cursor: pointer;
  transition:
    transform var(--pf-transition-normal),
    box-shadow var(--pf-transition-normal),
    border-color var(--pf-transition-normal);
}

.pf-card--interactive:hover {
  transform: translateY(-1px);
  border-color: var(--pf-border-strong);
  box-shadow: var(--pf-shadow-md);
}

.pf-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--pf-space-4);
  margin-bottom: var(--pf-space-5);
}

.pf-card__title {
  margin: 0;
  color: var(--pf-text);
  font-size: 1rem;
  font-weight: 650;
}

.pf-card__subtitle {
  margin-top: var(--pf-space-1);
  color: var(--pf-text-muted);
  font-size: .875rem;
}

.pf-stat-grid,
.dash-grid-4,
.dash-grid-3,
.dash-grid-2,
.summaryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--pf-space-4);
}

.pf-stat-card,
.dash-card {
  background: var(--pf-surface);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  box-shadow: var(--pf-shadow-sm);
  padding: var(--pf-space-5);
}

.pf-stat-card__label,
.dash-label {
  display: block;
  margin-bottom: var(--pf-space-2);
  color: var(--pf-text-muted);
  font-size: .8rem;
  font-weight: 600;
}

.pf-stat-card__value,
.dash-value,
.cardValue,
.statValue {
  display: block;
  color: var(--pf-text);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.1;
}

.pf-stat-card__meta {
  display: block;
  margin-top: var(--pf-space-2);
  color: var(--pf-text-soft);
  font-size: .8rem;
}

.accountsSummaryCard {
  background:
    linear-gradient(145deg, rgba(37, 99, 235, .07), rgba(255, 255, 255, .98)),
    var(--pf-surface);
  padding: var(--pf-space-6);
}

.posProfit,
.msgOk {
  color: var(--pf-success);
}

.negProfit,
.msgError {
  color: var(--pf-danger);
}

.btn,
.btnPrimary,
.btnSmall,
.btnDanger,
.lessonSummaryAction,
.phTab,
.aTab {
  min-height: var(--pf-control-height);
  border: 1px solid transparent;
  border-radius: var(--pf-radius-md);
  background: var(--pf-primary);
  color: var(--pf-text-on-primary);
  box-shadow: var(--pf-shadow-sm);
  transition:
    background var(--pf-transition-fast),
    border-color var(--pf-transition-fast),
    box-shadow var(--pf-transition-fast),
    transform var(--pf-transition-fast);
}

.btn:hover,
.btnPrimary:hover,
.btnSmall:hover,
.btnDanger:hover,
.lessonSummaryAction:hover,
.phTab:hover,
.aTab:hover {
  background: var(--pf-primary-hover);
  box-shadow: var(--pf-shadow-md);
}

.btnSecondary,
.aTab,
.phTab {
  background: var(--pf-surface);
  border-color: var(--pf-border);
  color: var(--pf-text);
}

.btnSecondary:hover,
.aTab:hover,
.phTab:hover {
  background: var(--pf-surface-hover);
  border-color: var(--pf-border-strong);
  color: var(--pf-text);
}

.aTab.isActive,
.phTab.active,
.phTab.isActive {
  background: var(--pf-primary);
  border-color: var(--pf-primary);
  color: var(--pf-text-on-primary);
}

.dangerBtn,
.btnDanger {
  border-color: var(--pf-danger-soft);
  background: var(--pf-danger-soft);
  color: var(--pf-danger);
}

.dangerBtn:hover,
.btnDanger:hover {
  border-color: var(--pf-danger);
  background: var(--pf-danger);
  color: var(--pf-text-on-primary);
}

input,
select,
textarea,
.lessonSummaryCard textarea,
.lessonSummaryCard input,
.pfField input,
.pfField select,
#incomeModal input,
#incomeModal select,
.lessonGrid input,
.lessonGrid select {
  min-height: var(--pf-control-height);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
  background: var(--pf-surface);
  color: var(--pf-text);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus,
.lessonSummaryCard textarea:focus,
.lessonSummaryCard input:focus,
.pfField input:focus,
.pfField select:focus {
  outline: none;
  border-color: var(--pf-primary);
  box-shadow: 0 0 0 4px var(--pf-focus);
}

.tableWrap {
  background: var(--pf-surface);
  overflow-x: auto;
}

table {
  color: var(--pf-text);
}

th,
td {
  border-bottom: 1px solid var(--pf-border);
}

tr:hover td {
  background: var(--pf-surface-hover);
}

.modal {
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(8px);
}

.modalCard,
.fabPanel {
  background: var(--pf-surface);
  color: var(--pf-text);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  box-shadow: var(--pf-shadow-lg);
}

.fabAdd {
  background: var(--pf-primary);
  border-radius: var(--pf-radius-lg);
  box-shadow: var(--pf-shadow-lg);
}

.fabAdd:hover {
  background: var(--pf-primary-hover);
}

.backupRow,
.messageThreadBtn,
.messageItem,
.receiptCropCard {
  background: var(--pf-surface);
  border-color: var(--pf-border);
  color: var(--pf-text);
}

.messageThreadBtn:hover {
  background: var(--pf-surface-hover);
}

.messageThreadBtn.active {
  border-color: var(--pf-primary);
  background: var(--pf-primary-soft);
}

.messageThreadLatest {
  color: var(--pf-text-muted);
}

.messageBadge {
  background: var(--pf-danger);
}

.messageToast {
  background: var(--pf-text);
  border-color: rgba(255, 255, 255, .12);
  color: #fff;
  box-shadow: var(--pf-shadow-lg);
}

.notificationCenterRoot {
  position: fixed;
  inset: 70px 18px 18px auto;
  z-index: 30;
  width: min(560px, calc(100vw - 36px));
  max-height: calc(100vh - 88px);
  overflow: auto;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  background: var(--pf-surface);
  box-shadow: var(--pf-shadow-lg);
}

#btnNotifications,
#studentNotificationsBtn {
  position: relative;
}

.notificationUnreadBadge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pf-danger);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--pf-surface);
}

.notificationUnreadBadge.hidden {
  display: none;
}

.notificationPanel {
  display: grid;
  gap: var(--pf-space-4);
  padding: var(--pf-space-5);
}

.notificationPanelHeader,
.notificationActions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--pf-space-3);
}

.notificationPanelHeader h2 {
  margin: 0;
}

.notificationQuiet,
.notificationPrefs {
  display: grid;
  gap: var(--pf-space-3);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
  padding: var(--pf-space-4);
}

.notificationQuiet {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.notificationQuiet legend {
  padding: 0 var(--pf-space-2);
  color: var(--pf-text-muted);
  font-weight: 800;
}

.notificationPrefs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 280px;
  overflow: auto;
}

.notificationHistory {
  display: grid;
  gap: var(--pf-space-2);
}

.notificationHistoryItem {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
  background: var(--pf-surface);
  color: var(--pf-text);
  padding: var(--pf-space-3);
}

.notificationHistoryItem.unread {
  border-color: var(--pf-primary);
  background: var(--pf-primary-soft);
}

.notificationHistoryItem span,
.notificationHistoryItem small {
  color: var(--pf-text-muted);
}

.studentAccessLink {
  color: var(--pf-primary);
}

.zeroLine {
  stroke: var(--pf-border-strong);
}

.axisText,
.valueText {
  fill: var(--pf-text-muted);
}

.profitLine,
.profitPoint {
  stroke: var(--pf-success);
  fill: var(--pf-success);
}

.calendarControls,
.accountsTabs,
#phTabs,
.actionsRow,
.backupActions {
  gap: var(--pf-space-2);
}

.calendarWrap,
.pCalV2,
.pCalGridWrap {
  border-color: var(--pf-border);
  box-shadow: var(--pf-shadow-sm);
}

.pCalV2Header,
.pCalV2ColHeader,
.pCalV2TimeCol {
  background: var(--pf-surface);
  color: var(--pf-text);
}

.pCalV2Grid,
.pCalV2Col,
.pCalCol,
.pCalSlotRow {
  background: #fbfdff;
  border-color: var(--pf-border);
}

.pCalV2Col::before {
  background-image:
    repeating-linear-gradient(to bottom,
      rgba(15, 23, 42, 0.14) 0,
      rgba(15, 23, 42, 0.14) 1px,
      transparent 1px,
      transparent 30px,
      rgba(15, 23, 42, 0.07) 30px,
      rgba(15, 23, 42, 0.07) 31px,
      transparent 31px,
      transparent 60px);
}

.pCalV2TimeRow {
  color: var(--pf-text-muted);
  border-top-color: rgba(15, 23, 42, 0.14);
}

.pCalV2Event {
  box-shadow: var(--pf-shadow-md);
}

.pCalNowLine,
.pCalNowLabel,
.pCalNowDot {
  background: var(--pf-primary);
}

@media (max-width: 860px) {
  .topbar {
    height: 58px;
    padding: 0 var(--pf-space-3);
  }

  .layout {
    padding: var(--pf-space-4);
    gap: var(--pf-space-4);
  }

  .notificationCenterRoot {
    inset: 64px var(--pf-space-3) var(--pf-space-3);
    width: auto;
  }

  .notificationPanelHeader,
  .notificationActions,
  .notificationQuiet {
    display: grid;
  }

  .notificationPrefs {
    grid-template-columns: 1fr;
  }

  .sidebar {
    background: var(--pf-surface);
    box-shadow: var(--pf-shadow-lg);
  }

  body.sidebarOpen::before {
    background: rgba(15, 23, 42, .35);
    backdrop-filter: blur(4px);
  }
}

@media (max-width: 768px) {
  .pf-page {
    padding: var(--pf-space-4);
  }
}

/* ========= Viewport-contained app shell ========= */

:root {
  --app-height: 100vh;
  --visual-viewport-top: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

@supports (height: 100svh) {
  :root {
    --app-height: 100svh;
  }
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}

html,
body {
  width: 100%;
  max-width: 100%;
  height: var(--app-height);
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body.app {
  width: 100%;
  max-width: 100%;
  height: var(--app-height);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0;
}

img,
video,
canvas,
svg,
iframe {
  max-width: 100%;
}

p,
li,
td,
th,
label,
input,
textarea,
select,
.card,
.dash-card,
.messageItem,
.notificationHistoryItem {
  overflow-wrap: anywhere;
}

input,
textarea,
select,
button {
  max-width: 100%;
}

button {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.pfIconSprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.pfCompactAction svg,
.calendarLessonSheet button svg,
.calendarLessonFact svg,
.calendarLessonReminder svg {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#pupilQuickActions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 4px 0 6px;
}

#pupilQuickActions.hidden {
  display: none;
}

#pupilQuickActions .pfCompactAction {
  width: 100%;
  min-width: 0;
  min-height: 56px;
  max-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 3px;
  font-size: 12px;
  line-height: 1.05;
  white-space: normal;
}

#pupilQuickActions .pfCompactAction span {
  max-width: 100%;
  text-align: center;
}

#view-pupils > h2 {
  margin-bottom: 4px;
}

.topbar {
  height: auto;
  min-height: calc(64px + var(--safe-top));
  flex: 0 0 auto;
  padding-top: var(--safe-top);
  padding-left: max(var(--pf-space-6), var(--safe-left));
  padding-right: max(var(--pf-space-6), var(--safe-right));
}

.layout {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
}

.sidebar {
  flex: 0 0 var(--pf-sidebar-width);
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(var(--pf-space-6), var(--safe-bottom));
}

.view,
.view.active,
.accountsBody,
.messagesPage,
.messagesConversationPanel,
.pupilHub,
.calendarWrap,
.tableWrap {
  max-width: 100%;
  min-width: 0;
  min-height: 0;
}

.tableWrap {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

table {
  max-width: 100%;
}

.calendarWrap {
  height: min(var(--calendar-available-height, calc(var(--app-height) - 140px)), calc(var(--app-height) - 112px));
  max-height: var(--calendar-available-height, calc(var(--app-height) - 140px));
  overflow: auto;
  overscroll-behavior: contain;
}

.modal {
  inset: 0;
  width: 100%;
  height: var(--app-height);
  max-width: 100%;
  max-height: var(--app-height);
  padding:
    max(12px, calc(var(--safe-top) + 8px))
    max(12px, calc(var(--safe-right) + 8px))
    max(12px, calc(var(--safe-bottom) + 8px))
    max(12px, calc(var(--safe-left) + 8px));
  overflow: hidden;
  overscroll-behavior: contain;
}

.modal.hidden {
  display: none !important;
}

.modalCard,
.receiptCropCard,
.lessonSummaryCard {
  max-width: min(100%, 920px);
  max-height: calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modalActions,
.lessonSummaryFooter,
.receiptCropActions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding-top: var(--pf-space-3);
  padding-bottom: max(var(--pf-space-2), var(--safe-bottom));
  background: inherit;
}

.lessonSummaryCard {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lessonSummaryBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

#lessonSummaryWorkflowModal .lessonSummaryFooter {
  position: static;
  flex: 0 0 auto;
  margin-top: 0;
}

@media (max-width: 768px) {
  html.keyboardOpen #lessonSummaryWorkflowModal {
    align-items: stretch;
    overflow-y: auto;
  }

  html.keyboardOpen #lessonSummaryWorkflowModal .lessonSummaryCard {
    max-height: calc(var(--app-visible-height, var(--app-height)) - 16px);
  }
}

.lessonSummaryPrimaryInput {
  min-height: 140px;
  max-height: min(34vh, 320px);
  overflow-y: auto;
}

.lessonSummaryGeneratedSection textarea {
  max-height: min(26vh, 220px);
  overflow-y: auto;
}

#lessonViewPanel {
  height: var(--app-height);
  max-height: var(--app-height);
  overflow: hidden;
}

#lessonViewPanel .modalCard {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  padding-bottom: max(16px, var(--safe-bottom));
}

.notificationCenterRoot {
  top: calc(var(--safe-top) + 72px);
  right: max(18px, var(--safe-right));
  bottom: max(18px, var(--safe-bottom));
  left: auto;
  max-width: calc(100vw - var(--safe-left) - var(--safe-right) - 24px);
  max-height: calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - 90px);
  overscroll-behavior: contain;
}

.notificationPanel {
  min-height: 0;
}

body.notificationCenterOpen .fabAdd {
  display: none;
}

.notificationPanel .checkLine {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  margin: 0;
  color: var(--pf-text-muted);
  font-size: 14px;
  line-height: 1.25;
}

.notificationPanel input[type="checkbox"] {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  border-radius: 6px;
}

.notificationPanel input[type="time"] {
  min-height: 38px;
  padding: 8px 10px;
}

.notificationPanel .btn {
  min-height: 40px;
}

.notificationPanelHeader h2 {
  font-size: clamp(24px, 7vw, 36px);
  line-height: 1.05;
}

.notificationHistory,
.notificationPrefs {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.fabAdd {
  right: max(18px, calc(var(--safe-right) + 18px));
  bottom: max(18px, calc(var(--safe-bottom) + 18px));
}

body.modalOpen .main,
body.sidebarOpen .main {
  overflow: hidden;
}

@media (max-width: 860px) {
  .topbar {
    height: auto;
    min-height: calc(58px + var(--safe-top));
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "menu brand logout"
      "version update notify";
    align-items: center;
    gap: 8px;
    padding-left: max(var(--pf-space-3), var(--safe-left));
    padding-right: max(var(--pf-space-3), var(--safe-right));
    padding-bottom: var(--pf-space-3);
    overflow: visible;
  }

  .menuToggle {
    grid-area: menu;
    width: 38px;
    height: 38px;
  }

  .brand {
    grid-area: brand;
    justify-content: flex-start;
    min-width: 0;
    overflow: visible;
  }

  .brandLogo {
    display: block;
    height: 32px;
    width: auto;
    max-width: 118px;
    flex: 0 0 auto;
  }

  .appVersion {
    grid-area: version;
    justify-self: stretch;
    text-align: center;
    font-size: 11px;
    padding: 5px 6px;
  }

  #btnForceLatestApp {
    grid-area: update;
    justify-self: stretch;
  }

  #btnNotifications {
    grid-area: notify;
    justify-self: stretch;
  }

  #btnLogout {
    grid-area: logout;
    justify-self: end;
    width: auto;
    min-width: 66px;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1;
  }

  .btnLatestApp {
    min-height: 34px;
    border-radius: 999px;
    font-size: 12px;
    padding: 7px 8px;
  }

  .layout {
    padding:
      var(--pf-space-4)
      max(var(--pf-space-4), var(--safe-right))
      max(var(--pf-space-4), var(--safe-bottom))
      max(var(--pf-space-4), var(--safe-left));
  }

  .sidebar {
    top: calc(var(--shell-header-bottom, calc(var(--safe-top) + 70px)) + 8px);
    bottom: max(12px, var(--safe-bottom));
    max-height: calc(var(--app-height) - var(--shell-header-bottom, calc(var(--safe-top) + 70px)) - var(--safe-bottom) - 20px);
    overflow-y: auto;
  }

  .notificationCenterRoot {
    inset:
      calc(var(--safe-top) + 112px)
      max(var(--pf-space-3), var(--safe-right))
      max(var(--pf-space-3), var(--safe-bottom))
      max(var(--pf-space-3), var(--safe-left));
    width: auto;
    max-height: none;
  }

  .modalCard,
  .receiptCropCard,
  .lessonSummaryCard {
    width: 100%;
    max-height: calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - 24px);
  }

  .main {
    padding-bottom: max(var(--pf-space-4), var(--safe-bottom));
  }

  .accountsTabs,
  #phTabs {
    display: flex;
    align-items: center;
  }

  .accountsTabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  #phTabs {
    flex-wrap: wrap;
  }

  .aTab,
  .phTab {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    min-width: max-content;
    flex: 0 0 auto;
  }

  .expensesTableWrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .expensesTable {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 var(--pf-space-3);
  }

  .expensesTable thead {
    display: none;
  }

  .expensesTable,
  .expensesTable tbody,
  .expensesTable tr,
  .expensesTable td {
    display: block;
    width: 100%;
  }

  .expensesTable tr {
    padding: var(--pf-space-4);
    border: 1px solid var(--pf-border);
    border-radius: var(--pf-radius-lg);
    background: var(--pf-surface);
    box-shadow: var(--pf-shadow-sm);
  }

  .expensesTable td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: var(--pf-space-3);
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid var(--pf-border);
    overflow-wrap: anywhere;
  }

  .expensesTable td::before {
    content: attr(data-label);
    color: var(--pf-text-muted);
    font-weight: 650;
  }

  .expensesTable td:last-child {
    border-bottom: 0;
  }

  .expensesTable .moneyCell {
    overflow-wrap: normal;
    word-break: normal;
  }

  .expensesTable .expenseActions {
    display: flex;
    justify-content: flex-start;
    padding-top: var(--pf-space-3);
  }

  .expensesTable .expenseActions::before {
    display: none;
  }

  .expensesTable .expenseActions .btnSmall {
    min-width: 92px;
    min-height: 42px;
  }

  #view-pupils .tableWrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  #view-pupils .table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 var(--pf-space-3);
  }

  #view-pupils .pupilsTable td {
    min-width: 0;
  }

  #view-pupils .table thead {
    display: none;
  }

  #view-pupils .table,
  #view-pupils .table tbody,
  #view-pupils .table tr,
  #view-pupils .table td {
    display: block;
    width: 100%;
  }

  #view-pupils .table tr:not(.pupilSectionRow) {
    padding: var(--pf-space-4);
    border: 1px solid var(--pf-border);
    border-radius: var(--pf-radius-lg);
    background: var(--pf-surface);
    box-shadow: var(--pf-shadow-sm);
  }

  #view-pupils .table .pupilSectionRow {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #view-pupils .table .pupilSectionRow td {
    padding: var(--pf-space-2) 0;
    border: 0;
    color: var(--pf-text-muted);
  }

  #view-pupils .table tr:not(.pupilSectionRow) td {
    display: grid;
    grid-template-columns: minmax(104px, 36%) minmax(0, 1fr);
    gap: var(--pf-space-3);
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid var(--pf-border);
    overflow-wrap: anywhere;
  }

  #view-pupils .table tr:not(.pupilSectionRow) td::before {
    content: attr(data-label);
    color: var(--pf-text-muted);
    font-weight: 650;
  }

  #view-pupils .table tr:not(.pupilSectionRow) td:last-child {
    border-bottom: 0;
  }

  #view-pupils .table tr:not(.pupilSectionRow) td:nth-child(11) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: var(--pf-space-3);
  }

  #view-pupils .table tr:not(.pupilSectionRow) td:nth-child(11)::before {
    display: none;
  }

  #view-pupils .table tr:not(.pupilSectionRow) td:nth-child(11) .btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 116px;
    min-height: 42px;
    margin-left: 0 !important;
  }
}

@media (max-width: 430px) {
  .brandLogo {
    max-width: 100px;
  }

  .appVersion,
  .btnLatestApp,
  #btnNotifications {
    font-size: 11px;
  }
}

/* ===== v10.3.21 mobile calendar summary dashboard ===== */
#view-calendar.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.calendarControls {
  grid-template-areas:
    "date date"
    "nav modes";
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
}

.calendarDateRange { grid-area: date; }
.calendarControls .calNav { grid-area: nav; }
.calendarControls .calModes { grid-area: modes; }

.calendarControls .calNav,
.calendarControls .calModes {
  flex-wrap: nowrap;
  gap: 5px;
}

.calendarControls .calModes {
  padding: 2px;
  border: 1px solid var(--pf-border, #dbe3ee);
  border-radius: 12px;
  background: var(--pf-muted-surface, #f5f7fa);
}

.calendarControls .calModes button {
  border-color: transparent;
  border-radius: 9px;
}

.calendarControls .calModes button:not(.btnSecondary) {
  background: var(--pf-primary, #2563eb);
  color: #fff;
}

#view-calendar.active .calendarWrap {
  flex: 1 1 auto;
  min-height: 320px;
  height: auto;
  max-height: none;
}

.calendarSummaryMount {
  flex: 0 0 auto;
  position: relative;
  min-width: 0;
  margin-top: 8px;
  padding-top: 27px;
}

.calendarSummaryHeader {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 1;
  min-height: 44px;
  pointer-events: none;
}

.calendarSummaryToggle {
  pointer-events: auto;
  position: absolute;
  top: -8px;
  right: 0;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 12px;
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #0f172a);
  box-shadow: 0 3px 10px rgba(15, 23, 42, .10);
}

.calendarSummaryToggle span {
  display: block;
  font-size: 20px;
  line-height: 1;
}

.calendarSummaryCollapsed {
  display: none;
  min-width: 0;
  height: 44px;
  align-items: center;
  gap: 8px;
  padding: 0 52px 0 12px;
  border: 1px solid var(--pf-border, #dbe3ee);
  border-radius: 13px;
  background: var(--pf-surface, #fff);
  box-shadow: 0 3px 12px rgba(15, 23, 42, .08);
  overflow: hidden;
}

.calendarSummaryCollapsed span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendarSummaryStrip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(150px, 43vw, 170px);
  gap: 9px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 7px;
  scroll-snap-type: x mandatory;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.calendarSummaryCard {
  box-sizing: border-box;
  height: 146px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--pf-border, #dbe3ee);
  border-radius: 15px;
  background: var(--pf-surface, #fff);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
  scroll-snap-align: start;
}

.calendarSummaryCard h3 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.2;
}

.calendarSummaryCard p {
  margin: 3px 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendarSummaryViewStudent {
  width: 100%;
  min-height: 36px;
  margin-top: 6px;
  padding: 5px 9px;
  font-size: 13px;
}

.calendarSummaryMount.isCollapsed {
  padding-top: 0;
}

.calendarSummaryMount.isCollapsed .calendarSummaryHeader {
  position: relative;
}

.calendarSummaryMount.isCollapsed .calendarSummaryCollapsed {
  display: flex;
}

.calendarSummaryMount.isCollapsed .calendarSummaryStrip {
  display: none;
}

body.calendarViewActive .fabAdd:not([style*="top"]) {
  bottom: calc(195px + env(safe-area-inset-bottom, 0px));
}

body.calendarViewActive:has(.calendarSummaryMount.isCollapsed) .fabAdd:not([style*="top"]) {
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 430px) {
  .calendarControls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .calendarControls .calNav button,
  .calendarControls .calModes button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 8px;
  }
}

@media (max-width: 375px) {
  .calendarControls {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "date" "nav" "modes";
  }

  .calendarSummaryStrip {
    grid-auto-columns: 155px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .calendarSummaryCard { height: 132px; }
  .calendarSummaryStrip { grid-auto-columns: 158px; }
  #view-calendar.active .calendarWrap { min-height: 230px; }
}

@media (prefers-reduced-motion: reduce) {
  .calendarSummaryStrip { scroll-behavior: auto; }
}

/* v0.9.60 full rebuild: force the Pupils table into readable cards on phones and small tablets. */
.pupilAccordionChevron {
  display: none;
}

@media (max-width: 900px) {
  #view-pupils > .row,
  #view-pupils .filters,
  #view-pupils .actionsRow:not(#pupilQuickActions) {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #view-pupils #pupilSearch,
  #view-pupils #pupilStatusFilter,
  #view-pupils #pupilGo,
  #view-pupils #pupilClearSearch,
  #view-pupils #pupilExportCsv {
    width: 100%;
    max-width: none !important;
    min-height: 48px;
    white-space: normal;
  }

  #view-pupils .tableWrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  #view-pupils table,
  #view-pupils thead,
  #view-pupils tbody,
  #view-pupils tr,
  #view-pupils th,
  #view-pupils td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #view-pupils thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  #view-pupils #pupilTableBody tr.pupilSectionRow {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #view-pupils #pupilTableBody tr:not(.pupilSectionRow) {
    margin: 0 0 14px;
    padding: 14px;
    border: 1px solid var(--pf-border, #dfe7f1);
    border-radius: var(--pf-radius-lg, 22px);
    background: var(--pf-surface, #fff);
    box-shadow: var(--pf-shadow-sm, 0 8px 18px rgba(15, 23, 42, .06));
  }

  #view-pupils #pupilTableBody tr.selectedPupil {
    border-color: var(--pf-primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .14);
  }

  #view-pupils #pupilTableBody td {
    display: grid;
    grid-template-columns: minmax(92px, 36%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 8px 0;
    border-bottom: 1px solid var(--pf-border, #dfe7f1);
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  #view-pupils #pupilTableBody td::before {
    content: attr(data-label);
    color: var(--pf-text-muted, #66758b);
    font-weight: 800;
  }

  #view-pupils #pupilTableBody .pupilSectionRow td::before {
    content: "";
    display: none;
  }

  #view-pupils #pupilTableBody td:last-child {
    border-bottom: 0;
  }

  #view-pupils #pupilTableBody td[data-label="Actions"] {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
  }

  #view-pupils #pupilTableBody td[data-label="Actions"]::before {
    flex: 0 0 100%;
  }

  #view-pupils #pupilTableBody td[data-label="Actions"] .btn {
    flex: 1 1 calc(50% - 8px);
    margin-left: 0 !important;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    white-space: normal;
  }
}

/* v10.1.9: compact, touch-friendly pupil accordion on phones and small tablets. */
@media (max-width: 900px) {
  #view-pupils .pupilSearchControls {
    grid-template-columns: minmax(0, 1fr) minmax(112px, 34%);
    align-items: stretch !important;
    margin-bottom: 8px !important;
  }

  #view-pupils .pupilSearchControls #pupilSearch,
  #view-pupils .pupilSearchControls #pupilStatusFilter {
    min-height: 44px;
  }

  #view-pupils .pupilSearchControls #pupilClearSearch,
  #view-pupils .pupilSearchControls #pupilExportCsv {
    min-height: 42px;
  }

  #view-pupils .pupilSearchControls.hasResults {
    gap: 8px !important;
    margin-top: 4px !important;
  }

  #view-pupils .pupilSearchControls:not(.hasSearch) #pupilClearSearch {
    display: none;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 12px;
    row-gap: 0;
    margin-bottom: 8px;
    padding: 11px 14px;
    cursor: pointer;
    touch-action: manipulation;
    transition:
      border-color 180ms ease,
      box-shadow 180ms ease,
      background-color 180ms ease;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .3);
    outline-offset: 2px;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow td {
    grid-column: 1 / -1;
    max-height: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    overflow: hidden;
    transition:
      max-height 220ms ease,
      padding 220ms ease,
      opacity 160ms ease,
      border-color 220ms ease;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow td.pupilAccordionSummary {
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-height: 56px;
    min-height: 44px;
    padding: 2px 0 7px;
    opacity: 1;
    overflow: visible;
    font-size: 16px;
    font-weight: 800;
  }

  #view-pupils #pupilTableBody td.pupilAccordionSummary::before {
    display: none;
  }

  #view-pupils .pupilAccordionName {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #view-pupils .pupilAccordionChevron {
    display: inline-block;
    flex: 0 0 auto;
    color: var(--pf-text-muted, #66758b);
    font-size: 24px;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 200ms ease;
  }

  #view-pupils #pupilTableBody tr.pupilExpanded .pupilAccordionChevron {
    transform: rotate(180deg);
  }

  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td[data-label="Mobile"],
  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td[data-label="Rate"],
  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td[data-label="Transmission"],
  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td[data-label="Status"] {
    display: block;
    grid-column: auto;
    max-height: 38px;
    min-height: 32px;
    padding: 6px 8px;
    border: 0;
    border-radius: 10px;
    opacity: 1;
    background: var(--pf-surface-muted, #f5f8fc);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td[data-label="Mobile"]::before,
  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td[data-label="Rate"]::before,
  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td[data-label="Transmission"]::before,
  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td[data-label="Status"]::before {
    display: none;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td[data-label="Status"] {
    color: #16803d;
    font-weight: 800;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td.pupilStatus-inactive,
  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td.pupilStatus-passed {
    color: #b42318;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td.pupilStatus-waiting {
    color: #9a6700;
  }

  #view-pupils #pupilTableBody tr.pupilExpanded {
    border-color: var(--pf-primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
  }

  #view-pupils #pupilTableBody tr.pupilExpanded td {
    display: grid;
    grid-column: 1 / -1;
    max-height: 96px;
    padding: 8px 0;
    border-bottom: 1px solid var(--pf-border, #dfe7f1);
    opacity: 1;
  }

  #view-pupils #pupilTableBody tr.pupilExpanded td.pupilAccordionSummary {
    display: flex;
    max-height: 56px;
  }

  #view-pupils #pupilTableBody tr.pupilExpanded td[data-label="Actions"] {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    grid-column: 1 / -1;
    max-height: 220px;
    padding-top: 12px;
    border-bottom: 0;
    opacity: 1;
  }

  #view-pupils #pupilTableBody tr.pupilExpanded td[data-label="Actions"] .btn {
    flex: 1 1 calc(50% - 8px);
    min-height: 44px;
    margin-left: 0 !important;
  }
}

@media (max-width: 430px) {
  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td[data-label="Mobile"] {
    display: none;
  }
}

/* v10.2.0: Accounts dashboard, Profile backup, and compact pupil identity rows. */
.accountsView .accountsHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.accountsShortcutGrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.accountsShortcutGrid .aTab {
  display: grid;
  place-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 78px;
  padding: 10px 6px;
  border: 1px solid var(--pf-border, #dfe7f1);
  border-radius: 14px;
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #111827);
  box-shadow: var(--pf-shadow-sm, 0 2px 8px rgba(15, 23, 42, .08));
  font-weight: 700;
}

.accountsShortcutGrid .aTab > span {
  font-size: 24px;
  line-height: 1;
}

.accountsShortcutGrid .aTab.isActive {
  border-color: var(--pf-primary, #2563eb);
  color: var(--pf-primary, #2563eb);
  box-shadow: inset 0 -3px 0 var(--pf-primary, #2563eb);
}

.accountsFilters {
  display: grid;
  gap: 12px;
  max-width: none;
  margin-bottom: 18px;
}

.accountsPresets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.accountsPresets .presetBtn {
  min-height: 40px;
  padding: 7px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--pf-surface-muted, #eef2f7);
  color: var(--pf-text, #111827);
  font-weight: 700;
}

.accountsPresets .presetBtn.isActive {
  background: var(--pf-primary, #2563eb);
  color: #fff;
}

.savedPeriodPicker {
  display: grid;
  gap: 6px;
  color: var(--pf-text-muted, #66758b);
  font-size: 13px;
  font-weight: 700;
}

.savedPeriodPicker select {
  min-height: 44px;
}

.accountsRangeToggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid var(--pf-border, #dfe7f1);
  border-radius: 14px;
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #111827);
  text-align: left;
  box-shadow: var(--pf-shadow-sm, 0 2px 8px rgba(15, 23, 42, .08));
}

.accountsRangeToggle strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accountsRangeChevron {
  font-size: 22px;
  transition: transform 180ms ease;
}

.accountsRangeToggle[aria-expanded="true"] .accountsRangeChevron {
  transform: rotate(180deg);
}

.accountsDateEditor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.accountsDateEditor label {
  display: grid;
  gap: 5px;
  color: var(--pf-text-muted, #66758b);
  font-size: 13px;
  font-weight: 700;
}

.accountsDateEditor input {
  width: 100%;
  min-height: 44px;
}

.accountsDateEditor.hidden {
  display: none;
}

.accountsPackButton {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
}

.accountsExportActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--pf-space-2);
}

.accountsExportStatus {
  grid-column: 1 / -1;
  min-height: 1.4em;
  margin: 0;
}

.accountsRecordsExportCard {
  width: min(520px, 100%);
}

.profitLossReportCard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 18px;
  margin-top: 18px;
}

.profitLossReportCard h3,
.profitLossReportCard p {
  margin: 0;
}

.profitLossReportCard p {
  margin-top: 5px;
}

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

.profitLossReportCard > [role="status"] {
  grid-column: 1 / -1;
  min-height: 1.25em;
}

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

  .profitLossReportActions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .profitLossReportActions .btn {
    width: 100%;
    min-height: 48px;
  }
}

.accountsRecordsRange {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--pf-space-3);
  margin-bottom: var(--pf-space-4);
}

.accountsRecordsRange span,
.accountsRecordsSelections label {
  padding: var(--pf-space-3);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
  background: var(--pf-surface-muted);
}

.accountsRecordsSelections {
  display: grid;
  gap: var(--pf-space-2);
  margin: 0;
  padding: 0;
  border: 0;
}

.accountsRecordsSelections legend {
  margin-bottom: var(--pf-space-2);
  font-weight: 800;
}

.accountsRecordsSelections label {
  display: flex;
  align-items: center;
  gap: var(--pf-space-3);
}

.accountsRecordsSelections input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
}

@media (max-width: 620px) {
  .accountsExportActions,
  .accountsRecordsRange {
    grid-template-columns: 1fr;
  }
}

.accountsBody {
  overflow: visible;
}

.accountsSummaryCard {
  overflow: hidden;
  border: 1px solid var(--pf-border, #dfe7f1);
  border-radius: 16px;
  background: var(--pf-surface, #fff);
  box-shadow: var(--pf-shadow-sm, 0 2px 8px rgba(15, 23, 42, .08));
}

.accountsFinancialGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 16px;
}

.accountsFinancialGrid > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 0 14px;
  border-right: 1px solid var(--pf-border, #dfe7f1);
}

.accountsFinancialGrid > div:first-child {
  padding-left: 0;
}

.accountsFinancialGrid > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.accountsFinancialGrid span,
.accountsFinancialGrid small {
  color: var(--pf-text-muted, #66758b);
}

.accountsFinancialGrid strong {
  overflow-wrap: anywhere;
  color: var(--pf-primary, #2563eb);
  font-size: clamp(18px, 3vw, 27px);
}

.accountsFinancialGrid > div:nth-child(2) strong {
  color: #c81e1e;
}

.accountsFinancialGrid > div:nth-child(3) strong {
  color: #138a4b;
}

.accountsFinancialGrid > div:nth-child(4) strong {
  color: #7a3db8;
}

.accountsBreakdownToggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 0;
  border-top: 1px solid var(--pf-border, #dfe7f1);
  background: transparent;
  color: var(--pf-primary, #2563eb);
  font-weight: 800;
  text-align: left;
}

.accountsBreakdownToggle span:last-child {
  margin-left: auto;
  font-size: 24px;
}

.accountsBreakdownDetails {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--pf-border, #dfe7f1);
}

.accountsBreakdownDetails.hidden {
  display: none;
}

.accountsBreakdownDetails > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.accountsActivitySection {
  margin-top: 22px;
}

.accountsActivityHeading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 6px;
}

.accountsActivityHeading h3 {
  margin: 0 0 10px;
}

.accountsViewAll {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--pf-primary, #2563eb);
  font-weight: 800;
}

.accountsActivityList {
  margin: 0;
  padding: 0 16px;
  border: 1px solid var(--pf-border, #dfe7f1);
  border-radius: 16px;
  background: var(--pf-surface, #fff);
  box-shadow: var(--pf-shadow-sm, 0 2px 8px rgba(15, 23, 42, .08));
  list-style: none;
}

.accountsActivityRow {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto 18px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border-bottom: 1px solid var(--pf-border, #dfe7f1);
}
.accountsTransactionRow { cursor: pointer; border-radius: 8px; }
.accountsTransactionRow:hover { background: #f8fbff; }
.accountsTransactionRow:focus-visible { outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 2px; }
.accountsTransactionDetailModal { z-index: 10010; }
.accountsTransactionDetailCard { width: min(94vw, 560px); max-height: min(90vh, 760px); display: flex; flex-direction: column; }
.accountsTransactionDetailHeader { display: flex; justify-content: space-between; gap: 12px; padding: 18px 18px 10px; }
.accountsTransactionDetailHeader h2, .accountsTransactionDetailHeader p { margin: 0 0 4px; }
.accountsTransactionDetailAmount { font-size: 1.5rem; font-weight: 800; color: var(--pf-text, #0f172a); }
.accountsTransactionDetailHeader > button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 28px; }
.accountsTransactionDetailBody { overflow-y: auto; padding: 4px 18px 14px; }
.accountsDetailField, .accountsAllocationRow { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; min-height: 44px; padding: 10px 0; border-bottom: 1px solid var(--pf-border, #dfe7f1); }
.accountsDetailField span, .accountsAllocationRow span { color: var(--pf-text-muted, #66758b); overflow-wrap: anywhere; }
.accountsDetailField strong, .accountsAllocationRow strong { text-align: right; overflow-wrap: anywhere; }
.accountsDetailSection { margin-top: 14px; }
.accountsTransactionDetailActions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--pf-border, #dfe7f1); }
.accountsTransactionDetailActions .btn { min-height: 44px; flex: 1 1 130px; }

.accountsActivityRow:last-child {
  border-bottom: 0;
}

.accountsActivityIcon,
.pupilAccordionAvatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: 800;
}

.tone-0 { background: #dbeafe; color: #1d4ed8; }
.tone-1 { background: #dcfce7; color: #15803d; }
.tone-2 { background: #ede9fe; color: #6d28d9; }
.tone-3 { background: #fef3c7; color: #a16207; }
.tone-4 { background: #fee2e2; color: #b91c1c; }

.accountsActivityRow time {
  color: var(--pf-text-muted, #66758b);
}

.accountsActivityAmount {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.accountsActivityChevron {
  color: var(--pf-text-muted, #66758b);
  font-size: 24px;
}

.accountsActivityEmpty {
  padding: 18px 0;
}

.settingsSectionHeading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.reportingPeriodsSettings {
  margin-top: 18px;
}

.reportingPeriodRow {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(110px, .7fr) minmax(220px, 2fr) auto auto;
  align-items: end;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--pf-border, #dfe7f1);
}

.reportingPeriodRow label {
  display: grid;
  gap: 5px;
}

.reportingPeriodEndHint {
  align-self: center;
  margin: 0;
}

.profileSectionEyebrow {
  margin: 0 0 4px;
  color: var(--pf-primary, #2563eb);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pupilAccordionAvatar,
.pupilAccordionMeta,
.pupilAccordionStatus {
  display: none;
}

@media (max-width: 900px) {
  .accountsShortcutGrid {
    overflow: visible;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-bottom: 0;
  }

  .accountsShortcutGrid .aTab {
    min-width: 0;
    min-height: 74px;
    font-size: 12px;
  }

  .accountsPresets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .accountsFinancialGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 0;
  }

  .accountsFinancialGrid > div,
  .accountsFinancialGrid > div:first-child,
  .accountsFinancialGrid > div:last-child {
    padding: 0 12px;
    border-right: 1px solid var(--pf-border, #dfe7f1);
  }

  .accountsFinancialGrid > div:nth-child(2n) {
    border-right: 0;
  }

  .accountsActivityRow {
    grid-template-columns: 40px minmax(0, 1fr) auto 16px;
  }

  .accountsActivityRow time {
    display: none;
  }

  .reportingPeriodRow {
    grid-template-columns: minmax(0, 1fr) minmax(105px, .45fr);
  }

  .reportingPeriodEndHint,
  .reportingPeriodDefault {
    grid-column: 1 / -1;
  }

  #view-pupils .pupilSearchControls {
    grid-template-columns: minmax(0, 1fr) minmax(108px, 34%) auto;
    gap: 6px !important;
  }

  #view-pupils .pupilSearchControls #pupilClearSearch {
    grid-column: 1 / 2;
    justify-self: start;
    width: auto;
    min-height: 44px;
  }

  #view-pupils .pupilSearchControls #pupilExportCsv {
    grid-column: 3;
    grid-row: 1;
    width: auto;
    min-height: 44px;
    padding-inline: 12px;
    border: 1px solid var(--pf-border, #dfe7f1);
    background: var(--pf-surface, #fff);
    color: var(--pf-text, #111827);
  }

  #view-pupils #pupilTableBody tr.pupilDataRow {
    display: block;
    min-height: 68px;
    margin-bottom: 6px;
    padding: 0 12px;
    border-radius: 14px;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow:not(.pupilExpanded) td:not(.pupilAccordionSummary) {
    display: none !important;
    max-height: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow td.pupilAccordionSummary,
  #view-pupils #pupilTableBody tr.pupilExpanded td.pupilAccordionSummary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 9px;
    min-height: 68px;
    max-height: 76px;
    padding: 7px 0;
    border: 0;
  }

  #view-pupils .pupilAccordionIdentity {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  #view-pupils .pupilAccordionAvatar {
    display: inline-grid;
    width: 42px;
    height: 42px;
  }

  #view-pupils .pupilAccordionNameBlock {
    display: grid;
    min-width: 0;
  }

  #view-pupils .pupilAccordionName {
    font-size: 15px;
  }

  #view-pupils .pupilAccordionMeta {
    display: block;
    overflow: hidden;
    color: var(--pf-text-muted, #66758b);
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #view-pupils .pupilAccordionStatus {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e8f7ee;
    color: #16803d;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  #view-pupils .pupilAccordionStatus.pupilStatus-test-booked,
  #view-pupils .pupilAccordionStatus.pupilStatus-testbooked {
    background: #dbeafe;
    color: #1d4ed8;
  }

  #view-pupils .pupilAccordionStatus.pupilStatus-passed {
    background: #fef3c7;
    color: #a16207;
  }

  #view-pupils .pupilAccordionStatus.pupilStatus-inactive {
    background: #eef2f7;
    color: #66758b;
  }

  #view-pupils .pupilAccordionStatus.pupilStatus-archived {
    background: #fee2e2;
    color: #9f3434;
  }

  #view-pupils #pupilTableBody tr.pupilExpanded td:not(.pupilAccordionSummary) {
    max-height: 110px;
    padding: 7px 0;
  }

  #view-pupils #pupilTableBody tr.pupilExpanded td[data-label="Actions"] {
    gap: 7px;
    max-height: 280px;
  }

  #view-pupils #pupilTableBody tr.pupilExpanded td[data-label="Actions"] .btn {
    flex: 1 1 calc(33.333% - 7px);
    min-width: 92px;
  }
}

@media (max-width: 520px) {
  .accountsShortcutGrid .aTab {
    min-height: 66px;
    padding: 8px 3px;
    font-size: 10px;
  }

  .accountsShortcutGrid .aTab > span {
    font-size: 20px;
  }

  .accountsActivityList {
    padding: 0 10px;
  }

  .accountsActivityRow {
    grid-template-columns: 36px minmax(0, 1fr) auto 12px;
    gap: 7px;
  }

  .accountsActivityIcon {
    width: 34px;
    height: 34px;
  }

  #view-pupils .pupilSearchControls {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  #view-pupils .pupilSearchControls #pupilExportCsv {
    grid-column: 2;
    grid-row: 2;
  }

  #view-pupils .pupilAccordionStatus {
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ===== Student profile directions ===== */
.pupilDirectionsAction { margin: 10px 0 12px !important; }
.pupilDirectionsButton {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pupilDirectionsMessage {
  margin: 8px 0 0;
  color: var(--danger, #dc2626);
  font-size: .92rem;
  line-height: 1.35;
}
.navigationProviderModal {
  align-items: flex-end;
  padding: 16px;
}
.navigationProviderSheet {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  border-radius: 22px 22px 16px 16px;
}
.navigationProviderHandle {
  width: 42px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .55);
}
.navigationProviderSheet h3 {
  margin: 0 0 14px;
  text-align: center;
}
.navigationProviderActions {
  display: grid;
  gap: 8px;
}
.navigationProviderActions button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--pf-border, rgba(148, 163, 184, .3));
  border-radius: 14px;
  background: var(--surface, #fff);
  color: var(--text, #0f172a);
  font: inherit;
  font-weight: 700;
}
.navigationProviderActions button:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.navigationProviderActions .navigationProviderCancel {
  justify-content: center;
  margin-top: 4px;
}
.navigationProviderUnavailable {
  margin: -2px 8px 4px;
  color: var(--muted, #64748b);
  font-size: .84rem;
}
@media (min-width: 700px) {
  .navigationProviderModal { align-items: center; }
  .navigationProviderSheet { border-radius: 20px; }
}

/* ===== Focused calendar lesson modal ===== */
.calendarLessonModal {
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  background: rgba(15, 23, 42, .38);
}
.calendarLessonSheet {
  flex: 0 0 100%;
  width: 100%;
  min-width: 0;
  max-width: 620px;
  height: min(100dvh, 940px);
  max-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #f5f8fc;
  color: var(--text, #0f172a);
  box-shadow: 0 -12px 40px rgba(15, 23, 42, .2);
}
.calendarLessonHeader {
  position: sticky;
  top: 0;
  z-index: 2;
  min-width: 0;
  min-height: 58px;
  max-height: calc(58px + env(safe-area-inset-top));
  display: flex;
  gap: 8px;
  align-items: center;
  padding:
    max(7px, env(safe-area-inset-top))
    12px
    7px;
  border-bottom: 0;
  background: var(--pf-primary, #176ae0);
  color: #fff;
}
.calendarLessonHeader h3 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 1.25rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendarLessonBack,
.calendarLessonMessages {
  flex: 0 0 44px;
  position: relative;
  width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
}

/* ===== v10.3.34 Generic data-import preview responsive correction (read-only) ===== */
.importDataManagement { width: 100%; max-width: 100%; min-width: 0; margin-top: 18px; overflow-x: clip; }
.importDataHeader { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.importDataHeader h3 { margin: 0 0 4px; }
.importDataFilePicker { display: grid; min-width: 0; gap: 8px; margin-top: 14px; font-weight: 700; }
.importDataFilePicker input { box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; font-size: 16px; line-height: 1.35; }
.importDataProgress { max-width: 100%; margin: 12px 0; color: var(--muted, #64748b); overflow-wrap: anywhere; }
.importDataSummary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 8px; margin: 16px 0; }
.importDataSummary div { min-width: 0; padding: 10px; border: 1px solid var(--pf-border, #dbe3ee); border-radius: 12px; background: var(--pf-surface, #fff); }
.importDataSummary dt { color: var(--muted, #64748b); font-size: .82rem; }
.importDataSummary dd { margin: 3px 0 0; font-weight: 800; overflow-wrap: anywhere; }
.importDataNames { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0; padding: 12px; border: 1px solid var(--pf-border, #dbe3ee); border-radius: 12px; }
.importDataNames h4 { margin: 0 0 4px; }
.importDataFuture { margin: 14px 0; padding: 12px; border: 1px solid var(--pf-border, #dbe3ee); border-radius: 12px; background: #eff6ff; }
.importDataFuture h4, .importDataFuture p { margin: 0; }
.importDataFuture p { margin-top: 4px; }
.importDataFilters { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.importDataFilters .active { background: var(--pf-primary, #2563eb); color: #fff; }
.importDataTableWrap { display: block; width: 100%; max-width: 100%; min-width: 0; max-height: 440px; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.importDataTableWrap table { width: 940px; max-width: none; min-width: 940px; }
.importDataTableWrap td { vertical-align: top; }
.importDataTableWrap .preview-review td { background: #fffbeb; }
.importDataTableWrap .preview-information td { background: #eff6ff; }
.importDataTableWrap .preview-rejected td { background: #fef2f2; }
.importDataPager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.importLearnerModal { padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); }
.importLearnerModal .modalCard { display: flex; flex-direction: column; width: min(560px, calc(100vw - 28px)); max-width: calc(100vw - 28px); min-width: 0; max-height: min(720px, calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); overflow: hidden; }
.importLearnerModal label { display: grid; gap: 6px; }
.importLearnerModal input { width: 100%; min-width: 0; box-sizing: border-box; font-size: 16px; }
.importLearnerList { display: grid; min-height: 0; margin-top: 12px; border-top: 1px solid var(--pf-border, #dbe3ee); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.importLearnerRow { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--pf-border, #dbe3ee); }
.importCompletionPreview { margin-top: 20px; opacity: .72; }
.importCompletionPreview h4, .importCompletionPreview p { margin-top: 0; }
.importCompletionPreview .btn { width: 100%; margin-top: 10px; }

@media (max-width: 600px) {
  .importDataHeader { align-items: stretch; flex-direction: column; }
  .importDataSummary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .importDataNames { align-items: stretch; flex-direction: column; }
  .importDataPager { justify-content: space-between; }
}
.calendarLessonBack svg,
.calendarLessonMessages svg {
  width: 24px;
  height: 24px;
  margin: auto;
}
.calendarLessonUnread {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
}
.calendarLessonBody {
  width: 100%;
  min-width: 0;
  overflow: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: var(--pf-space-3, 12px) var(--pf-space-3, 12px) 30px;
  scroll-behavior: smooth;
}
.calendarLessonLoading {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #e8f1ff;
  color: #145ac7;
  font-weight: 700;
}
.calendarLessonSummary h2 {
  max-width: 100%;
  min-width: 0;
  margin: 0 0 12px;
  overflow: hidden;
  font-size: 1.35rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendarLessonFact {
  width: 100%;
  min-width: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  color: #17233b;
  line-height: 1.35;
  white-space: normal;
}
.calendarLessonFact > svg {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  color: #12396f;
}
.calendarLessonFact > span:last-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}
.calendarLessonBadges {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.calendarLessonBadge {
  flex: 0 0 auto;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 9px;
  background: #e8f1ff;
  color: #145ac7;
  font-size: .86rem;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: normal;
  white-space: nowrap;
}
.calendarLessonBadge.is-positive {
  background: #dcf8e2;
  color: #15803d;
}
.calendarLessonBadge.is-negative {
  background: #fee2e2;
  color: #b91c1c;
}
.calendarLessonBadge.is-payment {
  background: #0b4c91;
  color: #fff;
}
.calendarLessonBadge.is-booking {
  background: #ffedd2;
  color: #c0560a;
}
.calendarLessonProfile {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-color: #176ae0;
  color: #145ac7;
}

.calendarLessonAddPayment {
  min-height: 40px;
  margin-top: 8px;
  padding-block: 7px;
}
.calendarLessonProfile svg {
  width: 20px;
  height: 20px;
  flex-basis: 20px;
}
.calendarLessonCard {
  width: 100%;
  min-width: 0;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--pf-border, rgba(148, 163, 184, .25));
  border-radius: var(--pf-radius-lg, 16px);
  background: var(--pf-surface, #fff);
  box-shadow: var(--pf-shadow-sm, 0 4px 14px rgba(15, 23, 42, .07));
}
.calendarLessonCard h4 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}
.calendarLessonCard p {
  margin: 6px 0;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
}
.calendarLessonCard ul {
  margin: 8px 0 0;
  padding-left: 20px;
}
.calendarLessonPreviousDate {
  color: #176ae0;
  font-size: .9rem;
}
.calendarLessonNotesButton {
  display: block;
  margin: 10px 0 0 auto;
}
.calendarLessonSectionHeading {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.calendarLessonSectionHeading .btn {
  flex: 0 0 auto;
  min-height: 44px;
}
.calendarLessonActionGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.calendarLessonActionGrid button {
  min-width: 0;
  min-height: 58px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 5px 4px;
  border: 1px solid #bfd4f1;
  border-radius: 12px;
  background: #f5f9ff;
  color: #1559be;
  font: inherit;
  font-size: .8rem;
  font-weight: 800;
  line-height: 1.05;
  white-space: normal;
}
.calendarLessonActionGrid button svg {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
}
.calendarLessonDirectionsGrid button svg {
  width: 26px;
  height: 26px;
  flex-basis: 26px;
}
.calendarLessonActionGrid button span {
  max-width: 100%;
  text-align: center;
}
.calendarLessonActionGrid button:disabled {
  opacity: .42;
}
.calendarLessonDirectionsGrid button:nth-child(2) {
  border-color: #b7dfbd;
  background: #f0fbf1;
  color: #15803d;
}
.calendarLessonDirectionsGrid button:nth-child(3) {
  border-color: #dacaf0;
  background: #faf7ff;
  color: #6b2fad;
}
.calendarLessonContactGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.calendarLessonContactGrid button {
  min-height: 58px;
  background: #fff;
  color: #17324d;
}
.calendarLessonContactGrid button:nth-child(1) svg { color: #17a34a; }
.calendarLessonContactGrid button:nth-child(2) svg { color: #176ae0; }
.calendarLessonContactGrid button:nth-child(3) svg { color: #e76f00; }
.calendarLessonContactGrid button:nth-child(4) svg { color: #dc2626; }
.calendarLessonPlanList {
  list-style: none;
  padding-left: 0 !important;
}
.calendarLessonPlanList li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid #e2e8f0;
}
.calendarLessonPlanList li:last-child {
  border-bottom: 0;
}
.calendarLessonPlanList li span {
  color: #176ae0;
  font-weight: 900;
}
.calendarLessonReminder {
  width: 100%;
  min-height: 50px;
  margin-top: 12px;
  display: grid;
  grid-template-columns: 24px 1fr 18px;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border: 0;
  border-radius: 13px;
  background: #e8f2ff;
  color: #144da1;
  font: inherit;
  text-align: left;
  overflow-wrap: break-word;
  white-space: normal;
}
.calendarLessonReminder svg {
  width: 20px;
  height: 20px;
  flex-basis: 20px;
}
.calendarLessonMore {
  position: relative;
}
.calendarLessonMore summary {
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--pf-border, rgba(148, 163, 184, .3));
  border-radius: 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 800;
}
.calendarLessonMore summary::-webkit-details-marker {
  display: none;
}
.calendarLessonMore > div {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 4;
  min-width: 190px;
  padding: 7px;
  border: 1px solid var(--pf-border, rgba(148, 163, 184, .3));
  border-radius: 12px;
  background: var(--surface, #fff);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .18);
}
.calendarLessonHeaderMore {
  flex: 0 0 44px;
  color: inherit;
}
.calendarLessonHeaderMore summary {
  min-height: 44px;
  border: 0;
  color: inherit;
}
.calendarLessonHeaderMore > div {
  top: calc(100% + 8px);
  bottom: auto;
  color: var(--pf-text, #0f172a);
}
.calendarLessonMore button {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}
.calendarLessonMore button.danger {
  color: var(--danger, #dc2626);
}
.calendarStarterPlan {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--pf-border, rgba(148, 163, 184, .2));
}
@media (min-width: 700px) {
  .calendarLessonModal {
    align-items: center;
    padding: 20px;
  }
  .calendarLessonSheet {
    border-radius: 20px;
    height: min(94dvh, 940px);
    flex-basis: 620px;
  }
}
@media (max-width: 390px) {
  .calendarLessonSectionHeading {
    align-items: flex-start;
  }
  .calendarLessonSectionHeading .btn {
    max-width: 48%;
  }
}

@media (max-width: 900px) {
  #view-pupils #pupilFilters {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(68px, .72fr) minmax(84px, .88fr);
    gap: 6px !important;
    margin: 6px 0 8px !important;
  }

  #view-pupils #pupilSearch {
    grid-column: 1 / -1;
  }

  #view-pupils #pupilSearch,
  #view-pupils #pupilStatusFilter,
  #view-pupils #pupilClearSearch,
  #view-pupils #pupilExportCsv {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding-inline: 8px;
    font-size: 12px;
  }
}

/* v10.3.5 mobile density refinement: preserve the existing structure and data flow. */
@media (max-width: 900px) {
  #view-pupils > h2 {
    margin-bottom: 2px;
  }

  #pupilQuickActions {
    gap: 5px;
    margin: 2px 0 4px;
  }

  #pupilQuickActions .pfCompactAction {
    min-height: 46px;
    max-height: 48px;
    gap: 1px;
    padding: 3px 2px;
    font-size: 11px;
    line-height: 1;
  }

  #pupilQuickActions .pfCompactAction svg {
    width: 19px;
    height: 19px;
    flex-basis: 19px;
  }

  #view-pupils #pupilMsg:empty {
    min-height: 0;
    margin: 0;
  }

  #view-pupils #pupilFilters {
    grid-template-columns: minmax(0, 1fr) minmax(104px, .46fr);
    gap: 5px !important;
    margin: 4px 0 5px !important;
  }

  #view-pupils #pupilSearch {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #view-pupils #pupilStatusFilter {
    grid-column: 1;
    grid-row: 2;
  }

  #view-pupils #pupilExportCsv {
    grid-column: 2;
    grid-row: 2;
  }

  #view-pupils #pupilClearSearch {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: start;
    width: auto;
  }

  #view-pupils #pupilFilters:not(.hasSearch) #pupilClearSearch {
    display: none;
  }

  #view-pupils .pupilsTable {
    border-spacing: 0;
  }

  #view-pupils #pupilTableBody tr.pupilSectionRow {
    margin: 0;
  }

  #view-pupils #pupilTableBody tr.pupilSectionRow td {
    padding: 4px 2px 5px !important;
    line-height: 1.2;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow {
    margin-bottom: 5px;
  }
}

@media (max-width: 699px) {
  .calendarLessonBack {
    border: 0;
    border-radius: 999px;
    box-shadow: none;
    outline-offset: 2px;
  }

  .calendarLessonSheet:focus {
    outline: none;
  }

  .calendarLessonSummary {
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .calendarLessonSummary h2 {
    margin-bottom: 8px;
  }

  .calendarLessonSummary .calendarLessonBadges {
    margin: 10px 0;
  }

  .calendarLessonProfile {
    min-height: 44px;
    height: 44px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
}

/* v10.3.6 mobile polish: consistent density without changing screen structure. */
@media (max-width: 900px) {
  #pupilQuickActions {
    gap: 4px;
    margin: 1px 0 3px;
  }

  #pupilQuickActions .pfCompactAction {
    min-height: 44px;
    max-height: 44px;
    padding-block: 2px;
    border-radius: 12px;
  }

  #pupilQuickActions .pfCompactAction svg {
    align-self: center;
  }

  #view-pupils #pupilFilters {
    gap: 4px !important;
    margin: 3px 0 4px !important;
  }

  #view-pupils #pupilSearch,
  #view-pupils #pupilStatusFilter,
  #view-pupils #pupilExportCsv {
    height: 44px;
    min-height: 44px;
    border-radius: 12px;
  }

  #view-pupils #pupilStatusFilter,
  #view-pupils #pupilExportCsv {
    align-self: stretch;
  }

  #view-pupils #pupilTableBody tr.pupilSectionRow td {
    padding: 3px 2px 4px !important;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow {
    min-height: 64px;
    margin-bottom: 4px;
    border-radius: 14px;
  }

  #view-pupils #pupilTableBody tr.pupilDataRow td.pupilAccordionSummary,
  #view-pupils #pupilTableBody tr.pupilExpanded td.pupilAccordionSummary {
    min-height: 64px;
    max-height: 70px;
    padding: 4px 0;
  }

  #view-pupils .pupilAccordionIdentity {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 9px;
  }

  #view-pupils .pupilAccordionAvatar {
    width: 44px;
    height: 44px;
  }

  #view-pupils .pupilAccordionName {
    font-weight: 800;
  }
}

@media (max-width: 699px) {
  .calendarLessonProfile {
    min-height: 40px;
    height: 40px;
    padding-block: 4px;
    border-width: 1px;
    border-color: rgba(23, 106, 224, .58);
  }
}

/* ===== Focused pupil profile tabs ===== */
.pupilHubCompactCard,
.pupilHubPaymentSummary,
.pupilHubAdvancedActions {
  max-width: 900px;
}
.pupilHubCompactCard p,
.pupilHubPaymentSummary p {
  margin: 7px 0;
}
.pupilHubSummaryText {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--pf-border, rgba(148, 163, 184, .22));
}
.pupilHubSummaryText p {
  overflow-wrap: anywhere;
}
.pupilHubPrimaryActions .btn,
.pupilHubPaymentForm input,
.pupilHubPaymentForm select,
.pupilHubAdvancedActions summary {
  min-height: 44px;
}
.pupilHubPaymentSummary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 12px;
}
.pupilHubPaymentForm {
  margin-bottom: 10px;
}
.pupilHubHomeworkForm .fullWidth { grid-column: 1 / -1; }
.pupilHubHomeworkForm textarea,
.pupilHubHomeworkForm input,
.pupilHubHomeworkForm select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}
@media (max-width: 600px) {
  .pupilHubHomeworkForm { grid-template-columns: minmax(0, 1fr); }
}
.pupilHubLessonRow {
  cursor: pointer;
}
.pupilHubLessonRow:focus-visible {
  outline: 3px solid var(--primary, #2563eb);
  outline-offset: -3px;
}
.pupilHubAdvancedActions {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--pf-border, rgba(148, 163, 184, .22));
}
.pupilHubAdvancedActions summary {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 750;
}
.pupilHubAdvancedActions .actionsRow {
  margin-top: 10px;
}
.btnDanger {
  border-color: var(--danger, #dc2626);
  color: var(--danger, #dc2626);
}
.pupilProfileBack {
  min-height: 44px;
  margin: 0 0 12px;
}

/* ===== Instructor teaching history and report ===== */
.phHeader,
.phTeachingRecordActions,
.pupilLessonPreviewHeading,
.calendarLessonRecordActions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.phHeader { justify-content: space-between; margin-bottom: 10px; }
.phTeachingRecordActions .btn { min-height: 44px; }
.pupilLessonPreviewHeading { justify-content: space-between; }
.pupilLessonPreviews { display: grid; gap: 8px; }
.pupilLessonPreview { width: 100%; display: grid; grid-template-columns: minmax(100px, .75fr) minmax(90px, .6fr) minmax(130px, 1fr) minmax(180px, 1.5fr); gap: 8px; align-items: center; padding: 12px; border: 1px solid var(--pf-border, #d9e1ec); border-radius: 12px; background: var(--surface, #fff); color: inherit; text-align: left; cursor: pointer; }
.pupilLessonPreview:hover { border-color: var(--primary, #2563eb); }
.pupilLessonPreview small { grid-column: 1 / -1; color: var(--muted, #64748b); }
.calendarLessonRecordActions { display: grid; grid-template-columns: 1fr 1fr; margin-top: 8px; }

body.lessonHistoryOpen { overflow: hidden; }
.lessonHistoryOverlay { position: fixed; inset: 0; z-index: 10050; display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: rgba(15, 23, 42, .42); backdrop-filter: blur(8px); }
.lessonHistoryOverlay.hidden { display: none !important; }
.lessonHistoryPanel,
.lessonDetailPanel,
.lessonReportPanel { width: min(1040px, 100%); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: var(--pf-space-5); border: 1px solid var(--pf-border); border-radius: var(--pf-radius-lg); background: var(--pf-surface); color: var(--pf-text); box-shadow: var(--pf-shadow-lg); }
.lessonHistoryPanel > header,
.lessonDetailPanel > header,
.lessonReportPanel > header { position: sticky; top: calc(-1 * var(--pf-space-5)); z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: var(--pf-space-3); padding: var(--pf-space-4) 0 var(--pf-space-3); background: var(--pf-surface); }
.lessonHistoryPanel header button,
.lessonDetailPanel header button,
.lessonReportPanel header button { width: 44px; height: 44px; border-radius: var(--pf-radius-md); border: 1px solid var(--pf-border); background: var(--pf-surface); color: var(--pf-text); font-size: 25px; }
.lessonHistoryFilters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1.3fr; gap: 10px; }
.lessonHistoryFilters label,
.lessonReportForm label { display: grid; gap: 5px; }
.lessonHistoryFilters input,
.lessonHistoryFilters select,
.lessonReportForm input,
.lessonReportForm select { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
.lessonHistoryFilters fieldset,
.lessonReportForm fieldset { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 18px; border: 1px solid var(--pf-border, #d9e1ec); border-radius: 12px; }
.lessonHistoryFilters fieldset label,
.lessonReportForm fieldset label { display: flex; align-items: center; gap: 7px; }
.lessonHistoryFilters input[type="checkbox"],
.lessonReportForm input[type="checkbox"] { width: 20px; min-height: 20px; }
.lessonHistoryList { display: grid; gap: 9px; margin: 12px 0; }
.lessonHistoryRow button { width: 100%; display: grid; grid-template-columns: minmax(130px, .8fr) minmax(150px, 1fr) minmax(200px, 1.4fr) minmax(160px, 1fr) 24px; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--pf-border, #d9e1ec); border-radius: 12px; background: transparent; text-align: left; color: inherit; }
.lessonHistoryRow span { display: grid; gap: 3px; }
.lessonHistoryRow small { color: var(--muted, #64748b); }
.lessonDetailPanel,
.lessonReportPanel { position: absolute; z-index: 3; }
.lessonDetailBody section { padding-block: 7px; border-top: 1px solid var(--pf-border, #d9e1ec); }
.lessonDetailBody h3 { margin-bottom: 5px; }
.lessonReportForm .formGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lessonReportStatus { min-height: 24px; }

@media (max-width: 700px) {
  .phTeachingRecordActions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .phTeachingRecordActions .btn { min-width: 0; white-space: normal; }
  .pupilLessonPreview { grid-template-columns: 1fr 1fr; }
  .pupilLessonPreview span:nth-of-type(2), .pupilLessonPreview span:nth-of-type(3) { grid-column: 1 / -1; }
  .lessonHistoryOverlay { align-items: end; padding-inline: 8px; }
  .lessonHistoryPanel, .lessonDetailPanel, .lessonReportPanel { width: 100%; max-height: calc(100dvh - max(12px, env(safe-area-inset-top))); border-radius: 20px 20px 0 0; padding: 16px; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .lessonHistoryFilters { grid-template-columns: 1fr 1fr; }
  .lessonHistoryFilters label:first-child, .lessonHistoryFilters label:nth-child(5) { grid-column: 1 / -1; }
  .lessonHistoryRow button { grid-template-columns: 1fr 24px; }
  .lessonHistoryRow button > span { grid-column: 1; }
  .lessonHistoryRow button > b { grid-column: 2; grid-row: 1 / 5; }
}
.pupilSectionFailure .btn {
  min-height: 44px;
}

/* ===== Named pupil competency progress ===== */
body.progressModalOpen {
  overflow: hidden;
}
#progressModal {
  overflow: hidden;
}
.progressModalCard {
  width: min(94vw, 860px);
  height: min(92dvh, 920px);
  max-height: 92dvh;
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}
.progressModalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--pf-border, rgba(148, 163, 184, .25));
}
.progressModalHeader h3 {
  margin: 0;
  font-size: 1.15rem;
}
.progressModalHeader .btn {
  min-height: 44px;
}
.progressModalBody {
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px;
}
.progressModalFooter {
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--pf-border, rgba(148, 163, 184, .25));
  background: inherit;
}
.progressModalFooter .actionsRow {
  justify-content: flex-end;
}
.progressModalFooter .btn {
  min-height: 46px;
}
.progressSummary {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}
.progressSummary span {
  color: var(--muted, #64748b);
}
.progressGroup {
  margin-bottom: 10px;
  border: 1px solid var(--pf-border, rgba(148, 163, 184, .25));
  border-radius: 14px;
  overflow: clip;
  background: var(--surface, #fff);
}
.progressGroup > summary {
  min-height: 54px;
  padding: 10px 13px;
  display: grid;
  gap: 3px;
  align-content: center;
  cursor: pointer;
  font-weight: 800;
}
.progressGroup > summary small {
  color: var(--muted, #64748b);
  font-weight: 600;
}
.progressSkillList {
  padding: 0 12px 12px;
}
.progressSkill {
  padding: 13px 0;
  border-top: 1px solid var(--pf-border, rgba(148, 163, 184, .2));
}
.progressSkill h4,
.progressSkill p {
  margin: 0 0 6px;
}
.progressCurrent {
  font-weight: 800;
}
.progressLevelSelector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}
.progressLevelSelector button {
  min-height: 48px;
  padding: 6px 8px;
  border: 1px solid var(--pf-border, rgba(148, 163, 184, .35));
  border-radius: 10px;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
}
.progressLevelSelector button span {
  display: block;
  font-size: 1rem;
}
.progressLevelSelector button.selected {
  border-color: var(--primary, #2563eb);
  background: color-mix(in srgb, var(--primary, #2563eb) 12%, white);
  box-shadow: inset 0 0 0 1px var(--primary, #2563eb);
}
.progressDiscardPrompt {
  position: absolute;
  inset: auto 14px calc(74px + env(safe-area-inset-bottom)) 14px;
  z-index: 3;
  padding: 14px;
  border: 1px solid var(--danger, #dc2626);
  border-radius: 14px;
  background: var(--surface, #fff);
  box-shadow: 0 14px 32px rgba(15, 23, 42, .2);
}
@media (max-width: 600px) {
  #progressModal {
    align-items: stretch;
    padding: 0;
  }
  .progressModalCard {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .progressModalHeader {
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .progressModalBody {
    padding-inline: 12px;
  }
  .progressLevelSelector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .pupilHubPrimaryActions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pupilHubPrimaryActions .btn {
    width: 100%;
  }
  .pupilHubTable {
    min-width: 520px;
  }
}

/* ===== v10.3.7 shared persistent ADI header ===== */
.topbar {
  min-height: calc(56px + var(--safe-top, 0px));
  height: auto;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: "menu brand actions";
  align-items: center;
  gap: 8px;
  padding:
    var(--safe-top, 0px)
    max(10px, var(--safe-right, 0px))
    0
    max(10px, var(--safe-left, 0px));
  overflow: visible;
  border-bottom: 1px solid var(--pf-border, #dbe3ee);
  background: rgba(255, 255, 255, .97);
  color: var(--pf-text, #0f172a);
  box-shadow: 0 2px 10px rgba(15, 23, 42, .06);
  backdrop-filter: blur(14px);
}

.menuToggle {
  grid-area: menu;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-content: center;
  gap: 4px;
  padding: 0;
  border: 1px solid var(--pf-border, #dbe3ee);
  border-radius: 12px;
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #0f172a);
  box-shadow: 0 2px 7px rgba(15, 23, 42, .07);
}

.menuToggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menuToggle:hover {
  border-color: color-mix(in srgb, var(--pf-primary, #176ae0) 35%, var(--pf-border, #dbe3ee));
  background: color-mix(in srgb, var(--pf-primary, #176ae0) 5%, white);
}

.menuToggle:active {
  transform: translateY(1px);
  background: color-mix(in srgb, var(--pf-primary, #176ae0) 10%, white);
}

.menuToggle:focus-visible,
.headerIconButton:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pf-primary, #176ae0) 30%, transparent);
  outline-offset: 2px;
}

.brand {
  grid-area: brand;
  min-width: 0;
  justify-content: flex-start;
  overflow: hidden;
}

.brandLogo {
  display: block;
  width: auto;
  height: 34px;
  max-width: min(142px, 100%);
  object-fit: contain;
}

.appHeaderActions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.systemHealth {
  min-width: 24px;
  min-height: 44px;
  justify-content: center;
}

/* ===== v10.3.23 compact half-height calendar summary ===== */
.calendarSummaryMount {
  flex: 0 0 auto;
  position: relative;
  min-width: 0;
  margin-top: 5px;
  padding-top: 0;
}

.calendarSummaryHeader,
.calendarSummaryMount.isCollapsed .calendarSummaryHeader {
  position: relative;
  inset: auto;
  z-index: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 44px;
  padding-left: 3px;
  pointer-events: auto;
}

.calendarSummaryTitle {
  min-width: 0;
  font-size: 14px;
  line-height: 1.1;
}

.calendarSummaryToggle {
  position: static;
  inset: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
}

.calendarSummaryToggle:hover,
.calendarSummaryToggle:focus-visible {
  background: var(--pf-muted-surface, #f5f7fa);
}

.calendarSummaryToggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 160ms ease;
}

.calendarSummaryToggle:not(.isExpanded) svg {
  transform: rotate(180deg);
}

.calendarSummaryCollapsed {
  display: none;
  min-width: 0;
  height: auto;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.15;
  white-space: nowrap;
}

.calendarSummaryCollapsed span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendarSummaryStrip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-columns: auto;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  padding: 0 0 4px;
  scroll-snap-type: none;
  scrollbar-width: auto;
}

.calendarSummaryCard {
  box-sizing: border-box;
  height: auto;
  min-height: 88px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--pf-border, #dbe3ee);
  border-radius: 12px;
  background: var(--pf-surface, #fff);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .07);
  scroll-snap-align: none;
}

.calendarSummaryCard h3 {
  margin: 0 0 3px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendarSummaryCard .calendarSummaryMetric {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  margin: 1px 0;
  overflow: hidden;
  font-size: 10.5px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendarSummaryMetric > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendarSummaryIcon {
  display: inline-flex;
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
}

.calendarSummaryIcon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.calendarSummaryMetric--lessons { color: var(--pf-primary, #2563eb); }
.calendarSummaryMetric--hours { color: var(--pf-success, #16a34a); }
.calendarSummaryMetric--income { color: #7c3aed; }
.calendarSummaryMetric--slots { color: #ea580c; }
.calendarSummaryMetric--student { color: var(--pf-primary, #2563eb); }
.calendarSummaryMetric--location { color: #dc2626; }

.calendarSummaryMetric > span:last-child {
  color: var(--pf-text, #0f172a);
}

.calendarSummaryViewStudent {
  width: 100%;
  min-height: 22px;
  margin-top: 2px;
  padding: 1px 4px;
  border-radius: 8px;
  font-size: 10.5px;
  line-height: 1.1;
}

.calendarSummaryMount.isCollapsed {
  padding-top: 0;
}

.calendarSummaryMount.isCollapsed .calendarSummaryTitle {
  display: none;
}

.calendarSummaryMount.isCollapsed .calendarSummaryCollapsed {
  display: flex;
}

.calendarSummaryMount.isCollapsed .calendarSummaryStrip {
  display: none;
}

@media (max-width: 430px) {
  .calendarControls {
    display: grid;
    grid-template-areas: "date date" "nav modes";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 7px;
  }

  .calendarControls .calNav,
  .calendarControls .calModes {
    flex: 0 1 auto;
    gap: 4px;
  }

  .calendarControls .calNav button,
  .calendarControls .calModes button {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 44px;
    padding-inline: 8px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .calendarControls {
    grid-template-areas: "date nav modes";
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  #view-calendar.active .calendarWrap {
    min-height: 100px;
  }

  .calendarSummaryHeader,
  .calendarSummaryMount.isCollapsed .calendarSummaryHeader {
    min-height: 40px;
  }

  .calendarSummaryCard {
    height: auto;
    min-height: 84px;
    padding-block: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calendarSummaryToggle svg {
    transition: none;
  }
}

/* ===== v10.3.15 staged-session renewal state ===== */
.stagedSessionBlock {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: rgba(15, 23, 42, .58);
}

.stagedSessionBlock.hidden {
  display: none;
}

.stagedSessionCard {
  width: min(440px, 100%);
  padding: 22px;
  border: 1px solid var(--pf-border, #dbe3ee);
  border-radius: 18px;
  background: var(--pf-surface, #fff);
  box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
}

.stagedSessionCard h2 {
  margin: 4px 0 10px;
}

.stagedSessionActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

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

.systemHealthLight {
  width: 10px;
  height: 10px;
}

.headerIconButton {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--pf-border, #dbe3ee);
  border-radius: 12px;
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #0f172a);
  box-shadow: 0 2px 7px rgba(15, 23, 42, .07);
  cursor: pointer;
}

.headerIconButton svg {
  width: 21px;
  height: 21px;
}

.notificationUnreadBadge {
  top: -5px;
  right: -5px;
}

.appMenuSecondary {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--pf-border, #dbe3ee);
}

.appMenuFooterGrid {
  display: contents;
}

.appMenuSecondary .appVersion,
.appMenuSecondary .btnLatestApp,
.appMenuSecondary .btn {
  width: 100%;
  min-height: 44px;
}

.appMenuSecondary .appVersion {
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: var(--pf-border, #dbe3ee);
  background: var(--pf-surface-soft, #f8fafc);
  color: var(--pf-text-muted, #64748b);
}

.appMenuSecondary .btnLatestApp {
  border: 1px solid var(--pf-border, #dbe3ee);
  border-radius: 12px;
  background: var(--pf-surface, #fff);
  color: var(--pf-primary, #176ae0);
  font-size: .9rem;
}

.menuSystemHealth {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid var(--pf-border, #dbe3ee);
  border-radius: 12px;
  background: var(--pf-surface-soft, #f8fafc);
  color: var(--pf-text-muted, #64748b);
  font-size: .86rem;
  font-weight: 800;
}

.menuSystemHealth.isOnline .systemHealthLight {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .16);
}

.calendarLessonModal {
  inset: var(--shell-header-bottom, calc(56px + var(--safe-top, 0px))) 0 0;
  width: 100%;
  height: calc(var(--app-height, 100dvh) - var(--shell-header-bottom, calc(56px + var(--safe-top, 0px))));
  max-height: calc(var(--app-height, 100dvh) - var(--shell-header-bottom, calc(56px + var(--safe-top, 0px))));
  padding: 0;
}

.calendarLessonSheet {
  height: 100%;
  max-height: 100%;
}

.calendarLessonHeader {
  min-height: 52px;
  max-height: 52px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--pf-border, #dbe3ee);
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #0f172a);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}

.calendarLessonHeader h3 {
  font-size: 1.08rem;
}

.calendarLessonBack,
.calendarLessonMessages {
  color: var(--pf-text, #0f172a);
}

.calendarLessonBack svg,
.calendarLessonMessages svg {
  width: 22px;
  height: 22px;
}

.calendarLessonBody {
  padding-top: 8px;
}

@media (max-width: 430px) {
  .systemHealthLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .topbar {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 7px;
  }

  .brandLogo {
    height: 31px;
    max-width: 130px;
  }
}

.instructorOnboardingOverlay { position: fixed; inset: 0; z-index: 20000; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); background: rgba(15, 23, 42, .42); backdrop-filter: blur(8px); overflow-y: auto; }
.instructorOnboardingCard { width: min(100%, 560px); max-height: calc(100dvh - 36px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: clamp(20px, 5vw, 34px); border: 1px solid var(--pf-border); border-radius: var(--pf-radius-lg); background: var(--pf-surface); color: var(--pf-text); box-shadow: var(--pf-shadow-lg); }
.instructorOnboardingCard h1 { margin-top: 0; }
.instructorOnboardingCard label { display: grid; gap: 7px; margin: 16px 0; font-weight: 700; }
.instructorOnboardingCard input:not([type="checkbox"]) { width: 100%; min-height: 48px; font-size: 16px; }
.instructorLogoPreview { display: block; width: min(220px, 80%); max-height: 140px; object-fit: contain; margin: 14px auto; }
.brandingScaleControl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; margin: 14px 0; }
.brandingScaleControl input[type="range"] { grid-column: 1 / -1; width: 100%; min-height: 44px; margin: 0; accent-color: var(--pf-primary); }
.brandingScaleControl span { color: var(--pf-text-muted); font-variant-numeric: tabular-nums; }
body.onboardingLocked { overflow: hidden; }

/* ===== v10.3.11 mobile menu footer flow correction ===== */
@media (max-width: 860px) {
  .sidebar {
    padding-bottom: max(14px, calc(var(--safe-bottom, 0px) + 10px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .appMenuSecondary {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    flex: none;
    transform: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .appMenuSecondary > .userIdentity,
  .appMenuSecondary > .appVersion {
    position: static;
    inset: auto;
    grid-area: auto;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    transform: none;
  }

  .appMenuFooterGrid {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    gap: 9px;
    width: 100%;
    min-width: 0;
    transform: none;
  }

  .appMenuFooterGrid > #menuSystemHealth,
  .appMenuFooterGrid > #menuNotifications,
  .appMenuFooterGrid > #btnForceLatestApp,
  .appMenuFooterGrid > #btnLogout {
    position: static;
    inset: auto;
    grid-area: auto;
    justify-self: stretch;
    align-self: stretch;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    height: auto;
    margin: 0;
    padding: 9px 8px;
    transform: none;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    font-size: clamp(11px, 3.1vw, 14px);
    line-height: 1.2;
  }

  .appMenuFooterGrid > #menuSystemHealth {
    justify-content: flex-start;
  }

  body.sidebarOpen {
    overflow: hidden;
    touch-action: none;
  }

  body.sidebarOpen .sidebar {
    touch-action: pan-y;
  }
}

/* ===== v10.3.18 real Day view and controlled calendar gestures ===== */
.pCalV2[data-calendar-mode="day"] .pCalV2ColHeader,
.pCalV2[data-calendar-mode="day"] .pCalV2Col {
  min-width: 0;
  width: 100%;
}

.pCalV2Col[hidden],
.pCalV2ColHeader[hidden] {
  display: none !important;
}

.pCalV2Grid {
  touch-action: pan-y;
}

/* ===== v10.3.19 current-time following and calendar viewport ===== */
.calendarControls,
.calendarControls .calNav,
.calendarControls .calModes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* ===== v10.3.20 persistent section title and compact calendar toolbar ===== */
.topbar {
  grid-template-columns: 44px minmax(84px, 142px) minmax(0, 1fr) auto;
  grid-template-areas: "menu brand title actions";
}

.appSectionTitle {
  grid-area: title;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--pf-text, #0f172a);
  font-size: clamp(1rem, 2.2vw, 1.22rem);
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appSectionTitle.hasCalendarDateJump { overflow: visible; }
.calendarDateJumpTrigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 44px;
  max-width: 100%;
  margin: -8px 0;
  padding: 6px 5px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  cursor: pointer;
}
.calendarDateJumpTrigger:hover { background: color-mix(in srgb, var(--pf-primary) 8%, transparent); }
.calendarDateJumpTrigger:focus-visible,
.calendarDateJumpMonthButton:focus-visible,
.calendarDateJumpDay:focus-visible,
.calendarDateJumpCancel:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pf-primary) 42%, transparent);
  outline-offset: 2px;
}
.calendarDateJumpLabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendarDateJumpChevron { flex: 0 0 auto; color: var(--pf-primary); font-size: 1rem; transform: translateY(-1px); }
.calendarDateJumpOverlay {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(8, 18, 34, .34);
  overscroll-behavior: contain;
}
.calendarDateJumpOverlay.hidden { display: none !important; }
.calendarDateJumpPicker {
  width: min(350px, 100%);
  max-height: 100%;
  padding: 14px;
  border: 1px solid var(--pf-border);
  border-radius: 18px;
  background: var(--pf-surface);
  color: var(--pf-text);
  box-shadow: 0 20px 55px rgba(8, 18, 34, .24);
}
.calendarDateJumpMonthHeader { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; }
.calendarDateJumpMonth { margin: 0; text-align: center; font-size: 1.05rem; line-height: 1.2; }
.calendarDateJumpMonthButton,
.calendarDateJumpCancel,
.calendarDateJumpDay {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.calendarDateJumpMonthButton { min-width: 44px; min-height: 44px; border-radius: 12px; font-size: 1.65rem; }
.calendarDateJumpWeekdays,
.calendarDateJumpDays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.calendarDateJumpWeekdays { margin-top: 8px; color: var(--pf-muted); text-align: center; font-size: .72rem; font-weight: 800; }
.calendarDateJumpWeekdays span { padding: 5px 0; }
.calendarDateJumpDay { position: relative; min-width: 0; min-height: 44px; border-radius: 50%; font-size: .9rem; font-weight: 700; }
.calendarDateJumpDay.isOutsideMonth { color: var(--pf-muted); opacity: .55; }
.calendarDateJumpDay.isToday { box-shadow: inset 0 0 0 2px var(--pf-primary); }
.calendarDateJumpDay.isSelected { background: var(--pf-primary); color: #fff; box-shadow: none; }
.calendarDateJumpDay.isToday.isSelected { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--pf-primary); }
.calendarDateJumpCancel { display: block; min-height: 44px; margin: 8px auto -4px; padding: 6px 16px; border-radius: 12px; color: var(--pf-primary); font-weight: 800; }
body.calendarDateJumpOpen { overflow: hidden; }

@media (max-height: 600px) {
  .calendarDateJumpPicker { padding-block: 10px; }
  .calendarDateJumpDay { min-height: 38px; }
  .calendarDateJumpCancel { min-height: 40px; margin-top: 2px; }
}

.calendarControls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  grid-template-areas: "date teaching nav modes";
  gap: 6px;
  margin: 0 0 6px;
}

.calendarDateRange {
  grid-area: date;
  min-width: 0;
  align-self: center;
  overflow: hidden;
  font-size: clamp(.96rem, 3.8vw, 1.12rem);
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendarControls .calendarTeachingMode {
  grid-area: teaching;
  align-self: center;
  justify-self: end;
  height: 42px;
  min-height: 42px;
  max-height: 42px;
  width: auto;
  max-width: 150px;
  padding: 5px 10px;
  font-size: .875rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.1;
}

.calendarControls .calNav { grid-area: nav; }
.calendarControls .calModes { grid-area: modes; }

.calendarSummaryMount[hidden],
.calendarSummaryMount:empty {
  display: none;
}

#view-calendar.active .calendarWrap {
  height: var(--calendar-available-height, calc(var(--app-height) - 140px));
  max-height: var(--calendar-available-height, calc(var(--app-height) - 140px));
}

@media (max-width: 600px) {
  .topbar {
    grid-template-columns: 44px minmax(68px, 112px) minmax(0, 1fr) auto;
    gap: 4px 6px;
  }

  .brandLogo {
    width: min(100%, 112px);
    height: auto;
    max-height: 30px;
  }

  .appHeaderActions {
    gap: 3px;
  }

  .calendarControls {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "date teaching"
      "nav modes";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .calendarControls .calNav,
  .calendarControls .calModes {
    flex: 1 1 auto;
    flex-wrap: nowrap;
  }

  .calendarControls .calNav button,
  .calendarControls .calModes button {
    min-width: 0;
    padding-inline: 7px;
  }
}

@media (max-width: 375px) {
  .topbar {
    grid-template-columns: 44px minmax(62px, 92px) minmax(0, 1fr) auto;
  }
  .brandLogo { max-width: 92px; }
  .appSectionTitle { font-size: .96rem; }
}

.calendarControls button {
  min-width: 52px;
  min-height: 42px;
  height: 42px;
  padding: 6px 9px;
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
  background: var(--pf-surface);
  color: var(--pf-text);
  box-shadow: var(--pf-shadow-sm);
  font: inherit;
  font-size: .875rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.15;
  transition:
    background var(--pf-transition-fast),
    border-color var(--pf-transition-fast),
    box-shadow var(--pf-transition-fast);
}

.calendarControls button:hover,
.calendarControls button:focus-visible {
  border-color: var(--pf-border-strong);
  background: var(--pf-surface-hover);
  box-shadow: var(--pf-shadow-md);
}

.calendarControls button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--pf-focus);
}

.calendarControls .calNowButton {
  min-width: 50px;
}

.calendarControls .calNowButton[hidden] {
  display: none !important;
}

body.calendarViewActive .main {
  overflow-x: hidden;
  overflow-y: auto;
}

#view-calendar.active {
  display: block;
  height: auto;
  min-height: 0;
  overflow: visible;
}

#view-calendar.active .calendarWrap {
  height: var(--calendar-available-height, calc(var(--app-height) - 160px));
  min-height: min(320px, var(--calendar-available-height, 320px));
  max-height: var(--calendar-available-height, calc(var(--app-height) - 160px));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.calendarSummaryMount.isCollapsed {
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  margin-bottom: 0;
  overflow: hidden;
}

.calendarSummaryMount.isCollapsed .calendarSummaryHeader {
  height: 48px;
  min-height: 48px;
  max-height: 48px;
}

.calendarSummaryMount:not(.isCollapsed) {
  height: auto;
  max-height: none;
  overflow: visible;
}

.pCalNowLine {
  left: 0;
  right: 0;
  z-index: 2;
  pointer-events: none;
  transition: top 160ms linear;
}

.pCalNowLine[hidden] {
  display: none !important;
}

.pCalV2Event {
  z-index: 3;
}

.pCalV2Event:focus-visible {
  outline: 3px solid var(--pf-focus, rgba(37, 99, 235, .35));
  outline-offset: 2px;
}

.pCalV2Event.isSelected {
  z-index: 12;
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  box-shadow: 0 7px 18px rgba(15, 23, 42, .28);
  overflow: visible;
}

.pCalLessonResizeHandle,
.pCalLessonDetails {
  display: none;
  position: absolute;
  width: 44px;
  height: 44px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  touch-action: none;
}

.pCalV2Event.isSelected :is(.pCalLessonResizeHandle, .pCalLessonDetails) { display: block; }
.pCalLessonResizeStart { top: -22px; left: 0; }
.pCalLessonResizeFinish { right: 0; bottom: -22px; }
.pCalLessonDetails {
  top: calc(50% - 22px);
  right: 0;
  z-index: 15;
  background: rgba(15, 23, 42, .82);
  font-size: 18px;
  font-weight: 900;
}
.pCalLessonResizeHandle { z-index: 16; }
.pCalLessonResizeHandle span {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 4px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 2px #2563eb;
}
.pCalLessonResizeStart span { top: 20px; }
.pCalLessonResizeFinish span { bottom: 20px; }

.pCalV2Event.isCompactSelected :is(.pCalLessonResizeHandle, .pCalLessonDetails) {
  top: calc(50% - 22px);
  bottom: auto;
  width: 33.333%;
  border-radius: 6px;
}
.pCalV2Event.isCompactSelected .pCalLessonResizeStart { left: 0; right: auto; }
.pCalV2Event.isCompactSelected .pCalLessonDetails { left: 33.333%; right: auto; }
.pCalV2Event.isCompactSelected .pCalLessonResizeFinish { left: 66.666%; right: auto; }

.pCalV2.isLessonFocus .pCalV2Event.isSelected :is(.pCalV2EventTitle, .pCalV2EventTime) {
  padding-right: 42px;
}

body:has(.pCalV2.isLessonFocus[data-focus-position="2"]) .fabAdd {
  right: auto;
  left: max(18px, calc(var(--safe-left) + 18px));
}

.calendarEditMessage {
  flex: 1 1 170px;
  color: var(--pf-text);
  font-size: .82rem;
  font-weight: 700;
}

.pCalDragLayer {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  overflow: visible;
  visibility: hidden;
}

.pCalDragLayer.isActive {
  visibility: visible;
}

.pCalV2Event.pCalDragSource {
  visibility: hidden;
  pointer-events: none;
}

body.calendarDragActive .fabAdd {
  pointer-events: none;
}

.pCalDragLayer .pCalV2Event.pCalDragProxy {
  position: fixed;
  z-index: 1;
  pointer-events: none;
  touch-action: none;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .34);
  outline: 2px solid #2563eb;
  overflow: hidden;
  transition: none !important;
}

.pCalResizeHandle,
[data-resize-handle] {
  z-index: 4;
}

.pCalV2Col.today,
.pCalV2ColHeader.today {
  background: color-mix(in srgb, var(--pf-primary) 8%, var(--pf-surface));
}

@media (prefers-reduced-motion: reduce) {
  .pCalNowLine {
    transition: none;
  }
}

@media (max-width: 430px) {
  .calendarControls {
    align-items: stretch;
  }

  .calendarControls .calNav,
  .calendarControls .calModes {
    flex: 1 1 auto;
  }

  .calendarControls .calNav button,
  .calendarControls .calModes button {
    flex: 1 1 auto;
    min-width: 50px;
    min-height: 42px;
    height: 42px;
  }
}

/* ===== v10.3.13 Lesson header safe-area correction ===== */
.calendarLessonModal {
  inset: 0;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
}

.calendarLessonHeader {
  --lesson-safe-top: env(safe-area-inset-top, 0px);
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 2;
  display: block;
  min-width: 0;
  min-height: calc(56px + var(--lesson-safe-top));
  max-height: calc(56px + var(--lesson-safe-top));
  padding: var(--lesson-safe-top) 0 0;
  border-bottom: 1px solid var(--pf-border, #dbe3ee);
  background: var(--pf-surface, #fff);
  color: var(--pf-text, #0f172a);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}

.calendarLessonHeaderRow {
  box-sizing: border-box;
  width: 100%;
  height: 56px;
  min-height: 56px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: max(10px, env(safe-area-inset-left, 0px));
  padding-right: max(10px, env(safe-area-inset-right, 0px));
}

.calendarLessonHeaderRow h3 {
  flex: 1 1 auto;
  min-width: 0;
}

.calendarLessonBack,
.calendarLessonMessages {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.learnerLicenceAdminCard { display: grid; gap: 14px; }
.licenceAdminPreview { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--licence-preview) 70%, white), var(--licence-preview)); color: #0a1b39; }
.licenceEndorsementChecks { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 14px; }
.licenceEndorsementChecks label { min-width: 0; }
.learnerLicenceAdminCard textarea { width: 100%; font: inherit; }
@media (max-width: 600px) { .licenceEndorsementChecks { grid-template-columns: 1fr; } }
/* Learner registration and invitation extension */
.dashboardPrimaryAction {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}

.dashboardPrimaryAction .btn { min-height: 44px; }

.registrationAttention {
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff0d5;
  color: #7a4200;
  font-weight: 750;
}

.learnerRegistrationCard {
  width: min(720px, calc(100vw - 28px));
  max-height: min(820px, calc(100dvh - 28px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.learnerRegistrationHeader {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.learnerRegistrationHeader h3,
.learnerRegistrationHeader p { margin: 0 0 6px; }

.learnerRegistrationChoices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 20px;
}

.learnerRegistrationChoices button {
  min-width: 0;
  min-height: 76px;
  padding: 12px;
  text-align: left;
  border: 1px solid #d6e1f0;
  border-radius: 14px;
  background: #f8fbff;
  color: #10203a;
}

.learnerRegistrationChoices button strong,
.learnerRegistrationChoices button span { display: block; }
.learnerRegistrationChoices button span { margin-top: 4px; color: #65748b; font-weight: 500; line-height: 1.35; }
.registrationReviewSection { border-top: 1px solid #dce5f2; padding-top: 16px; }
.registrationReviewSection h4 { margin: 0 0 10px; }
.registrationReviewRow { display: grid; gap: 5px; padding: 12px 0; border-bottom: 1px solid #e3eaf4; }
.registrationReviewRow > span { color: #65748b; }
.registrationReviewActions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.registrationReviewActions button { min-height: 42px; }

@media (max-width: 520px) {
  .learnerRegistrationSheet { align-items: end; }
  .learnerRegistrationCard {
    width: 100%;
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
    margin: 0;
    border-radius: 20px 20px 0 0;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  .learnerRegistrationChoices { grid-template-columns: 1fr; }
}
/* v10.3.67: shared Teaching Mode and sensitive-area guard. */
.teachingModeIndicator {
  min-height: 40px;
  max-width: 148px;
  padding: 8px 12px;
  border: 1px solid #cfd9e8;
  border-radius: 999px;
  background: #fff;
  color: #17223b;
  font: inherit;
  font-weight: 700;
}
.teachingModeIndicator.isActive {
  background: #e7f8ee;
  border-color: #70c891;
  color: #176b3a;
}
.sensitiveAreaGuard {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(8px);
}
.sensitiveAreaGuard.hidden { display: none; }
.sensitiveAreaGuardCard {
  width: min(100%, 440px);
  max-height: 100%;
  overflow: auto;
  padding: var(--pf-space-6);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-lg);
  background: var(--pf-surface);
  color: var(--pf-text);
  box-shadow: var(--pf-shadow-lg);
}
.sensitiveAreaGuardCard input { width: 100%; min-height: 48px; font-size: 16px; }
.sensitiveAreaGuardCard .modalActions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
body.sensitiveAreasLocked #view-accounts.active .accountsBody { visibility: hidden; }
@media (max-width: 640px) {
  .teachingModeIndicator:not(.calendarTeachingMode) { max-width: 94px; padding: 6px 8px; font-size: 12px; }
}

/* Shared modal spacing helpers used by dynamically mounted instructor forms. */
.modalTitle {
  margin: 0 0 var(--pf-space-4);
}

.startupDiagnosticsOverlay {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, .72);
}
.startupDiagnosticsOverlay.hidden { display: none; }
.startupDiagnosticsPanel {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(720px, 100%);
  height: min(760px, 100%);
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 20px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.startupDiagnosticsPanel h2 { margin: 0 0 12px; }
.startupDiagnosticsPanel pre {
  flex: 1 1 0;
  min-height: 0;
  margin: 0;
  padding: 12px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border: 1px solid #dbe3ec;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  font: 500 .78rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
.startupDiagnosticsActions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.startupDiagnosticsActions button { min-height: 44px; }
#startupDiagnosticsMessage { flex: 0 0 auto; min-height: 1.4em; margin: 8px 0 0; }

.modalSection,
.modalSectionLabel {
  margin-top: var(--pf-space-3);
}

.receiptPhotoActions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pf-space-2);
  margin-top: var(--pf-space-2);
}

.expenseReceiptTopAction {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 0 var(--pf-space-4);
  padding: var(--pf-space-3);
  border: 1px solid var(--pf-border);
  border-radius: var(--pf-radius-md);
  background: var(--pf-surface-subtle);
}

.expenseReceiptTopAction > label {
  display: block;
  font-weight: 800;
}

.expenseReceiptTopAction .receiptPhotoActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.expenseReceiptTopAction .receiptPhotoActions .btn {
  width: 100%;
  min-width: 0;
  margin-top: 0;
  white-space: normal;
}

.modalCloseButton {
  flex: 0 0 44px;
  width: 44px;
  min-height: 44px;
  padding: 0;
}

.lessonListActions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pf-space-2);
}

@media (max-width: 699px) {
  #view-lessons .tableWrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #view-lessons .lessonListTable {
    display: block;
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  #view-lessons .lessonListTable thead {
    display: none;
  }

  #view-lessons .lessonListTable tbody {
    display: grid;
    gap: var(--pf-space-3);
  }

  #view-lessons .lessonListTable tr {
    display: block;
    width: 100%;
    padding: var(--pf-space-4);
    border: 1px solid var(--pf-border);
    border-radius: var(--pf-radius-lg);
    background: var(--pf-surface);
    box-shadow: var(--pf-shadow-sm);
  }

  #view-lessons .lessonListTable td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: var(--pf-space-3);
    width: 100%;
    padding: 7px 0;
    border-bottom: 1px solid var(--pf-border);
    overflow-wrap: anywhere;
  }

  #view-lessons .lessonListTable td::before {
    content: attr(data-label);
    color: var(--pf-text-muted);
    font-weight: 650;
    overflow-wrap: normal;
    word-break: normal;
  }

  #view-lessons .lessonListTable td:last-child {
    border-bottom: 0;
  }

  #view-lessons .lessonListTable .lessonListActions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--pf-space-2);
    padding-top: var(--pf-space-3);
  }

  #view-lessons .lessonListTable .lessonListActions::before {
    display: none;
  }

  #view-lessons .lessonListTable .lessonListActions .btn {
    flex: 1 1 104px;
    min-width: 0;
    min-height: 42px;
    margin: 0;
  }

  .pfModalBody {
    grid-template-columns: 1fr;
  }

  .pfField.full {
    grid-column: auto;
  }
}

/* v10.3.75: compact mobile header; Calendar owns Teaching Mode. */
@media (max-width: 600px) {
  .topbar {
    grid-template-columns: 44px minmax(68px, 112px) minmax(0, 1fr) auto;
    grid-template-areas: "menu brand title actions";
  }

  .appHeaderActions {
    display: flex;
    grid-area: actions;
    gap: 6px;
  }

  #systemHealth .systemHealthLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (max-width: 375px) {
  .topbar {
    grid-template-columns: 44px minmax(62px, 92px) minmax(0, 1fr) 44px;
  }
}

/* v10.4.40: keep login in natural document flow while the iOS keyboard resizes the visual viewport. */
@media (max-width: 860px) {
  html.authLoginDocument.viewportShellReady,
  html.authLoginDocument.viewportShellReady body.authLoginPage.viewportShell.naturalDocumentScroll {
    height: auto;
    max-height: none;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
  }

  html.authLoginDocument.keyboardOpen body.authLoginPage .container {
    min-height: var(--app-visible-height, auto);
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  body.authLoginPage input,
body.authLoginPage button {
    scroll-margin-block: 16px;
  }
}

/* v10.4.54 final cascade: compact active-lesson layout. */
.calendarLessonBody { padding: 8px 8px max(18px, env(safe-area-inset-bottom)); }
.calendarLessonTopActions, .calendarLessonDirections { width: 100%; max-width: 100%; min-width: 0; margin-top: 8px; }
.calendarLessonActionGrid { gap: 6px; }
.calendarLessonContactGrid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.calendarLessonActionGrid button,
.calendarLessonContactGrid button,
.calendarLessonDirectionsGrid button { min-width: 0; min-height: 44px; padding: 4px 3px; border-radius: 10px; font-size: .75rem; line-height: 1.1; overflow-wrap: anywhere; }
.calendarLessonActionGrid button svg,
.calendarLessonDirectionsGrid button svg { width: 18px; height: 18px; flex-basis: 18px; }
.calendarLessonAddPayment { margin: 0; border-color: #176ae0 !important; background: #176ae0 !important; color: #fff !important; }
.calendarLessonCard { max-width: 100%; min-width: 0; margin-top: 8px; padding: 11px 12px; border-radius: 13px; }
.calendarLessonSummary h2 { margin-bottom: 7px; font-size: 1.2rem; }
.calendarLessonFact { gap: 7px; margin: 3px 0 !important; font-size: .9rem; }
.calendarLessonFact > svg { width: 18px; height: 18px; flex-basis: 18px; }
.calendarLessonBadges { gap: 5px; margin: 8px 0; }
.calendarLessonBadge { padding: 5px 8px; font-size: .76rem; }
.calendarLessonRecordActions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 7px; }
.calendarLessonRecordActions .btn,
.calendarLessonSectionHeading .btn,
.calendarLessonNotesButton { min-width: 0; min-height: 44px; padding: 6px 8px; font-size: .82rem; white-space: normal; }
.calendarLessonMode { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; padding: 6px 10px; border: 1px solid #bfd4f1; border-radius: 10px; background: #f5f9ff; color: #17324d; font: inherit; font-size: .84rem; font-weight: 750; }
.calendarLessonMode strong { min-width: 42px; padding: 4px 7px; border-radius: 999px; background: #e2e8f0; color: #475569; text-align: center; font-size: .72rem; }
.calendarLessonMode.isActive strong { background: #dcfce7; color: #15803d; }
.calendarLessonDirectionsGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.calendarLessonCard h4 { margin-bottom: 5px; font-size: .98rem; }
.calendarLessonPlanList { margin-top: 4px !important; }
.calendarLessonPlanList li { grid-template-columns: 20px minmax(0, 1fr); gap: 5px; padding: 6px 0; }
.calendarLessonReminder { min-height: 44px; margin-top: 8px; padding: 7px 10px; font-size: .82rem; }
.pupilLessonPreview { box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; white-space: normal; overflow: hidden; }
.pupilLessonPreview > *, .lessonDetailBody, .lessonDetailBody > *, .lessonReportForm, .lessonReportForm > * { box-sizing: border-box; max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.lessonDetailPanel, .lessonReportPanel { box-sizing: border-box; inset: 12px; width: auto; max-width: calc(100% - 24px); }
@media (max-width: 390px) {
  .calendarLessonContactGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .calendarLessonContactGrid .calendarLessonAddPayment { grid-column: span 2; }
  .calendarLessonSectionHeading { align-items: center; }
  .calendarLessonSectionHeading .btn { max-width: 50%; }
}
@media (max-width: 700px) {
  .lessonHistoryOverlay { padding-inline: 8px; }
  .lessonDetailPanel, .lessonReportPanel { inset: auto 8px 0; width: auto; max-width: calc(100% - 16px); }
}

/* PF-PUPIL-UI-001: contextual pupil workspace */
.pupilHub { position: relative; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
#phTabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding: 5px; border: 1px solid var(--pf-border, #dbe3ee); border-radius: 16px; background: var(--pf-surface, #fff); }
#phTabs .phTab { min-width: 0; min-height: 44px; padding: 7px 8px; border: 0; border-radius: 11px; background: transparent; color: var(--pf-text-muted, #64748b); font-weight: 750; }
#phTabs .phTab.active { background: var(--primary, #2563eb); color: #fff; }
.phMoreMenu { position: absolute; z-index: 25; top: 58px; right: 0; width: min(270px, calc(100vw - 32px)); padding: 8px; border: 1px solid var(--pf-border, #dbe3ee); border-radius: 16px; background: var(--pf-surface, #fff); box-shadow: 0 18px 44px rgba(15, 23, 42, .2); }
.phMoreMenu button { display: block; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--pf-border, #e2e8f0); background: transparent; color: inherit; text-align: left; font: inherit; font-weight: 700; }
.phMoreMenu button:last-child { border-bottom: 0; }
.pupilBottomNav { position: fixed; z-index: 120; right: max(12px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); left: max(12px, env(safe-area-inset-left)); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 920px; margin: auto; padding: 7px 8px; border: 1px solid var(--pf-border, #dbe3ee); border-radius: 18px; background: rgba(255,255,255,.96); box-shadow: 0 12px 34px rgba(15,23,42,.16); backdrop-filter: blur(14px); }
.pupilBottomNav button { display: grid; place-items: center; gap: 2px; min-width: 0; min-height: 50px; padding: 4px; border: 0; border-radius: 13px; background: transparent; color: #64748b; font: inherit; }
.pupilBottomNav button > span { font-size: 20px; line-height: 1; }
.pupilBottomNav button > span svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pupilBottomNav small { overflow: hidden; max-width: 100%; font-size: 11px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.pupilBottomNav button.active { color: var(--primary, #2563eb); background: #eff6ff; }
.pupilBottomNav .pupilBottomAdd { transform: translateY(-17px); color: #fff; }
.pupilBottomNav .pupilBottomAdd > span { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: linear-gradient(135deg, #2563eb, #0f5de8); box-shadow: 0 8px 20px rgba(37,99,235,.35); font-size: 30px; }
.pupilBottomNav .pupilBottomAdd small { color: #0f172a; }
body.pupilContextActive .fabAdd { display: none !important; }
.pupilSummaryHeading, .pupilProfileHeading, .pupilSectionHeading, .pupilSummaryProgress, .pupilLessonIdentityTop { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pupilSummaryHeading, .pupilProfileHeading { margin: 12px 0 14px; }
.pupilSummaryHeading h2, .pupilProfileHeading h2, .pupilLessonsScreen h2 { margin: 0; }
.pupilProfileHeading { display: block; }
.pupilProfileHeading p, .pupilSummaryHeading p { margin: 4px 0 0; color: #64748b; }
.eyebrow { margin: 0 0 4px; color: var(--primary, #2563eb); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pupilSummaryHero, .pupilSummaryProgress, .pupilLessonSection { margin-bottom: 12px; }
.pupilSummaryFacts, .pupilLessonFacts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.pupilSummaryFacts span, .pupilLessonFacts > div { min-width: 0; padding: 10px; border-radius: 12px; background: #f8fafc; }
.pupilSummaryFacts small, .pupilSummaryFacts strong, .pupilLessonFacts small, .pupilLessonFacts strong { display: block; overflow-wrap: anywhere; }
.pupilSummaryFacts small, .pupilLessonFacts small { margin-bottom: 3px; color: #64748b; }
.pupilSubjectChips { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.pupilSubjectChips span { padding: 5px 10px; border-radius: 999px; background: #eaf2ff; color: #1458c6; font-size: 13px; font-weight: 750; }
.pupilLessonList { display: grid; gap: 10px; margin-top: 12px; }
.pupilLessonListItem { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; width: 100%; min-height: 74px; padding: 13px 42px 13px 14px; border: 1px solid var(--pf-border, #dbe3ee); border-radius: 16px; background: var(--pf-surface, #fff); color: inherit; text-align: left; font: inherit; }
.pupilLessonListDate { display: grid; gap: 3px; min-width: 0; }
.pupilLessonListDate span, .pupilLessonListItem small { overflow-wrap: anywhere; color: #64748b; }
.pupilLessonListMeta { display: flex; align-items: center; gap: 7px; }
.pupilLessonListItem > small { grid-column: 1 / -1; }
.pupilLessonChevron { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); font-size: 28px; }
.pupilLessonStatus { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 800; }
.pupilLessonStatus.completed { background: #dcfce7; color: #15803d; }
.pupilLessonStatus.cancelled { background: #fee2e2; color: #b91c1c; }
.pupilProfileCard { padding: 18px; }
.pupilProfileIdentity { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; }
.pupilAvatar { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: #edf4ff; color: #176ae0; font-size: 23px; font-weight: 850; }
.pupilActiveState { color: #16a34a; font-weight: 750; }
.pupilActiveState::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.pupilActiveState.inactive { color: #64748b; }
.pupilProfileFacts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin-top: 16px; }
.pupilProfileFacts > div { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: start; gap: 10px; min-width: 0; }
.pupilProfileFacts > div > span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #eff6ff; color: #176ae0; font-size: 20px; font-weight: 800; }
.pupilProfileFacts > div > span svg, .pupilProfileDirections svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pupilProfileFacts p, .pupilProfileFacts small, .pupilProfileFacts strong { display: block; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.pupilProfileFacts small { margin-bottom: 3px; color: #64748b; }
.pupilProfileFacts p > span { display: block; color: #64748b; }
.pupilProfileAccount { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--pf-border, #e2e8f0); }
.pupilProfileAccount h3 { margin: 0; }
.pupilProfileAccount .pupilProfileFacts { margin-top: 11px; }
.pupilProfileDirections { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; margin-top: 14px; }
.pupilAdvancedCard { margin-top: 12px; }
.pupilAdvancedRow { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 64px; padding: 12px 14px; border: 1px solid var(--pf-border, #e2e8f0); border-radius: 14px; background: #fff; color: inherit; text-align: left; font: inherit; }
.pupilAdvancedRow + .pupilAdvancedRow { margin-top: 8px; }
.pupilAdvancedRow span { display: grid; gap: 4px; }
.pupilAdvancedRow small { color: #64748b; }
.pupilAdvancedRow.destructive { border-color: #fecaca; background: #fff7f7; color: #b91c1c; }
.pupilInlineBack { min-height: 44px; margin-bottom: 10px; padding: 8px 2px; border: 0; background: transparent; color: #0f172a; font: inherit; font-weight: 750; }
.pupilLessonIdentity, .pupilLessonSection { padding: 18px; }
.pupilLessonIdentity h2 { margin: 0; font-size: 24px; }
.pupilLessonTime { margin: 5px 0 0; font-weight: 700; }
.pupilLessonSection { border: 1px solid var(--pf-border, #dbe3ee); border-radius: 16px; background: #fff; }
.pupilLessonSection h3 { margin-top: 0; }
.pupilLessonPlanSection { background: #f6fffb; }
.pupilLessonActions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.pupilLessonActions .btn { min-width: 0; min-height: 48px; padding: 8px; white-space: normal; }

@media (max-width: 700px) {
  #view-pupilProfile { padding-inline: 10px; }
  #phTabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .phMoreMenu { top: 108px; }
  .pupilProfileCard { padding: 16px; }
  .pupilProfileIdentity { grid-template-columns: auto minmax(0, 1fr) auto; }
  .pupilProfileIdentity .btn { width: auto; }
  .pupilProfileFacts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .pupilProfileFacts > div { grid-template-columns: 38px minmax(0, 1fr); gap: 8px; }
  .pupilProfileFacts > div > span { width: 38px; height: 38px; }
  .pupilSummaryFacts, .pupilLessonFacts { grid-template-columns: minmax(0, 1fr); }
  .pupilLessonActions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pupilLessonActions .btn:last-child { grid-column: 1 / -1; }
}
@media (max-width: 370px) {
  .pupilProfileFacts .pupilProfileLongValue { grid-column: 1 / -1; }
}
@media (max-width: 350px) {
  .pupilBottomNav { right: 5px; left: 5px; padding-inline: 3px; }
  .pupilBottomNav small { font-size: 10px; }
  .pupilBottomNav .pupilBottomAdd > span { width: 48px; height: 48px; }
  .pupilSummaryHeading { align-items: flex-start; }
  .pupilLessonListMeta { align-items: flex-end; flex-direction: column; }
  .pupilProfileCard { padding: 14px; }
  .pupilProfileIdentity { grid-template-columns: auto minmax(0, 1fr); }
  .pupilProfileIdentity .btn { grid-column: 1 / -1; width: 100%; }
}
