/* Brand colors and fonts come from brand/lhmt-colors.css (a copy of
   branding/tokens/lhmt-colors.css). Layouts stay usable on a phone:
   organizers are often at the course, not at a desk. */
body {
  font-family: var(--lhmt-font-body);
  margin: 0;
  color: var(--lhmt-clubhouse-ink);
  background: var(--lhmt-scorecard-ivory);
}
h1, h2, h3 {
  font-family: var(--lhmt-font-display);
}
a {
  color: var(--lhmt-fairway);
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--lhmt-fairway);
  color: var(--lhmt-scorecard-ivory);
  border-bottom: 3px solid var(--lhmt-heritage-gold);
}
header .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}
header h1 {
  margin: 0;
  font-size: 1.25rem;
}
header .subtitle {
  margin: 0;
  color: var(--lhmt-heritage-gold-on-dark);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
nav a {
  color: var(--lhmt-scorecard-ivory);
  font-weight: 600;
  text-decoration: none;
}
nav a:hover,
nav button.link:hover {
  color: var(--lhmt-heritage-gold-on-dark);
}
nav .signout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
nav .who {
  color: var(--lhmt-heritage-gold-on-dark);
  font-size: 0.9rem;
}

main {
  padding: 1.5rem;
  max-width: 64rem;
}

.card {
  background: #fff;
  border: 1px solid var(--lhmt-bunker-sand);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.card.narrow {
  max-width: 26rem;
}
.card.notice {
  border-color: var(--lhmt-heritage-gold);
  background: #fffaf0;
}
.card h2,
.card h3 {
  margin-top: 0;
}

form label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
}
form.inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}
form.inline label {
  margin-bottom: 0;
}
input[type="email"],
input[type="password"],
input[type="text"] {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.25rem;
  padding: 0.6rem 0.7rem;
  font: inherit;
  font-weight: 400;
  border: 1px solid #c9bfa6;
  border-radius: 6px;
  background: #fff;
}
input.copy {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
}
button {
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 700;
  color: var(--lhmt-scorecard-ivory);
  background: var(--lhmt-fairway);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
button.secondary {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  color: var(--lhmt-fairway);
  background: transparent;
  border: 1px solid var(--lhmt-fairway);
}
button.link {
  padding: 0;
  color: var(--lhmt-scorecard-ivory);
  background: none;
  font-weight: 600;
}

.error {
  color: #8a1c1c;
  font-weight: 600;
}
.hint {
  color: var(--lhmt-muted-text);
  font-size: 0.85rem;
  font-weight: 400;
}
.badge {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--lhmt-clubhouse-ink);
  background: var(--lhmt-heritage-gold-on-dark);
  border-radius: 999px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
th, td {
  padding: 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--lhmt-bunker-sand);
  vertical-align: middle;
}
th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--lhmt-muted-text);
}
tr.inactive td,
tr.status-inactive td,
tr.status-deceased td {
  color: var(--lhmt-muted-text);
}

/* Sortable headings (static/sortable.js). */
th button.sort {
  padding: 0;
  font: inherit;
  font-weight: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  background: none;
  border: none;
  cursor: pointer;
}
th button.sort::after {
  content: " \2195"; /* ↕ */
  opacity: 0.35;
}
th[aria-sort="ascending"] button.sort::after {
  content: " \25B2"; /* ▲ */
  opacity: 1;
}
th[aria-sort="descending"] button.sort::after {
  content: " \25BC"; /* ▼ */
  opacity: 1;
}
th button.sort:hover,
th[aria-sort="ascending"],
th[aria-sort="descending"] {
  color: var(--lhmt-fairway);
}

/* Golfer status chips. */
.status {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  white-space: nowrap;
}
.status.status-active {
  color: var(--lhmt-fairway);
  background: #e3efe5;
}
.status.status-inactive {
  color: var(--lhmt-muted-text);
  background: var(--lhmt-bunker-sand);
}
.status.status-deceased {
  color: var(--lhmt-scorecard-ivory);
  background: var(--lhmt-clubhouse-ink);
}
.table-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
a.button.secondary {
  color: var(--lhmt-fairway);
  background: transparent;
  border: 1px solid var(--lhmt-fairway);
}
a.button.small {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}
textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.25rem;
  padding: 0.6rem 0.7rem;
  font: inherit;
  font-weight: 400;
  border: 1px solid #c9bfa6;
  border-radius: 6px;
  background: #fff;
  resize: vertical;
}
.select-buttons {
  margin-bottom: 0.75rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
input.recipient {
  width: 1.1rem;
  height: 1.1rem;
}
details {
  margin: 0.5rem 0 1rem;
}
summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
}
.test-email {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--lhmt-bunker-sand);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Event status chips. */
.status.event-draft { color: var(--lhmt-muted-text); background: var(--lhmt-bunker-sand); }
.status.event-registration { color: var(--lhmt-clubhouse-ink); background: var(--lhmt-heritage-gold-on-dark); }
.status.event-in_progress { color: var(--lhmt-scorecard-ivory); background: var(--lhmt-fairway); }
.status.event-completed { color: var(--lhmt-fairway); background: #e3efe5; }
.status.event-closed { color: var(--lhmt-scorecard-ivory); background: var(--lhmt-muted-text); }

table.field input.money { width: 5.5rem; }
table.field input.notes { min-width: 8rem; }
table.field select { width: auto; min-width: 4rem; }
table.field input[type="text"] { margin-top: 0; padding: 0.35rem 0.5rem; }
table.field input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
table.field tr.htmx-request { opacity: 0.6; }
.flight-tools { margin: 0.5rem 0 1rem; }
#candidate-filter { width: auto; min-width: 14rem; margin-top: 0; }

.card.danger {
  border-color: #d9b3b3;
}
button.danger-button {
  background: #8a1c1c;
}

/* Aligned form layout: every label sits in a grid cell, so inputs line
   up in rows. 4 columns on a laptop, 2 on a tablet, 1 on a phone. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
  margin-bottom: 0.75rem;
}
.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid > label {
  margin: 0;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid label.checkbox-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  /* Same height as a text box, so it lines up with its neighbors. */
  min-height: 2.6rem;
}
.form-grid label.checkbox-cell input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
}
ul.form-notes {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
}
ul.form-notes li {
  margin-bottom: 0.25rem;
}
@media (max-width: 48rem) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span-3 { grid-column: span 2; }
}
@media (max-width: 30rem) {
  .form-grid, .form-grid.two { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
}

/* Money inputs: a fixed "$" inside the box, so every currency field
   reads the same whether or not it has a value. */
.money-field {
  position: relative;
  display: block;
  margin-top: 0.25rem;
}
.money-field .currency {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--lhmt-muted-text);
  font-weight: 400;
  pointer-events: none;
}
.money-field input[type="text"] {
  margin-top: 0;
  padding-left: 1.5rem;
}
.money-field.compact {
  display: inline-block;
  margin-top: 0;
}
.money-field.compact .currency {
  left: 0.5rem;
}
.money-field.compact input[type="text"] {
  padding-left: 1.2rem;
}

.status-change .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
td.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--lhmt-bunker-sand);
  border-left: 4px solid var(--lhmt-heritage-gold);
  border-radius: 8px;
}
.stat .value {
  font-family: var(--lhmt-font-display);
  font-size: 1.75rem;
  font-weight: 700;
}
.stat .label {
  color: var(--lhmt-muted-text);
  font-size: 0.85rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
a.button {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  font-weight: 700;
  color: var(--lhmt-scorecard-ivory);
  background: var(--lhmt-fairway);
  border-radius: 6px;
  text-decoration: none;
}
.notice {
  padding: 0.5rem 0.75rem;
  background: #eef5ee;
  border-left: 4px solid var(--lhmt-fairway);
  font-weight: 600;
}
div.error {
  padding: 0.5rem 0.75rem;
  background: #fbeeee;
  border-left: 4px solid #8a1c1c;
}
div.error p,
div.error ul {
  margin: 0.25rem 0;
}
.missing {
  color: #a0521c;
  font-size: 0.85rem;
}
.badge.muted {
  background: var(--lhmt-bunker-sand);
}
.stat .value a {
  color: inherit;
  text-decoration: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}
.filters label {
  margin: 0;
}
.grow {
  flex: 1 1 14rem;
}
input[type="search"],
input[type="tel"],
input[type="date"],
input[type="number"],
select {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.25rem;
  padding: 0.6rem 0.7rem;
  font: inherit;
  font-weight: 400;
  border: 1px solid #c9bfa6;
  border-radius: 6px;
  background: #fff;
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(14rem, 1fr);
  gap: 1rem;
  align-items: start;
}
fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.25rem;
}
legend {
  font-family: var(--lhmt-font-display);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}
.golfer-form .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.golfer-form .row > label {
  flex: 1 1 10rem;
}
.golfer-form .row > label.short {
  flex: 0 1 6rem;
}
.golfer-form .hint {
  display: block;
  margin-top: 0.25rem;
}
.big {
  font-family: var(--lhmt-font-display);
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0.25rem 0;
}
ol.scores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0;
  list-style: none;
}
ol.scores li {
  padding: 0.15rem 0.45rem;
  background: var(--lhmt-scorecard-ivory);
  border: 1px solid var(--lhmt-bunker-sand);
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
ol.scores li.unused {
  color: var(--lhmt-muted-text);
  opacity: 0.6;
}

@media (max-width: 40rem) {
  .columns {
    grid-template-columns: 1fr;
  }
  header, main {
    padding: 0.75rem 1rem;
  }
  header h1 {
    font-size: 1rem;
  }
  /* Stack table rows into cards on phones. */
  table, thead, tbody, tr, td {
    display: block;
  }
  /* Keep the headings as a row of sort buttons above the cards. */
  thead tr {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    padding: 0.25rem 0;
  }
  th {
    border: none;
    padding: 0.2rem 0.4rem;
  }
  tr {
    border-bottom: 1px solid var(--lhmt-bunker-sand);
    padding: 0.5rem 0;
  }
  td {
    border: none;
    padding: 0.2rem 0.6rem;
  }
}
