:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef3f6;
  --text: #17212b;
  --muted: #667585;
  --line: #dbe3ea;
  --accent: #0f7b6c;
  --accent-strong: #095f53;
  --accent-soft: #dff3ef;
  --danger: #b5474c;
  --shadow: 0 18px 48px rgba(22, 34, 45, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 2.4rem;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1.05rem;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.checkLabel {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.checkLabel input {
  width: auto;
  min-height: auto;
}

.appHeader {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px);
  color: #ffffff;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(122, 214, 200, 0.16) 0 12%, transparent 12% 18%, rgba(239, 210, 154, 0.16) 18% 30%, transparent 30%),
    linear-gradient(240deg, transparent 0 62%, rgba(239, 210, 154, 0.1) 62% 70%, transparent 70%),
    #10242d;
}

.appHeader::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.06)),
    repeating-linear-gradient(90deg, transparent 0 52px, rgba(255, 255, 255, 0.045) 52px 53px);
  opacity: 0.7;
}

.appHeader > * {
  position: relative;
  z-index: 1;
}

.statusBanner {
  margin: 14px clamp(14px, 3vw, 34px) 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 800;
}

.statusBanner.success {
  color: var(--accent-strong);
  border-color: #b8e3db;
  background: var(--accent-soft);
}

.statusBanner.error {
  color: var(--danger);
  border-color: #efc4c7;
  background: #fff0f1;
}

.headerMeta {
  margin-top: 10px;
  color: #bfd0d8;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.appHeader .eyebrow {
  color: #7ad6c8;
}

.headerLink {
  color: inherit;
}

.headerLink:hover {
  color: #ffffff;
}

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

.languageSelector {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.languageSelector button {
  width: 38px;
  min-height: 32px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  color: #d8e4e8;
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: lowercase;
}

.languageSelector button:hover,
.languageSelector button.isActive {
  color: #10242d;
  background: #ffffff;
}

.loginPanel .languageSelector {
  margin-top: 18px;
  border-color: var(--line);
  background: var(--surface-soft);
}

.loginPanel .languageSelector button {
  color: var(--muted);
}

.loginPanel .languageSelector button:hover,
.loginPanel .languageSelector button.isActive {
  color: #ffffff;
  background: var(--accent);
}

.rolePill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #d8f2ee;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  font-weight: 700;
}

.accountIdentity {
  display: grid;
  gap: 1px;
  justify-items: end;
  line-height: 1.12;
}

.accountIdentity strong {
  color: #ffffff;
  font-size: 0.92rem;
}

.accountIdentity small {
  color: #bfd0d8;
  font-size: 0.74rem;
  font-weight: 700;
}

.appShell {
  display: grid;
  grid-template-columns: minmax(440px, max-content) minmax(320px, 1fr);
  grid-template-areas:
    "ratings side";
  gap: 16px;
  padding: 20px clamp(14px, 3vw, 34px);
  align-items: start;
}

.modeToolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px clamp(14px, 3vw, 34px) 0;
}

.modeButton {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(22, 34, 45, 0.06);
  cursor: pointer;
  font-weight: 800;
}

.modeButton:hover {
  border-color: var(--accent);
}

.modeButton.isActive {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.modeIcon,
.toolIcon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.modeButton.isActive .modeIcon {
  color: var(--accent-strong);
  background: #ffffff;
}

.modeIcon svg,
.toolIcon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modePanel[hidden] {
  display: none;
}

.ratingPanel,
.outputPanel,
.toolPanel,
.loginPanel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.ratingPanel {
  grid-area: ratings;
  justify-self: start;
  width: var(--rating-panel-width, max-content);
  max-width: 100%;
  overflow: hidden;
}

.outputPanel {
  min-height: 220px;
  max-height: calc(100vh - 170px);
  padding: 20px;
  overflow: auto;
}

.quickDetailsPanel {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 250, 249, 0.82);
}

.quickDetailsPanel[hidden] {
  display: none;
}

.outputPanel h2 span {
  color: var(--muted);
  font-weight: 500;
}

.playerDetailsContent {
  min-width: 0;
}

.playerDetails h2 {
  margin-bottom: 12px;
}

.playerDetails.hasAvatar .playerDetailsContent {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.playerDetails.hasAvatar .quickStats {
  margin-top: 0;
}

.playerAvatar {
  width: 150px;
  height: 100%;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.sideRail {
  grid-area: side;
  display: grid;
  align-content: start;
  gap: 14px;
}

.modeWorkspace.ratingsClosed {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "side";
}

.modeWorkspace.ratingsClosed .sideRail {
  width: min(100%, 1160px);
  justify-self: start;
}

.toolPanel {
  padding: 18px;
}

.matchFilterPanel {
  padding: 0;
  overflow: visible;
}

.matchFilterControls {
  padding: 18px;
}

.matchFilterHeader {
  display: block;
}

.matchFilterHeader h2 {
  min-width: 0;
}

.matchFilterPanel .outputPanel {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  margin: 0 -1px -1px;
}

.ratingToolsPanel {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 250, 249, 0.82);
}

.iconToolButton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  min-height: 44px;
  padding: 7px 10px;
  color: var(--accent-strong);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.iconToolButton:hover,
.iconToolButton.isActive {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.iconToolButton.isActive .toolIcon,
.iconToolButton:hover .toolIcon {
  color: var(--accent-strong);
  background: #ffffff;
}

.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panelHeader.compact {
  padding: 0 0 16px;
  border-bottom: 0;
}

.muted {
  color: var(--muted);
}

.tableWrap {
  width: 100%;
  overflow: auto;
}

.ratingTableWrap {
  width: max-content;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

#matureTable,
#eggTable {
  width: max-content;
  min-width: 0;
  table-layout: auto;
}

#matureTable.ratingColumnsMeasured,
#eggTable.ratingColumnsMeasured {
  table-layout: fixed;
  width: var(--rating-table-width);
}

#matureTable .rankColumn,
#eggTable .rankColumn {
  width: var(--rating-rank-column-width, auto);
}

#matureTable .nameColumn,
#eggTable .nameColumn {
  width: var(--rating-name-column-width, auto);
}

#matureTable .ratingColumn,
#eggTable .ratingColumn {
  width: var(--rating-rating-column-width, auto);
}

#matureTable .incrementColumn,
#eggTable .incrementColumn {
  width: var(--rating-increment-column-width, auto);
}

#matureTable .experienceColumn,
#eggTable .experienceColumn {
  width: var(--rating-experience-column-width, auto);
}

#matureTable .clubColumn,
#eggTable .clubColumn {
  width: var(--rating-club-column-width, auto);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 10px;
  color: var(--muted);
  background: #f8fafb;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
}

.sortableHeader {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.sortableHeader::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0;
}

th[aria-sort="ascending"] .sortableHeader::after {
  border-bottom: 6px solid currentColor;
  opacity: 0.8;
}

th[aria-sort="descending"] .sortableHeader::after {
  border-top: 6px solid currentColor;
  opacity: 0.8;
}

.matchesPlayed .sortableHeader,
.matchesWon .sortableHeader,
.matchesLost .sortableHeader,
.winPct .sortableHeader,
.incrementPos .sortableHeader {
  justify-content: flex-end;
}

td {
  padding: 8px 10px;
  border-bottom: 1px solid #edf1f4;
}

tr.odd,
tr.even {
  background: #ffffff;
}

tbody tr:hover {
  background: #f6fbfa;
}

tr.ratingSelectable {
  cursor: pointer;
}

tr.ratingSelectable.isSelected {
  background: var(--accent-soft);
  outline: 2px solid rgba(15, 123, 108, 0.35);
  outline-offset: -2px;
}

tr.ratingSelectable.isSelected td.name,
tr.ratingSelectable.isSelected td.rating {
  color: var(--accent-strong);
}

.rank,
.rating,
.incrementPos,
.incrementNeg,
.increment,
.experience,
.length,
.matchesPlayed,
.matchesWon,
.matchesLost,
.winPct,
.record {
  text-align: right;
}

.name,
.winner,
.loser,
.thePlayer {
  font-weight: 700;
}

.club,
.event,
.experience {
  color: var(--muted);
  font-size: 0.88rem;
}

#matureTable .rank,
#matureTable .name,
#matureTable .rating,
#matureTable .increment,
#matureTable .incrementPos,
#matureTable .incrementNeg,
#matureTable .experience,
#matureTable .club,
#eggTable .rank,
#eggTable .name,
#eggTable .rating,
#eggTable .increment,
#eggTable .incrementPos,
#eggTable .incrementNeg,
#eggTable .experience,
#eggTable .club {
  padding-left: 6px;
  padding-right: 6px;
}

#matureTable .rank,
#eggTable .rank {
  width: var(--rating-rank-column-width, auto);
}

#matureTable .rating,
#eggTable .rating {
  width: var(--rating-rating-column-width, auto);
}

#matureTable .increment,
#matureTable .incrementPos,
#matureTable .incrementNeg,
#matureTable .experience,
#eggTable .increment,
#eggTable .incrementPos,
#eggTable .incrementNeg,
#eggTable .experience {
  width: var(--rating-increment-column-width, auto);
}

#matureTable .experience,
#eggTable .experience {
  width: var(--rating-experience-column-width, auto);
}

#matureTable .club,
#eggTable .club {
  width: var(--rating-club-column-width, auto);
}

.incrementPos {
  color: #087a58;
  font-weight: 800;
}

.incrementNeg {
  color: var(--danger);
  font-weight: 800;
}

.subList {
  border-top: 1px solid var(--line);
}

.subList h3 {
  padding: 14px 20px;
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 800;
}

.stackForm {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.stackForm label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.matchFilterForm {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.matchFilterForm label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.matchFilterForm fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.matchFilterForm legend {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.filterPillGroup {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 118px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.filterPillGroupTall {
  max-height: 176px;
}

.filterPillGroupCompact {
  max-height: 92px;
}

.filterPill {
  display: inline-flex;
}

.filterPill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filterPill span {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #b8e3db;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.filterPill input:checked + span {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.filterPill span:hover,
.filterPill input:focus + span {
  border-color: var(--accent);
  background: #d2eee8;
}

.filterPill input:checked + span:hover,
.filterPill input:checked:focus + span {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.activeFilterStrip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  margin-top: 10px;
}

.activeFilterEmpty {
  margin: 0;
  font-size: 0.88rem;
}

.activeFilterPill {
  display: inline-flex;
  align-items: stretch;
  margin: 0;
}

.activeFilterPill input {
  display: none;
}

.activeFilterPill span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #b8e3db;
  border-right: 0;
  border-radius: 999px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.activeFilterPill button {
  min-width: 28px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #b8e3db;
  border-radius: 999px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  color: var(--accent-strong);
  background: var(--accent-soft);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.activeFilterPill:hover span,
.activeFilterPill:hover button {
  border-color: var(--accent);
  background: #d2eee8;
}

.filterConfig {
  position: relative;
}

.filterConfig summary {
  list-style: none;
}

.filterConfig summary::-webkit-details-marker {
  display: none;
}

.filterIconButton {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.filterIconButton:hover {
  border-color: var(--accent);
}

.filterIconButton:hover .toolIcon {
  color: #ffffff;
  background: var(--accent);
}

.iconOnlyButton {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.iconOnlyButton .toolIcon {
  width: 28px;
  height: 28px;
}

.iconOnlyButton .toolIcon svg {
  width: 18px;
  height: 18px;
}

.iconOnlyButton:hover {
  border-color: var(--accent);
}

.iconOnlyButton:hover .toolIcon {
  color: #ffffff;
  background: var(--accent);
}

.matchActions {
  position: relative;
  width: 44px;
  text-align: center;
  white-space: nowrap;
}

.matchActionMenu {
  position: relative;
  display: inline-block;
}

.matchEditSelectForm,
.matchMoveForm {
  display: block;
  margin: 0;
}

.matchActionMenuPanel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 7;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.matchActionMenuPanel[hidden] {
  display: none;
}

tr.matchDraggableRow {
  cursor: grab;
}

tr.matchDraggableRow.isDragging {
  opacity: 0.55;
}

tr.matchDraggableRow.dropBefore td {
  border-top: 3px solid var(--accent);
}

tr.matchDraggableRow.dropAfter td {
  border-bottom: 3px solid var(--accent);
}

.filterConfig .matchFilterForm {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  z-index: 5;
  width: min(720px, calc(100vw - 52px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dateFilterGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

select[multiple] {
  min-height: 180px;
}

input:focus,
select:focus {
  outline: 3px solid rgba(15, 123, 108, 0.18);
  border-color: var(--accent);
}

.primaryButton,
.ghostButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.primaryButton {
  color: #ffffff;
  background: var(--accent);
}

.primaryButton:hover {
  background: var(--accent-strong);
  text-decoration: none;
}

.ghostButton {
  color: var(--accent-strong);
  background: #ffffff;
  border-color: var(--line);
}

.ratingToolMode.isActive {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.ratingToolMode.isActive:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.primaryButton:disabled,
.ghostButton:disabled {
  color: #8d9aa5;
  background: #eef2f4;
  border-color: #dbe3ea;
  cursor: not-allowed;
}

.toolActionForm {
  margin-top: 12px;
}

.pagerBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.pagerActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagerActions form {
  margin: 0;
}

.pagerActions .ghostButton {
  min-height: 32px;
  padding: 6px 10px;
}

.toolButtonGrid {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.toolButtonGrid .ratingToolMode {
  justify-content: center;
  width: 44px;
  min-height: 44px;
  padding: 5px;
}

.toolButtonGrid .ratingToolMode .toolIcon {
  width: 32px;
  height: 32px;
}

.selectionHint {
  margin-top: 10px;
}

.inlineActions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.compactActions {
  margin-top: 10px;
}

.batchActions {
  margin-top: 0;
}

.batchMatchForm {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.batchMatchForm label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.batchDefaults {
  display: grid;
  grid-template-columns: minmax(160px, 0.45fr) minmax(260px, 1fr);
  gap: 10px;
}

.dateCombobox {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  width: 100%;
}

.dateCombobox input {
  grid-column: 1 / 2;
  min-width: 0;
  border-radius: 6px 0 0 6px;
}

.datePickerToggle {
  position: static;
  grid-column: 2 / 3;
  width: 38px;
  min-height: 40px;
  height: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 0 5px 5px 0;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
}

.datePickerToggle:hover,
.datePickerToggle[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.datePickerPanel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: 280px;
  max-width: min(280px, calc(100vw - 42px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(19, 45, 55, 0.18);
}

.datePickerHeader {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.datePickerMonth {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
  text-align: center;
}

.datePickerNav {
  min-width: 34px;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 900;
}

.datePickerNav:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.datePickerNav:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.datePickerGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.datePickerDow {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-align: center;
}

.datePickerDay {
  min-width: 0;
  min-height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: #f6faf9;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.datePickerDay:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.datePickerDay.isSelected {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.datePickerDay.isToday:not(.isSelected) {
  border-color: var(--accent);
}

.datePickerDay.isOutside {
  color: #8ca5a0;
  background: #eef5f3;
}

.datePickerDay:disabled {
  color: #b8c2c0;
  background: #f1f3f3;
  cursor: not-allowed;
}

.datePickerFooter {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.datePickerFooter button {
  min-height: 30px;
  padding: 5px 9px;
}

.eventCombobox {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  width: 100%;
}

.eventCombobox input {
  grid-column: 1 / 2;
  min-width: 0;
  border-radius: 6px 0 0 6px;
}

.eventOptionsToggle {
  position: static;
  grid-column: 2 / 3;
  width: 38px;
  min-height: 40px;
  height: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 0 5px 5px 0;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
}

.eventOptionsToggle:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.eventOptionsList {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 8;
  max-height: 220px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eventOptionsList button {
  display: block;
  width: 100%;
  min-height: 28px;
  padding: 4px 8px;
  border: 0;
  border-radius: 4px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-size: 0.84rem;
  text-align: left;
}

.eventOptionsList button[hidden] {
  display: none !important;
}

.eventOptionsList button:hover,
.eventOptionsList button.isSelected,
.eventOptionsList button.isAutocompleteMatch {
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 800;
}

.sessionPicker {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.sessionPlayers {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-content: flex-start;
  min-height: 28px;
  overflow: visible;
  padding: 2px;
}

.sessionPlayers .muted {
  align-self: center;
  font-size: 0.85rem;
}

.sessionPlayerPill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  max-width: 100%;
  min-height: 28px;
  height: 30px;
  margin: 0;
  overflow: hidden;
  border: 1px solid #b8e3db;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  cursor: grab;
  font-size: 0.82rem;
  font-weight: 800;
}

.sessionPlayerName {
  min-width: 0;
  padding: 4px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sessionRosterField {
  display: grid;
  gap: 4px;
}

.sessionRosterField > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.playerRoster {
  width: 100%;
  min-height: 40px;
  height: 40px;
  padding: 8px 10px;
  font-size: 0.86rem;
  line-height: 1.2;
}

.sessionPlayerPill:hover {
  border-color: var(--accent);
  background: #d2eee8;
}

.sessionPlayerPill:active {
  cursor: grabbing;
}

.removeSessionPlayer {
  min-width: 28px;
  min-height: 28px;
  height: 30px;
  padding: 4px 8px;
  border: 0;
  border-left: 1px solid #b8e3db;
  border-radius: 0;
  color: var(--accent-strong);
  background: var(--accent-soft);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.removeSessionPlayer:hover {
  color: #ffffff;
  border-color: var(--danger);
  background: var(--danger);
}

.batchRows {
  display: grid;
  gap: 8px;
}

.formError {
  padding: 10px 12px;
  border: 1px solid #efc4c7;
  border-radius: 8px;
  color: var(--danger);
  background: #fff0f1;
  font-size: 0.86rem;
  font-weight: 800;
}

.batchRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 72px 78px;
  gap: 8px;
  align-items: center;
}

.batchRow.batchHead {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.batchRow .ghostButton {
  min-height: 40px;
  padding-inline: 8px;
}

.batchRow.hasError select,
.batchRow.hasError input[name="length[]"] {
  border-color: var(--danger);
  background: #fff7f7;
  outline: 3px solid rgba(181, 71, 76, 0.14);
}

.batchPlayerSelect.dropTarget {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: 3px solid rgba(15, 123, 108, 0.18);
}

.adminMatchList {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: 520px;
  overflow: auto;
}

.adminList {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: 560px;
  overflow: auto;
}

.adminListHead,
.adminListRow {
  display: grid;
  gap: 8px;
  align-items: center;
}

.adminListHead {
  grid-template-columns: minmax(130px, 1fr) 150px minmax(180px, 1fr) 110px 170px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.adminListRow {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.userAdminRow {
  grid-template-columns: minmax(130px, 1fr) 150px minmax(180px, 1fr) 110px minmax(170px, 0.8fr);
}

.userPasswordRow {
  grid-template-columns: 1fr auto;
  margin-top: -8px;
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.playerAdminHead,
.playerAdminRow {
  grid-template-columns: minmax(190px, 1fr) minmax(90px, 0.45fr) 96px 80px;
}

.clubAdminHead,
.clubAdminRow {
  grid-template-columns: minmax(190px, 1fr) 80px;
}

.adminCreateRow {
  border-color: #b8e3db;
  background: #f3fbf9;
}

.inlineAdminForm,
.rowActions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.rowActions input {
  min-width: 130px;
}

.adminMatchRow {
  display: grid;
  grid-template-columns: 130px 70px minmax(140px, 1fr) minmax(140px, 1fr);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.adminMatchRow input[name="event"],
.adminMatchRow input[name="entered_by"] {
  grid-column: span 2;
}

.inlineDeleteForm {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
  margin-bottom: 8px;
}

.selectedMatchEditPanel {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.selectedMatchEditPanel .adminMatchRow {
  padding: 0;
  border: 0;
  background: transparent;
}

.selectedMatchDeleteForm {
  margin: 0;
}

.confirmOverlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 36, 45, 0.42);
}

.confirmOverlay[hidden] {
  display: none;
}

.confirmDialog {
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(22, 34, 45, 0.24);
}

.confirmDialog h2 {
  margin-bottom: 8px;
}

.confirmActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.dangerButton {
  color: var(--danger);
}

.dangerButton:hover {
  color: #ffffff;
  border-color: var(--danger);
  background: var(--danger);
}

.statGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.statGrid div,
.quickStats div,
.quickStats button {
  min-height: 76px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.quickStats button {
  color: var(--text);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.quickStats button:hover {
  border-color: var(--accent);
}

.quickStats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.statGrid span,
.quickStats span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.quickStats span {
  font-size: clamp(0.65rem, 0.7vw, 0.78rem);
}

.statGrid strong,
.quickStats strong {
  display: block;
  margin-top: 6px;
  font-size: 1.25rem;
}

#history,
#recordList,
#sumStatLength,
#sumStatOpponent {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
}

#ratingChart {
  width: 100%;
  max-height: 430px;
  margin-top: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.appFooter {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px clamp(14px, 3vw, 34px) 32px;
  color: var(--muted);
  font-size: 0.9rem;
}

.loginShell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #10242d;
}

.loginPanel {
  width: min(420px, 100%);
  padding: 28px;
}

.formError {
  margin-top: 12px;
  color: var(--danger);
  font-weight: 800;
}

@media (max-width: 820px) {
  .appShell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "ratings"
      "side";
  }

  .modeWorkspace.ratingsClosed {
    grid-template-columns: 1fr;
    grid-template-areas: "side";
  }

  .sideRail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .appHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  .accountBox {
    justify-content: flex-start;
  }

  .sideRail,
  .statGrid,
  .quickStats,
  .dateFilterGrid {
    grid-template-columns: 1fr;
  }

  .matchFilterHeader {
    align-items: start;
  }

  .filterConfig .matchFilterForm {
    left: 0;
    right: auto;
    width: calc(100vw - 52px);
  }

  .playerDetails.hasAvatar .playerDetailsContent {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
  }

  .playerAvatar {
    width: 96px;
  }

  .panelHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  .batchRow {
    grid-template-columns: 1fr;
  }

  .adminListHead {
    display: none;
  }

  .userAdminRow,
  .userPasswordRow,
  .playerAdminRow,
  .clubAdminRow {
    grid-template-columns: 1fr;
  }

  .batchRow.batchHead {
    display: none;
  }

  .batchDefaults,
  .batchDefaults label:first-child,
  .batchDefaults label:last-child {
    grid-template-columns: 1fr;
  }

  .sessionPlayers {
    min-height: 28px;
    overflow: visible;
  }

  h1 {
    font-size: 2rem;
  }
}
