/* StudyBuddy — Page-specific styles */

/* ========== Auth / Login ========== */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
}

.auth-left {
  background: #F0F7FF;
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(37, 99, 235, 0.08), transparent),
    radial-gradient(ellipse 50% 40% at 80% 20%, rgba(37, 99, 235, 0.06), transparent);
  pointer-events: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.auth-brand img { width: 40px; height: 40px; object-fit: contain; }
.auth-brand .brand-text { font-size: 22px; font-weight: 700; color: var(--text-heading); }
.auth-tagline {
  margin-top: 4px;
  margin-left: 50px;
  font-size: 13px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.auth-hero {
  margin-top: 40px;
  position: relative;
  z-index: 1;
  max-width: 480px;
}
.auth-hero h1 {
  font-size: clamp(34px, 3.2vw, 44px);
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 14px;
}
.auth-hero p {
  font-size: 15px;
  color: var(--text-body);
  line-height: 1.6;
}

.auth-illustration {
  margin-top: auto;
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: flex-end;
  min-height: 0;
  padding-top: 12px;
  margin-right: -48px;
  margin-bottom: -8px;
}
.auth-illustration img {
  width: 100%;
  height: auto;
  max-height: min(62vh, 680px);
  object-fit: contain;
  object-position: left bottom;
}

.auth-right {
  display: flex;
  flex-direction: column;
  padding: 32px 48px;
  position: relative;
}

.auth-signup-link {
  position: absolute;
  top: 32px;
  right: 48px;
  font-size: 13.5px;
  color: var(--text-body);
}
.auth-signup-link a { font-weight: 600; }

.auth-form-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

.auth-form-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}
.auth-form-logo img { width: 48px; height: 48px; margin-bottom: 10px; }
.auth-form-logo h2 { font-size: 20px; margin-bottom: 4px; }
.auth-form-logo .welcome { font-size: 24px; font-weight: 700; margin-top: 16px; }
.auth-form-logo .sub { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }

.auth-form .form-group { margin-bottom: 14px; }
.auth-signup-actions { display: grid; gap: 8px; }

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 20px;
  font-size: 13px;
}
.auth-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-body);
  font-weight: 500;
}
.auth-options input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  height: 48px;
  text-decoration: none;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-heading);
  cursor: pointer;
  transition: background var(--transition);
}
.btn-google:hover { background: var(--page-bg); }
.btn-google svg { width: 20px; height: 20px; }
.google-button-host { display: flex; justify-content: center; min-height: 0; }
.google-button-host:empty { display: none; }
.btn-google[hidden], .google-button-host[hidden], .auth-form[hidden], .auth-divider[hidden] { display: none !important; }
.authenticator-secret {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.backup-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.auth-footer a { font-weight: 600; }

.auth-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
  display: none;
}
.auth-error.show { display: block; }

/* ========== Dashboard extras ========== */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.schedule-item:last-child { border-bottom: none; }
.schedule-item[role="button"] {
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition);
}
.schedule-item[role="button"]:hover { background: var(--page-bg); }
.schedule-item[role="button"]:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: -2px;
}
.schedule-item[role="button"]:hover .subj { color: var(--primary); }
.schedule-item-link { color: inherit; text-decoration: none; }
.schedule-item-link:hover .subj { color: var(--primary); }
.schedule-item-link:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: -2px;
  border-radius: 8px;
}
.schedule-item .time {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 110px;
}
.schedule-item .info { flex: 1; }
.schedule-item .info .subj {
  font-weight: 600;
  color: var(--text-heading);
  font-size: 13.5px;
}
.schedule-item .info .room {
  font-size: 12px;
  color: var(--text-muted);
}
.day-schedule-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #E8EDF4;
}
.day-schedule-item:last-child { border-bottom: 0; }
.calendar-day-section + .calendar-day-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #E8EDF4;
}
.calendar-day-section > h4 {
  margin: 0 0 4px;
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 700;
}
.calendar-day-section .view-all {
  display: inline-flex;
  margin-top: 8px;
}
.day-schedule-copy { min-width: 0; }
.day-schedule-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.day-schedule-heading h4 {
  margin: 0;
  color: var(--text-heading);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.day-schedule-meta,
.day-schedule-location {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}
.schedule-actions { flex-shrink: 0; }
.schedule-day-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.schedule-day-link:hover .item-title { color: var(--primary); }
#dayScheduleEvents {
  max-height: 55vh;
  overflow-y: auto;
}

.subject-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.subject-tile {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.subject-tile:hover {
  border-color: var(--primary);
  box-shadow: var(--card-shadow);
  color: inherit;
}
.subject-tile .tile-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.subject-tile .tile-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.subject-tile .tile-name {
  font-weight: 600;
  color: var(--text-heading);
  font-size: 13.5px;
}
.subject-tile .tile-count {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ========== Subjects page ========== */
.subject-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.subject-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(226, 232, 240, 0.6);
  padding: 20px;
  transition: box-shadow var(--transition), transform var(--transition);
}
#classesGridView .subject-card {
  display: flex;
  flex-direction: column;
}
.subject-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}
#classesGridView .subject-card.ias,
#classesGridView .subject-card.math { background: #DBEAFE; border-color: #BFDBFE; }
#classesGridView .subject-card.iaslab,
#classesGridView .subject-card.science { background: #DCFCE7; border-color: #BBF7D0; }
#classesGridView .subject-card.sysad,
#classesGridView .subject-card.english { background: #EDE9FE; border-color: #DDD6FE; }
#classesGridView .subject-card.capstone,
#classesGridView .subject-card.cs { background: #FFEDD5; border-color: #FED7AA; }
#classesGridView .subject-card.sia,
#classesGridView .subject-card.filipino { background: #CCFBF1; border-color: #99F6E4; }
#classesGridView .subject-card.xplat,
#classesGridView .subject-card.history { background: #FCE7F3; border-color: #FBCFE8; }
:root[data-theme="dark"] #classesGridView .subject-card.ias,
:root[data-theme="dark"] #classesGridView .subject-card.math { background: #10244C; border-color: #1D3B72; }
:root[data-theme="dark"] #classesGridView .subject-card.iaslab,
:root[data-theme="dark"] #classesGridView .subject-card.science { background: #052E1A; border-color: #14532D; }
:root[data-theme="dark"] #classesGridView .subject-card.sysad,
:root[data-theme="dark"] #classesGridView .subject-card.english { background: #2E1065; border-color: #4C1D95; }
:root[data-theme="dark"] #classesGridView .subject-card.capstone,
:root[data-theme="dark"] #classesGridView .subject-card.cs { background: #431407; border-color: #7C2D12; }
:root[data-theme="dark"] #classesGridView .subject-card.sia,
:root[data-theme="dark"] #classesGridView .subject-card.filipino { background: #042F2E; border-color: #115E59; }
:root[data-theme="dark"] #classesGridView .subject-card.xplat,
:root[data-theme="dark"] #classesGridView .subject-card.history { background: #500724; border-color: #9D174D; }
.subject-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.subject-card-top .subj-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.subject-card-top .subj-info { flex: 1; }
.subject-card-top .subj-info h3 {
  font-size: 16px;
  margin-bottom: 2px;
}
.subject-card-top .subj-info p {
  font-size: 12.5px;
  color: var(--text-muted);
}
.subject-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
#classesGridView .subject-card-stats { margin-top: auto; }
.subject-card-stats .ss {
  text-align: center;
}
.subject-card-stats .ss .ss-val {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-heading);
}
.subject-card-stats .ss .ss-lbl {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin-top: 2px;
}

.subject-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.subject-tab {
  padding: 10px 18px;
  border: none;
  background: none;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--transition);
}
.subject-tab:hover { color: var(--text-heading); }
.subject-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.subject-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.detail-stat-box {
  padding: 14px;
  border-radius: 10px;
  background: var(--page-bg);
  text-align: center;
}
.detail-stat-box .ds-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
}
.detail-stat-box .ds-lbl {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 6px;
}
.detail-stat-box a {
  font-size: 12px;
  font-weight: 600;
}

/* ========== Todo checklist ========== */
.todo-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 15px 8px;
  border-bottom: 1px solid #E8EDF4;
  transition: background var(--transition);
}
.todo-item:last-child { border-bottom: 0; }
.todo-item:hover { background: var(--page-bg); }
.todo-item.done { background: var(--card-bg); }
.todo-item.done:hover { background: var(--page-bg); }
.todo-item.done .todo-title {
  text-decoration: line-through;
  color: var(--text-muted);
}
.todo-item .todo-body {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.todo-item .todo-body:hover .todo-title { color: var(--primary); }
.todo-item .todo-title {
  display: block;
  font-weight: 600;
  color: var(--text-heading);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.todo-item .todo-notes {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.todo-item .todo-meta {
  display: flex;
  align-items: center;
  gap: 6px 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.todo-item .todo-due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.todo-item .action-menu-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.todo-item .custom-check input:focus-visible + .box,
.todo-item .todo-body:focus-visible,
.todo-item .action-menu-btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.task-detail-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.task-detail-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.task-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.task-detail-field {
  min-width: 0;
  padding: 12px;
  border: 1px solid #E8EDF4;
  border-radius: 10px;
  background: var(--page-bg);
}
.task-detail-value {
  display: block;
  margin-top: 5px;
  color: var(--text-heading);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.task-detail-notes-field { grid-column: 1 / -1; }
.task-detail-notes-field p { margin-bottom: 0; white-space: pre-wrap; }

@media (max-width: 640px) {
  .todo-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 14px 4px;
  }
  .todo-item > .custom-check {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    margin-top: 2px;
  }
  .todo-item .todo-body {
    grid-column: 2;
    grid-row: 1;
  }
  .todo-item > .badge {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }
  .todo-item > .action-menu-wrap {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: start;
  }
  .task-detail-grid { grid-template-columns: 1fr; }
  .task-detail-notes-field { grid-column: auto; }
}

/* ========== Drive ========== */
.file-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-icon.doc { background: #DBEAFE; color: #2563EB; }
.file-icon.sheet { background: #DCFCE7; color: #16A34A; }
.file-icon.slide { background: #FFEDD5; color: #EA580C; }
.file-icon.pdf { background: #FEE2E2; color: #DC2626; }
.file-icon.image { background: #EDE9FE; color: #7C3AED; }
.file-icon.folder { background: var(--page-bg); color: var(--text-muted); }

.storage-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.storage-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.storage-legend-row .sl-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-body);
}
.storage-legend-row .sl-val {
  font-weight: 600;
  color: var(--text-heading);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.breadcrumb a { font-weight: 500; }
.breadcrumb span.current { color: var(--text-heading); font-weight: 600; }

.resource-folder-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 4px;
}
.resource-folder-path {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.resource-folder-actions { display: flex; align-items: center; gap: 8px; }
.resource-folder-back[hidden] { display: none; }
.resource-folder-header .breadcrumb {
  flex-wrap: wrap;
  margin: 0;
  min-height: 24px;
}
.resource-folder-header .breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}
.resource-folder-header .breadcrumb a:hover { text-decoration: underline; }
.resource-folder-count {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  padding-left: 12px;
  border-left: 1px solid var(--border, #E2E8F0);
}
.resource-folder-hint {
  margin: 0 16px 12px;
  color: var(--text-muted);
  font-size: 12px;
}
.teacher-resources-page .page-layout {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}
.teacher-resources-page .page-aside { min-width: 0; }
.teacher-resources-page .page-aside .card { min-width: 0; }
.resource-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}
.resource-actions-cell { width: 92px; }
.resource-actions .btn { flex: 0 0 auto; }
.teacher-resources-page .resource-action-dropdown {
  position: fixed;
  top: 0;
  right: auto;
  bottom: auto;
  left: 0;
  z-index: 120;
}
.resource-details {
  margin: 0;
  border: 1px solid var(--border, #E2E8F0);
  border-radius: 10px;
  overflow: hidden;
}
.resource-detail-row {
  display: grid;
  grid-template-columns: minmax(100px, 130px) 1fr;
  gap: 16px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border, #E2E8F0);
  font-size: 13px;
}
.resource-detail-row:last-child { border-bottom: 0; }
.resource-detail-row dt { color: var(--text-muted); }
.resource-detail-row dd { margin: 0; color: var(--text-heading); font-weight: 500; overflow-wrap: anywhere; }
#resourcesTable tbody tr[draggable="true"] { cursor: grab; }
#resourcesTable tbody tr.is-dragging { opacity: .45; }
#resourcesTable tbody tr.drop-target {
  background: var(--primary-light, #EFF6FF);
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
}
.resource-folder-header [data-drop-folder].drop-target {
  border-radius: 4px;
  background: var(--primary-light, #EFF6FF);
  outline: 2px dashed var(--primary);
}
@media (max-width: 640px) {
  .resource-folder-header { align-items: flex-start; flex-wrap: wrap; }
  .resource-folder-path { align-items: flex-start; flex-wrap: wrap; }
  .resource-folder-actions { flex-wrap: wrap; }
  .resource-folder-count { padding-left: 0; border-left: 0; }
}
@media (max-width: 1200px) {
  .teacher-resources-page .page-layout { grid-template-columns: minmax(0, 1fr); }
  .teacher-resources-page .page-aside { position: static; }
}

/* ========== Teacher greeting banner ========== */
.greeting-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.greeting-banner .banner-art {
  width: 160px;
  flex-shrink: 0;
}
.greeting-banner .banner-art img {
  width: 100%;
  border-radius: 12px;
}

/* ========== Connected accounts ========== */
.connected-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}
.connected-row .conn-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--page-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.connected-row .conn-info { flex: 1; }
.connected-row .conn-info h4 { font-size: 14px; }
.connected-row .conn-info p { font-size: 12px; color: var(--text-muted); }

/* ========== Empty / misc ========== */
#studentsTable thead th:nth-child(-n+2) {
  text-align: center;
}

.teacher-grades-page .grade-table-card {
  min-width: 0;
}

.teacher-grades-page .grade-table-card .table-wrap {
  overflow-x: clip;
  overflow-y: visible;
}

.teacher-grades-page #gradesTable {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.teacher-grades-page #gradesTable .grade-col-student { width: 17%; }
.teacher-grades-page #gradesTable .grade-col-assignment { width: 18%; }
.teacher-grades-page #gradesTable .grade-col-class { width: 11%; }
.teacher-grades-page #gradesTable .grade-col-score { width: 17%; }
.teacher-grades-page #gradesTable .grade-col-status { width: 9%; }
.teacher-grades-page #gradesTable .grade-col-submission { width: 20%; }
.teacher-grades-page #gradesTable .grade-col-actions { width: 8%; }

.teacher-grades-page #gradesTable th,
.teacher-grades-page #gradesTable td {
  padding: 10px 6px;
  font-size: 12px;
  vertical-align: middle;
}

.teacher-grades-page #gradesTable thead th {
  white-space: normal;
  line-height: 1.2;
}

.teacher-grades-page #gradesTable td {
  overflow-wrap: anywhere;
}

.teacher-grades-page #gradesTable .score-input {
  width: 82px;
  min-width: 0;
  max-width: 100%;
  height: 36px;
  padding: 6px;
}

.teacher-grades-page #gradesTable .grade-score-main {
  display: flex;
  align-items: center;
  gap: 5px;
}

.teacher-grades-page #gradesTable .grade-score-max {
  flex: 0 0 auto;
  color: var(--text-muted);
  white-space: nowrap;
}

.teacher-grades-page #gradesTable .grade-status-cell .badge {
  padding: 3px 5px;
  font-size: 10px;
}

.teacher-grades-page #gradesTable .grade-submission-cell a {
  display: block;
  overflow-wrap: anywhere;
}

.teacher-grades-page #gradesTable .grade-submission-cell .subtitle {
  white-space: normal;
  overflow-wrap: anywhere;
}

.teacher-grades-page #gradesTable .grade-action-cell .btn {
  width: 100%;
  padding-right: 4px;
  padding-left: 4px;
  white-space: nowrap;
}

.teacher-grades-page #gradesTable .grade-mobile-class {
  display: none;
}

@media (max-width: 640px) {
  .teacher-grades-page #gradesTable col.grade-col-class,
  .teacher-grades-page #gradesTable th:nth-child(3),
  .teacher-grades-page #gradesTable td:nth-child(3) {
    display: none;
  }

  .teacher-grades-page #gradesTable .grade-col-student { width: 20%; }
  .teacher-grades-page #gradesTable .grade-col-assignment { width: 24%; }
  .teacher-grades-page #gradesTable .grade-col-score { width: 16%; }
  .teacher-grades-page #gradesTable .grade-col-status { width: 12%; }
  .teacher-grades-page #gradesTable .grade-col-submission { width: 18%; }
  .teacher-grades-page #gradesTable .grade-col-actions { width: 10%; }
  .teacher-grades-page #gradesTable th,
  .teacher-grades-page #gradesTable td {
    padding-right: 4px;
    padding-left: 4px;
  }

  .teacher-grades-page #gradesTable .grade-mobile-class {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10px;
  }

  .teacher-grades-page #gradesTable .grade-score-main {
    display: block;
  }

  .teacher-grades-page #gradesTable .grade-score-max {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 10px;
  }

  .teacher-grades-page #gradesTable .grade-status-cell .badge {
    padding: 2px 3px;
    font-size: 9px;
  }

  .teacher-grades-page #gradesTable .grade-action-cell .btn {
    padding-right: 2px;
    padding-left: 2px;
    font-size: 10px;
  }
}

#studentsTable th:first-child,
#studentsTable td:first-child {
  width: 1%;
}

.teacher-students-page .student-roster-card {
  min-width: 0;
}

.teacher-students-page .student-roster-card .table-wrap {
  overflow-x: clip;
  overflow-y: visible;
}

.teacher-students-page #studentsTable {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.teacher-students-page #studentsTable .student-col-name { width: 20%; }
.teacher-students-page #studentsTable .student-col-email { width: 20%; }
.teacher-students-page #studentsTable .student-col-program { width: 16%; }
.teacher-students-page #studentsTable .student-col-classes { width: 18%; }
.teacher-students-page #studentsTable .student-col-gpa { width: 7%; }
.teacher-students-page #studentsTable .student-col-status { width: 11%; }
.teacher-students-page #studentsTable .student-col-actions { width: 8%; }

.teacher-students-page #studentsTable th:first-child,
.teacher-students-page #studentsTable td:first-child {
  width: auto;
}

.teacher-students-page #studentsTable thead th {
  text-align: left;
  white-space: nowrap;
}

.teacher-students-page #studentsTable th,
.teacher-students-page #studentsTable td {
  padding: 12px 8px;
  vertical-align: middle;
}

.student-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.student-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.student-identity-text,
.student-email {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-identity-text .title,
.student-email,
.student-program {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-email {
  color: var(--text-body);
}

.student-program {
  font-weight: 600;
}

.student-class-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.student-class-chip,
.student-class-more {
  display: inline-block;
  max-width: 100%;
  padding: 4px 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--page-bg);
  color: var(--text-body);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-class-more {
  flex: 0 0 auto;
  background: var(--primary-light, #eef2ff);
  color: var(--primary);
  font-weight: 700;
}

.student-gpa-cell strong {
  white-space: nowrap;
}

.student-empty-cell {
  padding: 24px !important;
  text-align: center;
}

@media (max-width: 640px) {
  .teacher-students-page #studentsTable col.student-col-email,
  .teacher-students-page #studentsTable col.student-col-gpa,
  .teacher-students-page #studentsTable th:nth-child(2),
  .teacher-students-page #studentsTable td:nth-child(2),
  .teacher-students-page #studentsTable th:nth-child(5),
  .teacher-students-page #studentsTable td:nth-child(5) {
    display: none;
  }

  .teacher-students-page #studentsTable .student-col-name { width: 26%; }
  .teacher-students-page #studentsTable .student-col-program { width: 21%; }
  .teacher-students-page #studentsTable .student-col-classes { width: 25%; }
  .teacher-students-page #studentsTable .student-col-status { width: 17%; }
  .teacher-students-page #studentsTable .student-col-actions { width: 11%; }
  .teacher-students-page #studentsTable th,
  .teacher-students-page #studentsTable td {
    padding-right: 5px;
    padding-left: 5px;
  }

  .teacher-students-page #studentsTable thead th {
    white-space: normal;
    line-height: 1.2;
  }

  .teacher-students-page #studentsTable .badge {
    padding: 2px 4px;
    font-size: 10px;
  }

  .teacher-students-page #studentsTable td:last-child {
    padding-right: 2px;
    padding-left: 2px;
  }

  .teacher-students-page #studentsTable .action-menu-btn {
    padding: 4px;
  }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state img {
  width: 180px;
  margin: 0 auto 16px;
  opacity: 0.85;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar .search-mini {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}
.toolbar .search-mini input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px 0 36px;
  outline: none;
  background: var(--card-bg);
}
.toolbar .search-mini input:focus { border-color: var(--primary); }
.toolbar .search-mini svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px; height: 16px;
}
.toolbar select {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  background: var(--card-bg);
  color: var(--text-body);
  outline: none;
  cursor: pointer;
}

.subject-filter {
  position: relative;
  flex: 0 0 auto;
  z-index: 20;
}
.subject-filter-button {
  height: 38px;
  min-width: 122px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text-body);
  cursor: pointer;
}
.subject-filter-button:focus-visible,
.subject-filter-options button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.subject-filter-button svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex: 0 0 auto;
}
.subject-filter-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  min-width: 100%;
  width: max-content;
  max-width: min(360px, calc(100vw - 32px));
  max-height: min(320px, calc(100vh - 120px));
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  box-shadow: var(--card-shadow-hover);
}
.subject-filter-options[hidden] {
  display: none;
}
.subject-filter-options button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-body);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.subject-filter-options button:hover,
.subject-filter-options button[aria-selected="true"] {
  background: var(--page-bg);
  color: var(--primary);
}

.segmented {
  display: inline-flex;
  background: var(--page-bg);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  padding: 7px 14px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.segmented button.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: var(--card-shadow);
}

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { padding: 24px; }
  .auth-signup-link { position: static; text-align: right; margin-bottom: 16px; }
  .dash-grid-2 { grid-template-columns: 1fr; }
  .subject-cards { grid-template-columns: 1fr; }
  .subject-tiles { grid-template-columns: 1fr; }
  .greeting-banner .banner-art { display: none; }
}

.form-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
}

.message-page-layout {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

.message-page-main { display: contents; }

.message-panel {
  display: flex;
  min-width: 0;
  min-height: 420px;
  height: calc(100vh - var(--header-height) - 120px);
  flex-direction: column;
}

.message-reply-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.message-reply-field { flex: 1; margin-bottom: 0; }

@media (max-width: 900px) {
  .message-page-layout {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .auth-right { padding: 18px 14px; }
  .form-grid-two { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .message-page-layout { grid-template-columns: minmax(0, 1fr); }
  .message-panel { min-height: 0; height: auto; }
  .message-list-panel { min-height: 220px; height: min(38vh, 320px); }
  .message-thread-panel { min-height: 380px; height: min(64vh, 560px); }
  .message-thread-panel .card-header { align-items: flex-start; flex-wrap: wrap; }
  .message-thread-panel .card-header-left { flex: 1 1 200px; min-width: 0; }
  .message-thread-panel #threadMeta { overflow-wrap: anywhere; }
  .message-thread-panel .thread-msg { max-width: 90% !important; }
  .message-reply-form { align-items: stretch; flex-wrap: wrap; }
  .message-reply-field { flex: 1 1 100%; }
  .message-thread-panel #threadReply form > .btn { margin-left: auto; }
}
