:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #6d7483;
  --line: #dfe3ea;
  --soft: #f4f6f9;
  --paper: #ffffff;
  --accent: #3857d6;
  --accent-dark: #263eab;
  --accent-soft: #edf0ff;
  --good: #147a55;
  --warn: #a15c08;
  --bad: #b13636;
  --shadow: 0 14px 40px rgba(29, 41, 74, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: #f7f8fb; color: var(--ink); }
button, input, textarea, select { font: inherit; }
a { color: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 68px; padding: 10px max(24px, calc((100vw - 1320px) / 2));
  background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand { display: flex; gap: 11px; align-items: center; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent); color: white; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.quiet-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.quiet-link:hover { color: var(--ink); }

.shell { width: min(1320px, calc(100% - 40px)); margin: 34px auto 70px; }
.page-head { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.page-head h1 { margin: 0 0 7px; font-size: clamp(27px, 3vw, 42px); letter-spacing: -.035em; }
.page-head p { margin: 0; color: var(--muted); max-width: 760px; line-height: 1.55; }
.eyebrow { margin-bottom: 8px; color: var(--accent); font-weight: 700; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; }

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); align-items: start; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.card-body { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-body h2, .card-body h3 { margin: 0; }

.field { margin-bottom: 19px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label, .label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; }
.hint { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.4; }
input[type="text"], input[type="url"], input[type="number"], input[type="search"], textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid #cbd1dc; border-radius: 10px; background: white; color: var(--ink); outline: 0;
}
textarea { min-height: 148px; line-height: 1.5; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,87,214,.11); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--soft); border-radius: 12px; }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 10px; border-radius: 9px; text-align: center; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: white; color: var(--ink); box-shadow: 0 2px 10px rgba(20,30,55,.09); }

.action-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.action-option { margin: 0; }
.action-option input { position: absolute; opacity: 0; pointer-events: none; }
.action-option span { display: flex; min-height: 74px; padding: 10px; flex-direction: column; justify-content: center; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.action-option strong, .action-option small { display: block; }
.action-option small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.3; font-weight: 400; }
.action-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(56,87,214,.08); }

.model-list { display: grid; gap: 9px; }
.model-option { display: flex; align-items: flex-start; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.model-option:hover { border-color: #aab5e8; background: #fafbff; }
.model-option input { margin-top: 3px; accent-color: var(--accent); }
.model-option strong, .model-option small { display: block; }
.model-option small { margin-top: 2px; color: var(--muted); overflow-wrap: anywhere; }
.model-picker { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fafbfc; }
.model-picker-head, .model-bulk { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.model-picker-head .label { margin-bottom: 2px; }
.model-filters { display: grid; grid-template-columns: minmax(190px, 1.6fr) repeat(4, minmax(120px, .8fr)); gap: 8px; margin: 12px 0 9px; }
.model-filters input, .model-filters select { min-height: 38px; padding: 8px 9px; font-size: 12px; }
.model-bulk { justify-content: flex-start; flex-wrap: wrap; margin-bottom: 9px; }
.model-bulk .hint { margin: 0 0 0 auto; text-align: right; }
.button.compact { min-height: 34px; padding: 0 11px; font-size: 12px; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 7px; max-height: 510px; overflow: auto; padding: 2px; }
.model-card { display: flex; gap: 8px; min-width: 0; margin: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; }
.model-card:hover { border-color: #aab5e8; }
.model-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.model-card.disabled { opacity: .55; cursor: not-allowed; }
.model-card input { flex: 0 0 auto; margin: 3px 0 0; accent-color: var(--accent); }
.model-card-content { min-width: 0; }
.model-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.model-title strong { min-width: 0; font-size: 12px; line-height: 1.25; }
.provider-badge { flex: 0 0 auto; padding: 2px 5px; border-radius: 5px; background: var(--soft); color: var(--muted); font-size: 9px; font-weight: 700; }
.model-id { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.25; overflow-wrap: anywhere; }
.model-meta { display: flex; flex-wrap: wrap; gap: 3px 7px; margin-top: 6px; color: #4f5869; font-size: 9px; line-height: 1.25; }
.model-empty { grid-column: 1 / -1; }

.file-drop { position: relative; padding: 24px; border: 1.5px dashed #aeb6c6; border-radius: 13px; background: var(--soft); text-align: center; }
.file-drop input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.file-drop strong, .file-drop span { display: block; }
.file-drop span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.dataset-summary { margin-top: 12px; padding: 11px 13px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); font-size: 13px; }
.dataset-preview { max-height: 330px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
.preview-row { display: grid; grid-template-columns: 42px 1fr; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.42; }
.preview-row:last-child { border-bottom: 0; }
.preview-index { color: var(--muted); font-variant-numeric: tabular-nums; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; text-decoration: none; font-weight: 700; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { background: white; border-color: var(--line); color: var(--ink); }
.button.secondary:hover { background: var(--soft); }
.button.danger { color: var(--bad); }
.button:disabled { opacity: .5; cursor: wait; }
.button.full { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.callout { padding: 13px 15px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-dark); line-height: 1.45; font-size: 13px; }
.callout.good { background: #eaf8f2; color: var(--good); }
.callout.warn { background: #fff5e8; color: var(--warn); }
.callout.bad { background: #fff0f0; color: var(--bad); }
.hidden { display: none !important; }

.run-list { display: grid; gap: 12px; }
.run-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 17px 18px; border: 1px solid var(--line); border-radius: 14px; background: white; text-decoration: none; }
.run-row:hover { border-color: #aeb8e6; transform: translateY(-1px); }
.run-row strong { display: block; margin-bottom: 5px; }
.meta { display: flex; flex-wrap: wrap; gap: 7px 15px; color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--soft); white-space: nowrap; }
.status.completed { background: #eaf8f2; color: var(--good); }
.status.failed, .status.completed_with_errors { background: #fff0f0; color: var(--bad); }
.status.running, .status.queued { background: var(--accent-soft); color: var(--accent); }

.progress { height: 10px; overflow: hidden; background: var(--soft); border-radius: 999px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .35s ease; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.metric strong { display: block; margin-bottom: 5px; font-size: 24px; }
.metric span { color: var(--muted); font-size: 12px; }
.metadata { display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; margin: 0; }
.metadata dt { color: var(--muted); }
.metadata dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

.share-box { display: flex; gap: 8px; }
.share-box input { flex: 1; }

.blind-shell { width: min(1480px, calc(100% - 32px)); margin: 25px auto 90px; }
.blind-toolbar { position: sticky; top: 80px; z-index: 12; display: grid; grid-template-columns: minmax(180px, 320px) auto auto; gap: 10px; align-items: end; margin-bottom: 18px; padding: 14px; background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.blind-toolbar .field { margin: 0; }
.eval-item { margin-bottom: 18px; overflow: hidden; }
.source-block { padding: 18px 20px; background: #f2f4f8; border-bottom: 1px solid var(--line); }
.source-label, .variant-label { margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.source-text, .variant-text { white-space: pre-wrap; line-height: 1.55; }
.variants { display: grid; grid-template-columns: repeat(var(--variant-count, 2), minmax(250px, 1fr)); }
.variant { display: flex; flex-direction: column; min-height: 220px; padding: 18px 20px; border-right: 1px solid var(--line); }
.variant:last-child { border-right: 0; }
.variant-text { flex: 1; }
.rating { display: flex; gap: 6px; margin-top: 18px; }
.rating button { width: 38px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); cursor: pointer; }
.rating button:hover, .rating button.active { background: var(--accent); border-color: var(--accent); color: white; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; background: white; font-size: 13px; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: var(--soft); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.score { font-weight: 800; font-size: 18px; }
.result-detail { max-width: 480px; white-space: pre-wrap; line-height: 1.4; }

.loading, .empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: 400px; padding: 12px 16px; border-radius: 11px; background: var(--ink); color: white; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .grid.two { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .variants { grid-template-columns: 1fr; }
  .variant { border-right: 0; border-bottom: 1px solid var(--line); }
  .variant:last-child { border-bottom: 0; }
  .action-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .model-filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 650px) {
  .shell { width: min(100% - 22px, 1320px); margin-top: 20px; }
  .topbar { padding-inline: 12px; }
  .brand small, .quiet-link { display: none; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .field-row, .metric-grid { grid-template-columns: 1fr; }
  .blind-toolbar { position: static; grid-template-columns: 1fr; }
  .card-body, .card-head { padding: 17px; }
  .metadata { grid-template-columns: 1fr; gap: 4px; }
  .metadata dd { margin-bottom: 10px; }
  .action-grid { grid-template-columns: 1fr 1fr; }
  .model-filters { grid-template-columns: 1fr; }
  .model-bulk .hint { width: 100%; margin-left: 0; text-align: left; }
}
