:root {
  color-scheme: light;
  --content-width: 1520px;
  --content-gutter: 20px;
  --bg: #eaf0f3;
  --surface: #ffffff;
  --surface-soft: #f5f8fa;
  --surface-muted: #edf3f6;
  --line: #d4dee4;
  --line-strong: #b8c7d0;
  --ink: #122630;
  --ink-soft: #3c525e;
  --muted: #60737d;
  --accent: #086d96;
  --accent-hover: #055b7f;
  --accent-soft: #e2f1f6;
  --danger: #b7443f;
  --danger-soft: #fbefee;
  --warning: #8a620e;
  --success: #247154;
  --blue: #086d96;
  --focus: #1689ba;
  --radius-panel: 14px;
  --radius-control: 8px;
  --font: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --z-sticky: 20;
  --z-modal: 40;
  --z-toast: 60;
}

.case-capabilities {display:flex; align-items:center; flex-wrap:wrap; gap:10px 18px; padding:10px 12px; background:var(--surface-soft); border:1px solid var(--line); border-radius:8px; margin-bottom:10px; font-size:12px;}
#outputCapabilities {display:flex; gap:14px; flex-wrap:wrap;}
#outputCapabilities label,.case-selection-bar label {display:flex; gap:6px; align-items:center;}
#outputCapabilities input,.case-selection-bar input,.case-row-actions input {width:15px; height:15px; accent-color:var(--accent); flex-shrink:0;}
#capabilityHint {font-size:11px; color:var(--ink-soft);}
.case-selection-bar {display:flex; align-items:center; gap:14px; padding:9px 12px; border-bottom:1px solid var(--line); font-size:11px; flex-wrap:wrap;}
#caseSelectionHint {flex:1; color:var(--ink-soft);}
.case-selection-bar button,.case-media-button {border:1px solid var(--line-strong); border-radius:6px; padding:4px 8px; background:var(--surface); color:var(--accent); font-size:11px;}
.case-row-actions {display:inline-flex; align-items:center; gap:8px; margin-right:10px; float:left;}
.rule-browser-header {display:flex; align-items:center; justify-content:space-between; gap:12px;}
.case-preview-dialog {width:min(900px,calc(100vw - 32px));}
.case-preview-content {padding:0 22px 20px; overflow:auto; max-height:65dvh;}
.case-preview-content article {padding:18px 0; border-bottom:1px solid var(--line);}
.case-preview-content p {white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.6;}
.case-preview-content img,.case-preview-content video {display:block; max-width:100%; max-height:360px; margin:12px 0; object-fit:contain;}
.case-preview-content small {display:block; color:var(--ink-soft); margin-top:8px;}
.case-media-preview {display:block; max-width:100%; max-height:360px; object-fit:contain; margin:12px 0;}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
.hidden { display: none !important; }
.app-shell { min-height: 100dvh; }
.skip-link { position: fixed; left: 12px; top: 8px; z-index: var(--z-toast); padding: 8px 11px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 11px; text-decoration: none; transform: translateY(-160%); transition: transform .15s ease; }
.skip-link:focus { transform: none; }

.topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(var(--content-gutter), calc((100% - var(--content-width)) / 2)); border-bottom: 1px solid #cbd7de; background: var(--surface); position: sticky; top: 0; z-index: var(--z-sticky); }
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.brand-logo-lockup { display: flex; align-items: center; height: 42px; }
.brand-logo-lockup img { display: block; width: 142px; height: 34px; object-fit: contain; }
.platform-name { padding-left: 14px; border-left: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.topbar-meta { display: flex; align-items: center; gap: 10px; }
.service-status { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; background: #edf7f3; color: #2c604e; font-size: 11px; font-weight: 650; }
.service-status i { width: 7px; height: 7px; border-radius: 50%; background: #2c8564; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-soft); font-size: 16px; transition: background .18s ease, border-color .18s ease, transform .12s ease; }
.icon-button:hover { background: var(--surface-muted); border-color: #9fb2bc; }
.icon-button:active { transform: translateY(1px); }

main { width: min(var(--content-width), calc(100% - 2 * var(--content-gutter))); margin: 0 auto; }
.intro { min-height: 78px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 28px; padding: 12px 2px 10px; }
.intro h1 { margin: 0 0 4px; font-size: 23px; line-height: 1.2; letter-spacing: -.025em; font-weight: 730; }
.intro-copy > p { max-width: 72ch; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.intro-side { display: flex; align-items: center; }
.intro-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.intro-stats div { min-width: 92px; padding: 2px 16px; border-right: 1px solid #c6d2d8; }
.intro-stats div:last-child { padding-right: 2px; border-right: 0; }
.intro-stats strong { display: block; font-size: 20px; line-height: 1.1; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.intro-stats span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }

.workspace { display: flex; flex-direction: column; overflow: hidden; border: 1px solid #c9d6dd; border-radius: var(--radius-panel); background: var(--surface); }
.config-panel { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; padding: 16px 20px 14px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.section-heading { min-width: 0; }
.section-heading h2 { margin: 0 0 4px; font-size: 16px; line-height: 1.25; letter-spacing: -.015em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.step { display: none; }
#configForm { display: grid; grid-template-columns: 1.08fr 1.5fr 1.12fr 1.34fr 214px; align-items: start; gap: 10px; min-width: 0; }
.field { display: block; min-width: 0; margin: 0; }
.field > span { display: block; margin: 0 0 5px; color: #2a414c; font-size: 10px; font-weight: 650; }
.field input, .field select, .field textarea, .table-toolbar input, .table-toolbar select { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #8ea5b1; }
.field input::placeholder, .field textarea::placeholder { color: #667983; opacity: 1; }
.field small { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.provider-field { position: relative; padding: 0; border: 0; }
.provider-field .field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.provider-field .field-label i { padding: 2px 5px; border-radius: 4px; background: #e5eff4; color: #38677c; font-size: 7px; font-style: normal; font-weight: 600; }
.provider-field small { color: #477083; }
.provider-combobox { position: relative; min-width: 0; }
.provider-native-select { position: absolute; width: 1px !important; height: 1px; min-height: 0 !important; overflow: hidden; padding: 0 !important; border: 0 !important; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.provider-menu-toggle { width: 100%; height: 38px; display: grid; grid-template-columns: 12px minmax(0, 1fr) 30px; align-items: center; gap: 7px; padding: 0 3px 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.provider-menu-toggle:hover { border-color: #8ea5b1; }
.provider-menu-toggle:focus-visible,
.provider-menu-toggle[aria-expanded="true"] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.provider-state-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.provider-selection { overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.provider-menu-toggle svg { width: 30px; height: 30px; padding: 7px; border-radius: 6px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: color .16s ease, background .16s ease, transform .16s ease; }
.provider-menu-toggle:hover svg,
.provider-menu-toggle[aria-expanded="true"] svg { background: var(--accent-soft); stroke: var(--accent); }
.provider-menu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-field button { position: absolute; inset: 4px 4px 4px auto; padding: 0 9px; border: 0; border-radius: 6px; background: var(--surface-muted); color: var(--ink-soft); font-size: 9px; }
.model-field-wrap { display: flex; gap: 5px; }
.model-combobox { position: relative; flex: 1 1 auto; min-width: 0; }
.model-combobox input { min-width: 0; padding-right: 34px; }
.model-menu-toggle { position: absolute; top: 3px; right: 3px; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.model-menu-toggle:hover,
.model-menu-toggle[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.model-menu-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .16s ease; }
.model-menu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.select-combobox { position: relative; min-width: 0; }
.select-combobox select { min-width: 0; padding-right: 34px; appearance: none; -webkit-appearance: none; }
.select-menu-icon { position: absolute; top: 3px; right: 3px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); pointer-events: none; transition: background .16s ease, color .16s ease; }
.select-menu-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.select-combobox:hover .select-menu-icon,
.select-combobox:focus-within .select-menu-icon { background: var(--accent-soft); color: var(--accent); }
.model-field-wrap > #fetchModels { flex: 0 0 auto; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--accent); font-size: 9px; font-weight: 650; }
.model-field-wrap > #fetchModels:hover { background: var(--accent-soft); }
.model-field-wrap > #fetchModels:disabled { opacity: .48; cursor: wait; }
.model-menu { position: fixed; inset: auto; margin: 0; max-height: 250px; overflow: auto; padding: 5px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--text); box-shadow: 0 5px 12px rgba(22, 48, 65, .14); }
.model-menu::backdrop { background: transparent; }
.model-option { width: 100%; min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; font: inherit; font-size: 10px; cursor: pointer; }
.model-option:hover,
.model-option:focus-visible { outline: none; background: var(--accent-soft); color: var(--accent); }
.model-option[aria-selected="true"] { color: var(--accent); font-weight: 650; }
.model-option-check { width: 16px; color: var(--accent); font-size: 12px; text-align: center; }
.model-menu-empty { padding: 13px 11px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.provider-menu { position: fixed; inset: auto; margin: 0; max-height: min(430px, calc(100vh - 24px)); overflow: auto; padding: 7px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 6px 14px rgba(22, 48, 65, .16); }
.provider-menu::backdrop { background: transparent; }
.provider-menu-group + .provider-menu-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.provider-menu-heading { padding: 5px 9px 3px; color: var(--muted); font-size: 8px; font-weight: 650; line-height: 1.4; }
.provider-option { width: 100%; min-height: 32px; display: grid; grid-template-columns: minmax(0, 1fr) 18px; align-items: center; gap: 10px; padding: 6px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; font: inherit; font-size: 10px; cursor: pointer; }
.provider-option:hover,
.provider-option:focus-visible { outline: none; background: var(--surface-muted); color: var(--accent); }
.provider-option[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.provider-option-check { color: var(--accent); font-size: 11px; text-align: center; }
#modelListStatus.error { color: var(--danger); }
.config-actions { min-width: 0; display: grid; grid-template-columns: 72px minmax(126px, 1fr); align-items: end; gap: 8px; padding-left: 10px; border-left: 1px solid var(--line); }
.config-actions .field > span { color: var(--muted); }
#testConnection { min-height: 38px; white-space: nowrap; }
.privacy-note { display: none; }

.secondary-button, .primary-button { border-radius: 8px; font-weight: 650; transition: background .16s ease, border-color .16s ease, transform .12s ease, opacity .16s ease; }
.secondary-button { min-height: 38px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft); }
.secondary-button:hover { border-color: #8ea5b1; background: var(--surface-muted); }
.secondary-button:active, .primary-button:active { transform: translateY(1px); }
.secondary-button:disabled, .primary-button:disabled { opacity: .46; cursor: not-allowed; }
.button-indicator { width: 7px; height: 7px; display: inline-block; margin-right: 7px; border-radius: 50%; background: var(--muted); }
.button-indicator.success { background: var(--success); }
.button-indicator.error { background: var(--danger); }

.test-panel { min-height: 0; display: flex; flex: 1; flex-direction: column; padding: 15px 20px 14px; }
.section-heading-wide { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 11px; }
.section-heading-wide > div:first-child { min-width: 0; }
.mode-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); }
.mode-switch button { min-height: 30px; padding: 0 13px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 600; transition: background .16s ease, color .16s ease, box-shadow .16s ease; }
.mode-switch button:hover { color: var(--ink); }
.mode-switch button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgb(26 52 65 / 12%); }

.benchmark-panel { min-height: 0; display: flex; flex: 1; flex-direction: column; }
.risk-overview { flex: 0 0 auto; margin-bottom: 10px; padding: 10px 13px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.risk-overview-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 7px; }
.risk-overview-header h3 { margin: 0 0 1px; font-size: 11px; }
.risk-overview-header p { margin: 0; color: var(--muted); font-size: 8px; }
.risk-total { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.risk-total strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.risk-total span { color: var(--muted); font-size: 8px; }
.risk-distribution { height: 6px; display: flex; gap: 2px; overflow: hidden; border-radius: 3px; background: #dfe8ec; }
.risk-distribution span { min-width: 2px; background: var(--risk-color); }
.risk-legend { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px 9px; margin-top: 7px; }
.risk-stat { min-width: 0; min-height: 24px; display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; align-items: center; gap: 5px; padding: 3px 5px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-soft); text-align: left; transition: background .15s ease, color .15s ease; }
.risk-stat:hover { background: #e8f0f3; color: var(--ink); }
.risk-stat.active { background: #dcecf3; color: #075f89; }
.risk-stat.empty { opacity: .45; }
.risk-stat i { width: 7px; height: 7px; border-radius: 2px; background: var(--risk-color); }
.risk-stat span { overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.risk-stat strong { font-size: 8px; font-variant-numeric: tabular-nums; }

.dataset-section { min-height: 0; display: flex; flex: 1; }
.rule-browser { min-height: 0; display: flex; flex: 1; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.rule-browser-header { flex: 0 0 auto; padding: 9px 13px 7px; border-bottom: 1px solid var(--line); }
.rule-browser-header h3 { margin: 0 0 2px; font-size: 11px; }
.rule-browser-header p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.45; }
.rule-toolbar { flex: 0 0 auto; display: grid; grid-template-columns: 1.05fr .9fr .72fr 1.35fr; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.rule-toolbar label { color: var(--muted); font-size: 8px; font-weight: 600; }
.rule-toolbar select, .rule-toolbar input { display: block; width: 100%; min-height: 29px; margin-top: 3px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 9px; }
.rule-table-scroll { min-height: 0; flex: 1; overflow: auto; background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
.rule-table { min-width: 840px; height: 100%; table-layout: fixed; }
.rule-table th:first-child { width: 49%; }
.rule-table th:nth-child(2) { width: 11%; }
.rule-table th:nth-child(3) { width: 9%; }
.rule-table th:nth-child(4) { width: 16%; }
.rule-table th:nth-child(5) { width: 15%; }
th { padding: 7px 10px; border-bottom: 1px solid var(--line); background: #f8fafb; color: #526773; font-size: 8px; font-weight: 650; letter-spacing: .02em; text-align: left; }
td { padding: 7px 10px; border-bottom: 1px solid #e0e7eb; color: #2d434e; font-size: 9px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.rule-table tbody tr:hover { background: #f6f9fa; }
.rule-table tbody tr { height: 44px; }
.rule-table td { height: 44px; }
.rule-text-cell strong { display: -webkit-box; overflow: hidden; color: #172c36; font-size: 9px; font-weight: 600; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }
.rule-text-cell small { display: block; margin-top: 2px; color: var(--muted); font: 7px/1.2 ui-monospace, "Cascadia Code", monospace; }
td > small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 7px; line-height: 1.35; text-overflow: ellipsis; }
.tag { display: inline-block; padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: 5px; background: #f8fafb; color: var(--ink-soft); white-space: nowrap; }
.tag.safe { border-color: #b7d3df; color: var(--accent); }
.tag.risk { border-color: #e7bbb8; background: var(--danger-soft); color: var(--danger); }
.rule-pagination { flex: 0 0 auto; min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 7px 12px 7px 14px; border-top: 1px solid var(--line); background: #f7fafb; color: var(--muted); font-size: 8px; }
.rule-pagination-summary { display: flex; align-items: baseline; gap: 8px; }
.rule-pagination-summary strong { color: var(--ink-soft); font-size: 9px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rule-pagination-summary span { color: var(--muted); }
.rule-pagination-controls { display: inline-flex; align-items: center; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); }
.rule-pagination-controls button { border: 0; border-radius: 0; }
.rule-pagination-controls button:first-child { border-right: 1px solid var(--line); }
.rule-pagination-controls button:last-child { border-left: 1px solid var(--line); }
.rule-pagination-controls button i { color: var(--accent); font-style: normal; }
.rule-page-position { min-width: 104px; padding: 0 11px; color: var(--muted); text-align: center; white-space: nowrap; }
.rule-page-position strong { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.rule-pagination button, .result-pagination button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink-soft); font-size: 8px; }
.rule-pagination button:hover, .result-pagination button:hover { background: var(--surface-muted); }
.rule-pagination button:disabled, .result-pagination button:disabled { opacity: .42; cursor: not-allowed; }

.custom-box { min-height: 0; display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
.prompt-composer, .input-options { min-height: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.prompt-composer { display: flex; flex-direction: column; padding: 16px; }
.input-options { padding: 16px; background: var(--surface-soft); }
.composer-heading, .options-heading { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; }
.composer-heading strong, .options-heading strong { font-size: 13px; }
.composer-heading span, .options-heading span { color: var(--muted); font-size: 9px; }
.prompt-field { min-height: 0; display: flex; flex: 1; flex-direction: column; }
.prompt-field textarea { min-height: 180px; flex: 1; padding: 14px; resize: none; font-size: 12px; line-height: 1.65; }
.prompt-field small { text-align: right; }
.input-options .field { margin-bottom: 14px; }
.input-options .field small { white-space: normal; }
.media-upload input[type="file"] { padding: 6px; font-size: 9px; }
.media-upload input[type="file"]::file-selector-button { margin-right: 8px; padding: 6px 9px; border: 0; border-radius: 6px; background: var(--surface-muted); color: var(--ink-soft); font-weight: 600; }
.audit-route { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.audit-route span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; }
.audit-route strong { color: var(--ink-soft); font-size: 10px; font-weight: 650; }
.run-bar { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 20px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.run-bar > div { text-align: right; }
.run-bar > div > span { display: block; color: var(--muted); font-size: 8px; }
.run-bar strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.primary-button {
  min-width: 190px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}
.run-bar .primary-button {
  min-width: 214px;
  height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 12px;
  padding: 0 7px 0 16px;
  text-align: left;
}
.run-bar .primary-button > span { color: #fff; font-size: 11px; font-weight: 700; line-height: 1; white-space: nowrap; }
.primary-button:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.primary-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.run-bar .primary-button i {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-style: normal;
  font-size: 16px;
  line-height: 1;
  transition: transform .16s cubic-bezier(.22, 1, .36, 1), background .16s ease;
}
.run-bar .primary-button:hover i { transform: translateX(2px); background: rgba(255, 255, 255, .22); }
.run-bar .primary-button:active i { transform: translateX(1px); }
.run-bar .primary-button.loading i { transform: none; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .25; } }

.results-section { min-height: 0; margin-bottom: 50px; }
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.results-header .eyebrow { display: none; }
.results-header h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.results-actions { display: flex; gap: 8px; }
.results-actions .secondary-button { width: auto; padding: 0 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.metric { padding: 11px 15px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 8px; }
.metric strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.metric strong.good, .result-pass { color: var(--success); }
.metric strong.bad, .result-fail { color: var(--danger); }
.results-table-wrap { min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.table-toolbar { display: flex; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.table-toolbar input { max-width: 310px; min-height: 34px; }
.table-toolbar select { width: 125px; min-height: 34px; }
.table-scroll { overflow: auto; }
.table-scroll table { min-width: 980px; }
.table-scroll td { vertical-align: top; }
.case-text { max-width: 330px; line-height: 1.5; }
.output-text { min-width: 260px; white-space: pre-wrap; }
.case-text small { display: block; margin-top: 4px; color: var(--muted); }
.result-clamp { display: -webkit-box; overflow: hidden; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.media-output-link { display: inline-flex; margin-top: 5px; color: var(--accent); font-weight: 650; text-decoration: none; }
.media-output-link:hover { text-decoration: underline; }
.result-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 8px; }
.result-pagination > div { display: flex; align-items: center; gap: 8px; }
.empty-row td { padding: 32px; color: var(--muted); text-align: center; }

.settings-dialog { width: min(960px, calc(100% - 28px)); max-height: calc(100dvh - 36px); padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); }
.settings-dialog::backdrop { background: rgb(29 48 58 / 42%); }
.settings-dialog-shell { max-height: calc(100dvh - 38px); display: flex; flex-direction: column; }
.settings-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.settings-dialog-header h2 { margin: 0 0 5px; font-size: 18px; }
.settings-dialog-header p { max-width: 65ch; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.dialog-close { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--muted); font-size: 19px; }
.settings-dialog-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 26px; overflow-y: auto; padding: 16px 22px; }
.review-flow, .settings-note { grid-column: 1 / -1; }
.review-flow { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 9px; }
.review-flow span { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.review-flow i { color: var(--accent); font-style: normal; }
.settings-note { margin-bottom: 16px; padding: 9px 11px; border-radius: 7px; background: var(--surface-muted); color: var(--muted); font-size: 9px; line-height: 1.5; }
.settings-note code { color: var(--accent); }
.review-model-section { min-width: 0; }
.vision-review-section { padding-left: 26px; border-left: 1px solid var(--line); }
.review-config-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.review-config-heading h3 { margin: 0 0 4px; font-size: 13px; }
.review-config-heading p { margin: 0; color: var(--muted); font-size: 9px; }
.review-config-heading button { min-height: 29px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--accent); font-size: 8px; }
.settings-dialog-body .field { margin-bottom: 10px; }
.settings-dialog-body .field input, .settings-dialog-body .field select { min-height: 36px; }
.review-test-button { width: auto; padding: 0 12px; }
.settings-dialog-footer { display: flex; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); }
.settings-save { min-width: 120px; justify-content: center; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast); max-width: 380px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink-soft); box-shadow: 0 6px 14px rgb(30 55 68 / 16%); font-size: 10px; line-height: 1.5; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: none; }
.toast.error { border-color: #dda8a4; color: var(--danger); }
footer { width: min(1520px, calc(100% - 40px)); min-height: 70px; display: flex; align-items: center; justify-content: space-between; margin: 0 auto; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
footer span { color: var(--ink-soft); font-weight: 650; }

@media (min-width: 821px) {
  html, body { height: 100%; overflow: hidden; }
  .app-shell { height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .topbar { flex: 0 0 62px; }
  main { min-height: 0; display: flex; flex: 1; flex-direction: column; overflow: hidden; }
  .intro { flex: 0 0 76px; }
  .workspace { min-height: 0; flex: 1; margin-bottom: 14px; }
  .config-panel { flex: 0 0 100px; }
  .test-panel { min-height: 0; }
  footer { display: none; }
  .results-section { min-height: 0; flex: 1; display: none; flex-direction: column; margin: 0 0 14px; }
  body.show-results .intro, body.show-results .workspace { display: none; }
  body.show-results .results-section { display: flex !important; padding-top: 14px; }
  .results-table-wrap { min-height: 0; display: flex; flex: 1; flex-direction: column; }
  .table-scroll { min-height: 0; flex: 1; overflow-y: hidden; }
}

@media (max-width: 1260px) {
  #configForm { grid-template-columns: .95fr 1.28fr .95fr 1.08fr 196px; }
  .config-actions { grid-template-columns: 64px minmax(116px, 1fr); padding-left: 8px; }
  .config-panel { grid-template-columns: 125px minmax(0, 1fr); gap: 14px; }
  .risk-legend { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  #configForm { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .config-actions { grid-column: span 2; border-left: 0; padding-left: 0; }
  .config-panel { grid-template-columns: 105px minmax(0, 1fr); }
  .custom-box { grid-template-columns: minmax(0, 1fr) 250px; }
}

@media (max-width: 820px) {
  body { background: var(--surface); }
  :root { --content-width: 720px; --content-gutter: 12px; }
  .topbar { position: static; }
  .brand-logo-lockup img { width: 130px; }
  .platform-name, .service-status { display: none; }

  .intro { grid-template-columns: 1fr; gap: 14px; padding: 24px 0 18px; }
  .intro-stats { padding-top: 12px; border-top: 1px solid var(--line); }
  .intro-stats div:first-child { padding-left: 0; }
  .workspace { overflow: visible; }
  .config-panel { display: block; padding: 18px; }
  .config-panel .section-heading { margin-bottom: 16px; }
  #configForm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .config-actions { grid-column: span 2; }
  #testConnection { width: 100%; }
  .test-panel { padding: 18px; }
  .risk-legend { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rule-table-scroll { overflow-x: auto; }
  .custom-box { grid-template-columns: 1fr; }
  .prompt-composer { min-height: 360px; }
  .input-options { grid-row: 1; }
  footer { width: calc(100% - 24px); gap: 16px; }
}

@media (max-width: 560px) {
  .intro h1 { font-size: 21px; }
  .intro-stats div { min-width: 0; padding: 2px 12px; }
  .intro-stats strong { font-size: 18px; }
  #configForm { grid-template-columns: 1fr; }
  .config-actions { grid-column: auto; grid-template-columns: 82px minmax(0, 1fr); }
  .section-heading-wide { align-items: flex-start; flex-direction: column; }
  .mode-switch { width: 100%; }
  .mode-switch button { flex: 1; }
  .risk-overview-header { align-items: flex-start; }
  .risk-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-pagination { align-items: stretch; flex-direction: column; gap: 7px; }
  .rule-pagination-summary { justify-content: space-between; }
  .rule-pagination-controls { align-self: stretch; justify-content: space-between; }
  .run-bar { align-items: stretch; flex-direction: column; }
  .run-bar > div { text-align: left; }
  .primary-button { width: 100%; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .table-toolbar { flex-direction: column; }
  .table-toolbar input, .table-toolbar select { width: 100%; max-width: none; }
  .settings-dialog-body { grid-template-columns: 1fr; }
  .vision-review-section { margin-top: 18px; padding: 18px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .review-flow { align-items: stretch; flex-direction: column; }
  .review-flow i { display: none; }
  footer { align-items: flex-start; padding: 22px 0; }
  footer p { max-width: 220px; margin: 0; text-align: right; }
}

/* 宽屏显示器经常搭配较高的系统缩放比例，CSS 视口会变得又宽又矮。
   单独按高度重排信息密度，避免表格只剩两三行可见。 */
@media (min-width: 821px) and (max-height: 900px) {
  .topbar { height: 48px; flex-basis: 48px; }
  .brand-logo-lockup { height: 34px; }
  .brand-logo-lockup img { width: 126px; height: 30px; }
  .intro { min-height: 0; flex-basis: 48px; padding: 5px 2px; }
  .intro h1 { margin-bottom: 1px; font-size: 18px; }
  .intro-copy > p { font-size: 9px; line-height: 1.35; }
  .intro-stats div { min-width: 76px; padding: 0 12px; }
  .intro-stats strong { font-size: 16px; }
  .intro-stats span { margin-top: 1px; font-size: 8px; }

  .workspace { margin-bottom: 7px; }
  .config-panel { flex-basis: 64px; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 6px 14px 5px; }
  .section-heading h2 { margin-bottom: 1px; font-size: 14px; }
  .section-heading p { font-size: 8px; }
  #configForm { gap: 7px; }
  .field > span { margin-bottom: 2px; font-size: 8px; }
  .field small { display: none; }
  .field input,
  .field select { min-height: 32px; padding-block: 5px; }
  .provider-menu-toggle { height: 32px; }
  .provider-menu-toggle svg { width: 26px; height: 26px; padding: 6px; }
  .provider-selection { font-size: 10px; }
  .model-menu-toggle,
  .select-menu-icon { top: 3px; width: 26px; height: 26px; }
  .model-combobox input,
  .select-combobox select { padding-right: 30px; }
  .password-field button { inset-block: 3px; }
  #testConnection { min-height: 32px; }

  .test-panel { padding: 7px 12px 6px; }
  .section-heading-wide { min-height: 29px; margin-bottom: 5px; }
  .section-heading-wide .section-heading p { display: none; }
  .mode-switch { padding: 2px; }
  .mode-switch button { min-height: 25px; padding-inline: 10px; font-size: 8px; }
  .risk-overview { margin-bottom: 5px; padding: 5px 8px 4px; }
  .risk-overview-header { margin-bottom: 3px; }
  .risk-overview-header h3 { font-size: 9px; }
  .risk-overview-header p { display: none; }
  .risk-total strong { font-size: 13px; }
  .risk-distribution { height: 4px; }
  .risk-legend { grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 1px 4px; margin-top: 3px; }
  .risk-stat { min-height: 18px; grid-template-columns: 5px minmax(0, 1fr) auto; gap: 3px; padding: 1px 2px; }
  .risk-stat i { width: 5px; height: 5px; }
  .risk-stat span,
  .risk-stat strong { font-size: 7px; }

  .rule-browser-header { padding: 5px 9px 4px; }
  .rule-browser-header h3 { margin: 0; font-size: 9px; }
  .rule-browser-header p { display: none; }
  .rule-toolbar { gap: 5px; padding: 4px 8px; }
  .rule-toolbar label { font-size: 0; }
  .rule-toolbar select,
  .rule-toolbar input { min-height: 27px; margin-top: 0; padding-block: 3px; font-size: 8px; }
  .rule-table th { height: 22px; padding: 3px 8px; font-size: 7px; }
  .rule-table tbody tr,
  .rule-table td { height: 25px; }
  .rule-table td { padding: 2px 8px; font-size: 8px; }
  .rule-text-cell strong { font-size: 8px; line-height: 1.25; }
  .rule-text-cell small,
  .rule-table td > small { display: none; }
  .tag { padding: 2px 5px; }
  .rule-pagination { min-height: 32px; padding: 2px 8px; }
  .rule-pagination button { min-height: 26px; padding-inline: 8px; }
  .rule-page-position { min-width: 90px; padding-inline: 7px; }
  .run-bar { gap: 12px; margin-top: 4px; padding-top: 4px; }
  .run-bar strong { font-size: 15px; }
  .run-bar .primary-button { min-width: 190px; height: 34px; grid-template-columns: minmax(0, 1fr) 24px; padding-left: 13px; }
  .run-bar .primary-button > span { font-size: 9px; }
  .run-bar .primary-button i { width: 24px; height: 24px; font-size: 14px; }
}

@media (min-width: 821px) and (max-height: 650px) {
  .topbar { height: 42px; flex-basis: 42px; }
  .intro { display: none; }
  .config-panel { flex-basis: 58px; padding-block: 4px; }
  .section-heading p { display: none; }
  .risk-overview { padding-block: 4px; }
  .risk-overview-header { margin-bottom: 2px; }
  .risk-legend { display: none; }
  .rule-table tbody tr,
  .rule-table td { height: 23px; }
  .rule-table td > small { display: none; }
  .rule-pagination { min-height: 30px; }
  .run-bar { min-height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Shared evaluation status and report layout. */
#testConnection, .review-test-button { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; white-space: normal; line-height: 1.25; padding: 6px 8px; }
.connection-label { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 12px; color: #207356; }
.connection-latency { display: block; font-size: 10px; color: var(--muted); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.config-error { grid-column: 1 / -1; margin: 6px 0; padding: 8px 10px; color: #a62f28; background: #fff1ee; border: 1px solid #e8b9b4; border-radius: 6px; font-size: 12px; }
.performance-option { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 11px; }
.performance-option label { display: inline-flex; align-items: center; gap: 6px; }
.performance-option input[type=checkbox] { width: 15px; height: 15px; min-height: 0; accent-color: var(--accent); }
.performance-option input[type=number] { width: 62px; min-height: 28px; padding: 3px 6px; }
.performance-option small { color: var(--muted); }
body.show-results .intro, body.show-results .workspace { display: none; }
body.show-results .results-section { display: flex !important; flex-direction: column; gap: 12px; overflow-y: auto; padding: 16px 2px 28px; }
body.show-results .results-section > * { flex-shrink: 0; }
.evaluation-progress { padding: 18px 20px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; }
.progress-heading, .progress-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.progress-heading h2 { margin: 0 0 6px; font-size: 18px; }
.progress-heading p, .progress-meta { color: var(--muted); font-size: 12px; }
.progress-heading p { margin: 0; }
.progress-heading > strong { font-size: 24px; font-variant-numeric: tabular-nums; color: var(--accent); }
#evaluationProgress { display: block; width: 100%; height: 8px; margin: 16px 0 10px; border: 0; border-radius: 4px; overflow: hidden; accent-color: #126b9a; }
#evaluationProgress::-webkit-progress-bar { background: #e6edf2; }
#evaluationProgress::-webkit-progress-value { background: #126b9a; }
.results-header { margin: 0; }
.report-note { font-size: 12px; color: var(--muted); margin: 0; }
.category-summary { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 11px; color: var(--muted); }
.category-summary strong { color: var(--ink); margin-right: 6px; }
.performance-report { padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.performance-report h3 { font-size: 15px; margin: 0 0 8px; }
.performance-report p { font-size: 12px; color: var(--muted); margin: 0 0 12px; line-height: 1.6; }
.performance-report table { min-width: 840px; }
.performance-report td { font-variant-numeric: tabular-nums; }
body.show-results .results-table-wrap { flex: none; overflow: visible; }
body.show-results .table-scroll { overflow: auto; }
#progressTitle:focus { outline: none; }
@media (max-width: 820px) { .progress-heading, .results-header { flex-wrap: wrap; } .progress-meta { align-items: flex-start; font-size: 11px; } .results-actions { flex-wrap: wrap; } }

/* One horizontal connection action: stable alignment across every status. */
#testConnection, .review-test-button { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px 7px; min-height: 38px; font-size: 11px; font-weight: 600; }
#testConnection:disabled, .review-test-button:disabled { opacity: 1; background: #edf4f8; color: #416577; cursor: progress; }
#testConnection:disabled .button-indicator, .review-test-button:disabled .button-indicator { width: 12px; height: 12px; border: 2px solid #c5d9e3; border-top-color: #126b9a; background: transparent; border-radius: 50%; animation: connection-spin .8s linear infinite; flex-shrink: 0; }
.connection-label { font-size: 11px; gap: 5px; }
.connection-latency { margin: 0; font-size: 10px; }
@keyframes connection-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #testConnection:disabled .button-indicator, .review-test-button:disabled .button-indicator { animation: none; } }
.native-select-hidden { display: none !important; }
.unified-select { position: relative; width: 100%; min-width: 0; }
.unified-select-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 38px; padding: 0 3px 0 10px; gap: 4px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); text-align: left; font: inherit; font-size: 11px; cursor: pointer; }
.unified-select-toggle:hover { border-color: #8ea5b1; }
.unified-select-toggle:focus-visible, .unified-select-toggle[aria-expanded=true] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.unified-select-value { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.unified-select-arrow { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 5px; flex: 0 0 30px; }
.unified-select-arrow svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.unified-select-toggle:hover .unified-select-arrow, .unified-select-toggle[aria-expanded=true] .unified-select-arrow { background: var(--accent-soft); }
.unified-select-toggle[aria-expanded=true] svg { transform: rotate(180deg); }
.unified-select-menu { color: var(--ink); box-sizing: border-box; }
.unified-select-menu .model-option { color: var(--ink); font-size: 11px; }
.unified-select-menu .model-option[aria-selected=true] { color: var(--accent); background: var(--accent-soft); }
.select-combobox > .select-menu-icon { display: none; }
.rule-toolbar .unified-select-toggle, .table-toolbar .unified-select-toggle { min-height: 32px; }
.table-toolbar > .unified-select { width: 160px; }
.provider-menu-toggle { grid-template-columns: minmax(0, 1fr) 30px; gap: 4px; padding-left: 10px; }
.provider-state-dot { display: none; }
.provider-selection { font-size: 11px; font-weight: 400; }
.provider-menu, .model-menu { border-radius: 9px; padding: 5px; box-shadow: 0 3px 8px rgb(22 48 65 / 12%); }
.provider-option:hover { background: var(--accent-soft); }
@media (min-width: 821px) and (max-height: 850px) { .unified-select-toggle { min-height: 32px; } .unified-select-arrow { height: 26px; } }

/* Reserve report regions from the first frame; only their data changes. */
.stop-button { color: #a3312b; border-color: #d6a09c; }
.stop-button:hover:not(:disabled) { background: #fff0ee; }
.stop-button:disabled { opacity: .5; cursor: default; }
.tag.pending { color: #745619; background: #faf3e2; border-color: #ddcdab; white-space: nowrap; }
.evaluation-progress { flex: none; }
.progress-heading p, .progress-meta, #reportNote { min-height: 20px; }
#performanceStatus { height: 40px; overflow-y: auto; }
.category-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 16px; }
.category-summary > span { min-height: 22px; white-space: nowrap; }
#performanceReport tbody tr { height: 36px; }
.results-table-wrap table { table-layout: fixed; width: 100%; min-width: 980px; }
#resultBody tr { height: 96px; }
#resultBody td { overflow: hidden; vertical-align: top; }
#resultBody .result-clamp, #resultBody td > small { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
#resultBody td:nth-child(6), #resultBody td:nth-child(7) { white-space: nowrap; }
.results-table-wrap .table-scroll { height: 522px; overflow: auto; }
.results-table-wrap thead { position: sticky; top: 0; background: var(--surface-soft); }
.metric-grid { min-height: 76px; }

/* Report workbench: stable viewport, compact overview, independent report panes. */
body.show-results .results-section { display: grid !important; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: 94px minmax(0,1fr); gap: 12px; overflow: hidden; padding: 14px 0; margin: 0; }
body.show-results .evaluation-progress { grid-column: 1; grid-row: 1; padding: 12px 16px; border: 0; background: transparent; }
.progress-heading h2 { font-size: 18px; margin-bottom: 3px; }
.progress-heading p { font-size: 11px; }
.progress-heading > strong { font-size: 22px; }
#evaluationProgress { margin: 8px 0 5px; height: 5px; }
.progress-meta { font-size: 10px; min-height: 15px; }
body.show-results .results-header { grid-column: 2; grid-row: 1; align-self: center; }
.results-header > div:first-child { display: none; }
.results-actions .secondary-button { min-height: 34px; font-size: 11px; }
.report-layout { grid-column: 1 / -1; display: grid; grid-template-columns: 244px minmax(0,1fr); gap: 16px; min-height: 0; overflow: hidden; }
.report-sidebar { min-height: 0; display: flex; flex-direction: column; overflow: auto; padding: 16px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.report-sidebar > h3 { font-size: 13px; margin: 0 0 14px; }
.report-sidebar #metricGrid { order: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 0; margin: 0 0 18px; border: 0; border-radius: 0; gap: 14px 12px; background: transparent; }
.report-sidebar .metric { padding: 0; border: 0; background: transparent; }
.report-sidebar .metric span { font-size: 10px; }
.report-sidebar .metric strong { font-size: 22px; margin-top: 5px; white-space: nowrap; }
.report-sidebar .metric:last-child strong { font-size: 17px; }
.report-sidebar #categorySummary { order: 2; display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); padding-top: 8px; }
.report-sidebar #categorySummary > span { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 28px; font-size: 9px; }
.report-sidebar #categorySummary strong { font-size: 10px; margin: 0; }
.report-sidebar #reportNote { order: 3; margin-top: auto; padding-top: 14px; font-size: 10px; line-height: 1.6; }
.report-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 10px; }
.report-tabs { display: flex; flex: 0 0 48px; align-items: stretch; gap: 24px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.report-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 0 2px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.report-tabs button[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }
.report-pane[hidden] { display: none !important; }
body.show-results #safetyPane { display: flex; flex: 1; flex-direction: column; min-height: 0; border: 0; border-radius: 0; overflow: hidden; }
#safetyPane .table-toolbar { flex: 0 0 54px; padding: 10px 14px; background: white; }
body.show-results #safetyPane .table-scroll { height: auto; min-height: 0; flex: 1; overflow: auto; }
#safetyPane table { min-width: 820px; }
#safetyPane thead th { padding: 10px 8px; font-size: 10px; }
#resultBody tr { height: 72px; }
#resultBody td { padding: 9px 8px; font-size: 11px; line-height: 1.5; }
#resultBody .result-clamp, #resultBody td > small { -webkit-line-clamp: 2; }
#resultBody td small { font-size: 10px; }
.result-detail-button { padding: 2px 0 0; border: 0; background: none; color: var(--accent); font-size: 10px; }
#safetyPane .result-pagination { flex: 0 0 44px; padding: 8px 14px; border-top: 1px solid var(--line); }
body.show-results #performanceReport { min-height: 0; overflow: auto; padding: 24px; border: 0; }
#performanceReport h3 { margin-bottom: 12px; font-size: 18px; }
#performanceStatus { height: auto; min-height: 48px; max-width: 80ch; font-size: 12px; }
#performanceReport table { min-width: 760px; }
#performanceReport th, #performanceReport td { padding: 12px 8px; font-size: 11px; }
.result-detail-dialog { width: min(760px,calc(100vw - 40px)); max-height: 82dvh; padding: 0; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
.result-detail-dialog::backdrop { background: rgb(20 40 55 / 35%); }
.result-detail-dialog header { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.result-detail-dialog h2 { font-size: 17px; margin: 0; }
.result-detail-dialog header button { font-size: 24px; border: 0; background: transparent; }
#resultDetailContent { padding: 0 22px 20px; }
#resultDetailContent h3 { font-size: 12px; margin: 20px 0 8px; color: var(--muted); }
#resultDetailContent p { font-size: 14px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
@media (max-width: 1050px) and (min-width: 821px) { .report-layout { grid-template-columns: 210px minmax(0,1fr); gap: 10px; } .report-sidebar { padding: 12px; } }
@media (max-width: 820px) { body.show-results .results-section { height: calc(100dvh - 74px); grid-template-columns: minmax(0,1fr); grid-template-rows: 94px 40px minmax(0,1fr); } body.show-results .results-header { grid-column: 1; grid-row: 2; } .report-layout { grid-template-columns: 170px minmax(0,1fr); grid-row: 3; gap: 8px; } .report-sidebar { padding: 10px; } .report-sidebar #metricGrid { grid-template-columns: 1fr; } .report-sidebar #categorySummary > span { display: block; white-space: normal; } }
.report-sidebar #metricGrid { flex: 0 0 auto; overflow: visible; }
.report-sidebar #categorySummary { flex: 0 0 auto; }
.report-sidebar #categorySummary > span { min-height: 24px; }
#resultBody tr { height: 64px; }
#resultBody td { padding: 7px 8px; line-height: 1.4; }

/* History stays beside the workspace on wide screens, and opens as a drawer on laptops. */
.home-layout { display: flex; flex: 1; min-height: 0; }
.home-layout > .workspace { flex: 1; min-width: 0; }
body.show-results .home-layout { display: none; }
.history-panel { display: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; flex-direction: column; min-height: 0; gap: 16px; }
.history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.history-heading h2 { margin: 0 0 6px; font-size: 17px; }
.history-heading span, .history-footnote { font-size: 12px; color: #71838e; }
.history-heading button { border: 0; background: transparent; font-size: 24px; line-height: 1; cursor: pointer; }
.history-tools { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: #71838e; }
.history-tools button { border: 0; background: transparent; color: #08749a; cursor: pointer; }
.history-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.history-record { flex-shrink: 0; width: 100%; text-align: left; background: #f7fafb; border: 1px solid #e2eaee; border-radius: 8px; padding: 14px; color: #243e4c; cursor: pointer; }
.history-record:hover { border-color: #79aabb; background: #f0f7fa; }
.history-record:focus-visible { outline: 2px solid #08749a; outline-offset: 2px; }
.history-record strong { display: block; font-size: 14px; overflow-wrap: anywhere; margin-bottom: 7px; }
.history-record time { display: block; font-size: 11px; color: #71838e; margin-bottom: 12px; }
.history-record .history-status { display: flex; justify-content: space-between; font-size: 12px; gap: 8px; }
.history-record small { display: block; margin-top: 9px; color: #71838e; font-size: 11px; }
.history-empty { margin: auto 0; padding: 24px 4px; text-align: center; color: #71838e; line-height: 1.8; font-size: 13px; }
.history-footnote { margin: 0; padding-top: 12px; border-top: 1px solid var(--line); line-height: 1.7; }
body.history-open .history-panel { display: flex; position: fixed; z-index: 80; right: 16px; top: 72px; bottom: 16px; width: min(320px, calc(100vw - 32px)); box-shadow: 0 12px 48px #18354326; }
body.history-open.show-results .home-layout { display: contents; }
@media (min-width: 1800px) {
  :root { --content-width: 1840px; --content-gutter: 24px; }
  .home-layout { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 20px; }
  .history-panel { display: flex; margin-bottom: 14px; }
  #closeHistory { display: none; }
  body.history-open .history-panel { position: static; width: auto; box-shadow: none; }
  body.history-open.show-results .history-panel { position: fixed; width: 320px; display: flex; }
  body.show-results #closeHistory { display: block; }
}
@media (max-width: 820px) { .home-layout { display: block; } }

/* Shared two-page evaluation navigation. */
:root { --content-width: 2040px; --content-gutter: 20px; }
.platform-layout { width: min(var(--content-width), calc(100% - 2 * var(--content-gutter))); margin: 0 auto; display: grid; grid-template-columns: 174px minmax(0,1fr); gap: 22px; min-height: 0; flex: 1; }
.platform-layout > main { width: 100%; min-width: 0; margin: 0; }
.platform-nav { padding: 27px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.platform-nav > p { margin: 0 12px 12px; font-size: 11px; color: #637b86; }
.platform-nav a { display: flex; align-items: center; gap: 9px; min-height: 50px; padding: 12px; color: #49616d; font-size: 13px; font-weight: 650; border-radius: 8px; text-decoration: none; }
.platform-nav a span { font-size: 10px; opacity: .65; }
.platform-nav a.active { background: #dcebf1; color: #075d7d; }
.platform-nav a:hover { background: #e1ebf0; }
.platform-nav > small { font-size: 10px; color: #687e89; margin: auto 12px 6px; }
.perf-engine { font-weight: 750; color: #086d96; font-size: 16px; white-space: nowrap; }
.perf-engine span { display: block; color: #697f8a; font-size: 10px; font-weight: 400; margin-top: 5px; }
.perf-workspace { display: grid; grid-template-columns: minmax(0,1fr) 250px; gap: 18px; flex: 1; min-height: 0; margin-bottom: 14px; }
.perf-content { min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.perf-config,.perf-results,.perf-history { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.perf-config { padding: 18px 20px 12px; flex-shrink: 0; }
.perf-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.perf-section-heading h2 { font-size: 16px; margin: 0; }
.perf-section-heading small { display: block; font-size: 11px; font-weight: 400; color: #657c88; margin-top: 4px; }
.perf-config fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.perf-model-fields { display: grid; grid-template-columns: 1fr 1.4fr 1fr 1.3fr; gap: 12px; }
.perf-parameters { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #e3eaee; }
.perf-config .field > span { font-size: 11px; }
.perf-config .field small { font-size: 10px; color: #657c88; line-height: 1.5; }
.perf-model-picker { display: flex; min-width: 0; gap: 5px; }
.perf-model-picker input { min-width: 0; }
.perf-model-picker button { flex-shrink: 0; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--accent); font-size: 10px; padding: 5px 8px; }
.perf-prompt { margin-top: 14px; }
.perf-prompt > span { display: flex; justify-content: space-between; gap: 8px; }
.perf-prompt textarea { min-height: 56px; height: 56px; resize: vertical; padding: 9px 12px; font-size: 12px; }
.perf-config-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 12px; }
.perf-config-footer > span { color: #5f7784; font-size: 11px; }
.perf-config-footer > div { display: flex; gap: 8px; }
.perf-config .primary-button { min-width: 150px; height: 38px; }
.perf-run { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px; gap: 14px; flex-shrink: 0; min-height: 62px; }
.perf-run strong { font-size: 14px; }
.perf-run p { margin: 5px 0 0; color: #617986; font-size: 11px; }
.perf-run-actions { display: flex; align-items: center; gap: 14px; white-space: nowrap; font-size: 12px; color: #547180; }
.perf-state-dot { display: inline-block; width: 8px; height: 8px; background: #a1b1b9; margin-right: 9px; border-radius: 50%; }
.perf-state-dot.running { background: #087398; animation: connection-pulse 1.5s infinite; }
.perf-state-dot.completed { background: #257558; }.perf-state-dot.error { background: #b55a38; }
.perf-results { padding: 18px 20px; flex: 1; min-height: 240px; }
.perf-metrics { display: grid; grid-template-columns: repeat(4,1fr); margin: 18px 0; }
.perf-metrics > div { padding: 0 18px; border-right: 1px solid var(--line); }.perf-metrics > div:first-child { padding-left: 0; }.perf-metrics > div:last-child { border: 0; }
.perf-metrics span { color: #617986; font-size: 11px; }.perf-metrics strong { display: block; font-size: 26px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.perf-detail-table { overflow: auto; }.perf-detail-table table { width: 100%; min-width: 560px; }.perf-detail-table th { font-size: 10px; padding: 10px 8px; }.perf-detail-table td { font-size: 12px; padding: 14px 8px; }
.perf-empty { text-align: center; color: #687f8a; }.perf-footnote { font-size: 10px; color: #607984; line-height: 1.8; margin: 12px 0 0; }
.perf-history { padding: 18px; display: flex; flex-direction: column; min-height: 0; gap: 18px; }
.perf-error { color: #b13e37; font-size: 12px; margin: 12px 0 0; }
#perfModelMenu { border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin: 0; max-height: 270px; overflow: auto; background: white; box-shadow: 0 8px 28px #18354322; }
#perfModelMenu button { display: block; border: 0; background: white; width: 100%; text-align: left; padding: 10px; font-size: 12px; }#perfModelMenu button:hover { background: #edf5f8; }
#perfHistoryList .history-record.active { border-color: #1681a3; background: #eaf4f7; }
@media(min-width:821px) and (max-width:1500px) { .platform-layout { grid-template-columns: 146px minmax(0,1fr); gap: 14px; }.platform-nav a { font-size: 11px; padding: 10px 8px; }.perf-workspace { grid-template-columns: minmax(0,1fr) 210px; gap: 12px; }.perf-model-fields { grid-template-columns: 1fr 1.2fr; }.perf-config { padding: 14px; }.perf-config-footer { flex-wrap: wrap; }.platform-layout .config-panel { grid-template-columns: 1fr; gap: 8px; }.platform-layout .section-heading p { display: none; }.platform-layout #configForm { grid-template-columns: repeat(4,minmax(0,1fr)); }.platform-layout .config-actions { grid-column: span 4; display:flex; justify-content:flex-end; border-left:0; }.platform-layout .config-actions .field { width:75px; }.platform-layout .config-actions > button { min-width:125px; }.platform-layout .config-actions .field-label { display:none; } }
@media(max-width:1050px) { .perf-workspace { grid-template-columns:minmax(0,1fr); overflow:auto; }.perf-content { overflow:visible; }.perf-history { min-height:200px; }.perf-history .history-list { max-height:250px; flex:none; }.perf-parameters { grid-template-columns:repeat(2,1fr); } }
@media(max-width:820px) { .platform-layout { width:calc(100% - 24px); display:flex; flex-direction:column; gap:0; }.platform-nav { flex-direction:row; padding:10px 0; gap:6px; }.platform-nav p,.platform-nav small { display:none; }.platform-nav a { flex:1; font-size:12px; min-height:40px; }.perf-model-fields { grid-template-columns:1fr; }.perf-config-footer > div { width:100%; }.perf-config-footer { flex-wrap:wrap; }.perf-metrics { grid-template-columns:repeat(2,1fr); gap:16px; }.perf-metrics > div { padding:0!important; border:0; }.perf-prompt > span small { display:none; }.performance-page .intro { grid-template-columns:1fr auto; }.perf-content { overflow:visible; }.perf-workspace { display:flex; flex-direction:column; } }
@media(prefers-reduced-motion:reduce) { .perf-state-dot.running { animation:none; } }

@media(min-width:1100px) and (max-height:850px) {
  .perf-model-fields { grid-template-columns: 1fr 1.3fr .9fr 1.2fr; gap:8px; }
  .perf-config { padding:12px 14px 10px; }
  .perf-section-heading { margin-bottom:10px; }
  .perf-parameters { margin-top:10px; padding-top:10px; gap:8px; }
  .perf-prompt { margin-top:10px; }.perf-prompt textarea { height:42px; min-height:42px; }
  .perf-config-footer { margin-top:10px; }.perf-config-footer > span { font-size:10px; }
  .perf-config-footer .primary-button { min-width:126px; height:34px; font-size:12px; }
  .perf-run { min-height:48px; }.perf-run p { margin-top:3px; }
  .perf-results { padding:14px; min-height:205px; }.perf-metrics { margin:12px 0; }.perf-metrics strong { font-size:23px; }
  .perf-detail-table td { padding:10px 6px; }.perf-footnote { margin-top:8px; }
}
.perf-metric-label { display:flex; align-items:center; gap:6px; color:#4b6674; font-size:12px; }
.perf-metrics .metric-help { border:1px solid #afc3cc; border-radius:50%; width:17px; height:17px; min-width:17px; padding:0; color:#446575; background:white; font-size:11px; cursor:help; }
.perf-metrics strong small { font-size:11px; font-weight:400; margin-left:5px; color:#526c78; }
.metric-target { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:9px; }
.perf-metrics .metric-target span { color:#526c78; }
.metric-verdict { font-size:10px; font-weight:600; border-radius:4px; padding:3px 6px; background:#edf2f5; color:#526c78; }
.metric-verdict.pass { color:#226849; background:#e9f5ee; }.metric-verdict.fail { color:#a1392e; background:#fff0ed; }
.metric-tooltip { position:fixed; inset:auto; margin:0; max-width:min(340px,calc(100vw - 24px)); padding:13px 16px; border:1px solid #c0d2db; border-radius:8px; background:#fff; color:#284756; box-shadow:0 6px 24px #18354324; font-size:12px; line-height:1.8; z-index:100; }
@media(max-width:650px) { .perf-metrics { grid-template-columns:repeat(2,1fr); gap:20px 0; }.perf-metrics > div:nth-child(3) {padding-left:0;}.perf-metrics > div:nth-child(2) {border:0;} }
.perf-view-tabs { display:flex; gap:22px; border-bottom:1px solid var(--line); margin:0 0 12px; flex-shrink:0; }
.perf-view-tabs button { background:none; border:0; border-bottom:2px solid transparent; padding:9px 0 12px; color:#536f7d; font-size:13px; cursor:pointer; }
.perf-view-tabs button.active { color:#086d96; border-bottom-color:#086d96; font-weight:700; }
#perfTestView[hidden], #perfAnalysisView[hidden] { display:none; }
#perfAnalysisView { flex:1; min-height:0; padding-bottom:14px; }
#perfDashboardFrame { display:block; width:100%; height:100%; min-height:500px; border:1px solid var(--line); border-radius:10px; background:white; }
@media(max-width:820px) { #perfDashboardFrame {height:80vh;} }
/* Combined report: both result frames stay visible throughout the run. */
body.show-results .results-section { grid-template-rows:82px 218px minmax(0,1fr); }
body.show-results #performanceReport { grid-column:1 / -1; grid-row:2; display:flex; flex-direction:column; padding:12px 16px; border:1px solid var(--line); border-radius:10px; background:white; margin:0; }
body.show-results .report-layout { grid-column:1 / -1; grid-row:3; }
.combined-performance-heading { display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
#performanceReport .combined-performance-heading h3 {font-size:15px;margin:0;}
#combinedAnalysisLink { display:inline-flex; align-items:center; min-height:30px; font-size:11px; text-decoration:none; }
#combinedAnalysisLink[aria-disabled=true] { opacity:.5; cursor:default; }
#performanceReport .perf-metrics { margin:8px 0; flex-shrink:0; }
#performanceReport .perf-metrics strong {font-size:23px;margin-top:4px;}
#performanceReport .metric-target {margin-top:5px;}
#performanceStatus {margin:0 0 6px; min-height:18px; height:18px; max-width:none; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; flex-shrink:0;}
#performanceReport .table-scroll {flex:1; min-height:0;overflow:auto;}
#performanceReport th, #performanceReport td {padding:5px 8px; font-size:10px;}
#performanceReport tbody tr {height:26px;}
.analysis-start {display:flex;align-items:center;justify-content:center;padding:0 18px;text-decoration:none;min-height:38px;font-size:13px;}
@media(max-width:820px) {body.show-results .results-section {grid-template-rows:78px 38px 218px minmax(220px,1fr);overflow:auto;}body.show-results #performanceReport {grid-row:3;}body.show-results .report-layout {grid-row:4;}.results-actions {flex-wrap:wrap;}}
@media(max-width:650px) {#performanceReport .perf-metrics {grid-template-columns:repeat(4,minmax(125px,1fr));gap:0;overflow:auto;}#performanceReport .perf-metrics>div {padding:0 8px;} }
#reviewStorageHint {margin-right:auto; font-size:12px; color:#526f7e;line-height:1.6;}
.settings-dialog-footer {gap:12px;flex-wrap:wrap;}

.case-view-button {float:right; display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px; padding:0; margin:0 0 0 8px; border:1px solid var(--line); border-radius:6px; color:var(--accent); background:white; cursor:pointer;}
.case-view-button:hover {background:#e2f1f6;border-color:var(--accent);}
.case-view-button:focus-visible {outline:2px solid var(--accent);outline-offset:2px;}

#verifyGeneration {grid-column:2; white-space:nowrap; font-size:11px; min-height:28px; padding:5px 8px;}
#saveModelCapability {font-size:11px; min-height:28px; padding:5px 8px;}
