.btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  border: 0;
  box-shadow: inset 0 0 0 1.5px var(--line), var(--shadow-1);
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; }

.btn-primary {
  background: var(--btn);
  color: var(--btn-ink);
  box-shadow: var(--shadow-1);
}

.btn-ok {
  background: var(--ok);
  color: var(--ok-ink);
  box-shadow: var(--shadow-1);
}

.btn-sm {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 650;
}

.btn-icon-plus {
  width: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
}

.btn-profile {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  font-weight: 700;
  background: var(--team-a-soft);
  color: var(--team-a);
  box-shadow: none;
}

.btn-wide { width: 100%; }
.btn-alert {
  background: var(--alert);
  color: #fff;
  box-shadow: var(--shadow-1);
}

.btn-icon {
  width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line), var(--shadow-1);
  font-size: 15px;
}
.btn-icon .nav-ico,
.btn-icon .nav-ico svg,
.btn-icon svg {
  width: 20px;
  height: 20px;
}
.btn-icon svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  box-shadow: none;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-1);
  border: 0;
}

.card-live {
  box-shadow: var(--shadow-1), inset 0 0 0 1.5px var(--team-a);
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  min-height: 64px;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  border: 0;
}

.input, .select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 0 40px 0 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235A7079' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  background-color: var(--surface);
}
.select::-ms-expand { display: none; }

.nav-bottom {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 70px;
  display: flex;
  background: var(--surface);
  border: 0;
  border-radius: 24px;
  z-index: 20;
  box-shadow: var(--shadow-2);
  padding: 6px;
}

.nav-bottom a, .nav-bottom button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: var(--ink-3);
  min-height: 58px;
  border-radius: 18px;
}

.nav-ico {
  display: flex;
  width: 26px;
  height: 26px;
}

.nav-ico svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-bottom .on {
  color: var(--accent-ink);
  background: var(--accent-soft);
  font-weight: 700;
}

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--btn);
  color: var(--btn-ink);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  z-index: 50;
  box-shadow: var(--shadow-2);
  font-size: var(--text-sm);
  font-weight: 650;
  max-width: calc(100% - 32px);
}
.toast-ok { background: var(--ok); color: var(--ok-ink); }
.toast-alert { background: var(--alert); color: #fff; }

.sheet-bg {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, .4);
  z-index: 40;
  display: flex;
  align-items: flex-end;
}

.sheet {
  background: var(--surface);
  width: 100%;
  border-radius: 28px 28px 0 0;
  padding: 24px 20px 32px;
  animation: sheet-in 180ms ease-out;
}
.sheet-ok { box-shadow: inset 0 4px 0 var(--ok); }
.sheet-alert { box-shadow: inset 0 4px 0 var(--alert); }
.sheet-ok h2 { color: var(--ok); }
.sheet-alert h2 { color: var(--alert); }

.sheet-body {
  max-height: 70vh;
  overflow: auto;
}
.filter-sheet .choice { width: 100%; }

.btn-icon.on {
  background: var(--btn-soft);
  color: var(--team-a);
  box-shadow: inset 0 0 0 1.5px var(--team-a);
}

@keyframes sheet-in {
  from { transform: translateY(20px); opacity: .6; }
  to { transform: none; opacity: 1; }
}

.choice {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font-weight: 650;
}

.choice.on {
  background: var(--btn);
  color: var(--btn-ink);
  box-shadow: none;
}
.choice.on .tiny { color: var(--btn-ink); }

.seg {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--surface-sunk);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.seg-btn {
  min-height: 36px;
  min-width: 88px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--ink-2);
  background: transparent;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.seg-btn.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
  animation: seg-pop .28s ease;
}

@keyframes seg-pop {
  0% { transform: scale(.96); }
  55% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.list-in {
  animation: list-in .28s ease;
}

@keyframes list-in {
  from { opacity: 0; transform: translateY(var(--s2)); }
  to { opacity: 1; transform: none; }
}

.tabs {
  display: flex;
  padding: 4px;
  gap: 4px;
  margin: 12px 0 16px;
  background: var(--surface-sunk);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--line);
}

.tabs .tab {
  flex: 1;
  min-height: 42px;
  padding: 0 8px;
  border-radius: 12px;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--ink-2);
  background: transparent;
}

.tabs .tab.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-sunk);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 700;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 4px;
}
.pager .btn {
  min-width: 40px;
  min-height: 36px;
  padding: 0;
}
.pager .btn:disabled { opacity: .35; }
.pager span { color: var(--ink-2); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }

.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  background: var(--btn-soft);
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 650;
  max-width: 100%;
  white-space: nowrap;
}
.tag-chip-on {
  background: var(--btn);
  color: var(--btn-ink);
}
.tag-chip b { font-weight: 650; }
.tag-chip button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1;
}
.tag-chip-on button {
  background: color-mix(in srgb, var(--btn-ink) 28%, transparent);
  color: var(--btn-ink);
}
.tag-input #tagList { display: contents; }
.tag-field {
  flex: 1;
  min-width: 140px;
  min-height: 32px;
  border: 0;
  background: transparent;
  padding: 0 6px;
}

.pick-list {
  max-height: 46vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.pick-list .choice {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-logo {
  display: block;
  height: 22px;
  width: auto;
  filter: invert(1);
}
.brand-logo-lg { height: 36px; }
:root[data-theme="dark"] .brand-logo { filter: none; }

.page.login-page {
  max-width: 420px;
  padding-top: 36px;
  padding-bottom: 48px;
}

.login-brand {
  display: block;
  height: 24px;
  width: auto;
  margin: 0 0 28px;
  object-fit: contain;
  object-position: left center;
}

.login-page h1 {
  font-size: 1.65rem;
  line-height: 1.2;
  margin: 0 0 8px;
  letter-spacing: -.02em;
}

.login-lead {
  margin: 0 0 24px;
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.login-auth {
  margin: 0 0 28px;
}

.login-gwrap {
  position: relative;
  min-height: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--btn);
  box-shadow: var(--shadow-1);
  cursor: pointer;
}
.login-gwrap.is-busy { opacity: .7; pointer-events: none; }
.login-gwrap.is-error {
  background: var(--alert-soft);
  box-shadow: none;
  height: auto;
  min-height: 40px;
}
.login-gwrap.is-error .login-gface { color: var(--alert); }
.login-gwrap.is-error .login-gmark,
.login-gwrap.is-error .login-gsi { display: none; }

.login-gface {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--btn-ink);
  font-weight: 650;
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}
.login-gmark {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.login-gsi {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.01;
  overflow: hidden;
  pointer-events: none;
}
.login-gwrap.is-ready .login-gsi { pointer-events: auto; }
.login-gsi > div,
.login-gsi iframe {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 40px !important;
  max-width: none !important;
  margin: 0 !important;
}

.login-hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--ink-3);
}

.login-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-group {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
}
.login-group h2 {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 10px;
}

.login-feats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.login-feats li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: var(--text-sm);
  color: var(--ink-2);
  font-weight: 600;
  line-height: 1.35;
}
.login-feats li::before {
  content: '';
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--btn);
  flex-shrink: 0;
}

.login-foot {
  margin-top: 28px;
  text-align: center;
  color: var(--ink-3);
  font-size: var(--text-xs);
}

.team-pick { min-height: 56px; }

.ico-btn {
  width: 44px;
  min-height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.ico-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-btn.on {
  background: var(--btn-soft);
  color: var(--team-a);
  box-shadow: inset 0 0 0 1.5px var(--team-a);
}

.hl-card h2 {
  font-size: .92rem;
  font-weight: 650;
  line-height: 1.25;
  margin: 4px 0 6px;
  letter-spacing: 0;
}
.hl-card .tiny { font-size: 10px; letter-spacing: .04em; }
.hl-card .hl-val { font-size: var(--text-sm); color: var(--ink-2); }

.filter-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--text-sm);
  text-align: left;
}

.metric-select option[data-tone="aces"] { background: var(--metric-aces); }
.bar-row[data-tone="aces"] .fill { background: var(--metric-aces); }
.bar-row[data-tone="winners"] .fill { background: var(--metric-winners); }
.bar-row[data-tone="unforcedErrors"] .fill { background: var(--metric-ue); }
.bar-row[data-tone="forcedErrors"] .fill { background: var(--chart-4); }
.bar-row[data-tone="doubleFaults"] .fill { background: var(--metric-df); }
.bar-row[data-tone="totalPointsWon"] .fill { background: var(--metric-points); }
.bar-row[data-tone="matchesWon"] .fill { background: var(--metric-wins); }
.bar-row[data-tone="acePerMatch"] .fill,
.bar-row[data-tone="wue"] .fill,
.bar-row[data-tone="firstServe"] .fill,
.bar-row[data-tone="winPct"] .fill,
.bar-row[data-tone="pointsWonPct"] .fill { background: var(--metric-rate); }

.select.tone-aces { background-color: var(--metric-aces); }
.select.tone-winners { background-color: var(--metric-winners); }
.select.tone-unforcedErrors { background-color: var(--metric-ue); }
.select.tone-forcedErrors { background-color: var(--chart-4); }
.select.tone-doubleFaults { background-color: var(--metric-df); }
.select.tone-totalPointsWon { background-color: var(--metric-points); }
.select.tone-matchesWon { background-color: var(--metric-wins); }
.select.tone-acePerMatch,
.select.tone-wue,
.select.tone-firstServe,
.select.tone-winPct,
.select.tone-pointsWonPct { background-color: var(--metric-rate); }

.sheet .col { gap: 12px; }
.sheet h2 { margin-bottom: 14px; }
.sheet .input, .sheet .select { margin: 0; }

.settings-page { display: flex; flex-direction: column; gap: 22px; }
.settings-block { display: flex; flex-direction: column; gap: 8px; }
.settings-block h3 {
  margin: 0 0 2px;
  font-size: var(--text-sm);
  color: var(--ink-2);
  font-weight: 700;
  letter-spacing: .02em;
}
.settings-block .list-row { margin-bottom: 0; }
.settings-block .select,
.settings-block input[type="range"] { margin: 0; }
.settings-block label.tiny { margin: 4px 0 0; }

.purge-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--ink);
}

.search-field { margin: 0 0 16px; }

.chart-grid {
  display: grid;
  gap: 12px;
  margin: 16px 0 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .chart-grid { grid-template-columns: 1fr 1fr; }
}
.chart-card { padding: 16px; }
.chart-card h3 { font-size: var(--text-sm); margin: 0 0 12px; color: var(--ink-2); }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  font-size: var(--text-xs);
  color: var(--ink-2);
}
.chart-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.chart-pie { width: 140px; height: 140px; display: block; margin: 0 auto; }
.line-chart { display: block; width: 100%; height: 120px; }
.stat-h { margin: 0 0 10px; font-size: var(--text-sm); color: var(--ink-2); }
.stat-dl {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--text-sm);
}
.stat-dl dt { color: var(--ink-2); }
.stat-dl dd { font-weight: 700; text-align: right; margin: 0; }
.badge-ok { background: var(--accent-soft); color: var(--ok); }
.badge-live { background: var(--btn-soft); color: var(--team-a); }
.badge-retired { background: var(--team-b-soft); color: var(--team-b); }
.badge-alert { background: var(--alert-soft); color: var(--alert); }
.badge-muted { background: var(--surface-sunk); color: var(--ink-2); }
.list-row .badge { flex-shrink: 0; }
.list-row .score {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 700;
}
.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.kpi {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-1);
}
.kpi b { display: block; font-size: 1.25rem; }
.kpi span { font-size: var(--text-xs); color: var(--ink-2); }

.share-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 16px 12px;
  box-shadow: var(--shadow-1);
}
.share-card > h2 {
  font-size: 1.25rem;
  margin: 0 0 4px;
}
.share-card-foot {
  margin: 16px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--ink-3);
  font-weight: 700;
}
