:root {
  --bg: #f2eee6;
  --bg-strong: #e5dccd;
  --panel: rgba(252, 249, 243, 0.9);
  --panel-strong: #f8f3ea;
  --panel-contrast: #1f2a2a;
  --line: rgba(49, 45, 37, 0.14);
  --line-strong: rgba(49, 45, 37, 0.28);
  --text: #211d18;
  --text-soft: #6c6458;
  --text-inverse: #f5efe4;
  --accent: #b24a2b;
  --accent-deep: #8e3418;
  --accent-soft: #f0d6c8;
  --ok: #466b57;
  --warn: #a67521;
  --muted: #d8d0c2;
  --shadow: 0 18px 50px rgba(54, 41, 23, 0.08);
  --radius: 18px;
  --radius-sm: 10px;
  --max-width: 1380px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "IBM Plex Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(178, 74, 43, 0.12), transparent 28%),
    linear-gradient(180deg, #f7f2ea 0%, #eee6d8 100%);
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(33, 29, 24, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 29, 24, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.55;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.topbar,
.hero-strip,
.panel,
.knowledge-detail,
.subject-nav-wrap {
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(250,244,235,0.94));
  box-shadow: var(--shadow);
}

.brand-block {
  min-width: 0;
}

.brand-kicker,
.panel-kicker,
.hero-eyebrow {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.brand-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.brand-mark {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-subtitle {
  font-size: 1rem;
  color: var(--text-soft);
}

.topbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}

.student-switcher {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.student-switcher label {
  font-size: 12px;
  color: var(--text-soft);
}

.student-selector,
.knowledge-toolbar select,
.knowledge-toolbar input,
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="date"],
.form-row select,
input[type="file"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.78);
  color: var(--text);
  padding: 10px 14px;
  font: inherit;
}

.student-selector {
  min-width: 210px;
}

.topbar-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  padding: 0 18px;
  background: rgba(255,255,255,0.72);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(54, 41, 23, 0.08);
}

.btn-accent,
.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff6f1;
}

.btn-accent:hover,
.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-ghost {
  background: rgba(255,255,255,0.4);
}

.btn-muted {
  background: #f5efe4;
}

.btn-danger {
  border-color: rgba(142, 52, 24, 0.28);
  background: rgba(178, 74, 43, 0.08);
  color: var(--accent-deep);
}

.btn-danger:hover {
  background: rgba(178, 74, 43, 0.16);
}

.btn-outline {
  background: transparent;
}

.btn-sm,
.btn-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.44), rgba(255,255,255,0.16)),
    linear-gradient(90deg, rgba(178, 74, 43, 0.08), rgba(70, 107, 87, 0.08));
}

.hero-copy p {
  margin: 10px 0 0;
  max-width: 640px;
  color: var(--text-soft);
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(49, 45, 37, 0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.52);
  color: var(--text-soft);
  font-size: 12px;
}

.hero-metrics {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-metric {
  min-width: 180px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.48);
}

.hero-metric-label {
  display: block;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.hero-metric-live {
  background: linear-gradient(180deg, rgba(178, 74, 43, 0.12), rgba(255,255,255,0.52));
}

.tabs {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.42);
  overflow-x: auto;
}

.tab {
  flex: 0 0 auto;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.tab.active {
  color: var(--text);
  background: rgba(255,255,255,0.85);
  box-shadow: inset 0 0 0 1px rgba(49,45,37,0.08);
}

.tab-content {
  display: none;
  margin-top: 20px;
}

.tab-content.active {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.panel,
.knowledge-detail,
.subject-nav-wrap {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.panel-full {
  grid-column: 1 / -1;
}

.panel-wide {
  grid-column: span 2;
}

.panel-hero {
  background:
    linear-gradient(135deg, rgba(178, 74, 43, 0.08), transparent 45%),
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(249,243,235,0.92));
}

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

.panel-head.compact {
  margin-bottom: 12px;
}

.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-head h2,
.panel-head h3 {
  margin: 6px 0 0;
  font-family: "Noto Serif SC", serif;
  font-size: 1.28rem;
  line-height: 1.2;
  font-weight: 700;
}

.student-meta {
  color: var(--text-soft);
  margin-top: -4px;
}

.student-note {
  margin-top: 14px;
  min-height: 24px;
  color: var(--text-soft);
  font-size: 14px;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.stat-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.5);
}

.stat-value {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--accent-deep);
}

.stat-label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-soft);
}

.subject-rings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 14px;
}

.ring-item {
  padding: 12px 10px;
  border-radius: 16px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(49, 45, 37, 0.06);
  text-align: center;
}

.ring-item canvas {
  display: block;
  margin: 0 auto;
}

.ring-label {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-soft);
}

.empty-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 160px;
  padding: 20px;
  border: 1px dashed rgba(49, 45, 37, 0.18);
  border-radius: 16px;
  background: rgba(255,255,255,0.3);
}

.empty-panel strong {
  font-family: "Noto Serif SC", serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.target-gauge,
.week-progress {
  min-height: 188px;
}

.empty-state,
.status-text,
.support-text,
.meta-text {
  color: var(--text-soft);
}

.status-text {
  font-size: 13px;
}

.status-text.ok {
  color: var(--ok);
}

.status-text.warn {
  color: var(--warn);
}

.status-text.error {
  color: var(--accent);
}

.metric-stack {
  text-align: center;
}

.metric-stack .metric-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.metric-stack .metric-label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-soft);
}

.knowledge-module {
  margin-bottom: 18px;
}

.knowledge-module h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-soft);
  letter-spacing: 0.08em;
}

.weak-list,
.assess-list,
.plan-list,
.knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.weak-item,
.kp-row,
.assess-row,
.plan-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(49,45,37,0.08);
  border-radius: 16px;
  background: rgba(255,255,255,0.58);
}

.weak-item {
  justify-content: space-between;
}

.kp-row {
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.kp-row:hover {
  transform: translateX(2px);
  box-shadow: 0 10px 18px rgba(54, 41, 23, 0.07);
  border-color: rgba(178, 74, 43, 0.22);
}

.weak-subject,
.kp-subject-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
  white-space: nowrap;
}

.weak-name,
.kp-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}

.kp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-soft);
  font-size: 12px;
}

.weak-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.level-掌握 {
  background: rgba(70, 107, 87, 0.14);
  color: #33503f;
}

.level-易错 {
  background: rgba(166, 117, 33, 0.18);
  color: #7d5919;
}

.level-了解 {
  background: rgba(83, 114, 154, 0.15);
  color: #3c587b;
}

.level-未学 {
  background: rgba(106, 100, 88, 0.12);
  color: #5d564b;
}

.subject-语文 { background: #b44b3e; }
.subject-数学 { background: #3f628f; }
.subject-英语 { background: #4f7758; }
.subject-物理 { background: #685b91; }
.subject-化学 { background: #467777; }
.subject-道法 { background: #9a6134; }
.subject-历史 { background: #8a533a; }
.subject-体育 { background: #5d7b3f; }
.subject-跨学科 { background: #4d565f; }

.knowledge-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  min-height: 64vh;
}

.subject-nav-wrap {
  padding: 18px;
}

.subject-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subject-nav-btn {
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.subject-nav-btn:hover {
  background: rgba(255,255,255,0.55);
}

.subject-nav-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff8f3;
}

.knowledge-detail {
  padding: 20px;
}

.knowledge-toolbar {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.form-row {
  margin-bottom: 14px;
}

.form-row label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  color: var(--text-soft);
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.assess-layout,
.plan-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.stacked-panels {
  display: grid;
  gap: 16px;
}

.subpanel {
  padding: 18px;
  border: 1px solid rgba(49,45,37,0.08);
  border-radius: 18px;
  background: rgba(255,255,255,0.42);
}

.subpanel-contrast {
  background: linear-gradient(180deg, rgba(31,42,42,0.98), rgba(37,49,49,0.98));
  border-color: rgba(245, 239, 228, 0.08);
  color: var(--text-inverse);
}

.subpanel-contrast .panel-kicker,
.subpanel-contrast .panel-head h3,
.subpanel-contrast label {
  color: var(--text-inverse);
}

.subpanel-contrast .form-row input[type="text"],
.subpanel-contrast .form-row input[type="number"],
.subpanel-contrast .form-row input[type="date"],
.subpanel-contrast .form-row select,
.subpanel-contrast input[type="file"] {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.14);
  color: var(--text-inverse);
}

.status-block,
.results-block {
  margin-top: 14px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 22, 20, 0.42);
  z-index: 1000;
}

.modal {
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #f9f4ec;
  box-shadow: 0 24px 70px rgba(24, 22, 20, 0.22);
}

.modal-wide {
  width: min(760px, 100%);
}

.modal h3 {
  margin: 0 0 18px;
  font-family: "Noto Serif SC", serif;
  font-size: 1.35rem;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.target-gauge,
.week-progress {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.gauge-circle {
  display: inline-block;
  margin: 12px 0;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(49,45,37,0.12);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
}

.progress-fill.green { background: var(--ok); }
.progress-fill.yellow { background: var(--warn); }
.progress-fill.red { background: var(--accent); }

.history-chart {
  margin-top: 12px;
}

.assess-meta,
.plan-meta {
  font-size: 12px;
  color: var(--text-soft);
}

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

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

th, td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(49,45,37,0.1);
  text-align: left;
  font-size: 13px;
}

@media (max-width: 1080px) {
  .dashboard-grid,
  .assess-layout,
  .plan-layout,
  .knowledge-layout {
    grid-template-columns: 1fr;
  }

  .panel-wide {
    grid-column: span 1;
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 18px 14px 28px;
  }

  .topbar,
  .hero-strip {
    padding: 18px;
  }

  .topbar,
  .hero-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions,
  .hero-metrics {
    justify-content: stretch;
  }

  .hero-metric {
    min-width: 0;
    flex: 1 1 180px;
  }

  .quick-stats,
  .form-row-2col,
  .knowledge-toolbar {
    grid-template-columns: 1fr;
  }

  .subject-nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .subject-nav-btn {
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  .brand-line {
    gap: 8px;
  }

  .panel-actions {
    width: 100%;
  }

  .quick-stats {
    grid-template-columns: 1fr;
  }

  .weak-item,
  .kp-row,
  .assess-row,
  .plan-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .modal {
    padding: 20px;
  }
}
