:root {
  --bg: #f4f6f1;
  --panel: #ffffff;
  --ink: #17211d;
  --muted: #66736d;
  --line: #dfe5dc;
  --accent: #2f7d68;
  --accent-dark: #1d5d4d;
  --gold: #c48a31;
  --rose: #c95163;
  --blue: #3e6fa8;
  --shadow: 0 18px 45px rgba(25, 38, 31, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(47, 125, 104, 0.1), transparent 34%),
    radial-gradient(circle at right top, rgba(196, 138, 49, 0.12), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

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

.app-shell.locked {
  display: none;
}

.login-screen {
  display: none;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
}

.login-screen.active {
  display: grid;
}

.login-card {
  display: grid;
  gap: 22px;
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.login-card form,
.assignment-form {
  display: grid;
  gap: 14px;
}

.login-card label,
.assignment-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
}

textarea {
  min-height: 90px;
  padding: 10px 12px;
  resize: vertical;
}

.login-error,
.form-message {
  min-height: 20px;
  color: var(--rose);
  font-size: 13px;
}

.demo-accounts {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: #f4f7f3;
  color: var(--muted);
  font-size: 13px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 22px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.today-card small,
.eyebrow,
.student-switcher label {
  color: var(--muted);
  font-size: 12px;
}

.nav-tabs {
  display: grid;
  gap: 10px;
}

body[data-role="student"] .nav-tab[data-view="teacher"],
body[data-role="student"] .nav-tab[data-view="admin"],
body[data-role="teacher"] .nav-tab[data-view="student"],
body[data-role="teacher"] .nav-tab[data-view="admin"],
body[data-role="admin"] .nav-tab[data-view="student"] {
  display: none !important;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-tab.active {
  border-color: rgba(47, 125, 104, 0.22);
  background: rgba(47, 125, 104, 0.11);
  color: var(--accent-dark);
  font-weight: 700;
}

.today-card,
.panel,
.hero-panel,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.today-card {
  margin-top: auto;
  padding: 18px;
}

.today-card strong {
  display: block;
  margin: 6px 0 14px;
  font-size: 20px;
}

.progress-track,
.meter {
  overflow: hidden;
  height: 9px;
  border-radius: 99px;
  background: #e7ece5;
}

.progress-fill,
.meter-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
}

main {
  min-width: 0;
  padding: 30px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  font-size: 20px;
}

.eyebrow {
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: 0;
}

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

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: center;
  min-height: 210px;
  margin-bottom: 20px;
  overflow: hidden;
  background:
    linear-gradient(100deg, rgba(23, 33, 29, 0.94), rgba(47, 125, 104, 0.84)),
    url("data:image/svg+xml,%3Csvg width='900' height='360' viewBox='0 0 900 360' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 246c84-48 168-64 252-48s150 49 220 32 110-74 200-83 166 34 228 74v139H0z' fill='%23f4f6f1' fill-opacity='.15'/%3E%3Cpath d='M0 126c68-35 127-38 178-10s103 76 172 70 109-80 185-91 131 40 190 43 105-19 175-69v291H0z' fill='%23ffffff' fill-opacity='.1'/%3E%3C/svg%3E");
  color: white;
}

.hero-copy {
  padding: 34px;
}

.hero-copy h2 {
  margin-bottom: 12px;
  font-size: 34px;
}

.hero-copy p:not(.eyebrow) {
  max-width: 620px;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.8;
}

.voice-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  padding-right: 34px;
}

.voice-visual span {
  width: 18px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.76);
  animation: pulse 1.4s ease-in-out infinite;
}

.voice-visual span:nth-child(1) { height: 42px; animation-delay: 0s; }
.voice-visual span:nth-child(2) { height: 86px; animation-delay: 0.12s; background: #f0c36e; }
.voice-visual span:nth-child(3) { height: 128px; animation-delay: 0.24s; }
.voice-visual span:nth-child(4) { height: 104px; animation-delay: 0.36s; background: #8ec6b2; }
.voice-visual span:nth-child(5) { height: 72px; animation-delay: 0.48s; }
.voice-visual span:nth-child(6) { height: 112px; animation-delay: 0.6s; background: #d67d8b; }

@keyframes pulse {
  0%,
  100% { transform: scaleY(0.72); opacity: 0.68; }
  50% { transform: scaleY(1); opacity: 1; }
}

.content-grid,
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(310px, 0.9fr) minmax(420px, 1.1fr);
  gap: 20px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.panel {
  padding: 20px;
}

.panel.wide {
  min-width: 0;
}

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

.task-list,
.assignment-list,
.task-checks,
.review-list,
.student-table {
  display: grid;
  gap: 12px;
}

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

.task-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.review-form,
.reminder-list,
.teacher-feedback {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.teacher-feedback {
  padding: 12px;
  border-radius: 8px;
  background: rgba(47, 125, 104, 0.08);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tag-check input {
  min-height: auto;
}

.review-form .practice-actions .primary-button {
  margin-top: 0;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.34fr) minmax(460px, 0.66fr);
  gap: 18px;
  align-items: start;
}

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

.account-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.account-item.is-disabled {
  background: #f7f4f2;
}

.account-title,
.account-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.account-title strong,
.account-title span {
  display: block;
}

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

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

.account-class-checks {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.account-actions input {
  min-width: 180px;
  flex: 1;
}

.account-actions .secondary-button,
.account-actions .ghost-button {
  min-width: 78px;
}

.trial-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.trial-card,
.trial-checklist,
.trial-feedback-list {
  display: grid;
  gap: 12px;
}

.trial-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.trial-title,
.trial-check-row,
.feedback-row {
  display: grid;
  gap: 10px;
}

.trial-title {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.trial-title span,
.trial-check-row span,
.feedback-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trial-check-row {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.trial-check {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: rgba(201, 81, 99, 0.12);
  color: var(--rose);
  font-weight: 900;
}

.trial-check.done {
  background: rgba(47, 125, 104, 0.14);
  color: var(--accent-dark);
}

.feedback-row {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.feedback-row p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.feedback-drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 26, 23, 0.38);
}

.feedback-drawer[hidden] {
  display: none !important;
}

.feedback-card {
  width: min(520px, 100%);
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 24px 70px rgba(18, 26, 23, 0.22);
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(380px, 0.9fr) minmax(460px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.operations-list,
.operations-card {
  display: grid;
  gap: 12px;
}

.operations-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.operations-card > strong {
  color: var(--ink);
}

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

.operations-summary {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.operations-row,
.student-status-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

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

.student-status-row {
  grid-template-columns: minmax(150px, 1fr) auto auto auto auto;
}

.operations-row strong,
.operations-row span,
.student-status-row strong,
.student-status-row span {
  display: block;
}

.operations-row span,
.student-status-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.operations-row .status-pill,
.student-status-row .status-pill {
  color: var(--accent-dark);
  text-align: center;
}

.operations-row .status-pill.risk,
.student-status-row .status-pill.risk {
  color: var(--rose);
}

.reminder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.task-check input {
  min-height: auto;
  margin-top: 2px;
}

.task-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.task-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: rgba(47, 125, 104, 0.12);
  color: var(--accent-dark);
  font-weight: 800;
}

.task-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.task-card p,
.panel-subtitle,
.prompt-box,
.analysis-card,
.review-item,
.student-row {
  color: var(--muted);
  line-height: 1.65;
}

.status-pill {
  padding: 6px 9px;
  border-radius: 999px;
  background: #eef3ef;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.done {
  background: rgba(47, 125, 104, 0.14);
}

.status-pill.risk {
  background: rgba(201, 81, 99, 0.13);
  color: var(--rose);
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  margin-top: 18px;
  background: var(--accent);
  color: white;
}

.secondary-button {
  background: rgba(62, 111, 168, 0.1);
  color: var(--blue);
  border-color: rgba(62, 111, 168, 0.18);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.practice-panel {
  min-height: 540px;
}

.prompt-box {
  min-height: 148px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.meter {
  margin: 18px 0;
}

.practice-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.practice-actions .primary-button {
  margin-top: 0;
}

.recorder-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-top: 14px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(47, 125, 104, 0.1);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.audio-preview {
  margin-top: 14px;
}

.audio-row,
.history-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.audio-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.audio-row strong,
.audio-row span,
.history-main strong,
.history-main span {
  display: block;
}

.audio-row span,
.history-main span {
  color: var(--muted);
  font-size: 12px;
}

audio {
  width: min(310px, 100%);
  height: 38px;
}

.recording-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--rose);
  font-weight: 700;
}

.recording-dot span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rose);
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%,
  100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.analysis-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.analysis-grid,
.ai-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.ai-detail-grid {
  margin-top: 14px;
}

.score-box {
  padding: 12px;
  border-radius: 8px;
  background: #f4f7f3;
}

.score-box strong {
  display: block;
  color: var(--ink);
  font-size: 24px;
}

.student-row,
.review-item,
.assignment-item,
.history-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.student-row {
  grid-template-columns: 1fr auto auto auto auto;
  align-items: center;
}

.student-row strong,
.review-item strong,
.assignment-item strong,
.history-item strong {
  color: var(--ink);
}

.history-panel {
  margin-top: 20px;
}

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

.history-item {
  gap: 12px;
}

.profile-grid,
.teacher-analytics {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
}

.radar-card,
.profile-summary,
.analytics-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.radar {
  width: min(320px, 100%);
  justify-self: center;
}

.radar-grid {
  fill: none;
  stroke: #d9e1d7;
  stroke-width: 1;
}

.radar-shape {
  fill: rgba(47, 125, 104, 0.28);
  stroke: var(--accent);
  stroke-width: 3;
}

.radar text {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.mini-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-metrics span {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(62, 111, 168, 0.1);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.weak-bars {
  display: grid;
  gap: 10px;
}

.weak-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.weak-row strong {
  color: var(--ink);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.chart {
  display: flex;
  align-items: end;
  gap: 12px;
  min-height: 280px;
  padding: 18px 8px 0;
  border-top: 1px solid var(--line);
}

.bar-wrap {
  display: grid;
  flex: 1;
  gap: 8px;
  justify-items: center;
  color: var(--muted);
  font-size: 12px;
}

.bar {
  width: 100%;
  max-width: 58px;
  min-height: 16px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--gold));
}

.empty-state {
  color: var(--muted);
}

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

  .sidebar {
    position: static;
    gap: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-tabs,
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .today-card {
    margin-top: 0;
  }

  .hero-panel,
  .content-grid,
  .dashboard-grid,
  .account-layout,
  .trial-grid,
  .operations-grid,
  .profile-grid,
  .teacher-analytics {
    grid-template-columns: 1fr;
  }

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

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

  .voice-visual {
    display: none;
  }
}

@media (max-width: 640px) {
  main,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-tabs,
  .metrics {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 24px;
  }

  .hero-copy h2 {
    font-size: 26px;
  }

  .task-card,
  .student-row,
  .reminder-row,
  .account-title,
  .account-actions,
  .account-fields,
  .account-class-checks,
  .trial-title,
  .feedback-row,
  .operations-row,
  .operations-metrics,
  .student-status-row,
  .audio-row,
  .history-main,
  .task-checks {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }
}
