:root {
  --ink: #17202a;
  --muted: #667085;
  --line: #d7dde5;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --school-red: #b4232a;
  --cobalt: #1f5f99;
  --teal: #147d78;
  --gold: #c58a1a;
  --green: #2f855a;
  --danger: #c2413b;
  --radius: 8px;
  --shadow: 0 18px 45px rgba(30, 45, 62, 0.12);
  font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(31, 95, 153, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(31, 95, 153, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  color: #fff;
  background: linear-gradient(180deg, #101827 0%, #17202a 48%, #0e3433 100%);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

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

.brand small {
  color: rgba(255, 255, 255, 0.7);
}

.brand-mark {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
}

.brand-mark span {
  display: block;
  border-radius: 4px;
  background: #fff;
}

.brand-mark span:nth-child(2) {
  background: #e9bd55;
}

.brand-mark span:nth-child(3) {
  background: #40b7aa;
}

.brand-mark span:nth-child(4) {
  background: #d9484e;
}

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

.nav-item {
  border: 0;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  border-radius: 8px;
  padding: 12px 12px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.nav-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: currentColor;
}

.team-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.team-card strong,
.team-card p {
  margin: 8px 0 0;
}

.team-card p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.team-label {
  color: #f5cf72;
  font-size: 12px;
}

.workspace {
  padding: 26px;
  min-width: 0;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--cobalt);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 30px;
}

h2 {
  margin: 0;
  font-size: 20px;
}

h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

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

.primary-btn,
.ghost-btn,
.small-btn {
  border: 0;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-btn {
  color: #fff;
  background: var(--school-red);
}

.primary-btn:hover {
  background: #961e24;
}

.ghost-btn {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.small-btn {
  min-height: 32px;
  padding: 0 10px;
  color: var(--cobalt);
  background: #e9f2fb;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

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

.metric-card,
.panel,
.radar-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 124px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

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

.metric-card strong {
  font-size: 34px;
}

.metric-card.accent {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), #164e63);
}

.metric-card.accent span,
.metric-card.accent small {
  color: rgba(255, 255, 255, 0.76);
}

.dashboard-grid,
.training-layout,
.ability-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(340px, 0.9fr);
  gap: 18px;
}

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

.panel.inset {
  box-shadow: none;
  background: #f9fbfd;
}

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

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

.risk-lane {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfd;
  min-height: 180px;
}

.risk-lane h3 {
  display: flex;
  justify-content: space-between;
}

.student-pill,
.warning-card,
.report-card,
.task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.student-pill {
  padding: 10px;
  margin-top: 10px;
}

.student-pill strong {
  display: block;
}

.student-pill small,
.warning-card small,
.report-card small {
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.tag.high {
  color: #fff;
  background: var(--danger);
}

.tag.medium {
  color: #3b2705;
  background: #f0c766;
}

.tag.low {
  color: #fff;
  background: var(--green);
}

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

.task-card {
  padding: 12px;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #e8edf3;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--cobalt));
}

.student-table-wrap {
  overflow: auto;
}

.student-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.student-table th,
.student-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.student-table th {
  color: var(--muted);
  font-size: 13px;
}

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

.warning-card,
.report-card {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.warning-card ul,
.report-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
}

.step-code {
  height: 56px;
  border-radius: 8px;
  color: #fff;
  background: var(--cobalt);
  display: grid;
  place-items: center;
  font-weight: 800;
}

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

.alert-item {
  padding: 12px;
  border-left: 4px solid var(--school-red);
  background: #fff4f4;
  border-radius: 6px;
}

.select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.radar-card {
  padding: 12px;
  display: grid;
  place-items: center;
  min-height: 460px;
}

.ability-detail {
  display: grid;
  gap: 12px;
}

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

.agent-panel {
  max-width: 1080px;
}

.quick-prompts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.prompt-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
}

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

.message {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  white-space: pre-wrap;
}

.message.user {
  justify-self: end;
  color: #fff;
  background: var(--cobalt);
  border-color: var(--cobalt);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.chat-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

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

.profile-card {
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #17202a;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

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

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

  .metrics-grid,
  .dashboard-grid,
  .training-layout,
  .ability-layout,
  .warning-grid,
  .reports-grid,
  .student-profile {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .workspace {
    padding: 16px;
  }

  .topbar,
  .top-actions,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    min-width: 0;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }

  .risk-board {
    grid-template-columns: 1fr;
  }

  .chat-window {
    height: 360px;
  }
}
