:root {
  /* Material Design 3 inspired colors */
  --md-sys-color-primary: #0b57d0;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d3e3fd;
  --md-sys-color-on-primary-container: #041e49;
  
  --md-sys-color-secondary: #00639b;
  --md-sys-color-secondary-container: #cce5ff;
  
  --md-sys-color-error: #b3261e;
  --md-sys-color-error-container: #f9dedc;
  --md-sys-color-on-error: #ffffff;
  
  --md-sys-color-background: #f1f3f4; /* Slightly grey for sandbox effect */
  --md-sys-color-surface: #f8fafd;
  --md-sys-color-surface-container: #ffffff;
  --md-sys-color-surface-container-high: #e8eaed;
  
  --md-sys-color-on-surface: #1f1f1f;
  --md-sys-color-on-surface-variant: #444746;
  --md-sys-color-outline: #c4c7c5;
  --md-sys-color-outline-variant: #e1e3e1;

  /* Mappings for legacy variables to maintain compatibility where needed */
  --bg: var(--md-sys-color-background);
  --bg-deep: var(--md-sys-color-surface-container-high);
  --panel: var(--md-sys-color-surface-container);
  --text: var(--md-sys-color-on-surface);
  --muted: var(--md-sys-color-on-surface-variant);
  --line: var(--md-sys-color-outline-variant);
  --accent: var(--md-sys-color-primary);
  --accent-strong: #0842a0;
  --accent-soft: var(--md-sys-color-primary-container);
  --danger: var(--md-sys-color-error);
  --danger-soft: var(--md-sys-color-error-container);
  --success: #146c2e;
  --success-soft: #c4eed0;
  --warning: #8f4e00;
  --warning-soft: #ffdcbb;
  
  /* Elevate / Shadows */
  --shadow-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.05), 0px 1px 2px 0px rgba(0, 0, 0, 0.1);
  --shadow-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.05), 0px 1px 2px 0px rgba(0, 0, 0, 0.1);
  --shadow-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.05), 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
  --shadow-4: 0px 6px 10px 4px rgba(0, 0, 0, 0.05), 0px 2px 3px 0px rgba(0, 0, 0, 0.1);
  --shadow-modal: 0px 8px 12px 6px rgba(0, 0, 0, 0.05), 0px 4px 4px 0px rgba(0, 0, 0, 0.1);

  /* Border Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 9999px;
  
  --transition: 0.2s cubic-bezier(0.2, 0, 0, 1);
  --transition-slow: 0.4s cubic-bezier(0.2, 0, 0, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.45;
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; font-family: inherit; }

.hidden { display: none !important; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ─── Layout (Sandbox Box Approach) ─────────────────────────────────────────── */
.admin-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  padding: 16px;
  gap: 16px;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  overflow-y: auto;
  border: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 0 8px 24px 8px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-2);
  flex-shrink: 0;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.brand-subtitle, .operator-meta, .section-kicker, .page-kicker, .muted, .metric-label {
  color: var(--muted);
}

.brand-subtitle, .page-kicker, .section-kicker {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* ─── Navigation ─────────────────────────────────────────────────────────────── */
.nav {
  display: grid;
  gap: 8px;
  margin: 0 0 24px 0;
  flex-shrink: 0;
}

.nav-link {
  min-height: 48px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-link:hover {
  background: var(--md-sys-color-surface-container-high);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.nav-icon {
  margin-right: 12px;
  font-size: 20px;
  opacity: 0.8;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  transition: all var(--transition);
}

.nav-link.active .nav-icon {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  opacity: 1;
}

/* ─── Sidebar Card (Operator) ───────────────────────────────────────────────── */
.sidebar-card {
  padding: 20px;
  margin-top: auto;
  border: 1px solid var(--line);
  background: var(--md-sys-color-surface);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.operator-name {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.operator-meta {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.sidebar-actions button {
  flex: 1;
  min-height: 36px;
  font-size: 13px;
  border-radius: var(--radius-pill);
}

/* ─── Main Workspace Area ───────────────────────────────────────────────────── */
.workspace {
  flex: 1;
  background: var(--panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  z-index: 5;
}

.topbar h1 {
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.page-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── Panels & Cards ─────────────────────────────────────────────────────────── */
.panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.panel-head h2 {
  font-size: 22px;
  font-weight: 500;
  margin: 0;
  color: var(--text);
}

.subpanel {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--transition);
}

.scrollable-panel {
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.subpanel:hover {
  box-shadow: var(--shadow-2);
}

.subpanel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.subpanel-head h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.subpanel-head.with-top-gap,
.toolbar.with-top-gap,
.table-wrap.with-top-gap,
.announcement-stats-grid.with-top-gap,
.worldbook-preparation-card.with-top-gap,
.chip-cloud.with-top-gap,
.user-picker-grid.with-top-gap,
.mini-metrics.with-top-gap,
.inline-form.with-top-gap,
.log-list.with-top-gap,
.muted.with-top-gap {
  margin-top: 24px;
}

/* ─── Metric Cards ───────────────────────────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.metric-card, .metric-mini {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-1);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-3);
}

.metric-value {
  margin-top: 12px;
  font-size: 32px;
  font-weight: 500;
  color: var(--accent-strong);
  letter-spacing: -0.02em;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.metric-mini {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--md-sys-color-surface-container-high);
  box-shadow: none;
  border: none;
}

.metric-mini strong {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 500;
  color: var(--text);
}

/* ─── Tables ────────────────────────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th, .data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  background: var(--md-sys-color-surface);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: var(--md-sys-color-surface-container-high);
}

.data-table tbody tr.active-row {
  background: var(--accent-soft);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
button, input[type="submit"] {
  min-height: 40px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

button:disabled, input[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.ghost-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}

.ghost-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}

.primary-btn {
  background: var(--accent);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--shadow-1);
}

.primary-btn:hover:not(:disabled) {
  background: var(--accent-strong);
  box-shadow: var(--shadow-2);
}

.danger-btn {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.danger-btn:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger-soft);
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* ─── Forms & Inputs ─────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.compact-grid {
  gap: 16px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-grid label span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-left: 4px;
}

.full-span {
  grid-column: 1 / -1;
}

.text-input, .text-area {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  transition: all var(--transition);
}

.text-area {
  resize: vertical;
  min-height: 80px;
}

.text-input:focus, .text-area:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.text-input:disabled, .text-area:disabled {
  background: var(--md-sys-color-background);
  color: var(--muted);
  cursor: not-allowed;
}

.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: 12px !important;
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.checkbox-row:hover {
  background: var(--md-sys-color-surface);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.inline-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.inline-form.wrap {
  flex-wrap: wrap;
}

/* ─── Detail Panels & Layouts ────────────────────────────────────────────────── */
.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(400px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.llm-dashboard, .announcement-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(460px, 0.7fr);
  gap: 24px;
  align-items: start;
}

.llm-primary-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-panel {
  position: sticky;
  top: 0;
  background: var(--panel);
  border: 1px solid var(--accent-soft);
  box-shadow: var(--shadow-2);
}

/* ─── Badges & Tags ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--muted);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
}

.announcement-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

.announcement-status-draft { background: var(--line); color: var(--text); }
.announcement-status-published { background: var(--success-soft); color: var(--success); }
.announcement-status-expired { background: var(--danger-soft); color: var(--danger); }

.priority-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

.priority-critical { background: #fde7e9; color: #b3261e; }
.priority-high { background: #fff4e5; color: #b06000; }
.priority-normal { background: var(--accent-soft); color: var(--accent); }
.priority-low { background: var(--md-sys-color-surface-container-high); color: var(--muted); }

/* ─── Specific Components ────────────────────────────────────────────────────── */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.empty-state-prompt {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--md-sys-color-surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}

.test-output {
  margin-top: 16px;
  padding: 16px;
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 250px;
  overflow-y: auto;
}

.user-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
}

.user-picker-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: all var(--transition);
  min-width: 0;
}

.user-picker-item:hover {
  background: var(--md-sys-color-surface-container-high);
}

.user-picker-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-picker-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.user-picker-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  word-break: break-all;
}

.user-picker-panel-head {
  align-items: center;
}

.user-picker-panel-summary {
  font-size: 12px;
  font-weight: 500;
}

.user-picker-panel-tools {
  margin-bottom: 12px;
}

.user-picker-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--md-sys-color-surface-container);
}

.user-picker-search-field .material-symbols-rounded {
  font-size: 18px;
  color: var(--muted);
}

.user-picker-search-field .text-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.user-picker-search-field .text-input:focus {
  box-shadow: none;
}

.chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ─── Skeleton Loading ───────────────────────────────────────────────────────── */
.skeleton-card {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.skeleton-line {
  height: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 12px;
}
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; height: 28px; }
.skeleton-cell {
  height: 14px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Modals and Overlays ────────────────────────────────────────────────────── */
.loading-overlay {
  display: none !important;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}

.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 1001;
}

.confirm-modal-box {
  background: var(--panel);
  width: 90%;
  max-width: 400px;
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-modal);
}

.confirm-modal-title {
  margin: 0 0 16px 0;
  font-size: 20px;
}

.confirm-modal-body {
  margin: 0 0 32px 0;
  color: var(--muted);
  line-height: 1.5;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.confirm-modal-actions button {
  min-width: 80px;
}

.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  z-index: 1002;
  transition: opacity var(--transition), transform var(--transition);
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

/* ─── Login Screen ───────────────────────────────────────────────────────────── */
.admin-login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--bg) 0%, var(--md-sys-color-primary-container) 100%);
  padding: 24px;
}

.admin-login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: var(--panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-4);
  border: 1px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px);
}

.login-brand {
  justify-content: center;
  margin-bottom: 24px;
  border: none;
}

.login-title {
  text-align: center;
  font-size: 24px;
  margin: 0 0 12px 0;
}

.login-copy {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 32px 0;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-error {
  margin-top: 16px;
  color: var(--danger);
  text-align: center;
  font-size: 14px;
  background: var(--danger-soft);
  padding: 10px;
  border-radius: var(--radius-sm);
}

.page-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.page-tab {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 0;
  cursor: pointer;
  transition: all var(--transition);
}

.page-tab:hover {
  color: var(--text);
  background: var(--md-sys-color-surface-container-high);
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

.page-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─── Worldbook Preparation Layout ───────────────────────────────────────────── */
.worldbook-preparation-card {
  background: var(--success-soft);
  border: 1px solid var(--success);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: var(--success);
}

/* ─── Button Row ─────────────────────────────────────────────────────────────── */
.button-group-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  align-items: center;
}

/* ─── Status Pills (Worldbook) ──────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  width: fit-content;
}

.status-pill.success { background: var(--success); color: #fff; }
.status-pill.danger { background: var(--danger); color: #fff; }
.status-pill.warning { background: var(--warning); color: #fff; }
.status-pill.muted { background: var(--line); color: var(--text); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.status-pill-meta {
  opacity: 0.8;
  font-size: 12px;
  margin-left: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.4);
  padding-left: 8px;
}

.worldbook-preparation-card {
  transition: all var(--transition);
}
.worldbook-preparation-card:has(.status-pill.success) {
  background: var(--success-soft);
  border-color: var(--success);
}
.worldbook-preparation-card:has(.status-pill.warning) {
  background: var(--warning-soft);
  border-color: var(--warning);
}
.worldbook-preparation-card:has(.status-pill.danger) {
  background: var(--danger-soft);
  border-color: var(--danger);
}

/* ---- New Compact Flex Layout & Inner Scrolling ---- */
.page-view {
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 16px 24px 24px !important; /* Tighter padding */
}

.page-view.hidden {
  display: none !important;
}

.panel {
  flex: 1;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

.users-layout,
.llm-dashboard, 
.announcement-dashboard {
  flex: 1;
  overflow: hidden !important;
  align-items: stretch !important;
  gap: 16px !important;
}

.llm-primary-column {
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.subpanel {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important; /* Hide overflow at subpanel level */
  max-height: none !important;
  border: 1px solid var(--line); /* Re-verify border */
}

/* Only content areas inside subpanel should scroll */
.table-wrap {
  flex: 1;
  overflow-y: auto !important;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
  border: none !important; /* Subpanel has border */
}

.subpanel > form,
.subpanel > .log-list,
.subpanel > .inline-form,
.subpanel > .mini-metrics {
  flex-shrink: 0; /* Keep them sizing normally */
}

/* Detail panel inner scroll: give it a wrapper or just let the whole subpanel scroll */
.subpanel.scrollable-panel {
  overflow-y: auto !important; 
}
.detail-panel {
  position: static !important;
}

/* Sticky Data Table Headers */
.data-table {
  border-collapse: separate; /* Required for sticky borders */
  border-spacing: 0;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--md-sys-color-surface-container, #f5f5f5) !important;
  padding: 10px 16px !important; /* Compact */
  border-bottom: 2px solid var(--line) !important;
}
.data-table td {
  padding: 10px 16px !important; /* Compact */
}

.subpanel-head {
  padding: 12px 16px !important;
  flex: 0 0 auto !important;
  background-color: var(--surface-1);
}

/* Tighter toolbar / Inline elements */
.toolbar {
  gap: 8px !important;
}

.tab-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden !important; }


/* Additional Compact Overrides */
.primary-btn, .ghost-btn, .danger-btn {
  padding: 6px 14px !important;
  font-size: 13px !important;
  height: auto !important;
  min-height: 32px !important; /* give it a fixed compact min height */
  border-radius: var(--radius) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.llm-admin-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1.55fr) minmax(440px, 0.92fr) !important;
  gap: 16px !important;
  align-items: stretch !important;
  min-height: 0;
}

.llm-admin-left {
  display: grid !important;
  grid-template-rows: minmax(300px, 0.9fr) minmax(320px, 1.05fr);
  min-width: 0;
  gap: 16px !important;
  min-height: 0;
}

.llm-list-panel,
.llm-logs-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.llm-list-wrap,
.llm-logs-wrap {
  flex: 1;
  min-height: 0;
}

.llm-editor-empty {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.llm-editor-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.llm-editor-content.hidden {
  display: none !important;
}

.worldbook-dashboard {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(380px, 0.45fr) minmax(560px, 1fr);
  gap: 32px;
  align-items: start !important;
}

.worldbook-list-panel,
.worldbook-detail-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.worldbook-detail-panel.scrollable-panel {
  overflow: visible !important;
}

/* ─── Worldbook Entry Modal ───────────────────────────────────────────────────── */
.worldbook-entry-modal-box {
  width: min(960px, calc(100vw - 48px));
  max-height: min(85vh, 880px);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.worldbook-entry-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.worldbook-entry-modal-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-close-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--md-sys-color-surface-container);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.worldbook-entry-modal-preview,
.worldbook-entry-edit-form {
  min-height: 0;
  overflow: auto;
  padding: 16px 0 0;
}

.worldbook-entry-preview-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.worldbook-entry-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.worldbook-entry-preview-body {
  white-space: pre-wrap;
  line-height: 1.8;
  color: var(--text);
  font-size: 14px;
}

.worldbook-entry-preview-json {
  margin-top: 16px;
  padding: 14px;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--radius);
  font-size: 12px;
  overflow: auto;
}

.worldbook-entry-modal-actions {
  margin-top: 16px;
}

.code-area {
  font-family: "Consolas", "SFMono-Regular", monospace;
}

.worldbook-entry-mode-tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--line);
}

.tab-strip .tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.tab-strip .tab:hover {
  color: var(--text);
  background: var(--md-sys-color-surface-container);
}

.tab-strip .tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Admin polish: local fonts, icon fallback, smaller dense layout ---- */
.material-symbols-rounded {
  display: none !important;
}

.modal-close-btn::before {
  content: '×';
  display: inline-block;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
}

.admin-shell {
  gap: 12px;
  padding: 12px;
}

.sidebar {
  width: 236px;
  padding: 18px 12px;
}

.brand {
  gap: 12px;
  padding: 0 6px 18px 6px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 40px;
  height: 40px;
}

.brand-title {
  font-size: 16px;
}

.brand-subtitle,
.page-kicker,
.section-kicker {
  font-size: 10px;
}

.nav {
  gap: 6px;
}

.nav-link {
  min-height: 40px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 16px;
}

.nav-icon {
  display: none !important;
}

.sidebar-card {
  padding: 16px;
}

.operator-name {
  font-size: 15px;
}

.operator-meta,
.muted,
.metric-label {
  font-size: 11px;
}

.topbar {
  padding: 18px 22px 12px;
}

.topbar h1 {
  font-size: 19px;
  font-weight: 600;
}

.page-view {
  padding: 14px 18px 20px !important;
  gap: 16px !important;
}

.panel {
  gap: 16px !important;
}

.subpanel {
  padding: 16px !important;
  border-radius: 18px;
}

.subpanel-head {
  padding: 8px 10px !important;
  margin-bottom: 12px;
}

.subpanel-head h3 {
  font-size: 14px;
}

.badge,
.chip,
.status-pill,
.priority-pill {
  font-size: 11px;
}

.text-input,
.text-area,
button,
input[type="submit"] {
  font-size: 12px !important;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: 30px !important;
  padding: 4px 12px !important;
}

.empty-state-prompt,
.login-copy,
.confirm-modal-body,
.worldbook-entry-preview-body {
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  font-size: 12px !important;
}

.data-table thead th {
  font-size: 10px !important;
  padding: 8px 10px !important;
  white-space: nowrap;
}

.data-table td {
  padding: 8px 10px !important;
  vertical-align: middle;
}

.user-cell-primary {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-cell-secondary {
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.num-cell,
.checkbox-col {
  white-space: nowrap;
  text-align: center;
}

.worldbook-import-panel .user-picker-grid,
.worldbook-detail-panel .user-picker-grid {
  grid-template-columns: 1fr;
  gap: 10px;
  overflow-x: hidden;
}

.worldbook-import-panel .user-picker-item,
.worldbook-detail-panel .user-picker-item {
  align-items: flex-start;
  min-width: 0;
  padding: 10px;
}

.worldbook-import-panel .user-picker-copy,
.worldbook-detail-panel .user-picker-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.worldbook-import-panel .user-picker-title,
.worldbook-detail-panel .user-picker-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.worldbook-import-panel .user-picker-meta,
.worldbook-detail-panel .user-picker-meta {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
  word-break: break-all;
}

.worldbook-dashboard {
  grid-template-columns: minmax(340px, 0.5fr) minmax(500px, 1fr);
  gap: 24px;
}

.worldbook-catalog-panel,
.worldbook-detail-panel,
.worldbook-import-section {
  padding: 24px;
}

.worldbook-header {
  padding: 24px 32px;
}

.worldbook-header-content h1 {
  font-size: 28px;
}

/* ─── Worldbook Page Layout ───────────────────────────────────────────────────── */
#worldbooksPage,
.page-view[data-page="worldbooks"] {
  min-height: 0;
  overflow-y: auto !important;
  padding-bottom: 48px !important;
  overscroll-behavior: contain;
}

#worldbooksPage > .panel,
.page-view[data-page="worldbooks"] .panel {
  overflow: visible !important;
  min-height: max-content;
  flex: 0 0 auto !important;
}

#worldbooksPage .subpanel,
.page-view[data-page="worldbooks"] .subpanel {
  min-width: 0;
}

.worldbook-page-panel {
  gap: 24px;
}

.worldbook-page-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 24px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.worldbook-page-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.worldbook-page-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.worldbook-page-title .muted {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.worldbook-studio-grid {
  display: grid;
  grid-template-columns: minmax(380px, 0.48fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.worldbook-studio-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.worldbook-user-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 4px;
}

.worldbook-user-toolbar > .text-input {
  flex: 1 1 240px;
  min-width: 0;
}

.worldbook-owner-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.worldbook-owner-pagination .ghost-btn {
  min-width: 70px;
  padding: 6px 12px;
  font-size: 12px;
}

.worldbook-owner-pagination .muted {
  font-size: 12px;
  white-space: nowrap;
}

.worldbook-owner-filter {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--line);
}

.worldbook-owner-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.worldbook-owner-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.worldbook-owner-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.worldbook-owner-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.worldbook-owner-item {
  min-width: 0;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
  transition: all var(--transition);
}

.worldbook-owner-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.worldbook-owner-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.worldbook-owner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.worldbook-owner-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-all;
}

.worldbook-explorer-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--line);
}

.worldbook-block-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.worldbook-block-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.worldbook-block-head .muted {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.worldbook-list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.worldbook-select-all {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.worldbook-select-all input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.worldbook-inline-toolbar {
  display: flex;
  gap: 8px;
}

.worldbook-inline-toolbar .text-input {
  width: 100%;
}

.worldbook-list-wrap.worldbook-card-list {
  border-radius: 10px;
  border: 0;
  background: transparent;
  overflow: visible;
}

#worldbooksPage #worldbooksTableBody {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.worldbook-card-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
  transition: all var(--transition);
}

.worldbook-card-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-1);
}

.worldbook-card-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.worldbook-card-main {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
}

.worldbook-card-check {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding-top: 2px;
}

.worldbook-card-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.worldbook-card-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.worldbook-card-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.worldbook-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.worldbook-card-id,
.worldbook-card-owner-row {
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.worldbook-card-owner-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.5;
}

.worldbook-card-owner-extra {
  color: var(--accent-strong);
  font-weight: 600;
}

.worldbook-card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.worldbook-card-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.worldbook-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.worldbook-editor-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.worldbook-editor-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.worldbook-editor-heading .muted {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.worldbook-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.worldbook-detail-status {
  display: flex;
  align-items: center;
  gap: 8px;
}




/* ═══════════════════════════════════════════════════════════════════════════
   世界书管理工作台 — 重构 CSS
   替换原有 wb-* 系列样式，保持对 JS 挂载点兼容
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. 页面容器覆盖 ────────────────────────────────────────────────────── */
#worldbooksPage {
  padding: 0 !important;
  overflow: hidden !important;
  background: var(--md-sys-color-background);
}

#worldbooksPage > .panel {
  overflow: hidden !important;
  flex: 1 !important;
  min-height: 0;
}

/* ─── 2. 三栏工作台布局 ──────────────────────────────────────────────────── */
.wb-workbench {
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--md-sys-color-background);
}

/* ─── 3. 左栏：用户 + 世界书列表 ────────────────────────────────────────── */
.wb-rail {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #fff;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  overflow: hidden;
}

.wb-rail-head {
  flex: 0 0 auto;
  padding: 20px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wb-rail-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

/* 用户搜索框 */
.wb-search-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 8px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.wb-search-input:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px var(--md-sys-color-primary-container);
}

/* 用户列表 */
.wb-owner-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 160px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* 分页 */
.wb-owner-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 10px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.wb-page-btn {
  min-height: 26px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 6px;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.wb-page-btn:hover:not(:disabled) {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.wb-page-info {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  font-feature-settings: 'tnum';
}

/* 世界书栏分隔 */
.wb-rail-divider {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 6px;
}

.wb-rail-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

/* 世界书工具栏 */
.wb-book-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wb-select-all-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.wb-select-all-wrap input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--md-sys-color-primary);
}

.wb-icon-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 6px;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.wb-icon-action:hover:not(:disabled) {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}

.wb-icon-action.danger {
  color: var(--md-sys-color-error);
  border-color: transparent;
}

.wb-icon-action.danger:hover:not(:disabled) {
  background: var(--md-sys-color-error-container);
  border-color: var(--md-sys-color-error-container);
}

/* 世界书搜索 */
.wb-book-search {
  position: relative;
  flex: 0 0 auto;
  padding: 4px 16px 8px;
}

.wb-book-search-icon {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-sys-color-on-surface-variant);
  pointer-events: none;
}

.wb-book-search-input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 30px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 8px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  font-size: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.wb-book-search-input:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  background: #fff;
  box-shadow: 0 0 0 2px var(--md-sys-color-primary-container);
}

/* 世界书列表滚动区 */
.wb-book-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 用户条目 */
.worldbook-owner-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
  width: 100%;
  text-align: left;
}

.worldbook-owner-item:hover {
  background: var(--md-sys-color-surface-container-high);
}

.worldbook-owner-item.active {
  background: var(--md-sys-color-primary-container);
  border-color: transparent;
}

.worldbook-owner-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.worldbook-owner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worldbook-owner-meta {
  font-size: 10px;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worldbook-owner-count {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  background: rgba(11, 87, 208, 0.10);
  border-radius: 999px;
  padding: 2px 8px;
}

/* 世界书卡片条目 */
.worldbook-card-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
}

.worldbook-card-item:hover {
  background: var(--md-sys-color-surface-container-high);
}

.worldbook-card-item.active {
  background: var(--md-sys-color-primary-container);
}

.worldbook-card-check {
  flex: 0 0 auto;
  padding-top: 2px;
}

.worldbook-card-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--md-sys-color-primary);
}

.worldbook-card-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.worldbook-card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.worldbook-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.worldbook-card-id {
  font-size: 10px;
  color: var(--md-sys-color-on-surface-variant);
}

.worldbook-card-owner-row {
  font-size: 10px;
  color: var(--md-sys-color-on-surface-variant);
}

.worldbook-card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.worldbook-card-status {
  flex: 0 0 auto;
}

/* ─── 4. 中栏：条目目录浏览器 ───────────────────────────────────────────── */
.wb-catalog {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--md-sys-color-background);
  border-right: 1px solid var(--md-sys-color-outline-variant);
}

.wb-catalog-head {
  flex: 0 0 auto;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  background: #fff;
}

.wb-catalog-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.wb-catalog-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
  flex: 0 0 auto;
}

.wb-catalog-book-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 空状态 */
.wb-catalog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.wb-catalog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 32px;
  text-align: center;
}

.wb-catalog-empty-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
}

.wb-catalog-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface-variant);
  max-width: 260px;
}

/* 模块分组 */
.worldbook-module-group {
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  margin-bottom: 8px;
}

.worldbook-module-head {
  width: 100%;
  border: 0;
  background: var(--md-sys-color-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.worldbook-module-head:hover {
  background: var(--md-sys-color-surface-container-high);
}

.worldbook-module-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.worldbook-module-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worldbook-module-meta {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  flex: 0 0 auto;
}

.worldbook-module-caret {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  flex: 0 0 auto;
  transition: transform 0.15s;
}

.worldbook-module-group[open] .worldbook-module-caret {
  transform: rotate(90deg);
}

/* 条目列表 */
.worldbook-entry-list {
  display: flex;
  flex-direction: column;
}

.worldbook-entry-item {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px 10px 22px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.worldbook-entry-item:hover {
  background: var(--md-sys-color-surface-container-high);
}

.worldbook-entry-item.active {
  background: var(--md-sys-color-primary-container);
}

.worldbook-entry-item-inner {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.worldbook-entry-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worldbook-entry-subtitle {
  font-size: 11px;
  line-height: 1.4;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── 5. 右栏：世界书详情 ───────────────────────────────────────────────── */
.wb-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #fff;
  overflow: hidden;
}

/* 标题栏 */
.wb-detail-head {
  flex: 0 0 auto;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.wb-detail-name-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.wb-detail-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  line-height: 1.4;
  word-break: break-word;
  min-width: 0;
  flex: 1;
}

.wb-detail-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.wb-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 8px;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.wb-action-btn:hover:not(:disabled) {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border-color: var(--md-sys-color-outline-variant);
}

.wb-action-btn.danger {
  color: var(--md-sys-color-error);
  border-color: var(--md-sys-color-error);
}

.wb-action-btn.danger:hover:not(:disabled) {
  background: var(--md-sys-color-error-container);
}

/* 内容滚动区 */
.wb-detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 指标区 */
.wb-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.wb-metric-empty {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  padding: 16px;
  text-align: center;
  background: var(--md-sys-color-surface-container-high);
  border-radius: 8px;
}

.wb-metric-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wb-metric-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.wb-metric-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  letter-spacing: -0.01em;
  font-feature-settings: 'tnum';
}

/* 内容区块 */
.wb-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wb-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.wb-section-sublabel {
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}

.wb-field {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 8px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.wb-field:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px var(--md-sys-color-primary-container);
}

.wb-status-box {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--md-sys-color-surface-container-high);
  font-size: 12px;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
}

/* 用户权限 chip */
.wb-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  align-items: flex-start;
}

.wb-chip-empty {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

/* user-picker 在右栏中的显示 */
.wb-user-picker {
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 8px;
  overflow: hidden;
  max-height: 200px;
  overflow-y: auto;
}

.wb-user-picker.compact {
  max-height: 140px;
}

/* 保存按钮 */
.wb-save-btn {
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 8px;
  background: var(--md-sys-color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  align-self: flex-start;
}

.wb-save-btn:hover:not(:disabled) {
  background: var(--accent-strong);
}

/* 导入区 */
.wb-section-import {
  padding-top: 20px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.wb-import-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.wb-file-input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--md-sys-color-on-surface);
}

/* 空状态提示 */
.wb-empty-hint {
  padding: 20px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.5;
}

/* ─── 6. 条目详情模态框调整 ─────────────────────────────────────────────── */
.worldbook-entry-modal-box {
  width: min(960px, calc(100vw - 48px));
  max-height: min(85vh, 880px);
  display: flex;
  flex-direction: column;
}

.worldbook-entry-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.worldbook-entry-modal-head h2.confirm-modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--md-sys-color-on-surface);
}

.worldbook-entry-modal-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
}

.worldbook-entry-mode-tabs {
  display: flex;
  gap: 0;
  padding: 12px 28px 0;
}

.worldbook-entry-mode-tabs .tab {
  height: 36px;
  padding: 0 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 0;
}

.worldbook-entry-mode-tabs .tab:hover {
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-high);
}

.worldbook-entry-mode-tabs .tab.active {
  color: var(--md-sys-color-primary);
  border-bottom-color: var(--md-sys-color-primary);
}

.worldbook-entry-modal-preview,
.worldbook-entry-edit-form {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 28px;
}

.worldbook-entry-preview-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  margin: 0 0 12px;
}

.worldbook-entry-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.worldbook-entry-preview-body {
  font-size: 14px;
  line-height: 1.8;
  color: var(--md-sys-color-on-surface);
  white-space: pre-wrap;
}

.worldbook-entry-preview-json {
  margin-top: 20px;
  padding: 14px;
  background: var(--md-sys-color-surface-container-high);
  border-radius: 8px;
  font-size: 12px;
  font-family: "Consolas", "SFMono-Regular", monospace;
  overflow-x: auto;
}

.worldbook-entry-modal-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 28px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* ─── 7. 兼容旧 JS 挂载点的 chip 样式 ──────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.chip-remove {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  border-radius: 999px;
  font-size: 14px;
  line-height: 1;
  opacity: 0.7;
  min-height: auto;
}

.chip-remove:hover {
  opacity: 1;
  background: rgba(0,0,0,0.1);
}

/* ─── 8. 状态药片兼容 ────────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.status-pill.success { background: var(--success-soft); color: var(--success); }
.status-pill.danger  { background: var(--danger-soft);  color: var(--danger); }
.status-pill.warning { background: var(--warning-soft); color: var(--warning); }
.status-pill.muted   { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface-variant); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ─── 9. 废弃旧 wb-* 规则（防止干扰） ──────────────────────────────────── */
.wb-fullscreen-layout,
.wb-left-pane,
.wb-left-content,
.wb-left-section,
.wb-right-pane,
.wb-right-content,
.wb-detail-block,
.wb-pane-header,
.wb-pane-title {
  all: unset;
  display: contents;
}


/* ─── Retrieval Page Layout ─────────────────────────────────────────────────────── */
#retrievalPage,
.page-view[data-page="retrieval"] {
  min-height: 0;
  overflow-y: auto !important;
  padding-bottom: 28px !important;
  overscroll-behavior: contain;
}

#worldbooksPage.hidden,
#retrievalPage.hidden,
.page-view[data-page="worldbooks"].hidden,
.page-view[data-page="retrieval"].hidden {
  display: none !important;
}

#retrievalPage > .panel,
.page-view[data-page="retrieval"] .panel {
  overflow: visible !important;
  min-height: max-content;
  flex: 0 0 auto !important;
}

#retrievalPage .subpanel,
.page-view[data-page="retrieval"] .subpanel {
  overflow: visible !important;
  min-width: 0;
}

.retrieval-service-panel {
  gap: 14px;
}

.retrieval-quick-hint {
  margin: 0 0 10px 0;
}

.retrieval-quick-form {
  margin-top: 4px;
}

.retrieval-active-summary {
  margin-top: 4px;
}

.retrieval-summary-card {
  gap: 6px;
  min-height: 112px;
}

.retrieval-service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.retrieval-service-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 120px;
}

.retrieval-service-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--md-sys-color-surface);
}

.retrieval-service-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(11, 87, 208, 0.12);
}

.retrieval-service-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.retrieval-service-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.retrieval-service-subtitle {
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
  word-break: break-all;
}

.retrieval-service-meta {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  word-break: break-all;
}

.retrieval-service-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.retrieval-service-actions button[disabled] {
  opacity: 0.62;
  cursor: default;
  pointer-events: none;
}

.retrieval-advanced-panel {
  margin-top: 0;
}

.retrieval-advanced-summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  list-style: none;
}

.retrieval-advanced-summary::-webkit-details-marker {
  display: none;
}

.retrieval-advanced-summary::after {
  content: '展开';
  margin-left: 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.retrieval-advanced-panel[open] .retrieval-advanced-summary::after {
  content: '收起';
}

.retrieval-advanced-panel .text-area {
  min-height: 180px;
  resize: vertical;
}

#retrievalPage .retrieval-service-grid,
#retrievalPage .retrieval-service-grid > .subpanel {
  min-width: 0;
}

@media (max-width: 1320px) {
  .retrieval-service-grid {
    grid-template-columns: 1fr;
  }
}

/* Worldbook targeted cleanup */
#worldbooksPage .wb-left-content {
  gap: 12px;
}

#worldbooksPage .wb-left-content > .wb-left-section:first-child {
  flex: 0 0 292px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}

#worldbooksPage .wb-owner-list {
  flex: 1 1 auto;
  min-height: 214px;
  max-height: none;
  overflow-y: auto;
  padding-right: 4px;
}

#worldbooksPage .wb-left-content > .wb-left-section:last-child {
  flex: 1 1 auto;
  min-height: 260px;
  margin-bottom: 0;
}

#worldbooksPage .wb-scroll-area {
  flex: 0 0 124px;
  min-height: 124px;
  max-height: 148px;
}

#worldbooksPage #worldbookEntryBrowser {
  height: 100%;
  min-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

#worldbooksPage .worldbook-owner-item {
  min-height: 72px;
  padding: 14px;
  border-radius: 12px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#worldbooksPage .worldbook-owner-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#worldbooksPage .worldbook-owner-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

#worldbooksPage .worldbook-owner-meta {
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

#worldbooksPage .worldbook-owner-count {
  flex: 0 0 auto;
  min-width: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(66, 133, 244, 0.12);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

#worldbooksPage .worldbook-owner-section-caption {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

#worldbooksPage .worldbook-module-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

#worldbooksPage .worldbook-module-head {
  width: 100%;
  border: 0;
  background: #f7f7f2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
}

#worldbooksPage .worldbook-module-title-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

#worldbooksPage .worldbook-module-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

#worldbooksPage .worldbook-module-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

#worldbooksPage .worldbook-module-caret {
  flex: 0 0 auto;
  font-size: 14px;
  color: var(--muted);
}

#worldbooksPage .worldbook-entry-list {
  display: flex;
  flex-direction: column;
}

#worldbooksPage .worldbook-entry-item {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 11px 14px;
  cursor: pointer;
  text-align: left;
}

#worldbooksPage .worldbook-entry-item:hover {
  background: #f8f8f5;
}

#worldbooksPage .worldbook-entry-item.active {
  background: rgba(66, 133, 244, 0.08);
}

#worldbooksPage .worldbook-entry-title {
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#worldbooksPage .worldbook-entry-subtitle {
  width: 100%;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1280px) {
  #worldbooksPage .wb-left-content > .wb-left-section:first-child {
    flex-basis: 260px;
  }

  #worldbooksPage .wb-left-content > .wb-left-section:last-child {
    min-height: 220px;
  }
}

.wb-hidden-support {
  display: none !important;
}

.worldbook-preview-stage {
  flex: 1 1 auto;
  min-height: calc(100vh - 92px);
  background: #ffffff;
  overflow: hidden;
}

.worldbook-preview-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 92px);
  border: 0;
  background: #ffffff;
}

body:has(#worldbooksPage:not(.hidden)) .workspace > .topbar {
  display: none;
}

body:has(#worldbooksPage:not(.hidden)) #worldbooksPage {
  padding: 0 !important;
  gap: 0 !important;
  overflow: hidden !important;
}

body:has(#worldbooksPage:not(.hidden)) #worldbooksPage > .worldbook-preview-stage {
  min-height: calc(100vh - 24px);
}

body:has(#worldbooksPage:not(.hidden)) #worldbooksPage > .worldbook-preview-stage > .worldbook-preview-frame {
  min-height: calc(100vh - 24px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Sprint 1 · 系统概览（与世界书基线对齐：克制、分级明确、meta-grid）
   命名空间：.ov-*  与旧 .metric-* 共存
   ═══════════════════════════════════════════════════════════════════════════ */

.ov-stage {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 1180px;
}

/* ── Hero 卡：核心 KPI + 副标题 ── */
.ov-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 24px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.ov-hero-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.ov-hero-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
}

.ov-hero-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.25;
}

.ov-hero-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  max-width: 640px;
}

.ov-hero-stats {
  display: flex;
  gap: 28px;
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.ov-hero-stat { display: flex; flex-direction: column; gap: 2px; min-width: 88px; }

.ov-hero-stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-strong);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.ov-hero-stat-label {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── 分组 ── */
.ov-group { display: flex; flex-direction: column; gap: 12px; }

.ov-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 4px;
}

.ov-group-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.ov-group-sub {
  font-size: 12px;
  color: #9ca3af;
}

/* ── Meta Grid（参考世界书 .detail-meta-grid）── */
.ov-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--panel);
}

.ov-meta-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.ov-meta-item:nth-child(3n) { border-right: none; }
.ov-meta-item:nth-last-child(-n+3) { border-bottom: none; }

.ov-meta-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ov-meta-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  gap: 8px;
  word-break: break-word;
}

.ov-meta-unit {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
}

.ov-meta-hint {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

.ov-meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  display: inline-block;
  margin-right: 4px;
  transform: translateY(-2px);
}
.ov-meta-dot--ok   { background: var(--success); }
.ov-meta-dot--warn { background: var(--warning); }
.ov-meta-dot--err  { background: var(--danger); }

/* ── Skeleton 适配 ── */
.ov-skeleton-hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  min-height: 96px;
}

/* ── 响应式 ── */
@media (max-width: 960px) {
  .ov-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .ov-hero-stats {
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--line);
    padding-top: 16px;
  }
  .ov-meta-grid { grid-template-columns: repeat(2, 1fr); }
  .ov-meta-item:nth-child(3n) { border-right: 1px solid var(--line); }
  .ov-meta-item:nth-child(2n) { border-right: none; }
  .ov-meta-item:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .ov-meta-item:nth-last-child(-n+2) { border-bottom: none; }
}

@media (max-width: 560px) {
  .ov-meta-grid { grid-template-columns: 1fr; }
  .ov-meta-item { border-right: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Sprint 2 · 检索服务（#retrievalPage override，与世界书基线对齐）
   ═══════════════════════════════════════════════════════════════════════════ */

#retrievalPage .panel {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

#retrievalPage .panel > .panel-head {
  padding: 0 4px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
#retrievalPage .panel-head .section-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 4px;
}
#retrievalPage .panel-head h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}

#retrievalPage .subpanel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: 20px 22px;
  margin-bottom: 20px;
}

#retrievalPage .subpanel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
#retrievalPage .subpanel-head h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
#retrievalPage .subpanel-head .badge {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 9999px;
  border: none;
}

/* 快速接入表单更紧凑 */
#retrievalPage .retrieval-quick-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin-bottom: 12px;
}

#retrievalPage .retrieval-quick-form label > span {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Active summary — 用世界书 meta-grid 感觉 */
#retrievalPage .retrieval-active-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  overflow: hidden;
  margin-top: 14px;
}
#retrievalPage .retrieval-summary-card {
  background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 20px;
  min-height: unset;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#retrievalPage .retrieval-summary-card:last-child { border-right: none; }
#retrievalPage .retrieval-summary-card .metric-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
#retrievalPage .retrieval-summary-card strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
#retrievalPage .retrieval-summary-card .muted {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  word-break: break-all;
}
#retrievalPage .retrieval-summary-card.muted strong { color: #9ca3af; }

@media (max-width: 640px) {
  #retrievalPage .retrieval-active-summary { grid-template-columns: 1fr; }
  #retrievalPage .retrieval-summary-card {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  #retrievalPage .retrieval-summary-card:last-child { border-bottom: none; }
}

/* Service cards — 左侧 accent bar + meta 细化 */
#retrievalPage .retrieval-service-list { gap: 10px; }

#retrievalPage .retrieval-service-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 14px 16px 14px 18px;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#retrievalPage .retrieval-service-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: transparent;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}
#retrievalPage .retrieval-service-card:hover {
  border-color: #c7d2fe;
}
#retrievalPage .retrieval-service-card.active {
  border-color: var(--accent);
  box-shadow: none;
  background: #f5f8ff;
}
#retrievalPage .retrieval-service-card.active::before { background: var(--accent); }

#retrievalPage .retrieval-service-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}
#retrievalPage .retrieval-service-subtitle {
  font-size: 11px;
  color: #9ca3af;
  font-family: "SF Mono", ui-monospace, Consolas, monospace;
}

#retrievalPage .retrieval-service-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 0 0;
  border-top: 1px dashed var(--line);
  margin-top: 2px;
}
#retrievalPage .retrieval-service-meta span {
  display: flex;
  gap: 6px;
}
#retrievalPage .retrieval-service-meta span::before {
  content: '';
  flex: 0 0 auto;
  width: 3px;
  background: var(--line);
  border-radius: 9999px;
  margin: 4px 2px;
}

#retrievalPage .retrieval-service-actions {
  gap: 8px;
  padding-top: 6px;
}
#retrievalPage .retrieval-service-actions .ghost-btn,
#retrievalPage .retrieval-service-actions .danger-btn {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
}

/* Status pill 小号 */
#retrievalPage .retrieval-service-card-head .status-pill {
  font-size: 11px;
  padding: 2px 10px;
  height: 22px;
  font-weight: 600;
}

/* 服务池 grid 更舒展 */
#retrievalPage .retrieval-service-grid {
  gap: 20px;
  margin-bottom: 20px;
}

/* 高级 JSON 折叠面板：更淡 */
#retrievalPage .retrieval-advanced-panel {
  background: #fafbfc;
  padding: 16px 20px;
}
#retrievalPage .retrieval-advanced-summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Empty state */
#retrievalPage .empty-state-prompt {
  padding: 28px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbfc;
}


/* ═══════════════════════════════════════════════════════════════════════════
   Sprint 3 · 远程配置（Remote Channels）· .rc-* 命名空间
   对齐世界书三栏基线：左渠道列表 + 右详情
   ═══════════════════════════════════════════════════════════════════════════ */

.rc-stage {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
  flex-shrink: 0;  /* 关键：不让 flex 父压缩，让内容自然撑高 → 触发 .page-view 的 overflow-y:auto */
}

/* #channelsPage 专属：必须用 !important 压过 styles.css:1102 的全局 .page-view { overflow: hidden !important } */
#channelsPage.page-view {
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.rc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0 4px 18px;
  border-bottom: 1px solid var(--line);
}

.rc-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 4px;
}

.rc-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.rc-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  max-width: 640px;
  line-height: 1.55;
}

.rc-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}

/* ── 左栏：渠道列表 ── */
.rc-rail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rc-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.rc-rail-title { font-size: 13px; font-weight: 600; color: var(--text); }

.rc-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 9999px;
}

.rc-search { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.rc-search-input {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  background: #f3f4f6;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
}
.rc-search-input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.08);
}

.rc-channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.rc-channel-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px 10px 18px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s;
}
.rc-channel-item:hover { background: #f8fafc; }
.rc-channel-item.active {
  background: #f0f5ff;
  border-left-color: var(--accent);
}
.rc-channel-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.rc-channel-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.rc-channel-item-url {
  font-size: 11px;
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "SF Mono", ui-monospace, Consolas, monospace;
}
.rc-type-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 9999px;
  background: #e2e8f0;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.rc-type-pill.openai { background: #d1fae5; color: #065f46; }
.rc-type-pill.anthropic { background: #fef3c7; color: #92400e; }
.rc-type-pill.gemini { background: #dbeafe; color: #1e40af; }

.rc-disabled-dot {
  width: 6px; height: 6px; border-radius: 9999px;
  background: #cbd5e1; display: inline-block;
}

.rc-empty {
  padding: 32px 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
}

/* ── 右栏：详情 ── */
.rc-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
}

.rc-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 480px;
  color: #9ca3af;
  font-size: 13px;
}

.rc-detail-body { display: flex; flex-direction: column; gap: 24px; }

.rc-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.rc-section:last-child { border-bottom: none; padding-bottom: 0; }

.rc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.rc-section-actions { display: flex; gap: 8px; }

.rc-section-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rc-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.rc-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text);
  min-width: 0;
}
.rc-form-grid label > span {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
}
.rc-full { grid-column: 1 / -1; }

.rc-field {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--text);
}
.rc-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.1);
}
select.rc-field { padding-right: 28px; }

.rc-checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
}
.rc-checkbox input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
}
.rc-checkbox span { color: var(--text); font-size: 13px; font-weight: 500; }

/* ── Key 池 ── */
.rc-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.rc-add-btn:hover { background: #c7dfff; }

.rc-key-list, .rc-model-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rc-key-row, .rc-model-row {
  display: grid;
  grid-template-columns: 1fr 90px 90px 36px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.rc-key-row .rc-field, .rc-model-row .rc-field {
  height: 30px;
  font-size: 12px;
}
.rc-key-row input[type="text"],
.rc-key-row input[type="password"] {
  font-family: "SF Mono", ui-monospace, Consolas, monospace;
}

.rc-toggle-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.rc-toggle-label input { accent-color: var(--accent); }

.rc-row-del {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.rc-row-del:hover {
  background: #fef2f2;
  color: var(--danger);
}
.rc-row-del .material-symbols-rounded { font-size: 18px; }

/* 模型行：8 列 = [enable][name][ctx][emb][rerank][chat][source][delete] */
.rc-model-row {
  grid-template-columns: 28px 1fr 70px 48px 48px 48px 80px 36px;
}
.rc-model-row.is-enabled {
  background: #f0f9ff;
  border-color: #bae6fd;
}
.rc-model-row.has-role {
  background: #eef2ff;
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.rc-model-toggle {
  display: flex; align-items: center; justify-content: center;
}
.rc-model-toggle input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.rc-role-cell {
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.rc-role-cell input[type="radio"] { accent-color: var(--accent); cursor: pointer; }
.rc-model-header {
  display: grid;
  grid-template-columns: 28px 1fr 70px 48px 48px 48px 80px 36px;
  gap: 8px;
  padding: 0 12px 6px;
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.rc-model-header-col { white-space: nowrap; }
.rc-channel-item-roles {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 2px;
}
.rc-role-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: "SF Mono", ui-monospace, Consolas, monospace;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rc-role-badge.emb { background: #ecfdf5; color: #047857; }
.rc-role-badge.rr { background: #fef3c7; color: #92400e; }
.rc-role-badge.ch { background: #dbeafe; color: #1e40af; }
.rc-model-source-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  text-align: center;
}
.rc-model-source-pill.manual { background: #f3f4f6; color: #475569; }
.rc-model-source-pill.probed { background: #ecfdf5; color: #047857; }

.rc-probe-hint {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
}
.rc-probe-hint.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.rc-probe-hint.success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

.rc-model-empty, .rc-key-empty {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

/* ── 底部操作 ── */
.rc-actions-bar {
  display: flex;
  gap: 12px;
  padding-top: 8px;
  justify-content: flex-end;
}

/* ── 响应式 ── */
@media (max-width: 1080px) {
  .rc-layout { grid-template-columns: 240px 1fr; }
  .rc-form-grid { grid-template-columns: 1fr; }
  .rc-key-row { grid-template-columns: 1fr 80px 70px 32px; }
  .rc-model-row,
  .rc-model-header { grid-template-columns: 26px 1fr 60px 40px 40px 40px 70px 32px; }
}

@media (max-width: 768px) {
  .rc-layout { grid-template-columns: 1fr; }
  .rc-rail { position: static; max-height: 320px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Sprint 4 · 其他模块小调整 · .sk-* shared kit + 页面级 override
   目标：与世界书基线（浅色、克制、uppercase 小字 label、分级明确）整体对齐
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Topbar：细化标题 + kicker ── */
.topbar h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.topbar .page-kicker {
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.topbar .ghost-btn {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 500;
}
.topbar .ghost-btn:hover { background: #f8fafc; }

/* ── 账号管理 page-tab 对齐基线 ── */
#usersPage .page-tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
#usersPage .page-tab {
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
#usersPage .page-tab:hover { background: #f3f4f6; color: var(--text); }
#usersPage .page-tab.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

#usersPage .subpanel-head h3 {
  font-size: 14px;
  font-weight: 600;
}
#usersPage .subpanel-head .badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 9999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: none;
}

#usersPage .data-table thead th {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}
#usersPage .data-table tbody td {
  font-size: 13px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
#usersPage .user-row { cursor: pointer; transition: background 0.12s; }
#usersPage .user-row:hover { background: #f8fafc; }
#usersPage .user-row.selected {
  background: #f0f5ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ── 公告系统 ── */
#announcementsPage .subpanel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: 18px 22px;
}
#announcementsPage .subpanel-head h3 {
  font-size: 14px;
  font-weight: 600;
}
#announcementsPage .subpanel-head .badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: none;
  padding: 2px 10px;
  border-radius: 9999px;
}
#announcementsPage .toolbar[style] {
  /* 覆盖 inline style 的背景 */
  background: #fafbfc !important;
  border: 1px solid var(--line);
  padding: 12px !important;
  border-radius: 8px !important;
}

/* ── 公共模型（#llmPage）：先小调，等 Sprint 3c 迁移到 channels ── */
#llmPage .subpanel-head h3 {
  font-size: 14px;
  font-weight: 600;
}
#llmPage .data-table thead th {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Status pill 统一收口 ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}
.status-pill.success { background: #ecfdf5; color: #047857; }
.status-pill.muted { background: #f3f4f6; color: #6b7280; }
.status-pill .status-dot {
  width: 6px; height: 6px;
  border-radius: 9999px;
  background: currentColor;
}

/* ── 按钮尺寸规整 ── */
.primary-btn, .ghost-btn, .danger-btn {
  font-size: 13px;
  font-weight: 500;
}

/* ── Skeleton 更柔和 ── */
.skeleton-line, .skeleton-cell {
  background: linear-gradient(90deg, #eef1f4 0%, #f5f7fa 50%, #eef1f4 100%);
  background-size: 200% 100%;
  animation: sk-shimmer 1.6s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes sk-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
