:root, [data-theme="green"] {
  --ink: #1c1915;
  --muted: #5c564c;
  --paper: #f3efe6;
  --card: #fffdf8;
  --line: #ddd4c4;
  --green: #1c3d32;
  --green-2: #2f6a52;
  --on-green: #f6f3ec;
  --top-muted: #d5e4db;
  --rail: #162820;
  --rail-ink: #e7efe9;
  --rail-line: #0e1c17;
  --rail-search: #0f1c18;
  --rail-search-line: #3d5c4e;
  --rail-muted: #b7cfc3;
  --rail-add: #2a4a3c;
  --rail-hover: #3d6b56;
  --copper: #8c4a22;
  --cream: #f7f1e4;
  --warn: #8a3418;
  --chip: #e7f0ea;
  --plot: #1c3d32;
  --up: #1b7a3a;
  --down: #b42318;
  --field: #fffdf8;
  --zone: rgba(255, 253, 248, 0.55);
  --zone-line: #b7a88f;
  --zone-hot: #e7f2ec;
  --badge: #f3e2c8;
  --ghost-line: #b7c9be;
  --stripe: #f4efe4;
  --chip-ink: #1c3d32;
  --bar: #1c3d32;
  --on-bar: #f6f3ec;
  --shade: rgba(20, 24, 22, 0.45);
  font-family: "Segoe UI", "Source Sans 3", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
[data-theme="white"] {
  --ink: #1a1a1a;
  --muted: #4d4d4d;
  --paper: #f6f6f4;
  --card: #ffffff;
  --line: #d9d9d4;
  --green: #16382c;
  --green-2: #1d4a3a;
  --on-green: #ffffff;
  --top-muted: #d7e6de;
  --rail: #fbfbfa;
  --rail-ink: #1a1a1a;
  --rail-line: #e4e4e0;
  --rail-search: #ffffff;
  --rail-search-line: #c8c8c2;
  --rail-muted: #5c6560;
  --rail-add: #e4efe8;
  --rail-hover: #d5e6dc;
  --copper: #7a3e1d;
  --cream: #f4f4f1;
  --warn: #8a2c14;
  --chip: #e8f2ec;
  --plot: #16382c;
  --up: #146c32;
  --down: #a11d14;
  --field: #ffffff;
  --zone: #f3f3f1;
  --zone-line: #c8c8c2;
  --zone-hot: #e7f2ec;
  --badge: #f3e2c8;
  --ghost-line: #b7c9be;
  --stripe: #f3f4f2;
  --chip-ink: #16382c;
  --bar: #16382c;
  --on-bar: #ffffff;
  --shade: rgba(20, 24, 22, 0.4);
}
[data-theme="dark"] {
  --ink: #f4f1ea;
  --muted: #c3bbb0;
  --paper: #121614;
  --card: #1c2320;
  --line: #3c4741;
  --green: #8fceb0;
  --green-2: #b7e4cc;
  --on-green: #102018;
  --top-muted: #d5e4db;
  --rail: #0e1311;
  --rail-ink: #f4f1ea;
  --rail-line: #2a3330;
  --rail-search: #1a211e;
  --rail-search-line: #4d5c54;
  --rail-muted: #b7c4bb;
  --rail-add: #24302b;
  --rail-hover: #314039;
  --copper: #e0a078;
  --cream: #24302b;
  --warn: #ffb4a2;
  --chip: #24382e;
  --plot: #9ddec0;
  --up: #7dcea0;
  --down: #ff8d7a;
  --field: #121816;
  --zone: rgba(18, 22, 20, 0.4);
  --zone-line: #4d5c54;
  --zone-hot: #24382e;
  --badge: #3a2e24;
  --ghost-line: #4d6b5c;
  --stripe: #24302b;
  --chip-ink: #d7efe4;
  --bar: #10261e;
  --on-bar: #f4f1ea;
  --shade: rgba(0, 0, 0, 0.62);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
input, select, textarea { color: inherit; }
button {
  cursor: pointer;
  background: var(--field);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
}
button:disabled { opacity: 0.55; cursor: default; }
button.ghost { background: var(--field); color: var(--ink); border: 1px solid var(--line); }
button.stake-go:not(.ghost), .actions > button:not(.ghost), .auth button {
  background: var(--green); color: var(--on-green); border: 0;
}
a { color: var(--green-2); }

.top {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end;
  padding: 1rem 1.25rem 0.75rem; background: var(--green); color: var(--on-green);
}
.top h1 { font-family: Palatino, "Palatino Linotype", Georgia, serif; font-weight: 500; font-size: 1.7rem; margin: 0; letter-spacing: -0.02em; }
.top p { margin: 0.15rem 0 0; color: var(--top-muted); font-size: 0.92rem; }
.top a { color: var(--on-green); }
.themes { display: flex; gap: 0.3rem; justify-content: flex-end; margin-bottom: 0.35rem; }
.themes button { background: transparent; color: var(--on-green); border: 1px solid currentColor; border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.78rem; }
.themes button[aria-pressed="true"] { background: var(--on-green); color: var(--green); }
.who { text-align: right; font-size: 0.9rem; }

.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 0; align-items: start; min-height: calc(100vh - 88px); }
.rail {
  position: sticky; top: 0; max-height: 100vh; overflow: auto;
  background: var(--rail); color: var(--rail-ink); padding: 0.8rem 0.75rem 2rem; border-right: 1px solid var(--rail-line);
}
.rail input[type="search"] {
  width: 100%; background: var(--rail-search); border: 1px solid var(--rail-search-line); color: var(--rail-ink); border-radius: 8px; padding: 0.45rem 0.6rem;
}
.group { margin-top: 0.9rem; }
.group h2 { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--rail-muted); margin: 0 0 0.25rem; font-weight: 650; }
.group h2 span { color: var(--copper); }
.filt { display: flex; gap: 0.35rem; align-items: stretch; margin: 0.15rem 0; }
.filt button.add, .filt button.name {
  background: transparent; border: 0; color: inherit; text-align: left; padding: 0.28rem 0.35rem; border-radius: 6px;
}
.filt button.add { width: 1.7rem; background: var(--rail-add); font-weight: 700; }
.filt button.name { flex: 1; }
.filt button:hover, .filt button:focus-visible { background: var(--rail-hover); }
.filt.on button.name { color: var(--copper); }
.filt.pro button.name { opacity: 0.55; }

.main { padding: 1rem 1.1rem 3rem; min-width: 0; }
.standing {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.65rem 0.85rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.85rem;
}
.standing > div { flex: 0 0 auto; max-width: 100%; }
.standing .wide { flex: 1 0 100%; }
.standing label, .card label, .auth label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.2rem; }
.standing select, .standing input, .card input, .card select, .auth input, textarea, .qa-body input, .qa-body select {
  background: var(--field); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 0.2rem 0.45rem; line-height: 1.25;
}
.auth input, #column-search { width: 100%; }
select {
  width: fit-content; max-width: 100%; height: 2rem; field-sizing: content;
  padding-right: 1.4rem;
}
.standing input[type="date"] { width: auto; height: 2rem; }
input.box { height: 2rem; flex: 0 0 auto; box-sizing: border-box; }
.savename { width: 22ch; max-width: 100%; height: 2rem; }
.pair { display: flex; flex-wrap: nowrap; gap: 0.35rem; align-items: center; width: max-content; max-width: 100%; }
.standing .hint, .standing .warn { max-width: 16rem; overflow-wrap: anywhere; }
.checkline { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.35rem; white-space: nowrap; margin-top: 0.45rem; color: var(--ink); font-size: 0.92rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; font-size: 0.92rem; }
.checks label { display: flex; gap: 0.3rem; align-items: center; color: var(--ink); font-size: 0.92rem; margin: 0; }
.span2 { grid-column: span 2; }
.hint { color: var(--muted); font-size: 0.82rem; margin: 0.25rem 0 0; }
.warn { color: var(--warn); font-size: 0.86rem; }

.zone {
  margin-top: 0.9rem; min-height: 140px; border: 1.5px dashed var(--zone-line); border-radius: 14px;
  padding: 0.7rem; background: var(--zone);
}
.zone.hot { border-color: var(--green-2); background: var(--zone-hot); }
.empty { color: var(--muted); margin: 0.4rem; }
.cards { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.7rem; }
.card {
  width: max-content; max-width: 100%; flex: 0 0 auto; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.75rem 0.8rem;
  box-shadow: 0 1px 0 rgba(28, 25, 21, 0.04);
}
.card h3, .card .hint, .card .warn, .card .why { max-width: 18rem; overflow-wrap: anywhere; }
.card header { display: flex; justify-content: space-between; gap: 0.5rem; align-items: flex-start; }
.card h3 { margin: 0; font-size: 1rem; font-family: Palatino, Georgia, serif; font-weight: 600; }
.card .x { background: transparent; border: 0; color: var(--muted); font-size: 1.1rem; padding: 0 0.2rem; }
.badge { display: inline-block; background: var(--badge); color: var(--copper); border-radius: 999px; padding: 0.05rem 0.45rem; font-size: 0.75rem; margin-left: 0.3rem; }
.card .why { font-size: 0.8rem; color: var(--copper); margin: 0.15rem 0 0.4rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.8rem 0; }
.export-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin: 0.2rem 0 0.4rem; }
.export-row label { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.export-row select { max-width: 100%; }
#csv-export { background: var(--green); color: var(--on-green); border: 0; border-radius: 8px; padding: 0.45rem 0.75rem; }
#csv-export:disabled { background: var(--line); color: var(--muted); opacity: 1; cursor: default; }
.csv-wait { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--ink); font-size: 1rem; }
.csv-wait[hidden] { display: none; }
.csv-wait .busy-spin { width: 1.15rem; height: 1.15rem; border-width: 3px; }
.actions button, .auth button, .qa button.use {
  background: var(--green); color: var(--on-green); border: 0; border-radius: 8px; padding: 0.45rem 0.75rem;
}
.actions button.ghost, .qa button { background: transparent; color: var(--green); border: 1px solid var(--ghost-line); }

.results, .qa, details.fold { margin-top: 0.8rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem; }
.race { margin-top: 0.7rem; }
.race.skipped { opacity: 0.55; }
.race h3 { margin: 0 0 0.3rem; font-family: Palatino, Georgia, serif; font-size: 1.05rem; }
.race h3 span { color: var(--muted); font-family: "Segoe UI", system-ui, sans-serif; font-size: 0.82rem; font-weight: 500; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; color: var(--ink); }
th, td { text-align: left; padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
tbody tr:nth-child(even) { background: var(--stripe); }
.scroll { overflow-x: auto; }

.qa-buttons { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.qa-buttons button { border-radius: 999px; padding: 0.28rem 0.6rem; }
.qa-buttons button.on, .qa-buttons button.open { background: var(--green); color: var(--on-green); border-color: var(--green); }
.qa-shade { position: fixed; inset: 0; background: var(--shade); z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem 2rem; }
.qa-pop { width: min(980px, 100%); max-height: 90vh; overflow: auto; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 50px rgba(0,0,0,.35); }
.qa-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--bar); color: var(--on-bar); padding: 0.7rem 0.9rem; position: sticky; top: 0; }
.qa-bar h2 { margin: 0; font-size: 1.05rem; color: var(--on-bar); }
.qa-x { background: transparent; color: var(--on-bar); border: 1px solid var(--on-bar); border-radius: 8px; padding: 0.35rem 0.7rem; }
.qa-body { padding: 0.8rem 0.9rem 1rem; color: var(--ink); background: var(--card); }
.qa-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-bottom: 0.7rem; }
.qa-chips span { background: var(--chip); color: var(--chip-ink); border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.82rem; }
.qa-chips .hist-flip { font: inherit; font-size: 0.82rem; background: var(--green); color: var(--on-green); border: 1px solid var(--green); border-radius: 999px; padding: 0.15rem 0.55rem; cursor: pointer; }
.hist-rows { display: inline-flex; align-items: center; gap: 0.2rem; }
.hist-rows button { font: inherit; font-size: 0.78rem; border-radius: 999px; border: 1px solid transparent; background: transparent; color: inherit; padding: 0.05rem 0.4rem; cursor: pointer; }
.hist-rows button.on { background: var(--green); color: var(--on-green); border-color: var(--green); }
.hist-scroll { max-height: 62vh; overflow: auto; }
.hist-scroll table { border-collapse: separate; border-spacing: 0; }
.hist-scroll thead th { position: sticky; top: 0; z-index: 2; background: var(--card); box-shadow: inset 0 -1px 0 var(--line); }
.qa-tiles { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.8rem; }
.qa-tiles div { border: 1px solid var(--line); border-radius: 8px; padding: 0.35rem 0.6rem; min-width: 6.5rem; background: var(--cream); color: var(--ink); }
.qa-tiles span { display: block; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.qa-tiles strong { font-size: 1.15rem; color: var(--ink); }
.qa-tiles small { font-size: 0.75rem; color: var(--muted); margin-left: 0.25rem; }
.pl-up { color: var(--up); }
.pl-down { color: var(--down); }
.card header { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; }
.card-tools { display: flex; align-items: center; gap: 0.35rem; }
.card-tools .qa-open { border: 1px solid var(--line); background: transparent; color: var(--green); border-radius: 999px; padding: 0.15rem 0.5rem; font-size: 0.75rem; }
.hold-card { border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; margin: 0.6rem 0; background: var(--cream); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: var(--field); color: var(--ink); border: 1px solid var(--line); }
.hold-card .kicker { margin: 0; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-size: 0.75rem; }
.hold-card .big { margin: 0.15rem 0 0.6rem; font-size: 2rem; font-variant-numeric: tabular-nums; }
.hold-card .big small { font-size: 0.9rem; color: var(--muted); }
.hold-card dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 0.45rem 0.8rem; margin: 0; }
.hold-card dt { font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.hold-card .wide { min-width: 12rem; }
.hold-card .wide dt { white-space: nowrap; font-size: 0.68rem; letter-spacing: 0.01em; }
.hold-card dd, .hold-card .hint { overflow-wrap: anywhere; }
.hold-card dd { margin: 0; font-variant-numeric: tabular-nums; }
.hold-card .too-few { color: var(--muted); }
button.info { display: inline-flex; align-items: center; justify-content: center; width: 1.15rem; height: 1.15rem; margin-left: 0.2rem; padding: 0; border-radius: 999px; border: 1px solid var(--muted); background: transparent; color: var(--muted); font-size: 0.75rem; font-style: italic; line-height: 1; text-transform: none; vertical-align: middle; }
button.info[aria-expanded="true"] { background: var(--chip); color: var(--chip-ink); border-color: var(--green); }
.tip[hidden] { display: none; }
.pr-note {
  position: fixed;
  z-index: 200;
  box-sizing: border-box;
  width: max-content;
  max-width: min(320px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow: auto;
  margin: 0;
  padding: 0.8rem 1rem;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  font-size: 1rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  overflow-wrap: break-word;
}
.pr-note[hidden] { display: none; }
.verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.6rem; margin: 0.6rem 0; }
.verdicts article { border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.75rem; }
.verdicts h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.verdicts p { margin: 0; }
svg.bank { width: 100%; height: auto; display: block; margin: 0.4rem 0 0.8rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
svg.bank polyline { stroke: var(--plot); }
.rank-on { background: var(--chip); color: var(--chip-ink); font-weight: 650; }
.busy { display: flex; align-items: center; gap: 0.7rem; margin: 0.6rem 0; color: var(--ink); }
.busy-spin { width: 1.35rem; height: 1.35rem; flex: 0 0 auto; border: 3px solid var(--line); border-top-color: var(--green-2); border-radius: 50%; animation: busy-turn 0.8s linear infinite; }
.busy[data-reduced="1"] .busy-spin { animation: none; }
@keyframes busy-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .busy-spin { animation: none; }
}
.holdup-verdict { border: 1px solid var(--line); border-left: 4px solid var(--green-2); border-radius: 10px; padding: 0.55rem 0.75rem; margin: 0.4rem 0 0.6rem; background: var(--cream); }
.holdup-verdict h3 { margin: 0 0 0.25rem; font-size: 1.15rem; }
.holdup-verdict p { margin: 0; }
.holdup-deeper h4 { margin: 0.8rem 0 0.35rem; font-size: 1rem; }
.holdup-deeper h5 { margin: 0.55rem 0 0.2rem; font-size: 0.95rem; }
.holdup-help { margin-top: 0.6rem; }
.holdup-help p { white-space: pre-line; }
.holdup-help summary { display: inline-block; width: 1.6rem; height: 1.6rem; line-height: 1.5rem; text-align: center; border: 1px solid var(--line); border-radius: 50%; background: var(--field); color: var(--ink); cursor: pointer; font-weight: 700; }
.race-panel { margin-top: 0.8rem; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 0.9rem 1rem; }
.race-panel h3, .race-panel h4 { margin: 0 0 0.35rem; font-family: Palatino, Georgia, serif; }
.race-plain { margin: 0.35rem 0; max-width: 42rem; }
.results-foot { margin: 1.4rem 0 0.2rem; padding-top: 0.7rem; border-top: 1px solid var(--line); max-width: 42rem; font-size: 0.9rem; color: var(--muted); }
.race-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 0.8fr); gap: 0.8rem; align-items: start; }
.race-track { width: 100%; height: auto; display: block; background: var(--field); border: 1px solid var(--line); border-radius: 10px; }
.lane-line { stroke: var(--line); stroke-width: 1; }
.race-horse .body { fill: var(--ink); }
.race-horse .silk { fill: var(--silk); }
.race-horse .race-num { fill: #fff; font-family: "Segoe UI", system-ui, sans-serif; }
.race-horse .stride-b { display: none; }
.race-horse[data-stride="b"] .stride-a { display: none; }
.race-horse[data-stride="b"] .stride-b { display: block; }
.race-horse[data-horse="you"] { --silk: #0072b2; }
.race-horse[data-horse="fav"] { --silk: #d55e00; }
.race-horse[data-horse="rand"] { --silk: #009e73; }
.race-label { fill: var(--ink); font-family: "Segoe UI", system-ui, sans-serif; }
.race-figures { display: flex; flex-direction: column; gap: 0.45rem; }
.race-fig { border: 1px solid var(--line); border-radius: 10px; padding: 0.45rem 0.6rem; background: var(--cream); }
.race-fig h4 { font-size: 1rem; }
.race-fig p { margin: 0.1rem 0; font-variant-numeric: tabular-nums; }
.race-fig[data-fig="you"] { border-top: 4px solid #0072b2; }
.race-fig[data-fig="fav"] { border-top: 4px solid #d55e00; }
.race-fig[data-fig="rand"] { border-top: 4px solid #009e73; }
.safer { margin: 0.8rem 0 0; font-size: 0.92rem; }
.race-finish { font-weight: 650; }
@media (max-width: 800px) {
  .race-layout { grid-template-columns: 1fr; }
}
.bank-tabs { display: flex; gap: 0.35rem; margin: 0.2rem 0 0.45rem; }
.bank-tabs button[aria-selected="true"] { background: var(--green); color: var(--on-green); border-color: var(--green); }
.only-head { margin: 0.15rem 0 0.35rem; font-weight: 650; }
.only-list { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.only-list .chip { display: inline-flex; align-items: center; gap: 0.15rem; background: var(--chip); color: var(--chip-ink); border-radius: 999px; padding: 0.1rem 0.2rem 0.1rem 0.45rem; }
.only-list .chip input { border: 0; background: transparent; color: inherit; padding: 0.1rem 0; text-align: center; font-variant-numeric: tabular-nums; }
.only-list .chip button { background: transparent; color: inherit; border: 0; border-radius: 999px; padding: 0 0.28rem; line-height: 1.4; }
button.linkish { background: transparent; color: var(--green-2); border: 0; padding: 0; text-decoration: underline; border-radius: 0; }
.system-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0 0 0.35rem; padding: 0.45rem 0.55rem 0.45rem 0.85rem; background: var(--bar); color: var(--on-bar); border-radius: 8px; position: sticky; top: 0; z-index: 30; }
#undo-stale { margin: 0 0 0.8rem; }
.system-open { margin: 0; padding: 0.2rem 0; background: transparent; color: var(--on-bar); font-size: 1.05rem; flex: 1 1 14rem; }
.undo-btns { display: flex; gap: 0.4rem; }
.undo-btns button { background: transparent; color: var(--on-bar); border: 1px solid currentColor; border-radius: 8px; padding: 0.4rem 0.8rem; }
.undo-btns button:disabled { opacity: 0.38; }
.qa-table { font-size: 0.86rem; }
.qa-table .all { font-weight: 700; background: var(--stripe); }
.qa-table th button.qa-sort { display: inline; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; text-align: inherit; }
.qa-table th button.qa-sort:focus-visible { outline: 2px solid var(--green-2); outline-offset: 2px; }
.qa-table th button.qa-sort[aria-sort="ascending"]::after { content: " ▲"; color: var(--green-2); }
.qa-table th button.qa-sort[aria-sort="descending"]::after { content: " ▼"; color: var(--green-2); }
.qa-tiles div.qa-on { background: var(--chip); border-color: var(--green); }
.qa-table th.qa-on, .qa-table td.qa-on { background: var(--chip); }
.bar span { display: block; height: 8px; border-radius: 4px; }
.bar span.up { background: var(--up); }
.bar span.down { background: var(--down); }
.qa-actions { display: flex; gap: 0.45rem; margin-top: 0.7rem; }
.qa-actions button { background: transparent; color: var(--green); border: 1px solid var(--ghost-line); border-radius: 8px; padding: 0.45rem 0.75rem; }
.qa-actions button.use { background: var(--green); color: var(--on-green); border: 0; }
.qa-tab { background: var(--paper); padding: 1rem; }
.qa-tab .qa-pop { margin: 0 auto; }

.columns { margin-top: 0.8rem; }
.columns .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.25rem 0.8rem; max-height: 280px; overflow: auto; }
textarea { width: min(100%, 36rem); min-height: 4.5rem; }
textarea.linkbox { width: 100%; max-width: none; min-height: 5.5rem; }
.months { font-size: 0.82rem; }
.months td, .months th { padding: 0.28rem 0.45rem; }
table.months td.place { text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 0.95rem; font-weight: 650; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.links a { font-size: 1.05rem; overflow-wrap: anywhere; }
.links [hidden] { display: none !important; }
.linkhead { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.7rem; }
.linkhead label, .linkhead span { font-weight: 600; }
.links .url { margin: 0.25rem 0 0.35rem; }
button.copy { background: transparent; color: var(--green); border: 1px solid var(--ghost-line); border-radius: 8px; padding: 0.28rem 0.65rem; }

.auth { max-width: 28rem; margin: 8vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem; }
.auth h1 { font-family: Palatino, Georgia, serif; font-weight: 500; margin: 0.2rem 0; }
.brand { letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.75rem; color: var(--green-2); margin: 0; }
.lede { color: var(--muted); }
.note { background: var(--chip); padding: 0.45rem 0.6rem; border-radius: 8px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; max-height: 42vh; min-width: 0; }
  .span2, .wide { grid-column: 1 / -1; }
  .top { flex-direction: column; align-items: flex-start; }
  .who { text-align: left; }
}
