body.teacher-profile-page,
body.dashboard-category-page,
body.teacher-profile-page .app-shell,
body.teacher-profile-page #teacherProfileScreen {
  background: #ffffff !important;
}

body.teacher-profile-page,
body.dashboard-category-page {
  color: #173150;
  -webkit-font-smoothing: antialiased;
}

.teacher-profile-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.teacher-profile-panel__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid #e2eaf5;
  color: #173150;
  flex-shrink: 0;
}

.teacher-profile-panel__title {
  min-width: 0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.teacher-profile-panel__body {
  display: grid;
  gap: 12px;
  padding: 4px;
  min-width: 0;
  flex: 1;
}

.teacher-profile-subsection {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e1e8f3;
  border-radius: 16px;
  background: #ffffff;
  min-width: 0;
  box-shadow: 0 4px 12px rgba(23, 49, 80, 0.03);
}

.teacher-profile-subsection__header {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.teacher-profile-subsection__title {
  color: #173150;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
}

.teacher-profile-subsection__subtitle {
  color: #5f718f;
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.teacher-profile-subsection__body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.teacher-profile-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.teacher-profile-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #dfe8f4;
  border-radius: 14px;
  background: #fafcff;
  min-width: 0;
  transition: all 0.2s ease;
  position: relative;
}

.teacher-profile-card--button {
  width: 100%;
  text-align: left;
  cursor: pointer;
  border: 1px solid #dfe8f4;
}

.teacher-profile-card--button:hover {
  background: #f1f7ff;
  border-color: #c9dbf5;
  transform: translateY(-1px);
}

.teacher-profile-card--button.is-active {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
}

.teacher-profile-card__title {
  color: #173150;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.teacher-profile-card__meta,
.teacher-profile-card__detail {
  color: #5f718f;
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.teacher-profile-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0;
}

.teacher-profile-metric {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #eef2f8;
  border-radius: 10px;
  background: #ffffff;
  min-width: 80px;
  flex: 1;
}

.teacher-profile-metric__label {
  color: #8c9bb4;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.teacher-profile-metric__value {
  color: #173150;
  font-size: 12px;
  font-weight: 900;
}

.teacher-profile-detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  padding: 10px;
  background: #f8fbff;
  border-radius: 10px;
  margin-top: 6px;
}

.teacher-profile-detail-grid__label {
  color: #5f718f;
  font-size: 11px;
  font-weight: 700;
}

.teacher-profile-detail-grid__value {
  color: #173150;
  font-size: 11px;
  line-height: 1.4;
}

.teacher-profile-form {
  display: grid;
  gap: 12px;
}

.teacher-profile-management {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 12px;
  background: #f8fbff;
  border-radius: 12px;
  border: 1px dashed #dbe6f4;
}

.teacher-profile-management__field {
  display: grid;
  gap: 6px;
}

.teacher-profile-management__field span {
  color: #5f718f;
  font-size: 11px;
  font-weight: 800;
}

.teacher-profile-management input,
.teacher-profile-management select {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #d8e3f1;
  border-radius: 10px;
  background: #ffffff;
  font-size: 13px;
  color: #173150;
  outline: none;
}

.teacher-profile-management__actions {
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
  justify-content: flex-end;
  margin-top: 4px;
}

.teacher-profile-empty {
  padding: 24px;
  text-align: center;
  color: #5f718f;
  font-size: 13px;
  background: #f9fbff;
  border: 2px dashed #e2eaf5;
  border-radius: 16px;
}

.teacher-profile-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.teacher-profile-badge {
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  background: #eef2f8;
  color: #5f718f;
}

.teacher-profile-badge--active { background: #dcfce7; color: #166534; }
.teacher-profile-badge--expired { background: #fee2e2; color: #991b1b; }
.teacher-profile-badge--scheduled { background: #fef3c7; color: #92400e; }

.teacher-profile-panel--integrated {
  border: 0;
  background: transparent;
  padding: 0;
}

.teacher-profile-panel--integrated .teacher-profile-panel__bar {
  background: transparent;
  border: 0;
  padding: 0 0 10px;
  justify-content: flex-start;
}

.teacher-profile-panel--integrated .teacher-profile-panel__body {
  padding: 0;
}

.homework-workspace-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  align-items: start;
}

.homework-detail-area {
  display: grid;
  gap: 12px;
  min-width: 0;
}

@media (max-width: 1100px) {
  .homework-workspace-grid {
    grid-template-columns: 300px 1fr;
  }
}

@media (max-width: 900px) {
  .homework-workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* Modal Inner Body Improvements */
.dashboard-category-page .community-modal__panel {
  max-width: min(1100px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  border-radius: 20px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.2);
}

@media (max-width: 600px) {
  .dashboard-category-page .community-modal__panel {
    max-width: 100vw;
    max-height: 100dvh;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
}

body.teacher-profile-page #teacherProfileScreen {
  display: flex;
  flex-direction: column;
}

body.teacher-profile-page .dashboard-topbar {
  margin: 8px 5px 0;
  height: 1cm;
  min-height: 1cm;
  padding: 0 6px;
  gap: 5px;
  justify-content: flex-start;
  flex-wrap: nowrap;
  align-items: center;
  border: none;
  border-radius: 18px;
  background: linear-gradient(90deg, #6dbcff 0%, #8f80ff 54%, #ffbf67 100%);
  box-shadow: none;
  overflow: hidden;
}

body.teacher-profile-page .user-chip {
  flex: 0 1 auto;
  min-width: 0;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  background: transparent;
  padding: 0;
}

body.teacher-profile-page .teacher-profile-user-chip {
  flex: 0 1 auto;
  min-width: 0;
}

body.teacher-profile-page .user-chip__meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex-wrap: nowrap;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

body.teacher-profile-page #teacherProfilePageUserRole {
  padding: 0;
  border: 0;
  background: transparent;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

body.teacher-profile-page .teacher-profile-user-name {
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.teacher-profile-page .teacher-profile-tabs {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-width: 0;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: hidden;
  scrollbar-width: none;
}

body.teacher-profile-page .teacher-profile-tabs .teacher-topbar-button {
  flex: 1 1 0;
  max-width: 118px;
}

body.teacher-profile-page .toolbar-actions .teacher-topbar-button {
  flex: 0 1 auto;
}

body.teacher-profile-page .teacher-profile-tabs::-webkit-scrollbar {
  display: none;
}

body.teacher-profile-page .toolbar-actions {
  flex: 0 0 auto;
  width: auto;
  height: 100%;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 4px;
}

body.teacher-profile-page .toolbar-actions > * {
  margin: 0;
}

body.teacher-profile-page .teacher-topbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 4px;
  min-width: 0;
  height: calc(1cm - 12px);
  min-height: calc(1cm - 12px);
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

body.teacher-profile-page .teacher-topbar-button:hover {
  background: rgba(255, 255, 255, 0.24);
}

body.teacher-profile-page .teacher-topbar-button.is-active {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.94);
  color: #173150;
}

body.teacher-profile-page .teacher-topbar-button__icon,
body.teacher-profile-page .teacher-topbar-button__icon svg {
  width: 16px;
  height: 16px;
  display: inline-flex;
  flex: 0 0 16px;
}

body.teacher-profile-page .teacher-topbar-button__icon svg {
  fill: currentColor;
}

body.teacher-profile-page .teacher-topbar-button__label {
  line-height: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.teacher-profile-page .teacher-profile-status {
  margin: 0 5px;
}

body.teacher-profile-page .teacher-profile-status.hidden {
  margin: 0 !important;
  padding: 0 !important;
}

body.teacher-profile-page .teacher-profile-root {
  display: grid;
  gap: 8px;
  margin: 0 5px 18px;
  min-width: 0;
}

body.teacher-profile-page #teacherProfileContent {
  display: grid;
  min-width: 0;
}

body.teacher-profile-page .teacher-profile-slot {
  min-width: 0;
}

body.teacher-profile-page .teacher-profile-code-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

body.teacher-profile-page .teacher-profile-code-row .teacher-profile-metric__value {
  flex: 0 1 auto;
  min-width: 0;
}

body.teacher-profile-page .teacher-profile-code-copy-button {
  flex: 0 0 auto;
}

body.teacher-profile-page .teacher-profile-code-feedback {
  color: #8f1f1f;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

body.teacher-profile-page .teacher-profile-code-feedback.is-success {
  color: #24663b;
}

body.teacher-profile-page .teacher-profile-card__actions,
body.teacher-profile-page .teacher-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

body.teacher-profile-page .teacher-profile-inline-select {
  min-width: 132px;
  max-width: 100%;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid #d7e4f4;
  border-radius: 999px;
  background: #ffffff;
  color: #173150;
  font-size: 12px;
}

body.teacher-profile-page .teacher-profile-summary-list {
  display: grid;
  gap: 6px;
}

body.teacher-profile-page .teacher-profile-summary-item {
  display: grid;
  gap: 4px;
  padding: 8px 9px;
  border: 1px solid #e0e8f4;
  border-radius: 10px;
  background: #fafcff;
}

body.teacher-profile-page .teacher-profile-summary-item__title {
  color: #173150;
  font-size: 12px;
  font-weight: 800;
}

body.teacher-profile-page .teacher-profile-summary-item__text {
  color: #5f718f;
  font-size: 11px;
  line-height: 1.35;
}

body.teacher-profile-page .teacher-profile-class-browser {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

body.teacher-profile-page .teacher-profile-class-browser > * {
  min-width: 0;
}

body.teacher-profile-page .teacher-profile-class-browser__content {
  display: grid;
  gap: 8px;
  min-width: 0;
}

body.teacher-profile-page .teacher-profile-class-actions {
  justify-content: flex-end;
}

body.teacher-profile-page .teacher-class-dialog {
  width: min(420px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid #d7e4f4;
  border-radius: 14px;
  background: #ffffff;
  color: #173150;
  box-shadow: 0 24px 72px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

body.teacher-profile-page .teacher-class-dialog--students {
  width: min(560px, calc(100vw - 24px));
}

body.teacher-profile-page .teacher-class-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

body.teacher-profile-page .teacher-class-dialog__panel {
  display: grid;
  gap: 0;
}

body.teacher-profile-page .teacher-class-dialog__header,
body.teacher-profile-page .teacher-class-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e2eaf5;
  background: #f7fbff;
}

body.teacher-profile-page .teacher-class-dialog__footer {
  justify-content: flex-end;
  border-top: 1px solid #e2eaf5;
  border-bottom: 0;
}

body.teacher-profile-page .teacher-class-dialog__title {
  color: #173150;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

body.teacher-profile-page .teacher-class-dialog__body {
  display: grid;
  gap: 8px;
  padding: 14px;
}

body.teacher-profile-page .teacher-profile-student-editor {
  gap: 10px;
}

body.teacher-profile-page .teacher-profile-student-editor__actions {
  justify-content: flex-end;
}

body.teacher-profile-page .teacher-homework-dialog {
  width: min(920px, calc(100vw - 24px));
  max-height: min(820px, calc(100dvh - 24px));
  padding: 0;
  border: 1px solid #d7e4f4;
  border-radius: 14px;
  background: #ffffff;
  color: #173150;
  box-shadow: 0 24px 72px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

body.teacher-profile-page .teacher-homework-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

body.teacher-profile-page .teacher-homework-dialog__panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(820px, calc(100dvh - 24px));
}

body.teacher-profile-page .teacher-homework-dialog__header,
body.teacher-profile-page .teacher-homework-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e2eaf5;
  background: #f7fbff;
}

body.teacher-profile-page .teacher-homework-dialog__footer {
  justify-content: flex-end;
  border-top: 1px solid #e2eaf5;
  border-bottom: 0;
}

body.teacher-profile-page .teacher-homework-dialog__title,
body.teacher-profile-page .teacher-homework-dialog__section-title {
  color: #173150;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

body.teacher-profile-page .teacher-homework-dialog__body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 10px;
  padding: 12px 14px;
  overflow: auto;
}

body.teacher-profile-page .teacher-homework-dialog__section {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  padding: 9px;
  border: 1px solid #e0e9f5;
  border-radius: 12px;
  background: #fbfdff;
}

body.teacher-profile-page .teacher-homework-dialog__section:first-child {
  grid-row: span 2;
}

body.teacher-profile-page .teacher-homework-dialog__section--content {
  padding: 0;
  overflow: hidden;
}

@media (max-width: 860px) {
  body.teacher-profile-page .dashboard-topbar {
    grid-template-areas:
      "identity actions"
      "tabs tabs";
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body.teacher-profile-page .toolbar-actions {
    grid-area: actions;
    width: min(230px, 100%);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.teacher-profile-page .teacher-profile-tabs {
    grid-area: tabs;
  }

  body.teacher-profile-page .teacher-homework-dialog__body {
    grid-template-columns: 1fr;
  }
}
