/* ECM Scouter app: one warm neutral family, one accent (highlighter ochre). */
:root {
  --paper: #F4F2ED;
  --paper-2: #EBE7DE;
  --paper-3: #E2DDD1;
  --card: #FFFFFF;
  --ink: #191712;
  --ink-2: #3D382E;
  --muted: #6B6456;
  --line: #DFD9CB;
  --line-soft: #E9E4D8;
  --mark: #F0CE5E;
  --mark-soft: #FBEDC4;
  --mark-deep: #6B4E06;
  --warn: #A6503C;
  --warn-soft: #F6EAE6;
  --warn-ink: #7A3B2A;
  --ok: #3F6B3A;

  /* Score ramp, muted to ochre, the same in every view */
  --b1: #C9C2B2; --b2: #A79E8A; --b3: #6B6456; --b4: #B8903A; --b5: #6B4E06;

  --sh-1: 0 1px 2px rgba(74,58,22,.07), 0 2px 6px rgba(74,58,22,.05);
  --sh-2: 0 2px 4px rgba(74,58,22,.06), 0 14px 34px rgba(74,58,22,.10);
  --sh-3: 0 6px 12px rgba(74,58,22,.08), 0 30px 70px rgba(74,58,22,.18);

  --r-lg: 16px; --r-md: 10px; --r-sm: 6px;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --spring: cubic-bezier(.34, 1.42, .64, 1);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --gutter: clamp(16px, 3vw, 36px);
  --col: 1280px;
  --top-h: 60px;
  --z-top: 40; --z-sheet: 60; --z-menu: 70; --z-toast: 80;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141310; --paper-2: #1D1B16; --paper-3: #26231C; --card: #211E18;
    --ink: #F5F2EA; --ink-2: #D3CCBC; --muted: #9A9283; --line: #353026; --line-soft: #2B271F;
    --mark: #F0CE5E; --mark-soft: #3A3116; --mark-deep: #F3DC93;
    --warn: #D98A72; --warn-soft: #3A2620; --warn-ink: #F0B9A8; --ok: #9CC48F;
    --b1: #4A453A; --b2: #6E675A; --b3: #A39B8B; --b4: #C9A24A; --b5: #F0CE5E;
    --sh-1: 0 1px 2px rgba(0,0,0,.35); --sh-2: 0 10px 30px rgba(0,0,0,.40); --sh-3: 0 30px 70px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--mark); color: #191712; }
:focus-visible { outline: 2.5px solid var(--mark-deep); outline-offset: 2px; border-radius: var(--r-sm); }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ph { font-size: 1.1em; line-height: 1; vertical-align: -0.12em; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: var(--r-md); text-decoration: none; }
.skip:focus { top: 12px; }
.noscript { padding: 40px; text-align: center; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: var(--z-top); height: var(--top-h);
  background: var(--paper); background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.3); border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: var(--col); margin: 0 auto; height: 100%; padding: 0 var(--gutter); display: flex; align-items: center; gap: 28px; }
.brand { font-weight: 650; font-size: 16px; letter-spacing: -.025em; text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav a {
  padding: 7px 12px; border-radius: var(--r-sm); text-decoration: none; color: var(--muted);
  font-weight: 500; font-size: 14px; white-space: nowrap; transition: color .2s, background-color .2s;
}
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--paper-2); box-shadow: inset 0 -2px 0 var(--mark); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.run-pill {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px 5px 10px; font-size: 13px; box-shadow: var(--sh-1);
  transition: transform .3s var(--spring), box-shadow .3s var(--spring);
}
.run-pill:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.run-pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--b4); animation: pulse 1.6s ease-in-out infinite; }
.run-pill[data-state="stopping"] .run-pill-dot { background: var(--warn); }
.run-pill-label { font-weight: 550; }
.run-pill-count { font-size: 12px; color: var(--muted); }
.run-pill-bar { width: 56px; height: 4px; border-radius: 2px; background: var(--paper-3); overflow: hidden; }
.run-pill-bar i { display: block; height: 100%; width: 0; background: var(--b4); transition: width .6s var(--ease); }
@keyframes pulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }

.seg { display: inline-flex; background: var(--paper-2); border-radius: var(--r-sm); padding: 2px; }
.seg button {
  border: 0; background: transparent; padding: 4px 9px; border-radius: 4px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--muted); transition: background-color .2s, color .2s;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--sh-1); }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 0; background: transparent; cursor: pointer; color: var(--ink-2); font-size: 18px;
  transition: background-color .2s, transform .3s var(--spring);
}
.icon-btn:hover { background: var(--paper-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-menu); min-width: 220px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-3);
  padding: 6px; display: grid;
}
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 8px; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 8px 10px; border-radius: var(--r-sm); text-decoration: none; font-size: 14px;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--paper-2); }
.menu-who { margin: 4px 10px 8px; font-size: 12.5px; color: var(--muted); }

/* ── Page frame ──────────────────────────────────────────────────────── */
main { position: relative; z-index: 2; outline: none; }
.page { max-width: var(--col); margin: 0 auto; padding: 28px var(--gutter) 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: clamp(24px, 2.6vw, 32px); font-weight: 650; letter-spacing: -.03em; line-height: 1.1; margin: 0; }
.page-head .lede { margin: 6px 0 0; color: var(--muted); max-width: 70ch; text-wrap: pretty; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view-enter { animation: enter .42s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Buttons and fields ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  border: 1px solid transparent; border-radius: var(--r-md); padding: 8px 14px; cursor: pointer;
  font-size: 14px; font-weight: 550; letter-spacing: -.01em; text-decoration: none; background: transparent;
  transition: transform .3s var(--spring), box-shadow .3s var(--spring), background-color .2s, border-color .2s, color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.975); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-solid { background: var(--ink); color: var(--paper); box-shadow: var(--sh-1); }
.btn-solid:hover { box-shadow: var(--sh-2); }
.btn-line { background: var(--card); border-color: var(--line); box-shadow: var(--sh-1); }
.btn-line:hover { border-color: var(--ink-2); }
.btn-quiet { color: var(--ink-2); }
.btn-quiet:hover { background: var(--paper-2); }
.btn-danger { background: var(--warn); color: #fff; }
.btn-danger-line { border-color: var(--warn); color: var(--warn-ink); background: var(--card); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: var(--r-sm); }
.btn .count { font-family: var(--mono); font-size: 11.5px; background: var(--mark); color: #191712; border-radius: 4px; padding: 0 5px; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; text-wrap: pretty; }
.input, .select, .textarea {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 8px 11px; font-size: 14px; transition: border-color .2s, box-shadow .3s var(--spring);
}
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mark) 45%, transparent); }
.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.textarea { font-family: var(--mono); font-size: 13px; line-height: 1.55; resize: vertical; min-height: 220px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--paper-3); position: relative; cursor: pointer; transition: background-color .2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); box-shadow: var(--sh-1); transition: transform .3s var(--spring); }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(14px); }
.choice-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--card); font-size: 13.5px; cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
.choice input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.choice input:focus-visible + span { outline: 2.5px solid var(--mark-deep); outline-offset: 2px; }
.choice small { font-size: 11.5px; opacity: .7; }

/* ── Stats line ──────────────────────────────────────────────────────── */
.stats { display: flex; flex-wrap: wrap; gap: 10px 34px; margin: 0 0 18px; }
.stats div { display: grid; gap: 1px; }
.stats dt { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stats dd { margin: 0; font-family: var(--mono); font-size: 22px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats dd.hi { color: var(--mark-deep); }
.stats dd.bad { color: var(--warn); }

/* ── Toolbar, search, filters ────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search { position: relative; flex: 1 1 320px; min-width: 0; }
.search .ph { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 36px; padding-right: 40px; height: 40px; }
.search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--muted); background: var(--paper);
}
.toolbar .select { width: auto; height: 40px; }

.filters {
  margin-top: 10px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  animation: enter .3s var(--ease) both;
}
.filters .wide { grid-column: 1 / -1; }
.filters-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: var(--r-sm);
  background: var(--mark-soft); color: var(--ink); font-size: 12.5px; border: 0;
}
.chip button { border: 0; background: transparent; cursor: pointer; border-radius: 4px; padding: 2px 4px; color: var(--ink-2); display: grid; place-items: center; }
.chip button:hover { background: color-mix(in srgb, var(--mark) 50%, transparent); }

/* ── Threshold strip: the distribution is the filter ─────────────────── */
.strip { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px 8px; box-shadow: var(--sh-1); }
.strip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.strip-head p { margin: 0; font-size: 12.5px; color: var(--muted); }
.strip-head b { font-family: var(--mono); font-size: 15px; font-weight: 550; color: var(--mark-deep); }
.strip-stage { position: relative; height: 54px; cursor: ew-resize; border-radius: var(--r-sm); }
.strip-stage canvas { display: block; width: 100%; height: 100%; }
.strip-stage input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.strip-stage:has(input:focus-visible) { outline: 2.5px solid var(--mark-deep); outline-offset: 4px; }
.strip-axis { display: flex; justify-content: space-between; margin-top: 4px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

/* ── Publication list ────────────────────────────────────────────────── */
.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 22px 0 6px; }
.list-head p { margin: 0; font-size: 13px; color: var(--muted); }
.list { display: grid; gap: 2px; }
.row {
  display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 18px; align-items: center;
  padding: 12px 14px; border-radius: var(--r-md); text-decoration: none; color: inherit;
  transition: background-color .2s, box-shadow .25s;
  content-visibility: auto; contain-intrinsic-size: auto 78px;
}
.row:hover { background: var(--card); box-shadow: var(--sh-1); }
.row[aria-current="true"] { background: var(--card); box-shadow: var(--sh-1), inset 3px 0 0 var(--ink); }
.row.is-top { box-shadow: inset 3px 0 0 var(--mark); }
.row.is-top:hover, .row.is-top[aria-current="true"] { box-shadow: var(--sh-1), inset 3px 0 0 var(--mark); }
.row.is-fresh { animation: fresh 2.4s var(--ease); }
@keyframes fresh { 0% { background: var(--mark-soft); } 100% { background: transparent; } }
.score-cell { display: grid; justify-items: end; gap: 5px; }
.score-cell b { font-family: var(--mono); font-size: 20px; font-weight: 550; letter-spacing: -.03em; line-height: 1; color: var(--ink-2); }
.score-cell i { display: block; height: 2px; border-radius: 2px; width: var(--w, 0%); max-width: 100%; background: var(--ink-2); opacity: .35; }
.row.is-top .score-cell b { color: var(--mark-deep); }
.row.is-top .score-cell i { background: var(--mark-deep); opacity: 1; }
.row.is-error .score-cell b { font-size: 12px; color: var(--warn); }
.row-main { min-width: 0; display: grid; gap: 3px; }
.row-title { font-size: 15px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12.5px; color: var(--muted); }
.row-idea { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { display: grid; justify-items: end; gap: 4px; font-size: 12px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.row-side .ph { font-size: 15px; color: var(--mark-deep); }
.more { display: flex; justify-content: center; padding: 18px; color: var(--muted); font-size: 13px; }

.skel { display: grid; grid-template-columns: 58px 1fr; gap: 18px; padding: 14px; }
.skel i { display: block; height: 11px; border-radius: 4px; background: var(--paper-3); animation: shimmer 1.4s ease-in-out infinite; }
.skel i + i { margin-top: 8px; height: 9px; opacity: .7; }
@keyframes shimmer { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

.empty { text-align: center; padding: 56px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--r-lg); }
.empty h2 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.empty p { color: var(--muted); margin: 8px auto 18px; max-width: 52ch; text-wrap: pretty; }
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--r-md); background: var(--mark-soft); margin-bottom: 14px; font-size: 14px;
}
.banner.warn { background: var(--warn-soft); color: var(--warn-ink); }

/* ── Detail sheet ────────────────────────────────────────────────────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: var(--z-sheet); background: rgba(25, 23, 18, .18); opacity: 0; transition: opacity .3s var(--ease); }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: calc(var(--z-sheet) + 1); width: min(780px, 100vw);
  background: var(--paper); box-shadow: var(--sh-3); display: grid; grid-template-rows: auto 1fr;
  transform: translateX(104%); transition: transform .42s var(--ease); outline: none;
}
.sheet.open { transform: none; }
.sheet-head {
  display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: var(--paper); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(10px);
}
.sheet-pos { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-right: auto; padding-left: 4px; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 22px 28px 60px; }
.d-kicker { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.d-title { font-size: clamp(20px, 2.2vw, 25px); font-weight: 600; line-height: 1.25; letter-spacing: -.022em; margin: 0; text-wrap: balance; }
.d-authors { margin: 12px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.7; }
.role { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 0 5px; border-radius: 4px; background: var(--paper-2); color: var(--muted); margin-left: 4px; vertical-align: 1px; }
.role.corr { background: var(--mark-soft); color: var(--mark-deep); }
.d-aff { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.d-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.scorebox {
  margin-top: 20px; display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center;
  background: var(--card); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--sh-1);
}
.scorebox-big { font-family: var(--mono); font-size: 56px; font-weight: 500; line-height: .9; letter-spacing: -.05em; }
.scorebox-big.hi { color: var(--mark-deep); }
.scorebox-label { font-size: 13px; font-weight: 600; margin: 8px 0 0; }
.scorebox dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px 18px; margin: 0; }
.scorebox dt { font-size: 12px; color: var(--muted); }
.scorebox dd { margin: 2px 0 0; font-family: var(--mono); font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }

.runs { margin-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.runs button {
  display: inline-flex; align-items: baseline; gap: 8px; border: 1px solid var(--line); background: var(--card);
  border-radius: var(--r-sm); padding: 6px 10px; cursor: pointer; font-size: 12.5px; text-align: left;
  transition: border-color .2s, background-color .2s;
}
.runs button b { font-family: var(--mono); font-weight: 550; }
.runs button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }

.sec { margin-top: 26px; }
.sec-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 8px; letter-spacing: -.005em; }
.sec p { margin: 0; line-height: 1.62; text-wrap: pretty; }
.sec .lead { font-size: 17px; font-weight: 500; line-height: 1.5; color: var(--ink); }
.callout { background: var(--mark-soft); border-radius: var(--r-md); padding: 14px 16px; }
.callout.warn { background: var(--warn-soft); }
.callout.warn .sec-title { color: var(--warn-ink); }
.axes { display: grid; gap: 10px; }
.axis { display: grid; grid-template-columns: minmax(0, 1fr) 140px 34px; gap: 14px; align-items: center; font-size: 13.5px; }
.axis-bar { height: 4px; border-radius: 2px; background: transparent; position: relative; }
.axis-bar i { position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 2px; background: var(--ink-2); transition: width .7s var(--ease); }
.axis b { font-family: var(--mono); font-weight: 550; text-align: right; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12.5px; padding: 3px 9px; border-radius: var(--r-sm); background: var(--paper-2); color: var(--ink-2); }
.contact-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.contact-list a { font-weight: 550; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--mark); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
details.fold { border-top: 1px solid var(--line); padding-top: 12px; }
details.fold summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary .ph { transition: transform .25s var(--ease); }
details.fold[open] summary .ph { transform: rotate(90deg); }
details.fold > div { margin-top: 10px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.code {
  font-family: var(--mono); font-size: 12px; line-height: 1.55; background: var(--paper-2); border-radius: var(--r-md);
  padding: 12px 14px; white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; margin: 0;
}
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table tbody tr { cursor: pointer; transition: background-color .15s; }
.table tbody tr:hover { background: var(--paper-2); }
.skel-block i { display: block; height: 10px; border-radius: 4px; background: var(--paper-3); margin-top: 9px; animation: shimmer 1.4s ease-in-out infinite; }

/* ── Panels for runs, settings, backtesting ──────────────────────────── */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 20px 22px; }
.panel + .panel { margin-top: 20px; }
.panel h2 { font-size: 16px; font-weight: 600; letter-spacing: -.012em; margin: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head p { margin: 4px 0 0; }
.stack { display: grid; gap: 16px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.status-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.status-big { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.progress { height: 8px; border-radius: 4px; background: var(--paper-2); overflow: hidden; margin: 14px 0 8px; }
.progress i { display: block; height: 100%; width: var(--p, 0%); background: var(--b4); border-radius: 4px; transition: width .7s var(--ease); }
.progress.indet i { width: 35%; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px 18px; margin: 14px 0 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; }
.log {
  margin-top: 16px; background: #191712; color: #E9E4D8; border-radius: var(--r-md); font-family: var(--mono);
  font-size: 12px; line-height: 1.6; padding: 12px 14px; height: 340px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.log .WARNING { color: #F0CE5E; }
.log .ERROR, .log .CRITICAL { color: #F0A890; }
.log .ts { color: #8C8475; margin-right: 8px; }
.log-empty { color: #8C8475; }
.est { font-size: 13px; color: var(--ink-2); background: var(--paper-2); border-radius: var(--r-md); padding: 10px 12px; margin: 0; }
.est.warn { background: var(--warn-soft); color: var(--warn-ink); }

.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.toc { position: sticky; top: calc(var(--top-h) + 24px); display: grid; gap: 2px; }
.toc a { padding: 6px 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--muted); font-size: 14px; }
.toc a:hover { background: var(--paper-2); color: var(--ink); }
.settings section { scroll-margin-top: calc(var(--top-h) + 20px); }
.status { font-size: 13px; margin: 0; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn-ink); }
.model-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.model-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; border-radius: var(--r-sm); background: var(--paper-2); font-family: var(--mono); font-size: 13px; }
.prompt-list { display: grid; gap: 4px; }
.prompt-list button {
  display: grid; gap: 1px; text-align: left; border: 1px solid transparent; background: transparent; border-radius: var(--r-md);
  padding: 9px 12px; cursor: pointer; transition: background-color .2s, border-color .2s;
}
.prompt-list button:hover { background: var(--paper-2); }
.prompt-list button[aria-current="true"] { background: var(--paper-2); border-color: var(--line); }
.prompt-list b { font-size: 14px; font-weight: 550; }
.prompt-list small { font-size: 12px; color: var(--muted); }
.danger { border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); }
.danger h2 { color: var(--warn-ink); }

.drop {
  display: grid; place-items: center; gap: 6px; padding: 26px; border: 1.5px dashed var(--line); border-radius: var(--r-lg);
  text-align: center; color: var(--muted); cursor: pointer; transition: border-color .2s, background-color .2s;
}
.drop:hover, .drop.over { border-color: var(--mark-deep); background: var(--mark-soft); color: var(--ink); }
.drop .ph { font-size: 26px; }
.files { display: grid; gap: 14px; margin-top: 16px; }
.files h3 { font-size: 13.5px; font-weight: 600; margin: 0 0 4px; }
.files ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.files li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 4px 4px 10px; border-radius: var(--r-sm); font-size: 13px; }
.files li:hover { background: var(--paper-2); }

/* ── Login ───────────────────────────────────────────────────────────── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-3); padding: 32px 30px; }
.login-card h1 { font-size: 24px; font-weight: 650; letter-spacing: -.03em; margin: 0; }
.login-card .lede { color: var(--muted); margin: 6px 0 22px; }
.login-card form { display: grid; gap: 14px; }
.login-card .btn { width: 100%; padding: 10px; margin-top: 4px; }
.login-foot { margin: 18px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.form-error { color: var(--warn-ink); background: var(--warn-soft); border-radius: var(--r-sm); padding: 8px 10px; font-size: 13.5px; margin: 0; }

/* ── Toasts and confirm dialog ───────────────────────────────────────── */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: var(--r-md); box-shadow: var(--sh-3); font-size: 14px; max-width: min(560px, 92vw);
  animation: toast-in .4s var(--spring) both;
}
.toast.warn { background: var(--warn); color: #fff; }
.toast.out { animation: toast-out .25s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
.confirm { border: 0; padding: 0; border-radius: var(--r-lg); box-shadow: var(--sh-3); background: var(--card); color: var(--ink); width: min(440px, 92vw); }
.confirm::backdrop { background: rgba(25, 23, 18, .32); }
.confirm-in { padding: 22px 22px 18px; display: grid; gap: 12px; }
.confirm h2 { font-size: 17px; font-weight: 600; margin: 0; }
.confirm p { margin: 0; color: var(--ink-2); line-height: 1.55; }
.confirm-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr; }
  .toc { position: static; display: flex; flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .topbar-in { gap: 12px; }
  .top-right .seg { display: none; }
  .toolbar .seg { flex-wrap: wrap; }
  .row { grid-template-columns: 46px minmax(0, 1fr); gap: 12px; }
  .row-side { display: none; }
  .sheet-body { padding: 18px 18px 60px; }
  .scorebox { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
  .axis { grid-template-columns: minmax(0, 1fr) 90px 30px; }
  .run-pill-bar, .run-pill-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Journal bonus marker under the score */
.score-cell small.bonus { font-family: var(--mono); font-size: 10.5px; color: var(--mark-deep); line-height: 1; margin-top: -1px; }
.row:not(.is-top) .score-cell small.bonus { color: var(--muted); }

/* Evaluated / waiting switch above the publication list */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin: -2px 0 20px; overflow-x: auto; }
.tabs a {
  padding: 8px 0 11px; margin-bottom: -1px; border-bottom: 2px solid transparent; white-space: nowrap;
  font-size: 14px; font-weight: 550; color: var(--muted); text-decoration: none; transition: color .2s, border-color .2s;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--ink); }
.tabs small { font-family: var(--mono); font-size: 12px; font-weight: 500; margin-left: 5px; opacity: .7; }

/* Waiting publications: a checkbox where evaluated rows show their score */
.qrow .row-main { text-decoration: none; color: inherit; }
.qrow .row-main:focus-visible { outline: 2.5px solid var(--mark-deep); outline-offset: 4px; border-radius: 4px; }
.qrow.is-picked { background: var(--card); box-shadow: var(--sh-1), inset 3px 0 0 var(--ink); }
.qcheck { display: grid; place-items: center; align-self: stretch; cursor: pointer; }
.qcheck input { width: 18px; height: 18px; accent-color: var(--ink); cursor: pointer; }
.selbar {
  position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  margin-top: 14px; padding: 10px 12px 10px 16px; border-radius: var(--r-md);
  background: var(--ink); color: var(--paper); box-shadow: var(--sh-2); font-size: 14px;
}
.selbar b { font-family: var(--mono); font-weight: 600; }
.selbar .grow { flex: 1; min-width: 12ch; }
.selbar .muted-inv { color: color-mix(in srgb, var(--paper) 70%, transparent); font-size: 13px; }
.selbar .btn-quiet { color: var(--paper); }
.btn-mark { background: var(--mark); color: #241B05; box-shadow: var(--sh-1); }
.btn-mark:hover { box-shadow: var(--sh-2); }

/* Wider segmented switch for a choice inside a form */
.seg-wide { display: flex; }
.seg-wide button { flex: 1; padding: 7px 12px; font-size: 13px; }
