:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --ink: #172033;
  --muted: #657083;
  --line: #dbe3ee;
  --blue: #176bff;
  --blue-soft: #e8f1ff;
  --teal: #00a88b;
  --teal-soft: #e3f7f2;
  --violet: #6e56cf;
  --violet-soft: #f0edff;
  --amber: #f5a524;
  --amber-soft: #fff3d8;
  --red: #dc3545;
  --red-soft: #ffe9ec;
  --green: #16a34a;
  --shadow: 0 12px 30px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #111827;
  color: #f9fafb;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
}

.brand-subtitle {
  color: #aeb8c7;
  font-size: 13px;
  line-height: 1.35;
}

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

.nav-button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d8dee9;
  padding: 12px 12px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 800;
  font-size: 13px;
}

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

.topbar {
  min-height: 74px;
  background: rgba(246, 248, 251, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  display: grid;
  gap: 2px;
  min-width: 220px;
}

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

.topbar-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-controls select {
  width: auto;
  min-width: 180px;
}

.topbar-controls .btn {
  white-space: nowrap;
}

.content {
  padding: 24px 28px 40px;
  display: grid;
  gap: 18px;
}

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

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

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

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

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel.flush {
  padding: 0;
  overflow: hidden;
}

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

.section-header h2,
.section-header h3 {
  margin: 0;
}

.section-header h2 {
  font-size: 22px;
}

.section-header h3 {
  font-size: 18px;
}

.section-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 108px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.metric-value {
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
}

.metric-value.blue {
  color: var(--blue);
}

.metric-value.teal {
  color: var(--teal);
}

.metric-value.violet {
  color: var(--violet);
}

.metric-value.amber {
  color: var(--amber);
}

.small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

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

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

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

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 107, 255, 0.12);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
}

.btn:hover {
  border-color: #b8c4d4;
}

.btn.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.btn.teal {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: #ffc8d0;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.tag.teal {
  color: var(--teal);
  background: var(--teal-soft);
}

.tag.violet {
  color: var(--violet);
  background: var(--violet-soft);
}

.tag.amber {
  color: #9a6500;
  background: var(--amber-soft);
}

.tag.red {
  color: var(--red);
  background: var(--red-soft);
}

.student-list {
  display: grid;
}

.student-row {
  border-top: 1px solid var(--line);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 110px 130px 124px;
  gap: 12px;
  align-items: center;
}

.student-row:first-child {
  border-top: 0;
}

.student-row:hover {
  background: #fbfcfe;
}

.row-title {
  font-weight: 800;
}

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

.route-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  min-height: 126px;
}

.route-step strong {
  display: block;
  margin-bottom: 8px;
}

.route-step.current {
  border-color: var(--blue);
  background: var(--blue-soft);
}

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

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

.task-item.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.task-title {
  font-weight: 800;
  margin-bottom: 4px;
}

.feedback-box {
  border-left: 5px solid var(--blue);
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  display: grid;
  gap: 8px;
}

.feedback-box.off-track {
  border-left-color: var(--amber);
}

.feedback-box.stuck {
  border-left-color: var(--red);
}

.feedback-box.ahead {
  border-left-color: var(--teal);
}

.split {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

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

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

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.empty {
  border: 1px dashed #b8c4d4;
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: #fff;
}

.toast-area {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 40;
}

.toast {
  width: min(360px, calc(100vw - 40px));
  border-radius: 8px;
  background: #111827;
  color: white;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  font-size: 14px;
}

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

  .sidebar {
    position: static;
  }

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

  .grid.two,
  .grid.three,
  .grid.four,
  .route-line,
  .split {
    grid-template-columns: 1fr;
  }

  .student-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-controls {
    justify-content: stretch;
  }

  .topbar-controls > * {
    flex: 1;
  }

  .content {
    padding: 18px 14px 32px;
  }

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

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