:root {
  --navy: #082f55;
  --navy-2: #123a68;
  --ink: #172033;
  --muted: #68748a;
  --gold: #dfb052;
  --gold-2: #f3c66a;
  --line: #dfe5ee;
  --surface: #f6f8fb;
  --card: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.app-shell.student-shell {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 16px;
  color: #fff;
  background: var(--navy);
  overflow: hidden;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}

.brand strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, .75);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-bottom {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .14);
}

.nav-item {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: rgba(255, 255, 255, .8);
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, .12);
}

.nav-arrow {
  margin-left: auto;
}

.main {
  min-width: 0;
  padding: 18px 24px 24px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--surface);
}

.login-card {
  width: min(100%, 520px);
  display: grid;
  gap: 20px;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(19, 55, 93, .12);
}

.login-brand {
  display: grid;
  gap: 6px;
}

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

.login-form .primary-btn {
  width: 100%;
}

.remember-login {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.remember-login button {
  min-height: 36px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.remember-login button.active {
  color: var(--navy);
  background: #fffaf0;
  border-color: rgba(223, 176, 82, .7);
}

.compact-error {
  min-height: auto;
  padding: 10px 12px;
}

.password-field > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.password-field input {
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.password-field button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border-left: 1px solid var(--line);
  cursor: pointer;
}

.student-main {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.compact-topbar .eyebrow {
  margin-bottom: 2px;
  font-size: 11px;
}

.compact-topbar h1 {
  font-size: clamp(22px, 2.2vw, 28px);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-family: 'Songti SC', STSong, serif;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.2;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.account-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.primary-btn,
.icon-btn,
.select {
  min-height: 40px;
  border-radius: 8px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  color: #09233c;
  background: var(--gold);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(223, 176, 82, .22);
}

.primary-btn:disabled {
  opacity: .65;
  cursor: progress;
}

.primary-btn.full {
  width: 100%;
}

.secondary-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.danger-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  color: #b42318;
  background: #fff7f5;
  border: 1px solid #ffd6cf;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.icon-btn {
  width: 42px;
  display: grid;
  place-items: center;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
}

.select {
  padding: 0 34px 0 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.metric,
.panel,
.list-panel,
.subpanel,
.report-card,
.hero-report {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(31, 48, 79, .06);
}

.metric {
  grid-column: span 3;
  min-height: 136px;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 7px;
}

.metric svg {
  color: var(--gold);
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  font-size: 30px;
}

.span-7 {
  grid-column: span 7;
}

.span-5 {
  grid-column: span 5;
}

.panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
}

.panel-title svg {
  color: var(--gold);
}

.panel-title h3 {
  font-size: 15px;
  font-weight: 800;
}

.panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-heading-row .panel-title {
  margin-bottom: 0;
}

.compact-select {
  width: auto;
  min-width: 150px;
}

.chart-tall {
  height: 310px;
}

.activity-list,
.flow-list {
  display: grid;
  gap: 10px;
}

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 12px;
  background: #f7f9fc;
  border-radius: 8px;
}

.activity-item strong,
.activity-item span {
  display: block;
}

.activity-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.activity-item em {
  padding: 4px 8px;
  color: var(--navy);
  background: rgba(223, 176, 82, .16);
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.flow-step {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 12px;
}

.flow-step > span {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(223, 176, 82, .14);
}

.flow-step strong {
  display: block;
  margin-bottom: 4px;
}

.flow-step p,
.student-header p,
.student-header span,
.report-card p,
.api-box span,
.report-head span {
  color: var(--muted);
  line-height: 1.65;
}

.split-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.list-panel {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.list-title {
  padding: 6px 6px 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.search-box {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.student-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.student-row.active,
.student-row:hover {
  background: #f0f4f9;
}

.avatar,
.large-avatar {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--navy);
  font-family: 'Songti SC', STSong, serif;
  font-weight: 700;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.student-row strong,
.student-row small {
  display: block;
}

.student-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.detail-panel {
  min-height: 600px;
  overflow: hidden;
}

.student-header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.student-header.compact {
  margin-bottom: 0;
}

.large-avatar {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  font-size: 22px;
}

.student-header h2 {
  font-size: 22px;
  font-family: 'Songti SC', STSong, serif;
}

.student-meta-line {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-goal-details {
  width: fit-content;
  max-width: min(100%, 760px);
  margin-top: 5px;
}

.student-goal-details summary {
  width: fit-content;
  color: #52617a;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.student-goal-details > div {
  display: grid;
  gap: 5px;
  margin-top: 7px;
  padding: 9px 11px;
  color: #52617a;
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.student-goal-details > div p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  white-space: normal;
}

.student-header span {
  display: block;
  margin-top: 5px;
  font-size: 13px;
}

.score-pill {
  padding: 8px 12px;
  color: var(--navy);
  background: rgba(223, 176, 82, .18);
  border: 1px solid rgba(223, 176, 82, .35);
  border-radius: 8px;
  font-weight: 800;
}

.student-header-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.archive-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 16px;
}

.student-profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.subpanel {
  padding: 16px;
}

.radar-wrap {
  height: 300px;
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.dimension-grid div {
  min-height: 56px;
  padding: 8px;
  background: #f4f7fb;
  border-radius: 8px;
  text-align: center;
}

.dimension-grid span,
.dimension-grid strong {
  display: block;
}

.dimension-grid span {
  color: var(--muted);
  font-size: 12px;
}

.dimension-grid strong {
  margin-top: 3px;
  color: var(--navy);
}

.record-list {
  display: grid;
  gap: 10px;
}

.compact-record-list {
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.record {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  background: #f7f9fc;
  border-radius: 8px;
}

.record span {
  color: var(--gold);
  font-weight: 800;
}

.record p {
  line-height: 1.65;
}

.record em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.learning-panel {
  display: grid;
  gap: 12px;
}

.learning-summary {
  display: grid;
  grid-template-columns: minmax(120px, .38fr) minmax(0, 1fr);
  gap: 10px;
}

.learning-summary > div {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 14px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.learning-summary > .learning-factors {
  min-height: 48px;
  padding: 8px;
}

.learning-summary span,
.learning-summary strong,
.learning-summary em {
  display: block;
}

.learning-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.learning-summary strong {
  color: var(--gold);
  font-size: 26px;
}

.learning-summary em {
  color: var(--navy);
  font-style: normal;
  font-weight: 900;
}

.learning-trend.up strong {
  color: #047857;
}

.learning-trend.down strong {
  color: #b42318;
}

.learning-factors {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-content: center;
  min-height: 48px;
  padding: 8px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.learning-factors span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 7px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.archive-form-panel {
  max-width: 1120px;
}

.form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.form-head .panel-title {
  margin-bottom: 6px;
}

.form-head p {
  color: var(--muted);
  line-height: 1.65;
}

.archive-form {
  display: grid;
  gap: 18px;
}

.form-section {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-section legend {
  padding: 0 8px;
  color: var(--navy);
  font-weight: 800;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field span {
  color: #27344f;
  font-size: 13px;
  font-weight: 800;
}

.field em {
  margin-left: 3px;
  color: #b42318;
  font-style: normal;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  outline: 0;
}

.field input,
.field select {
  min-height: 44px;
  padding: 0 12px;
}

.field textarea {
  padding: 11px 12px;
  resize: vertical;
}

.field input[readonly] {
  color: var(--muted);
  background: #f2f5f9;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(223, 176, 82, .9);
  box-shadow: 0 0 0 3px rgba(223, 176, 82, .16);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.teacher-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.teacher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.teacher-card {
  display: grid;
  gap: 10px;
  min-height: 118px;
  padding: 16px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.teacher-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.teacher-card-head > div {
  display: grid;
  gap: 2px;
}

.teacher-card strong {
  color: var(--navy);
  font-size: 18px;
}

.teacher-card span {
  color: var(--muted);
}

.teacher-card em {
  width: fit-content;
  padding: 4px 8px;
  color: #047857;
  background: #e8f7ef;
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.teacher-student-list {
  display: grid;
  gap: 7px;
}

.teacher-student-list > span {
  color: var(--muted);
  font-size: 13px;
}

.teacher-student-list label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.teacher-student-list b {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-student-list select {
  min-height: 32px;
  padding: 0 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.teacher-card-actions {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px !important;
}

.teacher-card-hint {
  font-size: 12px;
  line-height: 1.5;
}

.teacher-student-manager {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9fc;
}

.modal-card.teacher-edit-modal {
  width: min(100%, 720px);
}

.teacher-edit-modal .modal-head > div {
  display: grid;
  gap: 3px;
}

.teacher-edit-modal .modal-head strong {
  color: var(--navy);
  font-size: 18px;
}

.teacher-edit-modal .modal-head small {
  color: var(--muted);
}

.teacher-edit-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.teacher-edit-form .form-actions {
  grid-column: 1 / -1;
}

.teacher-manager-modal.teacher-student-manager {
  width: min(100%, 920px);
  max-height: min(86vh, 820px);
  margin-top: 0;
  overflow: hidden;
  background: #fff;
}

.teacher-manager-modal .teacher-student-table {
  min-height: 180px;
  max-height: min(56vh, 560px);
}

.teacher-manager-head,
.teacher-student-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.teacher-manager-head > div { display: grid; gap: 4px; }
.teacher-manager-head strong { color: var(--navy); font-size: 17px; }
.teacher-manager-head span,
.teacher-student-pagination > span { color: var(--muted); font-size: 12px; }
.teacher-student-search { max-width: 420px; }

.teacher-student-table {
  display: grid;
  gap: 7px;
  max-height: 560px;
  overflow: auto;
}

.teacher-student-row {
  display: grid;
  grid-template-columns: 22px 36px minmax(160px, .7fr) minmax(220px, 1.3fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.teacher-student-row.checked { border-color: rgba(4, 120, 87, .35); background: #f1fbf6; }
.teacher-student-row .avatar { width: 32px; height: 32px; }
.teacher-student-row > span:nth-of-type(2) { display: grid; gap: 2px; }
.teacher-student-row small { color: var(--muted); }
.teacher-student-row em { overflow: hidden; color: #536179; font-size: 12px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.teacher-student-pagination > div { display: flex; gap: 8px; }

.teacher-multi-field > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.teacher-multi-field > span em { color: #047857; }
.teacher-multi-picker { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9fc; }
.teacher-multi-picker .search-box { max-width: 420px; margin-bottom: 10px; }
.teacher-check-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-height: 240px; overflow: auto; }
.teacher-check-item { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.teacher-check-item.checked { border-color: rgba(4, 120, 87, .4); background: #edf9f3; }
.teacher-check-item > input[type="checkbox"],
.teacher-student-row > input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  accent-color: #047857;
}
.teacher-check-item > span { display: grid; gap: 2px; }
.teacher-check-item small { color: var(--muted); font-size: 11px; }

@media (max-width: 900px) {
  .teacher-check-list { grid-template-columns: 1fr 1fr; }
  .teacher-student-row { grid-template-columns: 22px 36px 1fr; }
  .teacher-student-row em { grid-column: 3; }
}

@media (max-width: 620px) {
  .teacher-check-list { grid-template-columns: 1fr; }
  .teacher-edit-form { grid-template-columns: 1fr; }
  .teacher-manager-head, .teacher-student-pagination { align-items: flex-start; flex-direction: column; }
}

.account-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.account-form-actions {
  grid-column: 1 / -1;
}

.account-table {
  display: grid;
  gap: 8px;
}

.account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.account-row div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.account-row strong {
  overflow: hidden;
  color: var(--navy);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.account-row em {
  width: fit-content;
  padding: 4px 8px;
  color: #047857;
  background: #e8f7ef;
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.account-row em.disabled {
  color: #b42318;
  background: #fff0ed;
}

.list-toolbar {
  display: grid;
  gap: 8px;
  margin: -2px 0 8px;
}

.student-list-actions {
  display: grid;
  gap: 8px;
}

.student-list-actions .primary-btn,
.student-list-actions .secondary-btn {
  width: 100%;
}

.create-student-btn {
  min-height: 38px;
  box-shadow: none;
}

.archive-toggle {
  width: 100%;
  justify-content: center;
}

.secondary-btn.active,
.archive-toggle.active {
  color: var(--navy);
  background: rgba(223, 176, 82, .16);
  border-color: rgba(223, 176, 82, .65);
}

.score-editor {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.score-editor label {
  display: grid;
  grid-template-columns: 1fr 64px 32px;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.score-editor strong {
  font-size: 13px;
}

.score-editor input {
  min-height: 34px;
  text-align: center;
}

.score-editor em {
  color: var(--navy);
  font-style: normal;
  font-weight: 800;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.chip.active {
  color: var(--navy);
  background: rgba(223, 176, 82, .18);
  border-color: rgba(223, 176, 82, .65);
  font-weight: 800;
}

.json-preview {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.json-preview strong {
  color: var(--navy);
  font-size: 13px;
}

.json-preview pre {
  max-height: 320px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: #dbe8ff;
  background: #111827;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
}

.observation-layout {
  display: grid;
  grid-template-columns: minmax(220px, 235px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.observation-head {
  align-items: flex-start;
  gap: 14px;
}

.observation-head-save {
  min-height: 36px;
  flex: 0 0 auto;
  padding-inline: 12px;
  box-shadow: none;
}

.observation-controls {
  display: grid;
  gap: 8px;
  align-content: start;
}

.observation-controls .field {
  gap: 5px;
}

.observation-controls .field span {
  font-size: 12px;
}

.observation-controls .field input,
.observation-controls .field select {
  min-height: 38px;
  padding: 0 11px;
}

.observation-controls .field textarea {
  min-height: 72px;
  padding: 9px 11px;
}

.learning-score-entry {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.learning-score-entry strong {
  color: var(--navy);
  font-size: 13px;
}

.learning-score-entry div {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, .8fr);
  gap: 7px;
}

.learning-score-entry input {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.learning-score-entry input:focus {
  border-color: rgba(223, 176, 82, .9);
  box-shadow: 0 0 0 3px rgba(223, 176, 82, .16);
}

.learning-score-entry span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.learning-score-labels span {
  font-size: 11px;
  font-weight: 900;
}

.learning-score-entry p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.behavior-table,
.behavior-card-grid {
  display: grid;
  gap: 8px;
}

.behavior-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.behavior-card {
  min-height: 66px;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.behavior-card.positive {
  background: #f5fcf8;
  border-color: #d8f2e3;
}

.behavior-card.negative {
  background: #fff8f6;
  border-color: #ffe1dc;
}

.behavior-card.positive:hover {
  background: #e9f8f0;
  border-color: #94d8b1;
}

.behavior-card.positive.checked {
  background: #d7f4e4;
  border-color: #22965d;
  box-shadow: 0 0 0 3px rgba(34, 150, 93, .18);
}

.behavior-card.negative:hover {
  background: #ffede9;
  border-color: #f1a293;
}

.behavior-card.negative.checked {
  background: #ffdcd5;
  border-color: #d64532;
  box-shadow: 0 0 0 3px rgba(214, 69, 50, .18);
}

.behavior-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.behavior-card strong {
  font-size: 13px;
  line-height: 1.32;
}

.behavior-card em {
  width: fit-content;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.behavior-card .positive,
.behavior-card em.positive {
  color: #047857;
  background: #e8f7ef;
}

.behavior-card .negative,
.behavior-card em.negative {
  color: #b42318;
  background: #fff0ed;
}

.behavior-row {
  display: grid;
  grid-template-columns: 22px 72px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  min-height: 50px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.behavior-row.checked {
  border-color: rgba(223, 176, 82, .7);
  background: #fffaf0;
}

.behavior-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.behavior-row strong {
  font-size: 14px;
}

.behavior-row em {
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.behavior-row .positive {
  color: #047857;
}

.behavior-row .negative {
  color: #b42318;
}

.report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.report-command {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 20px;
}

.report-command-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, .86fr);
  gap: 20px;
  align-items: start;
}

.report-step {
  display: grid;
  gap: 8px;
}

.report-step > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.report-type-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.report-type-card {
  min-height: 74px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-content: center;
  padding: 10px;
  color: var(--ink);
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.report-type-card em {
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--navy);
  border-radius: 8px;
  font-style: normal;
  font-weight: 900;
}

.report-type-card strong,
.report-type-card small {
  display: block;
}

.report-type-card strong {
  font-size: 15px;
}

.report-type-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.report-type-card.weekly em {
  background: #0f5f7a;
}

.report-type-card.monthly em {
  background: var(--navy);
}

.report-type-card.semester em {
  background: #7a5a14;
}

.report-type-card.active {
  background: #fffaf0;
  border-color: rgba(223, 176, 82, .8);
  box-shadow: 0 0 0 3px rgba(223, 176, 82, .14);
}

.period-row {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: start;
}

.report-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.report-type-tabs {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: #eef3f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-type-tabs button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.report-type-tabs button.active {
  color: var(--navy);
  background: #fff;
  box-shadow: 0 2px 8px rgba(19, 55, 93, .08);
}

.period-picker {
  min-height: 64px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
  padding: 10px 12px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.period-picker svg {
  grid-row: 1 / 3;
}

.period-picker select {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
  font-weight: 900;
}

.period-picker strong {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
}

.report-history-bar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(260px, 360px) minmax(180px, 260px);
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.report-search-box {
  margin-bottom: 12px;
}

.report-history-bar .report-search-box {
  width: 100%;
  margin-bottom: 0;
}

.report-history-title {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.period-filter {
  min-height: 42px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.period-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.period-filter select {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--navy);
  background: transparent;
  font-weight: 700;
}

.student-period-filter {
  width: min(360px, 100%);
  margin: 0 0 14px auto;
}

.api-box {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #f5f0e5;
  border: 1px solid rgba(223, 176, 82, .36);
  border-radius: 8px;
}

.api-box code {
  color: var(--navy);
  font-weight: 800;
}

.report-list {
  display: grid;
  gap: 12px;
}

.error-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  color: #b42318;
  background: #fff7f5;
  border: 1px solid #ffd0c7;
  border-radius: 8px;
  font-weight: 800;
}

.report-card {
  position: relative;
  padding: 16px;
  overflow: hidden;
}

.report-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--gold);
}

.report-summary-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 96px auto;
  gap: 14px;
  align-items: center;
}

.report-date-block {
  min-width: 0;
}

.report-date-block strong,
.report-date-block span,
.report-summary-main strong,
.report-summary-main span,
.report-summary-score strong,
.report-summary-score span {
  display: block;
}

.report-date-block strong {
  color: var(--navy);
  font-size: 20px;
  line-height: 1.2;
}

.report-date-block span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.report-summary-main {
  min-width: 0;
}

.report-summary-main strong {
  color: var(--ink);
  font-size: 15px;
}

.report-summary-main span {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-summary-score {
  text-align: right;
}

.report-summary-score strong {
  color: var(--gold);
  font-size: 24px;
  line-height: 1;
}

.report-summary-score span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-card.expanded .report-head {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.report-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.report-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-head strong,
.report-head span {
  display: block;
}

.report-head em {
  height: 24px;
  padding: 3px 8px;
  color: var(--navy);
  background: rgba(223, 176, 82, .17);
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.small-btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.danger-btn {
  color: #b42318;
  border-color: #ffd0c7;
  background: #fff7f5;
}

.report-score {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.report-score strong {
  color: var(--gold);
  font-size: 32px;
}

.report-score span {
  color: var(--muted);
}

.report-visual-summary {
  display: grid;
  grid-template-columns: 120px 220px minmax(0, 1fr) 180px;
  gap: 16px;
  align-items: center;
  margin: 10px 0 14px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-visual-summary .report-score {
  margin-bottom: 0;
}

.report-mini-radar {
  height: 170px;
  min-width: 0;
}

.report-score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.report-score-grid div {
  min-height: 50px;
  display: grid;
  place-items: center;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-learning-card {
  min-height: 110px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  background: #fff;
  border: 1px solid rgba(223, 176, 82, .35);
  border-radius: 8px;
}

.report-learning-card span,
.report-learning-card strong,
.report-learning-card em {
  display: block;
}

.report-learning-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.report-learning-card strong {
  color: var(--gold);
  font-size: 26px;
}

.report-learning-card em {
  color: var(--navy);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.45;
}

.report-score-grid span,
.report-score-grid strong {
  display: block;
}

.report-score-grid span {
  color: var(--muted);
  font-size: 12px;
}

.report-score-grid strong {
  color: var(--navy);
  font-size: 16px;
}

.markdown-report,
.report-text-block {
  max-height: 260px;
  margin: 12px 0 0;
  padding: 12px;
  overflow: auto;
  color: #22304a;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
}

.report-text-block {
  white-space: pre-wrap;
}

.report-editor {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.report-editor textarea {
  width: 100%;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.7;
  resize: vertical;
}

.markdown-report h2,
.markdown-report h3,
.markdown-report h4,
.markdown-report p {
  margin: 0 0 8px;
}

.markdown-report h2 {
  color: var(--navy);
  font-size: 18px;
}

.markdown-report h3 {
  color: #27344f;
  font-size: 16px;
}

.markdown-report h4 {
  color: #34405a;
  font-size: 14px;
}

.markdown-report .md-list {
  padding-left: 14px;
  position: relative;
}

.markdown-report .md-list::before {
  content: '';
  position: absolute;
  left: 0;
  top: .75em;
  width: 5px;
  height: 5px;
  background: var(--gold);
  border-radius: 50%;
}

.md-table-wrap {
  margin: 10px 0 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.md-table th,
.md-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

.md-table th {
  color: var(--navy);
  background: #eef3f8;
  font-weight: 900;
}

.md-table tr:last-child td {
  border-bottom: 0;
}

.md-table th:last-child,
.md-table td:last-child {
  border-right: 0;
}

.report-dimensions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.report-dimensions div {
  min-height: 92px;
  padding: 10px;
  background: #f7f9fc;
  border-radius: 8px;
}

.report-dimensions strong,
.report-dimensions span,
.report-dimensions small {
  display: block;
}

.report-dimensions span {
  margin-top: 4px;
  color: var(--gold);
  font-size: 20px;
  font-weight: 800;
}

.report-dimensions small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.power-panel {
  display: grid;
  gap: 18px;
}

.relay-power-head { align-items: flex-start; }
.relay-power-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.relay-recharge-link { text-decoration: none; white-space: nowrap; }
.relay-power-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.relay-usage-heading label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.relay-usage-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.relay-usage-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.relay-usage-table th, .relay-usage-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.relay-usage-table tr:last-child td { border-bottom: 0; }
.relay-usage-table th { color: var(--muted); background: #f7f9fc; font-size: 12px; }
.relay-usage-table td strong, .relay-usage-table td small { display: block; }
.relay-usage-table td small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.relay-status { padding: 3px 7px; color: #9b3b35; background: #fff0ef; border-radius: 999px; font-size: 11px; font-style: normal; }
.relay-status.success { color: #047857; background: #e9f8f1; }
.relay-empty-cell { height: 88px; color: var(--muted); text-align: center !important; }
.relay-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.relay-pagination > div { display: flex; gap: 8px; }

.power-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 14px;
}

.power-balance-card {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 18px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compact-recharge-btn {
  width: fit-content;
  min-height: 34px;
  margin-top: 4px;
  padding-inline: 12px;
  box-shadow: none;
}

.power-balance-card span,
.power-balance-card strong,
.power-balance-card em,
.power-balance-card small {
  display: block;
}

.power-balance-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.power-balance-card strong {
  color: var(--navy);
  font-size: 34px;
  line-height: 1.1;
}

.power-balance-card em,
.power-balance-card small {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.power-progress {
  height: 10px;
  overflow: hidden;
  background: #e8edf5;
  border-radius: 999px;
}

.power-progress i {
  display: block;
  height: 100%;
  background: var(--gold);
  border-radius: inherit;
}

.power-section {
  display: grid;
  gap: 12px;
}

.recharge-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, 1fr)) minmax(240px, 1.35fr);
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 35, 60, .36);
}

.modal-card {
  width: min(100%, 560px);
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(9, 35, 60, .22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recharge-modal-card {
  width: min(100%, 620px);
}

.modal-recharge-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.modal-custom-recharge {
  min-height: auto;
}

.recharge-card {
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.recharge-card:hover {
  background: #fffaf0;
  border-color: rgba(223, 176, 82, .55);
}

.recharge-card strong {
  color: var(--navy);
  font-size: 20px;
}

.recharge-card span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.custom-recharge {
  display: grid;
  gap: 6px;
  min-height: 68px;
  padding: 10px 12px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.custom-recharge > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.custom-recharge div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.custom-recharge input {
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.custom-recharge .primary-btn {
  min-height: 34px;
  box-shadow: none;
}

.custom-recharge small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.power-ledger {
  display: grid;
  gap: 8px;
}

.power-ledger-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  background: #f7f9fc;
  border-radius: 8px;
}

.power-ledger-row span,
.power-ledger-row em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.power-ledger-row em {
  color: #b42318;
  text-align: right;
}

.student-portal {
  display: grid;
  gap: 16px;
}

.student-report-browser {
  display: grid;
  gap: 14px;
}

.student-report-controls {
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(420px, 1fr);
  gap: 16px;
  align-items: start;
}

.student-report-controls p {
  margin-top: 6px;
  color: var(--muted);
}

.student-report-types {
  align-self: start;
}

.polish-panel {
  max-width: 1120px;
  height: calc(100vh - 132px);
  min-height: 620px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
}

.polish-panel.with-history {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.polish-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.polish-history {
  max-height: 220px;
  display: grid;
  gap: 8px;
  overflow: auto;
  padding: 10px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compact-empty {
  padding: 12px;
  min-height: auto;
}

.polish-history-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.polish-history-summary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.polish-history-summary span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.polish-history-summary strong {
  overflow: hidden;
  color: var(--navy);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.polish-history-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.polish-history-summary em {
  color: var(--navy);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.polish-history-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.polish-history-body .markdown-report {
  max-height: 260px;
  margin: 0;
  padding: 12px;
  overflow: auto;
}

.chat-window {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  overflow: auto;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chat-message {
  display: grid;
  gap: 8px;
}

.chat-message.user {
  justify-items: end;
}

.chat-message.assistant {
  justify-items: start;
}

.chat-bubble {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.75;
}

.chat-bubble.user {
  color: #fff;
  background: var(--navy);
}

.chat-bubble.assistant {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.chat-bubble .markdown-report {
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}

.chat-composer {
  width: 100%;
  justify-self: stretch;
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(19, 55, 93, .08);
}

.chat-composer textarea {
  width: 100%;
  min-height: 72px;
  max-height: 148px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 0;
  outline: 0;
  line-height: 1.7;
  resize: vertical;
}

.chat-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.bubble-download {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.hero-report {
  min-height: 220px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 20px;
  align-items: center;
  padding: 28px;
  color: #fff;
  background: var(--navy);
}

.hero-report h2 {
  font-family: 'Songti SC', STSong, serif;
  font-size: clamp(28px, 4vw, 46px);
  margin-bottom: 12px;
}

.hero-report p:not(.eyebrow) {
  max-width: 780px;
  color: rgba(255, 255, 255, .78);
  line-height: 1.8;
}

.hero-score {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .08);
  border-radius: 8px;
}

.hero-score strong {
  color: var(--gold-2);
  font-size: 54px;
}

.hero-score span {
  color: rgba(255, 255, 255, .72);
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .metric,
  .span-7,
  .span-5 {
    grid-column: span 12;
  }

  .split-layout,
  .two-col,
  .hero-report,
  .observation-layout,
  .report-command,
  .report-command-controls,
  .report-visual-summary,
  .learning-summary,
  .power-overview,
  .student-report-controls {
    grid-template-columns: 1fr;
  }

  .report-summary-row {
    grid-template-columns: 180px minmax(0, 1fr) 88px;
  }

  .report-summary-row .small-btn {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .report-history-bar {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  }

  .report-history-title {
    grid-column: 1 / -1;
  }

  .score-editor,
  .report-dimensions,
  .behavior-card-grid,
  .report-score-grid,
  .learning-summary,
  .recharge-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .report-toolbar,
  .report-history-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .content-grid {
    gap: 12px;
  }

  .student-header {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .large-avatar {
    width: 48px;
    height: 48px;
  }

  .score-pill {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .dimension-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .api-box {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .score-editor,
  .report-dimensions,
  .behavior-card-grid,
  .report-type-cards,
  .period-row,
  .report-score-grid,
  .learning-summary,
  .recharge-grid,
  .power-ledger-row {
    grid-template-columns: 1fr;
  }

  .power-ledger-row em {
    text-align: left;
  }

  .record {
    grid-template-columns: 28px 1fr;
  }

  .record em {
    grid-column: 2 / -1;
  }

  .report-history-bar .report-search-box {
    width: 100%;
  }

  .report-history-bar {
    grid-template-columns: 1fr;
  }

  .report-history-title {
    grid-column: auto;
  }

  .period-filter,
  .student-period-filter {
    width: 100%;
    margin-left: 0;
  }

  .report-summary-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .report-date-block,
  .report-summary-main {
    grid-column: 1 / -1;
  }

  .report-summary-score {
    text-align: left;
  }

  .report-summary-row .small-btn {
    grid-column: auto;
  }

  .period-picker strong {
    min-width: 0;
    text-align: left;
  }

  .behavior-row {
    grid-template-columns: 22px 64px 1fr;
  }

  .behavior-row em {
    grid-column: 2 / -1;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .list-panel,
  .report-toolbar,
  .report-command,
  .report-history-title,
  .report-history-bar,
  .report-head-actions,
  .advice-list,
  .chat-composer,
  .polish-head .secondary-btn {
    display: none !important;
  }

  .app-shell,
  .split-layout {
    display: block;
  }

  .main {
    padding: 0;
  }

  .panel,
  .report-card {
    box-shadow: none;
    border: 0;
  }

  .markdown-report {
    max-height: none;
    overflow: visible;
  }
}
.report-upload-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid rgba(24, 63, 104, .14);
  border-radius: 14px;
  background: rgba(245, 249, 253, .82);
}

.report-upload-box > * { min-width: 0; max-width: 100%; }
.report-upload-box > div { display: flex; flex-direction: column; gap: 4px; }
.report-upload-box > div span { color: #68758a; font-size: 12px; }
.report-upload-box > input { min-width: 0; padding: 10px 12px; border: 1px solid rgba(24, 63, 104, .18); border-radius: 9px; background: #fff; }
.report-upload-box > button { justify-content: center; width: 100%; white-space: nowrap; }
.report-upload-box > button svg { flex: 0 0 auto; }
.report-upload-box > button span { display: inline; white-space: nowrap; }
.report-file-picker { display: grid !important; gap: 7px !important; min-width: 0; }
.report-file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.report-file-trigger { width: fit-content; cursor: pointer; white-space: nowrap; }
.report-file-names { display: grid; gap: 4px; min-width: 0; }
.report-file-names small { display: block; color: #68758a; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.uploaded-extraction { display: grid; gap: 7px; margin: 14px 0; padding: 12px; color: #536179; background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; }
.uploaded-extraction.parsed { color: #046c50; background: #f0faf5; border-color: rgba(4, 120, 87, .25); }
.uploaded-extraction > span { font-size: 12px; }
.uploaded-extraction summary { width: fit-content; color: var(--navy); font-size: 12px; font-weight: 800; cursor: pointer; }
.uploaded-extraction pre { max-height: 320px; margin: 8px 0 0; padding: 12px; overflow: auto; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.report-upload-box > em { grid-column: 1 / -1; color: #b94747; font-style: normal; }
.uploaded-report-section { margin: 18px 0 26px; }
.uploaded-report-section > .report-history-title { margin-bottom: 10px; }
.report-head-actions a.secondary-btn { text-decoration: none; }
.audit-table-wrap { overflow: auto; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.audit-table th, .audit-table td { padding: 12px 10px; border-bottom: 1px solid rgba(24, 63, 104, .1); text-align: left; vertical-align: top; white-space: nowrap; }
.audit-table th { color: #5c6980; font-weight: 600; }
.audit-table td small { display: block; margin-top: 3px; color: #8893a5; }
.audit-table td code { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; color: #43526a; background: #f3f6fa; padding: 5px 7px; border-radius: 6px; }
.audit-table th:last-child,
.audit-table td:last-child { min-width: 420px; white-space: normal; }
.audit-change-list { display: grid; gap: 6px; }
.audit-change-item { display: grid; grid-template-columns: 92px minmax(110px, 1fr) 18px minmax(110px, 1fr); gap: 7px; align-items: start; }
.audit-change-item strong { color: var(--navy); }
.audit-change-item span { max-width: 280px; overflow: hidden; color: #536179; text-overflow: ellipsis; white-space: nowrap; }
.audit-change-item em { color: var(--gold-dark); font-style: normal; text-align: center; }

@media (max-width: 980px) {
  .report-upload-box { grid-template-columns: 1fr; }
  .relay-power-overview { grid-template-columns: 1fr; }
  .relay-power-actions { justify-content: flex-start; }
}
