:root {
  --green: #1f6f43;
  --green-dark: #134d2e;
  --fairway: #f1f6f0;
  --ink: #1c2520;
  --muted: #6b7a70;
  --line: #d9e2da;
  --danger: #b3261e;
  --warn: #8a6d00;
  --card: #ffffff;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--fairway);
  line-height: 1.5;
}

a { color: var(--green-dark); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  padding: .85rem 1.25rem;
  background: var(--green);
  color: #fff;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; }
.topbar .me { opacity: .85; font-size: .9rem; }
.btn-link {
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 999px;
  padding: .25rem .75rem;
}

.container { max-width: 760px; margin: 1.5rem auto; padding: 0 1.25rem; }

h1 { font-size: 1.6rem; margin: .2rem 0 1rem; }

/* Flash messages */
.flashes { margin-bottom: 1rem; display: grid; gap: .5rem; }
.flash { padding: .6rem .85rem; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.flash-success { border-color: #b9e0c6; background: #eaf7ee; }
.flash-danger  { border-color: #f0c5c2; background: #fdeceb; color: var(--danger); }
.flash-warning { border-color: #ecdca0; background: #fbf4d8; color: var(--warn); }
.flash-info, .flash-message { border-color: #cdd9f0; background: #eef3fb; }

/* Ladder table */
table.ladder { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
table.ladder th, table.ladder td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--line); }
table.ladder th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafdfa; }
table.ladder tr:last-child td { border-bottom: none; }
.rung { font-weight: 700; width: 3rem; color: var(--green-dark); }
.pname { font-weight: 500; }
.action { text-align: right; width: 8rem; }
tr.is-me { background: #f3faf5; }
.you { font-size: .72rem; background: var(--green); color: #fff; padding: .05rem .4rem; border-radius: 999px; vertical-align: middle; }
.swapped { color: var(--green); font-weight: 700; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: .55rem .9rem;
  font-size: .95rem;
  cursor: pointer;
}
.btn:hover { background: var(--green-dark); }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-full { width: 100%; margin-top: .5rem; }
.btn-ghost { background: transparent; color: var(--green-dark); border: 1px solid var(--line); }
.btn-ghost:hover { background: #eef3ee; }
form { margin: 0; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.auth-card { max-width: 380px; margin: 1rem auto; }
.auth-card label, .report-form label { display: block; margin-bottom: .75rem; font-size: .9rem; }
.auth-card input, .auth-card textarea, .report-form input, .report-form select {
  width: 100%; padding: .5rem .6rem; margin-top: .25rem;
  border: 1px solid var(--line); border-radius: 8px; font-size: 1rem;
}
.auth-card textarea { font-family: inherit; resize: vertical; }
.checkbox { display: flex !important; align-items: center; gap: .4rem; }
.checkbox input { width: auto; margin: 0; }
.opt { color: var(--muted); font-weight: 400; font-size: .8rem; }

/* Invite-acceptance / ladder picker */
.invite-card { max-width: 440px; }
.invite-card .kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--muted); margin: 0 0 .35rem; }
.ladder-choice { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .85rem; margin-bottom: .75rem; }
.ladder-choice legend { font-size: .9rem; padding: 0 .3rem; }
.ladder-opt { align-items: flex-start !important; margin-bottom: .5rem; }
.ladder-opt:last-child { margin-bottom: 0; }
.ladder-opt input { margin-top: .2rem; }
.invite-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; max-width: 600px; margin-bottom: 1rem; }
.invite-form label { display: block; margin: 0; font-size: .9rem; flex: 1 1 12rem; }
.invite-form input { width: 100%; padding: .5rem .6rem; margin-top: .25rem; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; }
.founding-check { flex: 1 1 100%; font-size: .9rem; }
.founding-check input { width: auto; margin: 0; }
.email-preview { border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.25rem; margin: 1rem 0; background: #fafcfa; max-width: 620px; }

/* Public invite requests (committee dashboard) */
.request-note { margin: .5rem 0; font-size: .92rem; white-space: pre-line; }

/* Match cards */
.match-card { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.match-card.status-reported { border-left-color: var(--warn); }
.match-card.status-confirmed { border-left-color: var(--green); }
.match-card.status-proposed { border-left-color: #3b6fb0; }
.match-card.status-disputed { border-left-color: var(--danger); }
.match-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.vs em { font-style: normal; color: var(--muted); }
.badge { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; background: #eef3ee; color: var(--muted); padding: .15rem .5rem; border-radius: 999px; }
.actions { display: flex; gap: .5rem; margin: .6rem 0; }
.result { margin: .5rem 0; }
.result.muted, .muted { color: var(--muted); }
.report-form fieldset { border: 1px dashed var(--line); border-radius: var(--radius); padding: .75rem .9rem; margin-top: .75rem; }
.report-form legend { font-size: .8rem; color: var(--muted); padding: 0 .35rem; }

.callout { background: #eef3fb; border: 1px solid #cdd9f0; border-radius: var(--radius); padding: .7rem .9rem; margin-bottom: 1rem; }
.hint { color: var(--muted); font-size: .9rem; }
.contact { font-size: .9rem; margin: .4rem 0; }
.contact a { color: var(--green-dark); font-weight: 600; word-break: break-all; }
.empty { color: var(--muted); padding: 1rem 0; }

.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; }

/* Handicap column + away players */
.hcp { color: var(--muted); width: 3.5rem; font-variant-numeric: tabular-nums; }
tr.is-away { opacity: .6; }
.away-tag { font-size: .7rem; background: #eee; color: var(--muted); padding: .05rem .4rem; border-radius: 999px; vertical-align: middle; }
.callout.climbers { background: #fbf7ea; border-color: #ecdca0; }
/* Join prompt at the top of a board: text + button on one row, wraps on narrow screens. */
.callout.join-cta { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; background: #eaf5ec; border-color: #bcdcc4; }

/* Dispute thread (both sides) + the reason/response forms. */
.dispute-thread { background: #fdf3f3; border: 1px solid #efc9c9; border-radius: var(--radius); padding: .6rem .8rem; margin: .6rem 0; }
.dispute-reason, .dispute-response { margin: .25rem 0; font-size: .92rem; }
.dispute-response { color: var(--green-dark); }
.dispute-form { margin-top: .6rem; }
.dispute-form .field-label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: .25rem; }
.dispute-form textarea { width: 100%; box-sizing: border-box; resize: vertical; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; margin-bottom: .4rem; }

/* Landing / splash */
.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.25rem 1.75rem; text-align: center; }
.hero .kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--muted); margin: 0 0 .5rem; }
.hero h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 .65rem; color: var(--green-dark); }
.hero .lead { color: var(--muted); font-size: 1.05rem; max-width: 52ch; margin: 0 auto 1rem; }
.cta { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin: 1.25rem 0 .35rem; }
.btn-lg { padding: .7rem 1.4rem; font-size: 1.05rem; border-radius: 999px; }
.ladders-pick, .how, .why { margin-top: 1.75rem; }
.ladder-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ladder-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.ladder-card h3 { margin: 0 0 .4rem; color: var(--green-dark); font-size: 1.05rem; }
.ladder-card p { margin: 0; }
@media (max-width: 560px) { .ladder-cards { grid-template-columns: 1fr; } }
.status-pending { color: var(--warn); font-weight: 600; margin: 0; }
.status-approved { color: var(--green-dark); font-weight: 600; margin: 0; }

/* Side-by-side ladder boards */
.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.board-head h2.sec { margin-top: .5rem; }
.reach-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #eef3ee; padding: .15rem .5rem; border-radius: 999px; white-space: nowrap; }
@media (max-width: 720px) { .boards { grid-template-columns: 1fr; } }
.steps, .perks { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 0; }
.steps { padding-left: 2.5rem; }
.steps li, .perks li { margin: .55rem 0; }
.perks { list-style: none; }
.why .cta { margin-top: 1.25rem; justify-content: flex-start; }

/* Rules page */
.rules { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.75rem; }
.rules .kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--muted); margin: 0; }
.rules h1 { margin: .25rem 0 .35rem; }
.rules .lead { color: var(--muted); margin-top: 0; }
.rules h2 { font-size: 1.1rem; color: var(--green-dark); border-bottom: 2px solid var(--line); padding-bottom: .35rem; margin: 1.6rem 0 .6rem; }
.rules h2 .num { color: var(--gold, #b88a2e); font-weight: 700; margin-right: .5rem; }
.rules h2 .star { color: var(--gold, #b88a2e); margin-right: .5rem; }
.rules .key { background: #fbf7ea; border-left: 4px solid #b88a2e; border-radius: 8px; padding: .75rem 1rem; margin: .9rem 0; font-size: .95rem; }
.rules table.ladder { box-shadow: none; }
.rules .footer-note { font-size: .8rem; margin-top: 2rem; }
hr { border: none; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* Admin / committee */
h2.sec { font-size: 1.15rem; color: var(--green-dark); margin: 1.75rem 0 .75rem; border-bottom: 2px solid var(--line); padding-bottom: .35rem; }
h3.subsec { font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 1.25rem 0 .6rem; }
.admin-ladder { margin-bottom: 2.5rem; }
.inline-form { display: inline-flex; align-items: center; gap: .25rem; margin: 0; }
.inline-form input[type=text] { padding: .25rem .4rem; border: 1px solid var(--line); border-radius: 6px; }
.admin-players td { vertical-align: middle; }
.order-cell { white-space: nowrap; }
.order-cell .btn { padding: .2rem .5rem; }
.danger-btn { color: var(--danger); border-color: #f0c5c2; }
.danger-btn:hover { background: #fdeceb; }
button[disabled] { opacity: .35; cursor: default; }

/* Scheduling deadlines */
.deadline { font-size: .88rem; color: var(--muted); margin: .4rem 0; }
.deadline.overdue { color: var(--danger); font-weight: 600; }
.match-card.is-overdue-card { border-left-color: var(--danger); background: #fdf6f5; }

/* Player profile */
.player-head h1 { margin: 0 0 .5rem; }
.player-stats { display: flex; flex-wrap: wrap; gap: 1.25rem; color: var(--muted); }
.player-stats strong { color: var(--ink); font-size: 1.05rem; }
.pname a { text-decoration: none; color: var(--ink); }
.pname a:hover { color: var(--green-dark); text-decoration: underline; }
.wl { font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; font-weight: 600; }
.wl.win { background: #eaf7ee; color: var(--green-dark); }
.wl.loss { background: #fdeceb; color: var(--danger); }
.wl.tie { background: #eef0f2; color: var(--muted); }

/* Per-ladder rules switcher (Rules page) */
.rules-switch { display: flex; gap: 8px; margin: 4px 0 18px; flex-wrap: wrap; }
.rules-switch .rules-tab {
  padding: 6px 14px; border: 1px solid #d9e2da; border-radius: 999px;
  text-decoration: none; color: #134d2e; font-size: 14px; background: #fff;
}
.rules-switch .rules-tab.active {
  background: #1f6f43; color: #fff; border-color: #1f6f43; font-weight: 600;
}
