.analytics-page {
  width: min(1760px, 100%);
  padding: 24px 28px 72px;
}

.analytics-hero,
.analytics-panel,
.analytics-metrics .metric-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(33, 44, 37, 0.1);
}

.analytics-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px;
}

.analytics-hero h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.08;
}

.analytics-hero p:not(.eyebrow) {
  max-width: 900px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.analytics-actions,
.panel-head,
.map-toolbar,
.student-name,
.status-pill,
.student-path-preview,
.student-profile-head,
.file-card,
.teacher-actions {
  display: flex;
  align-items: center;
}

.analytics-actions,
.map-toolbar,
.teacher-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.analytics-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.analytics-metrics .metric-card {
  min-height: 112px;
  padding: 18px;
}

.analytics-metrics strong {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.analytics-metrics span {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.analytics-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.55fr);
  gap: 18px;
  margin-top: 18px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.analytics-panel {
  margin-top: 18px;
  padding: 22px;
}

.analytics-layout .analytics-panel {
  margin-top: 0;
}

.panel-head {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.compact-tabs button,
.map-toolbar select,
.panel-head select {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 13px;
}

.map-shell {
  height: 690px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f5f0;
  overflow: hidden;
}

#analyticsMap {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#analyticsMap:active {
  cursor: grabbing;
}

.map-link,
.graph-link {
  fill: none;
  stroke: rgba(23, 32, 27, 0.14);
  stroke-width: 1;
}

.graph-link.is-background {
  stroke: rgba(67, 103, 89, 0.68);
  stroke-width: 0.48;
  stroke-opacity: 0.14;
}

.graph-node {
  cursor: pointer;
}

.graph-dot {
  fill: var(--node-fill, #2f725f);
  stroke: #fff;
  stroke-width: 2.6;
  filter: drop-shadow(0 2px 6px rgba(26, 47, 60, 0.15));
}

.graph-node.is-route-node .graph-dot {
  fill: #b4862e;
  stroke: #fff;
  stroke-width: 3;
}

.graph-square,
.graph-diamond {
  stroke-width: 2.4;
}

.student-route {
  fill: none;
  stroke-width: 1.05;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.32;
  filter: none;
}

.student-route.is-selected {
  stroke-width: 1.05;
  opacity: 0.32;
  filter: none;
}

.student-route.is-hidden {
  display: none;
}

.node-label,
.graph-label {
  fill: var(--label-ink);
  paint-order: stroke;
  stroke: var(--label-halo);
  stroke-width: 4px;
  stroke-linejoin: round;
  font-weight: 700;
  dominant-baseline: middle;
  pointer-events: none;
}

.graph-label {
  font-weight: 300;
}

.graph-label.is-path {
  font-weight: 900;
  fill: #5f4415;
}

.student-toggle-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.route-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.route-toggle span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--route-color);
  opacity: 0.42;
}

.route-toggle.is-active {
  color: #fff;
  background: var(--route-color);
  border-color: var(--route-color);
}

.route-toggle.is-active span {
  background: #fff;
  opacity: 0.9;
}

.route-toggle.is-selected {
  box-shadow: 0 0 0 3px rgba(31, 111, 85, 0.14);
}

.detail-panel {
  align-self: start;
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 108px);
  overflow: auto;
}

.student-profile-head {
  gap: 12px;
  margin-bottom: 16px;
}

.student-profile-head h3 {
  margin: 0;
  font-size: 22px;
}

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

.student-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.detail-block {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-block h4 {
  margin: 0 0 10px;
  font-size: 16px;
}

.detail-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.tag-row,
.student-path-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-row span,
.unit-chip {
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--green-dark);
  background: rgba(31, 111, 85, 0.09);
  font-size: 12px;
  font-weight: 800;
}

.chat-log {
  display: grid;
  gap: 10px;
}

.chat-message {
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--surface-2);
}

.chat-message.is-ai {
  background: rgba(39, 93, 140, 0.09);
}

.chat-message strong {
  display: block;
  margin-bottom: 5px;
  color: var(--green-dark);
  font-size: 13px;
}

.chat-message p {
  margin: 0;
  color: var(--ink);
}

.analytics-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.analytics-table-wrap table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  background: #fff;
}

.analytics-table-wrap th,
.analytics-table-wrap td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.analytics-table-wrap th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
}

.student-name {
  gap: 9px;
}

.progress-track {
  width: 120px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: #e8ece7;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.status-pill {
  width: max-content;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(31, 111, 85, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.is-warning {
  color: var(--red);
  background: rgba(157, 63, 53, 0.11);
}

.inline-action {
  min-height: 30px;
  padding: 5px 9px;
  color: var(--green-dark);
  background: rgba(31, 111, 85, 0.08);
  border: 1px solid rgba(31, 111, 85, 0.16);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.assignment-list {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
}

.assignment-list button {
  display: block;
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.assignment-list button.is-active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 111, 85, 0.1);
}

.assignment-list strong,
.assignment-list span {
  display: block;
}

.assignment-list span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.file-card {
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.file-card strong,
.file-card span {
  display: block;
}

.file-card span {
  margin-top: 5px;
  color: var(--muted);
}

.review-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.review-form label {
  display: grid;
  gap: 6px;
}

.review-form input,
.review-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.bar-list,
.insight-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 12px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e7ece7;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.insight-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.insight-item strong {
  display: block;
  margin-bottom: 6px;
}

.insight-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.report-panel {
  margin-top: 18px;
}

#reportStamp {
  color: var(--muted);
  font-size: 13px;
}

.report-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.report-section h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.report-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 1260px) {
  .analytics-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-layout,
  .analytics-grid,
  .report-body {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .analytics-page {
    padding: 16px 14px 48px;
  }

  .analytics-hero,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .analytics-metrics {
    grid-template-columns: 1fr;
  }

  .map-shell {
    height: 540px;
  }

  .bar-row {
    grid-template-columns: 86px minmax(0, 1fr) 46px;
  }
}
