:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-muted: #eef2f5;
  --line: #d7dee5;
  --text: #17202a;
  --muted: #637083;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b42318;
  --warning: #b54708;
  --blue: #2563eb;
  --purple: #7c3aed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html { overflow-y: scroll; scrollbar-gutter: stable; overflow-anchor: none; }
body { overflow-x: hidden; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 38px;
  padding: 0 14px;
  line-height: 1.2;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 18px;
}
.topbar > div:first-child { min-height: 42px; }

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}
.title-row { align-items:baseline; display:flex; gap:12px; }
.language-tabs { align-items:center; display:flex; gap:5px; white-space:nowrap; }
.language-tabs span { color:var(--line); font-size:10px; }
.language-tabs button { background:none; border:0; color:var(--muted); font-size:10px; font-weight:600; height:14px; line-height:12px; min-height:0; padding:1px 2px; }
.language-tabs button:hover,.language-tabs button.is-active { background:none; border:0; color:var(--accent); text-decoration:underline; text-underline-offset:3px; }
.model-option-body strong { display:block; overflow-wrap:anywhere; line-height:1.25; }

h2 {
  font-size: 16px;
  line-height: 1.3;
}

p {
  color: var(--muted);
  margin-top: 6px;
}

.api-config {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto auto;
  min-width: 0;
}

.api-config label {
  grid-column: 1 / -1;
}

.health-status { align-items:center; display:flex; font-size:12px; font-weight:700; gap:6px; justify-content:flex-end; }
.health-status-dot { background:#94a3b8; border-radius:50%; box-shadow:0 0 0 2px rgba(148,163,184,.18); height:8px; width:8px; }
.health-status.is-healthy { color:#15803d; }
.health-status.is-healthy .health-status-dot { background:#22c55e; box-shadow:0 0 0 3px rgba(34,197,94,.18); }
.health-status.is-unhealthy { color:#b42318; }
.health-status.is-unhealthy .health-status-dot { background:#ef4444; box-shadow:0 0 0 3px rgba(239,68,68,.18); }
#healthBtn { border-radius:5px; font-size:11px; line-height:1; min-height:24px; padding:0 7px; width:auto; }

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
  min-width: 120px;
}

.tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.primary-tabs {
  margin-bottom: 10px;
}
.primary-tabs .tab { flex:1 1 0; line-height:1.2; min-width:0; }
.primary-tabs { min-height:42px; }

html[lang="ja"] button,
html[lang="ja"] input,
html[lang="ja"] select,
html[lang="ja"] label { font-size-adjust:.5; }

.tab-live-dot {
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.13);
  display: inline-block;
  height: 7px;
  margin-right: 7px;
  width: 7px;
}

.sub-tabs {
  margin-bottom: 12px;
}

.sub-tabs .tab {
  font-size: 12px;
  min-width: auto;
  padding: 0 10px;
  white-space: nowrap;
}

.filter-stage {
  display: none;
}

.filter-stage.is-active {
  display: block;
}

.is-hidden {
  display: none;
}

.panel,
.output {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel {
  display: none;
  margin-bottom: 14px;
}

.panel.is-active {
  display: block;
}

.empty-panel {
  min-height: 120px;
}

.panel-head,
.output-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}
.json-field-decision { color:#b42318; font-weight:800; }
.json-field-score,.json-field-risk_score { color:#9a6700; font-weight:800; }
.json-field-text { color:#1769aa; font-weight:700; }

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid > div {
  align-items: end;
  display: flex;
  margin-bottom: 12px;
}

.grid > div[hidden] {
  display: none;
}

label {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: block;
  margin-top: 6px;
  outline: none;
  padding: 10px 11px;
  width: 100%;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

textarea {
  min-height: 148px;
  resize: vertical;
}

.model-summary {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.tier2-text-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}
.tier2-text-title { display:block; font-size:15px; font-weight:700; margin-top:16px; }
.tier2-text-title span { color:var(--muted); font-size:12px; font-weight:500; margin-left:5px; }

.tier2-text-cards {
  display: grid;
  gap: 8px;
}

.tier2-text-card {
  align-items: flex-start;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  padding: 8px;
}

.tier2-text-card-input {
  flex: 1;
  min-height: 58px;
  resize: vertical;
}

.tier2-text-remove {
  flex: 0 0 auto;
}

.tier2-dataset-choices {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
}
.tier2-dataset-choice-head { display:flex; justify-content:space-between; margin-bottom:8px; }
.tier2-dataset-choice { align-items:start; display:grid; grid-template-columns:20px minmax(0,1fr); gap:8px; padding:7px 4px; border-bottom:1px solid var(--line); line-height:1.45; }
.tier2-dataset-choice:last-child { border-bottom:0; }
.tier2-dataset-choice input { height:16px; margin:2px 0 0; width:16px; }
.tier2-dataset-choice span { min-width:0; white-space:pre-wrap; word-break:break-word; }

.toggle {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  margin: 4px 0 12px;
}

.toggle input {
  margin: 0;
  width: auto;
}

.output {
  padding-bottom: 0;
}

.output-head button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

pre {
  background: #111827;
  border-radius: 6px 6px 0 0;
  color: #d1fae5;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  margin: 0 -18px;
  max-height: 520px;
  overflow: auto;
  padding: 16px 18px;
  white-space: pre-wrap;
}

.error {
  color: var(--danger);
}

/* Trained model comparison lab */
.model-lab { --lab-navy:#111c2d; --lab-mint:#4ce0b3; --lab-paper:#fbfcfe; color:#172236; }
.model-lab-tab .tab-live-dot { background:#4ce0b3; }
.lab-hero { align-items:center; background:radial-gradient(circle at 88% 12%,rgba(76,224,179,.18),transparent 28%),linear-gradient(125deg,#101b2c,#172b3b); border-radius:14px 14px 0 0; color:white; display:flex; justify-content:space-between; min-height:150px; overflow:hidden; padding:28px 32px; }
.lab-eyebrow { color:var(--lab-mint); font-size:10px; font-weight:900; letter-spacing:.16em; }
.lab-hero h2,.results-overview h2 { font-size:28px; letter-spacing:-.04em; margin:7px 0 0; }
.lab-hero p { color:#aebdca; font-size:13px; max-width:650px; }
.lab-hero-status { align-items:center; background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.12); border-radius:12px; display:grid; gap:1px 10px; grid-template-columns:auto 1fr; padding:13px 16px; }
.lab-hero-status>span { animation:healthPulse 2s infinite; background:var(--lab-mint); border-radius:50%; grid-row:1/3; height:9px; width:9px; }.lab-hero-status strong { font-size:12px; }.lab-hero-status small { color:#91a5b4; font-size:10px; }
.lab-card { background:white; border:1px solid #dce3ea; border-radius:12px; padding:22px; }
.lab-model-section { border-radius:0 0 12px 12px; border-top:0; margin-bottom:12px; }
.lab-section-head,.truth-head,.result-model-head { align-items:center; display:flex; justify-content:space-between; margin-bottom:17px; }
.lab-section-head>div:first-child,.truth-head>div:first-child,.result-model-head>div:first-child { align-items:center; display:flex; gap:11px; }
.lab-section-head h3,.truth-head h3,.result-model-head h3 { font-size:15px; margin:0; }.lab-section-head p,.truth-head p,.result-model-head p { font-size:11px; margin-top:2px; }
.lab-step,.model-index { align-items:center; background:#e8f9f4; border-radius:7px; color:#08785f; display:flex; font:800 11px/1 monospace; height:30px; justify-content:center; width:30px; }
.lab-compact-actions { display:flex; gap:6px; }.lab-link-button { background:transparent; border-color:#d8e0e7; color:#516071; font-size:11px; min-height:30px; padding:0 10px; }.lab-link-button:hover { background:#f2f6f8; border-color:#b7c4cf; color:#172236; }
.model-picker { display:grid; gap:9px; grid-template-columns:repeat(5,minmax(0,1fr)); }
.model-option { align-items:center; border:1px solid #dce3ea; border-radius:10px; cursor:pointer; display:flex; gap:9px; margin:0; min-height:72px; padding:12px; position:relative; transition:.16s ease; }.model-option:hover { border-color:#aab8c4; transform:translateY(-1px); }.model-option:has(input:checked) { background:#f6fffc; border-color:var(--option-color,#0f766e); box-shadow:inset 0 0 0 1px var(--option-color,#0f766e); }.model-option.violet{--option-color:#7c3aed}.model-option.blue{--option-color:#2563eb}.model-option.amber{--option-color:#d97706}.model-option.rose{--option-color:#be185d}
.model-option input { opacity:0; position:absolute; }.model-check { align-items:center; border:1px solid #cbd5df; border-radius:5px; color:transparent; display:flex; flex:0 0 auto; height:19px; justify-content:center; width:19px; }.model-option:has(input:checked) .model-check { background:var(--option-color,#0f766e); border-color:var(--option-color,#0f766e); color:white; }
.model-option-body { min-width:0; }.model-option-body strong,.model-option-body small { display:block; }.model-option-body strong { color:#192536; font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.model-option-body small { color:#81909e; font-size:9px; line-height:1.25; margin-top:4px; }.model-score { margin-left:auto; text-align:right; }.model-score small,.model-score strong{display:block}.model-score small{color:#96a2ad;font-size:8px}.model-score strong{color:var(--option-color,#0f766e);font-size:13px}
.lab-input-grid { display:grid; gap:12px; grid-template-columns:1.15fr .85fr; }.source-switch { background:#eef2f5; border-radius:8px; display:grid; gap:3px; grid-template-columns:1fr 1fr; margin-bottom:14px; padding:3px; }.source-switch button { background:transparent; border:0; color:#667382; min-height:34px; }.source-switch button.is-active { background:white; box-shadow:0 1px 4px rgba(20,35,50,.1); color:#152235; }
.lab-text-label { color:#7b8998; font-size:10px; letter-spacing:.12em; margin-bottom:6px; text-transform:uppercase; }.model-lab textarea { border-color:#dce3ea; font:13px/1.65 "SFMono-Regular",Consolas,monospace; min-height:220px; }.text-meta { align-items:center; color:#8b98a5; display:flex; font-size:10px; justify-content:space-between; margin-top:6px; }
.truth-card { background:#f6f9fb; }.truth-card.has-truth { background:white; }.decision-pill { border-radius:999px; font-size:10px; font-weight:900; letter-spacing:.08em; padding:7px 11px; }.decision-pill.dlp { background:#fff0ed; color:#bd351e; }.decision-pill.normal { background:#e9f9f3; color:#08785f; }.decision-pill.neutral { background:#e9edf1; color:#75818d; }
.highlight-document { background:#f7f9fb; border:1px solid #e0e6ec; border-radius:9px; color:#28364a; font:12px/2 "SFMono-Regular",Consolas,monospace; max-height:250px; min-height:145px; overflow:auto; padding:15px; white-space:pre-wrap; word-break:break-word; }.highlight-document.empty { align-items:center; color:#98a4af; display:flex; font-family:inherit; justify-content:center; text-align:center; }.finding-mark { background:color-mix(in srgb,var(--mark-color) 16%,white); border-bottom:2px solid var(--mark-color); border-radius:3px 3px 0 0; color:inherit; padding:2px 1px; position:relative; }.finding-mark em { background:var(--mark-color); border-radius:3px; color:white; display:inline-block; font:700 7px/1.4 system-ui; margin-left:3px; padding:1px 3px; vertical-align:middle; }.finding-mark.fp { background:#fff0ed; border-color:#dc4c38; }.finding-mark.fp em { background:#dc4c38; }.finding-mark.tp { background:#e6f8f1; border-color:#12936f; }.finding-mark.tp em { background:#12936f; }
.finding-chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:11px; }.finding-chip { align-items:center; background:white; border:1px solid #dfe5ea; border-left:3px solid var(--chip-color); border-radius:6px; display:flex; font-size:9px; gap:6px; padding:7px 8px; }.finding-chip strong { color:var(--chip-color); }.finding-chip q { color:#39485a; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.finding-chip small,.no-findings { color:#8d99a5; font-size:9px; }
.dataset-controls { display:grid; gap:6px; grid-template-columns:1fr .45fr .5fr; }.dataset-controls input,.dataset-controls select { font-size:11px; margin:0; min-height:36px; padding:7px; }.case-list { border:1px solid #dce3ea; border-radius:8px; height:258px; margin-top:8px; overflow:auto; }.case-item { align-items:center; background:white; border:0; border-bottom:1px solid #edf0f3; border-radius:0; color:#29374a; display:grid; gap:8px; grid-template-columns:28px 1fr 23px; min-height:62px; padding:8px 10px; text-align:left; width:100%; }.case-item:hover,.case-item.is-selected { background:#f0faf7; }.case-language { color:#788694; font:800 8px monospace; }.case-copy { min-width:0; }.case-copy strong,.case-copy small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.case-copy strong { font-size:10px; }.case-copy small { color:#99a4ad; font:8px monospace; margin-top:4px; }.case-count { align-items:center; background:#e9edf1; border-radius:50%; color:#65717c; display:flex; font-size:9px; height:22px; justify-content:center; }.case-count.positive { background:#ffebe7; color:#c63f28; }.case-pagination { align-items:center; display:flex; gap:10px; justify-content:center; margin-top:8px; }.case-pagination button { background:white; border-color:#d7dfe6; color:#536170; font-size:10px; min-height:29px; }.case-pagination span { color:#778491; font-size:9px; }.lab-skeleton,.case-empty { color:#8b98a4; font-size:11px; padding:28px; text-align:center; }
.lab-runbar { align-items:center; background:var(--lab-navy); border-radius:11px; color:white; display:flex; justify-content:space-between; margin:12px 0; padding:14px 18px; position:sticky; top:8px; z-index:10; }.lab-runbar>div strong,.lab-runbar>div span { display:block; }.lab-runbar>div strong { font-size:12px; }.lab-runbar>div span { color:#8295a5; font-size:9px; margin-top:3px; }.lab-run-button { align-items:center; background:var(--lab-mint); border-color:var(--lab-mint); color:#10261f; display:flex; gap:13px; min-width:165px; }.lab-run-button:hover { background:#64e8c1; border-color:#64e8c1; }.lab-run-button small { background:rgba(0,0,0,.09); border-radius:4px; font-size:8px; padding:3px 5px; }.run-spinner,.large-spinner { animation:labSpin .8s linear infinite; border:2px solid rgba(16,38,31,.22); border-top-color:#10261f; border-radius:50%; display:block; height:15px; width:15px; }@keyframes labSpin{to{transform:rotate(360deg)}}
.lab-results { scroll-margin-top:85px; }.results-overview { align-items:center; background:linear-gradient(135deg,#132034,#1d3444); border-radius:12px 12px 0 0; color:white; display:flex; justify-content:space-between; padding:22px 26px; }.results-overview h2 { font-size:21px; }.overview-stats { display:flex; gap:7px; }.overview-stats span { background:rgba(255,255,255,.07); border-radius:7px; min-width:82px; padding:8px 11px; }.overview-stats small,.overview-stats strong { display:block; }.overview-stats small { color:#8fa2b1; font-size:8px; }.overview-stats strong { font-size:16px; margin-top:3px; }
.result-tabs { background:#f1f4f7; display:flex; gap:4px; overflow:auto; padding:8px; }.result-tab { background:transparent; border:0; color:#697785; display:flex; font-size:10px; gap:6px; min-height:36px; white-space:nowrap; }.result-tab.is-active { background:white; box-shadow:0 1px 4px rgba(20,35,50,.12); color:#182638; }.result-tab strong,.result-tab em { background:#e8edf1; border-radius:8px; font-size:8px; font-style:normal; padding:2px 5px; }.result-dot { background:#8794a0; border-radius:50%; height:6px; width:6px; }.result-dot.dlp { background:#e0543d; }.result-dot.normal { background:#18a27b; }.result-dot.error { background:#d32f2f; }
.result-panel { background:white; border:1px solid #dce3ea; border-radius:0 0 12px 12px; display:none; padding:23px; }.result-panel.is-active { display:block; }.model-index { background:#edf1f5; color:#657383; }.result-metrics { display:grid; gap:7px; grid-template-columns:repeat(5,1fr); margin-bottom:17px; }.result-metrics>div { background:#f5f8fa; border-radius:8px; padding:10px 12px; }.result-metrics small,.result-metrics strong { display:block; }.result-metrics small { color:#8794a0; font-size:8px; }.result-metrics strong { font-size:16px; margin-top:3px; }.metric-tp strong{color:#078462}.metric-fp strong{color:#d14b35}.metric-fn strong{color:#d97706}
.result-content-grid { align-items:start; display:grid; gap:12px; grid-template-columns:1.1fr .9fr; }.result-content-grid>section { min-width:0; }.result-subhead { align-items:center; display:flex; justify-content:space-between; margin-bottom:7px; min-height:28px; }.result-subhead h4 { font-size:11px; margin:0; }.result-subhead>span { color:#8a96a2; font-size:8px; }.result-document,.raw-output-section pre { box-sizing:border-box; height:252px; max-height:252px; min-height:252px; overflow:auto; }.raw-output-section pre { border-radius:9px; font-size:10px; margin:0; padding:14px; }.running-state { align-items:center; background:white; border:1px solid #dce3ea; border-radius:0 0 12px 12px; display:flex; flex-direction:column; min-height:260px; justify-content:center; }.large-spinner { border-color:#dce4ea; border-top-color:#0f766e; height:28px; margin-bottom:13px; width:28px; }.running-state strong { font-size:13px; }.running-state p { font-size:10px; }.result-error { background:#fff3f1; border:1px solid #ffc9c1; border-radius:8px; color:#a33221; padding:18px; }.result-error p { color:#b64c3b; font-size:11px; }

@media (max-width:900px){.model-picker{grid-template-columns:repeat(2,1fr)}.lab-input-grid,.result-content-grid{grid-template-columns:1fr}.lab-hero{align-items:flex-start;flex-direction:column;gap:18px}.lab-hero-status{width:100%}.result-metrics{grid-template-columns:repeat(3,1fr)}}
@media (max-width:600px){.model-picker{grid-template-columns:1fr}.lab-hero{padding:22px}.lab-hero h2{font-size:23px}.lab-runbar,.results-overview{align-items:stretch;flex-direction:column;gap:12px}.lab-run-button{justify-content:center;width:100%}.overview-stats{overflow:auto}.dataset-controls{grid-template-columns:1fr 1fr}.dataset-controls input{grid-column:1/-1}.result-metrics{grid-template-columns:repeat(2,1fr)}}

/* Batch pipeline */
.batch-stage {
  --batch-ink: #13201e;
  --batch-subtle: #f7faf9;
}

.batch-toolbar {
  align-items: flex-end;
  background:
    radial-gradient(circle at 87% -20%, rgba(15, 118, 110, 0.16), transparent 35%),
    linear-gradient(135deg, #fff 0%, #f8fbfa 100%);
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 24px;
}

.batch-toolbar h2 {
  color: var(--batch-ink);
  font-size: 25px;
  letter-spacing: -0.03em;
  margin-top: 4px;
}

.batch-toolbar p {
  font-size: 13px;
}

.eyebrow,
.section-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.batch-toolbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.batch-toolbar-actions button,
.composer-footer button {
  white-space: nowrap;
}

.button-secondary,
.icon-button,
.text-button {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.button-secondary:hover,
.icon-button:hover,
.text-button:hover {
  background: var(--surface-muted);
  border-color: #b9c4ce;
  color: var(--text);
}

.auto-refresh {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  gap: 7px;
  margin: 0 4px 0 0;
  padding: 8px 11px;
}

.auto-refresh input {
  accent-color: var(--accent);
  margin: 0;
  width: auto;
}

.batch-health-strip {
  align-items: center;
  background: #10211e;
  color: #d8e9e5;
  display: flex;
  font-size: 11px;
  gap: 8px;
  padding: 8px 24px;
}

.batch-health-strip strong {
  font-size: 11px;
}

.batch-health-strip > span:last-child {
  color: #91aaa4;
  margin-left: auto;
}

.health-indicator {
  background: #94a3b8;
  border-radius: 50%;
  display: inline-block;
  height: 7px;
  width: 7px;
}

.health-indicator.is-online {
  animation: healthPulse 2s infinite;
  background: #34d399;
}

.health-indicator.is-offline {
  background: #fb7185;
}

@keyframes healthPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
  50% { box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.13); }
}

.batch-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, 1fr);
  margin: 12px 0;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  min-height: 116px;
  overflow: hidden;
  padding: 15px 17px;
  position: relative;
}

.stat-card::before {
  background: var(--stat-color);
  content: "";
  height: 3px;
  inset: 0 0 auto;
  position: absolute;
}

.stat-card span,
.stat-card small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
}

.stat-card strong {
  color: var(--batch-ink);
  display: block;
  font-size: 29px;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 12px 0 9px;
}

.stat-pending { --stat-color: #94a3b8; }
.stat-processing { --stat-color: var(--blue); }
.stat-completed { --stat-color: var(--accent); }
.stat-retry { --stat-color: #f59e0b; }
.stat-failed { --stat-color: #dc2626; }

.batch-composer,
.batch-list-card,
.batch-detail-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.batch-composer {
  margin-bottom: 12px;
  max-height: 900px;
  overflow: hidden;
  padding: 20px;
  transition: max-height 220ms ease, opacity 180ms ease, padding 220ms ease, border-width 220ms ease;
}

.batch-composer.is-collapsed {
  border-width: 0;
  margin: 0;
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
  padding-top: 0;
}

.batch-section-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.batch-section-head h3,
.detail-header h3,
.detail-empty h3 {
  font-size: 16px;
  margin: 3px 0 0;
}

.icon-button {
  border-radius: 50%;
  font-size: 21px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.composer-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1.4fr 0.7fr 1fr;
}

.import-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 2fr) minmax(140px, 0.6fr) minmax(120px, 0.4fr);
}

.import-options {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  margin-top: 14px;
}

.import-options label {
  align-items: center;
  display: inline-flex;
  flex-direction: row;
  gap: 8px;
}

.import-options input {
  width: auto;
}

.import-preview {
  background: #f5faf9;
  border: 1px solid #cfe4df;
  border-radius: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
  padding: 14px;
}

.import-preview div {
  display: flex;
  flex-direction: column;
}

.import-preview strong {
  color: var(--ink);
  font-size: 20px;
}

.import-preview span,
.import-preview small {
  color: var(--muted);
  font-size: 11px;
}

.import-preview p,
.import-preview small {
  grid-column: 1 / -1;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-preview .import-warning {
  color: #b45309;
}

.composer-actions {
  display: flex;
  gap: 8px;
}

.model-settings-summary {
  align-items: center;
  background: #f5faf9;
  border: 1px solid #cfe4df;
  border-radius: 10px;
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.model-settings-summary > span {
  background: #d9f6e8;
  border-radius: 999px;
  color: #087b61;
  font-size: 10px;
  font-weight: 800;
  padding: 5px 8px;
  white-space: nowrap;
}

.model-settings-summary p {
  color: var(--muted);
  flex: 1;
  font-size: 12px;
  margin: 0;
}

.model-settings-summary code {
  color: #315c55;
  font-size: 11px;
}

.model-settings-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.model-config-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
  padding: 16px;
}

.model-config-card.is-loading,
.model-config-error {
  grid-column: 1 / -1;
}

.model-config-card.is-loading p,
.model-config-error p {
  color: var(--muted);
  margin: 0;
}

.model-config-head {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.model-config-head span:first-child {
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.model-config-head h4 {
  font-size: 16px;
  margin: 4px 0 0;
}

.model-enabled {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  padding: 6px 9px;
  white-space: nowrap;
}

.model-enabled.is-enabled {
  background: #d9f6e8;
  color: #087b61;
}

.model-enabled.is-disabled {
  background: #edf0f4;
  color: #697386;
}

.model-config-meta {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
  margin: 14px 0;
  padding: 12px 0;
}

.model-config-meta div {
  display: grid;
  gap: 8px;
  grid-template-columns: 82px minmax(0, 1fr);
}

.model-config-meta dt {
  color: var(--muted);
  font-size: 11px;
}

.model-config-meta dd {
  font-size: 11px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-viewer summary {
  color: var(--teal);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.prompt-viewer pre {
  background: #101e1b;
  border-radius: 9px;
  color: #d7eee8;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  margin: 12px 0 0;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.batch-composer textarea {
  min-height: 100px;
}

.batch-composer .metadata-input {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  min-height: 68px;
}

.composer-footer {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.composer-footer span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.batch-workspace {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.18fr) minmax(380px, 0.82fr);
}

.batch-list-card,
.batch-detail-card {
  min-height: 580px;
}

.batch-list-card {
  overflow: hidden;
}

.batch-list-card .batch-section-head {
  padding: 18px 20px 0;
}

.list-head {
  align-items: flex-end;
  gap: 8px;
}

.list-head > div:first-child {
  flex: 0 0 auto;
}

.list-head .section-kicker {
  font-size: 8px;
  letter-spacing: 0.09em;
}

.list-head h3 {
  font-size: 14px;
}

.recent-job-count {
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  margin-left: 3px;
  white-space: nowrap;
}

.batch-filters {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  min-width: 0;
}

.requeue-list-button {
  font-size: 10px;
  padding-left: 8px;
  padding-right: 8px;
  white-space: nowrap;
}

.batch-filters select,
.batch-filters input {
  font-size: 11px;
  margin: 0;
  min-width: 0;
  padding: 7px;
  width: 96px;
}

#batchActualLabelFilter {
  width: 92px;
}

#batchSearch {
  flex: 1 1 128px;
  min-width: 112px;
  width: 128px;
}

.batch-table-wrap {
  max-height: 535px;
  overflow: auto;
}

.batch-table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}

.batch-table th {
  background: #f8fafb;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  position: sticky;
  text-align: left;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

.batch-table td {
  border-bottom: 1px solid #edf0f2;
  color: #334155;
  padding: 12px 14px;
}

.batch-table tbody tr {
  cursor: pointer;
  transition: background 120ms ease;
}

.batch-table tbody tr:hover,
.batch-table tbody tr.is-selected {
  background: #f0f8f6;
}

.batch-table tbody tr.is-selected {
  box-shadow: inset 3px 0 var(--accent);
}

.batch-table td strong,
.batch-table td small {
  display: block;
}

.batch-table td strong {
  color: var(--batch-ink);
  font-size: 12px;
  margin-bottom: 3px;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-table td small {
  color: #8a97a6;
  font-size: 10px;
}

.actual-label {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  color: #4338ca;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  max-width: 150px;
  overflow: hidden;
  padding: 4px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actual-label.is-missing {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.detail-actual-label {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 7px;
  margin: 7px 0 4px;
}

.table-empty {
  color: var(--muted) !important;
  cursor: default;
  padding: 50px 20px !important;
  text-align: center;
}

.status-pill,
.decision-mini,
.tier-decision,
.decision-badge {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 5px 8px;
  white-space: nowrap;
}

.status-pill {
  background: #f1f5f9;
  color: #475569;
  gap: 5px;
}

.status-pill i {
  background: currentColor;
  border-radius: 50%;
  height: 5px;
  width: 5px;
}

.status-processing { background: #eff6ff; color: #2563eb; }
.status-completed { background: #ecfdf5; color: #047857; }
.status-retry { background: #fffbeb; color: #b45309; }
.status-failed { background: #fef2f2; color: #b91c1c; }

.decision-pass,
.decision-safe_pass { background: #dcfce7; color: #166534; }
.decision-block,
.decision-clear_block { background: #fee2e2; color: #991b1b; }
.decision-review,
.decision-uncertain { background: #fef3c7; color: #92400e; }
.decision-waiting,
.decision-pending,
.decision-processing,
.decision-skipped,
.decision-— { background: #f1f5f9; color: #64748b; }

.batch-detail-card {
  min-width: 0;
  padding: 20px;
}

.detail-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  min-height: 520px;
  justify-content: center;
  padding: 30px;
  text-align: center;
}

.detail-empty p {
  font-size: 12px;
  line-height: 1.55;
  max-width: 280px;
}

.empty-orbit {
  align-items: center;
  border: 1px dashed #9fbab4;
  border-radius: 50%;
  display: flex;
  height: 76px;
  justify-content: center;
  margin-bottom: 18px;
  position: relative;
  width: 76px;
}

.empty-orbit::after {
  background: var(--accent);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #b8cec9;
  content: "";
  height: 11px;
  left: 2px;
  position: absolute;
  top: 9px;
  width: 11px;
}

.empty-orbit span {
  color: var(--accent);
  font-size: 25px;
  font-weight: 800;
}

.detail-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding-bottom: 14px;
}

.detail-actions {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-actions button {
  font-size: 10px;
  min-height: 30px;
  padding: 6px 10px;
}

.detail-header h3 {
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-header p {
  font-size: 10px;
  line-height: 1.5;
  max-width: 330px;
  overflow-wrap: anywhere;
}

.decision-badge {
  font-size: 11px;
  padding: 7px 11px;
}

.document-preview {
  background: #f8faf9;
  border: 1px solid #dce9e6;
  border-radius: 7px;
  margin-top: 14px;
  padding: 10px 12px;
}

.preview-head {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 10px;
  font-weight: 700;
  justify-content: space-between;
}

.text-button {
  border: 0;
  font-size: 10px;
  min-height: auto;
  padding: 3px 5px;
}

.document-preview pre {
  background: transparent;
  border: 0;
  color: #334155;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  margin: 9px 0 0;
  max-height: 220px;
  overflow: auto;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.tier-flow {
  margin-top: 17px;
}

.tier-card {
  display: grid;
  grid-template-columns: 32px 1fr;
  min-height: 88px;
}

.tier-card.is-skipped {
  opacity: 0.58;
}

.tier-rail {
  align-items: center;
  display: flex;
  flex-direction: column;
}

.tier-rail span {
  align-items: center;
  background: #e6f4f1;
  border: 1px solid #a7cbc3;
  border-radius: 50%;
  color: var(--accent);
  display: flex;
  flex: 0 0 25px;
  font-size: 10px;
  font-weight: 800;
  height: 25px;
  justify-content: center;
  width: 25px;
}

.tier-rail i {
  background: #d8e4e1;
  flex: 1;
  margin: 4px 0;
  width: 1px;
}

.tier-card-body {
  border-bottom: 1px solid #edf0f2;
  margin-bottom: 10px;
  padding: 1px 0 12px 3px;
  min-width: 0;
}

.tier-title-row {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.tier-title-row strong,
.tier-title-row small {
  display: block;
}

.tier-title-row strong {
  color: var(--batch-ink);
  font-size: 12px;
}

.tier-title-row small {
  color: #93a0ae;
  font-size: 9px;
  margin-top: 2px;
}

.tier-card-body > p {
  color: var(--muted);
  font-size: 10px;
  margin: 5px 0 0;
}

.score-row {
  color: var(--muted);
  display: flex;
  font-size: 9px;
  justify-content: space-between;
  margin-top: 8px;
}

.score-row strong {
  color: #334155;
}

.score-track {
  background: #e9eef2;
  border-radius: 99px;
  height: 5px;
  margin-top: 4px;
  overflow: visible;
  position: relative;
}

.score-fill {
  background: linear-gradient(90deg, #2dd4bf, #f59e0b, #ef4444);
  border-radius: inherit;
  display: block;
  height: 100%;
}

.score-threshold {
  background: #17202a;
  height: 9px;
  position: absolute;
  top: -2px;
  width: 1px;
}

.evidence-list,
.tier-confidence {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}

.evidence-list span,
.tier-confidence span {
  background: #f1f5f4;
  border: 1px solid #e0e8e6;
  border-radius: 4px;
  color: #52635f;
  font-size: 8px;
  max-width: 100%;
  overflow: hidden;
  padding: 3px 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.final-verdict {
  background: #f8faf9;
  border-left: 3px solid #94a3b8;
  border-radius: 0 7px 7px 0;
  margin-top: 6px;
  padding: 13px 14px;
}

.final-verdict span,
.final-verdict strong,
.final-verdict small {
  display: block;
}

.final-verdict span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.final-verdict strong {
  font-size: 19px;
  margin-top: 4px;
}

.final-verdict p {
  color: #52606d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  margin-top: 5px;
}

.final-verdict small {
  color: #8b98a7;
  font-size: 9px;
  margin-top: 6px;
}

.verdict-pass { border-left-color: #16a34a; }
.verdict-block { border-left-color: #dc2626; }
.verdict-review { border-left-color: #d97706; }

.raw-details {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 12px;
}

.raw-details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.raw-details pre {
  border-radius: 6px;
  font-size: 10px;
  margin: 10px 0 0;
  max-height: 320px;
  padding: 12px;
}

.batch-toast {
  background: #13201e;
  border: 1px solid #31504a;
  border-radius: 7px;
  bottom: 24px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.22);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  left: 50%;
  max-width: min(420px, calc(100% - 32px));
  opacity: 0;
  padding: 11px 15px;
  position: fixed;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 20;
}

.batch-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.batch-toast.toast-error {
  background: #7f1d1d;
  border-color: #b91c1c;
}

@media (max-width: 860px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .api-config,
  .grid {
    grid-template-columns: 1fr;
  }

  .batch-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-toolbar-actions {
    justify-content: flex-start;
  }

  .batch-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .batch-workspace {
    grid-template-columns: 1fr;
  }

  .composer-grid {
    grid-template-columns: 1fr;
  }

  .import-grid {
    grid-template-columns: 1fr;
  }

  .model-settings-grid {
    grid-template-columns: 1fr;
  }

  .batch-detail-card {
    min-height: 400px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .batch-toolbar {
    padding: 18px;
  }

  .batch-toolbar-actions > button {
    flex: 1 1 44%;
  }

  .auto-refresh {
    width: 100%;
  }

  .batch-stats {
    gap: 7px;
  }

  .stat-card {
    min-height: 99px;
    padding: 13px;
  }

  .stat-card strong {
    font-size: 24px;
  }

  .list-head {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-filters {
    width: 100%;
  }

  .batch-filters select,
  .batch-filters input {
    min-width: 0;
    flex: 1 1 calc(50% - 7px);
    width: auto;
  }

  .batch-filters {
    flex-wrap: wrap;
  }

  .batch-filters .requeue-list-button {
    width: 100%;
  }

  .batch-table th:nth-child(5),
  .batch-table td:nth-child(5),
  .batch-table th:nth-child(6),
  .batch-table td:nth-child(6) {
    display: none;
  }

  .composer-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .import-options {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .model-settings-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .model-settings-summary code {
    overflow-wrap: anywhere;
  }

  .composer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
