/* PITOT — operating surface for a polite catalog extractor
   Design system inspired by NEWCO's weathered industrial badge aesthetic,
   translated for utility: cream paper, ink, machine orange, brass. */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700;9..144,900&family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Paper & ink */
  --paper:      #F1E9D7;   /* cream background */
  --paper-2:    #EADFC6;   /* card / panel */
  --paper-3:    #E2D4B4;   /* deeper panel / table head */
  --ink:        #1A1714;   /* primary text */
  --ink-2:      #3D352B;   /* secondary text */
  --ink-3:      #78695A;   /* muted */
  --rule:       #C7B996;   /* border/rule */
  --rule-2:     #A99467;   /* heavier rule */

  /* Accents */
  --orange:     #C9441F;   /* NEWCO red-orange — primary action */
  --orange-2:   #E35A31;
  --brass:      #8B6A2F;   /* secondary accent, highlights */
  --olive:      #5E6A3A;   /* ok / success */
  --rust:       #8E3A1E;   /* error */
  --smoke:      #5A5147;   /* neutral chip */

  /* Geometry */
  --radius:     2px;
  --radius-lg:  4px;

  /* Shadows — subtle, like pressed ink */
  --press:      inset 0 -1px 0 rgba(26,23,20,0.08);
  --lift:       0 1px 0 rgba(26,23,20,0.06), 0 8px 20px -12px rgba(26,23,20,0.25);

  /* Type */
  --serif: 'Fraunces', 'Times New Roman', serif;
  --sans:  'IBM Plex Sans', -apple-system, system-ui, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Paper grain — very subtle noise */
  background-image:
    radial-gradient(rgba(120,105,90,0.035) 1px, transparent 1px),
    radial-gradient(rgba(120,105,90,0.025) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 2px;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }

/* ---------- Top bar ---------- */
.topbar {
  border-bottom: 1px solid var(--rule-2);
  background: var(--paper);
  position: sticky; top: 0; z-index: 50;
  padding: 14px 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
}
.topbar::after {
  /* double-rule, like a letterpress masthead */
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px;
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: flex; align-items: center; gap: 12px;
}
.brand-mark {
  width: 40px; height: 40px;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 900; font-size: 22px;
  letter-spacing: -0.02em;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3px var(--ink);
}
.brand-word {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.02em;
  line-height: 1;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 3px;
}
.nav {
  display: flex; gap: 2px; align-items: center;
  justify-content: center;
}
.nav a {
  padding: 8px 14px;
  color: var(--ink-2);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  position: relative;
}
.nav a:hover { color: var(--ink); background: rgba(26,23,20,0.04); text-decoration: none; }
.nav a.active {
  color: var(--ink);
  background: rgba(26,23,20,0.06);
}
.nav a.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px;
  border-bottom: 2px solid var(--orange);
}
.topbar-right {
  display: flex; align-items: center; gap: 18px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.topbar-right .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--olive);
  box-shadow: 0 0 0 3px rgba(94,106,58,0.15);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(94,106,58,0.15); }
  50%     { box-shadow: 0 0 0 6px rgba(94,106,58,0.02); }
}

/* ---------- Layout ---------- */
main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

/* ---------- Page head ---------- */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.page-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px;
  border-bottom: 1px solid var(--rule);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow .num { color: var(--orange); font-weight: 600; }
h1.page-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 46px;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
  font-variation-settings: "opsz" 120;
}
.page-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--ink-2);
}
.page-sub {
  font-family: var(--sans);
  color: var(--ink-3);
  font-size: 14px;
  margin-top: 10px;
  max-width: 640px;
}

/* ---------- Card / panel ---------- */
.panel {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  position: relative;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.panel-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
}
.panel-title .count {
  color: var(--ink-3); margin-left: 8px; font-weight: 400;
}

/* ---------- Form ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px 20px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.field label .req { color: var(--orange); }
.field .hint {
  font-size: 12px; color: var(--ink-3); font-family: var(--sans);
  margin-top: 2px;
}
.field input, .field select, .field textarea {
  background: #F8F1DE;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  box-shadow: var(--press);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.field input.mono { font-family: var(--mono); font-size: 13px; }
.field.col-6 { grid-column: span 6; }
.field.col-4 { grid-column: span 4; }
.field.col-3 { grid-column: span 3; }
.field.col-12 { grid-column: span 12; }

.check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #F8F1DE;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
}
.check input { accent-color: var(--orange); }
.check .label { font-weight: 500; }
.check .sub { color: var(--ink-3); font-size: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  padding: 11px 20px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 80ms, background 120ms;
}
.btn:hover { background: #000; transform: translateY(-1px); text-decoration: none; color: var(--paper); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--orange); }
.btn-primary:hover { background: #B03D1B; color: var(--paper); }
.btn-ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-sm { padding: 7px 12px; font-size: 11px; }
.btn-link {
  background: transparent; color: var(--orange);
  padding: 4px 0; text-transform: none; letter-spacing: 0;
  font-weight: 500;
}
.btn-link:hover { background: transparent; color: #B03D1B; text-decoration: underline; }

/* ---------- Status pills (ink-stamp style) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 3px 8px 3px 8px;
  border-radius: 2px;
  border: 1px solid currentColor;
  background: transparent;
}
.chip .bullet {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.chip-running    { color: var(--orange); background: rgba(201,68,31,0.08); }
.chip-running .bullet { animation: pulse-bullet 1.4s infinite; }
@keyframes pulse-bullet { 50% { opacity: 0.35; } }
.chip-discovering{ color: var(--brass); background: rgba(139,106,47,0.08); }
.chip-completed  { color: var(--olive); background: rgba(94,106,58,0.08); }
.chip-done       { color: var(--olive); background: rgba(94,106,58,0.08); }
.chip-failed     { color: var(--rust);  background: rgba(142,58,30,0.08); }
.chip-paused     { color: var(--smoke); background: rgba(90,81,71,0.08); }
.chip-queued     { color: var(--ink-3); background: rgba(120,105,90,0.08); }
.chip-cancelled  { color: var(--ink-3); background: rgba(120,105,90,0.08); }
.chip-pending    { color: var(--ink-3); background: rgba(120,105,90,0.08); }
.chip-skipped    { color: var(--ink-3); background: rgba(120,105,90,0.08); }
.chip-ok         { color: var(--olive); background: rgba(94,106,58,0.08); }

/* ---------- Tables ---------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 13px;
}
table.data thead th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-2);
  background: var(--paper-3);
}
table.data tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
table.data tbody tr:hover { background: rgba(26,23,20,0.025); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .num { font-family: var(--mono); font-size: 12px; }
table.data .truncate {
  max-width: 420px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}

/* ---------- Run detail hero ---------- */
.run-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
.run-id {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.run-id .hash { color: var(--orange); font-weight: 700; }
.run-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 38px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 8px 0 6px;
}
.run-title em { font-style: italic; color: var(--ink-2); font-weight: 400; }
.run-meta {
  display: flex; gap: 22px; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}
.run-meta span b { color: var(--ink-2); font-weight: 600; }

/* ---------- Progress ---------- */
.progress-rail {
  position: relative;
  height: 44px;
  margin: 22px 0 6px;
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.progress-rail .fill {
  position: absolute; inset: 0 auto 0 0;
  background:
    repeating-linear-gradient(
      135deg,
      var(--orange) 0 10px,
      #D0552C 10px 20px
    );
  transition: width 400ms ease;
}
.progress-rail .fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(241,233,215,0.15) 100%);
}
.progress-rail .label {
  position: absolute; inset: 0;
  display: flex; align-items: center; padding: 0 16px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--paper);
  mix-blend-mode: difference;
  text-transform: uppercase;
  font-weight: 600;
  z-index: 2;
}
.progress-ticks {
  display: flex; justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.12em;
  margin-top: 4px;
}

.counts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
}
.counts .cell {
  padding: 16px 18px;
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 4px;
}
.counts .cell:last-child { border-right: none; }
.counts .k {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3);
}
.counts .v {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
}
.counts .cell.accent .v { color: var(--orange); }
.counts .cell.fail  .v { color: var(--rust); }
.counts .cell.ok    .v { color: var(--olive); }

/* ---------- Workers ---------- */
.workers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.worker {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  min-height: 108px;
}
.worker .top {
  display: flex; justify-content: space-between; align-items: center;
}
.worker .wid {
  font-weight: 600; color: var(--ink);
  letter-spacing: 0.04em;
}
.worker .url {
  color: var(--ink-2);
  word-break: break-all;
  line-height: 1.35;
  font-size: 11.5px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.worker .kind {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3);
}
.worker.idle { opacity: 0.55; }

/* ---------- Event stream ---------- */
.events {
  background: #1A1714;
  color: #E8DFC6;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  max-height: 360px;
  overflow: auto;
  padding: 12px 14px;
}
.events .event {
  display: grid;
  grid-template-columns: 76px 90px 100px 1fr;
  gap: 12px;
  padding: 3px 0;
  align-items: baseline;
}
.events.events-wide { max-height: 520px; }
.events.events-wide .event {
  grid-template-columns: 90px 90px 110px 1fr;
  padding: 4px 0;
  font-size: 12.5px;
}
.events .event .ts   { color: #8B7F66; }
.events .event .wid  { color: #C9AD6F; }
.events .event .st   { color: #E35A31; }
.events .event .st.done  { color: #A3B46E; }
.events .event .st.queued{ color: #8B7F66; }
.events .event .st.failed{ color: #E06A4A; }
.events .event .msg  { color: #E8DFC6; opacity: 0.85; word-break: break-all; }

/* ---------- Profiles accordion ---------- */
.profile-row {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
  margin-bottom: 10px;
  overflow: hidden;
}
.profile-row summary {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}
.profile-row summary > span:empty { display: none; }
.profile-row summary::-webkit-details-marker { display: none; }
.profile-row summary::before {
  content: "+";
  font-family: var(--mono);
  font-size: 16px;
  color: var(--orange);
  font-weight: 600;
  width: 16px;
  transition: transform 120ms;
}
.profile-row[open] summary::before { content: "−"; }
.profile-row .pid {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.profile-row .pname {
  font-family: var(--sans);
  color: var(--ink-3);
  font-size: 13px;
  margin-left: 10px;
}
.profile-row .tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  padding: 3px 8px;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
}
.profile-row .path {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.profile-body {
  padding: 0 18px 18px 52px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  border-top: 1px solid var(--rule);
  padding-top: 18px;
}
.profile-body h4 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px;
  font-weight: 600;
}
.profile-body pre {
  background: #1A1714; color: #E8DFC6;
  padding: 14px;
  border-radius: var(--radius);
  overflow: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  max-height: 340px;
  margin: 0;
}
.strategy-list {
  display: flex; flex-direction: column; gap: 8px;
}
.strategy {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #F8F1DE;
  font-family: var(--mono);
  font-size: 12px;
}
.strategy .slot {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.strategy .kind { color: var(--ink); font-weight: 500; }

/* ---------- Products (extracted catalog) ---------- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.product {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 210px;
  cursor: pointer;
  transition: transform 120ms, box-shadow 120ms;
}
.product:hover {
  transform: translateY(-2px);
  box-shadow: var(--lift);
}
.product .sku {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.product .title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.product .specs {
  display: flex; flex-wrap: wrap; gap: 4px 6px;
  margin-top: auto;
}
.product .spec {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 3px 7px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: var(--paper);
}
.product .foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.product .foot .docs { color: var(--orange); font-weight: 600; }

/* ---------- Tab strip (for multi-view single page) ---------- */
.view { display: none; }
.view.active { display: block; }

/* ---------- Toolbar / Filters ---------- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.toolbar .group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: #F8F1DE;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 8px 12px;
  min-width: 320px;
}
.search input {
  background: transparent; border: 0; outline: none; flex: 1;
  font: inherit; font-size: 13px; color: var(--ink);
  font-family: var(--sans);
}
.search input::placeholder { color: var(--ink-3); }
.search .kbd {
  font-family: var(--mono);
  font-size: 10px;
  border: 1px solid var(--rule-2);
  padding: 1px 6px;
  border-radius: 2px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}

/* ---------- Side-by-side (main + side) ---------- */
.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .counts  { grid-template-columns: repeat(3, 1fr); }
  .workers-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Stat tile (for dashboard hero metrics) ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
}
.stat .k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.stat .v {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1;
  margin-top: 10px;
  font-variation-settings: "opsz" 120;
}
.stat .v em { font-style: italic; font-weight: 400; color: var(--ink-2); font-size: 28px; }
.stat .sub {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 8px;
}
.stat .badge {
  position: absolute; top: 18px; right: 18px;
}

/* ---------- Tweaks panel ---------- */
.tweaks-panel {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 100;
  width: 280px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px -20px rgba(26,23,20,0.35);
  font-family: var(--sans);
  font-size: 13px;
  overflow: hidden;
  display: none;
}
.tweaks-panel.open { display: block; }
.tweaks-head {
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
}
.tweaks-body {
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.tweak { display: flex; flex-direction: column; gap: 6px; }
.tweak label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
}
.seg {
  display: flex; border: 1px solid var(--rule-2); border-radius: var(--radius); overflow: hidden;
}
.seg button {
  flex: 1; background: transparent; border: 0; padding: 7px 10px;
  font: inherit; font-size: 12px; cursor: pointer; color: var(--ink-2);
  font-family: var(--mono); letter-spacing: 0.06em;
  border-right: 1px solid var(--rule-2);
  text-transform: none;
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: var(--paper); }

/* ---------- Footer plate ---------- */
.plate {
  margin-top: 40px;
  padding: 16px 0;
  border-top: 1px solid var(--rule-2);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.plate .seal {
  padding: 4px 10px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  color: var(--ink-2);
}

/* ---------- Theme: minimal (toggleable) ---------- */
body.theme-min {
  --paper: #FAFAF7;
  --paper-2: #FFFFFF;
  --paper-3: #F2F0EA;
  --rule: #E5E2D8;
  --rule-2: #D5D1C3;
  background-image: none;
}
body.theme-min .events { background: #1F1D1A; }

/* ---------- Density: compact ---------- */
body.density-compact main { padding-top: 20px; }
body.density-compact .panel { padding: 16px 18px; margin-bottom: 14px; }
body.density-compact .stat { padding: 14px 16px; }
body.density-compact .stat .v { font-size: 34px; margin-top: 6px; }
body.density-compact table.data tbody td { padding: 10px 12px; }
body.density-compact .run-title { font-size: 30px; }
body.density-compact h1.page-title { font-size: 36px; }

/* ---------- Scrollbar polish ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 10px; border: 2px solid var(--paper); }
.events::-webkit-scrollbar-thumb { background: #4A4337; border-color: #1A1714; }
