/* Biwenger analysis -- app stylesheet. Layered on top of vendored Bootstrap 4.6
   (static/vendor/bootstrap). Dark design system; every colour comes from the
   tokens below. */

:root {
  color-scheme: dark;
  --bg: oklch(0.16 0.012 255);
  --sidebar-bg: oklch(0.135 0.01 255);
  --card-bg: oklch(0.19 0.012 255);
  --card-bg-raised: oklch(0.22 0.014 255);
  --border: oklch(1 0 0 / 0.07);
  --border-strong: oklch(1 0 0 / 0.14);
  --row-border: oklch(1 0 0 / 0.05);
  --text: oklch(0.93 0.006 255);
  --text-muted: oklch(0.7 0.01 255);
  --accent: oklch(0.75 0.15 165);
  --accent-strong: oklch(0.82 0.15 165);
  --accent-bg: oklch(0.75 0.15 165 / 0.14);
  --negative: oklch(0.7 0.19 25);
  --negative-bg: oklch(0.65 0.19 25 / 0.15);
  --warning: oklch(0.8 0.13 80);
  --warning-bg: oklch(0.78 0.13 80 / 0.15);
  --high-competition: oklch(0.74 0.17 45);
  --high-competition-bg: oklch(0.72 0.17 45 / 0.15);
  --info: oklch(0.76 0.11 240);
  --info-bg: oklch(0.7 0.11 240 / 0.15);
  --radius: 12px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, .navbar-brand, th {
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 700;
}

h1 { font-size: 1.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

code { color: var(--warning); background: oklch(1 0 0 / 0.05); padding: 1px 5px; border-radius: 4px; }
pre { color: var(--text-muted); background: oklch(0 0 0 / 0.25); padding: 10px 12px; border-radius: 8px; max-width: 60ch; white-space: pre-wrap; word-break: break-word; }
hr { border-color: var(--border); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--accent);
  color: oklch(0.16 0.012 255);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  z-index: 2000;
}
.skip-link:focus { top: 12px; color: oklch(0.16 0.012 255); }

.text-muted, .app-main p.text-muted { color: var(--text-muted) !important; }

/* ---- App shell ---- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-sidebar .app-name {
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 4px;
}

.app-sidebar .league-name {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.app-sidebar .app-name + .sidebar-nav { margin-top: 24px; }

.sidebar-nav { list-style: none; margin: 0; padding: 0; flex: 1; }
.sidebar-nav li + li { margin-top: 4px; }

.sidebar-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 600;
  font-size: 14px;
}
.sidebar-nav a:hover { color: var(--text); background: oklch(1 0 0 / 0.04); }
.sidebar-nav a.active { background: var(--accent-bg); color: var(--accent); }

.league-switcher select,
.app-sidebar .league-switcher select {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 12px;
}

.sidebar-user {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.sidebar-user .email { word-break: break-all; margin-bottom: 8px; }
.sidebar-user form { display: inline; }
.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.link-button:hover { color: var(--accent-strong); }
.sidebar-user .sep { margin: 0 6px; opacity: 0.5; }

.app-topbar { display: none; }
.sidebar-backdrop { display: none; }

.app-main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 64px;
  max-width: 1280px;
}

/* ---- Mobile / tablet: sidebar becomes an off-canvas drawer ---- */
@media (max-width: 991.98px) {
  .app-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-h);
    padding: 0 16px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
  }
  .app-topbar .app-name {
    font-family: "Manrope", system-ui, sans-serif;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-toggle {
    width: 44px;
    height: 44px;
    margin-left: -10px;
    background: none;
    border: 0;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }
  .nav-toggle:hover { background: oklch(1 0 0 / 0.06); }

  .app-shell { display: block; }
  .app-sidebar {
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }
  body.nav-open .app-sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px oklch(0 0 0 / 0.5);
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: oklch(0 0 0 / 0.55);
  }
  .app-main { padding: 20px 16px 56px; }
  h1 { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Page header ---- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 20px;
}
.page-header h1 { margin: 0; display: flex; align-items: center; gap: 4px; }
.page-header .subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.breadcrumb-link {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 13px;
  text-decoration: none;
  color: var(--text-muted);
}
.breadcrumb-link:hover { color: var(--text); }

/* ---- Cards / panels ---- */
.card, .panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel { padding: 20px; margin-bottom: 20px; }
.panel > h2:first-child, .panel > .panel-title:first-child { margin-top: 0; }
.panel-title {
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}
.stat-card .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}
.stat-card .stat-value {
  font-family: "Manrope", system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-card .stat-note { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-card.stat-accent { background: var(--accent-bg); border-color: transparent; }
.stat-card.stat-accent .stat-value { color: var(--accent); }

/* ---- Tables ---- */
.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}
.table-wrap > table { margin: 0; }

table.table {
  color: var(--text);
  background: transparent;
  margin-bottom: 0;
  border: 0;
}
table.table thead th {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  border-top: none;
  background: transparent;
  font-weight: 700;
  white-space: nowrap;
}
table.table td, table.table th {
  border-top: none;
  border-bottom: 1px solid var(--row-border);
  vertical-align: middle;
  padding: 12px 14px;
}
table.table-sm td, table.table-sm th { padding: 8px 12px; }
table.table tbody tr:last-child td { border-bottom: none; }
table.table-striped tbody tr:nth-of-type(odd) { background: transparent; }
table.table tbody tr:hover { background: oklch(1 0 0 / 0.03); }
table.table tbody tr.table-active,
table.table tbody tr.table-active:hover { background: var(--accent-bg); }
table.table .num { text-align: right; font-variant-numeric: tabular-nums; }
table.table th.num { text-align: right; }

/* Sortable headers (static/js/app.js) */
table.js-sortable th[data-sort] { cursor: pointer; user-select: none; }
table.js-sortable th[data-sort]:hover { color: var(--text); }
table.js-sortable th[data-sort]::after {
  content: "";
  display: inline-block;
  margin-left: 6px;
  border: 4px solid transparent;
  vertical-align: middle;
  opacity: 0;
}
table.js-sortable th[aria-sort="ascending"]::after { border-bottom-color: currentColor; border-top-width: 0; opacity: 1; }
table.js-sortable th[aria-sort="descending"]::after { border-top-color: currentColor; border-bottom-width: 0; opacity: 1; }
table.js-sortable th[aria-sort] { color: var(--accent); }
table.js-sortable th[data-sort]:not([aria-sort]):hover::after { border-top-color: currentColor; border-bottom-width: 0; opacity: 0.4; }

tr.is-clickable { cursor: pointer; }

/* ---- Toolbar (search + filter chips) ---- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar .search-input { flex: 1 1 220px; max-width: 340px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 34px;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent-bg); border-color: transparent; color: var(--accent); }
.result-count { margin-left: auto; font-size: 13px; color: var(--text-muted); }

/* ---- Biwenger images ---- */
.player-photo, .team-badge, .manager-icon {
  width: 32px;
  height: 32px;
  object-fit: cover;
  vertical-align: middle;
  flex: none;
  background: var(--card-bg-raised);
}
.manager-icon { border-radius: 50%; }
.player-photo, .team-badge { border-radius: 8px; }
.team-badge { object-fit: contain; }
h1 .player-photo, h1 .team-badge, h1 .manager-icon { width: 44px; height: 44px; margin-right: 8px; }
.entity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.entity .entity-text { min-width: 0; line-height: 1.25; }
.entity .entity-name { font-weight: 600; }
.entity .entity-name a { color: var(--text); text-decoration: none; }
.entity .entity-name a:hover { color: var(--accent); text-decoration: underline; }
.entity .entity-sub, .sub { font-size: 12px; color: var(--text-muted); }
.sub { display: block; }

/* ---- Money ---- */
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-positive { color: var(--accent); }
.amount-negative { color: var(--negative); }
.amount-zero { color: var(--text-muted); }

.bid-recommended {
  background: var(--accent-bg);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
}

/* Hero recommendation card */
.reco {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  background: linear-gradient(135deg, var(--accent-bg), transparent 70%), var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.reco .reco-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; }
.reco .reco-amount { font-family: "Manrope", system-ui, sans-serif; font-weight: 800; font-size: 2rem; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.reco .reco-amount .amount { color: inherit; }
.reco .reco-note { margin: 6px 0 0; color: var(--text-muted); font-size: 14px; }
.reco dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 14px; }
.reco dt { color: var(--text-muted); font-weight: 400; }
.reco dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.reco.reco-muted { background: var(--card-bg); grid-template-columns: 1fr; }
.reco.reco-muted .reco-amount { color: var(--text-muted); font-size: 1.2rem; }
@media (max-width: 767.98px) {
  .reco { grid-template-columns: 1fr; padding: 18px; }
  .reco .reco-amount { font-size: 1.6rem; }
}

/* Probability bars + bid-range tracks */
.prob { display: flex; align-items: center; gap: 8px; min-width: 96px; }
.prob-track { flex: 1; height: 6px; border-radius: 3px; background: oklch(1 0 0 / 0.08); overflow: hidden; min-width: 40px; }
.prob-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.prob-fill.is-high { background: var(--high-competition); }
.prob-value { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3ch; text-align: right; }

.range { position: relative; height: 8px; background: oklch(1 0 0 / 0.07); border-radius: 4px; min-width: 120px; }
.range-band { position: absolute; top: 0; bottom: 0; background: var(--info-bg); border: 1px solid var(--info); border-radius: 4px; }
.range-median { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--info); }
.range-reco { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--accent); }
.range-legend { font-size: 12px; color: var(--text-muted); display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 10px; }
.range-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.swatch-band { background: var(--info-bg); border: 1px solid var(--info); }
.swatch-reco { background: var(--accent); width: 3px !important; }
.range-caption { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.45; }
.range-caption .amount { font-size: 12px; }

/* ---- Pills / badges ---- */
.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.pill-high, .pill-low-competition { background: var(--accent-bg); color: var(--accent); }
.pill-medium { background: var(--warning-bg); color: var(--warning); }
.pill-low, .pill-high-competition, .pill-veryhigh { background: var(--negative-bg); color: var(--negative); }
.pill-competition-high { background: var(--high-competition-bg); color: var(--high-competition); }
.pill-muted { background: oklch(1 0 0 / 0.07); color: var(--text-muted); }
.pill-info { background: var(--info-bg); color: var(--info); }

.pos { display: inline-block; min-width: 2.4em; text-align: center; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; background: oklch(1 0 0 / 0.07); color: var(--text-muted); }
.pos-gk { background: var(--warning-bg); color: var(--warning); }
.pos-def { background: var(--info-bg); color: var(--info); }
.pos-mid { background: var(--accent-bg); color: var(--accent); }
.pos-fwd { background: var(--negative-bg); color: var(--negative); }

.badge { font-weight: 700; padding: 4px 8px; }
.badge-success { background: var(--accent-bg); color: var(--accent); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--negative-bg); color: var(--negative); }

.closing-soon { color: var(--warning); font-weight: 600; }

/* ---- Alerts ---- */
.alert { border-radius: 10px; border: 1px solid var(--border); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.alert-danger { background: var(--negative-bg); color: var(--negative); border-color: transparent; }
.alert-info, .alert-success { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
.status-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.status-banner.is-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.status-banner.is-danger { background: var(--negative-bg); color: var(--negative); border-color: transparent; }
.status-banner form { margin: 0; }

/* ---- Buttons ---- */
.btn { border-radius: 8px; font-weight: 600; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: oklch(0.16 0.012 255); font-weight: 700; }
.btn-primary:hover, .btn-primary:focus { background: var(--accent-strong); border-color: var(--accent-strong); color: oklch(0.16 0.012 255); }
.btn-primary:disabled, .btn-primary.disabled { background: var(--accent); border-color: var(--accent); color: oklch(0.16 0.012 255); opacity: 0.55; }
.btn-outline-secondary { color: var(--text-muted); border-color: var(--border-strong); }
.btn-outline-secondary:hover { color: var(--text); background: oklch(1 0 0 / 0.06); border-color: var(--text-muted); }
.btn-danger { background: var(--negative); border-color: var(--negative); color: oklch(0.16 0.012 255); }
.btn-lg { padding: 10px 20px; }

.btn.is-loading { position: relative; pointer-events: none; }
.btn .spinner {
  display: none;
  width: 0.9em;
  height: 0.9em;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -1px;
}
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Forms ---- */
.form-control, .custom-select {
  background: oklch(0.14 0.012 255);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}
.form-control:focus, .custom-select:focus {
  background: oklch(0.14 0.012 255);
  color: var(--text);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.form-control::placeholder { color: oklch(0.55 0.01 255); }
.form-control:disabled, .form-control[readonly] { background: oklch(0.2 0.012 255); }
select.form-control option { background: var(--card-bg); color: var(--text); }
textarea.form-control { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.form-group label, label.field-label { font-weight: 600; font-size: 14px; }
.field-help { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.field-help ul { padding-left: 1.2em; margin: 4px 0 0; }
.field-errors { color: var(--negative); font-size: 13px; margin: 4px 0 0; padding: 0; list-style: none; }
.form-control.is-invalid { border-color: var(--negative); }

/* Checkbox list used by league selection */
.choice-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.choice-list li label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  background: var(--card-bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}
.choice-list li label:hover { border-color: var(--border-strong); }
.choice-list input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* ---- Pagination ---- */
.pagination .page-link { background: var(--card-bg); border-color: var(--border); color: var(--accent); }
.pagination .page-item.disabled .page-link { background: var(--card-bg); color: var(--text-muted); opacity: 0.6; }
.pagination .page-link:hover { background: var(--card-bg-raised); }

/* ---- Empty states ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--card-bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.empty-state h2 { font-size: 1.2rem; margin-bottom: 6px; }
.empty-state p { color: var(--text-muted); max-width: 46ch; margin: 0 auto 16px; }
.empty-state .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.inline-empty { color: var(--text-muted); font-size: 14px; margin: 0; }

/* ---- Connections ---- */
.connection-card { margin-bottom: 20px; }
.connection-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.connection-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.membership { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.membership-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.membership-name { font-weight: 700; font-family: "Manrope", system-ui, sans-serif; }
.membership-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.membership-actions form { margin: 0; }
details.sync-history > summary { cursor: pointer; color: var(--text-muted); font-size: 13px; margin-top: 10px; }
details.sync-history > summary:hover { color: var(--text); }
.kv { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ---- Steps (onboarding) ---- */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 8px; display: grid; gap: 10px; }
.steps li { counter-increment: step; position: relative; padding-left: 40px; min-height: 28px; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notice {
  border-left: 3px solid var(--warning);
  background: var(--warning-bg);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 0 10px 10px 0;
  font-size: 14px;
  margin-bottom: 20px;
}
details.disclosure { margin-bottom: 20px; }
details.disclosure > summary { cursor: pointer; font-family: "Manrope", system-ui, sans-serif; font-weight: 700; padding: 4px 0; }

/* ---- Auth pages ---- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-brand { display: block; text-align: center; font-family: "Manrope", system-ui, sans-serif; font-weight: 800; font-size: 22px; color: var(--text); text-decoration: none; margin-bottom: 6px; }
.auth-tagline { text-align: center; color: var(--text-muted); font-size: 14px; margin: 0 0 22px; }
.auth-card .panel { margin-bottom: 16px; padding: 24px; }
.auth-card h1 { font-size: 1.35rem; margin: 0 0 16px; }
.auth-links { text-align: center; font-size: 14px; color: var(--text-muted); }
.auth-links a { white-space: nowrap; }
.auth-links p { margin: 0 0 6px; }
.auth-card .btn-block { padding: 10px; }

/* ---- Toasts ---- */
#toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1080;
}
.toast-item {
  background: var(--card-bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 8px 24px oklch(0 0 0 / 0.35);
  min-width: 220px;
  max-width: min(360px, calc(100vw - 40px));
  animation: toast-in 0.15s ease-out;
}
.toast-item.toast-error { border-left-color: var(--negative); }
.toast-item.toast-warning { border-left-color: var(--warning); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.sr-only-focusable:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.only-xs { display: none; }
.btn-link { color: var(--text-muted); }
.btn-link:hover { color: var(--text); }

/* Ledger / long tables on tiny screens: tighten padding. */
@media (max-width: 575.98px) {
  table.table td, table.table th { padding: 10px 10px; }
  .panel { padding: 16px; }
  .toolbar .search-input { max-width: none; }
  .result-count { margin-left: 0; width: 100%; }
}

@media (max-width: 575.98px) {
  .hide-xs { display: none !important; }
  .only-xs { display: inline; }
  table.table .amount { font-size: 13px; }
  .bid-recommended { padding: 2px 6px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-grid .stat-accent { grid-column: 1 / -1; }
  .stat-card { padding: 12px 14px; }
  .stat-card .stat-value { font-size: 1.15rem; }
  .page-header { margin-bottom: 14px; }
}

/* Stacked "cards" layout for wide data tables on phones (.table-cards):
   each row becomes a labelled two-column grid; a sort <select> (added by
   app.js) replaces the hidden header row. */
.mobile-sort { display: none; margin-bottom: 12px; }
.mobile-sort label { margin: 0 8px 0 0; font-size: 13px; color: var(--text-muted); }
@media (max-width: 575.98px) {
  .mobile-sort { display: flex; align-items: center; }
  .mobile-sort select { flex: 1; }
  .table-wrap:has(.table-cards) { background: transparent; border: 0; overflow: visible; }
  .table-cards, .table-cards tbody { display: block; width: 100%; }
  .table-cards thead { display: none; }
  .table-cards tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
  }
  .table-cards tbody tr:hover { background: var(--card-bg); }
  .table-cards tbody tr.table-active { background: var(--accent-bg); border-color: transparent; }
  .table-cards tbody tr[hidden] { display: none; }
  .table-cards td, .table-cards td.num { display: block; padding: 0; border: 0; text-align: left; min-width: 0; }
  .table-cards td.cell-wide { grid-column: 1 / -1; }
  .table-cards td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 2px;
  }
  .table-cards .range { min-width: 0; }
  .table-cards .prob { min-width: 0; }
}

/* ---- PWA install banner ---- */
.install-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1050;
  max-width: 34rem; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between;
  padding: 12px 16px; border-radius: 10px;
  background: var(--card-bg-raised); border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.install-banner[hidden] { display: none; }
.install-banner-text { display: flex; flex-direction: column; font-size: 0.9rem; flex: 1 1 14rem; }
.install-banner-actions { display: flex; gap: 8px; }
.js-install-sidebar[hidden] { display: none; }
