:root {
  --brand: #e21f23;
  --brand-dark: #c41b1e;
  --brand-soft: #fdeced;
  --surface: #f8f8f8;
  --ink: #1f1f1f;
  --muted: #6b6b6b;
  --card: #ffffff;
  --line: #e6e6e6;
  --ok: #1f7a4d;
  --warn: #b36b00;
}

html { font-size: 15px; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem rgba(226, 31, 35, 0.25);
}

.navbar.bg-dark { background: #2b2b2b !important; }
.navbar .nav-link {
  position: relative;
  color: rgba(255, 255, 255, 0.92) !important;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.navbar button.nav-link {
  border: 0;
  font: inherit;
  cursor: pointer;
  background: transparent;
}
.navbar button.nav-link:hover,
.navbar button.nav-link.show {
  background: rgba(255, 255, 255, 0.1);
  color: #fff !important;
}
.navbar button.nav-link.active,
.navbar button.nav-link.active:hover,
.navbar button.nav-link.active.show {
  background: var(--brand-soft);
  color: var(--ink) !important;
}
.navbar .nav-link:not(.dropdown-toggle)::after {
  content: "";
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.2rem;
  height: 2px;
  border-radius: 1px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s ease;
  pointer-events: none;
}
.navbar .nav-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.1);
}
.navbar .nav-link:not(.dropdown-toggle):hover::after {
  transform: scaleX(1);
}
.navbar .nav-link.active {
  color: var(--ink) !important;
  background: var(--brand-soft);
  font-weight: 600;
}
.navbar .nav-link:not(.dropdown-toggle).active::after {
  display: none;
}
.navbar .dropdown-menu {
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 0.35rem;
  min-width: 12rem;
}
.navbar .dropdown-item {
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  color: var(--ink);
}
.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
  background: var(--brand-soft);
  color: var(--ink);
}
.navbar .dropdown-item.active,
.navbar .dropdown-item:active {
  background: var(--brand);
  color: #fff;
}
.navbar-brand { letter-spacing: 0.02em; }
.navbar-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.nursery-scope {
  max-width: 14rem;
  background: #243140;
  color: #fff;
  border-color: #4b5563;
}
.nursery-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.nursery-logo-preview {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .navbar .nav-link,
  .navbar .nav-link:not(.dropdown-toggle)::after {
    transition: none;
  }
}
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.muted { color: var(--muted); }

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-head h2 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.form-card {
  max-width: 40rem;
}
.form-card-wide {
  max-width: none;
  padding: 1.85rem 2.1rem 2rem;
}
.form-card-wide .form-section-title {
  margin: 0 0 1.15rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.form-card-wide .form-section {
  margin-bottom: 2.35rem;
}
.form-card-wide .form-card-actions {
  margin-top: 0.25rem;
}
.form-card-wide .form-text {
  margin-top: 0.45rem;
  line-height: 1.45;
}
.form-card-wide input[type="color"].form-control {
  width: 5.75rem;
  max-width: 100%;
  height: 2.55rem;
  padding: 0.28rem;
}
@media (max-width: 767.98px) {
  .form-card-wide {
    padding: 1.25rem 1.1rem 1.4rem;
  }
}
.form-card .form-label {
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.form-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
}
.filter-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.filter-inline .form-label {
  margin: 0;
  white-space: nowrap;
  font-weight: 600;
}
.filter-inline .form-select,
.filter-inline .form-control {
  min-width: 11rem;
}

.table {
  --bs-table-bg: transparent;
}
.table > :not(caption) > * > * {
  padding: 0.75rem 0.9rem;
  vertical-align: middle;
}
.table thead th {
  background: var(--brand-soft);
  color: var(--ink);
  border-bottom: 2px solid #f0c4c5;
  font-weight: 600;
}

/* Shared alternating row colors across admin tables */
.table tbody tr:nth-child(odd) > *,
.meals-grid tbody tr:nth-child(odd) > *,
.schedule-timeline tbody tr:nth-child(odd) > * {
  background-color: #fff;
  --bs-table-bg-type: #fff;
  box-shadow: none;
}
.table tbody tr:nth-child(even) > *,
.meals-grid tbody tr:nth-child(even) > *,
.schedule-timeline tbody tr:nth-child(even) > * {
  background-color: #f3f3f3;
  --bs-table-bg-type: #f3f3f3;
  box-shadow: none;
}
.table tbody tr:hover > *,
.meals-grid tbody tr:hover > *,
.schedule-timeline tbody tr:hover > * {
  background-color: #ececec;
  --bs-table-bg-state: #ececec;
  box-shadow: none;
}

.table-actions a,
.table-actions .table-action-btn,
a.table-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}
.table-actions .table-action-btn {
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  vertical-align: baseline;
}
.table-actions a:hover,
.table-actions .table-action-btn:hover,
a.table-link:hover {
  background: var(--brand-soft);
  text-decoration: underline;
}
.table-actions .sep {
  color: #ccc;
  margin: 0 0.15rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.dash-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.dash-panel h3 {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-top: 3px solid var(--brand);
  background: var(--brand-soft);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.dash-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}
.dash-panel .dash-body { padding: 0.75rem 1rem 1rem; }
.dash-empty { color: var(--muted); font-size: 0.9rem; padding: 0.5rem 0; }
.dash-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}
.dash-stat-row:last-child { border-bottom: 0; }
.badge-yes { color: var(--ok); font-weight: 600; }
.badge-no { color: var(--muted); }

.parent-devices-table {
  font-size: 0.88rem;
}
.parent-devices-table > :not(caption) > * > * {
  padding: 0.4rem 0.65rem;
}
.parent-devices-table tbody tr.row-stale > * {
  color: #8a4b00;
}
.parent-devices-table .font-monospace {
  font-size: 0.78rem;
}
.parent-devices-table .student-cell {
  min-width: 11rem;
}
.parent-devices-table .student-cell-inner {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 1.4rem;
}
.parent-devices-table .student-tree {
  display: none;
  position: relative;
  flex: 0 0 1.1rem;
  width: 1.1rem;
  height: 1.6rem;
}
.parent-devices-table tr.is-grouped:not(.student-group-start) .student-tree {
  display: block;
}
/* Vertical stem (down) */
.parent-devices-table .student-tree::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: -0.55rem;
  width: 0;
  border-left: 2px solid #9a9a9a;
}
/* Elbow to the right */
.parent-devices-table .student-tree::after {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 50%;
  width: 0.65rem;
  border-top: 2px solid #9a9a9a;
}
/* Mid branch: stem continues through the row */
.parent-devices-table tr.student-group-mid .student-tree::before {
  bottom: -0.55rem;
}
/* Last branch: stem stops at the elbow */
.parent-devices-table tr.student-group-end .student-tree::before {
  bottom: 50%;
}
.parent-devices-table .student-name-block {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}
.parent-devices-table .student-device-count {
  white-space: nowrap;
}
.parent-devices-table tr.is-grouped.student-group-mid > *,
.parent-devices-table tr.is-grouped.student-group-end > * {
  border-top-color: #eee;
}

.meals-month-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.45rem;
}
.meals-month-nav strong {
  min-width: 10rem;
  text-align: center;
  font-size: 1.05rem;
}
.meals-nav-btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.meals-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.meals-grid th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  padding: 0.75rem 0.9rem;
  border-bottom: 2px solid #f0c4c5;
  background: var(--brand-soft);
}
.meals-grid td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.meals-grid tr.weekend td {
  background: #e9e9e9 !important;
  color: var(--muted);
}
.meals-day {
  font-weight: 600;
  white-space: nowrap;
  width: 5.5rem;
}
.meals-grid .form-control {
  border-radius: 8px;
  border-color: #ddd;
  background: #fff;
}
.meals-grid .click-edit {
  min-width: 8rem;
  cursor: pointer;
}
.meals-grid .click-edit .ce-display {
  max-width: none;
  display: block;
  padding: 0.45rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meals-grid .click-edit .ce-editor {
  min-width: 8rem;
}

.report-table {
  font-size: 0.82rem;
  width: 100%;
  min-width: 0;
  table-layout: auto;
  border-collapse: collapse;
}
.report-table > :not(caption) > * > * {
  padding: 0.28rem 0.2rem;
}
.report-table .col-student {
  /* Shrink-wrap to the longest name in the column */
  width: 1%;
  white-space: nowrap;
  max-width: none;
  overflow: visible;
  padding-right: 0.35rem !important;
  padding-left: 0.35rem !important;
}
.report-table th.col-student {
  font-size: 0.72rem;
  text-align: left;
  white-space: nowrap;
}
.report-table .col-student .student-name {
  display: inline;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  font-weight: 600;
}
.report-table .col-student .badge-no-app {
  display: inline-block;
  margin-left: 0.25rem;
  margin-top: 0;
  font-size: 0.58rem;
  padding: 0.05rem 0.25rem;
  vertical-align: middle;
}
.report-table .report-colhead {
  width: auto;
  padding-left: 0.12rem !important;
  padding-right: 0.12rem !important;
}
.report-table .col-check {
  width: 2.5rem;
  max-width: 3rem;
  padding-left: 0.08rem !important;
  padding-right: 0.08rem !important;
  text-align: center;
}
.report-table .col-select {
  width: 6.1rem;
  max-width: 6.35rem;
  padding-left: 0.12rem !important;
  padding-right: 0.12rem !important;
}
.report-table .col-select .ce-display {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 6.1rem;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
}
.report-table .col-select.is-editing .ce-editor {
  width: max(100%, 7rem);
  min-width: 7rem;
  right: auto;
  max-width: 11rem;
}
.report-table .col-nap {
  width: 3.5rem;
  max-width: 3.6rem;
}
.report-table .col-nap .ce-display {
  max-width: 3.5rem;
}
.report-table .col-nap.is-editing .ce-editor {
  min-width: 4.75rem;
  width: max(100%, 4.75rem);
}
.report-table .col-feeling {
  width: 7rem;
  max-width: 7.25rem;
}
.report-table .col-feeling .ce-display {
  max-width: 7rem;
}
.report-table .col-feeling.is-editing .ce-editor {
  min-width: 8rem;
  width: max(100%, 8rem);
}
.report-table .col-tip:not(.col-notes) {
  width: 4.25rem;
  max-width: 4.75rem;
}
.report-table .col-notes {
  width: auto;
  min-width: 4.25rem;
}
.report-table .col-count {
  width: 3.1rem;
  max-width: 3.4rem;
  text-align: center;
  padding-left: 0.08rem !important;
  padding-right: 0.08rem !important;
}
.report-table .col-count .ce-display {
  text-align: center;
  padding-left: 0.1rem;
  padding-right: 0.1rem;
}
.report-table .col-count .ce-editor {
  padding-left: 0.1rem;
  padding-right: 0.1rem;
  text-align: center;
}
.report-table .col-actions {
  width: 4.1rem;
  max-width: 4.5rem;
  padding-left: 0.15rem !important;
  padding-right: 0.15rem !important;
}
.report-table .form-control,
.report-table .form-select {
  min-width: 0;
  width: 100%;
  padding: 0.25rem 0.3rem;
  font-size: 0.82rem;
}
.report-table tr.report-absent .report-field {
  pointer-events: none;
}
.report-table tr.report-absent .report-field > * {
  visibility: hidden;
}
.report-table tr.report-absent .student-name {
  color: var(--muted);
  font-weight: 500;
}
.report-table tr.report-absent .badge-no-app {
  opacity: 0.65;
}
.report-table .form-check-input {
  accent-color: var(--brand);
  border-color: #d0a0a1;
  cursor: pointer;
}
.report-table .form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}
.report-table .form-check-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(226, 31, 35, 0.25);
}
.report-table .form-check-input:checked:focus {
  box-shadow: 0 0 0 0.2rem rgba(226, 31, 35, 0.25);
}
.report-sent { color: var(--ok); font-weight: 600; }
.report-absent-label { color: var(--muted); font-style: italic; }

.row-system td {
  color: #9a9a9a;
  background: #f0f0f0 !important;
}
.row-system .table-actions a,
.row-system .table-actions .table-action-btn {
  color: #888;
}
.row-inactive td {
  color: #9a9a9a;
}
.row-inactive .table-actions a,
.row-inactive .table-actions .table-action-btn {
  color: #888;
}

.schedule-time-col {
  width: 5.25rem;
  min-width: 5.25rem;
  vertical-align: stretch !important;
  padding: 0 !important;
  position: relative;
}
.timeline-rail {
  position: relative;
  height: 100%;
  min-height: 3.4rem;
  padding: 0 0.85rem 0 0.2rem;
}
.timeline-rail::before {
  content: "";
  position: absolute;
  right: 0.35rem;
  left: auto;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #f0c4c5;
}
.schedule-slot:not(.is-last) .timeline-rail::before {
  bottom: -1px;
}
.timeline-mark {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  height: 0;
  z-index: 1;
  padding-right: 0.85rem;
  box-sizing: border-box;
}
.timeline-mark-top {
  top: 0;
  transform: translateY(-50%);
}
.timeline-mark-bottom {
  bottom: 0;
  transform: translateY(50%);
}
.timeline-dot {
  position: absolute;
  right: 0.17rem;
  left: auto;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #f0c4c5;
  flex-shrink: 0;
}
.timeline-time {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  background: var(--card);
  padding: 0 0.15rem;
  text-align: right;
  white-space: nowrap;
}
.timeline-span {
  height: 100%;
}
.schedule-timeline tbody tr:nth-child(odd) > .schedule-time-col,
.schedule-timeline tbody tr:nth-child(even) > .schedule-time-col,
.schedule-timeline tbody tr:hover > .schedule-time-col {
  background-color: #fff !important;
  --bs-table-bg-type: #fff;
  --bs-table-bg-state: #fff;
  box-shadow: none;
}
.schedule-timeline .timeline-time {
  background: #fff;
}
.schedule-timeline tbody tr.schedule-slot td {
  border-top: 1px solid var(--line);
}
.schedule-timeline tbody tr.schedule-slot td:not(.schedule-time-col) {
  vertical-align: middle;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}
.schedule-timeline .click-edit {
  min-width: 5.5rem;
}
.schedule-timeline .click-edit .ce-display {
  max-width: 9rem;
  display: block;
  padding: 0.35rem 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-timeline .click-edit .ce-editor {
  min-width: 5.5rem;
}

.report-colhead {
  text-align: center !important;
  vertical-align: bottom;
  font-size: 0.65rem;
  line-height: 1.1;
}
.report-colhead img {
  display: block;
  width: 46px;
  height: 46px;
  margin: 0 auto 0.15rem;
  object-fit: contain;
}
.report-colhead span {
  display: block;
  text-align: center;
  max-width: 3.6rem;
  margin: 0 auto;
}
.report-top-field {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.report-field-icon-lg {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.report-top-field-body {
  flex: 1;
  min-width: 0;
}
.report-top-field-body .form-control {
  max-width: 100%;
}
.badge-no-app {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8a4b00;
  background: #fff3cd;
  border: 1px solid #ffe69c;
  border-radius: 4px;
  vertical-align: middle;
}

.report-field-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}
.report-field-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.click-edit {
  cursor: pointer;
  position: relative;
  min-width: 3.2rem;
}
.click-edit .ce-display {
  display: block;
  padding: 0.35rem 0.3rem;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
  min-height: 1.9rem;
}
.click-edit:hover .ce-display {
  background: var(--brand-soft);
}
.click-edit .ce-editor {
  display: none;
  width: 100%;
  min-width: 0;
}
.click-edit.is-editing .ce-display {
  visibility: hidden;
}
.click-edit.is-editing .ce-editor {
  display: block;
  position: absolute;
  left: 0.2rem;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}
.click-edit.is-editing {
  cursor: default;
}

.site-tip {
  position: fixed;
  z-index: 1080;
  max-width: min(22rem, calc(100vw - 1.5rem));
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid #f0c4c5;
  box-shadow: 0 8px 24px rgba(31, 31, 31, 0.12);
  font-size: 0.88rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
.site-tip.is-visible {
  opacity: 1;
  visibility: visible;
}

.print-sheet { max-width: 720px; margin: 1rem auto; }
.print-card {
  border: 1px solid #d8d0e8;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 1rem;
  color: #5b2d8e;
  background: #fff;
  overflow: hidden;
}
.print-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.print-card h1 {
  font-size: 1.35rem;
  margin: 0;
  color: var(--brand);
}
.print-card h3 {
  margin: 0.9rem 0 0.4rem;
  font-size: 1.02rem;
  color: #5b2d8e;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.print-card h3 img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.print-card .line { margin: 0.3rem 0 0.3rem 0.35rem; }
.print-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  flex-shrink: 0;
}
.print-cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}
/* Daily report cards: two per row */
.print-cards-grid .print-card {
  flex: 1 1 calc(50% - 0.75rem);
  max-width: calc(50% - 0.375rem);
  box-sizing: border-box;
  margin-bottom: 0;
  break-inside: avoid;
  page-break-inside: avoid;
}
/* Access code slips: half-page width, cuttable */
.print-cards-grid .access-print-card {
  flex: 0 0 calc(50% - 0.4rem);
  width: calc(50% - 0.4rem);
  max-width: calc(50% - 0.4rem);
  box-sizing: border-box;
  margin-bottom: 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

.access-print-card {
  border: 1px solid #d0c8dc;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
  break-inside: avoid;
  page-break-inside: avoid;
  background: #fff;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #2a2433;
}
.access-print-card .brand-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}
.access-print-card .brand-row img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}
.access-print-title {
  font-size: 1.12rem;
  color: var(--brand);
  display: block;
  line-height: 1.2;
}
.access-print-tagline {
  font-size: 0.8rem;
}
.access-print-intro {
  margin: 0 0 0.7rem;
}
.access-print-card .code-box {
  margin-top: 0;
  padding: 0.7rem 0.85rem;
  background: var(--brand-soft);
  border-radius: 8px;
  border-left: 4px solid var(--brand);
  flex: 1;
  min-width: 0;
}
.access-print-initials {
  letter-spacing: 0.06em;
}
.access-print-code {
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  color: var(--brand);
}
.access-print-url {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  word-break: break-all;
  line-height: 1.3;
}
.access-print-body {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.access-print-qr {
  flex-shrink: 0;
}
.access-print-qr img {
  display: block;
  width: 128px;
  height: 128px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fff;
}
.access-print-qr-label {
  font-size: 0.72rem;
  text-align: center;
  margin-top: 0.3rem;
}
.access-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.student-picker {
  position: relative;
}
.student-picker-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  max-height: 16rem;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.student-picker-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.75rem;
  color: var(--ink);
}
.student-picker-option:hover,
.student-picker-option:focus {
  background: var(--brand-soft);
  outline: none;
}
.student-picker-empty {
  padding: 0.65rem 0.75rem;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  html, body {
    background: #fff !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
  }
  .navbar, .no-print, .btn, nav { display: none !important; }
  .container,
  .container.body-content {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .print-card, .access-print-card { box-shadow: none; }

  /* Daily report cards: two per row */
  .print-cards-grid:not(.access-codes-print) {
    display: block;
  }
  .print-cards-grid:not(.access-codes-print) .print-card {
    display: inline-block;
    vertical-align: top;
    width: 48%;
    max-width: 48%;
    margin: 0 2% 0.6rem 0;
    font-size: 0.82rem;
    padding: 0.7rem 0.85rem;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
  }
  .print-cards-grid:not(.access-codes-print) .print-card h1 {
    font-size: 1.05rem;
  }
  .print-cards-grid:not(.access-codes-print) .print-card h3 {
    margin: 0.55rem 0 0.25rem;
    font-size: 0.92rem;
  }
  .print-cards-grid:not(.access-codes-print) .print-card h3 img {
    width: 18px;
    height: 18px;
  }
  .print-cards-grid:not(.access-codes-print) .print-card .line {
    margin: 0.2rem 0 0.2rem 0.25rem;
  }
  .print-cards-grid:not(.access-codes-print) .print-logo {
    width: 48px;
    height: 48px;
  }

  /*
   * Access slips: fixed physical size so A4 fits exactly 2 cols x 3 rows.
   * Explicit page breaks every 6 cards are inserted in the PrintAll view.
   */
  .access-print-page-break {
    display: block;
    grid-column: 1 / -1;
    break-before: page;
    page-break-before: always;
    height: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .access-codes-print {
    display: grid !important;
    grid-template-columns: 93mm 93mm;
    column-gap: 4mm;
    row-gap: 4mm;
    justify-content: start;
    align-content: start;
    width: 190mm;
    max-width: 190mm;
    font-size: 10.5pt;
  }
  .access-codes-print-single {
    grid-template-columns: 93mm;
    width: 93mm;
  }
  .access-codes-print .access-print-card,
  .access-print-card {
    display: block !important;
    width: 93mm !important;
    max-width: 93mm !important;
    min-width: 93mm !important;
    height: 88mm !important;
    max-height: 88mm !important;
    margin: 0 !important;
    padding: 5mm 5.5mm !important;
    font-size: 10.5pt !important;
    line-height: 1.35;
    border: 1px solid #999 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
  }
  .access-print-card .brand-row {
    margin-bottom: 2.5mm;
    gap: 2.5mm;
  }
  .access-print-card .brand-row img {
    width: 11mm !important;
    height: 11mm !important;
    max-width: none !important;
  }
  .access-print-title {
    font-size: 12.5pt !important;
  }
  .access-print-tagline {
    font-size: 8.5pt !important;
  }
  .access-print-intro {
    margin: 0 0 3mm !important;
    font-size: 9.5pt !important;
  }
  .access-print-body {
    gap: 3.5mm;
  }
  .access-print-qr {
    flex-shrink: 0;
  }
  .access-print-qr img {
    width: 30mm !important;
    height: 30mm !important;
    max-width: none !important;
  }
  .access-print-qr-label {
    font-size: 8pt !important;
    margin-top: 1mm;
  }
  .access-print-card .code-box {
    margin-top: 0;
    padding: 2.5mm 3mm !important;
  }
  .access-print-code {
    font-size: 15pt !important;
    letter-spacing: 0.12em;
  }
  .access-print-url {
    display: none !important;
  }
}
