:root {
  /* 文字 */
  --ink: #26222D;
  --ink-soft: #5F5968;
  --muted: #8A8496;
  /* 底色 */
  --bg: #FBF9F4;
  --surface: #FFFFFF;
  --surface-soft: #F7F3FF;
  --line: #EFEAF7;
  --line-strong: #DED8E7;
  /* 主色：紫 */
  --primary: #6C3FF5;
  --primary-l: #A98CFF;
  --primary-soft: #F2EEFF;
  /* 辅助色 */
  --pink: #EF2FC2;
  --pink-soft: #FFE4F5;
  --blue: #3D8BFF;
  --blue-soft: #E6F0FF;
  --green: #17A673;
  --green-soft: #DDF8EC;
  --cyan: #2CB5BC;
  --cyan-soft: #E1F8F8;
  --yellow: #C79A00;
  --yellow-soft: #FFF1B8;
  --orange: #E85D24;
  --orange-soft: #FFE9DE;
  --red: #E23A56;
  --red-soft: #FFE7EC;
  /* 圆角与投影 */
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --shadow-s: 0 4px 14px rgba(54, 40, 84, 0.06);
  --shadow: 0 14px 34px rgba(54, 40, 84, 0.10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
tr[tabindex]:focus-visible {
  outline: 3px solid rgba(108, 63, 245, 0.28);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 12% -10%, #F3EAFF 0%, rgba(243, 234, 255, 0) 62%),
    radial-gradient(900px 480px at 92% 8%, #FFE9F6 0%, rgba(255, 233, 246, 0) 58%),
    linear-gradient(180deg, #FFF8E4 0%, #FBF9F4 46%, #F4F7FF 100%);
}

.auth-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 14px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(108, 63, 245, 0.28);
  font-size: 20px;
  font-weight: 800;
}

.eyebrow {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.auth-card h1 {
  font-size: 26px;
  line-height: 1.2;
}

.auth-copy {
  margin-top: 24px;
  color: var(--ink-soft);
}

.auth-form {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.auth-form label {
  font-size: 13px;
  font-weight: 650;
}

.auth-form input,
.filter-control {
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  background: var(--surface-soft);
  color: var(--ink);
}

.auth-form input:focus,
.filter-control:focus {
  border-color: var(--primary-l);
  background: var(--surface);
  outline: 3px solid rgba(108, 63, 245, 0.14);
}

.form-error {
  min-height: 20px;
  color: var(--red);
  font-size: 12px;
}

.auth-hint {
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
}

.button {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-m);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease, color 120ms ease, transform 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(108, 63, 245, 0.26);
}

.button-primary:hover {
  background: #5B2FE0;
  box-shadow: 0 10px 22px rgba(108, 63, 245, 0.32);
}

.button-secondary {
  color: var(--ink-soft);
  background: var(--surface-soft);
}

.button-secondary:hover,
.button-quiet:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.button-quiet {
  color: var(--ink-soft);
}

.button-block {
  width: 100%;
  min-height: 42px;
}

.admin-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 20px rgba(54, 40, 84, 0.06);
  backdrop-filter: blur(10px);
}

.brand-block-compact .brand-mark {
  width: 34px;
  height: 34px;
  font-size: 16px;
}

.brand-block-compact div {
  display: grid;
  line-height: 1.2;
}

.brand-block-compact strong {
  font-size: 14px;
}

.brand-block-compact span:last-child {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.topbar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-identity {
  max-width: 180px;
  margin-right: 4px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.updated-at {
  margin-right: 6px;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.side-nav {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  padding: 18px 12px;
  background: var(--surface);
  box-shadow: 6px 0 20px rgba(54, 40, 84, 0.05);
}

.nav-item {
  width: 100%;
  display: grid;
  gap: 1px;
  margin-bottom: 4px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-m);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.nav-item span {
  font-weight: 650;
}

.nav-item small {
  color: var(--muted);
  font-size: 11px;
}

.nav-item:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-item.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-item.is-active small {
  color: #8A6BE8;
}

.content {
  width: 100%;
  max-width: 1480px;
  min-width: 0;
  padding: 26px 28px 48px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.page-head h2 {
  font-size: 23px;
  line-height: 1.2;
}

.page-head p {
  margin-top: 5px;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.metric-card {
  position: relative;
  min-width: 0;
  padding: 18px 16px 15px;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.metric-card::before {
  position: absolute;
  top: 13px;
  left: 16px;
  width: 34px;
  height: 4px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
}

.metric-card[data-tone="green"]::before {
  background: var(--green);
}

.metric-card[data-tone="cyan"]::before {
  background: var(--cyan);
}

.metric-card[data-tone="orange"]::before {
  background: var(--orange);
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 14px;
}

.surface {
  min-width: 0;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.surface-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
}

.surface-header h3 {
  font-size: 15px;
}

.surface-header span {
  color: var(--muted);
  font-size: 11px;
}

.trend-chart {
  min-height: 238px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  padding: 20px 18px 16px;
}

.trend-day {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
}

.trend-bars {
  height: 154px;
  display: flex;
  align-items: end;
  gap: 3px;
}

.trend-bar {
  width: 9px;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--cyan);
}

.trend-bar-assignment {
  background: var(--orange);
}

.trend-count {
  color: var(--ink-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.trend-label {
  color: var(--muted);
  font-size: 11px;
}

.legend {
  display: flex;
  gap: 14px;
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 11px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--cyan);
}

.legend-dot-assignment {
  background: var(--orange);
}

.activity-list {
  margin: 0;
  padding: 4px 17px 8px;
  list-style: none;
}

.activity-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
}

.activity-dot.assignment {
  background: var(--orange);
}

.activity-dot.class {
  background: var(--green);
}

.activity-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.filter-form {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-field {
  display: grid;
  gap: 5px;
}

.filter-field label {
  color: var(--muted);
  font-size: 11px;
}

.filter-search {
  width: min(300px, 42vw);
}

.filter-select {
  width: 132px;
}

.table-surface {
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

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

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  table-layout: auto;
}

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

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

tbody tr {
  transition: background-color 100ms ease;
}

tbody tr[tabindex] {
  cursor: pointer;
}

tbody tr:hover {
  background: var(--primary-soft);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.primary-cell {
  min-width: 180px;
}

.primary-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  color: #fff;
  background: var(--avatar-color, var(--green));
  font-size: 12px;
  font-weight: 700;
}

.primary-copy {
  min-width: 0;
}

.primary-copy strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-copy small {
  display: block;
  max-width: 260px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.number-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.chip {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.chip::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.chip-active,
.chip-published {
  color: var(--green);
  background: var(--green-soft);
}

.chip-expired {
  color: var(--orange);
  background: var(--orange-soft);
}

.chip-dissolved,
.chip-deleted {
  color: var(--red);
  background: var(--red-soft);
}

.progress {
  width: 120px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--primary-soft);
}

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

.progress-label {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 0 0 var(--radius-l) var(--radius-l);
}

.page-info {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager-numbers {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pager-btn,
.pager-num {
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-s);
  color: var(--ink-soft);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.pager-btn:hover:not(:disabled),
.pager-num:hover:not(.is-current) {
  color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.pager-num.is-current {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 6px 14px rgba(108, 63, 245, 0.28);
}

.pager-btn:disabled {
  color: #C6C0D4;
  background: transparent;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.pager-ellipsis {
  min-width: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.empty-state,
.loading-state,
.error-state {
  min-height: 240px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 7px;
  padding: 32px;
  text-align: center;
}

.empty-state strong,
.error-state strong {
  font-size: 15px;
}

.empty-state span,
.loading-state span,
.error-state span {
  color: var(--muted);
  font-size: 12px;
}

.loading-line {
  width: 150px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebe9;
}

.loading-line::after {
  width: 50%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--primary);
  content: "";
  animation: loading 900ms ease-in-out infinite alternate;
}

@keyframes loading {
  from {
    transform: translateX(-10%);
  }
  to {
    transform: translateX(110%);
  }
}

.drawer-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(18, 30, 27, 0.38);
  cursor: default;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(520px, 100vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: -18px 0 50px rgba(54, 40, 84, 0.16);
  animation: drawer-in 180ms ease-out;
}

@keyframes drawer-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.drawer-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2 {
  font-size: 18px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.detail-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-hero .avatar {
  width: 46px;
  height: 46px;
  font-size: 16px;
}

.detail-hero h3 {
  font-size: 18px;
}

.detail-hero p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.detail-stat {
  padding: 13px;
  border: 0;
  border-radius: var(--radius-m);
  background: var(--primary-soft);
}

.detail-stat strong {
  display: block;
  font-size: 20px;
}

.detail-stat span {
  color: var(--muted);
  font-size: 11px;
}

.detail-section {
  margin-top: 22px;
}

.detail-section h3 {
  margin-bottom: 9px;
  font-size: 14px;
}

.detail-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 13px;
  border: 0;
  border-radius: var(--radius-m);
  background: var(--surface-soft);
}

.detail-list li > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-list small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.detail-note {
  padding: 13px;
  border: 0;
  border-left: 5px solid var(--cyan);
  border-radius: var(--radius-m);
  background: var(--cyan-soft);
  color: var(--ink-soft);
  font-size: 13px;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 15px;
  transform: translateX(-50%);
  border-radius: 6px;
  color: #fff;
  background: #322B47;
  box-shadow: 0 10px 28px rgba(54, 40, 84, 0.24);
  font-size: 13px;
}

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

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
    align-content: start;
  }

  .side-nav {
    position: static;
    height: auto;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-item {
    width: auto;
    min-width: 104px;
    margin: 0;
  }

  .content {
    padding: 22px 18px 40px;
  }

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

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
  }

  .side-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
    padding: 8px;
  }

  .nav-item {
    min-width: 0;
    padding: 8px 5px;
    text-align: center;
  }

  .nav-item small {
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .updated-at {
    display: none;
  }

  .admin-identity {
    max-width: 78px;
    margin-right: 0;
  }

  .content {
    padding: 18px 12px 36px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

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

  .metric-card strong {
    font-size: 22px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-form {
    align-items: stretch;
  }

  .filter-field,
  .filter-search,
  .filter-select {
    width: 100%;
  }

  .trend-chart {
    gap: 4px;
    padding-inline: 10px;
  }

  .trend-bar {
    width: 7px;
  }

  .activity-item {
    grid-template-columns: 8px minmax(0, 1fr);
  }

  .activity-time {
    display: none;
  }

  .table-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-card {
    padding: 24px;
  }
}
