:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-strong: #f8fafc;
  --text: #1f2937;
  --muted: #64748b;
  --line: #dde4ef;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --teal: #0f766e;
  --amber: #b45309;
  --rose: #be123c;
  --green: #15803d;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  background: #10233f;
  color: #e5edf8;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #38bdf8;
  color: #082f49;
  font-weight: 800;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.brand-subtitle {
  color: #a9bdd6;
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 0 10px;
  color: #bdd0e8;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.nav svg,
.top-action svg,
.icon svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

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

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 68px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
}

.topbar h1 {
  font-size: 22px;
  margin: 0;
}

.topbar p {
  color: var(--muted);
  margin: 4px 0 0;
}

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

.top-action,
.btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.btn.ghost {
  background: transparent;
}

.content {
  padding: 24px 28px 42px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

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

.panel {
  padding: 18px;
}

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

.panel-title {
  margin: 0;
  font-size: 17px;
}

.panel-desc,
.muted {
  color: var(--muted);
}

.metric {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 104px;
}

.metric-label {
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 30px;
  font-weight: 800;
}

.metric-note {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e0f2fe;
  color: #0369a1;
}

.icon.teal {
  background: #ccfbf1;
  color: var(--teal);
}

.icon.amber {
  background: #fef3c7;
  color: var(--amber);
}

.icon.rose {
  background: #ffe4e6;
  color: var(--rose);
}

.tag,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2ff;
  color: #3730a3;
}

.status.low,
.status.success,
.status.present,
.status.strong {
  background: #dcfce7;
  color: var(--green);
}

.status.medium,
.status.warning,
.status.leave,
.status.normal {
  background: #fef3c7;
  color: var(--amber);
}

.status.high,
.status.danger,
.status.absent,
.status.weak,
.status.conflict {
  background: #ffe4e6;
  color: var(--rose);
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: var(--panel-strong);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: var(--brand-strong);
  font-weight: 800;
}

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

.student-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.student-card.active {
  border-color: var(--brand);
}

.student-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bar {
  height: 9px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.bar .green {
  background: var(--green);
}

.bar .amber {
  background: var(--amber);
}

.bar .rose {
  background: var(--rose);
}

.chart-bars {
  min-height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 4px 0;
  border-bottom: 1px solid var(--line);
}

.chart-item {
  flex: 1;
  min-width: 34px;
  display: grid;
  gap: 8px;
  align-items: end;
  text-align: center;
}

.chart-bar {
  min-height: 24px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
}

.chart-label {
  color: var(--muted);
  font-size: 11px;
  min-height: 28px;
}

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

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

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  margin: 5px auto 0;
  box-shadow: 0 0 0 4px #dbeafe;
}

.callout {
  border-left: 4px solid var(--brand);
  background: #eff6ff;
  border-radius: 8px;
  padding: 14px;
}

.callout.warning {
  border-left-color: var(--amber);
  background: #fffbeb;
}

.callout.danger {
  border-left-color: var(--rose);
  background: #fff1f2;
}

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

.tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #ffffff;
  font-weight: 700;
}

.tab.active {
  background: #dbeafe;
  color: var(--brand-strong);
  border-color: #bfdbfe;
}

.ai-output {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  line-height: 1.7;
  white-space: normal;
}

.ai-output h1,
.ai-output h2,
.ai-output h3 {
  margin: 12px 0 8px;
  line-height: 1.35;
}

.ai-output h1 {
  font-size: 22px;
}

.ai-output h2 {
  font-size: 18px;
}

.ai-output h3 {
  font-size: 16px;
}

.ai-output p {
  margin: 8px 0;
}

.ai-output ul {
  margin: 8px 0 8px 20px;
  padding: 0;
}

.ai-output li {
  margin: 5px 0;
}

.ai-output blockquote {
  margin: 0 0 12px;
  border-left: 4px solid var(--brand);
  background: #eff6ff;
  border-radius: 8px;
  padding: 10px 12px;
  color: #1e40af;
  font-weight: 700;
}

.ai-output code {
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

.ai-output hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

.lesson-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: stretch;
}

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

.flow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.flow-step {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
  min-height: 100px;
}

.flow-step strong {
  display: block;
  font-size: 18px;
  color: var(--brand);
  margin-bottom: 6px;
}

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

.slide-tile {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.slide-number {
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}

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

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

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

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  background: #10233f;
}

.login-visual {
  color: #ffffff;
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-visual h1 {
  font-size: 40px;
  line-height: 1.2;
  margin: 0 0 18px;
}

.login-visual p {
  color: #bdd0e8;
  font-size: 16px;
  line-height: 1.7;
}

.login-panel {
  background: var(--bg);
  padding: 54px;
  overflow-y: auto;
}

.login-card {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

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

.mini-stat {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.mini-stat strong {
  display: block;
  font-size: 24px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
}

.kbd {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 0 8px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .app-shell,
  .login-page,
  .split,
  .grid.cols-4,
  .grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .lesson-hero,
  .lesson-goals,
  .flow-steps,
  .slide-board,
  .practice-lanes {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 700px) {
  .content,
  .topbar,
  .login-panel,
  .login-visual {
    padding-left: 16px;
    padding-right: 16px;
  }

  .grid.cols-2,
  .mini-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    padding-top: 14px;
    padding-bottom: 14px;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }
}
