:root {
  --bg: #f5f7fb;
  --panel: #fff;
  --line: #e6ebf2;
  --line-strong: #d7dfeb;
  --text: #1d2433;
  --muted: #667085;
  --accent: #2f70ed;
  --accent-dark: #1f5fd6;
  --success: #169b62;
  --danger: #d14343;
  --warning: #b7791f;
  --shadow: 0 18px 45px rgba(18, 32, 56, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { color: var(--text); background: var(--bg); font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.admin-shell { display: grid; grid-template-rows: 58px minmax(0, 1fr); height: 100vh; }
.admin-topbar { z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 0 20px 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); font-size: 18px; }
.brand img { width: auto; height: 30px; max-width: 142px; object-fit: contain; }
.admin-user { position: relative; }
.avatar-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(47, 112, 237, 0.18); border-radius: 999px; background: #fff; cursor: pointer; box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1); }
.avatar-btn span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background: linear-gradient(135deg, #38bdf8, #2563eb); color: #fff; font-size: 12px; font-weight: 800; }
.user-menu-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: 178px; padding: 6px; border: 1px solid rgba(148, 163, 184, 0.18); border-radius: 10px; background: rgba(255, 255, 255, 0.98); box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16); }
.user-menu-info { display: grid; gap: 3px; padding: 8px 10px 10px; border-bottom: 1px solid rgba(148, 163, 184, 0.16); }
.user-menu-info strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-info span { color: var(--muted); font-size: 12px; }
.user-menu-item { display: flex; align-items: center; width: 100%; min-height: 34px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; font-size: 13px; text-align: left; }
.user-menu-item:hover { background: rgba(47, 112, 237, 0.08); color: var(--accent-dark); }

.admin-layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 0; overflow: hidden; }
.admin-sidebar { overflow-y: auto; padding: 18px 12px 16px; background: #fff; border-right: 1px solid var(--line); }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; margin: 0 0 8px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; color: #202735; cursor: pointer; text-align: left; font-weight: 700; }
.nav-item span { width: 22px; color: currentColor; font-size: 20px; text-align: center; }
.nav-item:hover { background: #f6f9ff; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 12px 24px rgba(47, 112, 237, 0.22); }

.admin-main { min-height: 0; overflow: auto; padding: 20px 24px 30px; }
.workspace-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 82px; margin-bottom: 14px; padding: 16px 20px; border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.workspace-head h1 { margin: 0 0 4px; font-size: 22px; line-height: 1.2; }
.workspace-head p { margin: 0; color: var(--muted); font-size: 13px; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.search-box { display: inline-flex; align-items: center; gap: 9px; width: 268px; height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: #8997aa; cursor: text; transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease; }
.search-box-icon { flex: 0 0 auto; transition: color .16s ease; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; font: inherit; font-size: 12px; line-height: 1; }
.search-box input::placeholder { color: #98a4b5; opacity: 1; }
.search-box input::-webkit-search-cancel-button { opacity: .45; cursor: pointer; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--accent); cursor: pointer; font-size: 18px; }

.content-panel, .table-panel { border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.settings-panel { padding: 16px 18px 18px; }
.section-title { margin-bottom: 10px; }
.section-title span { display: block; margin-bottom: 3px; color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.section-title h2 { margin: 0 0 2px; font-size: 18px; }
.section-title p { margin: 0; color: var(--muted); font-size: 12px; }
.setting-block { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-bottom: 8px; padding: 0 0 8px; border-bottom: 1px solid rgba(215, 223, 235, 0.72); }
.setting-block:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.setting-block.compact { grid-template-columns: minmax(0, 1fr) auto; }
.setting-block.provider-setting:has(#kling-default-model) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.setting-block.provider-setting:has(#kling-default-model) .secondary-btn { justify-self: end; }
.form-field { display: grid; gap: 4px; margin-bottom: 0; }
.form-field span { color: #1f2937; font-size: 12px; font-weight: 700; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--text); font-size: 13px; }
.form-field input[readonly] { background: #f8fafc; color: var(--muted); cursor: default; }
.form-actions { display: flex; align-items: center; gap: 10px; }
.settings-feedback-row { align-items: stretch; }
.full-row { grid-column: 1 / -1; }
.primary-btn, .secondary-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 0 10px; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 800; white-space: nowrap; }
.primary-btn { border: 0; background: var(--accent); color: #fff; }
.primary-btn:hover { background: var(--accent-dark); }
.secondary-btn { border: 1px solid var(--line-strong); background: #fff; color: var(--accent); }
.primary-btn:disabled, .secondary-btn:disabled { cursor: not-allowed; opacity: 0.62; }
.text-btn, .danger-btn { min-height: 28px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; cursor: pointer; font-weight: 800; font-size: 12px; }
.text-btn { color: var(--accent); }
.danger-btn { border-color: rgba(209, 67, 67, 0.28); color: var(--danger); }
.feedback { padding: 10px 12px; border: 1px solid #dbe7ff; border-radius: 4px; background: #f4f8ff; color: #43536b; font-size: 13px; }
.feedback.success { border-color: rgba(22, 155, 98, 0.25); background: rgba(22, 155, 98, 0.08); color: var(--success); }
.feedback.error { border-color: rgba(209, 67, 67, 0.25); background: rgba(209, 67, 67, 0.08); color: var(--danger); }

#settings-view .settings-panel { padding: 16px 18px 18px; }
#settings-view .settings-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
#settings-view .section-title { margin-bottom: 12px; }
#settings-view .section-title h2 { margin-bottom: 3px; font-size: 20px; line-height: 1.2; }
#settings-view .section-title p { font-size: 13px; line-height: 1.4; }
#settings-view .setting-block { gap: 8px 10px; margin-bottom: 8px; padding-bottom: 0; border-bottom: 0; }

#settings-view .default-provider-setting,
#settings-view .model-default-setting {
  grid-template-columns: minmax(580px, 1fr);
  justify-content: stretch;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

#settings-view .platform-default-fields { display: grid; gap: 8px; }
#settings-view .platform-default-save-row {
  display: grid;
  grid-template-columns: minmax(580px, 590px) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

#settings-view .setting-block.provider-setting,
#settings-view .provider-secret-setting,
#settings-view .hunyuan-setting {
  grid-template-columns: minmax(420px, 590px) auto;
  justify-content: start;
  align-items: center;
}

#settings-view .form-field { gap: 5px; }
#settings-view .form-field span { font-size: 13px; line-height: 1.2; }
#settings-view .platform-secret-field {
  grid-template-columns: 150px minmax(260px, 420px);
  align-items: center;
  gap: 10px;
}
#settings-view .platform-inline-field {
  grid-template-columns: 150px minmax(260px, 420px);
  align-items: center;
  gap: 10px;
}
#settings-view .model-default-setting .platform-inline-field {
  grid-template-columns: 150px 420px;
}
#settings-view .form-field input,
#settings-view .form-field select,
#settings-view .form-field textarea { min-height: 34px; padding: 0 10px; border-radius: 6px; font-size: 13px; }
#settings-view .form-field input:focus,
#settings-view .form-field select:focus,
#settings-view .form-field textarea:focus {
  outline: 0;
  border-color: rgba(47, 112, 237, 0.42);
  box-shadow: 0 0 0 3px rgba(47, 112, 237, 0.12);
}

.platform-secret-actions { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; }
.platform-secret-actions .text-btn { min-height: 30px; padding: 0 7px; }
#settings-view .platform-secret-actions .secondary-btn { min-width: 0; min-height: 30px; padding: 0 10px; border-radius: 4px; font-size: 12px; }
#settings-view .secret-visibility-btn { flex: 0 0 50px; width: 50px; padding: 0; }
#settings-view .platform-secret-actions .text-btn,
#settings-view .platform-secret-actions .secondary-btn {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.secret-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f1f4f8;
  color: #778296;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.secret-status.configured { background: rgba(22, 155, 98, 0.1); color: var(--success); }

#settings-view .settings-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

#settings-view .settings-section-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

#settings-view .section-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#settings-view .provider-group + .provider-group {
  margin-top: 22px;
}

#settings-view .provider-group > h3 {
  margin: 0 0 9px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

#settings-view .provider-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

#settings-view .provider-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

#settings-view .provider-card.ready {
  border-color: var(--line);
}

#settings-view .provider-card[open] {
  border-color: rgba(47, 112, 237, 0.42);
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
}

#settings-view .provider-card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

#settings-view .provider-card > summary::-webkit-details-marker {
  display: none;
}

#settings-view .provider-card > summary:hover {
  background: #f8fafc;
}

#settings-view .provider-card > summary:focus {
  outline: 0;
}

#settings-view .provider-card > summary:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(47, 112, 237, 0.42);
}

#settings-view .provider-card-identity,
#settings-view .provider-card-state,
#settings-view .provider-capabilities,
#settings-view .provider-secret-meta,
#settings-view .provider-card-footer,
#settings-view .route-actions,
#settings-view .capability-route-title {
  display: flex;
  align-items: center;
}

#settings-view .provider-card-identity {
  min-width: 0;
  gap: 9px;
}

#settings-view .provider-card-icon,
#settings-view .route-icon {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #f1f5ff;
  color: var(--accent);
}

#settings-view .provider-card-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#settings-view .provider-capabilities {
  gap: 4px;
}

#settings-view .provider-capabilities span {
  padding: 2px 6px;
  border: 1px solid #e1e7f0;
  border-radius: 4px;
  background: #f8fafc;
  color: #617083;
  font-size: 10px;
  font-weight: 800;
}

#settings-view .provider-card-state {
  flex: 0 0 auto;
  gap: 8px;
}

#settings-view .provider-state,
#settings-view .route-state {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f0f2f5;
  color: #778296;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

#settings-view .provider-state.ready,
#settings-view .route-state.ready {
  background: rgba(22, 155, 98, 0.1);
  color: var(--success);
}

#settings-view .provider-card-chevron {
  color: #98a2b3;
  transition: transform 160ms ease;
}

#settings-view .provider-card[open] .provider-card-chevron {
  transform: rotate(180deg);
}

#settings-view .provider-card-body {
  display: grid;
  gap: 12px;
  padding: 13px 14px 14px;
  border-top: 1px solid var(--line);
  background: #fcfdff;
}

#settings-view .provider-enable-toggle {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 7px;
  color: #344054;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

#settings-view .provider-enable-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

#settings-view .provider-secret-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

#settings-view .provider-secret-input {
  min-width: 0;
}

#settings-view .provider-secret-meta {
  min-height: 34px;
  gap: 4px;
}

#settings-view .icon-btn {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

#settings-view .icon-btn:hover:not(:disabled) {
  background: #edf3ff;
}

#settings-view .icon-btn:disabled {
  color: #b8c0cc;
  cursor: default;
}

#settings-view .text-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

#settings-view .text-action-btn:hover:not(:disabled) {
  background: #edf3ff;
}

#settings-view .text-action-btn:disabled {
  color: #98a2b3;
  cursor: not-allowed;
}

#settings-view .provider-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#settings-view .provider-card-footer {
  min-height: 32px;
  justify-content: flex-end;
  gap: 8px;
}

#settings-view .compact-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  width: auto;
  padding: 0 12px;
  white-space: nowrap;
}

#settings-view .route-section-head {
  align-items: flex-start;
}

#settings-view .route-actions {
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

#settings-view .route-actions .inline-action-feedback {
  flex-basis: 100%;
  margin-left: auto;
  max-width: min(560px, 100%);
  justify-content: flex-end;
  text-align: right;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

#settings-view .capability-route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#settings-view .capability-route-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

#settings-view .capability-route-card.ready {
  border-color: var(--line);
}

#settings-view .capability-route-card:focus-within {
  border-color: rgba(47, 112, 237, 0.42);
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
}

#settings-view .capability-route-title {
  grid-column: 1 / -1;
  gap: 9px;
}

#settings-view .capability-route-title strong {
  font-size: 14px;
}

#settings-view .capability-route-title .route-state {
  margin-left: auto;
}

#settings-view .image-route-icon {
  background: #fff4e8;
  color: #c56b19;
}

#settings-view .video-route-icon {
  background: #eaf8f3;
  color: #17865c;
}

#settings-view .model-route-icon {
  background: #f3efff;
  color: #6e4bc4;
}

#settings-view .default-provider-save-btn {
  min-height: 30px;
  padding: 0 10px;
  justify-self: start;
  white-space: nowrap;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#settings-view .default-provider-save-btn:disabled { cursor: not-allowed; opacity: 0.62; }
#settings-view .inline-action-feedback {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 260px;
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#settings-view .inline-action-feedback.error { color: var(--danger); }

.selected-user-card { display: grid; gap: 4px; padding: 9px 11px; border: 1px solid rgba(47, 112, 237, 0.18); border-radius: 6px; background: rgba(47, 112, 237, 0.06); }
.selected-user-card span { color: var(--muted); font-size: 13px; font-weight: 500; }
.credit-user-options { display: grid; gap: 6px; max-height: 174px; overflow-y: auto; padding: 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; }
.credit-user-option { display: grid; gap: 3px; width: 100%; min-height: 38px; padding: 6px 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.credit-user-option:hover, .credit-user-option.active { border-color: rgba(47, 112, 237, 0.25); background: rgba(47, 112, 237, 0.08); }
.credit-user-option small, .credit-user-empty { color: var(--muted); font-size: 12px; }
.credit-user-empty { padding: 10px; }

.table-panel { overflow: hidden; }
.table-summary { display: flex; align-items: baseline; gap: 8px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.table-summary strong { color: var(--accent); font-size: 22px; }
.table-summary span, .table-summary small { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 860px; border-collapse: collapse; }
#credits-view table { table-layout: fixed; }
#credits-view th:nth-child(1), #credits-view td:nth-child(1) { width: 120px; }
#credits-view th:nth-child(2), #credits-view td:nth-child(2) { width: 96px; }
#credits-view th:nth-child(3), #credits-view td:nth-child(3) { width: 110px; }
#credits-view th:nth-child(4), #credits-view td:nth-child(4) { width: auto; }
#credits-view th:nth-child(5), #credits-view td:nth-child(5) { width: 210px; }
#tasks-view th:nth-child(2), #tasks-view td:nth-child(2),
#tasks-view th:nth-child(3), #tasks-view td:nth-child(3),
#tasks-view th:nth-child(4), #tasks-view td:nth-child(4) { white-space: nowrap; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; color: #4b586b; font-size: 12px; font-weight: 800; }
td { color: #2f3848; font-size: 13px; }
.cell-main { display: grid; gap: 4px; }
.cell-main strong { font-size: 14px; }
.cell-main small, .muted { color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 4px; background: #edf2ff; color: var(--accent); font-size: 12px; font-weight: 800; }
#tasks-view .status-pill { white-space: nowrap; }
.status-pill.success { background: rgba(22, 155, 98, 0.1); color: var(--success); }
.status-pill.failed { background: rgba(209, 67, 67, 0.1); color: var(--danger); }
.status-pill.running { background: rgba(183, 121, 31, 0.12); color: var(--warning); }
.role-pill-list { display: flex; flex-wrap: wrap; gap: 5px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.classes-view { display: grid; gap: 14px; }
.class-page-feedback { margin: 0; }
.class-overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.class-overview-grid article { display: grid; gap: 5px; padding: 16px 18px; border: 1px solid rgba(47, 112, 237, 0.08); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.class-overview-grid span, .class-overview-grid small { color: var(--muted); }
.class-overview-grid span { font-size: 13px; font-weight: 700; }
.class-overview-grid strong { color: var(--accent); font-size: 26px; line-height: 1; }
.class-overview-grid small { font-size: 12px; }
.classes-table { min-width: 980px; }
.class-member-count { color: var(--accent); font-size: 16px; }
.class-dialog-panel { width: min(760px, 100%); }
.class-dialog-panel .dialog-head { align-items: flex-start; }
.class-dialog-panel .dialog-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.class-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 14px; }
.class-form-grid .form-field { margin-bottom: 0; }
.class-form-grid textarea { resize: vertical; }
.class-member-fieldset { margin: 16px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.class-member-fieldset legend { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-size: 14px; font-weight: 800; }
.class-member-fieldset legend strong { color: var(--accent); font-size: 12px; }
.class-member-search { width: 100%; min-height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 6px; }
.class-member-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; max-height: 210px; margin-top: 10px; overflow-y: auto; }
.class-member-options label { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 7px; min-width: 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.class-member-options label:has(input:checked) { border-color: rgba(47, 112, 237, 0.42); background: #f2f7ff; }
.class-member-options label > span { display: grid; min-width: 0; }
.class-member-options label strong, .class-member-options label small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-member-options label strong { font-size: 13px; }
.class-member-options label small, .class-member-options p { color: var(--muted); font-size: 11px; }
.class-member-options p { grid-column: 1 / -1; margin: 8px 0; text-align: center; }
.model-downloads { display: flex; flex-wrap: wrap; gap: 6px; min-width: 180px; max-width: 300px; }
.model-download-link { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 0 8px; border: 1px solid rgba(47, 112, 237, 0.18); border-radius: 4px; background: #f8fbff; color: var(--accent); font-size: 12px; font-weight: 800; }
.model-download-link:hover { border-color: rgba(47, 112, 237, 0.38); background: rgba(47, 112, 237, 0.08); color: var(--accent-dark); }
.model-download-link.provider { border-color: rgba(102, 112, 133, 0.22); color: #43536b; }
.model-download-link.provider:hover { border-color: rgba(102, 112, 133, 0.42); background: rgba(102, 112, 133, 0.08); color: #1f2937; }
.model-download-link small { color: currentColor; font-size: 10px; font-weight: 700; opacity: 0.72; }
.table-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.table-pagination div { display: inline-flex; align-items: center; gap: 8px; }
.table-pagination strong { min-width: 48px; color: var(--text); text-align: center; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; background: rgba(20, 30, 46, 0.28); }
.dialog-panel { width: min(430px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; padding: 18px; border-radius: 8px; background: #fff; box-shadow: 0 24px 60px rgba(18, 32, 56, 0.22); }
.credit-rules-panel { width: min(720px, 100%); }
.dialog-panel .form-field { gap: 8px; margin-bottom: 13px; }
.dialog-panel .form-field span { font-size: 14px; line-height: 1.25; }
.dialog-panel .form-field input, .dialog-panel .form-field select, .dialog-panel .form-field textarea { min-height: 40px; padding: 0 12px; font-size: 15px; line-height: 1.35; }
.dialog-panel .form-field textarea { padding-top: 10px; padding-bottom: 10px; }
.rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.check-field { display: inline-flex; align-items: center; gap: 8px; margin: 2px 0 12px; color: var(--text); font-weight: 700; }
.role-fieldset { margin: 0 0 13px; padding: 0; border: 0; }
.role-fieldset legend { margin-bottom: 8px; color: #1f2937; font-size: 14px; font-weight: 700; }
.role-check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.role-check-grid label { min-width: 0; display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 8px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 6px; cursor: pointer; }
.role-check-grid label:has(input:checked) { border-color: rgba(47, 112, 237, 0.44); background: #f2f7ff; }
.role-check-grid input { margin: 2px 0 0; }
.role-check-grid span { min-width: 0; display: grid; gap: 4px; }
.role-check-grid strong { font-size: 13px; }
.role-check-grid small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.hidden { display: none !important; }

@media (max-width: 980px) {
  .admin-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .admin-sidebar { display: flex; gap: 8px; overflow-x: auto; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-item { flex: 0 0 auto; width: auto; margin: 0; }
  .workspace-head { align-items: stretch; flex-direction: column; }
  .head-actions { flex-wrap: wrap; }
  .search-box { width: 100%; }
  .settings-grid { grid-template-columns: 1fr; }
  .setting-block, .setting-block.compact, .setting-block.provider-setting, .setting-block.provider-setting:has(#kling-default-model) { grid-template-columns: 1fr; }
  #settings-view .default-provider-setting,
  #settings-view .model-default-setting {
    grid-template-columns: 1fr;
  }
  #settings-view .setting-block.provider-setting,
  #settings-view .provider-secret-setting,
  #settings-view .hunyuan-setting { grid-template-columns: minmax(420px, 590px) auto; }
  #settings-view .primary-btn,
  #settings-view .secondary-btn,
  #settings-view .hunyuan-setting .secondary-btn {
    width: 100%;
    justify-self: stretch;
  }
  #settings-view .platform-secret-actions .secondary-btn { width: auto; justify-self: auto; }
  .platform-secret-actions { justify-content: flex-start; flex-wrap: wrap; }
  .setting-block .secondary-btn { justify-self: end; }
  .rule-grid { grid-template-columns: 1fr; }
  .class-overview-grid { grid-template-columns: 1fr; }
  .class-member-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #settings-view .provider-card-grid,
  #settings-view .capability-route-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .class-form-grid, .class-member-options { grid-template-columns: 1fr; }
  #settings-view .settings-panel {
    padding: 14px;
  }

  #settings-view .settings-section-head,
  #settings-view .route-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  #settings-view .route-actions {
    justify-content: flex-start;
  }

  #settings-view .route-actions .inline-action-feedback {
    margin-left: 0;
    text-align: left;
  }

  #settings-view .provider-card > summary {
    align-items: flex-start;
  }

  #settings-view .provider-card-identity {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  #settings-view .provider-capabilities {
    flex-basis: calc(100% - 39px);
    margin-left: 39px;
  }

  #settings-view .provider-card-state {
    margin-left: 8px;
  }

  #settings-view .provider-secret-control,
  #settings-view .provider-option-grid,
  #settings-view .capability-route-card {
    grid-template-columns: minmax(0, 1fr);
  }

  #settings-view .provider-secret-meta {
    justify-content: flex-start;
  }

  #settings-view .capability-route-title {
    grid-column: auto;
  }

  #settings-view .setting-block.provider-setting,
  #settings-view .provider-secret-setting,
  #settings-view .hunyuan-setting,
  #settings-view .platform-secret-field {
    grid-template-columns: minmax(0, 1fr);
  }

  #settings-view .platform-inline-field {
    grid-template-columns: minmax(0, 1fr);
  }

  #settings-view .model-default-setting .platform-inline-field {
    grid-template-columns: minmax(0, 1fr);
  }

  #settings-view .platform-default-save-row {
    grid-template-columns: minmax(0, 1fr);
  }

  #settings-view .platform-secret-field { gap: 5px; }
}
.teaching-tags-view {
  display: grid;
  gap: 14px;
}

.teaching-tags-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.teaching-tags-toolbar > span,
.teaching-tags-feedback {
  color: var(--muted);
  font-size: 13px;
}

.teaching-tags-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.teaching-tags-feedback {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.teaching-tags-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.teaching-tag-panel {
  padding: 18px;
}

.teaching-tag-panel > header strong {
  font-size: 16px;
}

.teaching-tag-panel > header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.teaching-tag-add,
.teaching-tag-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.teaching-tag-add {
  margin-top: 14px;
}

.teaching-tag-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.teaching-tag-list > div {
  grid-template-columns: minmax(0, 1fr) auto 34px;
}

.teaching-tag-add input,
.teaching-tag-list input[type="text"],
.teaching-tag-list > div > input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.teaching-tag-add button,
.teaching-tag-list button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  background: #fff;
  cursor: pointer;
}

.teaching-tag-list label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.teaching-tag-list button.danger {
  border-color: rgba(209, 67, 67, 0.24);
  color: var(--danger);
}

@media (max-width: 900px) {
  .teaching-tags-grid { grid-template-columns: 1fr; }
}

/* Admin center shell: aligned with the learning, teaching and enterprise centers. */
.admin-shell {
  min-height: 100vh;
  height: 100vh;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  color: #172033;
  background: #f3f6fa;
  --accent: #1768da;
  --accent-dark: #0f58bd;
  --admin-soft: #eaf2ff;
  --bg: #f3f6fa;
  --line: #dfe5ed;
  --line-strong: #cfd7e3;
  --text: #172033;
  --muted: #748196;
  --shadow: none;
}

.admin-sidebar {
  position: relative;
  z-index: 12;
  width: auto;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  overflow: hidden;
  padding: 20px 16px 18px;
  border-right: 1px solid #dfe5ed;
  background: #fff;
}

.admin-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.admin-brand img { width: 38px; height: 38px; object-fit: contain; }
.admin-brand span { min-width: 0; display: flex; align-items: center; }
.admin-brand strong { color: #1d293d; font-size: 14px; line-height: 1.35; }

.admin-navigation {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.admin-navigation::-webkit-scrollbar { width: 0; height: 0; display: none; }

html:has(.admin-shell),
body:has(.admin-shell) {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html:has(.admin-shell)::-webkit-scrollbar,
body:has(.admin-shell)::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.admin-navigation section { display: grid; gap: 4px; }
.admin-nav-label { padding: 0 11px 4px; color: #9aa5b5; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.admin-nav-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  color: #536177;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.admin-nav-item:hover,
.admin-nav-item.active { color: var(--accent); background: var(--admin-soft); }
.admin-nav-item.active { box-shadow: none; }
.admin-nav-item:focus { outline: 0; }
.admin-nav-item:focus-visible { box-shadow: inset 0 0 0 2px rgba(23, 104, 218, .32); }
.admin-stage {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.admin-stage::-webkit-scrollbar { width: 0; height: 0; display: none; }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 0 clamp(22px, 3vw, 44px);
  border-bottom: 1px solid #dfe5ed;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
}

.admin-account-area { position: relative; display: flex; align-items: center; gap: 14px; }
.admin-role-summary { color: #6c798d; font-size: 12px; white-space: nowrap; }

.admin-topbar .avatar-btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #c8dcfb;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 14px rgba(23, 104, 218, .16);
}

.admin-topbar .avatar-btn b {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  box-shadow: 0 0 0 2px var(--admin-soft);
}

.admin-topbar .user-menu-panel {
  top: calc(100% + 12px);
  width: 224px;
  padding: 10px;
  border-color: #dce3ec;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(32, 47, 69, .16);
}

.admin-topbar .user-menu-info { gap: 4px; margin-bottom: 7px; padding: 9px 10px 12px; border-color: #e7ebf1; }
.admin-topbar .user-menu-info strong { font-size: 14px; }
.admin-topbar .user-menu-info span { color: #748196; font-size: 11px; line-height: 1.45; }
.admin-topbar .user-menu-item { min-height: 38px; gap: 10px; border-radius: 6px; color: #344259; font-size: 13px; }
.admin-topbar .user-menu-item:hover { color: #344259; background: #f3f6fa; }
.admin-topbar .user-menu-item.danger { color: #a13b48; }

.admin-content { width: min(calc(100% - 48px), 1240px); margin: 0 auto; padding: 22px 0 52px; }
.workspace-head {
  min-height: 0;
  align-items: flex-end;
  margin: 0 0 16px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.workspace-heading { display: grid; gap: 4px; }
.workspace-heading > span { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.workspace-head h1 { margin: 0; color: #1c2940; font-size: 24px; font-weight: 700; line-height: 1.2; }
.workspace-head p { margin: 0; color: #748196; font-size: 12px; line-height: 1.55; }
.head-actions { justify-content: flex-end; flex-wrap: wrap; }
.search-box { border-color: #d7dfeb; }
.search-box:hover { border-color: #c5d1e2; background: #fdfefe; }
.search-box:focus-within { border-color: rgba(23, 104, 218, .52); background: #fff; box-shadow: 0 0 0 3px rgba(23, 104, 218, .09), 0 5px 14px rgba(37, 91, 164, .06); }
.search-box:focus-within .search-box-icon { color: var(--accent); }
.icon-btn { border-color: #d2dae6; border-radius: 6px; }
.primary-btn, .secondary-btn, .text-btn, .danger-btn { border-radius: 6px; }
.primary-btn { background: var(--accent); }
.primary-btn:hover { background: var(--accent-dark); }

.content-panel,
.table-panel,
.class-overview-grid article,
.teaching-tags-feedback {
  border: 1px solid #dce3ec;
  border-radius: 7px;
  background: #fff;
  box-shadow: none;
}

.settings-panel { padding: 18px 20px 20px; }
.table-summary { padding: 15px 18px; background: #fff; }
.table-summary strong { color: var(--accent); font-size: 20px; }
th { background: #f7f9fc; color: #56647a; }
th, td { padding: 12px 14px; border-color: #e5eaf1; }
tbody tr:hover td { background: #fbfcfe; }
.status-pill { border-radius: 999px; }
.table-pagination { padding: 14px 18px; background: #fff; }

.class-overview-grid { gap: 10px; }
.class-overview-grid article { padding: 17px 18px; }
.class-overview-grid strong { color: var(--accent); font-size: 24px; }
.teaching-tags-toolbar { min-height: 36px; }
.teaching-tag-panel { border-radius: 7px; }

.dialog-backdrop {
  z-index: 80;
  padding: 22px;
  background: rgba(23, 32, 51, .38);
  backdrop-filter: none;
}
.dialog-panel {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow-y: auto;
  padding: 0;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(16, 28, 48, .22);
  scrollbar-gutter: stable;
}
.class-dialog-panel { width: min(860px, 100%); }
.credit-rules-panel { width: min(760px, 100%); }
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 58px;
  align-items: center;
  margin: 0;
  padding: 10px 18px;
  border-bottom: 1px solid #e5eaf1;
  background: #fff;
}
.class-dialog-panel .dialog-head { align-items: center; }
.dialog-head h2 { color: #172033; font-size: 16px; }
.class-dialog-panel .dialog-head p { margin-top: 3px; color: #7a8799; font-size: 11px; }
.dialog-head .icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #647288;
  background: transparent;
  font-size: 20px;
  font-weight: 400;
}
.dialog-head .icon-btn:hover { color: var(--accent); background: var(--admin-soft); }
.dialog-panel > .form-field { margin-right: 18px; margin-left: 18px; }
.dialog-head + .form-field,
.dialog-panel > input[type="hidden"] + .form-field { margin-top: 18px; }
.dialog-panel .form-field { gap: 7px; margin-bottom: 12px; }
.dialog-panel .form-field span { color: #5f6e84; font-size: 12px; font-weight: 750; line-height: 1.35; }
.dialog-panel .form-field input,
.dialog-panel .form-field select,
.dialog-panel .form-field textarea {
  min-height: 38px;
  padding: 0 11px;
  border-color: #dce3ec;
  border-radius: 7px;
  color: #172033;
  font-size: 13px;
}
.dialog-panel .form-field textarea { min-height: 86px; padding: 10px 11px; line-height: 1.6; }
.dialog-panel .form-field input:focus,
.dialog-panel .form-field select:focus,
.dialog-panel .form-field textarea:focus {
  outline: 2px solid rgba(23, 104, 218, .2);
  border-color: var(--accent);
  box-shadow: none;
}
.role-fieldset { margin: 0 18px 12px; }
.role-fieldset legend { margin-bottom: 7px; color: #5f6e84; font-size: 12px; font-weight: 750; }
.role-check-grid { gap: 8px; }
.role-check-grid label { padding: 10px 11px; border-color: #dce3ec; border-radius: 7px; }
.role-check-grid label:has(input:checked) { border-color: rgba(23, 104, 218, .48); background: var(--admin-soft); }
.check-field { margin: 2px 18px 12px; color: #39475d; font-size: 13px; }
.dialog-panel > .feedback { margin-right: 18px; margin-left: 18px; }
.class-form-grid { gap: 12px; margin: 18px 18px 0; }
.class-member-fieldset { margin: 14px 18px 0; padding: 12px; border-color: #dce3ec; border-radius: 7px; }
.class-member-fieldset legend { color: #5f6e84; font-size: 12px; }
.class-member-search { min-height: 38px; border-color: #dce3ec; border-radius: 7px; font-size: 13px; }
.class-member-options { max-height: 170px; }
.class-member-options label { border-color: #dce3ec; border-radius: 7px; }
.rule-grid { gap: 0 12px; margin: 18px 18px 0; }
.dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 6px;
  padding: 12px 18px;
  border-top: 1px solid #e5eaf1;
  background: #fff;
}
.dialog-actions button { min-height: 36px; padding: 0 13px; font-size: 12px; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 74px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .admin-sidebar { display: grid; padding: 20px 10px 14px; border-right: 1px solid #dfe5ed; border-bottom: 0; }
  .admin-brand { justify-content: center; padding: 0; }
  .admin-brand span, .admin-nav-label { display: none; }
  .admin-navigation { display: grid; gap: 12px; overflow-x: hidden; overflow-y: auto; }
  .admin-navigation section { gap: 4px; }
  .admin-nav-item { justify-content: center; padding: 0; font-size: 0; }
  .admin-content { width: min(calc(100% - 32px), 1240px); padding-top: 22px; }
  .workspace-head { align-items: stretch; flex-direction: column; }
  .head-actions { justify-content: flex-start; }
  .search-box { width: min(100%, 360px); }
}

@media (max-width: 620px) {
  html, body { overflow: auto; }
  .admin-shell { display: block; height: auto; min-height: 100vh; padding-bottom: 66px; }
  .admin-stage { height: auto; min-height: 100vh; overflow: visible; }
  .admin-sidebar { position: fixed; inset: auto 0 0; z-index: 30; width: 100%; height: 64px; display: block; padding: 6px 10px; border-top: 1px solid #dfe5ed; border-right: 0; }
  .admin-brand, .admin-nav-label { display: none; }
  .admin-navigation { display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; }
  .admin-navigation section { display: flex; gap: 2px; }
  .admin-nav-item { width: 70px; min-height: 52px; flex: 0 0 70px; flex-direction: column; justify-content: center; gap: 4px; padding: 0 4px; font-size: 9px; text-align: center; }
  .admin-topbar { height: 56px; padding: 0 16px; }
  .admin-role-summary { display: none; }
  .admin-topbar .avatar-btn { width: 40px; height: 40px; }
  .admin-topbar .avatar-btn b { width: 31px; height: 31px; }
  .admin-content { width: calc(100% - 28px); padding: 18px 0 34px; }
  .workspace-head h1 { font-size: 21px; }
  .head-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; }
  .head-actions > .primary-btn, .head-actions > .secondary-btn { grid-column: 1 / -1; }
  .search-box { width: 100%; }
  .class-overview-grid, .teaching-tags-grid { grid-template-columns: 1fr; }
  .table-panel { border-radius: 7px; }
  .dialog-backdrop { padding: 12px; }
  .dialog-panel { max-height: calc(100vh - 24px); padding: 0; }
  .dialog-head { min-height: 54px; padding: 8px 14px; }
  .dialog-panel > .form-field { margin-right: 14px; margin-left: 14px; }
  .dialog-head + .form-field,
  .dialog-panel > input[type="hidden"] + .form-field { margin-top: 14px; }
  .role-fieldset, .check-field { margin-right: 14px; margin-left: 14px; }
  .class-form-grid { grid-template-columns: 1fr; margin: 14px 14px 0; }
  .class-member-fieldset, .rule-grid { margin-right: 14px; margin-left: 14px; }
  .rule-grid { grid-template-columns: 1fr; }
  .dialog-actions { padding: 11px 14px; }
  .dialog-actions button { flex: 1; }
}

/* Portal catalog management */
.portal-catalog-overview article { min-height: 104px; }
.portal-catalog-table { min-width: 940px; }
.catalog-admin-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.catalog-admin-tags span { padding: 3px 7px; border-radius: 999px; color: #52647d; background: #f0f4f9; font-size: 10px; white-space: nowrap; }
.profession-library-table { min-width: 1120px; }
.profession-library-table th:nth-child(1) { width: 25%; }
.profession-library-table th:nth-child(2) { width: 14%; }
.profession-library-table th:nth-child(3) { width: 23%; }
.profession-library-table th:nth-child(4) { width: 20%; }
.profession-level-cell strong,.profession-level-cell small { display: block; }
.profession-level-cell strong { color: #26384f; font-size: 13px; }
.profession-level-cell small { margin-top: 4px; color: #8190a3; font-size: 11px; }
.profession-discipline-cell { display: block; max-width: 300px; color: #52647b; font-size: 12px; line-height: 1.55; }
.profession-content-cell { display: flex; flex-wrap: wrap; gap: 5px; }
.profession-content-cell span { padding: 4px 7px; border-radius: 5px; color: #42617e; background: #eef4fa; font-size: 10px; font-weight: 750; white-space: nowrap; }
.profession-content-cell span.is-empty { color: #9a6a24; background: #fff6df; }
.portal-catalog-dialog { width: min(820px, 100%); }
.portal-catalog-dialog .dialog-head { align-items: center; }
.portal-catalog-dialog .dialog-head p { margin: 3px 0 0; color: #7a8799; font-size: 11px; }
.quick-profession-dialog { width: min(720px, 100%); }
.quick-profession-note { padding: 10px 12px; border: 1px solid #dce8f7; border-radius: 7px; color: #5e7188; background: #f3f7fc; font-size: 11px; line-height: 1.65; }
.portal-catalog-form textarea { resize: vertical; }
.portal-catalog-form .full-row { grid-column: 1 / -1; }
.portal-cover-field .teaching-cover-field { display: grid; min-width: 0; gap: 7px; }
.portal-cover-field .teaching-cover-field > span:first-child { color: #5f6e84; font-size: 12px; font-weight: 750; }
.portal-cover-field .teaching-cover-upload {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid #dce3ec;
  border-radius: 7px;
  background: #f8fafc;
}
.portal-cover-field .teaching-cover-preview {
  width: 160px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #cbd6e4;
  border-radius: 7px;
  color: #8a96a8;
  background: #fff;
  font-size: 12px;
}
.portal-cover-field .teaching-cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.portal-cover-field .teaching-cover-picker { position: relative; display: grid; min-width: 0; gap: 7px; justify-items: start; }
.portal-cover-field .teaching-cover-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.portal-cover-field .teaching-cover-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid rgba(23, 104, 218, .34);
  border-radius: 7px;
  color: var(--accent);
  background: var(--admin-soft);
  font-size: 12px;
  font-weight: 800;
}
.portal-cover-field .teaching-cover-name { max-width: 100%; overflow: hidden; color: #44536a; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.portal-cover-field .teaching-cover-picker small { color: #8a96a8; font-size: 11px; line-height: 1.5; }
.portal-catalog-view .row-actions .secondary-btn { min-height: 30px; padding: 0 9px; }
.status-pill.danger { color: #a13b48; background: #fff0f2; }

@media (max-width: 620px) {
  .portal-catalog-form { grid-template-columns: 1fr; }
  .portal-catalog-form .full-row { grid-column: auto; }
  .portal-cover-field .teaching-cover-upload { grid-template-columns: 1fr; }
  .portal-cover-field .teaching-cover-preview { width: 100%; max-width: 240px; }
}

/* Question bank and paper composition */
.assessment-feedback { margin-bottom: 12px; }
.assessment-overview { margin-bottom: 12px; }
.assessment-table { min-width: 1040px; }
.paper-table { min-width: 760px; }
.assessment-stem { max-width: 430px; }
.assessment-stem strong { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.55; }
.question-group-cell { display: block; max-width: 150px; overflow: hidden; color: #5f6e84; text-overflow: ellipsis; white-space: nowrap; }
.question-type-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.question-type-pill.objective { color: #1768da; background: #eef5ff; }
.question-type-pill.subjective { color: #8a4d12; background: #fff5e8; }
.assessment-dialog { width: min(900px, 100%); }
.assessment-dialog .dialog-head p { margin: 3px 0 0; color: #7a8799; font-size: 11px; }
.assessment-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; margin: 18px 18px 0; }
.assessment-form-grid .full-row { grid-column: 1 / -1; }
.question-type-help { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid #d8e7fb; border-radius: 7px; color: #52637b; background: #f4f8fe; font-size: 11px; line-height: 1.5; }
.question-type-help strong { flex: 0 0 auto; color: #1768da; font-size: 12px; }
.question-type-fields { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; margin: 0 0 13px; padding: 14px; overflow: hidden; border: 1px solid #dce5f0; border-radius: 8px; background: #fbfcfe; }
.question-type-fields-head { display: flex; min-width: 0; align-items: baseline; gap: 9px; margin-bottom: 11px; line-height: 1.5; }
.question-type-fields-head strong { flex: 0 0 auto; color: #43526a; font-size: 12px; font-weight: 800; }
.question-type-fields-head span { min-width: 0; color: #8390a2; font-size: 10px; overflow-wrap: anywhere; }
.choice-option-list, .answer-point-list { display: grid; gap: 7px; }
.choice-option-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 110px 34px; align-items: center; gap: 8px; padding: 6px 7px; border: 1px solid transparent; border-radius: 8px; background: #fff; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.choice-option-row:hover { border-color: #d6e1ef; }
.choice-option-row.selected { border-color: #9fc5f4; background: #f5f9ff; box-shadow: 0 2px 8px rgba(33, 103, 194, .07); }
.choice-option-row .option-index, .answer-point-row .answer-index { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: #1768da; background: #edf4ff; font-size: 11px; font-weight: 800; }
.choice-option-row.selected .option-index { color: #fff; background: #2376dc; }
.choice-option-row > input, .answer-point-row > input { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid #d8e0eb; border-radius: 6px; color: #2e3c51; background: #fff; font-size: 12px; outline: none; }
.choice-option-row > input::placeholder, .answer-point-row > input::placeholder { color: #9aa5b4; font-size: 12px; }
.choice-option-row > input:focus, .answer-point-row > input:focus { border-color: #3885e8; box-shadow: 0 0 0 3px rgba(34, 117, 224, .1); }
.choice-answer-control { position: relative; display: inline-flex; min-height: 34px; align-items: center; justify-content: center; gap: 6px; padding: 0 4px; border: 0; color: #758398; background: transparent; font-size: 10px; font-weight: 750; white-space: nowrap; cursor: pointer; }
.choice-answer-control:hover { color: #3e6ea9; }
.choice-answer-control.selected { color: #1768da; background: transparent; }
.choice-answer-control input, .judgement-options input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.answer-check { display: grid; width: 18px; height: 18px; place-items: center; border: 1px solid #bbc7d6; border-radius: 50%; color: transparent; background: #fff; }
.choice-answer-control.selected .answer-check, .judgement-options label.selected .answer-check { border-color: #2376dc; color: #fff; background: #2376dc; }
.option-delete-btn { display: grid; width: 32px; min-height: 32px; place-items: center; padding: 0; border: 0; border-radius: 6px; color: #9aa7b8; background: transparent; cursor: pointer; }
.option-delete-btn:hover:not(:disabled) { color: #b53f4d; background: #fff0f2; }
.option-delete-btn:disabled { color: #d2d9e2; cursor: not-allowed; }
.question-add-row { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 7px; margin-top: 9px; padding: 0 12px; border: 1px dashed #abc6e9; border-radius: 7px; color: #1768da; background: #f5f9ff; font-size: 11px; font-weight: 800; cursor: pointer; }
.question-add-row:hover { border-color: #5f9ee8; background: #edf5ff; }
.question-add-row:disabled { border-color: #d8e0ea; color: #9aa7b8; background: #f7f8fa; cursor: not-allowed; }
.question-add-row small { margin-left: auto; color: #8ca0b9; font-size: 9px; font-weight: 600; }
.judgement-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.judgement-options label { position: relative; display: flex; min-height: 48px; align-items: center; justify-content: center; gap: 8px; border: 1px solid #dce3ec; border-radius: 7px; color: #596980; background: #fff; font-size: 12px; font-weight: 750; cursor: pointer; }
.judgement-options label.selected { border-color: #438ce9; color: #1768da; background: #f1f7ff; box-shadow: 0 0 0 2px rgba(34, 117, 224, .08); }
.answer-point-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 34px; align-items: center; gap: 8px; padding: 6px 7px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.compose-tabs { display: flex; gap: 4px; margin: 16px 18px 0; padding: 4px; border-radius: 7px; background: #f1f4f8; }
.compose-tabs button { min-height: 34px; flex: 1; border: 0; border-radius: 5px; color: #68758a; background: transparent; font-size: 12px; font-weight: 750; cursor: pointer; }
.compose-tabs button.active { color: #1768da; background: #fff; box-shadow: 0 1px 4px rgba(22, 38, 62, .12); }
.paper-meta-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 14px; }
.dialog-panel .paper-meta-grid .form-field input, .dialog-panel .paper-meta-grid .form-field select { min-height: 38px; font-size: 12px; }
.manual-question-picker, .auto-rule-editor { margin: 4px 18px 14px; border: 1px solid #dce3ec; border-radius: 7px; overflow: hidden; }
.manual-question-picker > header, .auto-rule-editor > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 13px; border-bottom: 1px solid #e5eaf1; background: #f8fafd; }
.manual-question-picker header span, .auto-rule-editor header span { font-size: 12px; font-weight: 750; }
.valid { color: #14804a; }
.invalid { color: #bd3f4f; }
.manual-question-filters { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto; align-items: end; gap: 10px; padding: 11px 12px; border-bottom: 1px solid #e5eaf1; background: #fff; }
.manual-question-filters > label { display: grid; gap: 5px; color: #68768b; font-size: 10px; font-weight: 750; }
.manual-question-filters select { width: 100%; min-height: 36px; padding: 0 32px 0 10px; border: 1px solid #d5dde8; border-radius: 6px; color: #344258; background: #fff; font-size: 11px; outline: none; }
.manual-question-filters select:focus { border-color: #3885e8; box-shadow: 0 0 0 3px rgba(34, 117, 224, .09); }
.paper-batch-select { display: flex; align-items: center; gap: 9px; min-height: 36px; }
.paper-batch-select > span { color: #7f8ca0; font-size: 10px; white-space: nowrap; }
.paper-batch-select button { min-height: 36px; padding: 0 12px; border: 1px solid #b9d1ef; border-radius: 6px; color: #1768da; background: #f5f9ff; font-size: 11px; font-weight: 750; white-space: nowrap; cursor: pointer; }
.paper-batch-select button:hover:not(:disabled) { border-color: #73a8e8; background: #edf5ff; }
.paper-batch-select button:disabled { color: #9aa7b8; border-color: #d8e0ea; background: #f7f8fa; cursor: not-allowed; }
.manual-question-list { max-height: 320px; overflow-y: auto; }
.manual-question-list > label { display: grid; grid-template-columns: auto minmax(0, 1fr) 72px; align-items: center; gap: 10px; min-height: 58px; padding: 9px 12px; border-bottom: 1px solid #edf0f4; cursor: pointer; }
.manual-question-list > label:last-child { border-bottom: 0; }
.manual-question-list > label.selected { background: #f3f8ff; }
.manual-question-list > label > span { min-width: 0; display: grid; gap: 3px; }
.manual-question-list > label > span strong { overflow: hidden; color: #26344a; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.manual-question-list > label > span small { color: #8490a1; font-size: 10px; }
.manual-question-list > label > input[type="number"] { width: 70px; min-height: 34px; padding: 0 7px; border: 1px solid #d5dde8; border-radius: 6px; font-size: 11px; }
.manual-question-empty { margin: 0; padding: 28px 16px; color: #8b97a8; font-size: 11px; text-align: center; }
.auto-rule-editor { padding-bottom: 12px; }
.auto-rule-row { display: grid; grid-template-columns: minmax(120px, 1.3fr) 120px 110px 78px 86px 34px; align-items: end; gap: 8px; padding: 9px 12px; border-bottom: 1px solid #edf1f6; }
.auto-rule-row > input, .auto-rule-row > select, .auto-rule-row label input { box-sizing: border-box; width: 100%; min-height: 36px; padding: 0 9px; border: 1px solid #d8e0eb; border-radius: 6px; color: #344258; background-color: #fff; font-size: 11px; outline: none; }
.auto-rule-row > input::placeholder { color: #9aa5b4; font-size: 11px; }
.auto-rule-row > input:focus, .auto-rule-row > select:focus, .auto-rule-row label input:focus { border-color: #3885e8; box-shadow: 0 0 0 3px rgba(34, 117, 224, .09); }
.auto-rule-row label { display: grid; gap: 3px; color: #758296; font-size: 9px; }
.auto-rule-delete { display: grid; width: 32px; min-height: 32px; place-items: center; align-self: end; margin-bottom: 2px; padding: 0; border: 0; border-radius: 6px; color: #9aa7b8; background: transparent; cursor: pointer; }
.auto-rule-delete:hover { color: #b53f4d; background: #fff0f2; }
.auto-rule-add { display: flex; width: calc(100% - 24px); min-height: 38px; align-items: center; gap: 7px; margin: 10px 12px 0; padding: 0 11px; border: 1px dashed #abc6e9; border-radius: 7px; color: #1768da; background: #f5f9ff; font-size: 11px; font-weight: 800; cursor: pointer; }
.auto-rule-add:hover { border-color: #5f9ee8; background: #edf5ff; }
.auto-rule-add:disabled { border-color: #d8e0ea; color: #9aa7b8; background: #f7f8fa; cursor: not-allowed; }
.auto-rule-add small { margin-left: auto; color: #8ca0b9; font-size: 9px; font-weight: 600; }
.paper-preview-list { display: grid; gap: 12px; padding: 18px; }
.paper-preview-list article { padding: 14px; border: 1px solid #dfe5ed; border-radius: 7px; }
.paper-preview-list article header { display: flex; justify-content: space-between; gap: 16px; color: #1768da; font-size: 11px; }
.paper-preview-list article p { margin: 10px 0; color: #26344a; font-size: 13px; line-height: 1.7; }
.paper-preview-list article ol { margin: 8px 0 10px 22px; color: #526078; font-size: 12px; line-height: 1.8; }
.paper-preview-list article small { color: #788598; line-height: 1.6; }
.paper-edit-notice { margin: 0; padding: 14px; color: #8a5b16; background: #fff8e8; font-size: 11px; line-height: 1.6; }
.confirm-delete-dialog { width: min(440px, 100%); display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; padding: 20px; overflow: visible; }
.confirm-delete-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #b53f4d; background: #fff0f2; }
.confirm-delete-dialog h2 { margin: 1px 0 8px; color: #26344a; font-size: 17px; }
.confirm-delete-dialog p { margin: 0; color: #758296; font-size: 11px; line-height: 1.65; }
.confirm-delete-dialog .confirm-delete-target { overflow: hidden; margin-bottom: 5px; color: #44536a; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.confirm-delete-dialog > .feedback, .confirm-delete-dialog > .dialog-actions { grid-column: 1 / -1; margin-right: 0; margin-left: 0; }
.confirm-delete-dialog > .dialog-actions { padding: 4px 0 0; border-top: 0; }
.confirm-delete-btn { min-height: 36px; padding: 0 14px; border: 1px solid #bd4653; border-radius: 6px; color: #fff; background: #bd4653; font-size: 11px; font-weight: 800; cursor: pointer; }
.confirm-delete-btn:hover { border-color: #a93643; background: #a93643; }
.confirm-delete-btn:disabled { opacity: .6; cursor: not-allowed; }

@media (max-width: 760px) {
  .assessment-form-grid { grid-template-columns: 1fr; margin-right: 14px; margin-left: 14px; }
  .assessment-form-grid .full-row { grid-column: auto; }
  .manual-question-picker, .auto-rule-editor { margin-right: 14px; margin-left: 14px; }
  .auto-rule-row { grid-template-columns: 1fr 1fr; }
  .auto-rule-row > input { grid-column: 1 / -1; }
  .auto-rule-delete { justify-self: end; }
  .auto-rule-add small { display: none; }
  .paper-meta-grid { grid-template-columns: 1fr; }
  .manual-question-filters { grid-template-columns: 1fr; }
  .paper-batch-select { justify-content: space-between; }
  .manual-question-list > label { grid-template-columns: auto minmax(0, 1fr); }
  .manual-question-list > label > input[type="number"] { grid-column: 2; }
  .question-type-help { align-items: flex-start; flex-direction: column; gap: 2px; }
  .question-type-fields-head { align-items: flex-start; flex-direction: column; gap: 2px; }
  .choice-option-row { grid-template-columns: 30px minmax(0, 1fr) 34px; }
  .choice-answer-control { grid-column: 2; }
  .choice-option-row > button { grid-column: 3; grid-row: 1 / span 2; }
  .question-add-row small { display: none; }
  .confirm-delete-dialog { grid-template-columns: 36px minmax(0, 1fr); padding: 16px; }
}

/* Unified data-list language, aligned with the teaching center. */
.admin-list-view { display: grid; gap: 14px; }
.admin-list-view .admin-list-overview,
.admin-list-view .class-overview-grid { gap: 12px; margin: 0; }
.admin-list-view .class-overview-grid article {
  position: relative;
  min-height: 116px;
  align-content: center;
  gap: 7px;
  overflow: hidden;
  padding: 20px 22px;
  border: 1px solid #dce3ec;
  border-radius: 7px;
  background: #fff;
}
.admin-list-view .class-overview-grid article::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: var(--accent);
  opacity: .78;
}
.admin-list-view .class-overview-grid span { color: #617087; font-size: 12px; font-weight: 800; }
.admin-list-view .class-overview-grid strong { color: var(--accent); font-size: 27px; font-weight: 760; line-height: 1; }
.admin-list-view .class-overview-grid small { color: #8290a3; font-size: 11px; line-height: 1.45; }
.admin-list-view .table-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dce3ec;
  border-radius: 7px;
  background: #fff;
}
.admin-list-view .table-summary {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 20px;
  border-bottom: 1px solid #e2e7ee;
  background: #fff;
}
.admin-list-view .table-summary strong { color: var(--accent); font-size: 23px; font-weight: 780; line-height: 1; }
.admin-list-view .table-summary span { color: #435168; font-size: 14px; font-weight: 760; }
.admin-list-view .table-summary small { margin-left: 3px; color: #8390a2; font-size: 11px; }
.admin-list-view .table-wrap {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-color: #cbd5e1 transparent;
  scrollbar-width: thin;
}
.admin-list-view table { border-spacing: 0; border-collapse: separate; }
.admin-list-view th {
  height: 48px;
  padding: 0 18px;
  border-bottom: 1px solid #dfe5ed;
  color: #546278;
  background: #f6f8fb;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
  white-space: nowrap;
}
.admin-list-view td {
  min-height: 62px;
  padding: 14px 18px;
  border-bottom: 1px solid #e8ecf2;
  color: #354158;
  font-size: 13px;
  line-height: 1.55;
  vertical-align: middle;
}
.admin-list-view tbody tr:last-child td { border-bottom: 0; }
.admin-list-view tbody tr { transition: background-color .16s ease; }
.admin-list-view tbody tr:hover td { background: #f8fbff; }
.admin-list-view .cell-main { gap: 4px; }
.admin-list-view .cell-main strong { color: #253248; font-size: 14px; font-weight: 760; }
.admin-list-view .cell-main span { color: #3e4c61; }
.admin-list-view .cell-main small { color: #8390a3; font-size: 11px; line-height: 1.45; }
.admin-list-view td.muted {
  height: 150px;
  color: #8995a6;
  background: #fbfcfe;
  text-align: center;
  vertical-align: middle;
}
.admin-list-view .status-pill {
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.admin-list-view .row-actions { flex-wrap: nowrap; align-items: center; gap: 7px; }
.admin-list-view .row-actions .text-btn,
.admin-list-view .row-actions .secondary-btn,
.admin-list-view .row-actions .danger-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #d3dce8;
  border-radius: 6px;
  color: var(--accent);
  background: #fff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.admin-list-view .row-actions .text-btn:hover,
.admin-list-view .row-actions .secondary-btn:hover { border-color: rgba(23, 104, 218, .38); background: var(--admin-soft); }
.admin-list-view .row-actions .danger-btn { border-color: rgba(190, 60, 75, .22); color: #b33c4a; }
.admin-list-view .row-actions .danger-btn:hover { background: #fff4f5; }
.admin-list-view .table-pagination {
  min-height: 60px;
  padding: 0 18px;
  border-top: 1px solid #e2e7ee;
  color: #7b889b;
  background: #fff;
  font-size: 11px;
}
.admin-list-view .table-pagination div { gap: 7px; }
.admin-list-view .table-pagination strong { min-width: 58px; color: #46546a; font-size: 11px; }
.admin-list-view .table-pagination .secondary-btn { min-height: 32px; padding: 0 11px; border-color: #d5dde8; border-radius: 6px; font-size: 11px; }

@media (max-width: 900px) {
  .admin-list-view .class-overview-grid { grid-template-columns: repeat(3, minmax(190px, 1fr)); overflow-x: auto; padding-bottom: 3px; }
  .admin-list-view .class-overview-grid article { min-width: 190px; min-height: 106px; padding: 17px 19px; }
}

@media (max-width: 620px) {
  .admin-list-view { gap: 11px; }
  .admin-list-view .class-overview-grid { grid-template-columns: 1fr; overflow: visible; }
  .admin-list-view .class-overview-grid article { min-width: 0; min-height: 96px; }
  .admin-list-view .table-summary { min-height: 58px; flex-wrap: wrap; padding: 10px 14px; }
  .admin-list-view .table-summary small { width: 100%; margin: -4px 0 0; }
  .admin-list-view th { padding: 0 14px; }
  .admin-list-view td { padding: 13px 14px; }
  .admin-list-view .table-pagination { min-height: 0; align-items: stretch; flex-direction: column; padding: 12px 14px; }
  .admin-list-view .table-pagination div { justify-content: space-between; }
}

/* Teaching taxonomy libraries */
.teaching-library-tabs {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 8px;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  background: #fff;
}
.teaching-library-tabs button {
  min-width: 136px;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 7px;
  color: #536177;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.teaching-library-tabs button:hover { color: var(--accent); background: #f5f8fc; }
.teaching-library-tabs button.active { color: var(--accent); background: var(--admin-soft); }
.teaching-library-panel { display: grid; }
.teaching-library-head {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid #e2e7ee;
}
.teaching-library-head-content { min-width: 0; display: flex; align-items: center; gap: 11px; color: var(--accent); }
.teaching-library-title { min-width: 0; display: grid; gap: 3px; }
.teaching-library-title strong { color: #253248; font-size: 16px; }
.teaching-library-title small { color: #7f8b9d; font-size: 11px; font-weight: 500; line-height: 1.45; }
.teaching-library-summary { min-width: 0; display: flex; align-items: baseline; gap: 7px; margin-left: 9px; padding-left: 20px; border-left: 1px solid #e2e7ee; white-space: nowrap; }
.teaching-library-summary > strong { color: var(--accent); font-size: 23px; line-height: 1; }
.teaching-library-summary > span { color: #435168; font-size: 13px; font-weight: 760; }
.teaching-library-summary > small { color: #8390a2; font-size: 11px; }
.teaching-library-head .primary-btn { min-height: 36px; gap: 6px; padding: 0 12px; }
.teaching-library-table { min-width: 720px!important; table-layout: fixed; }
.teaching-library-table th:first-child,
.teaching-library-table td:first-child { width: 28%; }
.teaching-library-table th:last-child,
.teaching-library-table td:last-child { width: 190px; padding-right: 32px; padding-left: 24px; }
.teaching-library-description { max-width: 720px; margin: 0; color: #5f6d82; line-height: 1.65; }
.teaching-library-table .row-actions { justify-content: flex-start; }
.teaching-library-table .row-actions button { display: inline-flex; align-items: center; gap: 5px; }
.teaching-library-dialog { width: min(560px, 100%); }
.teaching-library-dialog > .form-field { margin-top: 14px; }
.teaching-library-dialog > .form-field + .form-field { margin-top: 0; }
.teaching-library-confirm { width: min(460px, 100%); }
.teaching-library-confirm .dialog-head p { margin: 3px 0 0; color: #7a8799; font-size: 11px; }
.teaching-library-confirm-body { display: flex; align-items: flex-start; gap: 12px; padding: 22px 20px 18px; }
.teaching-library-confirm-body > span { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 50%; color: #b33c4a; background: #fff1f3; }
.teaching-library-confirm-body p { margin: 0; color: #4a586d; font-size: 13px; line-height: 1.7; }
.teaching-library-confirm-body strong { color: #253248; }
.confirm-danger-btn { min-height: 36px; padding: 0 14px; border: 0; border-radius: 6px; color: #fff; background: #b93e4c; cursor: pointer; font-size: 12px; font-weight: 800; }
.confirm-danger-btn:hover { background: #a93543; }
.confirm-danger-btn:disabled { cursor: not-allowed; opacity: .62; }
.teaching-tags-feedback.error { border-color: rgba(190, 60, 75, .25); color: #a13b48; background: #fff4f5; }

@media (max-width: 620px) {
  .teaching-library-tabs { min-height: 58px; padding: 6px; }
  .teaching-library-tabs button { min-width: 112px; min-height: 42px; padding: 0 14px; font-size: 12px; }
  .teaching-library-head { align-items: stretch; flex-direction: column; padding: 14px; }
  .teaching-library-head-content { align-items: flex-start; flex-wrap: wrap; }
  .teaching-library-summary { width: 100%; margin: 4px 0 0 30px; padding: 8px 0 0; border-top: 1px solid #e2e7ee; border-left: 0; }
  .teaching-library-head .primary-btn { width: 100%; }
}

/* Admin dashboard */
.admin-dashboard-view { display: grid; gap: 14px; }
.dashboard-toolbar { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #8490a2; font-size: 11px; }
.dashboard-toolbar .secondary-btn { min-height: 34px; gap: 6px; color: #526178; }
.dashboard-toolbar .spinning { animation: dashboard-spin .8s linear infinite; }
.dashboard-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border: 1px solid rgba(185, 62, 76, .2); border-radius: 7px; color: #a13b48; background: #fff4f5; font-size: 12px; }
.dashboard-error button { border: 0; color: #a13b48; background: transparent; cursor: pointer; font-weight: 800; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dashboard-metric-card { position: relative; min-width: 0; min-height: 116px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 18px; align-items: start; gap: 13px; padding: 18px; overflow: hidden; border: 1px solid #dce3ec; border-radius: 8px; color: #253248; background: #fff; text-align: left; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.dashboard-metric-card::after { position: absolute; right: -24px; bottom: -34px; width: 92px; height: 92px; border-radius: 50%; content: ""; background: currentColor; opacity: .045; }
.dashboard-metric-card:hover { transform: translateY(-2px); border-color: rgba(23, 104, 218, .28); box-shadow: 0 10px 24px rgba(28, 48, 82, .07); }
.dashboard-metric-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 9px; color: #1768da; background: #edf4ff; }
.dashboard-metric-copy { min-width: 0; display: grid; gap: 3px; }
.dashboard-metric-copy small { color: #738095; font-size: 11px; font-weight: 760; }
.dashboard-metric-copy strong { color: #1f2d44; font-size: 27px; font-weight: 780; line-height: 1.1; }
.dashboard-metric-copy em { overflow: hidden; color: #8a96a7; font-size: 11px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-metric-arrow { align-self: center; color: #b0bac8; }
.dashboard-metric-card.cyan .dashboard-metric-icon { color: #12829a; background: #eaf8fb; }
.dashboard-metric-card.violet .dashboard-metric-icon { color: #7553c7; background: #f1edfc; }
.dashboard-metric-card.orange .dashboard-metric-icon { color: #bd6b22; background: #fff4e8; }
.dashboard-metric-card.green .dashboard-metric-icon { color: #16885f; background: #eaf8f2; }
.dashboard-metric-card.gold .dashboard-metric-icon { color: #aa7921; background: #fff8e7; }
.dashboard-report-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 12px; }
.dashboard-panel { min-width: 0; overflow: hidden; border: 1px solid #dce3ec; border-radius: 8px; background: #fff; }
.dashboard-panel > header { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 17px; border-bottom: 1px solid #e8ecf2; }
.dashboard-panel > header > div { min-width: 0; display: grid; gap: 3px; }
.dashboard-panel > header strong { color: #253248; font-size: 14px; font-weight: 800; }
.dashboard-panel > header small { color: #8692a4; font-size: 10px; line-height: 1.45; }
.dashboard-panel > header > button { display: inline-flex; align-items: center; gap: 5px; padding: 5px; border: 0; color: var(--accent); background: transparent; cursor: pointer; font-size: 11px; font-weight: 800; white-space: nowrap; }
.dashboard-panel > header > span { color: #425169; font-size: 12px; font-weight: 800; }
.dashboard-panel > header > svg { color: #9aa6b7; }
.dashboard-overview-bars { display: grid; gap: 18px; padding: 24px 20px; }
.dashboard-overview-bars > div { display: grid; grid-template-columns: minmax(120px, .65fr) minmax(120px, 1fr) 42px; align-items: center; gap: 12px; }
.dashboard-overview-bars > div > span { min-width: 0; display: grid; gap: 3px; }
.dashboard-overview-bars > div > span strong { color: #39475d; font-size: 12px; }
.dashboard-overview-bars > div > span small { color: #8a96a7; font-size: 10px; }
.dashboard-overview-bars > div > div { height: 9px; overflow: hidden; border-radius: 999px; background: #eef2f6; }
.dashboard-overview-bars > div > div i { height: 100%; display: block; min-width: 2px; border-radius: inherit; background: #3c83e6; }
.dashboard-overview-bars > div > div i.success { background: #25a874; }
.dashboard-overview-bars > div > div i.danger { background: #d85b68; }
.dashboard-overview-bars > div > div i.violet { background: #8061d0; }
.dashboard-overview-bars > div > b { color: #536278; font-size: 11px; text-align: right; }
.dashboard-task-type-list { display: grid; padding: 6px 20px 14px; }
.dashboard-task-type-row { display: grid; grid-template-columns: minmax(160px, .9fr) minmax(120px, 1fr) 38px; align-items: center; gap: 14px; min-height: 57px; border-bottom: 1px solid #edf0f4; }
.dashboard-task-type-row:last-child { border-bottom: 0; }
.dashboard-task-type-row > span { min-width: 0; display: grid; gap: 3px; }
.dashboard-task-type-row strong { color: #344158; font-size: 12px; }
.dashboard-task-type-row small { overflow: hidden; color: #8a96a7; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-task-type-row > div { height: 8px; overflow: hidden; border-radius: 999px; background: #eef2f6; }
.dashboard-task-type-row > div i { height: 100%; display: block; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, #6e9ff0, #1768da); }
.dashboard-task-type-row > b { color: #344158; font-size: 12px; text-align: right; }
.dashboard-task-empty { min-height: 170px; display: grid; place-items: center; color: #909bac; font-size: 11px; }
.dashboard-organization-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 20px; }
.dashboard-organization-stats > button, .dashboard-organization-stats > div { min-width: 0; min-height: 106px; display: grid; place-content: center; gap: 7px; padding: 14px; border: 1px solid #e4e9f0; border-radius: 8px; color: #768398; background: #f9fbfe; text-align: center; }
.dashboard-organization-stats > button { cursor: pointer; }
.dashboard-organization-stats > button:hover { border-color: rgba(23, 104, 218, .3); background: var(--admin-soft); }
.dashboard-organization-stats strong { color: #243249; font-size: 25px; line-height: 1; }
.dashboard-organization-stats span { font-size: 10px; font-weight: 700; }
.dashboard-trend-chart { position: relative; height: 190px; display: grid; grid-template-columns: repeat(7, minmax(34px, 1fr)); align-items: end; gap: 10px; padding: 25px 18px 14px; background: linear-gradient(to bottom, transparent 24%, #eef2f7 25%, transparent 26%, transparent 49%, #eef2f7 50%, transparent 51%, transparent 74%, #eef2f7 75%, transparent 76%); }
.dashboard-trend-column { height: 145px; display: grid; grid-template-rows: 18px 112px 15px; justify-items: center; align-items: end; gap: 0; }
.dashboard-trend-column span { color: #607087; font-size: 10px; font-weight: 750; }
.dashboard-trend-column i { width: min(28px, 70%); min-height: 5px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #4e91ee, #1768da); box-shadow: 0 4px 12px rgba(23, 104, 218, .16); transition: height .25s ease; }
.dashboard-trend-column small { color: #8a96a7; font-size: 9px; }
.dashboard-chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #909bac; font-size: 11px; }
.dashboard-status-list { display: grid; gap: 12px; padding: 18px 17px; }
.dashboard-status-list > div { display: grid; grid-template-columns: 66px minmax(0, 1fr) 26px; align-items: center; gap: 9px; }
.dashboard-status-list > div > span { display: flex; align-items: center; gap: 6px; color: #56657a; font-size: 11px; }
.dashboard-status-list > div > span i { width: 7px; height: 7px; border-radius: 50%; background: #aab4c1; }
.dashboard-status-list > div > div { height: 7px; overflow: hidden; border-radius: 999px; background: #f0f3f7; }
.dashboard-status-list b { height: 100%; display: block; min-width: 2px; border-radius: inherit; background: #aab4c1; }
.dashboard-status-list > div > strong { color: #44536a; font-size: 11px; text-align: right; }
.dashboard-status-list .success { background: #25a874; }
.dashboard-status-list .running { background: #3c83e6; }
.dashboard-status-list .queued { background: #e3a13d; }
.dashboard-status-list .danger { background: #d85b68; }
.dashboard-content-list { display: grid; padding: 6px 17px 13px; }
.dashboard-content-list button { min-width: 0; display: grid; grid-template-columns: minmax(130px, .75fr) minmax(90px, 1fr) 38px 14px; align-items: center; gap: 11px; padding: 12px 0; border: 0; border-bottom: 1px solid #edf0f4; color: #8c98a9; background: transparent; text-align: left; cursor: pointer; }
.dashboard-content-list button:last-child { border-bottom: 0; }
.dashboard-content-list button > span { min-width: 0; display: grid; gap: 2px; }
.dashboard-content-list button strong { color: #344158; font-size: 12px; }
.dashboard-content-list button small { overflow: hidden; color: #8a96a7; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-content-list button > div { height: 7px; overflow: hidden; border-radius: 999px; background: #eef2f6; }
.dashboard-content-list button > div i { height: 100%; display: block; border-radius: inherit; background: #3982e5; }
.dashboard-content-list button > b { color: #536278; font-size: 11px; text-align: right; }
.dashboard-teaching-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 16px 17px; }
.dashboard-teaching-stats button { min-width: 0; min-height: 78px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; border: 1px solid #e5eaf1; border-radius: 7px; color: #3978d2; background: #f9fbfe; cursor: pointer; }
.dashboard-teaching-stats button > span { min-width: 0; display: grid; gap: 2px; text-align: left; }
.dashboard-teaching-stats strong { color: #26344a; font-size: 20px; line-height: 1; }
.dashboard-teaching-stats small { color: #7e8b9e; font-size: 10px; white-space: nowrap; }
.dashboard-quick-links { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 0 17px 16px; }
.dashboard-quick-links > span { margin-right: 3px; color: #8a96a7; font-size: 10px; }
.dashboard-quick-links button { min-height: 28px; padding: 0 9px; border: 1px solid #d9e1eb; border-radius: 5px; color: #536278; background: #fff; cursor: pointer; font-size: 10px; font-weight: 750; }
.dashboard-quick-links button:hover { border-color: rgba(23, 104, 218, .3); color: var(--accent); background: var(--admin-soft); }
.dashboard-recent-panel { grid-column: 1 / -1; }
.dashboard-recent-table { min-width: 720px; }
.dashboard-recent-head, .dashboard-recent-row { display: grid; grid-template-columns: minmax(210px, 1.4fr) minmax(130px, .8fr) minmax(100px, .65fr) 120px 82px; align-items: center; gap: 12px; padding: 0 17px; }
.dashboard-recent-head { min-height: 40px; color: #657289; background: #f7f9fc; font-size: 10px; font-weight: 800; }
.dashboard-recent-row { min-height: 59px; border-top: 1px solid #e9edf3; color: #56657a; font-size: 11px; }
.dashboard-recent-row:first-of-type { border-top: 0; }
.dashboard-recent-row > span { min-width: 0; }
.dashboard-recent-row > span:first-child, .dashboard-recent-row > span:nth-child(2) { display: grid; gap: 2px; }
.dashboard-recent-row strong { overflow: hidden; color: #2e3b51; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-recent-row small { overflow: hidden; color: #8c98a9; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-status-pill { min-height: 23px; display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px; color: #617087; background: #f0f3f6; font-size: 10px; font-style: normal; font-weight: 800; white-space: nowrap; }
.dashboard-status-pill.success { color: #16885f; background: #eaf8f2; }
.dashboard-status-pill.running { color: #1768da; background: #edf4ff; }
.dashboard-status-pill.queued { color: #a06a19; background: #fff6e6; }
.dashboard-status-pill.danger { color: #b33c4a; background: #fff1f3; }
.dashboard-empty { min-height: 90px; display: flex; align-items: center; justify-content: center; gap: 7px; color: #8a96a7; font-size: 11px; }
@keyframes dashboard-spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-report-grid { grid-template-columns: 1fr; }
  .dashboard-recent-panel { grid-column: auto; overflow-x: auto; }
}

@media (max-width: 620px) {
  .dashboard-toolbar { align-items: flex-start; }
  .dashboard-metrics { grid-template-columns: 1fr; }
  .dashboard-metric-card { min-height: 104px; padding: 15px; }
  .dashboard-trend-chart { gap: 5px; padding-right: 10px; padding-left: 10px; }
  .dashboard-trend-column i { width: min(22px, 75%); }
  .dashboard-content-list button { grid-template-columns: minmax(110px, .8fr) minmax(70px, 1fr) 34px 12px; gap: 8px; }
  .dashboard-teaching-stats { grid-template-columns: 1fr; }
  .dashboard-teaching-stats button { min-height: 64px; justify-content: flex-start; padding-left: 18px; }
  .dashboard-overview-bars > div { grid-template-columns: minmax(100px, .75fr) minmax(80px, 1fr) 36px; gap: 8px; }
  .dashboard-task-type-row { grid-template-columns: minmax(130px, 1fr) minmax(80px, .8fr) 30px; gap: 9px; }
  .dashboard-organization-stats { grid-template-columns: 1fr; }
  .dashboard-organization-stats > button, .dashboard-organization-stats > div { min-height: 78px; }
}
.ai-question-fields { border: 0; margin: 0; min-width: 0; }
.ai-question-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ai-question-types { min-width: 0; margin: 2px 0 14px; }
.ai-question-dialog .dialog-actions .ai-question-total { align-self: center; margin-right: 24px; color: #8390a2; font-size: 11px; font-weight: 400; line-height: 1.5; white-space: nowrap; }
.ai-question-dialog .ai-question-counts .form-field { min-width: 0; margin-bottom: 0; }
.ai-question-count-error { margin: 10px 0 0; color: #c34646; font-size: 12px; line-height: 1.5; }
.ai-question-preview p, .ai-question-preview li { white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-question-preview header { gap: 16px; flex-wrap: wrap; }

@media (max-width: 640px) { .ai-question-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Question bank grouping: scoped dialog and filter controls. */
.question-groups-dialog { width: min(620px, 100%); }
.question-groups-body { margin: 18px 18px 0; }
.question-group-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.question-groups-dialog .question-group-form .form-field { flex: 1 1 240px; min-width: 0; margin-bottom: 0; }
.question-group-form input { width: 100%; }
.question-group-form > button { min-height: 38px; font-size: 12px; }
.question-group-list-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: #5f6e84; font-size: 12px; }
.question-group-list-heading span { color: #8390a2; font-size: 11px; }
.question-group-list { margin-bottom: 18px; border: 1px solid #dce5f0; border-radius: 7px; overflow: hidden; }
.question-group-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid #e5eaf1; }
.question-group-row:last-child { border-bottom: 0; }
.question-group-row.is-default { background: #fbfcfe; }
.question-group-row.is-editing { background: #f4f8fe; }
.question-group-row > div { flex: 1; min-width: 0; }
.question-group-row strong { display: block; color: #43526a; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.question-group-row small { display: block; margin-top: 3px; color: #8390a2; font-size: 11px; }
.question-group-default { flex-shrink: 0; color: #8390a2; font-size: 11px; }
.question-group-row .text-btn { flex-shrink: 0; font-size: 12px; }
.question-groups-body .feedback { margin: 0 0 18px; font-size: 12px; overflow-wrap: anywhere; }
.question-group-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.question-group-select { position: relative; display: flex; align-items: center; width: 172px; color: #7d8ba0; }
.question-group-select > svg { position: absolute; pointer-events: none; left: 11px; }
.question-group-select > svg:last-child { right: 11px; left: auto; }
.assessment-view .question-group-select select { width: 100%; height: 36px; min-height: 36px; margin: 0; appearance: none; padding: 0 32px 0 34px; border: 1px solid #dce4ef; border-radius: 7px; background: #fff; color: #46556c; font: inherit; font-size: 12px; font-weight: 500; text-overflow: ellipsis; cursor: pointer; }
.assessment-view .question-group-select select:hover { border-color: #a9bfdc; }
.assessment-view .question-group-select select:focus-visible { outline: 3px solid #e3edff; border-color: #659ae4; }
.question-group-toolbar > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; min-height: 36px; padding: 0 12px; font-size: 12px; }
.assessment-view .table-summary { flex-wrap: wrap; }
@media (max-width: 640px) {
  .question-groups-body { margin: 14px 14px 0; }
  .question-group-form { gap: 10px; }
  .question-groups-dialog .question-group-form .form-field { flex-basis: 100%; }
  .question-group-row { gap: 8px; padding: 10px; }
  .question-group-row .text-btn { padding: 6px 2px; }
  .question-group-toolbar { margin-left: 0; width: 100%; }
  .question-group-select { flex: 1; width: auto; min-width: 0; }
}

.admin-ai-button{min-height:32px;display:inline-flex;align-items:center;gap:6px;padding:0 10px;border:1px solid var(--accent);border-radius:6px;color:#fff;background:var(--accent);box-shadow:none;cursor:pointer;font:inherit;font-size:12px;font-weight:800;white-space:nowrap}
.admin-ai-button:hover{background:var(--accent-dark);border-color:var(--accent-dark)}
.admin-ai-button.hidden{display:none}
.dialog-panel.ai-tag-dialog { width: min(1100px, calc(100vw - 40px)); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; }
.ai-tag-fields { border: 0; padding: 18px; margin: 0; min-width: 0; overflow-y: auto; display: grid; gap: 14px; }
.ai-tag-dialog .ai-tag-fields .form-field { margin: 0; }
.ai-tag-dialog .ai-tag-fields > p { margin: 0; font-size: 12px; line-height: 1.5; }
.ai-tag-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ai-tag-sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.ai-tag-picker-trigger { width: 100%; height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid #dbe3ee; border-radius: 8px; padding: 0 12px; background: white; color: #334155; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.ai-tag-picker-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-tag-picker-trigger[aria-expanded="true"] { border-color: #1769d4; box-shadow: 0 0 0 2px #1769d414; }
.ai-tag-source-popover { position: fixed; z-index: 10000; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid #dbe3ee; border-radius: 8px; background: white; box-shadow: 0 8px 24px #182d5026; color: #334155; font-size: 13px; }
.ai-tag-source-popover > input { box-sizing: border-box; flex-shrink: 0; width: 100%; height: 32px; min-height: 0; padding: 5px 9px; border: 1px solid #dbe3ee; border-radius: 5px; font: inherit; }
.ai-tag-options { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.ai-tag-source-popover .ai-tag-options label, .ai-tag-source-popover .ai-tag-course-scope { display: flex; align-items: center; gap: 8px; min-height: 32px; box-sizing: border-box; margin: 0; padding: 6px 8px; font-size: 13px; line-height: 20px; font-weight: 400; cursor: pointer; border-radius: 4px; }
.ai-tag-source-popover label:hover { background: #f3f7ff; }
.ai-tag-source-popover label:has(input:checked) { background: #edf4ff; color: #1769d4; }
.ai-tag-source-popover label:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.ai-tag-source-popover input[type="checkbox"], .ai-tag-source-popover input[type="radio"] { width: 14px; height: 14px; min-height: 0; margin: 0; flex-shrink: 0; accent-color: #1769d4; }
.ai-tag-picker-footer { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; padding-top: 6px; border-top: 1px solid #edf0f5; color: #7c8ca3; font-size: 12px; }
.ai-tag-picker-footer button { background: #1769d4; color: white; border: 0; border-radius: 4px; padding: 4px 12px; font: inherit; cursor: pointer; }
.ai-tag-options small { color: #1769d4; white-space: nowrap; }
.ai-tag-source-popover .ai-tag-options p { font-size: 12px; margin: 8px 0; color: #7c8ca3; }
.ai-tag-selected { display: flex; flex-wrap: wrap; gap: 6px; }
.teaching-tags-search { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid #e5ebf3; }
.teaching-tags-search input { width: min(360px, 100%); min-width: 0; height: 36px; border: 1px solid #dbe3ee; border-radius: 7px; padding: 0 12px; font-size: 13px; }
.teaching-tags-search span { font-size: 13px; white-space: nowrap; }
.teaching-tags-pagination, .teaching-tags-pagination > div { flex-wrap: wrap; gap: 10px; }
.teaching-tags-pagination label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; }
.teaching-tags-pagination select { width: auto; min-height: 34px; padding: 4px 8px; border: 1px solid #dbe3ee; border-radius: 6px; background: white; color: inherit; }
.ai-tag-selected button { border: 1px solid #dbe3ee; border-radius: 6px; background: #f3f7ff; color: #215daa; padding: 5px 8px; font-size: 12px; }
@media (max-width: 640px) { .ai-tag-sources { grid-template-columns: 1fr; gap: 10px; } }
.ai-tag-dialog .dialog-head { flex-shrink: 0; }
.ai-tag-preview { min-height: 0; padding: 12px 18px; overflow-y: auto; }
.ai-tag-preview-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 16px; font-size: 13px; }
.ai-tag-preview table { width: 100%; table-layout: fixed; }
.ai-tag-preview th:first-child { width: 52px; }
.ai-tag-preview th:nth-child(2) { width: 75px; }
.ai-tag-preview th:nth-child(3) { width: 22%; }
.ai-tag-preview th:last-child { width: 23%; }
.ai-tag-preview td, .ai-tag-preview th { padding: 10px 8px; font-size: 13px; vertical-align: middle; }
.ai-tag-preview td:first-child, .ai-tag-preview th:first-child { text-align: center; }
.ai-tag-preview td input[type="checkbox"] { display: block; width: 14px; height: 14px; margin: 0 auto; }
.ai-tag-preview input:not([type=checkbox]), .ai-tag-preview textarea { width: 100%; min-width: 0; box-sizing: border-box; padding: 8px 10px; border: 1px solid #d9e3f0; border-radius: 7px; font: inherit; line-height: 1.5; color: #334155; background: #fff; }
.ai-tag-preview input:not([type=checkbox]) { display: block; height: 38px; }
.ai-tag-preview textarea { display: block; min-height: 62px; resize: vertical; }
.ai-tag-preview input:focus-visible, .ai-tag-preview textarea:focus-visible { outline: 2px solid #1769d433; outline-offset: 1px; border-color: #1769d4; }
.ai-tag-conflict { color: #a16207; overflow-wrap: anywhere; }
.ai-tag-available { color: #15803d; }
.ai-tag-actions { display: flex; gap: 12px; align-items: center; flex-shrink: 0; margin-top: 18px; }
.ai-tag-actions > div { display: flex; gap: 8px; margin-left: auto; }
.ai-tag-status { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 20px; color: #64748b; }
.ai-tag-status-text { min-width: 0; max-height: 72px; overflow-y: auto; overflow-wrap: anywhere; }
.ai-tag-spinner-frame { display: flex; align-items: center; justify-content: center; flex: 0 0 22px; height: 22px; overflow: hidden; }
.ai-tag-status.is-error { color: #b91c1c; }
.ai-tag-spinner { display: block; flex-shrink: 0; animation: ai-tag-spin 1s linear infinite; }
@keyframes ai-tag-spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .ai-tag-dialog { width: calc(100vw - 24px); } .ai-tag-counts { gap: 8px; } .ai-tag-preview table { min-width: 760px; } .ai-tag-actions { flex-wrap: wrap; } .ai-tag-actions > div { flex-wrap: wrap; } .ai-tag-status { flex-basis: 65%; } }
@media (prefers-reduced-motion: reduce) { .ai-tag-spinner { animation: none; } }
.job-modal-layer { position:fixed; inset:0; z-index:1600; background:#14243a66; display:flex; align-items:center; justify-content:center; padding:24px; }
.job-modal { position:relative; width:min(720px,100%); max-height:calc(100dvh - 48px); display:flex; flex-direction:column; background:white; border:1px solid #dce5f0; border-radius:14px; overflow:hidden; color:#25354c; font-size:13px; box-shadow:0 20px 60px #14243a26; }
.job-modal-wide { width:min(920px,100%); }
.job-modal>header,.job-modal>footer { display:flex; align-items:center; gap:12px; padding:16px 24px; flex-shrink:0; }
.job-modal>header { justify-content:space-between; border-bottom:1px solid #e2e8f0; }
.job-modal h2 { margin:0; font-size:20px; line-height:1.4; }
.job-modal>footer { border-top:1px solid #e2e8f0; }
.job-modal-body { padding:16px 24px; overflow-y:auto; min-height:0; scrollbar-gutter:stable; }
.job-modal fieldset { border:0; padding:0; margin:0; min-width:0; display:grid; gap:12px; }
.job-modal label { display:grid; min-width:0; gap:5px; font-size:12px; font-weight:600; line-height:1.5; }
.job-modal input:not([type=checkbox]):not([type=file]),.job-modal select,.job-modal textarea,.job-library-toolbar select { width:100%; min-width:0; box-sizing:border-box; border:1px solid #d9e3f1; border-radius:8px; padding:10px 12px; font:inherit; background:#fff; color:#25354c; }
.job-modal textarea { resize:vertical; line-height:1.6; }
.job-modal label input,.job-modal label select,.job-modal label textarea { font-weight:400; }
.job-modal input:focus,.job-modal textarea:focus,.job-modal select:focus { outline:2px solid #1765d533; border-color:#1765d5; }
.job-form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 16px; }
.job-steps { display:flex; justify-content:space-between; padding:12px 24px; background:#f5f8fc; gap:8px; font-size:12px; flex-shrink:0; color:#8291a6; }
.job-steps .active { color:#1765d5; font-weight:700; }
.job-status { flex:1; min-width:0; font-size:13px; display:flex; gap:8px; align-items:center; color:#75869e; }
.job-status.error { color:#d33333; }
.job-status svg { flex-shrink:0; }
.job-choice-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.job-choice { min-width:0; display:grid; gap:8px; }
.job-choice>div { max-height:180px; overflow:auto; border:1px solid #e1e8f2; border-radius:8px; padding:8px; }
.job-choice>div>label { display:flex; align-items:flex-start; gap:8px; padding:7px 4px; font-weight:400; line-height:1.5; }
.job-choice input[type=checkbox] { width:15px; height:15px; margin-top:3px; flex-shrink:0; }
.job-choice small { display:inline-block; color:#1765d5; font-size:11px; margin-left:6px; }
.job-preview { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }.job-preview>h3,.job-preview>p { grid-column:1/-1; }.job-preview h3,.job-preview h4,.job-preview p { margin:0; }.job-preview p { white-space:pre-line; line-height:1.7; }.job-preview article { padding:14px; background:#f7f9fc; border-radius:8px; }
.job-confirm { position:absolute; inset:0; background:#fff; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:20px; z-index:2; }
.job-library-toolbar { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:16px 20px; }
.job-library-toolbar select { width:230px; }.job-group-thumbnail { width:100px; aspect-ratio:3/2; object-fit:cover; border-radius:8px; }
@media(max-width:700px) { .job-modal-layer { padding:10px; }.job-modal { max-height:96dvh; }.job-modal>header,.job-modal>footer,.job-modal-body { padding:14px; }.job-steps { flex-wrap:wrap; padding:12px; }.job-form-grid,.job-choice-grid { grid-template-columns:1fr; }.job-modal>footer,.job-library-toolbar { flex-wrap:wrap; }.job-modal>footer .job-status { flex-basis:65%; }.job-library-toolbar select { width:160px; } }

/* Match the compact course/project wizard controls without affecting library tables. */
.job-modal input:not([type=checkbox]):not([type=file]),.job-modal select { height:38px; padding:0 10px; font-size:13px; }
.job-modal textarea { padding:9px 10px; font-size:13px; line-height:1.7; }
.job-modal>footer { padding:12px 24px; }
.job-modal button { font-size:12px; }
.job-modal .primary-btn,.job-modal .secondary-btn,.job-modal .danger-btn { min-height:38px; padding:0 14px; border-radius:7px; display:inline-flex; align-items:center; justify-content:center; gap:6px; }
.job-modal>header>button { width:32px; height:32px; padding:0; display:grid; place-items:center; border:0; }
.job-steps>span { display:flex; align-items:center; gap:7px; white-space:nowrap; }
.job-steps b { width:24px; height:24px; border-radius:50%; background:#e8edf4; display:grid; place-items:center; font-size:11px; }
.job-steps .active b { background:#1765d5; color:white; }
.job-modal .teaching-cover-upload { padding:10px; gap:12px; }
.job-modal .teaching-cover-preview { width:120px; height:80px; flex:0 0 120px; }
.job-modal .teaching-cover-picker { min-width:0; font-size:12px; }
.job-modal .teaching-cover-picker small { font-size:11px; }
.job-preview h3 { font-size:16px; }.job-preview h4 { font-size:13px; margin-bottom:6px; }
@media(max-width:700px) { .job-preview { grid-template-columns:1fr; }.job-modal>footer { padding:12px 14px; }.job-modal>footer>.row-actions { margin-left:auto; flex-wrap:wrap; }.job-steps { gap:8px 12px; }.job-steps>span { font-size:11px; }.job-modal .teaching-cover-preview { width:96px; height:64px; flex-basis:96px; } }

.job-modal .job-status:empty { display:none; }
.job-modal>footer>.row-actions { margin-left:auto; }
@media(min-width:561px) and (max-width:700px) { .job-form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }.job-modal>footer .job-status { flex-basis:0; } }
.job-batch-list { display:grid; gap:12px; }
.job-batch-list>article { border:1px solid #dce5f0; border-radius:8px; padding:12px; display:grid; gap:8px; }
.job-batch-list p { margin:0; font-size:12px; }
.job-batch-row { display:grid; grid-template-columns:18px minmax(0,1fr) minmax(120px,.6fr) auto; gap:10px; align-items:center; }
.job-batch-progress { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.job-batch-progress>span { margin-left:auto; color:#75869e; font-size:12px; }
.job-mode-switch { margin-bottom:4px; }
@media(max-width:560px) { .job-batch-row { grid-template-columns:18px minmax(0,1fr) auto; }.job-batch-row>select { grid-column:2; grid-row:2; } }
.job-batch-selection { position:sticky; top:-16px; z-index:1; padding:12px 0; margin-bottom:12px; background:white; display:grid; gap:8px; font-size:12px; }
.job-batch-selection .row-actions { flex-wrap:wrap; }
.job-batch-list>article.is-selected { border-color:#83b0f3; background:#f8fbff; }
.job-batch-row { grid-template-columns:76px minmax(0,1fr) minmax(120px,.6fr) auto; }
.job-modal label.job-batch-check { display:flex; align-items:center; justify-content:center; gap:7px; min-height:44px; cursor:pointer; border-radius:7px; background:#edf4ff; color:#1765d5; }
.job-batch-check input[type=checkbox] { width:20px; height:20px; margin:0; accent-color:#1765d5; flex-shrink:0; cursor:pointer; }
.job-batch-summary { padding:14px; background:#f5f8fc; border-radius:8px; font-size:13px; }
.job-batch-summary p { margin:8px 0; color:#75869e; line-height:1.6; }
.job-batch-summary ul { list-style:none; padding:0; margin:12px 0 0; max-height:180px; overflow:auto; }
.job-batch-summary li { display:flex; justify-content:space-between; gap:12px; padding:7px 0; border-top:1px solid #e1e8f2; }
@media(max-width:560px) { .job-batch-row { grid-template-columns:70px minmax(0,1fr) auto; } }
