:root {
  --blue-950: #062b55;
  --blue-900: #003b78;
  --blue-800: #075093;
  --blue-700: #0b65b1;
  --blue-100: #eaf5ff;
  --cyan: #22a7b8;
  --green: #20a783;
  --amber: #f2a93b;
  --red: #d84d4d;
  --ink: #12233a;
  --muted: #68778a;
  --line: #e3eaf2;
  --page: #f3f7fb;
  --card: #ffffff;
  --shadow: 0 14px 36px rgba(12, 60, 107, .12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

body.sidebar-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

button,
a,
input,
select,
textarea {
  transition: border-color .2s ease, box-shadow .2s ease, color .2s ease, background-color .2s ease, transform .2s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(34, 167, 184, .32);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  background:
    linear-gradient(120deg, rgba(0, 59, 120, .92), rgba(5, 98, 155, .76)),
    url("./../prototype/assets/hero-education.svg") center / cover no-repeat;
}

.login-visual {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px min(6vw, 76px);
  color: #fff;
}

.login-brand,
.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.login-brand img,
.sidebar-brand img {
  width: 48px;
  height: 48px;
  background: #fff;
  border-radius: 50%;
}

.login-brand strong,
.login-brand small,
.sidebar-brand strong,
.sidebar-brand small {
  display: block;
}

.login-brand strong {
  font-size: 24px;
}

.login-brand small,
.sidebar-brand small {
  color: rgba(255, 255, 255, .72);
  margin-top: 3px;
}

.login-visual__content {
  max-width: 720px;
  padding-bottom: 60px;
}

.login-visual__content span {
  color: #b8ecff;
  font-weight: 800;
  letter-spacing: .08em;
}

.login-visual__content h1 {
  margin: 18px 0 14px;
  font-size: clamp(36px, 5vw, 62px);
  line-height: 1.12;
}

.login-visual__content p {
  max-width: 620px;
  color: rgba(255, 255, 255, .78);
  font-size: 17px;
}

.login-card {
  align-self: center;
  margin-right: min(6vw, 76px);
  padding: 34px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: var(--radius);
  box-shadow: 0 28px 80px rgba(0, 35, 76, .24);
}

.login-card h2 {
  margin: 0 0 8px;
  color: var(--blue-900);
  font-size: 28px;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

label span {
  display: block;
  margin-bottom: 7px;
  color: #34485f;
  font-weight: 700;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d7e3ef;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

input,
select {
  height: 40px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 3px rgba(11, 101, 177, .12);
}

.login-card label {
  display: block;
  margin-top: 16px;
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.check {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  margin: 0 !important;
}

.check input {
  width: 15px;
  height: 15px;
}

.primary-button,
.ghost-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-button {
  width: auto;
  color: #fff;
  border: 1px solid var(--blue-800);
  background: linear-gradient(135deg, var(--blue-800), var(--blue-700));
}

.login-card .primary-button {
  width: 100%;
}

.ghost-button {
  color: var(--blue-800);
  border: 1px solid #cfe0ef;
  background: #fff;
}

.primary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled),
.table-actions button:hover:not(:disabled),
.table-actions a:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(12, 60, 107, .12);
}

.primary-button:active:not(:disabled),
.ghost-button:active:not(:disabled),
.table-actions button:active:not(:disabled),
.table-actions a:active {
  transform: translateY(0);
}

.login-error {
  display: block;
  min-height: 18px;
  margin-top: 12px;
  color: var(--red);
}

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

.sidebar {
  color: #dceeff;
  background: linear-gradient(180deg, #063764, #075093);
  padding: 18px 14px;
}

.sidebar-brand {
  min-height: 58px;
  padding: 0 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.sidebar-brand strong {
  color: #fff;
  font-size: 17px;
}

.sidebar-brand img {
  width: 42px;
  height: 42px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.sidebar-nav button {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: rgba(255, 255, 255, .82);
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
}

.sidebar-nav button:hover,
.sidebar-nav button.active {
  color: #fff;
  background: rgba(255, 255, 255, .12);
}

svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main-area {
  min-width: 0;
}

.admin-topbar {
  height: 70px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(12, 60, 107, .06);
}

.admin-topbar strong,
.admin-topbar small {
  display: block;
}

.admin-topbar strong {
  font-size: 20px;
}

.admin-topbar small {
  margin-top: 2px;
  color: var(--muted);
}

.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--blue-900);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.topbar-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
  display: block;
  width: min(28vw, 300px);
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 10px;
  color: #7890a6;
}

.search-box input {
  padding-left: 38px;
}

.avatar-button {
  width: 38px;
  height: 38px;
  color: #fff;
  border: 0;
  border-radius: 50%;
  background: var(--blue-800);
  font-weight: 900;
}

.api-status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid #d7e3ef;
  border-radius: 999px;
  color: #526579;
  background: #f7fbff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.api-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f2a93b;
}

.api-status.ok {
  color: #1f7d61;
  border-color: #bbe6d4;
  background: #f0fbf7;
}

.api-status.ok::before {
  background: #20a783;
}

.api-status.warn {
  color: #93630c;
  border-color: #f5d997;
  background: #fff9e8;
}

.api-status.warn::before {
  background: #f2a93b;
}

.content-area {
  padding: 22px 26px 34px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card,
.admin-panel,
.admin-table-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(12, 60, 107, .07);
}

.stat-card {
  min-height: 126px;
  padding: 20px;
  overflow: hidden;
  position: relative;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -32px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(11, 101, 177, .08);
}

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

.stat-card strong {
  display: block;
  margin: 10px 0 8px;
  color: var(--blue-900);
  font-size: 34px;
  line-height: 1;
}

.stat-card small {
  color: #557086;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr);
  gap: 16px;
  margin-top: 16px;
}

.admin-panel {
  padding: 18px;
}

.admin-panel.wide {
  grid-row: span 2;
}

.panel-head,
.module-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.panel-head h2,
.module-toolbar h1 {
  margin: 0;
  color: var(--blue-900);
}

.panel-head h2 {
  font-size: 18px;
}

.panel-head span,
.module-toolbar p {
  color: var(--muted);
  font-size: 13px;
}

.bar-chart {
  height: 280px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 18px;
  padding: 24px 12px 8px;
  background:
    linear-gradient(0deg, #edf4fb 1px, transparent 1px),
    linear-gradient(90deg, #edf4fb 1px, transparent 1px);
  background-size: 36px 36px;
  border-radius: 7px;
}

.bar-chart i {
  height: var(--h);
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #2aaed0, var(--blue-800));
}

.todo-list,
.status-list,
.api-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo-list li {
  padding: 13px 0;
  border-bottom: 1px solid #edf2f7;
}

.todo-list li:last-child {
  border-bottom: 0;
}

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

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

.status-list {
  display: grid;
  gap: 12px;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 7px;
  background: #f5f9fc;
}

.status-list em {
  color: var(--amber);
  font-style: normal;
  font-weight: 800;
}

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

.module-toolbar {
  margin-bottom: 16px;
}

.module-toolbar h1 {
  font-size: 26px;
}

.module-toolbar p {
  margin: 5px 0 0;
}

.admin-table-card {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #edf2f7;
  font-size: 14px;
}

tbody tr:hover {
  background: #fbfdff;
}

th {
  color: #526579;
  background: #f8fbfe;
  font-size: 13px;
}

td strong {
  display: block;
  color: #22364e;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: #1f7d61;
  background: #e7f8f2;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.pending {
  color: #93630c;
  background: #fff4d8;
}

.status-pill.draft,
.status-pill.disabled {
  color: #66758a;
  background: #edf2f7;
}

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

.table-actions button,
.table-actions a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  min-height: 30px;
  padding: 0 10px;
  color: var(--blue-800);
  border: 1px solid #d4e3f0;
  border-radius: 5px;
  background: #fff;
  font-weight: 700;
}

.table-actions button.danger {
  color: var(--red);
}

.table-actions button:disabled {
  color: #8b98a8;
  background: #f4f7fb;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  gap: 16px;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-form .primary-button {
  width: fit-content;
}

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

.api-list code {
  display: block;
  padding: 12px;
  border-radius: 6px;
  color: #0b4f86;
  background: #f0f7fd;
}

.record-dialog {
  width: min(920px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 28px 80px rgba(0, 35, 76, .28);
}

.record-dialog::backdrop {
  background: rgba(5, 25, 48, .52);
}

.record-dialog form {
  padding: 22px;
  max-height: min(86vh, 820px);
  overflow: auto;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dialog-head h2 {
  margin: 0;
  color: var(--blue-900);
}

.dialog-head button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #eef4fa;
  font-size: 24px;
}

.record-dialog label {
  display: block;
  margin-top: 14px;
}

.rich-editor-wrap {
  margin-top: 14px;
}

.rich-editor-wrap[hidden] {
  display: none;
}

.rich-editor-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.rich-editor-head span {
  color: #28455f;
  font-weight: 800;
}

.rich-editor-head small {
  color: var(--muted);
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid #d6e5f1;
  border-radius: 8px 8px 0 0;
  background: #f7fbff;
}

.rich-toolbar button,
.rich-toolbar select {
  min-height: 32px;
  border: 1px solid #c9dceb;
  border-radius: 6px;
  color: #153b5f;
  background: #fff;
  font-weight: 700;
}

.rich-toolbar button {
  padding: 0 10px;
}

.rich-toolbar select {
  padding: 0 8px;
}

.rich-editor {
  min-height: 260px;
  max-height: 430px;
  overflow: auto;
  padding: 18px;
  border: 1px solid #d6e5f1;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #fff;
  line-height: 1.8;
  outline: none;
}

.rich-editor:focus {
  border-color: #78aede;
  box-shadow: inset 0 0 0 1px #78aede;
}

.rich-editor:empty::before {
  content: "在这里编写正文，可像 Word 一样排版文字、插入图片。";
  color: #8a9bad;
}

.rich-editor h2,
.rich-editor h3,
.rich-editor p,
.rich-editor blockquote,
.rich-editor ul,
.rich-editor ol {
  margin: 0 0 12px;
}

.rich-editor h2 {
  color: var(--blue-900);
  font-size: 24px;
}

.rich-editor h3 {
  color: #173f66;
  font-size: 19px;
}

.rich-editor blockquote {
  padding: 10px 14px;
  border-left: 4px solid var(--blue-700);
  color: #35546f;
  background: #f4f9fd;
}

.rich-editor img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto;
  border-radius: 6px;
}

.rich-editor img.is-selected {
  outline: 3px solid rgba(11, 101, 177, .35);
  outline-offset: 3px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.muted-action {
  color: var(--muted);
  font-size: 13px;
}

.import-actions,
.import-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #f7fbff;
  border: 1px solid #dceaf5;
}

.import-actions {
  grid-template-columns: max-content 1fr;
  align-items: center;
}

.import-summary {
  margin-top: 14px;
}

.import-summary ul {
  margin: 0;
  padding-left: 18px;
  color: #9a3412;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  color: #fff;
  background: rgba(3, 47, 88, .94);
  border-radius: 7px;
  padding: 11px 14px;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

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

.admin-panel:focus-within,
.admin-table-card:focus-within,
.stat-card:focus-within {
  border-color: #bdd7ec;
  box-shadow: 0 14px 34px rgba(12, 60, 107, .1);
}

@media (max-width: 1080px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 360px;
  }

  .login-card {
    width: min(430px, calc(100% - 32px));
    margin: -80px auto 32px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    width: 250px;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: inline-grid;
  }

  .stats-grid,
  .dashboard-grid,
  .settings-layout {
    grid-template-columns: 1fr 1fr;
  }

  .admin-panel.wide {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 720px) {
  .login-visual {
    min-height: 300px;
    padding: 24px;
  }

  .login-visual__content {
    padding-bottom: 20px;
  }

  .login-visual__content h1 {
    font-size: 30px;
  }

  .login-card {
    padding: 24px;
  }

  .admin-topbar {
    height: auto;
    min-height: 66px;
    flex-wrap: wrap;
    padding: 14px;
  }

  .topbar-tools {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-box {
    width: 100%;
  }

  .api-status {
    order: 2;
  }

  .content-area {
    padding: 16px 14px 26px;
  }

  .stats-grid,
  .dashboard-grid,
  .settings-layout,
  .form-grid,
  .import-actions {
    grid-template-columns: 1fr;
  }

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

  .module-toolbar .primary-button {
    width: 100%;
  }

  .admin-table-card {
    border-radius: 7px;
  }

  th,
  td {
    padding: 12px;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    left: 14px;
    text-align: center;
  }
}
