/* @author wululu */
/* 全局采用系统字体与本地样式，不加载任何外部资源。 */
:root {
  color-scheme: light;
  --page: #f4fbfa;
  --surface: #ffffff;
  --ink: #17383a;
  --muted: #5f7678;
  --line: #d7e7e6;
  --ok: #1c9a74;
  --accent: #ef6f64;
  --accent-dark: #d4534a;
  --accent-soft: #fff1ef;
  --danger: #9c3b34;
  --danger-soft: #fff4f2;
  --warning: #8a5a12;
  --warning-soft: #fff8e9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(980px 460px at 50% -120px, #dff6f3 0%, transparent 68%), linear-gradient(180deg, #f7fcfb 0%, #eef7f6 42%, #f8f6f2 100%); color: var(--ink); line-height: 1.65; }

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a, [tabindex] { scroll-margin: 24px; }
:focus-visible { outline: 2px solid #efb2ab; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.shell { max-width: 1328px; margin: 0 auto; padding: 0 40px; }
.skip-link { position: absolute; top: -80px; left: 20px; z-index: 10; padding: 10px 18px; background: var(--ink); color: white; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 0 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 20px; font-weight: 650; letter-spacing: -.3px; line-height: 1.2; }
.brand-mark { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); color: transparent; font-size: 0; }
.brand-name { display: inline-flex; flex-direction: column; gap: 3px; }
.brand-caption { color: var(--muted); font-size: 12px; font-weight: 450; letter-spacing: 0; }
.header-note { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.masthead-actions { display: inline-flex; align-items: center; gap: 14px; }
.masthead-model { display: flex; align-items: center; gap: 8px; min-width: 0; }
.masthead-model-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.masthead-model .ai-model-select { flex: 0 0 auto; width: auto; min-width: 128px; max-width: 190px; height: 34px; padding: 0 10px; border: 1px solid #e4f0ef; border-radius: 10px; background: #f7fbfb; color: var(--ink); font-size: 12px; }
.gate-panel { display: grid; place-items: center; min-height: 62vh; padding: 12px 0 56px; }
.gate-card { width: min(440px, 100%); padding: 34px 32px 26px; background: #ffffffeb; color: var(--ink); border: 1px solid #ffffff; border-radius: 28px; box-shadow: 0 24px 60px #1d4d4a14, inset 0 1px 0 #ffffff; }
.gate-card h1 { display: block; margin: 8px 0 10px; font-size: 32px; font-weight: 650; letter-spacing: -.6px; line-height: 1.15; }
.gate-card .muted { margin-top: 0; font-size: 14px; line-height: 1.7; }
.gate-target { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding: 10px 14px; border: 1px solid #f3d2ce; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); }
.gate-target strong { font-size: 14px; font-weight: 650; }
.gate-target.is-restricted { border-color: #ead7b4; background: var(--warning-soft); color: var(--warning); }
.gate-form { display: grid; gap: 6px; margin-top: 18px; }
.gate-form label { color: var(--muted); font-size: 12px; }
.gate-form input { width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid #d5e4e3; border-radius: 14px; background: #f7fbfb; color: var(--ink); }
.gate-form input:focus { border-color: #efb2ab; background: white; outline: 3px solid #ef6f6424; }
.gate-form .button { width: 100%; min-height: 46px; margin-top: 10px; border-radius: 999px; font-size: 15px; }
.gate-feedback { margin-top: 14px; color: var(--muted); font-size: 12px; }
.refresh-layer { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 24px; background: #17383a33; }
.refresh-card { width: min(420px, 100%); padding: 24px; border: 1px solid white; border-radius: 24px; background: white; color: var(--ink); box-shadow: 0 24px 60px #1d4d4a24; }
.refresh-card h2 { margin: 6px 0 8px; font-size: 22px; }
.refresh-card label { display: block; margin-top: 14px; color: var(--muted); font-size: 12px; }
.refresh-card input { width: 100%; min-height: 44px; margin-top: 6px; padding: 10px 14px; border: 1px solid #d5e4e3; border-radius: 14px; background: #f7fbfb; color: var(--ink); }
.refresh-card input[readonly] { color: var(--muted); }
.refresh-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.gate-feedback.is-error { color: var(--danger); }
.ai-model-bar { display: flex; flex: 1 1 520px; align-items: center; justify-content: center; gap: 8px; min-width: 470px; max-width: 680px; padding: 9px 13px; border: 1px solid #dce8e5; border-radius: 10px; background: #fbfefd; box-shadow: 0 2px 8px #182e4708; }
.ai-model-label { color: #53657c; font-size: 11px; font-weight: 650; white-space: nowrap; }
.ai-model-select { flex: 1 1 145px; width: 145px; max-width: 190px; min-width: 110px; padding: 6px 8px; border: 1px solid #cfdedb; border-radius: 6px; background: white; color: #405b72; font-size: 11px; }
.ai-model-select:focus { border-color: var(--accent); outline: 2px solid #168fbd33; }
#ai-test { flex: 0 0 auto; border-color: #b9dcd4; background: #eaf6f3; color: var(--accent-dark); font-weight: 650; }
#ai-test:hover:not(:disabled) { border-color: #8fcbbd; background: #d9f0ea; }
.ai-feedback { display: inline-flex; max-width: 120px; align-items: center; gap: 5px; overflow: hidden; color: #7c8899; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ai-feedback::before { content: ""; display: inline-block; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #aab5c2; }
.ai-status-ready { color: var(--accent-dark); }
.ai-status-ready::before { background: #159570; box-shadow: 0 0 0 3px #1595701c; }
.ai-status-loading { color: #386293; }
.ai-status-loading::before { background: #4d8fca; animation: pulse 1.2s ease-in-out infinite; }
.ai-status-error { color: var(--danger); }
.ai-status-error::before { background: var(--danger); box-shadow: 0 0 0 3px #b23a321c; }
.ai-status-warning { color: var(--warning); }
.ai-status-warning::before { background: #d49431; }
.small-dot { width: 6px; height: 6px; background: #8695a7; border-radius: 50%; }
.environment-nav { min-height: 52px; margin-bottom: 22px; border-bottom: 0; }
.environment-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.environment-tab { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid transparent; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; border-radius: 999px; }
.environment-tab::after { content: none; }
.environment-tab:hover:not(:disabled) { color: var(--ink); background: #ffffffb8; }
.environment-tab[aria-selected="true"] { color: var(--ink); background: white; border-color: #ffffff; box-shadow: 0 8px 20px #1d4d4a12; }
.tab-code { font-size: 12px; font-weight: 450; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.tab-restricted { padding: 0 5px; border: 1px solid #ead7b4; border-radius: 4px; background: var(--warning-soft); color: var(--warning); font-size: 10px; font-weight: 500; }
.metadata-loading { padding: 12px 0; color: var(--muted); }
.metadata-error { padding: 18px; margin-bottom: 20px; border: 1px solid #f0c9c3; border-radius: 10px; background: var(--danger-soft); color: var(--danger); }
.metadata-error .button { margin-top: 12px; }
.environment-panel { padding: 18px 22px 16px; border: 1px solid #ffffff; border-radius: 22px; background: #ffffffeb; color: var(--ink); box-shadow: 0 16px 36px #1d4d4a0d; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.panel-heading-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.environment-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-top: 10px; padding: 6px 10px; border: 1px solid #e8eef4; border-radius: 7px; background: #f7fafb; color: #46586f; font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.environment-summary .field-label { font-family: inherit; }
.environment-details { margin-bottom: 2px; }
.eyebrow { margin-bottom: 4px; color: #7b8798; font-size: 9px; font-weight: 650; letter-spacing: 1.35px; }
h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; }
#current-environment { font-weight: 700; }
.code-badge { padding: 1px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.muted { margin-top: 3px; color: var(--muted); font-size: 11px; }
.badge { display: inline-flex; flex-shrink: 0; align-items: center; gap: 5px; padding: 4px 9px; border: 1px solid transparent; border-radius: 6px; font-size: 11px; font-weight: 500; }
.badge-neutral { background: #f0f3f7; color: #68758a; }
.badge-success { background: var(--accent-soft); color: var(--accent-dark); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-loading { background: #eef5ff; color: #386293; }
.restricted-warning { display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 8px 12px; border: 1px solid #f0d6a8; border-radius: 8px; background: var(--warning-soft); color: var(--warning); }
.restricted-warning > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.restricted-warning .warning-symbol { margin-top: 0; }
.warning-symbol { display: grid; flex: 0 0 19px; place-content: center; margin-top: 2px; height: 19px; border: 1.5px solid currentColor; border-radius: 50%; font-weight: 750; font-size: 12px; }
.restricted-warning strong { font-size: 12px; }
.restricted-warning p { margin-top: 0; font-size: 11px; }
.config-path-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.field-label, dt { color: var(--muted); font-size: 11px; }
.config-path-row code { color: #40526a; font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.read-only-tag { margin-left: auto; color: #8a95a5; font-size: 11px; }
.config-grid { display: grid; grid-template-columns: 1.55fr .6fr 1fr 1fr; gap: 6px 20px; margin: 12px 0 8px; }
.config-grid > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.config-grid dt { flex: 0 0 auto; margin-bottom: 0; }
dd { margin: 0; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.config-grid dd { flex: 1 1 6ch; min-width: 0; }
.config-issues { margin: 10px 0; padding: 10px 12px; border-left: 3px solid #cc6157; background: var(--danger-soft); color: var(--danger); font-size: 11px; overflow-wrap: anywhere; }
.config-issues h2 { font-size: 12px; font-weight: 650; }
.config-issues ul { margin: 5px 0 0; padding-left: 18px; }
.config-feedback { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.config-feedback.is-error { color: var(--danger); }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.environment-panel .button { min-height: 34px; padding: 6px 13px; }
.action-hint { flex: 1 1 auto; min-width: 0; color: #7c8899; font-size: 11px; line-height: 1.6; }
.actions { display: flex; flex-shrink: 0; gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 15px; border: 1px solid transparent; border-radius: 999px; font-size: 12px; font-weight: 600; transition: background .15s; }
.button-secondary { border-color: #d5e4e3; background: white; color: #3e5c5e; }
.button-secondary:hover:not(:disabled) { background: #f4faf9; }
.button-primary { background: var(--accent); color: white; }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); }
.button[aria-busy="true"]::before { content: ""; width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .85s linear infinite; }
.check-guidance { margin-top: 5px; text-align: right; font-size: 10px; color: var(--muted); }
.check-result { display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f9fafc; }
.result-indicator { flex: 0 0 7px; height: 7px; margin-top: 0; border-radius: 50%; background: #93a0b2; }
.result-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; overflow-wrap: anywhere; }
.result-copy strong { font-size: 12px; font-weight: 650; }
.result-copy p { margin-top: 0; font-size: 11px; color: var(--muted); }
.result-copy .result-details { margin-top: 0; font-size: 10px; }
.result-success { border-color: #cde7df; background: #f3faf7; }
.result-success .result-indicator { background: var(--ok); }
.result-danger { border-color: #f0d0ca; background: var(--danger-soft); }
.result-danger .result-indicator { background: var(--danger); }
.result-danger strong { color: var(--danger); }
.result-loading .result-indicator { background: #4679a7; animation: pulse 1.3s ease-in-out infinite; }
.workspace-layout { display: grid; grid-template-columns: 225px minmax(0, 1fr); gap: 22px; margin-top: 24px; }
.sidebar { padding: 20px 0; color: var(--ink); }
.sidebar > .eyebrow { padding-left: 14px; }
.menu-item { position: relative; display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 13px; border: 1px solid #e4f0ef; border-radius: 16px; background: white; color: #4e686a; font-size: 13px; font-weight: 600; transition: border-color .16s ease, background-color .16s ease, color .16s ease; }
.menu-item:hover { border-color: #f3d2ce; background: #fff8f7; color: var(--accent-dark); transform: none; }
.menu-item[aria-current="page"] { border-color: var(--accent); background: var(--accent); color: white; box-shadow: none; }
.menu-item[aria-current="page"]::before { content: none; }
.menu-item[aria-current="page"] .menu-arrow { color: white; transform: none; }
.menu-item:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px #168fbd33; outline: none; }
.menu-icon { font-size: 21px; line-height: 1; font-weight: 400; }
.menu-arrow { margin-left: auto; color: #8a9aab; font-size: 18px; font-weight: 400; transition: color .16s ease, transform .16s ease; }
.sidebar-note { margin: 18px 14px 0; color: #8994a4; font-size: 11px; }
.workspace { min-width: 0; overflow: hidden; border: 1px solid #ffffff; border-radius: 22px; background: white; color: var(--ink); box-shadow: 0 16px 36px #1d4d4a0d; }
.course-query { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 24px; border-bottom: 1px solid #eef1f5; background: #fbfcfd; }
.course-query label { display: block; margin-top: 2px; color: var(--ink); font-size: 13px; font-weight: 650; }
.course-query-hint { margin-top: 4px; color: var(--muted); font-size: 11px; }
.course-query-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; }
.course-id-input { width: 190px; min-height: 38px; padding: 8px 11px; border: 1px solid #cfd8e3; border-radius: 7px; color: var(--ink); background: white; font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; }
.course-id-input:focus { border-color: var(--accent); outline: 3px solid #168fbd33; }
.course-feedback { min-height: 20px; padding: 12px 24px 0; color: var(--muted); font-size: 12px; }
.course-feedback.is-error { color: var(--danger); }
.course-feedback.is-loading { color: #386293; }
.ai-match-controls { display: grid; gap: 10px; margin: 14px 24px 0; padding: 12px; border: 1px solid #dce8e5; border-radius: 8px; background: #fbfefd; }
.ai-batch-size-row { display: flex; align-items: center; gap: 8px; }
.ai-batch-size-row label { padding-top: 0; }
.ai-batch-size { width: 80px; min-height: 32px; padding: 6px 8px; border: 1px solid #cfd8e3; border-radius: 5px; color: var(--ink); background: white; font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.ai-inline-help { color: #8a98a8; font-size: 10px; }
.ai-selected-row, .ai-prompt-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: start; gap: 8px; }
.ai-match-controls label { padding-top: 8px; color: #53657c; font-size: 11px; font-weight: 600; white-space: nowrap; }
.ai-prompt-editor { display: grid; grid-template-columns: minmax(0, 1fr) 126px; align-items: stretch; gap: 8px; min-width: 0; }
.ai-prompt { width: 100%; min-height: 36px; resize: vertical; padding: 7px 8px; border: 1px solid #cfd8e3; border-radius: 5px; color: var(--ink); background: white; font: 11px/1.5 inherit; }
.ai-prompt:focus { border-color: var(--accent); outline: 2px solid #168fbd33; }
.ai-prompt-variables { display: flex; flex-direction: column; gap: 5px; padding: 2px 0; }
.ai-prompt-variables > span { color: #8a98a8; font-size: 10px; }
.ai-variable-button { padding: 5px 6px; border: 1px solid #c9dbe6; border-radius: 5px; background: #f5fbfd; color: #386293; font-size: 10px; line-height: 1.25; cursor: pointer; }
.ai-variable-button:hover { border-color: var(--accent); background: #eaf8fb; color: var(--accent-dark); }
.ai-selected-kp-picker { position: relative; min-width: 0; }
.ai-selected-kp-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 5px; }
.ai-selected-kp-search { min-height: 36px; resize: none; }
.ai-selected-kp-menu { top: calc(100% + 3px); max-height: 220px; }
.ai-selected-kp-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border: 1px solid #b9dcd4; border-radius: 5px; background: #effaf7; color: var(--accent-dark); font-size: 10px; }
.ai-selected-kp-remove { padding: 0; border: 0; background: transparent; color: currentColor; font-size: 13px; line-height: 1; cursor: pointer; }
.ai-selected-kp-remove:hover { color: var(--danger); }
.ai-prompt-help { grid-column: 2; margin-top: -3px; color: #8a98a8; font-size: 10px; }
.ai-match-actions { display: flex; align-items: center; gap: 8px; padding-left: 120px; }
.button-danger { border-color: #e8b9b4; background: #fff3f1; color: var(--danger); }
.button-danger:hover:not(:disabled) { border-color: #d98d86; background: #ffe5e1; }
.ai-match-feedback { min-width: 0; color: #7c8899; font-size: 10px; overflow-wrap: anywhere; }
.ai-batch-list { display: grid; gap: 7px; min-width: 0; }
.ai-batch-row { min-width: 0; padding: 8px; border: 1px solid #dce8e5; border-radius: 6px; background: #fff; }
.ai-batch-row.ai-batch-running { border-color: #8accc0; background: #f5fcfa; }
.ai-batch-row.ai-batch-success { border-color: #b8dfd5; }
.ai-batch-row.ai-batch-error { border-color: #e8b9b4; background: #fff8f7; }
.ai-batch-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #53657c; font-size: 11px; }
.ai-batch-row-actions { display: flex; align-items: center; gap: 7px; }
.ai-batch-row-status { color: #8a98a8; font-size: 10px; }
.ai-batch-row-logs { display: grid; max-height: 150px; gap: 4px; overflow-y: auto; margin-top: 6px; padding-top: 5px; border-top: 1px solid #edf1f4; }
.ai-batch-log { display: flex; align-items: flex-start; gap: 7px; color: #64758a; font-size: 10px; line-height: 1.5; }
.ai-batch-log::before { content: "●"; flex: 0 0 auto; color: #8a98a8; }
.ai-batch-log.log-success::before { color: #159570; }
.ai-batch-log.log-error::before { color: var(--danger); }
.ai-batch-log.log-warning::before { color: #d49431; }
.ai-batch-log-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ai-run-log { min-width: 0; border-top: 1px solid #e5eaf0; padding-top: 8px; }
.ai-run-log-head { display: flex; align-items: center; justify-content: space-between; color: #53657c; font-size: 11px; }
.ai-run-log-list { display: grid; max-height: 220px; gap: 5px; overflow-y: auto; margin-top: 6px; padding: 7px; border: 1px solid #e5eaf0; border-radius: 6px; background: #f8fafc; }
.ai-run-log-entry { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; color: #64758a; font-size: 10px; line-height: 1.5; }
.ai-run-log-entry::before { content: "●"; flex: 0 0 auto; color: #8a98a8; }
.ai-run-log-entry.log-success::before { color: #159570; }
.ai-run-log-entry.log-error::before { color: var(--danger); }
.ai-run-log-entry.log-warning::before { color: #d49431; }
.ai-run-log-entry.log-stopped::before { color: #7c8899; }
.ai-run-log-entry-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ai-run-log-detail { flex: 0 0 auto; padding: 2px 5px; border: 1px solid #cfd8e3; border-radius: 4px; background: white; color: #53657c; font-size: 10px; cursor: pointer; }
.ai-run-log-detail:hover { border-color: var(--accent); color: var(--accent-dark); }
.ai-prompt-preview { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 24px; background: #182e4766; }
.ai-prompt-preview-card { display: flex; width: min(1080px, 100%); max-height: min(82vh, 760px); flex-direction: column; overflow: hidden; border: 1px solid #dbe2ea; border-radius: 12px; background: white; box-shadow: 0 16px 45px #182e4740; }
.ai-prompt-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.ai-preview-head-actions { display: flex; align-items: center; gap: 6px; }
.ai-prompt-preview-head h3 { font-size: 14px; font-weight: 650; }
.ai-preview-edit-prompt { width: 100%; min-height: 130px; resize: vertical; padding: 9px; border: 1px solid #cfd8e3; border-radius: 6px; color: var(--ink); background: white; font: 11px/1.6 inherit; }
.ai-preview-edit-prompt:focus { border-color: var(--accent); outline: 2px solid #168fbd33; }
.ai-preview-batches { overflow: auto; padding: 14px 18px 20px; }
.ai-preview-batch { margin-bottom: 18px; }
.ai-preview-batch:last-child { margin-bottom: 0; }
.ai-preview-batch h4 { margin-bottom: 8px; color: var(--accent-dark); font-size: 12px; }
.ai-preview-batch strong { display: block; margin: 9px 0 4px; color: #53657c; font-size: 11px; }
.ai-preview-batch pre { max-height: 300px; overflow: auto; margin: 0; padding: 10px; border: 1px solid #e5eaf0; border-radius: 6px; background: #f8fafc; color: #40526a; font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.course-workspace { padding: 18px 24px 24px; }
.course-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.course-summary strong { color: var(--ink); font-size: 13px; }
.matching-columns { display: grid; grid-template-columns: minmax(210px, .75fr) minmax(0, 1.7fr); gap: 16px; }
.outline-panel, .quiz-panel { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: #fcfdfe; }
.data-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line); background: white; }
.data-panel-heading h3 { font-size: 13px; font-weight: 650; }
.panel-legend { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.legend-item { position: relative; padding-left: 9px; color: #8793a3; font-size: 9px; font-weight: 450; }
.legend-item::before { content: ""; position: absolute; left: 0; top: .55em; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.legend-section, .outline-node.outline-node-section { color: #6a58a5; }
.legend-knowledge, .outline-node.outline-node-knowledge { color: #197b72; }
.legend-tree, .quiz-kp-tree { color: #16786e; }
.legend-customize, .quiz-kp-customize { color: #a15d19; }
.count-chip { min-width: 24px; padding: 1px 6px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); text-align: center; font-size: 10px; }
.quiz-panel-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.quiz-search-row { display: flex; align-items: center; gap: 8px; margin: 10px 12px 0; }
.quiz-search-row input { width: 100%; min-height: 34px; padding: 7px 9px; border: 1px solid #cfd8e3; border-radius: 5px; color: var(--ink); background: white; font-size: 11px; }
.quiz-search-row input:focus { border-color: var(--accent); outline: 2px solid #168fbd33; }
.quiz-search-count { flex: 0 0 auto; color: #8a98a8; font-size: 10px; white-space: nowrap; }
.small-button { min-height: 24px; padding: 2px 7px; border: 1px solid #dbe2ea; border-radius: 5px; background: white; color: #64758a; font-size: 10px; }
.small-button:hover:not(:disabled) { border-color: #b9dcd4; background: #f3faf7; color: var(--accent-dark); }
.outline-tree { padding: 12px 10px 18px; }
.outline-tree ul { margin: 0; padding-left: 17px; list-style: none; }
.outline-tree > ul { padding-left: 0; }
.outline-tree li { position: relative; margin: 2px 0; }
.outline-node { display: block; padding: 6px 8px; border-radius: 6px; color: #40526a; font-size: 12px; line-height: 1.45; }
.outline-node-section { background: #f3effb; }
.outline-node-knowledge { background: #eef9f6; }
.outline-node-course { background: #f3f6fa; color: #53657c; }
.outline-node:hover { filter: brightness(.97); }
.outline-node .node-type { margin-left: 5px; color: #9aa6b5; font-size: 10px; }
.outline-empty, .quiz-empty { padding: 30px 15px; color: var(--muted); text-align: center; font-size: 12px; }
.quiz-list { display: grid; gap: 10px; padding: 12px; }
.quiz-card { padding: 13px 14px; border: 1px solid #e5eaf0; border-radius: 8px; background: white; }
.quiz-card:hover { border-color: #cfe5df; box-shadow: 0 3px 10px #182e4708; }
.quiz-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; }
.quiz-head-left { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.quiz-head-right { display: inline-flex; align-items: center; gap: 7px; }
.quiz-dirty-badge { padding: 2px 6px; border: 1px solid #f0d7b7; border-radius: 4px; background: #fff8ed; color: #a15d19; font-size: 10px; }
.legend-dirty { color: #a15d19; }
.quiz-select { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.quiz-index { min-width: 22px; color: #8a9aae; font: 600 10px ui-monospace, SFMono-Regular, Consolas, monospace; text-align: right; }
.quiz-id { color: #53657c; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.quiz-type { padding: 3px 7px; border-radius: 5px; background: #f0f3f7; color: #64758a; }
.quiz-card-meta { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 11px; color: #53657c; font-size: 12px; }
.quiz-card-meta span:first-child { color: #173b61; }
.quiz-content { margin-top: 12px; color: var(--ink); font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.quiz-options { margin: 10px 0 0; padding-left: 22px; color: #63728a; font-size: 12px; line-height: 1.8; }
.quiz-options-letter { list-style-type: upper-alpha; }
.quiz-kps { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.quiz-info-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 18px; margin-top: 14px; color: #40526a; font-size: 12px; line-height: 1.8; }
.quiz-info-row strong { color: #172b4d; font-weight: 650; }
.quiz-info-row span { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.quiz-answer span { color: #245b91; font-weight: 650; }
.quiz-analysis { padding-bottom: 2px; }
.quiz-kp { display: inline-flex; align-items: center; gap: 3px; padding: 2px 5px 2px 6px; border: 1px solid transparent; border-radius: 4px; font-size: 10px; }
.quiz-kp-remove { padding: 0; border: 0; background: transparent; color: currentColor; font-size: 13px; line-height: 1; }
.quiz-kp-remove:hover { color: var(--danger); }
.quiz-kp-empty { color: #9aa6b5; font-size: 10px; }
.quiz-kp-add { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.quiz-kp-picker { position: relative; width: 240px; }
.quiz-kp-search { width: 100%; min-width: 0; padding: 3px 5px; border: 1px solid #dbe2ea; border-radius: 5px; background: white; color: #64758a; font-size: 10px; }
.quiz-kp-search:focus { border-color: var(--accent); outline: 2px solid #168fbd33; }
.quiz-kp-menu { position: absolute; z-index: 5; top: calc(100% + 3px); left: 0; right: 0; max-height: 220px; overflow-y: auto; padding: 3px; border: 1px solid #cfd8e3; border-radius: 5px; background: white; box-shadow: 0 5px 14px #182e4720; }
.quiz-kp-option { display: block; width: 100%; padding: 5px 7px; border: 0; border-radius: 3px; background: transparent; color: #53657c; text-align: left; font-size: 10px; }
.quiz-kp-option:hover, .quiz-kp-option:focus { background: var(--accent-soft); color: var(--accent-dark); }
.quiz-kp-no-result { display: block; padding: 6px 7px; color: #9aa6b5; font-size: 10px; }
.small-button-primary { border-color: #b9dcd4; background: var(--accent-soft); color: var(--accent-dark); }
.quiz-kp-tree { border-color: #c8e6df; background: #f0faf7; }
.quiz-kp-customize { border-color: #f0d7b7; background: #fff8ed; }
.quiz-kp-unknown { border-color: #d8e0e8; background: #f5f7fa; color: #68758a; }
.quiz-source { margin-top: 8px; color: #9aa6b5; font-size: 10px; }
.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid #eef1f5; }
.workspace-heading h2 { font-size: 14px; font-weight: 650; }
.empty-state { padding: 40px 20px 36px; text-align: center; }
.empty-illustration { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 22px; }
.empty-illustration > span:not(.empty-link) { display: grid; place-items: center; width: 46px; height: 52px; border: 1px solid #dfe7ed; border-radius: 10px; background: #f7f9fb; color: #7f92a5; font-size: 17px; box-shadow: 0 4px 0 #f2f5f8; }
.empty-illustration > span:last-child { border-color: #d3e8e1; background: #f1f9f6; color: #6c9b8e; }
.empty-link { color: #a4b6c0; font-size: 25px; letter-spacing: 3px; }
.empty-state h3 { font-size: 16px; font-weight: 600; }
.empty-state p { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.safe-label { display: inline-flex; align-items: center; gap: 6px; margin-top: 23px; color: #809086; font-size: 11px; }
.workspace-footnote { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 22px; border-top: 1px solid #eef1f5; color: #8a96a5; font-size: 10px; }
.workspace-footnote strong { font-weight: 500; color: #64758a; }
.footer { display: flex; justify-content: space-between; gap: 14px; padding: 28px 0; color: #8c97a6; font-size: 12px; }
.footer span span { margin: 0 7px; color: #c3cbd4; }
/* 窄屏保持四个顶级环境入口可见，配置字段与操作区按可用宽度重排。 */
@media (max-width: 800px) {
  .shell { padding: 0 22px; }
  .environment-tab { gap: 6px; padding-left: 6px; padding-right: 6px; }
  .tab-restricted { font-size: 9px; }
  .workspace-layout { grid-template-columns: 185px minmax(0, 1fr); gap: 16px; }
  .course-query { align-items: flex-start; flex-direction: column; gap: 12px; }
  .course-query-controls { width: 100%; }
  .course-query-controls .button { flex: 1 1 130px; }
  .course-id-input { flex: 1; width: auto; }
  .action-row { align-items: flex-start; flex-direction: column; gap: 14px; }
  .ai-model-bar { width: 100%; min-width: 0; max-width: none; flex-wrap: wrap; justify-content: flex-start; }
  .ai-match-controls { align-items: stretch; margin-inline: 18px; }
  .ai-selected-row, .ai-prompt-row { grid-template-columns: 1fr; gap: 4px; }
  .ai-prompt-editor { grid-template-columns: 1fr; }
  .ai-prompt-variables { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ai-match-controls label { padding-top: 0; }
  .ai-prompt-help { grid-column: 1; }
  .ai-batch-size-row { align-items: flex-start; flex-wrap: wrap; }
  .ai-match-actions { padding-left: 0; flex-wrap: wrap; }
  .ai-inline-help { flex-basis: 100%; }
  .ai-run-log-entry { align-items: flex-start; }
  .ai-match-feedback { min-height: 16px; }
  .ai-batch-row-head { align-items: flex-start; flex-direction: column; }
  .ai-batch-row-actions { width: 100%; justify-content: space-between; }
  .ai-prompt-preview { padding: 12px; }
  .ai-prompt-preview-card { max-height: 88vh; }
  .ai-preview-head-actions { flex-wrap: wrap; justify-content: flex-end; }
  .ai-preview-batches { padding-inline: 12px; }
  .actions { align-self: flex-end; }
  .config-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
}
@media (max-width: 560px) {
  .shell { padding: 0 14px; }
  .masthead { padding: 22px 2px 17px; }
  .masthead { flex-wrap: wrap; row-gap: 10px; }
  .masthead-model { order: 3; width: 100%; }
  .masthead-model .ai-model-select { flex: 1 1 0; min-width: 0; }
  .brand { font-size: 20px; }
  .brand-mark { width: 8px; height: 8px; }
  .environment-tab { min-height: 36px; padding: 6px 10px; }
  .header-note { max-width: 90px; font-size: 10px; gap: 5px; }
  .environment-nav { margin-bottom: 16px; }
  .environment-tabs { gap: 2px; }
  .environment-tab { flex-wrap: wrap; align-content: center; gap: 1px 5px; min-height: 36px; padding: 6px 10px; font-size: 13px; }
  .tab-code { font-size: 10px; }
  .environment-panel { padding: 20px 16px 16px; border-radius: 11px; }
  .panel-heading { flex-direction: column; gap: 12px; }
  h1 { font-size: 16px; gap: 8px; }
  .eyebrow { font-size: 9px; }
  .config-path-row { margin-top: 18px; gap: 6px 9px; }
  .read-only-tag { width: 100%; margin-left: 0; }
  .actions { width: 100%; flex-wrap: wrap; }
  .actions .button { flex: 1 1 130px; padding-inline: 9px; }
  .check-guidance { text-align: left; }
  .workspace-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 16px; }
  .tenant-fields { grid-template-columns: minmax(0, 1fr); }
  .tenant-parse-controls { align-items: stretch; flex-direction: column; }
  .tenant-parse-controls .admin-input { flex: 1 1 auto; width: 100%; max-width: none; }
  .sidebar { padding: 6px 0 0; }
  .sidebar > .eyebrow, .sidebar-note { display: none; }
  .menu-item { margin-top: 0; }
  .workspace-heading { padding: 17px 18px; }
  .course-query { padding: 18px; }
  .ai-model-select { flex: 1 1 120px; width: auto; max-width: none; min-width: 80px; }
  .ai-feedback { width: auto; max-width: none; }
  .course-query + .course-feedback + .ai-match-controls { margin-inline: 18px; }
  .course-feedback { padding-inline: 18px; }
  .course-workspace { padding: 15px 12px 18px; }
  .matching-columns { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .course-summary { align-items: flex-start; flex-direction: column; gap: 4px; }
  .empty-state { padding: 30px 16px; }
  .footer { flex-direction: column; gap: 4px; padding: 22px 2px; }
}
/* AI 对话面板：只承载 pi 的联网检索测试，不涉及环境数据。 */
.agent-messages { display: flex; flex-direction: column; gap: 12px; margin: 0 24px; padding: 16px; min-height: 220px; max-height: 520px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.agent-empty { color: var(--muted); font-size: 13px; }
.agent-message { padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdfc; }
.agent-user { background: var(--accent-soft); border-color: #cfe9e2; }
.agent-role { color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .4px; }
.agent-content { margin-top: 4px; white-space: normal; word-break: break-word; font-size: 13px; line-height: 1.55; }
.agent-content p, .agent-content h3, .agent-content h4 { margin: 0 0 6px; }
.agent-content h3 { font-size: 14px; }
.agent-content h4 { font-size: 13px; }
.agent-content ul, .agent-content ol { margin: 4px 0 8px; padding-left: 18px; }
.agent-content li { margin: 2px 0; }
.agent-content a { color: #0f6f78; text-decoration: underline; }
.agent-content code { padding: 0 3px; border-radius: 4px; background: #eef6f6; font-family: ui-monospace, monospace; font-size: 0.92em; }
.agent-content pre { margin: 6px 0; padding: 8px; overflow: auto; border-radius: 6px; background: #f3f8f8; white-space: pre-wrap; }
.agent-content pre code { padding: 0; background: transparent; }
.agent-table-wrap { max-width: 100%; overflow-x: auto; margin: 6px 0; }
.agent-content table { width: 100%; border-collapse: collapse; font-size: 12px; }
.agent-content th, .agent-content td { padding: 5px 6px; border: 1px solid var(--line); vertical-align: top; text-align: left; }
.agent-content th { background: #f4fafa; font-weight: 650; }
.agent-message-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agent-copy { padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 10px; }
.agent-events { margin: 10px 0 0; padding: 8px 0 0; list-style: none; border-top: 1px dashed var(--line); color: var(--muted); font-size: 11px; }
.agent-events li { padding: 2px 0; }
.agent-context-note { flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: 11px; text-align: right; }
.agent-context-note.is-warning { color: var(--warning); }
.agent-context-note.is-danger { color: var(--danger); font-weight: 650; }
.agent-input { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; font: inherit; resize: vertical; }
.agent-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.runtime-dock { position: fixed; right: 22px; bottom: 22px; left: auto; z-index: 40; display: flex; flex-direction: column; width: min(420px, calc(100vw - 36px)); height: auto; min-width: 0; min-height: 0; border: 1px solid #ffffff; border-radius: 24px; background: #fff; color: var(--ink); box-shadow: 0 24px 64px #17383a29, 0 1px 0 #fff inset; }
.runtime-dock-launcher { position: absolute; top: 10px; left: 10px; z-index: 3; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: #f3fafa; color: var(--ink); box-shadow: inset 0 0 0 1px #e4f0ef; }
.runtime-dock-launcher::before { content: ""; display: block; width: 10px; height: 2px; border-radius: 1px; background: currentColor; }
.runtime-dock[data-collapsed="true"] { width: 58px; height: 58px; min-height: 58px; border-radius: 50%; overflow: hidden; }
.runtime-dock[data-collapsed="true"] .runtime-dock-sheet { display: none; }
.runtime-dock[data-collapsed="true"] .runtime-dock-launcher { position: static; width: 100%; height: 100%; background: var(--accent); color: #fff; box-shadow: none; }
.runtime-dock[data-collapsed="true"] .runtime-dock-launcher::before { width: 16px; height: 12px; border: 2px solid #fff; border-radius: 5px; background: transparent; box-shadow: 2px 4px 0 -1px #fff; }
.runtime-dock-cap { display: flex; align-items: center; min-height: 36px; padding: 8px 12px 0 46px; }
.runtime-dock-history { display: flex; flex-direction: column; height: 236px; min-height: 140px; max-height: min(52vh, 520px); overflow: hidden; padding: 6px 10px 8px; background: linear-gradient(#fff, #f6fbfb); }
.runtime-dock[data-collapsed="true"] .runtime-dock-history { display: none; }
.runtime-dock-resize { flex: 1 1 auto; height: 18px; cursor: ns-resize; touch-action: none; background: linear-gradient(#d5e4e2, #d5e4e2) center / 36px 3px no-repeat; }
.agent-loading { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; margin-right: auto; color: var(--accent); font-size: 11px; font-weight: 650; white-space: nowrap; }
.agent-loading::before { content: ""; width: 12px; height: 12px; border: 2px solid #f3d2ce; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.runtime-dock-composer { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 8px; border-top: 1px solid #eef6f5; background: #fff; }
.runtime-dock-actions { display: flex; align-items: center; gap: 6px; }
.runtime-dock-composer .agent-input { width: 100%; min-height: 42px; max-height: 88px; margin: 0; padding: 10px 12px; border: 1px solid #e4f0ef; border-radius: 16px; background: #f7fbfb; font-size: 13px; resize: none; }
.runtime-dock-actions .button { min-height: 32px; padding: 4px 12px; border: 0; font-size: 12px; }
.runtime-dock-actions .button-secondary { background: #f3fafa; color: #3f5c5d; }
.agent-session-picker { position: relative; }
.agent-session-menu { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 3; display: flex; flex-direction: column; gap: 2px; width: 240px; max-height: 240px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 -10px 28px #17383a1a; }
.agent-session-item { padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 12px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-session-item[aria-current="true"] { background: #e7f6f4; font-weight: 650; }
.agent-bar-feedback, .runtime-dock .ai-feedback { margin: 0; padding: 0 12px 8px; font-size: 11px; line-height: 1.4; }
.runtime-dock-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 2px 0; }
.runtime-dock-tools .small-button, .runtime-dock-tools .button { min-height: 26px; padding: 2px 9px; border: 0; border-radius: 999px; background: #fff; color: #4d6869; font-size: 11px; box-shadow: inset 0 0 0 1px #e3eeed; }
.runtime-dock #agent-badge { display: none; }
.runtime-section-heading { display: flex; align-items: center; gap: 8px; padding: 10px 0 7px; }
.runtime-section-heading strong { font-size: 11px; }
.runtime-section-heading .muted { flex: 1 1 auto; font-size: 10px; }
.runtime-ai-controls { border-bottom: 1px solid var(--line); }
.runtime-chat { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; padding-bottom: 4px; }
.runtime-chat .badge { flex: 0 0 auto; }
.runtime-chat-label { display: block; margin-top: 8px; color: #53657c; font-size: 10px; font-weight: 650; }
.runtime-dock .agent-context-note { padding: 0 0 6px; text-align: left; font-size: 10px; }
.runtime-dock .agent-messages { flex: 1 1 auto; gap: 8px; min-height: 140px; max-height: none; margin: 0; padding: 9px; border-radius: 8px; }
.runtime-dock .agent-empty { font-size: 11px; }
.runtime-dock .agent-message { padding: 7px 9px; border-radius: 7px; }
.runtime-dock .agent-role { font-size: 10px; }
.runtime-dock .agent-content { margin-top: 2px; font-size: 12px; }
.runtime-dock .agent-events { margin-top: 6px; padding-top: 6px; font-size: 10px; }
.runtime-dock .agent-input { margin-top: 4px; padding: 7px 9px; border-radius: 7px; font-size: 12px; }
.runtime-dock .agent-actions { gap: 6px; margin-top: 7px; }
.runtime-dock .agent-actions .button { min-height: 26px; padding: 3px 10px; font-size: 11px; }
.runtime-dock .agent-actions .ai-match-feedback { flex: 1 1 100%; font-size: 10px; }
.runtime-dock .ai-model-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; min-width: 0; max-width: none; padding: 0 0 10px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.runtime-dock .ai-model-label { grid-column: 1 / -1; }
.runtime-dock .ai-feedback { grid-column: 1 / -1; max-width: none; line-height: 1.4; white-space: normal; }
.runtime-processes { padding-bottom: 1px; }
.runtime-dock-actions { display: flex; gap: 8px; margin-top: 10px; }
.agent-runtime-table { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; }
.agent-runtime-row { display: grid; grid-template-columns: minmax(84px, 1fr) minmax(0, 1.5fr) 58px 44px auto; gap: 6px; align-items: center; padding: 6px 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 11px; }
.agent-runtime-purpose { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-runtime-model { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.agent-runtime-memory { color: var(--muted); text-align: right; }
.agent-runtime-status { font-weight: 600; text-align: right; }
.agent-runtime-status.is-busy { color: var(--accent-dark); }
.agent-runtime-status.is-idle { color: var(--muted); }
.agent-runtime-close { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--muted); font-size: 10px; }
.agent-runtime-close:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.agent-runtime-empty { color: var(--muted); font-size: 11px; }

.admin-scope-note { padding: 12px 24px; border-bottom: 1px solid #eef1f5; background: #fbfdfd; color: var(--muted); font-size: 11px; }
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 24px; border-bottom: 1px solid #eef1f5; }
.admin-feedback { flex: 1 1 260px; min-width: 0; color: var(--muted); font-size: 11px; }
.admin-feedback.is-error { color: var(--danger); }
.admin-feedback.is-success { color: var(--accent-dark); font-weight: 600; }
.admin-form-feedback { min-height: 0; }
.admin-form-feedback.is-error { color: var(--danger); }
.admin-form-feedback:empty { display: none; }
.admin-columns { display: grid; grid-template-columns: minmax(190px, 240px) minmax(0, 1fr); gap: 16px; padding: 16px 24px 24px; }
.admin-list-panel, .admin-detail-panel { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: #fcfdfe; }
.admin-detail-panel { padding-bottom: 14px; }
.admin-list { display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.admin-list-compact { padding: 8px 10px; }
.admin-list-item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); text-align: left; font-size: 12px; }
.admin-list-item:hover { border-color: #b9dcd4; background: #f5fbf9; }
.admin-list-item[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.admin-list-meta { color: var(--muted); font-size: 10px; line-height: 1.5; }
.admin-empty { padding: 18px 24px; color: var(--muted); font-size: 11px; }
.admin-form { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.admin-field { display: flex; flex-direction: column; gap: 5px; }
.admin-field-label { color: #40566f; font-size: 11px; font-weight: 650; }
.admin-field-hint { color: var(--muted); font-size: 10px; }
.admin-input { width: 100%; min-height: 30px; padding: 5px 8px; border: 1px solid #dbe2ea; border-radius: 6px; background: white; color: var(--ink); font: inherit; font-size: 12px; }
.admin-input:focus { border-color: var(--accent); outline: 2px solid #168fbd33; }
.admin-input:disabled { background: #f4f6f9; color: var(--muted); }
.admin-textarea { min-height: 56px; resize: vertical; line-height: 1.6; }
.admin-check { display: inline-flex; align-items: center; gap: 6px; color: #40566f; font-size: 11px; }
.admin-check-box { width: 14px; height: 14px; margin: 0; }
.admin-check-grid { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.admin-subrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 8px; border: 1px dashed #e2e8ef; border-radius: 7px; background: white; }
.admin-subrow .admin-input { flex: 1 1 160px; width: auto; }
.admin-prompt-list { display: flex; flex-direction: column; gap: 8px; }
.admin-prompt-row { align-items: flex-start; }
.admin-prompt-row .admin-input { flex: 1 1 100%; }
.admin-prompt-row .small-button { align-self: flex-end; }
.admin-form-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.tenant-create-panel { padding: 18px 24px 24px; }
.tenant-parse-row { display: flex; flex-direction: column; gap: 6px; }
.tenant-parse-controls { display: flex; align-items: center; gap: 10px; }
.tenant-parse-controls .admin-input { flex: 0 1 66.666%; width: 66.666%; max-width: 66.666%; min-width: 0; }
.tenant-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin-top: 18px; }
.tenant-field-warning { margin: 0; color: #a76219; font-size: 10px; line-height: 1.5; }
.tenant-warnings { margin-top: 16px; padding: 10px 12px; border: 1px solid #f1d6a4; border-radius: 8px; background: #fffaf0; color: #87551d; font-size: 11px; line-height: 1.6; }
.tenant-warnings ul { margin: 5px 0 0; padding-left: 18px; }
.tenant-validation { margin-top: 16px; padding: 10px 12px; border-radius: 8px; background: #f4f7fa; color: var(--muted); font-size: 11px; line-height: 1.6; }
.tenant-validation.is-success { background: #edf9f5; color: var(--accent-dark); }
.tenant-validation.is-error { background: #fff1f1; color: var(--danger); }
.tenant-actions { margin-top: 14px; }
.admin-models { border-top: 1px solid var(--line); margin-top: 6px; }
.admin-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.admin-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12px; }
.admin-row[data-editing="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.admin-inline-form { margin: -2px 0 4px; padding: 12px 14px; border: 1px solid #cfe6df; border-radius: 8px; background: white; box-shadow: 0 6px 18px #182e4710; }
.admin-row-actions { display: flex; gap: 6px; }
.admin-validation { margin: 12px 24px 0; padding: 8px 10px; border: 1px solid #bfe3d9; border-radius: 8px; background: var(--accent-soft); color: var(--accent-dark); font-size: 11px; }
.admin-validation.is-error { border-color: #f0cdc8; background: var(--danger-soft); color: var(--danger); }
.admin-detail { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.admin-summary { display: grid; gap: 2px; margin: 0; }
.admin-summary-row { display: flex; flex-wrap: wrap; gap: 2px 14px; padding: 6px 10px; border-radius: 6px; background: #f7fafb; }
.admin-summary-row dt { flex: 0 0 88px; color: var(--muted); font-size: 11px; }
.admin-summary-row dd { flex: 1 1 12ch; min-width: 0; margin: 0; color: #2f4157; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.admin-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.admin-tool-ref { display: flex; flex-direction: column; gap: 4px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.admin-tool-ref.is-unknown { border-color: #f0d6a8; background: var(--warning-soft); }
.admin-tool-ref-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-tool-badge.is-warning { background: #fdf1dc; color: var(--warning); }
.admin-prompt-item { display: flex; flex-direction: column; gap: 4px; }
.admin-prompt-key { color: #2f4157; font: 600 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.admin-prompt-content { max-height: 260px; overflow: auto; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fbfdfc; color: #40526a; font: 11px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-tool-picker { position: relative; display: flex; flex-direction: column; gap: 8px; }
.admin-tool-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.admin-tool-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border: 1px solid #cfe6df; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 11px; }
.admin-tool-tag.is-unknown { border-color: #f0d6a8; background: var(--warning-soft); color: var(--warning); }
.admin-tool-remove { padding: 0 4px; border: 0; background: transparent; color: inherit; font-size: 13px; line-height: 1; }
.admin-tool-remove:hover { color: var(--danger); }
.admin-tool-empty { color: var(--muted); font-size: 11px; }
.admin-tool-menu { position: absolute; z-index: 6; top: 100%; right: 0; left: 0; max-height: 264px; overflow-y: auto; padding: 4px; border: 1px solid #cfd8e3; border-radius: 8px; background: white; box-shadow: 0 10px 26px #182e4720; }
.admin-tool-option { display: flex; flex-direction: column; gap: 1px; width: 100%; padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; font-size: 12px; }
.admin-tool-option:hover { background: var(--accent-soft); }
.admin-tool-option strong { font: 600 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.admin-tool-desc { color: var(--muted); font-size: 11px; line-height: 1.5; }
.admin-tool-scope { color: #8a6d2f; font-size: 10px; }
.admin-tool-note { padding: 7px 9px; color: var(--muted); font-size: 11px; }
.admin-tools-search { flex: 1 1 240px; max-width: 340px; }
.admin-tools-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding: 16px 24px 24px; }
.admin-tool-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.admin-tool-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.admin-tool-name { font: 600 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.admin-tool-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-tool-badge { padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 10px; }
.admin-tool-badge.is-muted { background: #f0f3f7; color: var(--muted); }
.admin-tool-card-desc { color: #4b5a6d; font-size: 12px; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; }
.admin-list-overrides { padding: 12px 16px 20px; }
.admin-list-overrides .admin-row-main .admin-list-meta { display: block; }
.admin-override-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search-select { position: relative; display: block; width: 100%; }
.search-select-input { width: 100%; }
.search-select-menu { top: 100%; z-index: 12; }
/* 管理面板允许下拉浮层溢出面板边界，避免被面板圆角裁剪。 */
#admin-overrides, #admin-agents, #admin-tools, #admin-providers { overflow: visible; }
.admin-tool-menu[data-drop="up"], .search-select-menu[data-drop="up"] { top: auto; bottom: 100%; }
.search-select-menu .admin-tool-option strong { font-family: inherit; font-size: 12px; }
.admin-override-row .admin-input { flex: 1 1 160px; width: auto; }
.admin-create-form { margin: 4px 0 8px; padding: 12px 14px; border: 1px dashed #cfe6df; border-radius: 8px; background: #fbfdfd; }
.admin-scope-list { display: grid; gap: 8px; }
.admin-scope { padding: 8px 10px; border: 1px solid #e4ecf2; border-radius: 8px; background: #f8fbfc; }
.admin-scope-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.admin-scope-type { color: var(--accent-dark); font: 600 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.admin-scope-count { color: var(--muted); font-size: 10px; }
.admin-scope-fields { display: grid; gap: 3px; margin: 6px 0 0; }
.admin-scope-field { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.admin-scope-field dt { flex: 0 0 148px; color: #2f4157; font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.admin-scope-field dd { flex: 1 1 16ch; min-width: 0; margin: 0; color: var(--muted); font-size: 11px; }
.admin-scope-note { margin-top: 6px; color: var(--muted); font-size: 10px; }
.admin-tool-details { padding-top: 6px; border-top: 1px dashed var(--line); }
.admin-tool-details summary { color: #53657c; font-size: 11px; font-weight: 650; cursor: pointer; }
.admin-tool-params { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }
.admin-tool-param { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px; font-size: 11px; }
.admin-tool-param code { color: #2f4157; font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.admin-tool-param-type { color: #8a6d2f; font-size: 10px; }
.admin-tool-param-required { color: var(--danger); font-size: 10px; }
.admin-tool-param-desc { color: var(--muted); }
.admin-tool-raw { max-height: 180px; overflow: auto; margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: #f7fafb; color: #40526a; font: 10px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: #10182766; backdrop-filter: blur(2px); animation: modal-fade .16s ease-out; }
.modal-dialog { position: relative; display: flex; flex-direction: column; gap: 10px; width: min(520px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; padding: 22px 24px 20px; border: 1px solid var(--line); border-radius: 16px; background: white; color: var(--ink); box-shadow: 0 24px 60px #10182740; animation: modal-rise .18s ease-out; }
.modal-dialog.modal-warning { border-top: 3px solid #d99a3f; }
.modal-dialog.modal-info { border-top: 3px solid var(--accent); }
.modal-kicker { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.modal-kicker-warning { color: var(--warning); }
.modal-kicker-info { color: var(--accent-dark); }
.modal-dialog h2 { font-size: 16px; font-weight: 700; line-height: 1.4; }
.modal-dialog p#modal-message { color: #45566b; font-size: 13px; line-height: 1.7; white-space: pre-line; word-break: break-word; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal-actions .button { min-height: 32px; padding: 5px 16px; font-size: 12px; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
  .runtime-dock { right: 10px; bottom: 10px; width: calc(100vw - 20px); }
  .agent-runtime-row { grid-template-columns: minmax(72px, 1fr) minmax(0, 1.2fr) 52px auto; }
  .agent-runtime-status { display: none; }
  .admin-columns { grid-template-columns: minmax(0, 1fr); }
  .admin-tools-list { grid-template-columns: minmax(0, 1fr); padding: 12px 14px 16px; }
  .modal { padding: 14px; }
  .modal-dialog { padding: 18px 18px 16px; }
  .modal-actions { justify-content: stretch; }
  .modal-actions .button { flex: 1 1 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
