:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --border: #e1e7ef;
  --border-strong: #cfd8e5;
  --text: #182235;
  --muted: #667085;
  --subtle: #98a2b3;
  --nav: #0e1b34;
  --nav-soft: #172746;
  --accent: #2264e5;
  --accent-dark: #174fc1;
  --accent-soft: #eaf1ff;
  --cyan: #0e9f9a;
  --cyan-soft: #e7f8f5;
  --purple: #7956d8;
  --purple-soft: #f0ebff;
  --ok: #138a63;
  --ok-soft: #e8f7f1;
  --warn: #b76a08;
  --warn-soft: #fff5df;
  --danger: #d13b3b;
  --danger-soft: #fff0ef;
  --shadow: 0 8px 28px rgba(21, 37, 68, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #edf1f7;
  font-family: Consolas, monospace;
  font-size: 12px;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  overflow: auto;
  background:
    radial-gradient(circle at 15% 0, rgba(61, 114, 226, 0.26), transparent 32%),
    var(--nav);
  color: #f8fbff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 13px;
  background: linear-gradient(135deg, #4f8cff, #2359d3);
  box-shadow: 0 8px 18px rgba(27, 75, 181, 0.34);
  font-size: 20px;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.brand-kicker,
.eyebrow,
.breadcrumb,
.nav-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-kicker {
  margin-bottom: 4px;
  color: #8eb7ff;
  font-size: 9px;
}

.brand-meta {
  margin: 14px 2px 0;
  color: rgba(236, 243, 255, 0.62);
  font-size: 12px;
  line-height: 1.7;
}

.nav {
  display: grid;
  gap: 22px;
  margin-top: 26px;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-label {
  margin: 0 10px 6px;
  color: rgba(190, 204, 229, 0.48);
  font-size: 10px;
}

.nav-link {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 11px;
  border-radius: 9px;
  color: rgba(238, 244, 255, 0.76);
  font-size: 13px;
  transition: 0.16s ease;
}

.nav-link small {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(238, 244, 255, 0.62);
  text-align: center;
  font-size: 10px;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  outline: none;
}

.nav-link.is-active {
  background: linear-gradient(90deg, rgba(51, 111, 232, 0.42), rgba(51, 111, 232, 0.18));
  color: #ffffff;
  font-weight: 700;
}

.nav-link.is-active small {
  background: #2f70ed;
  color: #ffffff;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.connection-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #77849b;
  box-shadow: 0 0 0 4px rgba(119, 132, 155, 0.13);
}

.connection-dot.is-connected {
  background: #39d49e;
  box-shadow: 0 0 0 4px rgba(57, 212, 158, 0.14);
}

.sidebar-foot strong {
  display: block;
  color: #edf4ff;
  font-size: 12px;
}

.sidebar-foot p {
  margin: 3px 0 0;
  color: rgba(220, 230, 247, 0.48);
  font-size: 10px;
}

.main {
  min-width: 0;
  padding: 24px 28px 48px;
}

.page-header {
  min-height: 70px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin: 0 auto 18px;
  max-width: 1500px;
}

.page-header h2 {
  margin: 6px 0 0;
  font-size: 25px;
  line-height: 1.25;
}

.breadcrumb {
  color: #7b879c;
  letter-spacing: 0.04em;
  text-transform: none;
}

.page-copy,
.section-copy {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.header-status,
.badge,
.connection-state {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.workspace-view {
  display: none;
  max-width: 1500px;
  margin: 0 auto;
}

.workspace-view.is-active {
  display: block;
  animation: view-in 0.18s ease-out;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}

.panel-heading h3,
.detail-header h3 {
  margin: 5px 0 0;
  font-size: 17px;
  line-height: 1.35;
}

.connection-panel {
  max-width: 1500px;
  margin: 0 auto 18px;
  border-left: 4px solid var(--accent);
}

.connection-panel.is-collapsed {
  display: none;
}

.connection-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto auto;
  gap: 11px;
  align-items: end;
}

.connection-state.is-connected {
  border-color: #a8dec9;
  background: var(--ok-soft);
  color: var(--ok);
}

.connection-note,
.form-status {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.dashboard-hero {
  min-height: 172px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 16px;
  padding: 28px 30px;
  overflow: hidden;
  border-radius: 16px;
  background:
    radial-gradient(circle at 78% 20%, rgba(117, 163, 255, 0.55), transparent 26%),
    linear-gradient(120deg, #174db6, #246ee9 58%, #3984ed);
  box-shadow: 0 16px 38px rgba(26, 84, 196, 0.2);
  color: #ffffff;
}

.dashboard-hero h3 {
  margin: 8px 0 10px;
  font-size: 25px;
}

.dashboard-hero p {
  max-width: 660px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.7;
}

.eyebrow--light {
  color: rgba(255, 255, 255, 0.65);
}

.hero-score {
  min-width: 164px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: rgba(9, 41, 103, 0.26);
  backdrop-filter: blur(8px);
}

.hero-score span,
.hero-score small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.hero-score strong {
  display: block;
  margin: 7px 0;
  font-size: 34px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metrics--primary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
}

.metric-card--button {
  cursor: pointer;
  transition: 0.16s ease;
}

.metric-card--button:hover {
  transform: translateY(-2px);
  border-color: #b9cae9;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(42, 74, 132, 0.08);
}

.metric-card strong {
  display: block;
  margin-top: 9px;
  overflow: hidden;
  font-size: 26px;
  line-height: 1.15;
  text-overflow: ellipsis;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-note {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  color: var(--subtle);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.dashboard-grid--wide {
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.55fr);
}

.action-queue {
  display: grid;
  gap: 8px;
}

.queue-item {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.queue-item:hover {
  background: var(--panel-soft);
}

.queue-count {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.queue-item--danger .queue-count {
  background: var(--danger-soft);
  color: var(--danger);
}

.queue-item--warn .queue-count {
  background: var(--warn-soft);
  color: var(--warn);
}

.queue-item strong,
.queue-item small {
  display: block;
}

.queue-item strong {
  font-size: 12px;
}

.queue-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.queue-item b {
  color: var(--subtle);
}

.funnel {
  display: grid;
  gap: 15px;
  padding: 3px 0;
}

.funnel-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 12px;
}

.funnel-row > div:first-child {
  display: flex;
  align-items: center;
  gap: 7px;
}

.funnel-row > div:first-child span {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.funnel-row strong,
.funnel-row b {
  font-size: 11px;
}

.funnel-track,
.coverage-track {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf1f6;
}

.funnel-track i,
.coverage-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2d69e7, #5a90f0);
}

.coverage-list {
  display: grid;
  gap: 15px;
}

.coverage-row {
  display: grid;
  grid-template-columns: 135px minmax(100px, 1fr) 42px;
  align-items: center;
  gap: 12px;
}

.coverage-row strong,
.coverage-row span {
  display: block;
}

.coverage-row strong {
  font-size: 11px;
}

.coverage-row span {
  margin-top: 3px;
  color: var(--subtle);
  font-size: 9px;
}

.coverage-row b {
  color: var(--accent);
  font-size: 11px;
  text-align: right;
}

.activity-list {
  display: grid;
}

.activity-list button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid #edf0f5;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.activity-list button:last-child {
  border-bottom: 0;
}

.activity-list button > span {
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9px;
  text-align: center;
}

.activity-list strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-list small {
  color: var(--subtle);
  font-size: 9px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.filter-bar select,
.search-box {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
}

.field input,
.field select,
.field textarea,
.filter-bar select {
  padding: 9px 11px;
}

.field textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.65;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-bar select:focus,
.search-box:focus-within {
  border-color: var(--accent);
  outline: 3px solid rgba(34, 100, 229, 0.1);
}

.field--checkbox {
  align-content: end;
}

.checkbox-control {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
}

.checkbox-control input {
  width: 17px;
  min-height: 17px;
}

.button,
.icon-button,
.table-action,
.text-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.button,
.table-action {
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.button {
  min-height: 40px;
  padding: 0 16px;
  white-space: nowrap;
}

.button--compact {
  min-height: 34px;
  padding: 0 12px;
}

.button--secondary,
.table-action--secondary {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
}

.button:disabled,
.table-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button:not(:disabled):hover,
.table-action:not(:disabled):hover {
  background: var(--accent-dark);
}

.button--secondary:not(:disabled):hover,
.table-action--secondary:not(:disabled):hover {
  background: #f1f4f8;
  color: var(--text);
}

.text-button {
  padding: 3px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
}

.filter-bar select {
  width: auto;
  min-width: 135px;
}

.search-box {
  min-width: 220px;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 0 11px;
}

.search-box > span {
  color: var(--subtle);
  font-size: 18px;
}

.table-search {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

thead {
  background: #f4f7fb;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 11px;
  line-height: 1.5;
}

th {
  color: #647087;
  font-weight: 700;
  white-space: nowrap;
}

td {
  color: #273248;
}

tbody tr:hover {
  background: #fafcff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td select,
td input {
  width: 100%;
  min-width: 130px;
  min-height: 31px;
  margin: 2px 0;
  padding: 5px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-size: 10px;
}

.table-action {
  min-height: 29px;
  padding: 0 9px;
  font-size: 10px;
}

.table-actions-cell {
  min-width: 105px;
  white-space: nowrap;
}

.table-actions-cell .table-action + .table-action {
  margin-left: 5px;
}

.table-note,
.empty-state {
  padding: 17px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.empty-state--compact {
  padding: 12px 0;
}

.table-subline {
  display: block;
  margin-top: 3px;
  color: var(--subtle);
  font-size: 9px;
}

.cell-clamp {
  display: -webkit-box;
  max-width: 340px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.entity-cell {
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.entity-cell strong,
.entity-cell small {
  display: block;
}

.entity-cell small {
  margin-top: 3px;
  color: var(--subtle);
  font-size: 8px;
}

.entity-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #ffffff;
  object-fit: contain;
}

.entity-logo--large {
  width: 58px;
  height: 58px;
}

.entity-logo--fallback {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.entity-logo--stack {
  position: relative;
  overflow: hidden;
}

.entity-logo__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  object-fit: contain;
}

.book-cover-thumb {
  width: 38px;
  height: 50px;
  display: block;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f5f6f8;
  object-fit: cover;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef1f5;
  color: #687386;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-pill--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-pill--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-pill--info {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-pill--purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.text-ok {
  color: var(--ok);
}

.text-warn {
  color: var(--warn);
}

.text-danger {
  color: var(--danger);
}

.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: #f0f3f7;
}

.segmented button {
  min-height: 29px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.segmented button.is-active {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 2px 7px rgba(43, 66, 105, 0.08);
  font-weight: 700;
}

.warning-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.warning-list--dense {
  max-height: 650px;
  overflow: auto;
}

.warning-item {
  padding: 13px 14px;
  border: 1px solid #f0d5a5;
  border-radius: 9px;
  background: #fff9ed;
}

.warning-item strong {
  color: var(--warn);
  font-size: 11px;
}

.warning-item p {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 11px;
  line-height: 1.6;
}

.warning-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.quality-issue {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.quality-issue:hover {
  border-color: #bdcae0;
  background: #fbfcfe;
}

.quality-issue strong,
.quality-issue small {
  display: block;
}

.quality-issue strong {
  font-size: 11px;
}

.quality-issue small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.quality-issue b {
  color: var(--accent);
  font-size: 9px;
}

.issue-type {
  padding: 5px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9px;
  text-align: center;
}

.issue-type--book {
  background: var(--purple-soft);
  color: var(--purple);
}

.issue-type--resource {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.issue-type--annual {
  background: var(--warn-soft);
  color: var(--warn);
}

.checklist {
  display: grid;
  gap: 12px;
}

.checklist-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid #f1d7a9;
  border-radius: 9px;
  background: #fffbf2;
}

.checklist-item > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11px;
  font-weight: 800;
}

.checklist-item.is-ok {
  border-color: #cbe9dc;
  background: #f5fbf8;
}

.checklist-item.is-ok > span {
  background: var(--ok-soft);
  color: var(--ok);
}

.checklist-item strong {
  font-size: 11px;
}

.checklist-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.book-review-summary {
  display: flex;
  gap: 9px;
  margin: 0 0 14px;
  overflow: auto;
}

.summary-chip {
  min-width: 105px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-soft);
}

.summary-chip strong {
  font-size: 17px;
}

.summary-chip span {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.summary-chip--ok strong {
  color: var(--ok);
}

.summary-chip--warn strong {
  color: var(--warn);
}

.summary-chip--danger strong {
  color: var(--danger);
}

.summary-chip--info strong {
  color: var(--accent);
}

.course-admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.course-admin-summary article {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
}

.course-admin-summary span,
.course-admin-summary strong {
  display: block;
}

.course-admin-summary span {
  color: var(--muted);
  font-size: 10px;
}

.course-admin-summary strong {
  margin-top: 7px;
  font-size: 22px;
}

.course-admin-list {
  display: grid;
  gap: 14px;
}

.course-admin-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
}

.course-admin-card > header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.course-order {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.course-admin-card h4 {
  margin: 3px 0 6px;
  font-size: 14px;
}

.course-admin-card header small,
.course-admin-card header p {
  color: var(--muted);
  font-size: 10px;
}

.course-admin-card header p {
  margin: 0;
  line-height: 1.6;
}

.course-status {
  min-width: 120px;
  text-align: right;
}

.course-status strong,
.course-status span {
  display: block;
}

.course-status strong {
  color: var(--accent);
  font-size: 12px;
}

.course-status span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--cyan-soft);
  color: #147f7a;
  font-size: 9px;
  font-weight: 700;
}

.tag--muted {
  background: #edf1f5;
  color: var(--muted);
}

.bundle-admin {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--purple-soft);
}

.bundle-admin span {
  margin-right: auto;
  color: #6042b3;
  font-size: 10px;
}

.bundle-admin strong {
  color: #6439ca;
  font-size: 17px;
}

.bundle-admin del {
  color: var(--subtle);
  font-size: 10px;
}

.course-items-admin {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.course-items-admin > div {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.course-items-admin > div > span {
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
}

.course-items-admin strong {
  font-size: 10px;
}

.course-items-admin p {
  grid-column: 2 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.course-items-admin small {
  color: var(--subtle);
  font-size: 8px;
  white-space: nowrap;
}

.catalog-source-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.catalog-source-note a {
  margin-left: 8px;
  color: var(--accent);
}

.course-admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 11px;
  margin: 13px 0;
  padding: 13px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: #fafbfc;
}

.course-source-editor {
  display: flex;
  flex: 1;
  min-width: 260px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.course-source-editor input {
  flex: 1;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}

.course-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.button--danger {
  background: #c0392b;
  color: #ffffff;
}

textarea.json-input {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.summary-card {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
}

.summary-card h4 {
  margin: 0 0 11px;
  font-size: 12px;
}

.summary-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.summary-card .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
}

.summary-card dt {
  color: var(--muted);
}

.summary-card dd {
  margin: 0;
  text-align: right;
}

.detail-dialog,
.editor-dialog {
  width: min(1040px, calc(100vw - 30px));
  max-height: calc(100vh - 30px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 28px 90px rgba(12, 28, 58, 0.3);
}

.detail-dialog::backdrop,
.editor-dialog::backdrop {
  background: rgba(8, 18, 38, 0.58);
  backdrop-filter: blur(2px);
}

.detail-shell,
.editor-form {
  max-height: calc(100vh - 30px);
  overflow: auto;
}

.detail-header,
.editor-header,
.editor-actions {
  position: sticky;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.97);
}

.detail-header,
.editor-header {
  top: 0;
  border-bottom: 1px solid var(--border);
}

.detail-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #eef2f7;
  color: var(--text);
  font-size: 21px;
}

.detail-content {
  padding: 22px;
  background: #f8fafc;
}

.record-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #ffffff;
}

.record-hero > div {
  min-width: 0;
  flex: 1;
}

.record-hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.record-hero .tag-list {
  margin-top: 0;
}

.detail-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 12px 0;
}

.detail-stat-strip > div {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #ffffff;
}

.detail-stat-strip span,
.detail-stat-strip strong {
  display: block;
}

.detail-stat-strip span {
  color: var(--muted);
  font-size: 9px;
}

.detail-stat-strip strong {
  margin-top: 6px;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-section {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #ffffff;
}

.detail-section h4 {
  margin: 0 0 13px;
  font-size: 13px;
}

.detail-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-section-heading h4 {
  margin: 0;
}

.detail-section-heading > span {
  color: var(--muted);
  font-size: 9px;
}

.detail-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.definition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--border);
}

.definition-grid > div {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 3px;
  border-bottom: 1px solid var(--border);
}

.definition-grid dt {
  color: var(--muted);
  font-size: 9px;
}

.definition-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 10px;
  line-height: 1.6;
  word-break: break-word;
}

.external-link {
  color: var(--accent);
}

.mini-table {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mini-table table {
  min-width: 560px;
}

.mini-table th,
.mini-table td {
  padding: 8px 9px;
  font-size: 9px;
}

.book-chip-list {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 2px;
}

.book-chip {
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.book-chip img {
  width: 31px;
  height: 42px;
  border-radius: 3px;
  object-fit: cover;
}

.book-chip span {
  font-size: 9px;
  line-height: 1.45;
}

.book-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.book-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.book-card > img {
  width: 42px;
  height: 56px;
  border-radius: 4px;
  object-fit: cover;
}

.book-card strong,
.book-card small {
  display: block;
}

.book-card strong {
  font-size: 10px;
  line-height: 1.45;
}

.book-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.book-detail-hero {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #ffffff;
}

.book-detail-hero > img {
  width: 98px;
  height: 132px;
  border: 1px solid var(--border);
  border-radius: 6px;
  object-fit: cover;
}

.book-detail-hero h4 {
  margin: 14px 0 7px;
  font-size: 18px;
}

.book-detail-hero p,
.book-detail-hero small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.book-detail-hero small {
  display: block;
  margin-top: 9px;
  word-break: break-all;
}

.content-preview {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: #354057;
  font-size: 10px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.raw-block {
  margin-top: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.raw-block summary {
  padding: 10px 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.raw-block pre {
  max-height: 320px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-top: 1px solid var(--border);
  background: #f7f9fc;
  color: #3b465b;
  font: 9px/1.7 Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.screenshot-grid img {
  width: 100%;
  max-height: 260px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f0f2f6;
  object-fit: contain;
}

.editor-form {
  display: grid;
}

.editor-hint {
  margin: 16px 20px 0;
  padding: 11px 13px;
  border: 1px solid #bed4fb;
  border-radius: 8px;
  background: #f1f6ff;
  color: #4d6388;
  font-size: 10px;
  line-height: 1.65;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px;
}

.form-grid .field--full,
.form-group-heading {
  grid-column: 1 / -1;
}

.form-group-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  color: #3d4960;
  font-size: 11px;
}

.form-group-heading:first-child {
  margin-top: 0;
}

.form-group-heading span {
  height: 1px;
  flex: 1;
  background: var(--border);
}

.form-status {
  min-height: 20px;
  margin: 0;
  padding: 0 20px 11px;
}

.form-status.is-error {
  color: var(--danger);
}

.form-status.is-ok {
  color: var(--ok);
}

.editor-actions {
  bottom: 0;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

@media (max-width: 1240px) {
  .layout {
    grid-template-columns: 226px minmax(0, 1fr);
  }

  .main {
    padding: 22px;
  }

  .metrics--primary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid,
  .dashboard-grid--wide {
    grid-template-columns: 1fr;
  }

  .course-items-admin {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .brand-meta,
  .sidebar-foot {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    overflow: auto;
  }

  .nav-group {
    display: flex;
    gap: 5px;
  }

  .nav-label {
    display: none;
  }

  .nav-link {
    min-width: max-content;
    padding: 0 10px;
  }

  .connection-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics,
  .course-admin-summary,
  .import-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .main {
    padding: 16px 12px 35px;
  }

  .page-header,
  .panel-heading,
  .dashboard-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header {
    min-height: 0;
  }

  .header-actions {
    justify-content: space-between;
  }

  .dashboard-hero {
    padding: 22px;
  }

  .hero-score {
    min-width: 0;
  }

  .metrics,
  .metrics--primary,
  .course-admin-summary,
  .import-summary,
  .detail-stat-strip,
  .definition-grid,
  .book-card-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-bar select,
  .search-box {
    width: 100%;
    max-width: none;
  }

  .panel {
    padding: 16px;
  }

  .segmented {
    max-width: 100%;
    overflow: auto;
  }

  .course-admin-card > header {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .course-status {
    grid-column: 2;
    text-align: left;
  }

  .course-items-admin > div {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .course-items-admin small {
    grid-column: 2;
  }

  .detail-dialog,
  .editor-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }

  .detail-shell,
  .editor-form {
    max-height: calc(100vh - 12px);
  }

  .detail-header,
  .editor-header {
    align-items: flex-start;
  }

  .detail-header-actions {
    flex-direction: column-reverse;
    align-items: flex-end;
  }

  .detail-content {
    padding: 12px;
  }

  .definition-grid > div {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .form-grid .field--full,
  .form-group-heading {
    grid-column: auto;
  }

  .form-group-heading {
    grid-column: 1;
  }
}

/* ===== 表格分页器 ===== */
.table-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 8px 4px;
}

.table-pager-info {
  font-size: 13px;
  color: var(--muted, #6b7280);
}

.table-pager .button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ===== 快速补录模式 ===== */
#quickfill-toggle.is-active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.qf-table td {
  vertical-align: middle;
}

.qf-input {
  width: 78px;
  padding: 6px 8px;
  border: 1px solid var(--line, #d7dce5);
  border-radius: 8px;
  font-size: 13px;
  text-align: right;
  background: #fff;
}

.qf-input:focus {
  outline: 2px solid rgba(29, 78, 216, 0.25);
  border-color: #1d4ed8;
}

.qf-input--missing {
  background: #fffbeb;
  border-color: #f59e0b;
}

.qf-row--saved {
  background: #f0fdf4;
}

.qf-status {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

.qf-status--ok {
  color: #15803d;
}

.qf-status--error {
  color: #b91c1c;
}

.table-subline {
  display: block;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

/* ===== 编辑器可搜索下拉 ===== */
[data-combo-input] {
  width: 100%;
}

[data-combo-input]::placeholder {
  color: #9ca3af;
}

/* “保存并补下一条”按钮与主按钮间距 */
#save-next-button {
  margin-right: auto;
}
