:root {
  color-scheme: light;
  --bg: #eef2f1;
  --panel: #ffffff;
  --panel-strong: #f8faf9;
  --text: #17211f;
  --muted: #63716c;
  --line: #d7dfdc;
  --green: #195f4d;
  --green-dark: #0f3b32;
  --amber: #d99a24;
  --coral: #c9573b;
  --blue: #346da6;
  --shadow: 0 18px 45px rgba(22, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.center-stage {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 16px;
}

.auth-panel {
  width: min(100%, 440px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.mark {
  width: 42px;
  height: 42px;
  border: 3px solid var(--green);
  border-radius: 50%;
  background:
    radial-gradient(circle at 64% 34%, var(--amber) 0 5px, transparent 6px),
    linear-gradient(135deg, #ffffff 0 48%, var(--green) 49% 100%);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

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

.form-stack,
.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

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

input,
select {
  min-height: 44px;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(52, 109, 166, 0.24);
  outline-offset: 2px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.check-row {
  align-self: end;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.wide {
  grid-column: 1 / -1;
}

.primary-action,
.secondary-action,
.tabs button,
.icon-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-action {
  background: var(--green);
  color: #ffffff;
}

.primary-action:hover {
  background: var(--green-dark);
}

.secondary-action {
  background: var(--panel-strong);
  border-color: var(--line);
  color: var(--text);
}

.compact {
  min-height: 36px;
  padding: 8px 12px;
}

.message {
  border-radius: 6px;
  padding: 11px 12px;
  font-size: 0.92rem;
  font-weight: 700;
}

.message.error {
  border: 1px solid rgba(201, 87, 59, 0.35);
  background: rgba(201, 87, 59, 0.1);
  color: #8c2f1f;
}

.message.success {
  border: 1px solid rgba(25, 95, 77, 0.28);
  background: rgba(25, 95, 77, 0.1);
  color: var(--green-dark);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.user-chip span {
  overflow-wrap: anywhere;
}

.user-chip strong {
  border-radius: 999px;
  background: rgba(217, 154, 36, 0.17);
  color: #79520e;
  padding: 5px 9px;
}

.icon-button {
  width: 42px;
  padding: 0;
  background: var(--panel-strong);
  border-color: var(--line);
  color: var(--text);
  font-size: 1.1rem;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 14px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: #e4ebea;
}

.tabs button {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.tabs button.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

.workspace-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 800;
}

.workspace-tabs button.active {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.workspace {
  display: grid;
  gap: 22px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 44px) 44px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.tournament-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric-card span {
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  font-size: 2rem;
  line-height: 1;
}

.section-band {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.section-band.narrow {
  width: min(760px, 100%);
}

.section-heading,
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
}

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

.tournament-card {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.status-pill {
  border-radius: 999px;
  background: rgba(52, 109, 166, 0.12);
  color: var(--blue);
  padding: 5px 9px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.detail-list div {
  display: grid;
  gap: 3px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.settings-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.settings-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.settings-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.team-list {
  display: grid;
  gap: 14px;
}

.side-list,
.competition-list,
.foursome-list {
  display: grid;
  gap: 12px;
}

.side-card,
.competition-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.competition-card .muted {
  margin-bottom: 0;
}

.compact-settings {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-settings div {
  padding: 11px;
}

.entry-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.entry-chip-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--muted);
  padding: 6px 9px;
  font-size: 0.84rem;
  font-weight: 700;
}

.compact-empty {
  padding: 18px;
}

.team-roster {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.team-roster-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-roster-heading p {
  margin-bottom: 0;
}

.team-color {
  width: 18px;
  height: 42px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
}

.team-color.neutral {
  background: var(--line);
}

.player-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.player-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(90px, 0.5fr);
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.player-row:last-child {
  border-bottom: 0;
}

.player-row span,
.player-row strong {
  overflow-wrap: anywhere;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  border: 1px dashed #b8c4c0;
  border-radius: 8px;
  padding: 28px;
  background: #ffffff;
}

.empty-state p {
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 800px) {
  .topbar,
  .section-heading,
  .card-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-chip,
  .tabs {
    flex-wrap: wrap;
  }

  .metrics-grid,
  .tournament-grid,
  .workspace-grid,
  .settings-grid,
  .compact-settings,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .workspace-header,
  .player-row {
    grid-template-columns: 1fr;
  }
}
