/* ================================
   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 ========= */

* {
  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;
}

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

.btn {
  border: 1px solid rgba(255, 255, 255, .20);
  background: rgba(0, 0, 0, .18);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btnSecondary {
  background: rgba(0, 0, 0, .28);
}

.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 rgba(255, 255, 255, .12);
  background: rgba(0, 0, 0, .28);
  color: var(--text);
}

.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;
}

/* ========= 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;
}

.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;
}

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

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

.modalCard {
  background: #1e1f23;
  padding: 24px;
  border-radius: 12px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
  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);
}

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

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

@media (max-width:860px) {

  .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;
  }

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

  h2 {
    font-size: 28px;
  }

}

/* 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;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  z-index: 999;
}

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;
}

.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;
  }

}

.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;
}

.dateField {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: #bbb;
}

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

@media (max-width: 768px) {

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

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

  .dateField {
    flex: 1;
  }

  #btnExport {
    width: 100%;
    margin-top: 10px;
  }

}

.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: #aaa;
  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;
  }

}

.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;
}


/* =========================
   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;
}

/* 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;
}

/* 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: #ddd;
}

/* half hour */
.timeHalf {
  position: absolute;
  top: 30px;
  left: 6px;
  font-size: 10px;
  color: #777;
}

/* ===== 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,
      transparent,
      transparent 59px,
      rgba(255, 255, 255, 0.15) 60px);

  pointer-events: none;
}

.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 */
}

.pCalDragTimeLabel {
  position: absolute;
  top: -18px;
  left: 4px;
  font-size: 11px;
  background: #000;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0.9;
}

/* ===== 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;
}

.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: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pfModal.hidden {
  display: none;
}

.pfModalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.pfModalCard {
  position: relative;
  width: 95%;
  max-width: 420px;
  background: #1c1c1e;
  border-radius: 12px;
  padding: 16px;
  z-index: 1;
}

.pfModalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pfModalBody {
  display: grid;
  gap: 10px;
}

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

.pfField input {
  height: 36px;
  border-radius: 6px;
  border: none;
  padding: 0 8px;
}

.pfModalFooter {
  margin-top: 12px;
}

.pfModalFooter button {
  width: 100%;
  height: 40px;
}

.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: #b5bcc6;
}

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

  display: block;
  background: #0b0f14;
  overflow-y: auto;
}

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

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