:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #fbfaff;
  --ink: #17131f;
  --muted: #686374;
  --line: #e7e3ef;
  --purple: #4f2683;
  --purple-2: #27184f;
  --purple-3: #6d48b4;
  --purple-soft: #f0ebfb;
  --black: #111111;
  --german-red: #dd0000;
  --gold: #ffce00;
  --gold-soft: #fff7d3;
  --green: #16724f;
  --green-soft: #e8f4ee;
  --red-soft: #fff0f0;
  --shadow: 0 12px 34px rgba(39, 24, 79, 0.09);
  --shadow-soft: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 10px 24px rgba(39, 24, 79, 0.06);
  --radius: 8px;
  --sidebar: 256px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0, #f5f2fb 470px, var(--bg) 100%),
    linear-gradient(90deg, rgba(79, 38, 131, 0.08), transparent 30%);
  letter-spacing: 0;
  font-size: 14px;
}

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

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100svh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100svh;
  overflow: hidden;
  padding: 24px 16px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 34%),
    linear-gradient(180deg, #4b2e83 0%, #2a1857 58%, #201442 100%);
  border-right: 1px solid rgba(39, 24, 79, 0.12);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--black) 0 34%, var(--german-red) 34% 67%, var(--gold) 67% 100%);
}

.sidebar > * {
  position: relative;
}

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

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  color: #fff;
  background: var(--purple);
  border-radius: var(--radius);
  font-weight: 900;
}

.brand-mark {
  width: 44px;
  height: 44px;
  background: linear-gradient(145deg, #7653bd, var(--purple));
  border: 1px solid rgba(255, 206, 0, 0.8);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.18);
  font-family: "Songti SC", serif;
  font-size: 24px;
}

.brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 23px;
  line-height: 1;
}

.brand span,
.course-card small,
.sidebar-foot small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 760;
}

.flag-strip,
.german-mark {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  height: 5px;
  border-radius: 999px;
}

.flag-strip span:nth-child(1),
.german-mark span:nth-child(1) {
  background: var(--black);
}

.flag-strip span:nth-child(2),
.german-mark span:nth-child(2) {
  background: var(--german-red);
}

.flag-strip span:nth-child(3),
.german-mark span:nth-child(3) {
  background: var(--gold);
}

.course-card,
.sidebar-foot {
  display: grid;
  gap: 7px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

.course-card span {
  width: fit-content;
  padding: 4px 8px;
  color: #211800;
  background: var(--gold);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

.course-card strong {
  font-size: 16px;
  line-height: 1.45;
}

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

.main-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 820;
  text-align: left;
}

.main-nav button:hover,
.main-nav button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 3px 0 0 var(--gold), 0 10px 22px rgba(0, 0, 0, 0.1);
}

.main-nav svg {
  color: var(--gold);
  font-size: 18px;
}

.sidebar-foot {
  margin-top: auto;
}

.sidebar-foot strong {
  font-size: 30px;
}

.main,
.student-shell {
  min-width: 0;
  padding: 24px;
}

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

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 25px;
  line-height: 1.22;
}

h3 {
  margin-bottom: 0;
  font-size: 17px;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.topbar-actions,
.role-switch,
.panel-heading,
.section-heading,
.profile-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-input,
input,
select,
textarea {
  min-height: 42px;
  width: 100%;
  padding: 9px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  font-size: 13px;
  box-shadow: var(--shadow-soft);
}

.search-input {
  width: min(330px, 28vw);
}

textarea {
  resize: vertical;
}

.role-switch {
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.account-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  color: var(--purple);
  background: var(--purple-soft);
  border: 1px solid #ddd3f1;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 860;
  white-space: nowrap;
}

.role-switch button,
.segmented button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 860;
}

.role-switch button.active,
.segmented button.active {
  color: #fff;
  background: linear-gradient(180deg, var(--purple-3), var(--purple));
}

.primary-button,
.ghost-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 860;
  white-space: nowrap;
}

.primary-button {
  color: #fff;
  background: linear-gradient(180deg, var(--purple-3), var(--purple));
  border: 1px solid var(--purple);
  box-shadow: 0 12px 22px rgba(75, 46, 131, 0.18);
}

.ghost-button {
  color: var(--purple);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.text-button {
  color: var(--purple);
  background: transparent;
  border: 0;
}

.danger-text {
  color: var(--german-red);
}

.hero-panel,
.student-hero,
.panel,
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.hero-panel,
.student-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  padding: 18px 20px;
}

.admin-hero {
  border-left: 4px solid var(--purple);
  background:
    linear-gradient(90deg, rgba(79, 38, 131, 0.06), transparent 38%),
    #fff;
}

.hero-panel p,
.student-hero p {
  margin-bottom: 5px;
  color: var(--purple);
  font-weight: 860;
}

.hero-panel h2,
.student-hero h2 {
  margin-bottom: 0;
}

.german-mark {
  width: 160px;
  height: 12px;
}

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

.kpi-card {
  display: grid;
  gap: 10px;
  min-height: 112px;
  padding: 15px;
  border-top: 3px solid rgba(79, 38, 131, 0.18);
}

.kpi-card span,
.kpi-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.kpi-card strong {
  font-size: 32px;
  line-height: 1;
}

.kpi-card.danger {
  border-color: rgba(221, 0, 0, 0.22);
  border-top-color: rgba(221, 0, 0, 0.5);
}

.dashboard-grid,
.split-grid,
.student-grid,
.profile-layout {
  display: grid;
  gap: 14px;
  align-items: start;
}

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

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

.split-grid.wide-left {
  grid-template-columns: 390px minmax(0, 1fr);
}

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

.stack {
  display: grid;
  gap: 14px;
}

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

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading p {
  margin: 5px 0 0;
  font-size: 13px;
}

.panel-heading span,
.german-chip {
  color: var(--purple);
  background: var(--purple-soft);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 860;
  border: 1px solid #e1d8f4;
}

.schedule-grid,
.task-list,
.compact-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.course-tile {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--black);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.course-tile.today {
  border-left-color: var(--german-red);
  background: linear-gradient(90deg, #fff8fb, #fff);
}

.course-tile:hover {
  transform: translateY(-1px);
  border-color: #d9d1e8;
  box-shadow: 0 10px 20px rgba(39, 24, 79, 0.07);
}

.course-date {
  display: grid;
  gap: 3px;
  text-align: center;
}

.course-date strong {
  color: var(--purple);
  font-size: 14px;
}

.course-date span,
.course-tile small,
small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.course-tile h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.course-tile p {
  margin: 0 0 3px;
  font-size: 12px;
}

.status,
.compact-list em,
.task-list em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 0;
  font-size: 12px;
  font-style: normal;
  font-weight: 860;
}

.status.ok,
.compact-list .ok {
  color: var(--green);
  background: var(--green-soft);
}

.status.warn,
.compact-list .warn,
.task-list em {
  color: #7c5900;
  background: var(--gold-soft);
}

.status.danger,
.compact-list .danger {
  color: var(--german-red);
  background: var(--red-soft);
}

.attendance-summary {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.donut {
  display: grid;
  place-items: center;
  width: 134px;
  height: 134px;
  background: conic-gradient(var(--purple) 0 82%, #ece8f4 82% 100%);
  border-radius: 50%;
}

.donut strong,
.donut span {
  grid-area: 1 / 1;
}

.donut span {
  margin-top: 45px;
  color: var(--muted);
  font-size: 12px;
}

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

.summary-list span {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-soft);
}

.summary-list b {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.compact-list li,
.task-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.compact-list button,
.student-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  text-align: left;
}

.compact-list strong,
.task-list strong,
.student-cell strong {
  display: block;
  font-size: 13px;
}

.compact-list small,
.task-list span,
.student-cell small {
  overflow: hidden;
  max-width: 260px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar.large {
  width: 68px;
  height: 68px;
  margin-bottom: 12px;
  font-size: 24px;
}

.selected-card .profile-mini {
  margin-bottom: 12px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 13px 0;
}

.profile-stats div {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.profile-stats strong {
  display: block;
  font-size: 22px;
}

.profile-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.note-box {
  margin: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #34303d;
  font-size: 13px;
  box-shadow: var(--shadow-soft);
}

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

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

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

.data-table th {
  color: var(--muted);
  background: #fbfaff;
  font-size: 12px;
  font-weight: 900;
}

.data-table tr.selected,
.data-table tr:hover {
  background: #faf7ff;
}

.progress {
  overflow: hidden;
  width: 120px;
  height: 8px;
  background: #ece8f4;
  border-radius: 999px;
}

.progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--purple-3));
  border-radius: inherit;
}

.form-panel {
  display: grid;
  gap: 11px;
}

.form-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 860;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.segmented.small button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.profile-panel {
  text-align: center;
}

.skill-bars {
  display: grid;
  gap: 11px;
}

.skill-bars div {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
}

.skill-bars label,
.skill-bars b {
  color: var(--muted);
  font-size: 12px;
  font-weight: 860;
}

.skill-bars span {
  overflow: hidden;
  height: 10px;
  background: #ece8f4;
  border-radius: 999px;
}

.skill-bars i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--purple), #8066bf);
  border-radius: inherit;
}

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

.timeline article {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.timeline article:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.timeline time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 860;
}

.timeline strong {
  font-size: 13px;
}

.timeline p {
  margin: 4px 0 0;
  font-size: 13px;
}

.student-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.student-hero {
  color: #fff;
  background:
    linear-gradient(90deg, var(--purple) 0 70%, #111 70% 80%, var(--german-red) 80% 90%, var(--gold) 90% 100%);
  border: 0;
  box-shadow: 0 18px 46px rgba(39, 24, 79, 0.16);
}

.student-hero p,
.student-hero span {
  color: rgba(255, 255, 255, 0.82);
}

.student-hero h2 {
  color: #fff;
}

.student-hero .primary-button {
  color: var(--purple);
  background: #fff;
  border-color: #fff;
}

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

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

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  transform: translateY(12px);
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 14px;
  color: #fff;
  background: var(--purple-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  font-size: 13px;
  font-weight: 820;
}

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

@media (max-width: 1120px) {
  .admin-shell {
    grid-template-columns: 228px minmax(0, 1fr);
  }

  .dashboard-grid,
  .split-grid,
  .split-grid.wide-left,
  .student-grid,
  .profile-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 820px) {
  .admin-shell {
    display: block;
  }

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

  .main-nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .main-nav button {
    flex: 0 0 auto;
  }

  .sidebar-foot {
    display: none;
  }

  .main,
  .student-shell {
    padding: 16px;
  }

  .topbar,
  .hero-panel,
  .student-hero,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .search-input {
    width: 100%;
  }

  .course-tile {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .course-tile .status {
    grid-column: 1 / -1;
    width: fit-content;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 24px;
  }

  .kpi-grid,
  .student-kpis,
  .profile-stats,
  .summary-list {
    grid-template-columns: 1fr;
  }

  .attendance-summary {
    grid-template-columns: 1fr;
  }

  .timeline article,
  .skill-bars div {
    grid-template-columns: 1fr;
  }

  .progress {
    width: 100%;
  }
}
