/* Predictions — a web version of the annual forecasting spreadsheet. */

:root {
  --pred-bg: #FBFBFD;
  --pred-surface: #FFFFFF;
  --pred-text: #16161D;
  --pred-muted: #6B6C7B;
  --pred-border: #E3E4ED;
  --pred-accent: #4C4FD6;
  --pred-accent-soft: #EEEEFB;
  /* The one chart colour that isn't the accent. Indigo → green clears the colour-blind separation
     bar (ΔE 21.6 deutan, 8.6 tritan against white), which is why the second series is this and not
     a lighter indigo. Anything added after it needs the same check, not a guess. */
  --pred-series-2: #1F8A70;
  --pred-yes: #1F8A70;
  --pred-yes-soft: #E6F4F0;
  --pred-no: #C2413A;
  --pred-no-soft: #FBEAE9;
  --pred-void: #85868F;
  --pred-void-soft: #F0F0F3;
  --pred-shadow: 0 1px 3px rgba(20, 20, 40, 0.07);
  --pred-font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--pred-font);
  background: var(--pred-bg);
  color: var(--pred-text);
  line-height: 1.5;
}

/* ---------- Shell ---------- */

.pred-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.pred-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--pred-border);
  background: var(--pred-surface);
  position: sticky;
  top: 0;
  z-index: 5;
}

.pred-brand {
  font-weight: 650;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--pred-text);
}

.pred-header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.pred-header-link {
  font-size: 0.88rem;
  color: var(--pred-muted);
  text-decoration: none;
}

.pred-header-link:hover {
  color: var(--pred-accent);
}

/* ---------- About page ---------- */

.pred-prose {
  max-width: 68ch;
}

.pred-prose h1 {
  margin: 0 0 18px;
  font-size: 1.85rem;
  letter-spacing: -0.02em;
}

.pred-prose h2 {
  margin: 30px 0 8px;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.pred-prose p,
.pred-prose li {
  color: var(--pred-muted);
}

.pred-prose p {
  margin: 0 0 12px;
}

.pred-prose ul {
  margin: 0 0 12px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pred-prose strong {
  color: var(--pred-text);
  font-weight: 600;
}

.pred-prose a {
  color: var(--pred-accent);
}

.pred-prose-back {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--pred-border);
}

.pred-lede a {
  color: var(--pred-accent);
}

.pred-main {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 24px 72px;
}

/* ---------- Page furniture ---------- */

.pred-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.pred-page-head h1 {
  margin: 0 0 4px;
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pred-lede {
  margin: 6px 0 0;
  color: var(--pred-muted);
  max-width: 60ch;
}

.pred-breadcrumb {
  margin: 0 0 12px;
  font-size: 0.88rem;
}

.pred-breadcrumb a,
.pred-gate a {
  color: var(--pred-accent);
  text-decoration: none;
}

.pred-breadcrumb a:hover,
.pred-gate a:hover {
  text-decoration: underline;
}

.pred-muted {
  color: var(--pred-muted);
}

.pred-loading,
.pred-empty {
  color: var(--pred-muted);
  padding: 32px 0;
}

.pred-error {
  color: var(--pred-no);
  background: var(--pred-no-soft);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
  font-size: 0.9rem;
}

.pred-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 9px;
}

.pred-badge-private {
  background: var(--pred-accent-soft);
  color: var(--pred-accent);
}

/* ---------- Buttons ---------- */

.pred-btn {
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--pred-border);
  background: var(--pred-surface);
  color: var(--pred-text);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.pred-btn:hover {
  border-color: var(--pred-accent);
  color: var(--pred-accent);
}

.pred-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pred-btn-primary {
  background: var(--pred-accent);
  border-color: var(--pred-accent);
  color: #fff;
}

.pred-btn-primary:hover {
  color: #fff;
  filter: brightness(1.08);
}

.pred-btn-quiet {
  background: transparent;
  color: var(--pred-muted);
}

.pred-btn-danger {
  color: var(--pred-no);
  border-color: var(--pred-no-soft);
}

.pred-btn-danger:hover {
  border-color: var(--pred-no);
  color: var(--pred-no);
}

.pred-btn-small {
  padding: 5px 10px;
  font-size: 0.82rem;
}

.pred-icon-btn {
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  border: none;
  background: transparent;
  color: var(--pred-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.pred-icon-btn:hover {
  background: var(--pred-accent-soft);
  color: var(--pred-accent);
}

.pred-icon-danger:hover {
  background: var(--pred-no-soft);
  color: var(--pred-no);
}

/* ---------- Unlock ---------- */

.pred-unlock {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--pred-surface);
  border: 1px solid var(--pred-border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 22px;
  font-size: 0.9rem;
}

.pred-unlock label {
  color: var(--pred-muted);
}

.pred-unlock input,
.pred-gate input,
.pred-category-add input,
.pred-category-edit input,
.pred-search,
.pred-filters select {
  font: inherit;
  font-size: 0.9rem;
  padding: 7px 10px;
  border: 1px solid var(--pred-border);
  border-radius: 8px;
  background: var(--pred-surface);
  color: var(--pred-text);
}

.pred-unlock input:focus,
.pred-gate input:focus,
.pred-search:focus,
.pred-inline-input:focus,
.pred-form input:focus,
.pred-form textarea:focus,
.pred-form select:focus {
  outline: 2px solid var(--pred-accent);
  outline-offset: -1px;
}

.pred-unlock-status {
  color: var(--pred-yes);
  font-weight: 550;
}

.pred-gate {
  text-align: center;
  padding: 56px 0;
}

.pred-gate h1 {
  margin: 0 0 8px;
}

.pred-gate p {
  color: var(--pred-muted);
}

.pred-gate form {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
  flex-wrap: wrap;
}

.pred-admin-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Set list ---------- */

.pred-card-dates {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--pred-muted);
}

/* The table is wider than a phone; it scrolls in its own box rather than the page. */
.pred-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--pred-border);
  border-radius: 12px;
  background: var(--pred-surface);
  box-shadow: var(--pred-shadow);
}

.pred-set-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.pred-set-table th {
  padding: 0;
  border-bottom: 1px solid var(--pred-border);
  background: var(--pred-surface);
  position: sticky;
  top: 0;
}

.pred-set-table th button {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pred-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 12px 14px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pred-set-table th.is-right button {
  justify-content: flex-end;
}

.pred-set-table th button:hover {
  color: var(--pred-accent);
}

.pred-set-table th.is-sorted button {
  color: var(--pred-text);
}

.pred-sort-caret {
  font-size: 0.6rem;
  color: var(--pred-accent);
}

.pred-set-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--pred-border);
  vertical-align: top;
}

.pred-set-table tbody tr:last-child td {
  border-bottom: none;
}

.pred-set-table tbody tr:hover {
  background: var(--pred-accent-soft);
}

.pred-row-link {
  cursor: pointer;
}

/* The row is clickable, so the name underlines on row hover rather than only its own. */
.pred-row-link:hover .pred-set-link {
  color: var(--pred-accent);
  text-decoration: underline;
}

/* Keyboard focus lands on the name link; show it against the whole row. */
.pred-set-link:focus-visible {
  outline: 2px solid var(--pred-accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.pred-set-table .is-left {
  text-align: left;
}

.pred-set-table .is-right {
  text-align: right;
}

.pred-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.pred-nowrap {
  white-space: nowrap;
  color: var(--pred-muted);
}

.pred-set-link {
  font-weight: 600;
  color: var(--pred-text);
  text-decoration: none;
  margin-right: 8px;
  white-space: nowrap;
}

.pred-set-link:hover {
  color: var(--pred-accent);
  text-decoration: underline;
}

.pred-set-desc {
  margin-top: 3px;
  font-size: 0.8rem;
  color: var(--pred-muted);
  max-width: 42ch;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Stats ---------- */

.pred-stats {
  margin: 0 0 28px;
}

.pred-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.pred-stat {
  background: var(--pred-surface);
  border: 1px solid var(--pred-border);
  border-radius: 10px;
  padding: 14px;
}

.pred-stat-value {
  font-size: 1.5rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.pred-stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pred-muted);
  margin-top: 2px;
}

.pred-stat-hint {
  font-size: 0.76rem;
  color: var(--pred-muted);
  margin-top: 5px;
  min-height: 1.15rem;
  white-space: pre-line;
}

/* ---------- Charts ---------- */

.pred-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.pred-chart-stub-text {
  fill: var(--pred-muted);
  font-family: var(--pred-font);
  font-size: 12px;
}

.pred-chart-stub .pred-chart-title,
.pred-chart-stub .pred-chart-note {
  opacity: 0.75;
}

.pred-chart {
  margin: 0;
  background: var(--pred-surface);
  border: 1px solid var(--pred-border);
  border-radius: 12px;
  padding: 16px;
  position: relative; /* the tooltip is positioned against the figure */
}

/* Replaces SVG's own <title>, which appears after about a second and in the OS's styling rather
   than the page's. Sits above the cursor, follows it, and never eats its own pointer events.
   Width is set by its content — the rows can't wrap, so there is nothing to wrap against. */
.pred-chart-tip {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -100%);
  pointer-events: none;
  width: max-content;
  max-width: 240px;
  padding: 8px 10px;
  border: 1px solid var(--pred-border);
  border-radius: 8px;
  background: var(--pred-surface);
  box-shadow: 0 4px 14px rgba(20, 20, 40, 0.13);
  font-size: 0.74rem;
  line-height: 1.4;
}

.pred-chart-tip.is-below {
  transform: translate(-50%, 0);
}

/* The one line that can be arbitrarily long is the set name, so it clips rather than wrapping the
   card into a paragraph. */
.pred-chart-tip-head {
  font-weight: 650;
  color: var(--pred-text);
  max-width: 220px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pred-chart-tip-rows {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 16px;
  margin: 0;
}

.pred-chart-tip-rows dt {
  color: var(--pred-muted);
  white-space: nowrap;
}

.pred-chart-tip-rows dd {
  margin: 0;
  text-align: right;
  color: var(--pred-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pred-chart-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.pred-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.pred-chart-empty p {
  color: var(--pred-muted);
  font-size: 0.88rem;
  margin: 8px 0 0;
}

/* Two lines are reserved so a stub and the real chart it becomes are exactly the same height. */
.pred-chart-note {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--pred-muted);
  min-height: 2.4rem;
}

.pred-chart-grid {
  stroke: var(--pred-border);
  stroke-width: 1;
}

.pred-chart-tick,
.pred-chart-axis {
  fill: var(--pred-muted);
  font-size: 11px;
  font-family: var(--pred-font);
}

.pred-chart-axis {
  font-size: 11px;
  font-weight: 550;
}

.pred-chart-reference {
  fill: none;
  stroke: var(--pred-muted);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  opacity: 0.75;
}

.pred-chart-line {
  fill: none;
  stroke: var(--pred-accent);
  stroke-width: 2;
  stroke-linejoin: round;
}

.pred-chart-point {
  fill: var(--pred-accent);
  fill-opacity: 0.85;
  stroke: var(--pred-surface);
  stroke-width: 1.5;
}

.pred-chart-bar {
  fill: var(--pred-accent);
  fill-opacity: 0.82;
}

/* The second series. Only two charts have one, and both pair it with a legend and a direct label
   so the colour is never the only thing telling them apart. */
.pred-chart-line.is-secondary {
  stroke: var(--pred-series-2);
}

.pred-chart-point.is-secondary {
  fill: var(--pred-series-2);
}

.pred-chart-point.is-reference {
  fill: var(--pred-muted);
  fill-opacity: 0.7;
}

/* A per-bar reference tick — the baseline that bar has to beat. */
.pred-chart-marker {
  stroke: var(--pred-text);
  stroke-width: 2;
  opacity: 0.55;
}

/* The band between two lines, when the distance between them is the subject. */
.pred-chart-gap {
  fill: var(--pred-accent);
  fill-opacity: 0.09;
  stroke: none;
}

/* Direct labels sit in ink, never in the series colour — the mark beside them carries identity. */
.pred-chart-value {
  fill: var(--pred-text);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--pred-font);
  font-variant-numeric: tabular-nums;
}

.pred-chart-value.is-secondary {
  fill: var(--pred-muted);
}

.pred-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0 0 8px;
  font-size: 0.76rem;
  color: var(--pred-muted);
}

.pred-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pred-legend-swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--pred-accent);
}

.pred-legend-swatch.is-secondary {
  background: var(--pred-series-2);
}

.pred-legend-swatch.is-reference {
  background: repeating-linear-gradient(
    to right,
    var(--pred-muted) 0 5px,
    transparent 5px 9px
  );
}

.pred-legend-swatch.is-marker {
  width: 3px;
  height: 12px;
  background: var(--pred-text);
  opacity: 0.55;
}

.pred-legend-note {
  margin-left: auto;
  font-style: italic;
}

/* ---------- Cross-set panel ---------- */

.pred-cross {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--pred-border);
}

/* A filter change refetches; the charts it already drew stay put and just recede while it lands. */
.pred-cross.is-refreshing .pred-stat-row,
.pred-cross.is-refreshing .pred-charts {
  opacity: 0.55;
  transition: opacity 120ms ease-out;
}

.pred-cross-head h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.pred-cross-head .pred-lede {
  margin: 0 0 16px;
}

.pred-cat-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.pred-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--pred-border);
  border-radius: 999px;
  background: var(--pred-surface);
  color: var(--pred-text);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
}

.pred-chip:hover {
  border-color: var(--pred-accent);
}

.pred-chip.is-on {
  background: var(--pred-accent-soft);
  border-color: var(--pred-accent);
  color: var(--pred-accent);
  font-weight: 550;
}

.pred-chip-count {
  font-size: 0.74rem;
  color: var(--pred-muted);
  font-variant-numeric: tabular-nums;
}

.pred-chip.is-on .pred-chip-count {
  color: var(--pred-accent);
  opacity: 0.75;
}

/* ---------- Notes ---------- */

.pred-notes {
  background: var(--pred-surface);
  border: 1px solid var(--pred-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

.pred-notes h2 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.pred-notes p {
  margin: 0;
  white-space: pre-wrap;
  color: var(--pred-muted);
  font-size: 0.9rem;
}

/* ---------- Filters ---------- */

.pred-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.pred-search {
  flex: 1 1 200px;
  min-width: 0;
}

.pred-segmented {
  display: inline-flex;
  border: 1px solid var(--pred-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--pred-surface);
}

.pred-segmented button {
  font: inherit;
  font-size: 0.82rem;
  border: none;
  background: transparent;
  color: var(--pred-muted);
  padding: 7px 11px;
  cursor: pointer;
  border-right: 1px solid var(--pred-border);
}

.pred-segmented button:last-child {
  border-right: none;
}

.pred-segmented button.is-active {
  background: var(--pred-accent-soft);
  color: var(--pred-accent);
  font-weight: 600;
}

.pred-category-add {
  margin-bottom: 14px;
}

.pred-category-add form,
.pred-category-edit {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Prediction table ---------- */

.pred-category {
  margin-bottom: 26px;
}

.pred-category-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--pred-border);
  margin-bottom: 4px;
}

.pred-category-head h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.pred-category-count {
  font-size: 0.75rem;
  color: var(--pred-muted);
  background: var(--pred-void-soft);
  border-radius: 999px;
  padding: 1px 8px;
}

.pred-category-actions {
  margin-left: auto;
}

.pred-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pred-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 128px;
  align-items: center;
  gap: 10px;
  padding: 3px 4px;
  border-bottom: 1px solid var(--pred-border);
  font-size: 0.9rem;
  line-height: 1.35;
}

.pred-row.is-admin {
  grid-template-columns: 18px minmax(0, 1fr) 150px 128px 28px;
  gap: 8px;
  padding: 2px 4px;
}

.pred-row.is-busy {
  opacity: 0.5;
}

.pred-row-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

/* ---------- Drag to reorder ---------- */

.pred-drag-handle {
  color: var(--pred-border);
  cursor: grab;
  font-size: 0.85rem;
  line-height: 1;
  text-align: center;
  user-select: none;
}

.pred-row:hover .pred-drag-handle {
  color: var(--pred-muted);
}

.pred-drag-handle:active {
  cursor: grabbing;
}

.pred-drag-handle.is-disabled {
  cursor: default;
  opacity: 0.35;
}

.pred-row.is-dragging {
  opacity: 0.4;
}

.pred-row.is-drop-target {
  box-shadow: inset 0 2px 0 -1px var(--pred-accent);
  background: var(--pred-accent-soft);
}

/* ---------- Probability slider ---------- */

.pred-prob-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pred-prob-slider {
  flex: 1 1 auto;
  min-width: 0;
  height: 16px;
  margin: 0;
  accent-color: var(--pred-accent);
  cursor: pointer;
}

.pred-prob-slider.is-unset {
  opacity: 0.35;
}

.pred-prob-readout {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: none;
  background: transparent;
  color: var(--pred-text);
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 4px;
  min-width: 38px;
  text-align: right;
}

.pred-prob-readout:hover {
  background: var(--pred-no-soft);
  color: var(--pred-no);
}

.pred-prob-readout.is-unset {
  color: var(--pred-muted);
  font-weight: 400;
}

.pred-prob-readout.is-unset:hover {
  background: transparent;
  color: var(--pred-muted);
  cursor: default;
}

.pred-row-note {
  font-size: 0.78rem;
  color: var(--pred-muted);
  white-space: pre-wrap;
}

.pred-row-resolution-note {
  font-style: italic;
}

.pred-row-source {
  font-size: 0.76rem;
  color: var(--pred-accent);
  text-decoration: none;
  align-self: flex-start;
}

.pred-row-prob {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  font-size: 0.95rem;
}

.pred-row-result {
  display: flex;
  justify-content: flex-end;
}

.pred-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1px;
}

/* A subtle left edge marking which way each graded forecast fell. */
.pred-row.is-right {
  box-shadow: inset 3px 0 0 -1px var(--pred-yes);
}

.pred-row.is-wrong {
  box-shadow: inset 3px 0 0 -1px var(--pred-no);
}

.pred-chip {
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.pred-chip-yes {
  background: var(--pred-yes-soft);
  color: var(--pred-yes);
}

.pred-chip-no {
  background: var(--pred-no-soft);
  color: var(--pred-no);
}

.pred-chip-void {
  background: var(--pred-void-soft);
  color: var(--pred-void);
}

.pred-chip-pending {
  background: var(--pred-void-soft);
  color: var(--pred-muted);
}

/* ---------- Inline editing ---------- */

.pred-inline-input {
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 2px 5px;
  background: transparent;
  color: inherit;
  width: 100%;
}

.pred-inline-input:hover {
  border-color: var(--pred-border);
}

textarea.pred-inline-note {
  font-family: var(--pred-font);
  resize: vertical;
}

.pred-inline-note {
  font-size: 0.78rem;
  color: var(--pred-muted);
}

/* Collapsed to nothing until the row is hovered, so ~90 "+ note" affordances don't add ~90 lines
   of height to the table. */
.pred-add-note {
  font: inherit;
  font-size: 0.7rem;
  align-self: flex-start;
  border: none;
  background: transparent;
  color: transparent;
  cursor: pointer;
  padding: 0 5px;
  border-radius: 5px;
  height: 0;
  overflow: hidden;
}

.pred-row:hover .pred-add-note,
.pred-add-note:focus-visible {
  color: var(--pred-muted);
  height: auto;
}

.pred-add-note:hover {
  background: var(--pred-accent-soft);
  color: var(--pred-accent) !important;
}

.pred-inline-select {
  font: inherit;
  font-size: 0.88rem;
  padding: 4px 6px;
  border: 1px solid var(--pred-border);
  border-radius: 6px;
  background: var(--pred-surface);
  color: inherit;
  width: 100%;
}

.pred-resolution-group {
  display: inline-flex;
  border: 1px solid var(--pred-border);
  border-radius: 7px;
  overflow: hidden;
}

.pred-res-btn {
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  width: 29px;
  padding: 2px 0;
  border: none;
  border-right: 1px solid var(--pred-border);
  background: var(--pred-surface);
  color: var(--pred-muted);
  cursor: pointer;
}

.pred-res-btn:last-child {
  border-right: none;
}

.pred-res-btn:hover {
  background: var(--pred-void-soft);
}

.pred-res-YES.is-active {
  background: var(--pred-yes);
  color: #fff;
}

.pred-res-NO.is-active {
  background: var(--pred-no);
  color: #fff;
}

.pred-res-VOID.is-active {
  background: var(--pred-void);
  color: #fff;
}

.pred-res-none.is-active {
  background: var(--pred-void-soft);
  color: var(--pred-text);
}

.pred-row-add {
  border-bottom: none;
}

.pred-add-form {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.pred-add-form .pred-inline-input {
  border-color: var(--pred-border);
  border-style: dashed;
}

.pred-add-prob {
  width: 66px;
  flex: 0 0 auto;
  text-align: right;
}

/* ---------- Modals & forms ---------- */

.pred-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 40, 0.42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 20;
}

.pred-modal {
  background: var(--pred-surface);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 12px 40px rgba(20, 20, 40, 0.24);
}

.pred-modal.is-wide {
  max-width: 640px;
}

.pred-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--pred-border);
}

.pred-modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.pred-modal-body {
  padding: 18px;
}

.pred-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pred-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.88rem;
}

.pred-form label > span {
  font-weight: 550;
}

.pred-form input,
.pred-form textarea,
.pred-form select {
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 10px;
  border: 1px solid var(--pred-border);
  border-radius: 8px;
  background: var(--pred-surface);
  color: var(--pred-text);
  width: 100%;
}

.pred-form textarea {
  resize: vertical;
  font-family: var(--pred-font);
}

.pred-form small {
  color: var(--pred-muted);
  font-size: 0.76rem;
}

.pred-form-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--pred-muted);
}

.pred-form-hint code {
  background: var(--pred-void-soft);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.82em;
}

.pred-form-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pred-checkbox {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 9px !important;
}

.pred-checkbox input {
  width: auto;
  margin-top: 3px;
}

.pred-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.pred-form-actions-right {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.pred-preview {
  border: 1px solid var(--pred-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--pred-bg);
}

.pred-preview-head {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pred-muted);
  margin-bottom: 6px;
}

.pred-preview ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pred-preview li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.pred-preview-prob {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--pred-accent);
}

.pred-preview p {
  margin: 6px 0 0;
  font-size: 0.8rem;
}

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
  .pred-main {
    padding: 20px 14px 56px;
  }

  .pred-page-head h1 {
    font-size: 1.5rem;
  }

  .pred-set-table th button,
  .pred-set-table td {
    padding: 10px;
  }

  .pred-set-desc {
    display: none;
  }

  /* Stack each prediction: claim on its own line, odds and outcome beneath it. */
  .pred-row,
  .pred-row.is-admin {
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
    padding: 12px 4px;
  }

  .pred-row-text {
    grid-column: 1 / -1;
  }

  .pred-row-prob {
    text-align: left;
  }

  /* The odds column stretches to 1fr on mobile; the control itself shouldn't. */
  .pred-inline-select {
    max-width: 96px;
  }

  .pred-row-result {
    justify-content: flex-end;
  }

  .pred-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .pred-filters {
    gap: 8px;
  }

  .pred-segmented {
    width: 100%;
    overflow-x: auto;
  }

  .pred-segmented button {
    flex: 1 0 auto;
  }

  .pred-form-pair {
    grid-template-columns: 1fr;
  }

  .pred-charts {
    grid-template-columns: 1fr;
  }
}
