/* El panel de Rackers. Colores por papel, en claro y en oscuro. */
:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #efeee9;
  --line: #deddd6;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7973;
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --track: #e6e5df;
  --good: #0d7a3e;
  --good-bg: #e2f3e8;
  --warn: #8a5a00;
  --warn-bg: #fbefd6;
  --bad: #b42318;
  --bad-bg: #fbe4e2;
  --notice: #eef4fc;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --surface-2: #232321;
    --line: #2f2f2c;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #8f8e86;
    --accent: #6aa7f0;
    --series-1: #3987e5;
    --track: #2b2b28;
    --good: #6fd39a;
    --good-bg: #173524;
    --warn: #f0c060;
    --warn-bg: #3a2c0c;
    --bad: #ff8a80;
    --bad-bg: #3d1714;
    --notice: #172232;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 10px; }
.muted { color: var(--muted); font-weight: 400; }
.sub { color: var(--text-2); margin: 4px 0 12px; }
.empty { color: var(--muted); }
.neg { color: var(--bad); }

.top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 24px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); }
.brand span { color: var(--muted); font-weight: 500; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { color: var(--text-2); padding: 6px 10px; border-radius: 8px; }
.top nav a.on { color: var(--text); background: var(--surface-2); font-weight: 600; }
.top nav a:hover { text-decoration: none; background: var(--surface-2); }
.money-switch .chip { padding: 3px 9px; }
.link { background: none; border: 0; color: var(--text-2); font: inherit; cursor: pointer; padding: 6px; }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.crumbs { margin: 0 0 8px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chips { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.chip { display: inline-block; padding: 5px 10px; border-radius: 7px; color: var(--text-2); border: 1px solid transparent; }
.filters > .chip { border-color: var(--line); background: var(--surface); }
.chip.on { background: var(--surface-2); color: var(--text); font-weight: 600; }
.chip:hover { text-decoration: none; color: var(--text); }
input[type="search"], input[type="password"], select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
input[type="search"] { min-width: 240px; }
.button {
  font: inherit; font-weight: 600; cursor: pointer; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px;
}
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button:disabled { opacity: 0.6; cursor: default; }

.notice { background: var(--notice); color: var(--text-2); border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stats.small { margin-bottom: 8px; }
.stats.small .stat { background: var(--surface-2); border-color: transparent; }
.stat-label { color: var(--text-2); font-size: 12px; }
.stat-value { font-size: 26px; font-weight: 650; margin-top: 2px; letter-spacing: -0.01em; }
.stats.small .stat-value { font-size: 20px; }
.stat-note { color: var(--muted); font-size: 12px; margin-top: 2px; }

.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--series-1); }
.chart .hit { fill: transparent; }
.chart .col:hover .bar { opacity: 0.8; }
.chart .grid { stroke: var(--line); stroke-dasharray: 2 3; }
.chart .baseline { stroke: var(--line); }
.chart .axis { fill: var(--muted); font-size: 11px; }

.rank { display: grid; gap: 6px; }
.rank-row { display: grid; grid-template-columns: minmax(140px, 42%) 1fr auto; align-items: center; gap: 10px; }
.rank-label { color: var(--text); line-height: 1.25; }
.rank-track { height: 10px; background: var(--track); border-radius: 4px; overflow: hidden; }
.rank-bar { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.rank-value { color: var(--text-2); font-size: 12px; min-width: 88px; text-align: right; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--text-2); font-weight: 600; font-size: 12px; }
th a { color: inherit; }
td.num, th.num { text-align: right; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 600; border-bottom: 0; }
.users .who { display: flex; flex-direction: column; color: var(--text); }
.users .who span { color: var(--muted); font-size: 12px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); vertical-align: middle; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 170px 92px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.timeline time { color: var(--muted); font-size: 12px; }
.timeline .kind { font-size: 12px; font-weight: 600; color: var(--text-2); }
.timeline .k-payment .kind { color: var(--good); }
.timeline .k-coach .kind { color: var(--accent); }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }

.login { max-width: 360px; margin: 12vh auto; display: grid; gap: 10px; }
.login h1 { margin-bottom: 8px; }
.error { color: var(--bad); margin: 0; }

#tip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}

@media (max-width: 760px) {
  main { padding: 16px; }
  .top { padding: 10px 16px; gap: 12px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 22px; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  input[type="search"] { min-width: 0; flex: 1; }
  .rank-row { grid-template-columns: minmax(90px, 40%) 1fr auto; }
}
