:root {
  --chalk: #F4F6F1;
  --paper: #FFFFFF;
  --ink: #1B2430;
  --muted: #5B6573;
  --line: #D9DFD6;
  --pitch: #1E5C3A;
  --pitch-soft: #E3EEE6;
  --flight: #2C6BA8;
  --hotel: #A86A12;
  --car: #7B4C9E;
  --other: #5B6573;
  --alert: #B03A2B;
  --alert-soft: #FBEDEA;
  --player-0: #1E5C3A;
  --player-1: #23407A;
  --player-2: #7A2E55;
  --player-3: #7A4A12;
  --display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "Source Sans 3", "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font: 16px/1.5 var(--body);
}
a { color: var(--pitch); }
:focus-visible { outline: 3px solid var(--flight); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar */
.topbar {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  background: var(--pitch); color: #fff;
}
.wordmark {
  font: 700 1.7rem/1 var(--display); letter-spacing: 0.01em;
  color: #fff; text-decoration: none;
}
.topbar nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.topbar nav a { color: #DDEBE1; text-decoration: none; font-weight: 600; }
.topbar nav a:hover { color: #fff; text-decoration: underline; }

main { max-width: 960px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 4rem; }

/* ---------- buttons & forms */
.btn {
  font: 600 1rem var(--body); cursor: pointer;
  background: var(--pitch); color: #fff; border: 0; border-radius: 6px;
  padding: 0.6rem 1.1rem;
}
.btn:hover { background: #164A2E; }
.btn.small { padding: 0.35rem 0.75rem; font-size: 0.9rem; }
.btn.ghost { background: transparent; color: var(--pitch); border: 1px solid var(--pitch); }
.btn.ghost:hover { background: var(--pitch-soft); }
.btn.danger { background: var(--alert); }
.quiet { color: var(--muted); }
.row { display: flex; align-items: center; gap: 1rem; margin-top: 0.75rem; flex-wrap: wrap; }

input, select, textarea {
  width: 100%; font: 1rem var(--body); color: var(--ink);
  padding: 0.55rem 0.65rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper);
}
textarea { resize: vertical; }

.flash { padding: 0.7rem 1rem; border-radius: 6px; margin: 0 0 1rem; font-weight: 600; }
.flash-ok { background: var(--pitch-soft); color: var(--pitch); }
.flash-error { background: var(--alert-soft); color: var(--alert); }

/* ---------- intake */
.intake { margin-bottom: 1.75rem; }
.intake-line { margin: 0 0 0.6rem; }
.address {
  font: 600 1rem var(--body); color: var(--pitch); cursor: pointer;
  background: var(--paper); border: 1px dashed var(--pitch); border-radius: 6px; padding: 0.15rem 0.5rem;
  word-break: break-all;
}
.address.small { font-size: 0.85rem; }
.address.copied, .conf.copied { background: var(--pitch); color: #fff; border-style: solid; }
.paste summary { cursor: pointer; font-weight: 600; color: var(--pitch); }
.paste form { margin-top: 0.6rem; }
.intake-forms { display: grid; gap: 0.6rem; }
.schedule-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem 1rem; margin-bottom: 0.6rem; }
.schedule-fields label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 600; font-size: 0.9rem; }
.pending, .cal { color: var(--muted); margin: 0.6rem 0 0; font-size: 0.95rem; }

/* ---------- tabs */
.tabs { display: flex; gap: 1.5rem; border-bottom: 2px solid var(--line); margin-bottom: 1.5rem; }
.tabs a {
  font: 600 1.25rem/1 var(--display); color: var(--muted); text-decoration: none;
  padding: 0 0 0.55rem; margin-bottom: -2px; border-bottom: 3px solid transparent;
}
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--pitch); }
.tabs a.print-all { margin-left: auto; font: 600 0.95rem/1 var(--body); color: var(--pitch); padding-top: 0.3rem; }
.trip-actions { display: flex; gap: 1rem; align-items: baseline; font-size: 0.9rem; }
.trip-actions > a { color: var(--muted); }
.trip-actions > a:hover { color: var(--pitch); }

/* ---------- trip */
.trip {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 1.25rem clamp(1rem, 3vw, 1.75rem) 0.5rem; margin-bottom: 2rem;
}
.trip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.trip-head h2 {
  font: 700 clamp(2rem, 6vw, 2.75rem)/0.95 var(--display);
  margin: 0; letter-spacing: -0.005em;
}
.trip-meta { margin: 0.4rem 0 0; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; }
.trip-meta span:first-child { color: var(--ink); font-weight: 600; }
.rename summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; list-style: none; }
.rename summary::-webkit-details-marker { display: none; }
.rename summary:hover { color: var(--pitch); text-decoration: underline; }
.rename form { display: flex; gap: 0.5rem; margin-top: 0.4rem; min-width: 240px; }

.problems {
  list-style: none; margin: 1rem 0 0; padding: 0.75rem 1rem;
  background: var(--alert-soft); border-left: 4px solid var(--alert); border-radius: 0 6px 6px 0;
  color: var(--alert);
}
.problems li { font-weight: 600; }
.problems li + li { margin-top: 0.3rem; }

/* ---------- day timeline (the big date numerals are the one loud thing) */
.days { list-style: none; margin: 1rem 0 0; padding: 0; }
.day {
  display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem;
  padding: 1rem 0; border-top: 1px solid var(--line);
}
.date { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.date .dow { font: 600 1rem var(--display); color: var(--muted); }
.date .num { font: 700 3.4rem/0.9 var(--display); color: var(--pitch); margin: 0.1rem 0; }
.date .mon { font: 600 1rem var(--display); color: var(--muted); }
.day.is-today .num { color: var(--alert); }

.day-body { display: grid; gap: 1rem; align-content: start; min-width: 0; }

/* game cards: solid, one color per player, side by side */
.games {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 0.75rem;
}
/* each player keeps the same column every day */
.game.p0, .game.p2 { grid-column: 1; }
.game.p1, .game.p3 { grid-column: 2; }
.game { --pc: var(--player-0); }
.game.p1 { --pc: var(--player-1); }
.game.p2 { --pc: var(--player-2); }
.game.p3 { --pc: var(--player-3); }
.game-card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--pc); color: #fff;
  border-radius: 8px; padding: 0.7rem 0.9rem 0.8rem;
}
.game-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.game-edit { color: #fff; opacity: 0.85; font-size: 0.85rem; font-weight: 600; }
.game-edit:hover { opacity: 1; }
.game-card a.game-where { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.5); text-underline-offset: 2px; }
.game-card a.game-where:hover { text-decoration-color: #fff; }
.game-card :focus-visible { outline-color: #fff; }
.game-player { font-weight: 600; font-size: 0.95rem; opacity: 0.9; }
.game-time { font: 700 1.9rem/1 var(--display); margin: 0.15rem 0 0.2rem; }
.game-opp { font-weight: 600; font-size: 1.05rem; }
.game-where { font-size: 0.95rem; opacity: 0.9; }
.game-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.game-tags span {
  font-size: 0.85rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
}

.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.ev {
  display: grid; grid-template-columns: 5.2rem 1fr auto; gap: 0.2rem 0.9rem; align-items: start;
  padding-left: 0.85rem; border-left: 4px solid var(--other);
}
.ev-flight { border-left-color: var(--flight); }
.ev-hotel { border-left-color: var(--hotel); }
.ev-car { border-left-color: var(--car); }
.ev-time { font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 1.35rem; white-space: nowrap; }
.ev-body { display: flex; flex-direction: column; min-width: 0; }
.ev-kind { font-size: 0.85rem; font-weight: 600; color: var(--other); }
.ev-flight .ev-kind { color: var(--flight); }
.ev-hotel .ev-kind { color: var(--hotel); }
.ev-car .ev-kind { color: var(--car); }
.ev-title { font-size: 1.1rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.ev-title:hover { text-decoration: underline; }
.ev-sub { color: var(--muted); font-size: 0.95rem; }
.conf {
  margin-top: 1.25rem; cursor: pointer;
  font: 600 0.95rem var(--body); letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
  background: var(--chalk); color: var(--ink); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.3rem 0.6rem; white-space: nowrap;
}
.conf:hover { border-color: var(--pitch); }
a.conf { text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem; }
.conf-link { color: var(--pitch); border-color: #B9CFC0; }
.conf-arrow { font-size: 0.85em; }
.ev-map { color: var(--muted); font-size: 0.95rem; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.ev-map:hover { color: var(--pitch); text-decoration-color: currentColor; }

/* ---------- other pages */
.page-title { font: 700 2.4rem/1 var(--display); margin: 0 0 1rem; }
.lede { color: var(--muted); max-width: 60ch; }
.empty { text-align: left; padding: 2rem 0; color: var(--muted); }
.empty h2 { font: 700 2rem/1 var(--display); color: var(--ink); margin: 0 0 0.5rem; }
.undated { background: var(--alert-soft); border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 2rem; }
.undated h2 { font: 700 1.5rem/1 var(--display); margin: 0 0 0.3rem; color: var(--alert); }

.booking-form .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 1.25rem; }
.booking-form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.95rem; }
.booking-form label.wide { grid-column: 1 / -1; }
.booking-form small { font-weight: 400; color: var(--muted); }
.delete-form { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }

.table-wrap { overflow-x: auto; }
.emails { width: 100%; border-collapse: collapse; background: var(--paper); }
.emails th, .emails td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.emails th { font: 600 1.05rem var(--display); color: var(--muted); }
.emails small { color: var(--muted); }
.status-error { color: var(--alert); font-weight: 600; }
.status-done { color: var(--pitch); font-weight: 600; }

.import-form { display: grid; gap: 1rem; max-width: 520px; margin-top: 1.25rem; }
.import-form label { display: grid; gap: 0.3rem; font-weight: 600; }

.login { max-width: 340px; margin: 3rem auto; display: grid; gap: 1rem; }
.login label { display: grid; gap: 0.3rem; font-weight: 600; }

/* ---------- phones */
@media (max-width: 600px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .wordmark { white-space: nowrap; }
  .trip-head { flex-direction: column; }
  .day { grid-template-columns: 3.1rem 1fr; gap: 0.7rem; }
  .date .num { font-size: 2.6rem; }
  .ev { grid-template-columns: 1fr auto; }
  .ev-time { grid-column: 1 / -1; padding-top: 0; }
  .ev-time:empty { display: none; }
  .conf { margin-top: 0; align-self: start; }
  .booking-form .grid { grid-template-columns: 1fr; }
  .schedule-fields { grid-template-columns: 1fr; }
  .games { grid-template-columns: 1fr; }
  .game.p0, .game.p1, .game.p2, .game.p3 { grid-column: auto; }
  .rename form { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- settings */
.setting { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.setting h2 { font: 700 1.5rem/1 var(--display); margin: 0 0 0.5rem; }
.setting p { margin: 0 0 0.6rem; }
.setting .hint { color: var(--muted); font-size: 0.95rem; max-width: 62ch; }

/* ---------- email viewer */
.email-actions { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start; font-size: 0.9rem; }
.email-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; margin: 0 0 1.5rem; }
.email-meta dt { font-weight: 600; color: var(--muted); }
.email-meta dd { margin: 0; }
.email-meta ul { margin: 0; padding-left: 1.1rem; }
.section-title { font: 700 1.5rem/1 var(--display); margin: 0 0 0.6rem; }
.email-text {
  white-space: pre-wrap; word-break: break-word; background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; padding: 1rem; font-size: 0.85rem; max-height: 70vh; overflow: auto;
}
@media (max-width: 600px) { .email-meta { grid-template-columns: 1fr; } .email-meta dt { margin-top: 0.4rem; } }
