/* Pitchside components (D-158): the vocabulary every page shares.
 *
 * Cards, buttons, inputs, chips and segmented tabs, form pills, band tags,
 * tables with the my-row style, alerts, the wage-ceiling bar, stat bars,
 * crests and icons. Colours come only from tokens.css. Every control a
 * thumb presses is at least 44px tall.
 */

/* ---------------------------------------------------------------- cards */

.card {
  margin: 12px 0;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.card > h2 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.card > p:last-child, .card > div > p:last-child { margin-bottom: 0; }
.card .card { margin: 10px 0 0; background: var(--card-2); box-shadow: none; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 8px;
}
.card-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.card-head .meta { margin: 0; }
.card-head a { display: inline-flex; align-items: center; min-height: 44px; }
.card.pending { color: var(--muted); }
.card.next { box-shadow: var(--shadow), inset 3px 0 0 var(--club-ink); }

.quote { margin: 8px 0; font-size: 16px; font-style: italic; color: var(--ink-2); }
.error { color: var(--loss); }
.win { color: var(--win); }
.draw { color: var(--muted); }
.loss { color: var(--loss); }

/* --------------------------------------------------------------- alerts */

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 12px 0; padding: 14px;
  color: var(--warn-ink); background: var(--warn-bg);
  border: 0; border-radius: var(--r-card); box-shadow: none;
}
.alert > .icon { margin-top: 2px; }
.alert > div { min-width: 0; }
.alert h2 { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: inherit; }
.alert p { margin: 0 0 4px; }
.alert p:last-child { margin-bottom: 0; }
.alert .meta, .alert a { color: inherit; }

/* -------------------------------------------------------------- buttons */

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 48px; padding: 0 18px;
  font: inherit; font-size: 15px; font-weight: 700; line-height: 1.2;
  color: var(--on-club); background: var(--club);
  border: 0; border-radius: var(--r-ctl);
  box-shadow: inset 0 0 0 1px var(--club-edge);
  text-decoration: none; cursor: pointer;
}
button.quiet, .btn.quiet {
  color: var(--ink); background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
button.quiet:hover, .btn.quiet:hover { background: var(--line); }
button.danger, .btn.danger {
  color: var(--loss); background: transparent;
  box-shadow: inset 0 0 0 2px var(--loss);
}
button:disabled {
  color: var(--muted); background: var(--card-2);
  box-shadow: none; cursor: default;
}
:focus-visible { outline: 2px solid var(--club-ink); outline-offset: 2px; }

/* --------------------------------------------------------------- inputs */

select, textarea, input:not([type]),
input[type=number], input[type=text], input[type=email], input[type=password] {
  width: 100%; min-height: 48px; padding: 10px 12px;
  font: inherit; font-size: 16px;   /* 16px: iOS zooms into anything smaller */
  color: var(--ink); background: var(--card-2);
  border: 1px solid var(--line); border-radius: var(--r-input);
}
textarea { min-height: 96px; line-height: 1.5; }
form.stack { display: grid; gap: 6px; }
form.stack label { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
form.stack button { margin-top: 12px; }
form.inline { display: inline; }
.pushacts { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------- chips */

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 24px; padding: 2px 10px;
  font-size: 12px; font-weight: 700; line-height: 1.2; white-space: nowrap;
  color: var(--ink-2); background: var(--card-2);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  text-decoration: none;
}
a.chip { min-height: 44px; padding: 0 14px; font-size: 13px; }
.chip .icon { width: 16px; height: 16px; }
.chip.warn { color: var(--warn-ink); background: var(--warn-bg); border-color: transparent; }
.chip.derby { color: var(--loss); background: transparent; border-color: var(--loss); }
.chip.live { color: var(--live); background: transparent; border-color: var(--live); }

/* Segmented tabs: a 40px pill inside a 44px target -- the 2px transparent
   border is part of the hit area, not of the painted pill. */
nav.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
nav.tabs a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none;
  background-color: var(--card); background-clip: padding-box;
  border: 2px solid transparent; border-radius: var(--r-pill);
  box-shadow: inset 0 0 0 1px var(--line);
}
nav.tabs a.is-active, nav.tabs a[aria-current="page"] {
  color: var(--card); background-color: var(--ink); box-shadow: none;
}

/* ------------------------------------------------ form pills, band tags */

.pips { display: inline-flex; gap: 3px; vertical-align: middle; }
.pip {
  display: inline-grid; place-items: center; width: 20px; height: 20px;
  border-radius: var(--r-pip);
  font-size: 11px; font-style: normal; font-weight: 800; line-height: 1;
}
.pip.win  { color: var(--win-ink);  background: var(--win); }
.pip.draw { color: var(--draw-ink); background: var(--draw); }
.pip.loss { color: var(--loss-ink); background: var(--loss); }
.pip.none { color: var(--muted); background: transparent; }

.band {
  display: inline-flex; align-items: center; min-height: 22px; padding: 1px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  color: var(--ink-2); background: var(--card-2);
  border: 1px solid var(--line); border-radius: var(--r-pill);
}
.band.b1 { color: var(--club-ink); background: transparent; border-color: var(--club-ink); }
.band.b5 { color: var(--loss); background: transparent; border-color: var(--loss); }
.band.band-listed { color: var(--ink-2); background: var(--card-2); border-color: var(--line); }
.band.band-asked { color: var(--warn-ink); background: var(--warn-bg); border-color: transparent; }

/* --------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  padding: 8px 6px; text-align: right;
  font-size: 12px; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
tbody td { padding: 10px 6px; text-align: right; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
thead th.club, thead th.name, tbody td.club, tbody td.name { text-align: left; }
thead th.pts, tbody td.pts { font-weight: 800; color: var(--ink); }
thead th.pos, tbody td.pos { width: 1.8rem; color: var(--muted); }
tbody tr.is-mine td { font-weight: 800; background: var(--card-2); }
tbody tr.is-mine td:first-child { box-shadow: inset 3px 0 0 var(--club-ink); }
table a { color: inherit; text-decoration: none; }
table a:hover { text-decoration: underline; }
/* The name is the link: give it the row's height, not its text's. */
table td.name > a, table td.club > a, .clubcell a {
  display: block; padding: 12px 0; margin: -12px 0;
}
.clubcell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.clubcell a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* "10,228 cr" never breaks across two lines. */
td.money, .ceiling .meta strong, .chair .facts dd { white-space: nowrap; }
.wide { overflow-x: auto; }
/* Below 460px, drop the columns a phone cannot carry without wrapping. */
@media (max-width: 460px) { .hide-narrow { display: none; } }

/* ------------------------------------------------- the wage ceiling bar */

.ceiling .bar {
  height: 8px; margin: 6px 0; overflow: hidden;
  background: var(--card-2); border-radius: var(--r-pill);
  box-shadow: inset 0 0 0 1px var(--line);
}
.ceiling .bar span { display: block; height: 100%; border-radius: inherit; background: var(--win); }
.ceiling.warn .bar span { background: var(--warn); }
.ceiling.block .bar span { background: var(--loss); }

/* ------------------------------------------------------------ stat bars */

/* <div class="stats" style="--home: #..; --away: #.."> from stat_colours();
   each bar's two halves carry their share as an inline flex-grow. */
.stats { display: grid; gap: 14px; }
.stat {
  display: grid; grid-template-columns: 4rem 1fr 4rem; align-items: center;
  row-gap: 6px; font-variant-numeric: tabular-nums;
}
.stat .home { text-align: left; font-weight: 800; }
.stat .away { text-align: right; font-weight: 800; }
.stat-name { text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.statbar { grid-column: 1 / -1; display: flex; gap: 4px; height: 8px; }
.statbar i {
  display: block; min-width: 8px; border-radius: var(--r-pill);
  box-shadow: inset 0 0 0 1px var(--line);
}
.stats { --home: var(--home-light); --away: var(--away-light); }
@media (prefers-color-scheme: dark) {
  .stats { --home: var(--home-dark); --away: var(--away-dark); }
}
.statbar i:first-child { background: var(--home); }
.statbar i:last-child { background: var(--away); }

/* ---------------------------------------------------------------- crest */

/* crest(club, size): --c1 fill, --c2 inner ring, --c3 letters, from
   desk/club_style.crest_style. The outer ring is the surface it sits on. */
.crest {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 12px; font-weight: 800; letter-spacing: .02em; line-height: 1;
  color: var(--c3); background: var(--c1);
  box-shadow: 0 0 0 2px var(--card), inset 0 0 0 2px var(--c1), inset 0 0 0 5px var(--c2);
}
.crest-sm {
  width: 24px; height: 24px; font-size: 8px;
  box-shadow: 0 0 0 2px var(--card), inset 0 0 0 3px var(--c2);
}
.crest-lg {
  width: 52px; height: 52px; font-size: 15px;
  box-shadow: 0 0 0 3px var(--card), inset 0 0 0 3px var(--c1), inset 0 0 0 6px var(--c2);
}
.crest-blank {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  color: var(--muted); background: var(--card-2);
}
.crest-blank .icon { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- icons */

.icon { flex: none; width: 20px; height: 20px; }
