/* ---- app chrome ---- */
.app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.app-head__meta { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.app-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.app-head__actions .stats { margin-right: 6px; }

/* the nav reads as a distinct toolbar band: gray strip, white pill for the
   active view (segmented-control style) */
.viewbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 24px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border-2);
  flex-wrap: wrap;
}
.viewbar .tab:hover { background: var(--bg-active); }
.viewbar .tab[aria-selected='true'] {
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.06), 0 0 0 1px var(--border-2);
}
.viewbar .seg-btn { background: var(--bg); }
.filters { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.fgroup { display: inline-flex; align-items: center; gap: 7px; }
.flabel {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  white-space: nowrap;
}

.view { flex: 1; overflow: auto; padding: 0 24px 32px; }

/* ---- table view ---- */
/* No overflow wrapper here: it would become the sticky containing block
   and kill vertical stickiness. Wide tables scroll via .view itself. */
.dtable { border-collapse: collapse; width: 100%; min-width: 640px; }
.dtable th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  font-weight: 600;
  padding: 10px 12px 6px;
  height: 34px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 3;
}
.trow td { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.trow { cursor: pointer; }
.trow:hover td { background: var(--bg-hover); }
.trow-group td {
  padding: 9px 12px;
  font-weight: 600;
  font-size: 13.5px;
  background: var(--bg-warm);
  border-top: 1px solid var(--border-2);
  border-bottom: 1px solid var(--border-2);
  position: sticky;
  top: 34px; /* right under the column-header row */
  z-index: 2;
}
.trow-group .count { color: var(--text-3); font-weight: 400; margin-left: 8px; font-size: 12.5px; }
.cell-time { font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.cell-teams { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.vs { color: var(--text-3); font-size: 11px; padding: 0 2px; }
.cell-pin { color: var(--text-3); width: 30px; }

/* ---- timeline view ---- */
.tl-tabs { display: flex; align-items: center; gap: 4px; padding: 14px 0 12px; flex-wrap: wrap; }
.tl-tabs .flabel { margin-right: 6px; }
.tl-tab {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}
.tl-tab:hover { background: var(--bg-hover); }
.tl-tab[aria-selected='true'] { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.tl-tab:disabled { opacity: 0.35; cursor: default; }
.tl-tab:disabled:hover { background: none; }
.tl-wrap { overflow-x: auto; }
.tl-grid {
  display: grid;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-width: 720px;
  background: var(--border);
  gap: 1px;
}
.tl-grid > div { background: var(--bg); }
.tl-corner, .tl-colhead {
  background: var(--bg-warm) !important;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.tl-rowhead { padding: 10px; background: var(--bg-warm) !important; }
.tl-rowhead b { font-size: 13px; }
.tl-range { color: var(--text-3); font-size: 11.5px; margin-top: 1px; }
.tl-cell { padding: 5px; min-height: 74px; }
.tl-game {
  display: block;
  width: 100%;
  height: 100%;
  text-align: left;
  border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 7%, white);
  border-radius: 6px;
  padding: 6px 9px;
  transition: box-shadow 0.1s;
}
.tl-game:hover { box-shadow: 0 1px 6px rgba(15, 15, 15, 0.12); }
.tl-game.is-dim { opacity: 0.25; }
.tl-game__div {
  font-size: 11px;
  font-weight: 700;
  color: var(--c);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}
.tl-game__team { font-size: 12.5px; line-height: 1.4; color: var(--text); }

/* ---- small screens ---- */
@media (max-width: 640px) {
  .app-head, .viewbar { padding-left: 14px; padding-right: 14px; }
  .view { padding: 0 14px 24px; }
}

/* ---- print (the PDF path: Export → Print / PDF) ---- */
@page { margin: 14mm; }
@media print {
  #app { height: auto; }
  body { background: #fff; }
  .app-head__actions, .viewbar, .tl-tabs, #peek { display: none !important; }
  .app-head { border-bottom: 2px solid #000; padding: 0 0 8px; }
  .view { overflow: visible; padding: 0; }
  .dtable { min-width: 0; }
  .dtable th, .trow-group td { position: static; }
  .trow-group td {
    background: #f2f1ef !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .trow { break-inside: avoid; }
  .chip { background: none !important; border: 1px solid #999; color: #000 !important; }
  .cell-pin, th:last-child { display: none; }

  /* full-league packet: one page per league day (thead repeats per page) */
  .dtable--paged .trow-group {
    break-before: page;
    page-break-before: always;
  }
  .dtable--paged tbody .trow-group:first-child {
    break-before: auto;
    page-break-before: auto;
  }
}

/* ---- landing (league directory + admin sign-in) ---- */
.landing { max-width: 640px; margin: 0 auto; padding-top: 34px; padding-bottom: 60px; }
.landing h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 10px;
}
.landing section + section { margin-top: 40px; }
.league-list { display: flex; flex-direction: column; gap: 10px; }
.league-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 18px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  background: var(--bg);
  transition: box-shadow 0.12s, border-color 0.12s;
}
.league-card:hover { border-color: var(--text-3); box-shadow: 0 2px 10px rgba(15, 15, 15, 0.07); }
.league-card b { font-size: 16px; }
.league-card span { color: var(--text-2); font-size: 13px; }
.league-card__meta { color: var(--text-3) !important; font-size: 12px !important; }
.landing-admin {
  border: 1px solid var(--border);
  background: var(--bg-warm);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.landing-admin .sinput { background: var(--bg); border-color: var(--border-2); }
