/*
 * Youmi-inspired operating surface: white navigation, mist background, forest
 * actions and a small orange brand accent. Preserve all original data controls.
 * Desktop: sidebar / header / vendor toolbar / three-column workbench / run bar.
 * Narrow screens: drawer navigation and vertically stacked work sections.
 */
:root {
  color-scheme: light;
  --bg: #f0f5f2;
  --surface: #fff;
  --surface-hover: #eef5f1;
  --border: #dbe5de;
  --text: #1c3229;
  --text-muted: #596e63;
  --accent: #2d7a5f;
  --accent-hover: #1a4a3a;
  --success: #23744d;
  --danger: #b43c36;
  --warning: #936007;
  --radius: 6px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  --sidebar-width: 208px;
}

body { font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input::placeholder, textarea::placeholder { color: #66776e; opacity: 1; }
.panel-title, .section-divider, .admin-table th { letter-spacing: 0; text-transform: none; }
.ui-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background: currentColor;
  mask: var(--icon) center / contain no-repeat;
  -webkit-mask: var(--icon) center / contain no-repeat;
}

.themed-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.site-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  overflow-y: auto;
}
.site-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 26px; color: var(--text); }
.site-brand:hover { text-decoration: none; }
.brand-mark { flex-shrink: 0; font-family: Georgia, serif; color: #1a4a3a; font-size: 28px; font-weight: 700; line-height: 1; }
.brand-mark > span { color: #b85d22; }
.brand-copy { font-size: 16px; font-weight: 650; white-space: nowrap; }
.brand-copy > span { display: block; margin-top: 3px; font-size: 11px; color: var(--text-muted); font-weight: 400; }
.nav-caption { padding: 10px 12px; color: var(--text-muted); font-size: 11px; }
.site-nav { display: grid; gap: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #496354;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}
.nav-item:hover { background: #f3f8f5; text-decoration: none; color: #1a4a3a; }
.nav-item.active { background: #e5f0e9; color: #1a4a3a; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 20px 10px 0; }
.sidebar-label { display: block; font-size: 11px; color: var(--text-muted); }
.sidebar-label.secondary { margin-top: 4px; font-size: 10px; }
.sidebar-backdrop { display: none; }
.site-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.themed-shell .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  min-height: 60px;
  padding: 0 24px 0 16px;
  gap: 16px;
  background: #fff;
}
.header-leading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.themed-shell .header h1 { font-size: 17px; font-weight: 600; white-space: nowrap; }
.themed-shell .header-nav { width: auto; margin: 0; gap: 12px; flex-wrap: nowrap; }
.shell-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.shell-icon-button:hover { color: var(--accent-hover); background: var(--surface-hover); }
.user-chip { display: inline-flex; align-items: center; gap: 9px; padding: 0; border: 0; border-radius: 0; color: var(--text); font-size: 13px; }
.user-avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e5f0e9; color: #1a4a3a; font-size: 12px; font-weight: 700; }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-collapsed { --sidebar-width: 72px; }
.nav-collapsed .site-sidebar { padding-inline: 10px; }
.nav-collapsed .site-brand { justify-content: center; padding-inline: 0; }
.nav-collapsed .brand-mark { font-size: 23px; }
.nav-collapsed .brand-copy, .nav-collapsed .nav-caption, .nav-collapsed .sidebar-foot { display: none; }
.nav-collapsed .nav-item { justify-content: center; position: relative; }
.nav-collapsed .nav-item > span:not(.ui-icon) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.workspace-toolbar { display: flex; align-items: center; gap: 20px; min-height: 66px; flex-shrink: 0; padding: 12px 24px; }
.toolbar-label { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.workspace-toolbar .tabs { gap: 4px; align-self: auto; margin: 0; padding: 3px; overflow-x: auto; background: #e4ece7; border-radius: 6px; }
.tab { min-height: 32px; padding: 6px 16px; border: 0; border-radius: 4px; color: #526a5b; font-size: 13px; }
.tab.active { background: #fff; color: #1a4a3a; box-shadow: 0 1px 3px #0f2a2210; }
.tab:hover:not(.active) { background: #d8e5dc; color: #1a4a3a; }
.main-layout {
  grid-template-columns: minmax(220px, .85fr) minmax(280px, 1.1fr) minmax(300px, 1.3fr);
  margin: 0 24px 20px;
  border: 1px solid var(--border);
  background: #fff;
  overflow: hidden;
}
.panel, #results-panel { --panel-bg: #fff; background: #fff; }
.panel-head { min-height: 52px; padding: 12px 16px; background: #f7faf8; gap: 10px; }
.panel-title { font-size: 13px; font-weight: 600; color: #1a4a3a; }
.panel-body { padding: 12px; scrollbar-width: thin; scrollbar-color: #becfc3 transparent; }
#left-panel .panel-body { display: flex; flex-direction: column; overflow-y: auto; }
#model-list { flex: 1; min-height: 100px; overflow-y: auto; scrollbar-width: thin; }
#left-panel .section-divider, #left-panel .form-group { flex-shrink: 0; }
#left-panel .form-group:last-child { margin-bottom: 0; }
.section-divider { color: #1a4a3a; margin-top: 24px; font-size: 13px; }
.form-group label { color: #496354; font-size: 12px; margin-bottom: 7px; }
.form-group input, .form-group select, .form-group textarea, .concurrency-select, .admin-inline-control select, .validation-row input, .validation-row select, .validation-row textarea {
  background: #fff;
  border-color: #c3d2c8;
  font-size: 13px;
  min-height: 36px;
}
.form-group input:focus-visible, .form-group textarea:focus-visible, .form-group select:focus-visible, .validation-row input:focus-visible, .validation-row select:focus-visible, .validation-row textarea:focus-visible, .model-name-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"] { accent-color: var(--accent); }
.check-list li { margin-bottom: 2px; }
.check-list label { font-size: 13px; min-height: 40px; padding: 8px; }
.model-item:has(input:checked) { background: #edf5ef; }
.model-item:focus-within .icon-btn { opacity: 1; }
.icon-btn { width: 28px; height: 28px; padding: 4px; }
.group-filter { gap: 6px; }
.group-chip { padding: 5px 8px; border-radius: 4px; font-size: 11px; min-height: 30px; }
.group-chip.active { background: #e5f0e9; border-color: #9fbdab; color: #1a4a3a; }
.group-tag, .batch-id { background: #eaf2ec; color: #256447; }
.case-item { border-radius: 4px; margin: 0; padding: 9px 6px; gap: 6px; font-size: 13px; border-bottom: 1px solid #eef2ef; min-height: 42px; }
.case-item:has(input:checked) { background: #edf5ef; }
.case-item .case-open { opacity: 1; font-size: 11px; }
.case-item .group-tag { max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.empty-state { color: var(--text-muted); font-size: 13px; padding: 40px 16px; line-height: 1.8; }
#results-list > .empty-state { margin-top: 48px; }
#results-list > .empty-state::before { content: ""; display: block; width: 36px; height: 36px; margin: 0 auto 14px; background: #8aa796; mask: url('/static/icons/flask-conical.svg') center / contain no-repeat; -webkit-mask: url('/static/icons/flask-conical.svg') center / contain no-repeat; }
.btn { min-height: 36px; padding: 8px 16px; font-size: 13px; font-weight: 500; }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.btn-secondary { background: #fff; border-color: #c3d2c8; color: #365241; }
.btn-secondary:hover { background: #f0f6f2; border-color: #8faf9b; }
.btn-primary:disabled { background: #e0e8e3; color: #627369; opacity: 1; }
.run-bar { padding: 12px 24px; justify-content: flex-start; gap: 12px; min-height: 65px; background: #fff; }
#run-btn { min-width: 112px; }
.run-hint, #run-status { font-size: 12px; }
#run-status { margin-left: auto; }
.concurrency-select { padding: 7px 10px; }
.summary-bar { gap: 8px; font-size: 12px; }
.result-card, .result-matrix-card, .batch-item { background: #fff; }
.result-card.pass, .result-card.fail, .result-card.skipped, .result-card.pending, .batch-item.pass, .batch-item.fail { border-left-width: 1px; }
.result-matrix thead th, .script-result-table th, .admin-table th { background: #f5f9f7; color: #526a5b; }
.result-matrix .matrix-case-name { background: #fff; }
.result-title { font-size: 13px; }
.result-meta, .validation-result { font-size: 12px; }
.response-preview, #results-panel .response-preview, .curl-block, .validation-list li { background: #f5f8f6; }
.script-table-card { border-radius: 0; border-width: 1px 0 0; }
.script-result-table tr.fail td, .login-error { color: #a32f29; }
.badge.pass { background: #e6f2e9; }
.badge.fail { background: #fbeceb; }
.modal-overlay { background: #0f2a2259; }
.modal { border: 0; border-radius: 8px; box-shadow: 0 20px 64px #0f2a2226; }
.modal-header { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.modal-header h3 { color: #1a4a3a; font-size: 16px; }
.history-filters { font-size: 12px; }
.history-item { border: 0; border-radius: 0; border-bottom: 1px solid var(--border); }
.admin-container { width: 100%; max-width: none; flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 20px 24px; }
.admin-tabs { margin-bottom: 20px; }
.admin-tab { font-size: 13px; }
.admin-section { border: 0; border-radius: 0; padding: 20px; }
.admin-section .admin-section { border-top: 1px solid var(--border); padding: 20px 0 0; }
.admin-section h2 { font-size: 15px; }
.admin-section-head { align-items: center; }
.admin-table { font-size: 13px; }
.admin-table td, .admin-table th { padding: 10px 12px; }
.admin-inline-control { max-width: 560px; }
.admin-inline-control .btn { flex-shrink: 0; }
.admin-inline-control select { min-width: 100px; }
.login-page { background: #f0f5f2; align-items: center; padding: 24px; }
.login-shell { width: min(100%, 384px); }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 28px; color: #1a4a3a; font-size: 18px; font-weight: 600; }
.login-panel { padding: 32px; border: 0; border-radius: 8px; box-shadow: 0 8px 32px #0f2a2210; }
.login-panel h1 { margin-bottom: 28px; font-size: 21px; font-weight: 600; color: #1a4a3a; }
.login-panel .form-group { margin-bottom: 20px; }
.login-panel input { min-height: 42px; }
.login-panel .btn { margin-top: 8px; min-height: 42px; }

@media (min-width: 901px) and (max-width: 1179px) {
  .themed-shell { --sidebar-width: 180px; }
  .nav-collapsed { --sidebar-width: 72px; }
  .brand-copy { font-size: 14px; }
  .main-layout { grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.2fr); overflow-y: auto; flex: 1; }
  .panel { min-height: 440px; max-height: 440px; }
  #results-panel { grid-column: 1 / -1; min-height: 360px; max-height: none; border-top: 1px solid var(--border); }
}
@media (max-width: 900px) {
  .themed-shell { grid-template-columns: minmax(0, 1fr); height: 100dvh; padding-bottom: 0; overflow: hidden; }
  .site-sidebar { display: none; }
  .nav-open .site-sidebar { display: flex; position: fixed; z-index: 60; left: 0; top: 60px; bottom: 0; width: min(260px, 85vw); }
  .sidebar-backdrop:not([hidden]) { display: block; position: fixed; inset: 60px 0 0; z-index: 50; border: 0; background: #0f2a2259; }
  .themed-shell .header { padding: 0 12px; min-height: 60px; gap: 8px; }
  .header-leading { gap: 8px; }
  .themed-shell .header-nav { gap: 8px; }
  .workspace-toolbar { padding: 10px 12px; gap: 12px; min-height: 60px; }
  .workspace-toolbar .tabs { flex: 1; min-width: 0; }
  .tab { flex: 1 0 auto; padding-inline: 12px; }
  .main-layout { grid-template-columns: minmax(0, 1fr); margin: 0 12px 12px; overflow-y: auto; flex: 1; min-height: 0; display: block; }
  .panel { min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .panel-head { position: static; }
  .panel-body { max-height: none; overflow: visible; padding: 12px; }
  #left-panel .panel-body { display: block; overflow: visible; }
  #model-list { max-height: 240px; overflow-y: auto; }
  #case-list { max-height: 360px; overflow-y: auto; }
  #results-panel { min-height: 260px; }
  #results-list > .empty-state { margin-top: 0; }
  .group-filter { flex-wrap: wrap; margin: 0 0 12px; padding: 0 0 12px; }
  .group-chip { min-height: 32px; }
  .case-item { flex-wrap: nowrap; }
  .case-item .case-name { flex-basis: auto; }
  .case-item .group-tag { margin-left: 0; }
  .icon-btn { opacity: 1; min-height: 32px; min-width: 32px; }
  .run-bar { position: static; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); min-height: 65px; flex-wrap: wrap; gap: 8px; box-shadow: none; }
  .run-bar .btn { flex: 1 1 100px; }
  .run-bar .concurrency-select { flex: 1 1 110px; min-height: 36px; }
  .run-hint { flex: 1 1 100%; font-size: 11px; }
  #run-status { flex: 1 1 100%; font-size: 11px; margin: 0; }
  .run-hint:empty, #run-status:empty { display: none; }
  .admin-container { padding: 12px; }
  .admin-tabs { margin: 0 0 12px; padding: 0; }
  .admin-section { padding: 14px; }
  .admin-section-head { flex-direction: row; align-items: center; }
  .admin-section-head .btn { flex-shrink: 0; }
  .history-filters .concurrency-select { width: auto; flex: 1 1 130px; }
  .modal-overlay { padding: 12px; align-items: center; }
  .modal, #history-modal .modal-xl { max-height: calc(100dvh - 24px); border-radius: 8px; }
  .login-brand { font-size: 16px; }
  .login-panel { padding: 28px 24px; }
}
@media (max-width: 400px) {
  .toolbar-label { display: none; }
  .user-name { max-width: 64px; }
  .themed-shell .header h1 { font-size: 15px; }
  .case-item .group-tag { max-width: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 结果矩阵「全局展示」浮层（2026-10-07）----------
   配套脚本 static/js/matrix-wide.js。独立 class 前缀 matrix-wide-，
   避免与线上逐字节一致的 app.js / style.css 产生任何耦合。 */
body.matrix-wide-open { overflow: hidden; }

.matrix-wide-overlay {
  position: fixed;
  inset: 0;
  z-index: 300; /* 高于 .modal-overlay 的 100 */
  background: rgba(12, 28, 22, 0.72);
  display: flex;
  flex-direction: column;
  padding: 14px;
}
.matrix-wide-overlay[hidden] { display: none; }

.matrix-wide-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.matrix-wide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.matrix-wide-title { color: var(--text); font-size: 0.9375rem; font-weight: 600; }
.matrix-wide-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.matrix-wide-zoom-label {
  min-width: 48px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.matrix-wide-zoom-out, .matrix-wide-zoom-in { min-width: 34px; font-weight: 600; }

.matrix-wide-body { flex: 1 1 auto; min-height: 0; display: flex; }
.matrix-wide-scroll {
  flex: 1 1 auto;
  overflow: auto; /* 缩放到极限仍超出时由此兜底滚动 */
  padding: 0 2px 2px;
}

/* 浮层内表格铺满可用宽度，列按内容自动分配 —— 模型多时一屏可见，无需左右拖动 */
.matrix-wide-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: auto;
}
.matrix-wide-table th,
.matrix-wide-table td { white-space: nowrap; }
.matrix-wide-table .matrix-case-name { background: var(--surface); }

@media (max-width: 900px) {
  .matrix-wide-overlay { padding: 8px; }
  .matrix-wide-head { padding: 8px 10px; }
  .matrix-wide-title { font-size: 0.875rem; }
}

/* 「全局展示」按钮与「下载 Excel」靠右相邻。
   .result-matrix-head 是 space-between 布局，加入第三个子元素后若无此规则，
   两个按钮会被撑开分居中部与右侧；margin-left:auto 让它们整体贴右。 */
.matrix-wide-btn {
  flex-shrink: 0;
  margin-left: auto;
}

/* 模型响应内容（2026-10-18，用户要求）：糖果题 / 智商题这类自由作答的探针，
   卡片里 app.js 只给一行 180 字符摘要，这里把完整回答补在下面。
   样式统一 model-response- 前缀，仅由 static/js/model-response.js 生成。 */
.model-response { margin: 6px 0 8px; }
.model-response-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.model-response-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 6px 10px;
  margin-bottom: 6px;
}
.model-response-summary {
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.model-response-text {
  margin: 6px 0 0;
  padding: 8px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 360px;
  overflow: auto;
  background: var(--bg);
  border-radius: var(--radius);
}
