:root {
  --primary: #0d6efd;
  --primary-dark: #0b5ed7;
  --page: #f6f7fb;
  /* Solid page background fixes the "column" */
  --card-bg: #ffffff;
  --radius: 16px;
  --transition: 0.25s ease;
}

/* Reset & base */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100svh;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--page);
  display: grid;
  place-items: center;
  /* centers the card */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* When logged in, use normal flow (not centered grid) */
body.app-mode {
  display: block;
  padding: 20px;
}


/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 36px;
  background: var(--card-bg);
  /* solid white, no frosted blur */
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.08);
  text-align: center;
  animation: fade-in 0.45s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logo {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--primary);
}

.subtitle {
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 24px;
}

/* ---------- Form ---------- */
.field {
  position: relative;
  margin-bottom: 14px;
}

.field input {
  width: 100%;
  padding: 14px 44px 14px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 8px;
}

.toggle-password:hover {
  color: var(--primary);
}

/* ---------- Button ---------- */
.btn {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition), transform 0.05s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--primary-dark);
}

.btn:active {
  transform: translateY(1px);
}

/* ---------- Messages ---------- */
#message {
  margin-top: 14px;
  font-size: 0.93rem;
  font-weight: 500;
  min-height: 1.2em;
}

.error {
  color: #d52731;
}

.success {
  color: #269f53;
}

/* ---------- Logout button ---------- */
/* Tiny logout icon (top-left of the page) */
.logout-icon {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.12);
  transition: background var(--transition), transform 0.05s ease;
  z-index: 1000;
}

.logout-icon i {
  font-size: 14px;
  /* slightly larger than before */
  line-height: 1;
}

.logout-icon:hover {
  background: var(--primary-dark);
}

.logout-icon:active {
  transform: translateY(1px);
}



/* ---------- "+User" FAB (bottom-left) ---------- */
.user-fab {
  position: fixed;
  bottom: 12px;
  left: 12px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 6px 14px rgba(16, 24, 40, 0.14);
  transition: background var(--transition), transform 0.05s ease, box-shadow var(--transition);
  z-index: 1000;
}

.user-fab i {
  font-size: 18px;
  line-height: 1;
}

.user-fab:hover {
  background: var(--primary-dark);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.18);
}

.user-fab:active {
  transform: translateY(1px);
}


/* ---------- Calendar FAB (above +User) ---------- */
.calendar-fab {
  position: fixed;
  bottom: 64px;
  /* sits above the +User fab */
  left: 12px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(16, 24, 40, 0.14);
  transition: background var(--transition), transform 0.05s ease, box-shadow var(--transition);
  z-index: 1000;
}

.calendar-fab i {
  font-size: 18px;
  line-height: 1;
}

.calendar-fab:hover {
  background: var(--primary-dark);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.18);
}

.calendar-fab:active {
  transform: translateY(1px);
}


/* Teacher Calendar FAB (stacked above student FAB) */
.teacher-fab {
  bottom: 116px;
}

/* Teacher page: pin the FAB to the true bottom-left and trim bottom spacing */
.page-teacher .teacher-fab {
  position: fixed;
  bottom: 12px;
  /* was 116px on main page — this is the fix */
  left: 12px;
  z-index: 1200;
}

/* In case any containers add extra bottom gap, collapse it on this page */
.page-teacher .student-grid,
.page-teacher .day-grid,
.page-teacher #tBoardContent {
  margin-bottom: 0;
  padding-bottom: 0;
}


/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 23, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 1100;
}


/* Respect the [hidden] attribute for the modal */
.modal-backdrop[hidden] {
  display: none !important;
}

/* ---------- Autocomplete for "New student name" ---------- */
.autocomplete {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.12);
  max-height: 240px;
  overflow: auto;
  z-index: 1200;
  /* above modal content */
}

.autocomplete-list .suggestion {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.autocomplete-list .suggestion:hover {
  background: #f8fafc;
}

.autocomplete-list .empty {
  padding: 10px 12px;
  color: #64748b;
}

.modal {
  width: min(980px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(16, 24, 40, 0.28);
  animation: fade-in 0.25s ease both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #eef2f7;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  display: flex;
  gap: 10px;
  align-items: center;
  color: #0f172a;
}

.modal-close {
  border: none;
  background: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #475569;
}

.modal-body {
  padding: 18px 20px 6px;
  display: grid;
  gap: 16px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 20px 20px;
  border-top: 1px solid #eef2f7;
}

/* Buttons (match your style) */
.btn-primary,
.btn-secondary,
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  padding: 12px 16px;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), transform 0.05s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #e2e8f0;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-outline {
  background: #fff;
  color: #0f172a;
  border-color: #e2e8f0;
}

.btn-outline:hover {
  background: #f8fafc;
}

.section-title {
  margin-top: 6px;
  font-weight: 700;
  color: #0f172a;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.form-group label {
  display: block;
  margin: 0 0 6px;
  font-weight: 600;
  color: #334155;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  outline: none;
  font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

/* Schedule rows */
#scheduleRows {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 180px 160px 140px auto;
  gap: 10px;
  align-items: center;
}


/* Teacher: day + start + end + remove */
#teacherScheduleRows {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

.range-row {
  display: grid;
  grid-template-columns: 180px 140px 140px auto;
  gap: 10px;
  align-items: center;
}

.range-row .day,
.range-row .start,
.range-row .end {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.range-row .remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid #fecaca;
  background: #fff;
  color: #ef4444;
  cursor: pointer;
}

.range-row .remove:hover {
  background: #fff1f2;
}

@media (max-width:720px) {
  .range-row {
    grid-template-columns: 1fr 1fr 1fr auto;
  }
}


@media (max-width: 720px) {
  .schedule-row {
    grid-template-columns: 1fr 1fr 1fr auto;
  }
}

.schedule-row .day,
.schedule-row .time {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
}

.schedule-row .remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid #fecaca;
  background: #fff;
  color: #ef4444;
  cursor: pointer;
  justify-self: start;
  /* don't stretch across the row */
}

.schedule-row .remove i {
  pointer-events: none;
}

.schedule-row .remove:hover {
  background: #fff1f2;
}

.tip {
  color: #64748b;
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}



.schedule-row .bp-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-weight: 600;
  color: #334155;
}

.schedule-row .bp-toggle input {
  transform: translateY(1px);
}

/* ---------- Calendar Board ---------- */
.board {
  /* Wider container with a responsive cap */
  width: min(92vw, 1600px);
  max-width: 1600px;
  margin: 24px auto;
}


.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.board-header h1 {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0;
  font-size: 1.25rem;
  color: #0f172a;
}

.view-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  background: #fff;
  font-weight: 700;
}

.toggle.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.toggle:hover {
  background: #f8fafc;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
}

.icon-btn:hover {
  background: #f8fafc;
}

/* ----- By-student grid (modern cards) ----- */
.student-grid {
  display: grid;
  /* Always a single, full-width card per row */
  grid-template-columns: 1fr;
  gap: 16px;
}


.student-card {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
  padding: 14px 16px;
}

.student-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(16, 24, 40, .1);
  border-color: #e4e7ee;
}

/* 🔴 Overtime card: dotted red border */
.student-card.exceeded-alert{
  border: 2px dotted #ef4444;                 /* dotted red ring */
  box-shadow: 0 12px 30px rgba(239,68,68,.18); /* keep the soft red glow */
}



/* Row = name column + 7 equal day columns */
.student-week {
  display: grid;
  grid-template-columns: minmax(180px, 260px) repeat(7, 1fr);
  align-items: flex-start; /* was center — lets tall stacks breathe */
  gap: 8px 12px;
}

/* Day cell = vertical stack of items (breakout, time pill, teacher chip) */
.day-cell{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding-block: 2px;
}


/* name column on the left */
.student-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
}

/* small rounded badge for status number */
.status-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  background: #eef2f7;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  line-height: 1;
}


/* hide the faint day badge when a pill exists in this cell */
.day-cell.has-pill::before {
  display: none;
}

/* Connected "day + time" pill */
.duo-chip {
  --bg: #eef2ff;
  --bd: #e0e7ff;
  --fg: #3730a3;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--bd);
  background: var(--bg);
  color: var(--fg);
  border-radius: 9999px;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.03);
  cursor: pointer;
  white-space: nowrap;
  /* NEW: never wrap inside the chip */
}



/* left segment = weekday */
.duo-chip .day {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  background: rgba(255, 255, 255, .6);
  border-right: 1px solid var(--bd);
  border-top-left-radius: 9999px;
  border-bottom-left-radius: 9999px;
}

/* right segment = time (slightly smaller than before) */
.duo-chip .time {
  font-size: 14px;
  font-weight: 800;
  padding: 6px 10px;
  letter-spacing: .2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  /* NEW: keep “03:00 PM” on one line */
}


/* small hairline between start and end, follows current text color */
.t-sep {
  display: inline-block;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: .35;
}

/* when a day has multiple shifts, give pills a bit of breathing room */
/* Base spacing for the time pill */
.day-cell .duo-chip{
  margin: 6px 0 0; /* top space; teacher chip handles the bottom gap */
}

/* If the pill contains a breakout label (absolutely positioned), reserve extra space above */
.day-cell .duo-chip:has(.breakout-chip){
  margin-top: 18px; /* prevents collision with the item above */
}



/* subtle highlight for the next upcoming session */
.duo-chip.next {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .16);
  border-color: #bfdbfe;
}

/* per-day color tokens (same hues you already use) */
.duo-chip.sun {
  --bg: #fff7ed;
  --bd: #ffedd5;
  --fg: #9a3412;
}

.duo-chip.mon {
  --bg: #eef2ff;
  --bd: #e0e7ff;
  --fg: #3730a3;
}

.duo-chip.tue {
  --bg: #ecfeff;
  --bd: #cffafe;
  --fg: #155e75;
}

.duo-chip.wed {
  --bg: #ecfdf5;
  --bd: #bbf7d0;
  --fg: #065f46;
}

.duo-chip.thu {
  --bg: #fdf2f8;
  --bd: #fbcfe8;
  --fg: #9d174d;
}

.duo-chip.fri {
  --bg: #fef9c3;
  --bd: #fde68a;
  --fg: #854d0e;
}

.duo-chip.sat {
  --bg: #f1f5f9;
  --bd: #e2e8f0;
  --fg: #334155;
}

/* === Extra session (buổi phụ) look === */
.duo-chip.extra {
  --bg: #fff1f2;
  --bd: #fecaca;
  --fg: #b91c1c;
  border-style: dashed;
  position: relative;

  /* make the chip feel longer & flatter */
  padding-right: 6px;
  /* adds a tiny bit of length */
}

/* slim the vertical padding on segments only for extra chips */
.duo-chip.extra .day {
  padding: 2px 8px;
}

.duo-chip.extra .time {
  padding: 3px 12px;
  /* was 4px 12px */
  line-height: 1;
}


/* compact PHỤ badge so it doesn't increase height */
.duo-chip.extra .time::after {
  content: ' PHỤ';
  margin-left: 8px;
  font-size: 11px;
  font-weight: 900;
  padding: 1px 6px;
  /* was 2px 6px -> shorter badge */
  line-height: 1;
  /* prevents chip from growing taller */
  border-radius: 8px;
  border: 1px solid var(--bd);
  background: #fff;
}




.chip.sun {
  background: #fff7ed;
  border-color: #ffedd5;
  color: #9a3412;
}

.chip.mon {
  background: #eef2ff;
  border-color: #e0e7ff;
  color: #3730a3;
}

.chip.tue {
  background: #ecfeff;
  border-color: #cffafe;
  color: #155e75;
}

.chip.wed {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #065f46;
}

.chip.thu {
  background: #fdf2f8;
  border-color: #fbcfe8;
  color: #9d174d;
}

.chip.fri {
  background: #fef9c3;
  border-color: #fde68a;
  color: #854d0e;
}

.chip.sat {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #334155;
}

.chip.next {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .16);
  border-color: #bfdbfe !important;
}

/* Responsive: on narrow screens stack the week grid */
@media (max-width: 900px) {
  .student-week {
    grid-template-columns: 1fr;
    /* name on its own row */
  }

  .day-cell {
    padding-left: 38px;
  }

  .student-card {
    padding: 14px;
  }
}


/* pill chips + day colors */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 9999px;
  font-weight: 700;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  color: #3730a3;
}

/* day-specific hues */
.chip.sun {
  background: #fff7ed;
  border-color: #ffedd5;
  color: #9a3412;
}

.chip.mon {
  background: #eef2ff;
  border-color: #e0e7ff;
  color: #3730a3;
}

.chip.tue {
  background: #ecfeff;
  border-color: #cffafe;
  color: #155e75;
}

.chip.wed {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #065f46;
}

.chip.thu {
  background: #fdf2f8;
  border-color: #fbcfe8;
  color: #9d174d;
}

.chip.fri {
  background: #fef9c3;
  border-color: #fde68a;
  color: #854d0e;
}

.chip.sat {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #334155;
}

/* highlight the next session on the card */
.chip.next {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .16);
  border-color: #bfdbfe !important;
}


/* ----- By-day grid ----- */
.day-grid .day-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.day-grid .day-item .who {
  font-weight: 700;
  color: #0f172a;
}

.day-grid .day-item .when {
  color: #475569;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.day-grid .day-item:last-child {
  margin-bottom: 0;
}


/* Nicer “teacher name” tag */
/* Compact teacher name pill */
.assigned-teacher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* tighter gap */
  margin-top: 4px;
  /* smaller top margin */
  padding: 4px 8px;
  /* smaller padding */
  line-height: 1;
  /* keeps height tight */
  font-size: 11px;
  /* slightly smaller text */
  font-weight: 700;
  color: #1f2937;
  background: #eef2ff;
  border: 1px solid #dbeafe;
  border-radius: 9999px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: box-shadow .16s ease, border-color .16s ease;
}

.assigned-teacher::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: currentColor;
  /* dot follows text color */
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 30%, transparent);
  flex: 0 0 auto;
}

/* Teacher pill colors follow the day */
.assigned-teacher.sun {
  background: #fff7ed;
  border-color: #ffedd5;
  color: #9a3412;
}

.assigned-teacher.mon {
  background: #eef2ff;
  border-color: #e0e7ff;
  color: #3730a3;
}

.assigned-teacher.tue {
  background: #ecfeff;
  border-color: #cffafe;
  color: #155e75;
}

.assigned-teacher.wed {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #065f46;
}

.assigned-teacher.thu {
  background: #fdf2f8;
  border-color: #fbcfe8;
  color: #9d174d;
}

.assigned-teacher.fri {
  background: #fef9c3;
  border-color: #fde68a;
  color: #854d0e;
}

.assigned-teacher.sat {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #334155;
}


.assigned-teacher::before {
  content: '';
  width: 6px;
  /* smaller dot */
  height: 6px;
  border-radius: 9999px;
  background: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, .18);
  /* thinner ring */
  flex: 0 0 auto;
}

.assigned-teacher:hover {
  border-color: #bfdbfe;
  box-shadow: 0 2px 10px rgba(59, 130, 246, .12);
}



/* Usage bar under assigned pills */
.usage {
  margin-top: 6px;
}

.usage-bar {
  height: 6px;
  background: #e5e7eb;
  /* light gray track */
  border-radius: 9999px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  width: 0;
  /* set inline via style attribute */
  background: #3b82f6;
  /* blue fill */
}

.usage-label {
  margin-top: 4px;
  font-size: 11px;
  color: #334155;
}

/* Small teacher picker popover (used on main board) */
.pick-popover{
  position: fixed;
  z-index: 1300;
  right: auto !important;
  width: max-content;
  min-width: 240px;
  max-width: min(360px, calc(100vw - 24px));
  max-height: min(50vh, 320px);  /* scroll when long */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  padding: 6px 0;
}

/* Single-line rows with ellipsis so long emails don't spill */
.pick-popover .suggestion{
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pick-popover .suggestion:hover{ background:#f8fafc; }

/* Make the “remove” row look destructive */
.pick-popover .suggestion[data-unassign="1"]{
  color:#b91c1c;
  font-weight:700;
  border-top:1px dashed #fee2e2;
}
.pick-popover .suggestion[data-unassign="1"]:hover{ background:#fff1f2; }



/* Mini popover editor for a single availability range */
.avail-editor {
  position: fixed;
  z-index: 1300;
  width: 300px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 18px 36px rgba(16, 24, 40, .14);
}

.avail-editor .ae-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.avail-editor label {
  width: 48px;
  font-size: 12px;
  color: #334155;
}

.avail-editor input[type="time"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 0.95rem;
}

.avail-editor .ae-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.avail-editor .ae-actions .spacer {
  flex: 1;
}

/* small buttons */
.btn-sm {
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}

.btn-sm.primary {
  color: #fff;
  background: var(--primary);
  border-color: transparent;
}

.btn-sm.danger {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fecaca;
}

.btn-sm:hover {
  filter: brightness(0.98);
}


/* ---------- Teacher Calendar chip button (bottom-right) ---------- */
.teacher-calendar-chip {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  background: #ffffff;
  color: #111;
  border: 1px solid rgba(17, 24, 39, 0.12);
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  transition: transform 0.05s ease, box-shadow 160ms ease,
    background 160ms ease, color 160ms ease, border-color 160ms ease;
  z-index: 1100;
}

.teacher-calendar-chip .icon {
  line-height: 1;
  font-size: 16px;
  /* emoji size */
}

.teacher-calendar-chip:hover {
  border-color: var(--primary, #2563eb);
  background: var(--primary, #2563eb);
  color: #fff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.teacher-calendar-chip:active {
  transform: translateY(1px);
}

/* Focus-visible for keyboard users */
.teacher-calendar-chip:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary, #2563eb) 50%, transparent);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 6px color-mix(in srgb, var(--primary, #2563eb) 35%, transparent);
}

/* Only on Teacher page: pin the FAB to the real bottom-left */
.page-teacher .teacher-fab {
  bottom: 12px;
  left: 12px;
}


/* ---------- Back to main (teacher page) ---------- */
.back-home-chip {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  background: #ffffff;
  color: #111827;
  border: 1px solid rgba(17, 24, 39, 0.12);
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  transition: transform 0.05s ease, box-shadow 160ms ease,
    background 160ms ease, color 160ms ease, border-color 160ms ease;
  z-index: 1150;
  /* above cards & modals backdrop */
}

.back-home-chip i {
  font-size: 14px;
  line-height: 1;
}

.back-home-chip:hover {
  border-color: var(--primary, #2563eb);
  background: var(--primary, #2563eb);
  color: #fff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.back-home-chip:active {
  transform: translateY(1px);
}

.back-home-chip:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary, #2563eb) 50%, transparent);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 6px color-mix(in srgb, var(--primary, #2563eb) 35%, transparent);
}


/* ===== Teacher Planner ===== */
.planner-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

@media (max-width: 920px) {
  .planner-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .planner-grid {
    grid-template-columns: 1fr;
  }
}

.planner-day {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
  padding: 12px;
}

.planner-day h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
  color: #0f172a;
}

.range-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  margin: 8px 0 6px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-weight: 700;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.range-time {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.range-len {
  color: #64748b;
  font-weight: 600;
}

.block {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 6px 0 0;
  padding: 6px 10px;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-weight: 700;
  font-size: 12px;
  color: #0f172a;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
}

.block .when {
  color: #475569;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.block .del {
  border: none;
  background: none;
  color: #ef4444;
  cursor: pointer;
}

.add-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-weight: 600;
  cursor: pointer;
}

.add-link:hover {
  background: #eef2f7;
}

.add-pop {
  position: fixed;
  z-index: 1300;
  width: 320px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 18px 36px rgba(16, 24, 40, .14);
}

.add-pop .row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.add-pop label {
  width: 76px;
  font-size: 12px;
  color: #334155;
}

.add-pop input[type="time"],
.add-pop select,
.add-pop input[type="number"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
}

.add-pop .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.add-pop .btn-sm {
  padding: 8px 12px;
}


/* ===================== Teacher Planner: vertical timelines ===================== */

/* grid of day cards (keeps your existing look) */
.planner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.planner-day {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
}

.planner-day h4 {
  margin: 4px 8px 12px;
  color: #0f172a;
}

/* range header (08:00 — 12:00 • 240 min) */
.range-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.range-head .range-time {
  display: inline-flex;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.range-head .range-len {
  font-weight: 800;
  color: #475569;
}

.range-head .t-sep {
  display: inline-block;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: .35;
}

/* vertical timeline column */
/* ===== Teacher Planner: vertical timeline ===== */
.timeline {
  position: relative;
  --px-per-min: 3px;
  --pad-top: 20px;
  /* was 14px */
  --pad-bottom: 12px;
  height: calc(var(--len-min) * var(--px-per-min) + var(--pad-top) + var(--pad-bottom));
  padding-top: var(--pad-top);
  padding-bottom: var(--pad-bottom);
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}


/* ticks layer stays absolutely positioned */
.timeline .ticks {
  position: absolute;
  inset: 0;
}

/* 5-minute line */
.timeline .tick {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #e5e7eb;
}

/* 30-minute line a bit darker */
.timeline .tick.half {
  background: #dfe5ee;
}

/* Hour line slightly thicker */
.timeline .tick.hour {
  height: 2px;
  background: #ccd5e3;
}

/* time label next to hour / half-hour */
.timeline .tick .tlabel {
  position: absolute;
  left: 8px;
  top: -8px;
  /* centered on the line */
  font-size: 12px;
  color: #64748b;
  background: #fff;
  padding: 0 4px;
  border-radius: 6px;
}

/* Make the very first tick label (range start, e.g., 08:00) visible */
.timeline .ticks .tick:first-child .tlabel {
  top: 2px;
  /* put it fully inside the box instead of above the line */
}


/* blocks layer */
.timeline .blocks-v {
  position: absolute;
  inset: 0;
  padding: 0 10px;
}

@media (max-width: 640px) {
  .timeline {
    height: calc(var(--len-min) * 1.6px);
  }

  /* slightly shorter on phones */
}

/* 5-minute grid lines; stronger for hours/half-hours */
.tick {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(100, 116, 139, 0.18);
}

.tick.half {
  background: rgba(100, 116, 139, 0.26);
}

.tick.hour {
  background: rgba(100, 116, 139, 0.34);
}

.tick .tlabel {
  position: absolute;
  left: 6px;
  top: -7px;
  font-size: 10px;
  color: #64748b;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .7);
}

/* layer that holds the blocks */
.blocks-v {
  position: absolute;
  inset: 0;
  padding: 0 8px;
}

/* a scheduled block rectangle */
.blk {
  position: absolute;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 10px;

  /* use per-card tokens with day-color fallbacks */
  background: var(--cardbg, var(--bg));
  color: var(--cardfg, var(--fg));
  border: 1px solid var(--cardbd, var(--bd));

  box-shadow: 0 6px 12px rgba(16, 24, 40, .06);
  font-size: 12px;
  line-height: 1.2;
}

/* make inner text follow the card color */
.blk .b-name,
.blk .b-time {
  color: inherit;
}



/* Rotate a clean palette per card inside each timeline column */
/* Rotate harmonious bg/fg/border for blocks (8-color loop) */
.blocks-v .blk:nth-child(8n+1) {
  --cardbg: #eef2ff;
  --cardbd: #e0e7ff;
  --cardfg: #1e3a8a;
}

/* indigo */
.blocks-v .blk:nth-child(8n+2) {
  --cardbg: #ecfeff;
  --cardbd: #cffafe;
  --cardfg: #155e75;
}

/* cyan/teal */
.blocks-v .blk:nth-child(8n+3) {
  --cardbg: #fefce8;
  --cardbd: #fde68a;
  --cardfg: #854d0e;
}

/* amber */
.blocks-v .blk:nth-child(8n+4) {
  --cardbg: #fdf2f8;
  --cardbd: #fbcfe8;
  --cardfg: #9d174d;
}

/* rose */
.blocks-v .blk:nth-child(8n+5) {
  --cardbg: #ecfdf5;
  --cardbd: #bbf7d0;
  --cardfg: #065f46;
}

/* emerald */
.blocks-v .blk:nth-child(8n+6) {
  --cardbg: #fff7ed;
  --cardbd: #ffedd5;
  --cardfg: #9a3412;
}

/* orange */
.blocks-v .blk:nth-child(8n+7) {
  --cardbg: #f1f5f9;
  --cardbd: #e2e8f0;
  --cardfg: #334155;
}

/* slate */
.blocks-v .blk:nth-child(8n+8) {
  --cardbg: #e0f2fe;
  --cardbd: #bae6fd;
  --cardfg: #075985;
}

/* sky */

/* small lift on hover */
.blocks-v .blk:hover {
  box-shadow: 0 10px 18px rgba(16, 24, 40, .10);
}


.blk .b-time {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.blk .b-name {
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.blk .del {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #e11d48;
  cursor: pointer;
  font-size: 14px;
}

/* day color tokens reused from your chips */
.blk.sun {
  --bg: #fff7ed;
  --bd: #ffedd5;
  --fg: #9a3412;
}

.blk.mon {
  --bg: #eef2ff;
  --bd: #e0e7ff;
  --fg: #3730a3;
}

.blk.tue {
  --bg: #ecfeff;
  --bd: #cffafe;
  --fg: #155e75;
}

.blk.wed {
  --bg: #ecfdf5;
  --bd: #bbf7d0;
  --fg: #065f46;
}

.blk.thu {
  --bg: #fdf2f8;
  --bd: #fbcfe8;
  --fg: #9d174d;
}

.blk.fri {
  --bg: #fef9c3;
  --bd: #fde68a;
  --fg: #854d0e;
}

.blk.sat {
  --bg: #f1f5f9;
  --bd: #e2e8f0;
  --fg: #334155;
}


/* ===== Teacher Planner: centered "Add block" modal ===== */
.add-pop-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 23, 0.45);
  display: grid;
  place-items: center;
  padding: 14px;
  z-index: 2000;
  /* above everything */
}

.add-pop {
  width: min(380px, 92vw);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(16, 24, 40, .28);
  padding: 14px;
}

.add-pop .row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.add-pop label {
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.add-pop select,
.add-pop input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 0.95rem;
}

.add-pop .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}


/* --- Planner blocks: full name, neat header --- */
.timeline .blocks-v .blk {
  display: flex;
  flex-direction: column;
  padding: 8px 10px 10px 10px;
  /* no reserved space for the X */
}


/* header row (time + delete button) */
.timeline .blocks-v .blk .b-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  /* don't push content to make space for X */
  gap: 8px;
}


/* time stays on one line */
.timeline .blocks-v .blk .b-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* name can wrap to as many lines as needed */
.timeline .blocks-v .blk .b-name {
  margin-top: 4px;
  font-weight: 600;
  white-space: normal;
  /* allow wrapping */
  overflow: visible;
  /* no clipping */
  text-overflow: clip;
  /* no ellipsis */
  word-break: break-word;
  /* break long words if needed */
}

/* put the X in the header area without shrinking text */
/* put the trash icon at the bottom-right without shifting text */
.timeline .blocks-v .blk .del {
  position: absolute;
  /* float over the card */
  bottom: 6px;
  /* ⬅️ was top:6px */
  right: 8px;
  margin: 0;
  z-index: 2;
  opacity: 0;
  /* hidden by default */
  pointer-events: none;
  /* not clickable until hover */
  transition: opacity .15s ease-in-out;
}


/* reveal on hover */
.timeline .blocks-v .blk:hover .del {
  opacity: 1;
  pointer-events: auto;
}


/* slim trash icon button */
.timeline .blocks-v .blk .del {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #ef4444;
  /* same red you used */
  background: transparent;
}

.timeline .blocks-v .blk .del i {
  font-size: 14px;
  /* slender icon size */
  line-height: 1;
}

.timeline .blocks-v .blk .del:hover {
  background: rgba(239, 68, 68, 0.10);
  /* soft red hover */
}

.impacts {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.impacts-label {
  font-weight: 700;
  color: #334155;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  background: #f8fafc;
  font-size: 12px;
  color: #0f172a;

}


/* === Teacher card actions (hover-only) === */
.student-card {
  position: relative;
  /* anchor for absolute actions */
}

.card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  /* sticks to the far right */
  display: flex;
  gap: 8px;
  opacity: 0;
  /* hidden by default */
  pointer-events: none;
  /* ignore clicks while hidden */
  transition: opacity .12s ease-in-out;
}

.student-card:hover .card-actions {
  opacity: 1;
  /* show on hover */
  pointer-events: auto;
}

.card-action {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
}

.card-action:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
}


/* --- Teacher chip: smaller + distinct from time pill --- */
.assigned-teacher {
  margin-top: 6px;
  /* small gap under the time pill */
}

.assigned-teacher .duo-chip.small {
  /* compact size */
  padding: 2px 8px;
  min-height: 18px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 9999px;

  /* make it look different from the big pill */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  /* light gray-blue */
  border: 1px solid #cbd5e1;
  /* subtle outline */
  color: #334155;
  /* slate text */
  box-shadow: none;
  /* no shadow like the pill */
}

/* Compact teacher name chip (small + dotted rectangle) */
/* Compact teacher name chip — exactly the same height as .assigned-teacher (BR chip) */
.teacher-chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;

  /* match .assigned-teacher spacing */
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1;
  min-height: 22px;         /* lock the height */

  color: #334155;
  background: #f8fafc;
  border: 1px dotted #94a3b8;
  border-radius: 9999px;     /* pill like the top chip */
  margin-top: 6px;

  /* one line only */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  max-width: 100%;
  min-width: 0;
}




/* Teacher chip spacing/indent so it visually belongs to the pill above */
.day-cell .teacher-chip{
  margin: 6px 0 10px 24px; /* top, right, bottom, left (indent) */
  max-width: 100%;
}

.teacher-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: #3b82f6;
  /* tiny blue dot */
  flex: 0 0 auto;
}

/* Teacher badge header (name + count in one chunk) */
.teacher-group {
  margin: 10px 0 22px;
}

/* Make the section title hold a single badge nicely */
.teacher-group .section-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  /* one chunk */
  margin: 12px 2px 8px;
  font-weight: 800;
  font-size: 20px;
  color: #0f172a;
}

/* The badge itself */
.teacher-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
  /* light indigo */
  border: 1px solid #c7d2fe;
  /* subtle border */
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

/* Name part (truncates nicely if long) */
.teacher-badge .tb-name {
  font-weight: 700;
  color: #1e293b;
  /* slate-800 */
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Count part (distinct circular bubble) */
.teacher-badge .tb-count {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
  background: #ffffff;
  /* white bubble */
  color: #27326a;
  /* indigo text */
  border: 1px solid #c7d2fe;
  /* match badge border */
  line-height: 1;
}

@media (max-width: 640px) {
  .teacher-group .section-title {
    font-size: 18px;
  }

  .teacher-badge .tb-count {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }
}


/* --- LearnToday: Joined status slider --- */
.join-toggle {
  margin-top: 10px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.switch input {
  display: none;
}

.switch .track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #e5e7eb;
  /* gray track (off) */
  transition: background .2s ease;
  border: 1px solid #e5e7eb;
}

.switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  /* white knob */
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
  transition: left .2s ease;
}

.switch .label {
  font-weight: 700;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.switch .label .off {
  color: #334155;
}

/* slate-700 */
.switch .label .on {
  color: #065f46;
  display: none;
}

/* emerald-900 */

.switch input:checked+.track {
  background: #22c55e;
  /* green track (on) */
  border-color: #22c55e;
}

.switch input:checked+.track .thumb {
  left: 22px;
}

.switch input:checked~.label .off {
  display: none;
}

.switch input:checked~.label .on {
  display: inline;
}


/* --- LearnToday: modern confirm popup --- */
.confirm-overlay{
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(2, 8, 23, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1500;
}
.confirm-overlay[hidden]{ display: none !important; }

.confirm-dialog{
  width: min(560px, 92vw);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(16,24,40,.20);
  padding: 16px 18px 14px;
  animation: pop-in .18s ease-out both;
}
@keyframes pop-in{
  from{ opacity: 0; transform: translateY(6px) scale(.98); }
  to  { opacity: 1; transform: none; }
}

/* header + title */
.confirm-head{ display: grid; gap: 8px; margin-bottom: 8px; }
.confirm-title{
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; color: #0f172a;
}
.confirm-title .emoji{
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: #f1f5f9;
}
/* Student name in the confirm title: plain blue text, no pill */
.confirm-title .hv-name{
  color:#2563eb;          /* blue */
  font-weight:800;        /* bold */
  background:none;
  border:0;
  padding:0;
  border-radius:0;
}

/* guidance box */
.confirm-note{
  font-size: 13px;
  line-height: 1.55;
  color: #334155;
  background: #fff;                 /* plain background */
  border: 1px dotted #94a3b8;       /* dotted rectangle */
  border-radius: 10px;
  padding: 10px 12px;
}

/* keep the bold emphasis darker */
.confirm-note b{ color:#0f172a; }

.confirm-note b{ color:#0f172a; }

/* field */
.field-row{ margin: 12px 0 8px; }
.field-row label{
  display: block; margin-bottom: 6px;
  font-weight: 800; color: #0f172a;
}
.field-row label small{ font-weight: 600; color: #64748b; }

/* url input + copy button */
.input-with-copy{ display: flex; align-items: center; gap: 8px; }
.input-with-copy input{
  flex: 1; height: 44px;
  padding: 0 12px; border-radius: 12px;
  background: #f9fafb; border: 1px solid #e5e7eb;
  font-size: 14px; outline: none;
}
.input-with-copy input:focus{
  background: #fff; border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}
.input-with-copy button{
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px; border: 1px solid #e5e7eb;
  background: #fff; cursor: pointer;
}
.input-with-copy button:hover{ background: #f8fafc; }

.tiny-hint{ font-size: 12px; color: #64748b; margin-top: 6px; }

/* actions */
.confirm-actions{
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 14px;
}
.btn-cancel, .btn-confirm{
  padding: 10px 14px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 800; cursor: pointer;
}
.btn-cancel{ background:#f1f5f9; color:#0f172a; }
.btn-cancel:hover{ background:#e2e8f0; }
.btn-confirm{ background:#22c55e; color:#fff; }
.btn-confirm:hover{ background:#16a34a; }



/* Confirm popup: image input row */
.confirm-input {
  margin: 8px 0 12px;
}

.confirm-input .ci-label {
  display: block;
  font-weight: 700;
  color: #334155;
  margin: 0 0 6px;
}

.clip-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.clip-wrap .clip {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
}

.clip-wrap .spin-btn,
.clip-wrap .copy-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
}

.clip-wrap .copy-btn {
  display: none;
}

.tiny-tip {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

/* LearnToday: upload spinner */
.upload-spinner{
  width: 18px;
  height: 18px;
  margin: 0 8px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  border-top-color: #0d6efd;      /* primary */
  animation: ts-spin .8s linear infinite;
  flex: 0 0 auto;
}
@keyframes ts-spin{
  to { transform: rotate(360deg); }
}

/* Start delta = compact pill badge (Early/Late/On time) */
.start-delta{
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9999px;
  background: #f8fafc;            /* neutral base */
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 0 rgba(16,24,40,.03);
}

.start-delta .sd-label{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 12px;
  color: #334155;                  /* slate */
}

/* default icon + divider */
.start-delta .sd-label::before{
  content:"🎯";
  font-size: 12px; line-height: 1;
}
.start-delta .sd-label::after{
  content:"";
  width:1px; height:14px;
  background:#e5e7eb; opacity:.9;
  display:inline-block;
}

.start-delta .sd-clock{
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: .3px;
  color:#0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* --- State colors --- */
.start-delta.ontime{
  background:#ecfdf5;              /* green-50 */
  border-color:#bbf7d0;            /* green-200 */
}
.start-delta.ontime .sd-label{ color:#065f46; } /* green-900 */
.start-delta.ontime .sd-label::before{ content:"✅"; }
.start-delta.ontime .sd-label::after{ background:#86efac; }

.start-delta.early{
  background:#eef2ff;              /* indigo-50 */
  border-color:#dbeafe;            /* indigo-200 */
}
.start-delta.early .sd-label{ color:#1e3a8a; }  /* indigo-900 */
.start-delta.early .sd-label::before{ content:"🚀"; }
.start-delta.early .sd-label::after{ background:#c7d2fe; }

.start-delta.late{
  background:#fef2f2;              /* red-50 */
  border-color:#fecaca;            /* red-200 */
}
.start-delta.late .sd-label{ color:#b91c1c; }   /* red-700 */
.start-delta.late .sd-label::before{ content:"⏰"; }
.start-delta.late .sd-label::after{ background:#fecaca; }

/* respect [hidden] */
.start-delta[hidden]{ display:none !important; }


/* Time used = compact pill badge */
.time-used {
  margin-top: 8px;
  display: inline-flex;               /* inline pill, not a grid */
  align-items: center;
  gap: 6px;                           /* tight gap between label/time */
  padding: 6px 10px;
  border-radius: 9999px;              /* full pill */
  background: #eef2ff;                /* light indigo */
  border: 1px solid #dbeafe;          /* subtle border */
  box-shadow: 0 1px 0 rgba(16,24,40,.03);
}

.time-used .tu-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: #27326a;                     /* deeper indigo text */
  font-size: 12px;
}

/* tiny clock icon + slim divider */
.time-used .tu-label::before {
  content: "⏱";
  font-size: 12px;
  line-height: 1;
}

.time-used .tu-label::after {
  content: "";
  width: 1px;
  height: 14px;
  background: #c7d2fe;               /* soft indigo line */
  opacity: .9;
  display: inline-block;
}

.time-used .tu-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: .3px;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}


.time-used[hidden]{ display:none !important; }


/* Time left = compact pill badge (green tone) */
.time-left {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9999px;
  background: #ecfdf5;       /* light green */
  border: 1px solid #bbf7d0; /* green-200 */
  box-shadow: 0 1px 0 rgba(16,24,40,.03);
}

/* Red styles for both <=10m alert and overtime exceeded */
.time-left.alert,
.time-left.exceeded{
  background:#fee2e2;
  border-color:#fecaca;
}
.time-left.alert .tl-label,
.time-left.exceeded .tl-label{
  color:#b91c1c;
}
.time-left.alert .tl-label::after,
.time-left.exceeded .tl-label::after{
  background:#fecaca;
}
/* optional icons */
.time-left.alert .tl-label::before{ content:"⏰"; }
.time-left.exceeded .tl-label::before{ content:"⛔"; }



.time-left .tl-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: #065f46;            /* deep green */
  font-size: 12px;
}

.time-left .tl-label::before {
  content: "⏳";
  font-size: 12px;
  line-height: 1;
}

.time-left .tl-label::after {
  content: "";
  width: 1px;
  height: 14px;
  background: #86efac;
  opacity: .9;
  display: inline-block;
}

.time-left .tl-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: .3px;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Make sure hidden works */
.time-left[hidden]{ display:none !important; }

/* tiny gap between the two pills */
.time-used { margin-right: 6px; }


/* Time left: danger state (< 10 min) */
.time-left.danger {
  background: #fef2f2;          /* light red */
  border-color: #fecaca;        /* red-200 */
}

.time-left.danger .tl-label {
  color: #b91c1c;               /* red-700 */
}

.time-left.danger .tl-label::after {
  background: #fecaca;          /* divider matches border */
}

.time-left.danger .tl-clock {
  color: #7f1d1d;               /* red-900-ish monospace */
}


/* LearnToday: "Complete" pill button */
.complete-btn{
  margin-top: 8px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 12px;
  border-radius:9999px;
  background:#dcfce7;          /* green-100 */
  border:1px solid #bbf7d0;    /* green-200 */
  font-weight:800;
  color:#166534;               /* green-800 */
  cursor:pointer;
}
.complete-btn::before{ content:"✅"; font-size:14px; line-height:1; }
.complete-btn:hover{ filter:brightness(.98); }
.complete-btn[disabled]{ opacity:.55; cursor:not-allowed; }


/* Make sure anything with the [hidden] attribute is truly hidden,
   even if a component sets display (e.g., inline-flex). */
[hidden] { display: none !important; }



.br-badge {
  position: absolute;
  top: -12px;
  right: -12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .4px;
  box-shadow:
    0 6px 14px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.35);
  pointer-events: none; /* purely decorative; clicks go to the tooltip */
}

.br-badge::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 0 2px rgba(37,99,235,.18);
  pointer-events: none;
}


/* --- BR badge on day/time pill --- */
.duo-chip { position: relative; } /* ensure we can absolutely position the badge */

.br-badge {
  position: absolute;
  top: -8px;             /* nudge above the chip */
  right: -10px;          /* nudge to the right of the chip */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .3px;
  border: 1px solid rgba(255,255,255,.45);
  box-shadow:
    0 6px 14px rgba(0,0,0,.2),
    inset 0 1px 0 rgba(255,255,255,.2);
  cursor: pointer;       /* clickable */
  z-index: 2;            /* float above the chip */
}

.br-badge:focus {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(37,99,235,.25),
    0 6px 14px rgba(0,0,0,.2),
    inset 0 1px 0 rgba(255,255,255,.2);
}

.br-badge:hover {
  filter: brightness(1.05);
}

.br-badge:active {
  transform: translateY(1px);
}


/* --- BR badge inline, next to time inside the pink pill --- */
.duo-chip .time {
  display: inline-flex;
  align-items: center;
  gap: 6px;           /* space between time text and badge */
}

.br-badge-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .3px;
  line-height: 1;
  border: 1px solid rgba(255,255,255,.45);
  box-shadow:
    0 3px 8px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.2);
  cursor: pointer;    /* clickable */
  padding: 0;         /* ensure perfect circle */
}

.br-badge-inline:hover { filter: brightness(1.05); }
.br-badge-inline:active { transform: translateY(1px); }
.br-badge-inline:focus {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(37,99,235,.25),
    0 3px 8px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.2);
}


/* --- Breakout teacher chip (shows above the time pill) --- */
.duo-chip { position: relative; } /* anchor for absolute chip */

.breakout-chip {
  position: absolute;
  bottom: calc(100% + 4px); /* sit just above the pill */
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.2;
  background: #eef2ff;          /* soft indigo bg */
  color: #3730a3;               /* indigo-800 text */
  border: 1px solid #c7d2fe;    /* indigo-200 border */
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  pointer-events: none;         /* display only */
}

.breakout-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #6366f1;         /* indigo-500 */
}

/* If the name contains a <br>, hide it so the chip stays one line */
.teacher-chip br { display: none; }
