.teacher-hero-card {
  overflow: hidden;
  display: grid;
  gap: var(--space-4);
  padding: var(--mobile-card-pad);
  border: 1px solid color-mix(in srgb, var(--cdx-primary) 14%, var(--cdx-border));
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(47, 128, 237, 0.11), rgba(32, 169, 139, 0.09)),
    var(--cdx-surface);
  box-shadow: var(--shadow-card);
}

.teacher-mini-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
}

.teacher-photo,
.teacher-top-action {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
}

.teacher-photo {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-xl);
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.teacher-top-action {
  width: var(--header-action-size);
  height: var(--header-action-size);
  border: 1px solid var(--cdx-border);
  border-radius: 14px;
  background: var(--cdx-surface);
  color: var(--cdx-primary-700);
  box-shadow: var(--shadow-xs);
}

.teacher-meta-title {
  margin: 0;
  color: var(--cdx-ink);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.18;
  font-weight: 900;
}

.teacher-meta-subtitle {
  margin: 0.2rem 0 0;
  color: var(--cdx-muted);
  font-size: var(--text-sm);
}

.teacher-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.teacher-stat {
  padding: var(--space-3);
  border: 1px solid color-mix(in srgb, var(--cdx-border) 80%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--cdx-surface) 82%, transparent);
}

.teacher-stat strong {
  display: block;
  color: var(--cdx-ink);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1;
}

.teacher-stat span {
  display: block;
  margin-top: var(--space-1);
  color: var(--cdx-muted);
  font-size: var(--text-xs);
  font-weight: 750;
}

.teacher-page-title {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.teacher-page-title h2 {
  margin: 0;
  color: var(--cdx-ink);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: 1.1;
}

.teacher-page-title p {
  margin: 0;
  color: var(--cdx-muted);
  font-size: var(--text-sm);
}

.teacher-chip-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-1);
  scrollbar-width: none;
}

.teacher-chip-row::-webkit-scrollbar {
  display: none;
}

.teacher-chip {
  min-height: 36px;
  border: 1px solid var(--cdx-border);
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 var(--space-3);
  background: var(--cdx-surface);
  color: var(--cdx-muted);
  font-size: var(--text-sm);
  font-weight: 850;
}

.teacher-chip.is-active,
.teacher-chip[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--cdx-primary) 24%, var(--cdx-border));
  background: var(--cdx-primary-soft);
  color: var(--cdx-primary-700);
}

.teacher-list {
  display: grid;
  gap: var(--space-3);
}

.teacher-class-card,
.teacher-student-card,
.teacher-notification-card {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
}

.teacher-row-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
}

.teacher-row-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  background: var(--cdx-primary-soft);
  color: var(--cdx-primary-700);
  font-weight: 900;
}

.teacher-class-card h3,
.teacher-student-card h3,
.teacher-row-card h3,
.teacher-notification-card h3 {
  margin: 0;
  color: var(--cdx-ink);
  font-family: var(--font-display);
  font-size: var(--text-md);
  line-height: 1.2;
}

.teacher-class-card p,
.teacher-student-card p,
.teacher-row-card p,
.teacher-notification-card p {
  margin: var(--space-1) 0 0;
  color: var(--cdx-muted);
  font-size: var(--text-sm);
}

.teacher-card-meta,
.teacher-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.teacher-action-row .btn {
  min-height: 38px;
  padding-inline: var(--space-3);
  font-size: var(--text-sm);
}

.teacher-progress-shell {
  overflow: hidden;
  height: 0.56rem;
  border-radius: var(--radius-pill);
  background: var(--cdx-surface-3);
}

.teacher-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-gradient);
}

.attendance-toggle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.attendance-toggle {
  min-height: 38px;
  border: 1px solid var(--cdx-border);
  border-radius: var(--radius-pill);
  background: var(--cdx-surface);
  color: var(--cdx-muted);
  font-size: var(--text-xs);
  font-weight: 900;
}

.attendance-toggle.is-active {
  border-color: color-mix(in srgb, var(--cdx-primary) 28%, var(--cdx-border));
  background: var(--cdx-primary-soft);
  color: var(--cdx-primary-700);
}

.attendance-toggle[data-status="absent"].is-active {
  background: var(--cdx-error-soft);
  color: var(--cdx-error);
}

.attendance-toggle[data-status="late"].is-active {
  background: var(--cdx-warning-soft);
  color: var(--cdx-warning);
}

.attendance-toggle[data-status="leave"].is-active {
  background: var(--cdx-info-soft);
  color: var(--cdx-info);
}

.teacher-attendance-card {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
}

.student-mini-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
}

.student-roll {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  background: var(--cdx-secondary-soft);
  color: var(--cdx-secondary-600);
  font-weight: 900;
}

.teacher-search-card {
  padding: var(--space-3);
}

.teacher-notification-card {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.teacher-notification-card.is-read .notification-dot {
  background: var(--cdx-subtle);
  box-shadow: 0 0 0 5px var(--cdx-surface-3);
}

.profile-avatar-teacher {
  width: 68px;
  height: 68px;
  border-radius: 1.25rem;
  display: grid;
  place-items: center;
  background: var(--brand-gradient);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 900;
  box-shadow: var(--shadow-card);
}

.profile-header {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem;
}

.profile-header > div {
  min-width: 0;
}

.profile-header .teacher-meta-title {
  font-size: 1.08rem;
  line-height: 1.12;
}

.profile-header .teacher-meta-subtitle {
  margin-top: 0.2rem;
  font-size: 0.76rem;
  line-height: 1.35;
}

.profile-header .status-badge {
  grid-column: 2;
  width: max-content;
  max-width: 100%;
  margin-top: -0.18rem;
}

.teacher-info-grid {
  display: grid;
  gap: 0.65rem;
}

.teacher-info-item {
  display: grid;
  gap: 0.18rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--cdx-border);
  border-radius: var(--radius-lg);
  background: var(--cdx-surface-2);
}

.teacher-info-item span {
  color: var(--cdx-muted);
  font-size: var(--text-xs);
  font-weight: 850;
}

.teacher-info-item strong {
  color: var(--cdx-ink);
  font-size: 0.9rem;
  line-height: 1.3;
}

.teacher-list .period-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.82rem;
}

.teacher-list .period-card.is-next {
  border-color: color-mix(in srgb, var(--cdx-warning) 34%, var(--cdx-border));
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(47, 128, 237, 0.08)),
    var(--cdx-surface);
}

.period-time {
  width: 72px;
  min-height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--brand-gradient-purple);
  color: #ffffff;
  font-size: 0.75rem;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.16);
}

.period-copy {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.period-copy h3 {
  margin: 0;
  color: var(--cdx-ink);
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.16;
}

.period-copy p {
  margin: 0;
  color: var(--cdx-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.period-copy .status-badge {
  width: max-content;
  margin-top: 0.12rem;
}

.notice-card.teacher-notice {
  padding-right: var(--space-5);
}

.teacher-tool-strip {
  grid-auto-columns: minmax(min(12.5rem, 80vw), 66%);
}

.teacher-metric-grid,
.teacher-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.teacher-metric-card,
.teacher-form-card,
.marks-entry-card,
.doubt-reply-card,
.class-report-card,
.homework-preview-card,
.performance-card,
.exam-duty-card,
.parent-message-card {
  display: grid;
  gap: var(--space-3);
  padding: var(--mobile-card-pad);
}

.teacher-metric-card h3,
.teacher-form-card h3,
.marks-entry-card h3,
.doubt-reply-card h3,
.class-report-card h3,
.homework-preview-card h3,
.performance-card h3,
.exam-duty-card h3,
.parent-message-card h3 {
  margin: 0;
  color: var(--cdx-ink);
  font-family: var(--font-display);
  font-size: var(--text-md);
  line-height: 1.2;
  font-weight: 850;
}

.teacher-metric-card p,
.teacher-form-card p,
.marks-entry-card p,
.doubt-reply-card p,
.class-report-card p,
.homework-preview-card p,
.performance-card p,
.exam-duty-card p,
.parent-message-card p {
  margin: 0;
  color: var(--cdx-muted);
  font-size: var(--text-sm);
}

.teacher-metric-card strong {
  color: var(--cdx-ink);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  line-height: 1;
}

.teacher-metric-card span,
.teacher-form-label,
.teacher-card-label {
  color: var(--cdx-muted);
  font-size: var(--text-xs);
  font-weight: 850;
}

.teacher-form-stack {
  display: grid;
  gap: var(--space-3);
}

.teacher-form-field {
  display: grid;
  gap: var(--space-2);
}

.teacher-textarea {
  min-height: 94px;
  padding-block: var(--space-3);
  resize: vertical;
}

.teacher-select-row,
.teacher-card-top,
.teacher-inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.marks-entry-card {
  grid-template-columns: minmax(0, 1fr);
}

.marks-student-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
}

.marks-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
}

.marks-input {
  max-width: 8rem;
  text-align: center;
  font-weight: 900;
}

.teacher-toggle-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 42px;
  padding: 0 var(--space-3);
  border: 1px solid var(--cdx-border);
  border-radius: var(--radius-pill);
  background: var(--cdx-surface-2);
}

.teacher-toggle-line input {
  width: 20px;
  height: 20px;
  accent-color: var(--cdx-primary);
}

.doubt-attachment-row,
.message-template-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-1);
  scrollbar-width: none;
}

.doubt-attachment-row::-webkit-scrollbar,
.message-template-row::-webkit-scrollbar {
  display: none;
}

.attachment-pill,
.template-pill {
  min-height: 32px;
  border: 1px solid var(--cdx-border);
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0 var(--space-3);
  background: var(--cdx-surface-2);
  color: var(--cdx-muted);
  font-size: var(--text-xs);
  font-weight: 850;
}

.teacher-chart-placeholder,
.teacher-map-placeholder {
  min-height: 9rem;
  border: 1px dashed color-mix(in srgb, var(--cdx-primary) 28%, var(--cdx-border));
  border-radius: var(--radius-xl);
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background:
    linear-gradient(135deg, rgba(47, 128, 237, 0.08), rgba(32, 169, 139, 0.08)),
    var(--cdx-surface-2);
  color: var(--cdx-muted);
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 850;
}

.teacher-timeline {
  display: grid;
  gap: var(--space-3);
}

.teacher-timeline-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}

.teacher-timeline-dot,
.notification-dot {
  width: 12px;
  height: 12px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--cdx-primary);
  box-shadow: 0 0 0 5px var(--cdx-primary-soft);
}

.risk-badge {
  border-color: color-mix(in srgb, var(--cdx-error) 24%, var(--cdx-border));
  background: var(--cdx-error-soft);
  color: var(--cdx-error);
}

.floating-quick-action {
  position: sticky;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + var(--space-3));
  z-index: 18;
  margin-top: var(--space-4);
}

.floating-quick-action .btn {
  width: 100%;
}

@media (max-width: 374px) {
  .teacher-row-card,
  .teacher-class-card,
  .teacher-student-card,
  .teacher-attendance-card,
  .teacher-notification-card {
    padding: var(--space-3);
  }

  .teacher-metric-grid,
  .teacher-form-grid {
    grid-template-columns: 1fr;
  }

  .teacher-stat-row {
    grid-template-columns: 1fr;
  }

  .attendance-toggle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .marks-student-row,
  .marks-input-row {
    grid-template-columns: 1fr;
  }

  .marks-input {
    max-width: none;
  }
}

.teacher-hero-card {
  position: relative;
  padding: clamp(1rem, 4vw, 1.15rem);
  border-color: color-mix(in srgb, var(--cdx-primary) 18%, var(--cdx-border));
  background:
    radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.18), transparent 7.5rem),
    radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.18), transparent 7rem),
    linear-gradient(135deg, rgba(37, 99, 235, 0.13), rgba(124, 58, 237, 0.1)),
    var(--cdx-surface);
  box-shadow: var(--shadow-card-hover);
}

.teacher-hero-card::after {
  position: absolute;
  right: -34px;
  bottom: -42px;
  width: 122px;
  height: 122px;
  border-radius: 50%;
  background: rgba(47, 128, 237, 0.1);
  content: "";
  pointer-events: none;
}

.teacher-mini-profile {
  position: relative;
  z-index: 1;
  gap: 0.85rem;
}

.teacher-mini-profile > div {
  min-width: 0;
}

.teacher-photo {
  width: 62px;
  height: 62px;
}

.teacher-meta-title {
  font-size: 1.18rem;
}

.teacher-meta-subtitle {
  font-weight: 700;
}

.teacher-stat-row {
  position: relative;
  z-index: 1;
  gap: 0.55rem;
}

.teacher-stat {
  min-width: 0;
  padding: 0.72rem;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cdx-surface) 82%, transparent), color-mix(in srgb, var(--cdx-purple) 7%, var(--cdx-surface)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.teacher-stat strong {
  font-size: clamp(1.02rem, 4.4vw, 1.24rem);
}

.teacher-stat span {
  line-height: 1.25;
}

.teacher-tool-strip {
  grid-auto-columns: minmax(min(13rem, 82vw), 68%);
}

.teacher-meta-title,
.teacher-stat:nth-child(1) strong {
  color: var(--cdx-primary-700);
}

html[data-theme="dark"] .teacher-hero-card,
body[data-theme="dark"] .teacher-hero-card {
  border-color: color-mix(in srgb, var(--cdx-primary) 16%, var(--cdx-border));
  background:
    radial-gradient(circle at 100% 0%, rgba(81, 165, 246, 0.16), transparent 7.5rem),
    linear-gradient(135deg, rgba(47, 128, 237, 0.16), rgba(32, 169, 139, 0.1)),
    var(--cdx-surface);
}

html[data-theme="dark"] .teacher-stat,
body[data-theme="dark"] .teacher-stat {
  background: color-mix(in srgb, var(--cdx-surface-2) 72%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .teacher-info-item,
body[data-theme="dark"] .teacher-info-item,
html[data-theme="dark"] .teacher-list .period-card,
body[data-theme="dark"] .teacher-list .period-card {
  border-color: color-mix(in srgb, var(--cdx-border) 76%, transparent);
  background: color-mix(in srgb, var(--cdx-surface-2) 78%, transparent);
}

html[data-theme="dark"] .teacher-list .period-card.is-next,
body[data-theme="dark"] .teacher-list .period-card.is-next {
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(81, 165, 246, 0.12)),
    var(--cdx-surface);
}

@media (min-width: 350px) and (max-width: 374px) {
  .teacher-stat-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.teacher-chip.is-active,
.teacher-chip[aria-pressed="true"] {
  border-color: transparent;
  background: var(--brand-gradient-purple);
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.18);
}

body[data-page="profile"] .profile-header {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--cdx-purple) 24%, var(--cdx-border));
  background:
    radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.24), transparent 7.5rem),
    radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.2), transparent 7rem),
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.13)),
    var(--cdx-surface);
  box-shadow: var(--shadow-card-hover);
}

body[data-page="profile"] .profile-header::after {
  position: absolute;
  right: -34px;
  bottom: -44px;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.12);
  content: "";
  pointer-events: none;
}

body[data-page="profile"] .profile-avatar-teacher,
body[data-page="profile"] .profile-header > div,
body[data-page="profile"] .profile-header .status-badge {
  position: relative;
  z-index: 1;
}

body[data-page="profile"] .profile-avatar-teacher {
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.72) !important;
}

body[data-page="profile"] .profile-header .status-badge {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.13), rgba(124, 58, 237, 0.12));
  color: var(--cdx-primary-700);
}

body[data-page="profile"] .teacher-info-item,
body[data-page="profile"] .teacher-class-card,
body[data-page="profile"] .teacher-row-card {
  border-color: color-mix(in srgb, var(--cdx-purple) 14%, var(--cdx-border));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cdx-surface) 90%, transparent), color-mix(in srgb, var(--cdx-purple) 4%, var(--cdx-surface))),
    var(--cdx-surface);
  box-shadow: var(--shadow-xs);
}

html[data-theme="dark"] body[data-page="profile"] .profile-header,
body[data-theme="dark"][data-page="profile"] .profile-header,
html[data-theme="dark"] body[data-page="profile"] .teacher-info-item,
html[data-theme="dark"] body[data-page="profile"] .teacher-class-card,
html[data-theme="dark"] body[data-page="profile"] .teacher-row-card,
body[data-theme="dark"][data-page="profile"] .teacher-info-item,
body[data-theme="dark"][data-page="profile"] .teacher-class-card,
body[data-theme="dark"][data-page="profile"] .teacher-row-card {
  border-color: color-mix(in srgb, var(--cdx-border) 76%, transparent);
  background:
    radial-gradient(circle at 100% 0%, rgba(167, 139, 250, 0.13), transparent 7rem),
    color-mix(in srgb, var(--cdx-surface) 88%, transparent);
}
