:root {
  --bg: #f2f5f9;
  --surface: #ffffff;
  --surface-soft: #f2f5f9;
  --text: #505050;
  --heading: #10438a;
  --muted: #5a6a7e;
  --line: #d9e0ea;
  --primary: #10438a;
  --primary-hover: #1a5299;
  --primary-soft: #edf4fb;
  --accent: #fdcd24;
  --accent-soft: #f1e4d1;
  --danger: #b91c1c;
  --success: #166534;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 6px 18px rgba(0, 65, 140, 0.05);
  --shadow-md: 0 10px 28px rgba(0, 65, 140, 0.08);
  --transition: 0.3s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.hidden {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at 14% 18%, rgba(253, 205, 36, 0.18), transparent 28rem),
    linear-gradient(135deg, #ffffff 0%, #f2f5f9 58%, #e9f0f8 100%);
}

.login-panel {
  width: min(100%, 480px);
  padding: clamp(24px, 5vw, 38px);
  background: var(--surface);
  border: 1px solid rgba(0, 65, 140, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.login-panel h1,
.topbar h1 {
  margin: 0;
  color: var(--heading);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: 0;
}

.brand-logo {
  display: block;
  width: 150px;
  max-width: 58%;
  height: auto;
  margin: 0 auto 18px;
}

.topbar-logo {
  display: block;
  width: 88px;
  max-width: 42vw;
  height: auto;
  margin: 0 0 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 20px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid rgba(0, 65, 140, 0.1);
  border-radius: var(--radius);
}

.auth-switch button {
  min-height: 38px;
  color: var(--primary);
  background: transparent;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  font-weight: 800;
}

.auth-switch button.active {
  background: #fff;
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 6px;
  color: var(--heading);
  font-size: 0.92rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid rgba(0, 65, 140, 0.14);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}

textarea {
  min-height: 72px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 0;
  border-color: rgba(0, 65, 140, 0.34);
  box-shadow: 0 0 0 4px rgba(0, 65, 140, 0.08);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 700;
  overflow: hidden;
  overflow-wrap: normal;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: transform var(--transition), background-color var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.demo-users button:hover,
.tabs button:hover {
  transform: none;
}

.primary-button {
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: var(--shadow);
}

.primary-button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.secondary-button {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 65, 140, 0.14);
  box-shadow: var(--shadow);
}

.secondary-button:hover {
  background: #eef2f8;
  border-color: rgba(0, 65, 140, 0.24);
}

.ghost-button {
  color: var(--primary);
  background: transparent;
  border: 1px solid rgba(0, 65, 140, 0.18);
}

.ghost-button:hover {
  background: rgba(0, 65, 140, 0.05);
  border-color: rgba(0, 65, 140, 0.34);
}

.danger-button {
  color: #fff;
  background: var(--danger);
  border: 1px solid var(--danger);
}

.demo-users {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.demo-users .small-title {
  flex: 0 0 100%;
  margin: 0;
}

.demo-users button {
  min-height: 36px;
  padding: 7px 12px;
  color: var(--primary);
  background: var(--accent-soft);
  border: 1px solid rgba(0, 65, 140, 0.08);
  border-radius: var(--radius);
  font-weight: 800;
  transition: transform var(--transition), background-color var(--transition), border-color var(--transition);
}

.demo-users button:hover {
  background: #f7eddc;
  border-color: rgba(0, 65, 140, 0.18);
}

.small-title {
  color: var(--heading);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.message.error {
  color: var(--danger);
}

.report-form textarea {
  min-height: 96px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-approved {
  background: #e7f7ec;
  color: var(--success);
}

.status-pending {
  background: #fff7d6;
  color: #775a00;
}

.status-rejected {
  background: #ffe8e5;
  color: var(--danger);
}

.status-pending_director {
  background: #fff7d6;
  color: #775a00;
}

.status-open {
  background: #fff7d6;
  color: #775a00;
}

.status-in_progress {
  background: var(--primary-soft);
  color: var(--primary);
}

.status-resolved {
  background: #e7f7ec;
  color: var(--success);
}

.status-submitted,
.status-slip_generated,
.status-signed_pending_verification {
  background: #fff7d6;
  color: #775a00;
}

.status-reviewed,
.status-verified {
  background: #e7f7ec;
  color: var(--success);
}

.status-not_required {
  background: var(--primary-soft);
  color: var(--primary);
}

.report-actions {
  flex-wrap: nowrap;
}

.message.success {
  color: var(--success);
}

.app-shell {
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding: 10px 16px 16px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(0, 65, 140, 0.14);
  border-radius: 0;
  box-shadow: none;
}

.topbar h1 {
  font-size: clamp(1.35rem, 2.1vw, 1.8rem);
  line-height: 1;
}

.topbar .eyebrow {
  margin-bottom: 4px;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
}

.topbar-logo {
  width: 68px;
  margin: 0 0 4px;
}

.topbar > div {
  min-width: 0;
}

.topbar .ghost-button {
  width: 100%;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin: 8px 0;
  padding: 4px 0 6px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(0, 65, 140, 0.08);
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.tabs button {
  flex: 0 1 auto;
  max-width: none;
  min-height: 32px;
  min-width: 0;
  padding: 6px 2px;
  color: var(--heading);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-size: 0.9rem;
  font-weight: 800;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: transform var(--transition), background-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.tabs button.active {
  color: var(--primary);
  background: transparent;
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.sidebar {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.manager-shell .tabs {
  scrollbar-width: auto;
}

.side-tools {
  display: grid;
  gap: 8px;
  padding: 8px 0 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.side-tools .small-title,
.side-tools .muted {
  margin: 0;
}

.side-tools .muted {
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.side-tools .side-download {
  width: 100%;
}

.content {
  display: grid;
  min-width: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.search-strip {
  padding: 14px 18px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(0, 65, 140, 0.08);
  border-radius: 0;
  box-shadow: none;
}

.search-strip label {
  max-width: 520px;
}

.subject-roster {
  border-top: 4px solid var(--color-primary, #10438a);
}

.subject-roster .search-strip {
  margin: 0 0 1rem;
  padding: 0;
  box-shadow: none;
  border: 0;
}

.student-detail {
  scroll-margin-top: 1rem;
  border-top: 4px solid var(--color-accent, #fdcd24);
}

.student-detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0 1.5rem;
}

.student-detail-meta span {
  padding: .85rem 1rem;
  border: 1px solid #d9e0ea;
  border-radius: 12px;
  overflow-wrap: anywhere;
}

.student-detail-meta strong {
  display: block;
  margin-bottom: .3rem;
  color: #10438a;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.student-detail-meta .wide {
  grid-column: span 2;
}

.student-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.student-detail-grid h3 {
  margin: 0 0 .75rem;
}

@media (max-width: 900px) {
  .student-detail-meta,
  .student-detail-grid {
    grid-template-columns: 1fr;
  }

  .student-detail-meta .wide {
    grid-column: auto;
  }
}

.is-filtered-out {
  display: none !important;
}

.section {
  min-width: 0;
  padding: clamp(14px, 2.2vw, 22px);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.content > .section + .section,
.content > .section + .plain-card,
.content > .plain-card + .section,
.content > .plain-card + .plain-card,
.content > .section + .empty-state,
.content > .empty-state + .section {
  border-top: 1px solid rgba(0, 65, 140, 0.08);
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.section-header h2,
.section h3 {
  margin: 0;
  color: var(--heading);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.section-header .muted {
  margin: 6px 0 0;
  font-size: 0.95rem;
}

.load-section {
  box-shadow: none;
}

.load-section .bulk-table {
  min-width: 900px;
}

.load-section .bulk-table-wrap {
  border-color: #b9c3cf;
}

.load-section .bulk-table input,
.load-section .bulk-table select {
  min-height: 38px;
}

.deadline-alerts {
  display: grid;
  gap: 12px;
  margin: 10px 0 12px;
  padding: 14px 16px;
  background: #fff8dc;
  border: 1px solid rgba(119, 90, 0, 0.2);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.content > .deadline-alerts {
  margin: clamp(14px, 2.2vw, 22px);
}

.content > .deadline-alerts + .section {
  border-top: 1px solid rgba(0, 65, 140, 0.08);
}

.deadline-alerts-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.deadline-alerts h2 {
  margin: 0;
  color: var(--heading);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
}

.deadline-alerts .muted {
  margin: 2px 0 0;
  font-size: 0.88rem;
}

.deadline-alerts ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.deadline-alerts li::marker {
  color: #775a00;
}

.deadline-alerts li strong {
  color: #775a00;
}

.deadline-alerts li span {
  margin-left: 4px;
}

.grid {
  display: grid;
  gap: 8px;
}

.quick-grid {
  display: grid;
  gap: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat-card,
.plain-card {
  padding: 14px 16px;
  background: var(--surface-soft);
  border: 1px solid rgba(0, 65, 140, 0.08);
  border-radius: var(--radius);
  box-shadow: none;
}

.content > .plain-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.stat-card {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 6px;
  min-height: 70px;
}

.stat-card .muted {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 0;
  color: var(--heading);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.75rem;
  line-height: 1;
}

.campus-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

.campus-link:hover,
.campus-link:focus-visible {
  text-decoration: underline;
}

.campus-missing {
  color: var(--muted);
  font-size: 0.88rem;
}

.table-wrap {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(0, 65, 140, 0.08);
  border-radius: var(--radius);
  box-shadow: none;
}

.table-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid rgba(0, 65, 140, 0.08);
  border-radius: var(--radius);
}

.table-search-label,
.table-size-label,
.bulk-search-label,
.list-search-label {
  min-width: 0;
  margin: 0;
}

.table-search-label span,
.table-size-label span,
.bulk-search-label span,
.list-search-label span {
  font-size: 0.76rem;
  letter-spacing: 0;
}

.table-size-label {
  width: 86px;
}

.table-pager {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 240px;
}

.table-page-btn {
  min-height: 38px;
  padding: 7px 12px;
}

.table-page-status {
  min-width: 84px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

.hidden-row {
  display: none !important;
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 65, 140, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--heading);
  background: var(--surface-soft);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-grade-form {
  display: grid;
  grid-template-columns: minmax(72px, 96px) minmax(140px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: min(100%, 360px);
}

.inline-grade-form input {
  min-height: 38px;
  padding: 8px 10px;
}

.inline-grade-form button {
  min-height: 38px;
  padding: 8px 12px;
}

.grade-edit-dialog {
  width: min(680px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.5rem;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.grade-edit-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.contact-stack {
  display: grid;
  gap: 4px;
  padding: 6px 0;
}

.contact-stack + .contact-stack {
  border-top: 1px solid rgba(0, 65, 140, 0.1);
  margin-top: 6px;
  padding-top: 10px;
}

.contact-lines {
  display: grid;
  gap: 2px;
  min-width: 180px;
}

.contact-lines span {
  overflow-wrap: anywhere;
}

.actions button,
.inline-form button,
.form-stack button {
  min-width: 0;
}

.inline-form {
  display: grid;
  gap: 8px;
}

.compact-section {
  padding-block: 12px;
}

.checkbox-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.bulk-form {
  display: grid;
  gap: 10px;
}

.quick-panel {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding-top: 0;
}

.quick-panel + .quick-panel {
  padding-top: 12px;
  border-top: 1px solid rgba(0, 65, 140, 0.08);
}

.quick-panel-header {
  display: grid;
  gap: 8px;
}

.quick-panel-header h3,
.quick-panel-header .muted {
  margin: 0;
}

.quick-actions {
  align-items: end;
}

.quick-actions label {
  min-width: min(100%, 220px);
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-bottom: 16px;
  padding: 8px 0 0;
  overflow: visible;
  background: transparent;
  border: 1px solid rgba(0, 65, 140, 0.08);
  border-width: 1px 0 0;
  border-radius: 0;
}

.subtabs button {
  flex: 0 1 auto;
  min-height: 34px;
  padding: 7px 2px;
  color: var(--heading);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-weight: 800;
  transition: color var(--transition), border-color var(--transition);
}

.subtabs button:hover {
  color: var(--primary-hover);
}

.subtabs button.active {
  background: transparent;
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.entry-main {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.bulk-toolbar {
  align-items: end;
  flex-wrap: wrap;
}

.bulk-search-label {
  flex: 1 1 220px;
}

.bulk-count {
  align-self: center;
  margin-right: auto;
  color: var(--heading);
  font-size: 0.9rem;
  font-weight: 800;
}

.bulk-general-observation {
  display: grid;
  gap: 6px;
  max-width: 760px;
}

.bulk-general-observation span {
  color: var(--heading);
  font-size: 0.9rem;
  font-weight: 800;
}

.bulk-general-observation small {
  color: var(--muted);
}

.list-search-label {
  display: block;
  margin: 10px 0;
}

.csv-input {
  min-width: 0;
}

.bulk-table-wrap {
  max-height: min(68vh, 720px);
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid rgba(0, 65, 140, 0.08);
  border-radius: var(--radius);
}

.bulk-table {
  min-width: 760px;
}

.bulk-table td {
  vertical-align: middle;
}

.bulk-table input,
.bulk-table select {
  min-width: 120px;
}

.bulk-table .bulk-check {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
}

.quick-table {
  min-width: 880px;
}

.planner-table {
  min-width: 820px;
}

.planner-table th:last-child,
.planner-table td:last-child {
  width: 112px;
  text-align: center;
}

.planner-table .secondary-button {
  min-height: 34px;
  padding: 6px 14px;
  border-radius: var(--radius);
  box-shadow: none;
  font-size: 0.88rem;
}

.planner-table .row-action {
  width: auto;
  min-width: 82px;
}

.planner-table select {
  min-height: 38px;
}

.quick-table th:first-child,
.quick-table td:first-child {
  width: 54px;
}

.quick-table th:last-child,
.quick-table td:last-child {
  width: 132px;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.loading {
  padding: 18px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  color: var(--primary);
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 800;
}

@media (max-width: 519px) {
  .login-shell {
    padding: 14px;
  }

  .login-panel {
    padding: 22px;
  }

  .tabs {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
  }

  .tabs button {
    width: auto;
    min-width: 0;
    justify-content: flex-start;
  }

  .manager-shell .tabs {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
  }

  .manager-shell .tabs button {
    width: auto;
    max-width: none;
    min-width: 0;
  }

  .section {
    padding: 16px;
  }

  .search-strip {
    padding: 16px;
  }

  .stat-card {
    min-height: 58px;
  }

  .table-wrap {
    border: 0;
    overflow: visible;
  }

  .table-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .table-size-label,
  .table-pager {
    width: 100%;
    min-width: 0;
  }

  .table-pager {
    justify-content: space-between;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 8px;
  }

  tr {
    border: 1px solid rgba(0, 65, 140, 0.08);
    border-radius: var(--radius);
    background: #fff;
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: minmax(84px, 38%) minmax(0, 1fr);
    gap: 8px;
    min-height: 34px;
    padding: 7px 9px;
    border-bottom: 1px solid rgba(0, 65, 140, 0.08);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    color: var(--heading);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  tr:last-child td {
    border-bottom: 1px solid rgba(0, 65, 140, 0.08);
  }

  td:last-child {
    border-bottom: 0;
  }

  td .actions {
    gap: 6px;
  }

  td .actions button {
    width: 100%;
  }

  .bulk-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(0, 65, 140, 0.08);
  }

  .bulk-table,
  .bulk-table thead,
  .bulk-table tbody,
  .bulk-table tr,
  .bulk-table th,
  .bulk-table td {
    display: revert;
  }

  .bulk-table thead {
    display: table-header-group;
  }

  .bulk-table tbody {
    display: table-row-group;
  }

  .bulk-table tr {
    display: table-row;
    border: 0;
    border-radius: 0;
  }

  .bulk-table th,
  .bulk-table td {
    display: table-cell;
    border-bottom: 1px solid rgba(0, 65, 140, 0.08);
  }

  .bulk-table td::before {
    content: none;
  }
}

@media (min-width: 720px) {
  .app-shell {
    display: grid;
    grid-template-columns: 212px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 18px;
    padding: 10px 18px 18px;
    height: 100vh;
    overflow: hidden;
  }

  .app-shell.manager-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    max-width: 1480px;
  }

  .login-panel,
  .section,
  .topbar {
    padding: 18px;
  }

  .topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
  }

  .topbar > div {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 18px;
    align-items: center;
  }

  .topbar-logo {
    grid-row: 1 / 3;
    margin: 0;
  }

  .topbar .ghost-button {
    width: auto;
  }

  .tabs {
    position: static;
    top: auto;
    flex-direction: column;
    margin: 0;
  }

  .sidebar {
    grid-column: 1;
    grid-row: 2;
    position: static;
    align-self: stretch;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 67, 138, 0.5) rgba(16, 67, 138, 0.08);
    padding-right: 6px;
  }

  .sidebar::-webkit-scrollbar {
    width: 8px;
  }

  .sidebar::-webkit-scrollbar-track {
    background: rgba(16, 67, 138, 0.08);
    border-radius: 999px;
  }

  .sidebar::-webkit-scrollbar-thumb {
    background: rgba(16, 67, 138, 0.45);
    border-radius: 999px;
  }

  .app-shell:not(.manager-shell) .tabs {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .manager-shell .sidebar {
    position: static;
    top: auto;
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: stretch;
    overflow: visible;
    padding-right: 0;
  }

  .manager-shell .tabs {
    position: static;
    top: auto;
    flex-direction: row;
    flex-wrap: wrap;
    margin: 0;
    overflow: visible;
  }

  .tabs button {
    width: 100%;
  }

  .manager-shell .tabs button {
    width: auto;
    max-width: none;
  }

  .tabs button.active {
    box-shadow: none;
  }

  .manager-shell .tabs button.active {
    box-shadow: none;
  }

  .manager-shell .side-tools {
    grid-template-columns: auto minmax(220px, 320px);
    align-items: end;
  }

  .content {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .manager-shell .content {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .section-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .quick-panel-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .quick-actions {
    flex-wrap: nowrap;
  }

  .grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .inline-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .inline-form .full {
    grid-column: 1 / -1;
  }

  .inline-form .wide-field {
    grid-column: 1 / -1;
  }
}

@media (min-width: 980px) {
  .login-panel,
  .section,
  .topbar {
    padding: 20px;
  }
}

/* ─── NOTIFICATION BELL ─────────────────────────────────────────────────────── */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.notif-bell-btn {
  position: relative;
  padding: 10px 12px;
  line-height: 1;
}

.notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: #dc2626;
  color: #fff;
  border-radius: 9px;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

/* ─── NOTIFICATION CARDS ─────────────────────────────────────────────────────── */

.notif-list {
  display: grid;
  gap: 10px;
  padding: 4px 0 12px;
}

.notif-card {
  padding: 16px 20px;
  border: 1px solid rgba(0, 65, 140, 0.1);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.notif-unread {
  background: var(--primary-soft);
  border-color: rgba(16, 67, 138, 0.22);
}

.notif-read {
  opacity: 0.75;
}

.notif-sent {
  background: var(--surface-soft);
}

.notif-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.notif-title {
  margin: 0 0 5px;
  color: var(--heading);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}

.notif-body {
  margin: 0 0 10px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

.notif-sender,
.notif-student,
.notif-read-status {
  margin: 0 0 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.notif-type {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.notif-type-info {
  background: rgba(16, 67, 138, 0.1);
  color: var(--primary);
}

.notif-type-reminder {
  background: rgba(253, 205, 36, 0.3);
  color: #6b4d00;
}

.notif-type-alert {
  background: rgba(185, 28, 28, 0.12);
  color: var(--danger);
}

.notif-new-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.notif-channel {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Notification sender — student checkbox picker */
.notif-students-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.notif-students-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.notif-students-header .label-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.notif-students-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0;
  max-height: 280px;
  overflow-y: auto;
}

.notif-student-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  transition: background 0.1s;
}

.notif-student-check:hover {
  background: var(--surface-soft);
}

.notif-student-check input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.notif-student-check span:first-of-type {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-student-course {
  font-size: 0.75rem;
  white-space: nowrap;
}

/* File input and preview in notification form */
.notif-file-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.notif-file-label input[type="file"] {
  font-size: 0.85rem;
  font-weight: 400;
  padding: 6px 0;
  color: var(--text);
}

.field-hint {
  font-size: 0.78rem;
  font-weight: 400;
}

.notif-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.notif-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text);
}

/* Attachment chips in notification cards */
.notif-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.notif-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  background: var(--surface-soft);
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s;
}

a.notif-attach-chip:hover,
button.notif-attach-chip:hover {
  background: var(--primary-light, #e8f0fe);
  border-color: var(--primary);
  color: var(--primary);
}

button.notif-attach-chip {
  min-height: 0;
  font-weight: inherit;
  cursor: pointer;
}

.notif-attach-demo {
  opacity: 0.65;
  cursor: default;
}

/* ─── CALENDAR MONTH VIEW ─────────────────────────────────────────────────── */

.common-spaces-section,
.common-spaces-list {
  display: grid;
  gap: 18px;
}

.common-spaces-header {
  gap: 14px;
}

.common-space-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(0, 65, 140, 0.12);
  border-radius: var(--radius);
  background: #fff;
}

.common-space-card h3 {
  margin: 0 0 12px;
  color: var(--heading);
}

.common-space-grid-wrap {
  overflow-x: auto;
  border: 1px solid rgba(0, 65, 140, 0.1);
  border-radius: var(--radius);
}

.common-space-grid {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
}

.common-space-grid th,
.common-space-grid td {
  height: 66px;
  padding: 7px;
  border-right: 1px solid rgba(0, 65, 140, 0.09);
  border-bottom: 1px solid rgba(0, 65, 140, 0.09);
  vertical-align: middle;
}

.common-space-grid thead th {
  height: auto;
  background: #f4f7fb;
  color: var(--heading);
  text-align: center;
}

.common-space-grid thead th span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.common-space-grid tbody th {
  width: 108px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  white-space: nowrap;
}

.common-space-cell button {
  width: 100%;
  min-height: 48px;
  border: 1px dashed rgba(16, 67, 138, 0.25);
  border-radius: 9px;
  color: var(--primary);
  background: rgba(16, 67, 138, 0.035);
  font-size: 0.78rem;
  font-weight: 700;
}

.common-space-cell button:hover,
.common-space-cell button:focus-visible {
  border-style: solid;
  background: rgba(16, 67, 138, 0.1);
}

.common-space-cell-booked {
  color: #14532d;
  background: #ecfdf3;
}

.common-space-cell-booked strong,
.common-space-cell-booked small {
  display: block;
  overflow-wrap: anywhere;
}

.common-space-cell-booked small {
  margin-top: 4px;
  color: #3f6650;
  font-size: 0.75rem;
}

.common-space-cell-empty {
  color: #a0aec0;
  text-align: center;
}

.calendar-section {
  display: grid;
  gap: 12px;
}

.calendar-section-header {
  gap: 12px;
}

.calendar-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-nav strong {
  color: var(--heading);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: capitalize;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays span {
  display: grid;
  place-items: center;
  min-height: 26px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-day {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 98px;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(0, 65, 140, 0.12);
  border-radius: var(--radius);
  text-align: left;
}

.calendar-day:hover {
  border-color: rgba(16, 67, 138, 0.28);
}

.calendar-day-out {
  background: #f7f9fc;
  opacity: 0.82;
}

.calendar-day-today {
  border-color: rgba(16, 67, 138, 0.46);
}

.calendar-day-selected {
  box-shadow: inset 0 0 0 2px rgba(16, 67, 138, 0.35);
}

.calendar-day-number {
  color: var(--heading);
  font-size: 0.86rem;
  font-weight: 800;
}

.calendar-day-preview {
  display: grid;
  gap: 4px;
}

.calendar-day-pill {
  display: inline-block;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(16, 67, 138, 0.1);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-day-more {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.calendar-day-panel {
  border: 1px solid rgba(0, 65, 140, 0.1);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-soft);
}

.calendar-day-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.calendar-day-item {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(0, 65, 140, 0.1);
  border-radius: var(--radius);
  background: #fff;
}

.calendar-day-item strong {
  color: var(--heading);
  font-size: 0.95rem;
}

.calendar-day-item p {
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
}

@media (max-width: 719px) {
  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-weekdays {
    display: none;
  }

  .calendar-day {
    min-height: 84px;
  }
}

/* Multiple adult roles and active-view selector */
.view-role-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--heading);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.view-role-control select {
  width: auto;
  min-width: 150px;
  min-height: 40px;
  padding: 7px 34px 7px 10px;
}

.role-checkbox-fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(0, 65, 140, 0.14);
  border-radius: var(--radius);
}

.role-checkbox-fieldset legend {
  padding: 0 6px;
  color: var(--heading);
  font-size: 0.92rem;
  font-weight: 800;
}

.role-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.role-checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
}

.role-checkbox-grid input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  margin: 0;
  flex: 0 0 auto;
}

@media (max-width: 767px) {
  .topbar-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .view-role-control {
    flex: 1 1 100%;
  }

  .view-role-control select {
    flex: 1;
    min-width: 0;
  }
}
.grade-breakdown {
  min-width: 150px;
}

.grade-breakdown summary {
  align-items: center;
  color: var(--color-primary, #173f35);
  cursor: pointer;
  display: inline-flex;
  gap: 0.55rem;
  font-weight: 700;
}

.grade-breakdown-panel {
  background: #f7f4ec;
  border: 1px solid rgba(33, 67, 58, 0.15);
  border-radius: 12px;
  margin-top: 0.65rem;
  max-width: 420px;
  padding: 0.8rem;
}

.grade-breakdown-panel p {
  margin: 0.35rem 0;
}

.grade-breakdown-panel ul {
  margin: 0.45rem 0;
  padding-left: 1.1rem;
}

.bulk-table textarea[name="observation"] {
  min-width: 260px;
  resize: vertical;
}

.final-observation-field {
  min-width: 340px;
  overflow: hidden;
  border: 1px solid rgba(33, 67, 58, 0.2);
  border-radius: 10px;
  background: #fff;
}

.final-observation-prefix {
  display: block;
  padding: 8px 10px;
  background: #f7f4ec;
  color: #213b35;
  font-size: 0.82rem;
  font-weight: 700;
}

.final-observation-field textarea[name="observation"] {
  display: block;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.final-observation-field textarea[name="observation"]:focus {
  box-shadow: inset 0 0 0 2px rgba(0, 65, 140, 0.18);
}

.final-observation-field small {
  display: block;
  padding: 0 10px 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.grade-breakdown-label {
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 0.8rem !important;
}

.grade-closing-history {
  list-style: none;
  padding-left: 0 !important;
}

.grade-closing-row {
  align-items: start;
  border-bottom: 1px solid rgba(33, 67, 58, 0.12);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.45rem 0;
}

.grade-closing-row p {
  margin: 0.2rem 0 0;
}

.grade-export-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grade-export-control {
  align-items: end;
  background: #f7f4ec;
  border: 1px solid rgba(33, 67, 58, 0.15);
  border-radius: 12px;
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
}

.grade-export-control label,
.grade-export-control select,
.grade-export-control button {
  width: 100%;
}

@media (max-width: 900px) {
  .grade-export-grid {
    grid-template-columns: 1fr;
  }
}

.final-grade-value {
  align-items: center;
  background: #173f35;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  justify-content: center;
  min-height: 2rem;
  min-width: 2rem;
  padding: 0 0.55rem;
}

.grade-components {
  list-style: none;
  padding-left: 0 !important;
}

.grade-components li {
  align-items: center;
  border-bottom: 1px solid rgba(33, 67, 58, 0.12);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.35rem 0;
}
