:root {
  color-scheme: light dark;   /* let native controls (date picker, selects) adapt */
  --green-dark:  #1e4620;
  --green-mid:   #2e6b31;
  --green-light: #4a9b4f;
  --cream:       #f5f2eb;
  --white:       #ffffff;
  --surface-2:   #f5f5f5;
  --border:      #d4cfc4;
  --text:        #1a1a1a;
  --text-muted:  #6b6660;
  --red:         #c0392b;
  --accent:      #2e7d32;
  --danger:      #c62828;
  --danger-bg:   #fce4e4;
  --chip-ok-bg:  #e8f5e9;
  --chip-info-bg:   #e8eaf6;
  --chip-info-text: #3949ab;
  --chip-teal-bg:   #e0f2f1;
  --chip-teal-text: #00695c;
  --chip-skip-bg:   #eceff1;
  --chip-skip-text: #546e7a;
  --row-flag-bg: #fff8f8;      /* highlighted table rows (guest / suspect) */
  --flash-bg:     #fff3cd;
  --flash-border: #ffc107;
  --badge-pending-bg:   #fff8e1;
  --badge-pending-text: #7a5c00;
  --badge-booked-bg:    #e8f5e9;
  --badge-booked-text:  #1b5e20;
  --badge-failed-bg:    #fce4e4;
  --badge-failed-text:  #7f0000;
  --badge-cancelled-bg: #f0f0f0;
  --badge-cancelled-text: #555;
}

/* Dark mode: follows the OS setting. Only the palette changes — every
   surface below is variable-driven, so redefining the variables is enough,
   plus a few raw template colors routed through vars (--danger, --row-flag-bg,
   --chip-*). */
@media (prefers-color-scheme: dark) {
  :root {
    --cream:       #14171a;
    --white:       #1e2227;
    --surface-2:   #262b31;
    --border:      #363c43;
    --text:        #e7e3db;
    --text-muted:  #9a948a;
    --red:         #e0705f;
    --accent:      #6bbf70;
    --danger:      #ef8a8a;
    --danger-bg:   #3d2626;
    --chip-ok-bg:  #1f3b23;
    --chip-info-bg:   #26304a;
    --chip-info-text: #9fb0e8;
    --chip-teal-bg:   #1c3330;
    --chip-teal-text: #5cb8ad;
    --chip-skip-bg:   #2a2e33;
    --chip-skip-text: #9aa7b0;
    --row-flag-bg: rgba(224,112,95,.14);
    --flash-bg:     #3a3320;
    --flash-border: #7a6320;
    --green-mid:   #3f8f45;   /* lift buttons/links/focus off the dark bg */
    --green-light: #5bb35f;
    --badge-pending-bg:   #3a3320;  --badge-pending-text: #e8c86a;
    --badge-booked-bg:    #1f3b23;  --badge-booked-text:  #8fd694;
    --badge-failed-bg:    #3d2626;  --badge-failed-text:  #f0a0a0;
    --badge-cancelled-bg: #2a2e33;  --badge-cancelled-text: #a8a8a8;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--green-dark);
  color: var(--white);
  padding: 0 1.25rem;
}
.header-inner {
  max-width: 720px;
  margin: 0 auto;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  color: var(--white);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .01em;
}
nav { display: flex; align-items: center; gap: 1rem; }
.user-name { font-size: .875rem; opacity: .8; }
.nav-link { color: rgba(255,255,255,.75); font-size: .875rem; text-decoration: none; }
.nav-link:hover { color: var(--white); }

/* ── Main ── */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* ── Flash ── */
.flash {
  background: var(--flash-bg);
  border: 1px solid var(--flash-border);
  border-radius: 6px;
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .9rem;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.page-header h2 { font-size: 1.25rem; font-weight: 600; }
.section-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 2rem 0 .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .8rem;
}

/* ── Entry cards ── */
.card-list { display: flex; flex-direction: column; gap: .75rem; }

.entry-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.entry-card.booked  { border-left: 4px solid var(--green-light); }
.entry-card.failed  { border-left: 4px solid var(--red); opacity: .8; }
.entry-card.cancelled { opacity: .6; }

.entry-main { display: flex; align-items: baseline; gap: 1.25rem; flex-wrap: wrap; }
.entry-title { font-weight: 600; font-size: 1rem; color: var(--accent, #2e7d32); margin-bottom: .15rem; }
.entry-date { font-weight: 600; font-size: 1rem; font-variant-numeric: tabular-nums; }
.entry-time { color: var(--text-muted); font-size: .9rem; }
.entry-players { font-size: .85rem; color: var(--text-muted); }

.entry-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
.entry-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.entry-by   { font-size: .8rem; color: var(--text-muted); }
.entry-notes { font-size: .8rem; color: var(--text-muted); }

/* ── Status badges ── */
.status-badge {
  font-size: .75rem;
  font-weight: 600;
  padding: .2em .6em;
  border-radius: 99px;
  white-space: nowrap;
}
.status-badge.pending   { background: var(--badge-pending-bg);   color: var(--badge-pending-text); }
.status-badge.booked    { background: var(--badge-booked-bg);    color: var(--badge-booked-text); }
.status-badge.failed    { background: var(--badge-failed-bg);    color: var(--badge-failed-text); }
.status-badge.cancelled { background: var(--badge-cancelled-bg); color: var(--badge-cancelled-text); }
.status-badge.tested    { background: var(--chip-info-bg); color: var(--chip-info-text); }
.status-badge.skipped   { background: var(--chip-skip-bg); color: var(--chip-skip-text); }

/* ── Empty state ── */
.empty-state { color: var(--text-muted); font-size: .95rem; padding: .5rem 0; }
.empty-state a { color: var(--green-mid); }

/* ── Buttons ── */
.btn-primary, .btn-secondary, .btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: filter .15s;
}
.btn-primary:hover, .btn-secondary:hover { filter: brightness(.93); }

.btn-primary {
  background: var(--green-mid);
  color: var(--white);
  padding: .5rem 1.1rem;
}
.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  padding: .5rem 1.1rem;
}
.btn-ghost-sm {
  background: none;
  color: var(--text-muted);
  font-size: .8rem;
  padding: .25rem .5rem;
  border: 1px solid var(--border);
}
.btn-ghost-sm:hover { background: var(--cream); }
.btn-full { width: 100%; }

/* ── Form card ── */
.form-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 480px;
}

.field { margin-bottom: 1.25rem; }
.field label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .35rem;
}
.field input[type="date"],
.field input[type="text"],
.field select {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  background: var(--white);
  color: var(--text);
  appearance: auto;
}
.field input:focus,
.field select:focus { outline: 2px solid var(--green-mid); outline-offset: 1px; border-color: transparent; }
.field input[type="text"] { appearance: none; }

.field-row { display: flex; gap: 1rem; }
.field-row .field { flex: 1; margin-bottom: 0; }

.field-hint, .range-hint {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .4rem;
}
.range-hint { margin-top: .75rem; margin-bottom: 1.25rem; }

.checkbox-field { margin-bottom: 1.5rem; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .95rem;
  cursor: pointer;
}
.checkbox-label input { width: 1rem; height: 1rem; accent-color: var(--green-mid); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  padding-top: .5rem;
}

/* ── Auth page ── */
/* redeploy 2 */
body.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  width: 100%;
  max-width: 380px;
}
.auth-card h1 { font-size: 1.4rem; margin-bottom: .5rem; }
.auth-sub { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.25rem; }
.auth-card label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .35rem; }
.auth-card input[type="email"] {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  margin-bottom: 1rem;
}
.auth-card input:focus { outline: 2px solid var(--green-mid); outline-offset: 1px; border-color: transparent; }
