/* Admin-only Teacher Dashboard (/admin) — Warm-paper responsive layout (1440 & 390, light & dark) */
.td-shell {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0 0 28px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
}
.td-shell *,
.td-shell *::before,
.td-shell *::after {
  box-sizing: border-box;
}
.td-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.td-top-title h2 {
  margin: 2px 0 4px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}
.td-top-title p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.td-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
}
.td-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  max-width: 100%;
}
.td-btn:hover:not(:disabled) {
  background: var(--surface-soft);
}
.td-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.td-btn-primary {
  background: var(--action-bg, #335d48);
  color: var(--action-ink, #fffefa);
  border-color: transparent;
  font-weight: 600;
}
.td-btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  background: var(--action-bg, #335d48);
}
.td-btn-warn {
  border-color: color-mix(in srgb, #b85c38 45%, var(--line));
  color: var(--ink);
}

/* KPI Strip */
.td-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.td-kpi-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  text-align: left;
  color: var(--ink);
}
button.td-kpi-card {
  cursor: pointer;
  font: inherit;
}
button.td-kpi-card:hover {
  border-color: var(--green);
}
.td-kpi-label {
  font-size: 12px;
  color: var(--muted);
}
.td-kpi-val {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.td-kpi-sub {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Tabs */
.td-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.td-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.td-tab[aria-selected="true"] {
  background: var(--action-bg, #335d48);
  color: var(--action-ink, #fffefa);
  border-color: transparent;
  font-weight: 600;
}
.td-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: color-mix(in srgb, currentColor 16%, transparent);
}

/* Toolbar & Filters */
.td-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.td-search {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}
.td-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.td-pill {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.td-pill.is-active {
  border-color: var(--green);
  color: var(--ink);
  background: var(--surface-soft);
  font-weight: 600;
}

/* Split Master-Detail */
.td-split {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.td-student-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 680px;
  overflow-y: auto;
  min-width: 0;
}
.td-student-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.td-student-card:hover {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
}
.td-student-card.is-selected {
  border-color: var(--green);
  background: var(--surface-soft);
  box-shadow: 0 0 0 1px var(--green);
}
.td-stu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.td-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex: none;
  overflow: hidden;
}
.td-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.td-stu-meta {
  min-width: 0;
  flex: 1;
}
.td-stu-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-stu-sub {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-exam-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  flex: none;
}
.td-stu-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.td-stu-chips span {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.td-stu-chips span.is-alert {
  border-color: #c26d3a;
  color: var(--ink);
  font-weight: 600;
}

/* Detail Panel */
.td-detail {
  min-width: 0;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.td-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.td-detail-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.td-hw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 8px;
}
.td-hw-box {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  min-width: 0;
}
.td-hw-box strong {
  display: block;
  font-size: 16px;
  color: var(--ink);
}
.td-hw-box span {
  font-size: 11.5px;
  color: var(--muted);
}
.td-subblock {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  min-width: 0;
}
.td-subblock h4 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
}
.td-mock-item,
.td-corpus-card,
.td-fb-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 10px;
  min-width: 0;
}
.td-mock-head,
.td-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.td-mock-answers {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.td-ans-row {
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 12.5px;
  min-width: 0;
}
.td-ans-row p {
  margin: 4px 0;
  overflow-wrap: anywhere;
}
.td-shell audio {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 36px;
  margin-top: 6px;
}

/* Teacher Feedback Composer */
.td-fb-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.td-fb-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.td-fb-row select,
.td-fb-row input {
  flex: 1 1 140px;
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}
.td-fb-form textarea,
.td-review-note {
  width: 100%;
  max-width: 100%;
  min-height: 76px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}
.td-review-note {
  min-height: 54px;
  margin-top: 8px;
}
.td-rec-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.td-status-msg {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.td-status-msg[data-tone="ok"] {
  color: var(--green);
  font-weight: 600;
}
.td-status-msg[data-tone="err"] {
  color: #c62828;
  font-weight: 600;
}

/* Corpus Verbatim Review */
.td-verbatim-box {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.td-ai-items {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-soft);
  font-size: 12.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.td-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}
.td-badge[data-status="approved"] {
  border-color: var(--green);
  color: var(--green);
}
.td-badge[data-status="pending"] {
  border-color: #c26d3a;
}
.td-empty {
  margin: 0;
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 960px) {
  .td-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .td-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .td-student-list {
    max-height: 300px;
  }
}
@media (max-width: 520px) {
  .td-shell {
    padding: 14px 12px;
    border-radius: 14px;
  }
  .td-kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .td-detail {
    padding: 12px 10px;
  }
}
