/* Admin screens (laptop first, still usable at 360px). Builds on app.css tokens. */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }
.alert-ok { background: var(--green-bg); border-color: #86efac; color: #065f2c; font-weight: 600; }

/* ---------- tabs ---------- */
.admin-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin: 0 0 16px;
}
.admin-tab {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 6px 10px;
  border: 2px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--navy); font-weight: 700; font-size: 16px; text-decoration: none; text-align: center;
}
.admin-tab:hover { border-color: var(--navy); }
.admin-tab.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (min-width: 700px) {
  .admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 2px solid var(--line); padding-bottom: 12px; }
  .admin-tab { padding: 6px 18px; font-size: 17px; }
}

/* ---------- toolbars, fields ---------- */
.admin-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.admin-toolbar .screen-title { margin-bottom: 0; min-width: 0; overflow-wrap: anywhere; }
.admin-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.admin-loading { padding: 24px 0; }
.admin-foot { margin-top: 16px; }

.admin-field { display: flex; flex-direction: column; min-width: 0; }
.admin-field .label { margin: 8px 0 4px; font-size: 16px; }
.admin-select { font-size: 18px; min-height: 52px; padding: 8px 12px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.inline-form > .input { flex: 1 1 160px; min-width: 0; width: auto; }
.inline-form > .admin-field { flex: 1 1 220px; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin-bottom: 8px; }
.filters > .admin-field { flex: 1 1 200px; }
.filters > .filter-search { flex: 2 1 260px; }
.check-label {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; font-weight: 600; font-size: 16px; cursor: pointer;
}
.check-label input { width: 24px; height: 24px; flex: none; }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0 12px; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .stat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.stat {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.stat-value { font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat-label { font-weight: 700; font-size: 16px; }
.stat-note { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.stat-warn { border-color: var(--amber-border); background: #fff7ed; }
.stat-warn .stat-value { color: var(--amber); }
.stat-ok { border-color: #86efac; background: #f0fdf4; }
.stat-grid-compact .stat-value { font-size: 26px; }

/* ---------- tables ---------- */
.table-wrap {
  width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.admin-table th, .admin-table td { padding: 8px 10px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.admin-table thead th {
  background: #f1f1f1; color: var(--navy); font-size: 15px; font-weight: 800; white-space: nowrap;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:nth-child(even) { background: #f8fafc; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table .bib-cell { font-weight: 800; color: var(--navy); white-space: nowrap; }
.admin-table .row-actions { white-space: nowrap; text-align: right; }
.admin-table .row-actions .btn + .btn { margin-left: 6px; }
.admin-table .tag { margin-left: 6px; vertical-align: middle; }
.group-cell { white-space: nowrap; }
@media (max-width: 499px) { .group-cell { white-space: normal; } }
.cell-warn { color: var(--amber); font-weight: 700; }
.cell-sub { display: block; font-size: 14px; }
.row-removed td { color: var(--muted); }
.row-removed .num-name { text-decoration: line-through; }
.admin-table tr.row-error { background: #fef2f2; }
.admin-table tr.row-warn { background: #fff7ed; }
@media (max-width: 699px) {
  .hide-sm { display: none; }
  .admin-table th, .admin-table td { padding: 8px 6px; }
}

/* ---------- group pickers ---------- */
.numbers-groups { margin-top: 12px; }
.numbers-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.numbers-status p { flex: 1 1 280px; }
.btn-group-warn { border-color: var(--amber-border); background: #fff7ed; }
.btn-group-warn .btn-group-sub { color: var(--amber); }
.admin-body .continue-btn { margin: 4px 0 8px; }

/* ---------- upload ---------- */
.upload-intro { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.upload-intro .alert { margin: 0; }
.upload-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.file-input {
  position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden;
}
.file-label { cursor: pointer; }
.file-input:focus-visible + .file-label { outline: 3px solid var(--focus); outline-offset: 2px; }
.file-label.is-disabled { opacity: 0.55; pointer-events: none; }
.upload-out { scroll-margin-top: calc(var(--topbar-h) + 8px); }
.upload-report { display: flex; flex-direction: column; gap: 8px; }
.upload-report .section-title { margin-top: 12px; }
.upload-report > .section-title:first-child { margin-top: 0; }
.upload-actions { margin: 4px 0; }
.upload-actions > .btn-primary { flex: 2 1 240px; }
.dup-list { margin: 6px 0 0; padding-left: 20px; }
.dup-list li { margin: 2px 0; }
.admin-table .row-num { width: 4.5em; }
.group-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.group-count { font-size: 15px; }
.col-list { margin: 0; padding-left: 20px; font-size: 16px; }

/* ---------- GotSport ratings panel (upload tab) + overview counts ---------- */
.gs-panel { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; scroll-margin-top: calc(var(--topbar-h) + 8px); }
.gs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.gs-head .section-title { margin: 0; }
.gs-panel .alert, .external-stats .alert { margin: 0; }
.gs-panel .empty { padding: 16px 8px; }
.stat-grid.gs-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.external-stats { display: flex; flex-direction: column; gap: 8px; }
.gs-list { display: flex; flex-direction: column; gap: 12px; }
.gs-row {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  padding: 12px; border: 2px solid var(--amber-border); border-radius: var(--radius); background: #fff7ed;
}
.gs-row-head { display: flex; align-items: flex-start; gap: 12px; }
.gs-who { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.gs-rating {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 56px; height: 56px; padding: 0 6px; border-radius: 12px;
  background: var(--navy); color: #fff; font-size: 24px; font-weight: 900;
}
.gs-who { flex: 1 1 auto; min-width: 0; }
.gs-name { font-size: 19px; font-weight: 800; overflow-wrap: anywhere; }
.gs-meta { overflow-wrap: anywhere; }
.gs-status { font-size: 14px; }
.gs-help { font-size: 16px; }
.gs-cands { display: flex; flex-direction: column; gap: 8px; }
.gs-link { justify-content: center; text-align: left; flex-direction: column; align-items: flex-start; gap: 2px; overflow-wrap: anywhere; }
.gs-link-sub { font-size: 16px; font-weight: 600; color: var(--muted); }
.gs-link-sub + .gs-link-sub { font-size: 14px; }
.gs-row > .gs-pick { align-self: flex-start; }
.gs-picker { display: flex; flex-direction: column; gap: 10px; }
.gs-pick-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.gs-confirm { display: flex; flex-direction: column; gap: 8px; }
.reg-line { font-size: 14px; }
.rchip .tag { margin-left: 0; }
.rchip.is-gotsport { border-color: #b0b0b0; }
/* Phones: three count boxes side by side don't fit their labels — one line each instead. */
@media (max-width: 560px) {
  .stat-grid.gs-counts { grid-template-columns: 1fr; gap: 6px; }
  .gs-counts .stat { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 8px 12px; }
  .gs-counts .stat-value { font-size: 24px; min-width: 1.4em; }
}

/* ---------- numbers ---------- */
.numbers-top { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: flex-end; }
.numbers-top > .admin-field { flex: 1 1 260px; }
.num-start { max-width: 110px; flex: 0 0 110px !important; font-weight: 700; }
.numbers-summary { margin: 12px 0 4px; font-weight: 700; font-size: 18px; color: #065f2c; }
.numbers-summary.is-warn { color: var(--amber); }
.numbers-hint { margin: 4px 0 8px; }
.numbers-table .num-player { min-width: 0; overflow-wrap: anywhere; }
.num-name { font-size: 17px; }
.num-cell { width: 120px; }
.num-input {
  width: 100px; min-height: 48px; padding: 6px 10px;
  font-size: 22px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums;
}
.num-input.is-error { border-color: var(--red); background: #fef2f2; }
.numbers-table .status-col { width: 38%; font-size: 15px; }
.num-status.is-ok { color: #065f2c; font-weight: 700; }
.num-status.is-saving { color: var(--muted); }
.num-status.is-error { color: var(--red); font-weight: 700; }
.numbers-table tr.is-dup { background: #fff7ed; }
@media (max-width: 499px) {
  .numbers-table .status-col { width: auto; }
  .num-cell { width: 92px; }
  .num-input { width: 84px; font-size: 20px; }
}

/* ---------- players ---------- */
.player-form { display: flex; flex-direction: column; gap: 4px; }
.form-2col { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 520px) { .form-2col { grid-template-columns: 1fr 1fr; } }
.bib-hint:empty { display: none; }
.bib-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; min-height: 1.4em; }
.edit-extras { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.danger-inline { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 2px solid #f87171; border-radius: var(--radius); background: #fef2f2; font-size: 16px; }
.danger-inline .btn { align-self: flex-start; }
.checkin-inline { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 16px; }
.checkin-inline .btn { align-self: flex-start; }
.edit-ratings-box .label { margin: 0 0 6px; }
.edit-ratings { display: flex; flex-direction: column; gap: 6px; }
.edit-rating { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.edit-rating-val { font-size: 20px; font-weight: 800; min-width: 2.2em; text-align: center; }
.edit-rating-who { flex: 1; min-width: 0; }
.edit-rating.is-voided { border-style: dashed; background: var(--grey-bg); }
.edit-rating.is-voided .edit-rating-val, .edit-rating.is-voided strong { text-decoration: line-through; color: var(--muted); }
.player-form .form-error .btn { margin-left: 8px; }

/* ---------- results ---------- */
.results-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.results-summary { font-weight: 700; }
.results-table .chips-cell { min-width: 140px; }
.rchips { display: flex; flex-wrap: wrap; gap: 6px; }
.rchip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 4px 10px;
  border: 2px solid var(--navy); border-radius: 999px; background: #fff; color: var(--navy);
  font-size: 16px; font-weight: 700; cursor: pointer; touch-action: manipulation;
}
.rchip:hover { background: #f1f1f1; }
.rchip-coach { font-size: 13px; color: var(--muted); letter-spacing: 0.02em; }
.rchip-val { font-size: 18px; font-weight: 800; }
.rchip.is-voided { border-style: dashed; border-color: var(--border); color: var(--muted); background: var(--grey-bg); }
.rchip.is-voided .rchip-val { text-decoration: line-through; }
.avg-cell { font-weight: 800; font-size: 18px; color: var(--navy); }
.admin-table tr.row-spread { background: #fff7ed; }
.spread-high { background: var(--amber-bg); color: var(--amber); font-weight: 800; box-shadow: inset 3px 0 0 var(--amber-border); }
.rating-detail { display: flex; flex-direction: column; gap: 8px; }
.rating-detail-value { font-size: 44px; font-weight: 900; color: var(--navy); line-height: 1; }

/* ---------- settings ---------- */
.settings-card, .danger-zone { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.settings-card .section-title, .danger-zone .section-title { margin-top: 0; }
.share-url { font-size: 18px; font-weight: 700; }
.danger-zone { border: 2px solid #f87171; }
.danger-zone .section-title { color: var(--red); }
.danger-zone .btn-row > .btn { flex: 0 1 auto; }
.reset-form { display: flex; flex-direction: column; gap: 8px; }
.reset-form .alert { margin: 0; }

/* ---------- print check-in list ---------- */
.print-toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.print-toolbar .inline-form { max-width: 640px; }
.print-group { margin: 0 0 28px; }
.print-title { font-size: 22px; color: var(--navy); }
.print-meta { font-size: 14px; color: var(--muted); margin: 2px 0 8px; }
.print-wrap { width: 100%; overflow-x: auto; }
.print-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 16px; }
.print-table th, .print-table td { border: 1px solid #94a3b8; padding: 6px 8px; text-align: left; }
.print-table th { background: #f1f1f1; }
.print-table .num { text-align: right; }
.print-table .print-last { font-weight: 700; }
.print-table .print-bib { width: 4.5em; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; } /* room to write a bib by hand */
.print-table .tick { width: 3.5em; text-align: center; }
.tick-box { display: inline-block; width: 18px; height: 18px; border: 2px solid #334155; border-radius: 3px; vertical-align: middle; }

/* Phones: the group is already in the heading, so drop the column to fit 360px. */
@media screen and (max-width: 499px) {
  .print-group-col { display: none; }
  .print-table th, .print-table td { padding: 6px 5px; }
}

@media print {
  .print-wrap { overflow: visible; }
  .admin-tabs, .print-toolbar { display: none !important; }
  @page { margin: 10mm; }
  .print-group { margin: 0; }
  .print-group + .print-group { break-before: page; page-break-before: always; }
  .print-title { font-size: 14pt; margin: 0; color: #000; }
  .print-meta { font-size: 8pt; margin: 0 0 3pt; color: #333; }
  /* Compact rows: a group of up to ~48 fits one Letter page. Larger groups spill over, but
     the repeated header and the Group column still label every row. */
  .print-table { font-size: 10pt; line-height: 1.15; }
  .print-table th, .print-table td { border-color: #000; padding: 1pt 5pt; }
  .print-table th { background: #e5e7eb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-table tr { break-inside: avoid; page-break-inside: avoid; }
  .print-table thead { display: table-header-group; }
  .print-table .print-bib { font-size: 10pt; }
  .tick-box { width: 10px; height: 10px; border-width: 1.5px; vertical-align: -1px; }
}

/* ---------- sortable tables, filters, group chips ---------- */
.th-sort { padding: 0; }
.sort-btn { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 8px 10px; cursor: pointer; font-weight: 700; white-space: nowrap; }
.sort-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.th-sort.num .sort-btn { text-align: right; }
.sort-arrow { color: var(--muted); font-size: 0.85em; }
.th-sort.is-sorted .sort-arrow { color: inherit; }
.group-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.group-chips-label { margin: 0 4px 0 0; }
.chip-group:not(.is-active) { text-decoration: line-through; opacity: 0.6; }
.totals-row td { border-top: 2px solid var(--navy); font-weight: 700; }
.left-cell { font-weight: 800; }
.summary-totals { margin: 8px 0; }

/* ---- Practice (Phase 2): sub-tabs, Parks & fields, Teams, Coordinators, the Sheet's group status ---- */
.practice-intro { max-width: 70ch; }
.practice-subtabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.practice-subtab { text-decoration: none; display: inline-flex; align-items: center; }
.practice-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.practice-park { margin: 8px 0 16px; }
.practice-park-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-bottom: 2px solid var(--navy); padding-bottom: 6px; margin-bottom: 4px; }
.practice-park-head .section-title { margin: 0; }
.practice-area-list { list-style: none; margin: 0 0 10px; padding: 0; }
.practice-area { display: flex; align-items: center; justify-content: space-between; gap: 6px 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.practice-area-name { font-size: 17px; }
.practice-team-add .inline-form .num-input { max-width: 7rem; }
.practice-coord-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.share-text { width: 100%; font-family: inherit; font-size: 15px; white-space: pre-wrap; }

.psheet-groups { padding: 8px 12px; margin: 4px 0 10px; }
.psheet-groups-summary { cursor: pointer; font-size: 16px; padding: 4px 0; }
.psheet-groups .table-wrap { margin-top: 6px; }
.psheet-groups-table { font-size: 14px; }
.psheet-groups-table th, .psheet-groups-table td { padding: 3px 8px; }
.psheet-groups-table .btn-sm { min-height: 34px; font-size: 14px; padding: 2px 10px; }
.psheet-groups-empty { margin: 4px 0 10px; }
.psheet-warn { color: var(--amber); font-weight: 700; }
.psheet-unplaced { min-width: 12rem; }
.psheet-hint { font-size: 14px; margin: 4px 0 6px; max-width: 110ch; }
.psheet-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.psheet-chip { min-height: 40px; font-size: 15px; }
.psheet-phone-hint { font-size: 14px; margin-top: 4px; }
.psheet-phone-where { margin: 0 0 10px; font-weight: 600; overflow-wrap: anywhere; }
/* The cell editor's map of the field: tap a cell to stretch the block to it. */
.psheet-map { display: grid; gap: 4px; margin: 0 0 6px; }
.psheet-map-head, .psheet-map-rowname { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; white-space: nowrap; }
.psheet-map-rowname { align-self: center; padding-right: 2px; }
.psheet-map-cell {
  min-width: 0; min-height: 44px; padding: 0 2px; border: 1px solid var(--border); border-radius: 6px; background: #fff;
  font: inherit; font-size: 12px; font-weight: 700; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.psheet-map-cell.is-on { background: rgba(29, 78, 216, 0.16); border: 2px solid var(--focus); }
.psheet-map-cell.is-anchor { box-shadow: inset 0 0 0 2px #fff; }
.psheet-map-cell.is-taken { background: #eef1f5; color: #6b7280; font-style: italic; }
.psheet-map-cell.is-merged-other { border-style: dashed; }
.psheet-map-size { margin: 0 0 4px; font-weight: 700; }
.psheet-map-hint { margin: 0 0 8px; color: var(--amber); font-size: 14px; font-weight: 600; }
.psheet-map-hint:empty { display: none; }
@media (hover: none) and (pointer: coarse) { .only-mouse { display: none; } }
@media (hover: hover), (pointer: fine) { .only-touch { display: none; } }
.practice-counts { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.practice-count-field { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.practice-count-field .practice-count { min-height: 40px; width: auto; padding: 4px 8px; }
.practice-parts { border: 0; background: none; padding: 4px 0; font: inherit; font-size: 14px; color: var(--muted); text-decoration: underline dotted; cursor: pointer; }
.psheet-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.psheet-tools .btn-sm { min-height: 36px; font-size: 14px; padding: 2px 12px; }
.psheet-copy-to { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 12px; }
.sessions-form { display: flex; flex-direction: column; gap: 8px; }
.session-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.session-name { min-width: 4.5em; }
.session-time { display: inline-flex; align-items: center; gap: 6px; }
.session-time .input { width: auto; min-height: 44px; }
