.teacher-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #e9dcc0, #f8f1e3 46%, #ebdfca);
}

.teacher-topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px clamp(18px, 4vw, 52px);
  color: #fff;
  background: var(--ink-deep);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 8px 30px rgba(5, 31, 61, .2);
}

.teacher-topbar .brand { color: inherit; text-decoration: none; }
.teacher-session { display: flex; align-items: center; gap: 16px; color: #d8e3eb; font-size: 14px; }
.teacher-text-button { border: 0; padding: 5px 0; color: var(--ink); background: transparent; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.teacher-topbar .teacher-text-button { color: var(--gold-light); }

.teacher-main { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 38px 0 64px; }
.teacher-auth-card { width: min(620px, 100%); margin: 9vh auto 0; padding: clamp(28px, 5vw, 52px); border: 1px solid var(--line); border-top: 5px solid var(--gold); border-radius: var(--radius-lg); background: var(--paper-light); box-shadow: var(--shadow-md); text-align: center; }
.teacher-auth-card h1 { margin: 8px 0 12px; color: var(--ink); font: 700 clamp(28px, 4vw, 42px)/1.1 Georgia, serif; }
.teacher-auth-card > p:not(.section-kicker):not(.teacher-form-status) { max-width: 510px; margin: 0 auto 24px; color: var(--muted); }
.teacher-auth-icon { width: 66px; height: 66px; display: grid; place-items: center; margin: 0 auto 18px; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font: 700 30px Georgia, serif; background: #fffaf0; }
.teacher-auth-icon.warning { color: var(--red); border-color: var(--red); }
.teacher-login-form { margin-top: 26px; text-align: left; }
.teacher-login-form label { display: block; margin-bottom: 8px; color: var(--ink); font-size: 14px; font-weight: 700; }
.teacher-login-form > div { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.teacher-login-form > .teacher-turnstile { display: block; margin-top: 14px; }
.teacher-login-form > .teacher-turnstile[hidden] { display: none; }
.teacher-login-form input, .teacher-toolbar input, .teacher-toolbar select, .teacher-dialog input { min-height: 46px; width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; color: var(--text); background: #fff; }
.teacher-form-status { min-height: 24px; color: var(--green); font-weight: 700; }
.teacher-form-status[data-kind="error"], .teacher-form-status[data-kind="captcha-error"] { color: var(--red); }
.teacher-back-link { display: inline-block; margin-top: 10px; color: var(--ink); }

.teacher-page-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.teacher-page-heading h1 { margin: 5px 0 6px; color: var(--ink); font: 700 clamp(32px, 5vw, 54px)/1.05 Georgia, serif; }
.teacher-page-heading p:last-child { margin: 0; color: var(--muted); }
.teacher-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.teacher-metric { min-height: 128px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 251, 242, .96); box-shadow: var(--shadow-sm); }
.teacher-metric span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.teacher-metric strong { display: block; margin: 6px 0 4px; color: var(--ink); font: 700 32px Georgia, serif; }
.teacher-metric p { margin: 0; color: var(--muted); font-size: 13px; }

.teacher-results-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper-light); box-shadow: var(--shadow-md); }
.teacher-toolbar { display: flex; align-items: end; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: #f2e6cf; }
.teacher-toolbar label { min-width: 210px; color: var(--ink); font-size: 12px; font-weight: 700; }
.teacher-toolbar label input, .teacher-toolbar label select { display: block; margin-top: 5px; }
.teacher-toolbar .teacher-search { flex: 1; }
.teacher-toolbar-actions { display: flex; gap: 8px; }
.teacher-table-wrap { overflow-x: auto; }
.teacher-table { width: 100%; border-collapse: collapse; min-width: 880px; }
.teacher-table th { padding: 13px 15px; color: var(--ink); background: #edf1f3; border-bottom: 1px solid #cdd9df; font-size: 12px; text-align: left; }
.teacher-table td { padding: 15px; border-bottom: 1px solid #e5dccb; vertical-align: middle; font-size: 14px; }
.teacher-table tbody tr:hover { background: #fffcf5; }
.participant-name strong, .participant-name small { display: block; }
.participant-name strong { color: var(--ink); }
.participant-name small { margin-top: 3px; color: var(--muted); }
.progress-cell { min-width: 145px; }
.progress-cell > span { display: flex; justify-content: space-between; gap: 10px; color: var(--ink); font-weight: 700; }
.progress-cell i { display: block; height: 6px; margin-top: 6px; overflow: hidden; border-radius: 10px; background: #dbe2e5; }
.progress-cell i b { display: block; height: 100%; background: var(--green); }
.teacher-open-button { border: 1px solid var(--ink); border-radius: 8px; padding: 7px 10px; color: var(--ink); background: transparent; font-weight: 700; white-space: nowrap; }
.teacher-empty { padding: 56px 20px; text-align: center; }
.teacher-empty strong { color: var(--ink); font: 700 23px Georgia, serif; }
.teacher-empty p { margin: 7px 0 0; color: var(--muted); }

.teacher-dialog { width: min(560px, calc(100% - 28px)); border: 0; padding: 0; border-radius: var(--radius-lg); background: transparent; box-shadow: var(--shadow-lg); }
.teacher-dialog::backdrop { background: rgba(5, 31, 61, .72); backdrop-filter: blur(4px); }
.teacher-dialog > form, .teacher-dialog > article { position: relative; padding: 30px; background: var(--paper-light); border: 1px solid var(--line); border-top: 5px solid var(--gold); border-radius: var(--radius-lg); }
.teacher-dialog h2 { margin: 6px 36px 18px 0; color: var(--ink); font: 700 28px/1.15 Georgia, serif; }
.teacher-dialog label { display: block; color: var(--ink); font-size: 14px; font-weight: 700; }
.teacher-dialog label input { display: block; margin-top: 7px; }
.invite-link { display: grid; grid-template-columns: 1fr auto; margin-top: 20px; }
.invite-link input { border-radius: 10px 0 0 10px; }
.invite-link button { border: 0; border-radius: 0 10px 10px 0; padding: 0 16px; color: #fff; background: var(--ink); font-weight: 700; }
.invite-code { color: var(--muted); }
.invite-code strong { color: var(--ink); letter-spacing: .08em; }

.teacher-detail-dialog { width: min(1180px, calc(100% - 28px)); max-height: calc(100vh - 32px); }
.teacher-detail-dialog > article { overflow: auto; max-height: calc(100vh - 32px); }
.participant-detail-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.participant-detail-heading p:last-child { color: var(--muted); }
.participant-detail-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.participant-detail-metrics div { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.participant-detail-metrics span, .participant-detail-metrics strong { display: block; }
.participant-detail-metrics span { color: var(--muted); font-size: 12px; }
.participant-detail-metrics strong { margin-top: 4px; color: var(--ink); font-size: 19px; }
.teacher-table.detail { min-width: 800px; border: 1px solid #d7dedf; }
.module-status { display: inline-block; border-radius: 16px; padding: 4px 8px; color: var(--muted); background: #edf1f3; font-size: 12px; font-weight: 700; }
.module-status.complete { color: #fff; background: var(--green); }
.module-actions { display: flex; gap: 6px; }
.module-actions button { border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; color: var(--ink); background: #fff; font-size: 12px; font-weight: 700; }
.response-panel { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.response-panel > header { display: flex; align-items: center; justify-content: space-between; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.response-panel h3 { margin: 2px 0 0; color: var(--ink); font: 700 20px Georgia, serif; }
#responseList { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.response-item { padding: 12px; border-radius: 9px; background: #f5f7f7; }
.response-item span, .response-item strong { display: block; }
.response-item span { color: var(--muted); font-size: 12px; }
.response-item strong { margin-top: 4px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .teacher-metrics { grid-template-columns: repeat(2, 1fr); }
  .teacher-toolbar { flex-wrap: wrap; }
  .teacher-toolbar label { min-width: calc(50% - 8px); }
  .teacher-toolbar-actions { width: 100%; }
  .participant-detail-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .teacher-main { width: min(100% - 20px, 1440px); padding-top: 22px; }
  .teacher-topbar { padding: 10px 14px; }
  .teacher-session span { display: none; }
  .teacher-page-heading { align-items: stretch; flex-direction: column; }
  .teacher-metrics { grid-template-columns: 1fr; }
  .teacher-login-form > div { grid-template-columns: 1fr; }
  .teacher-toolbar { align-items: stretch; flex-direction: column; }
  .teacher-toolbar label { min-width: 100%; }
  .teacher-toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .participant-detail-heading { flex-direction: column; }
  #responseList { grid-template-columns: 1fr; }
}
