:root {
  --bg: #eceeea;
  --surface: #ffffff;
  --text: #121a16;
  --muted: #5e6862;
  --border: #d9ddd8;
  --accent: #14553a;
  --accent-soft: #e0eee6;
  --warn: #b5541c;
  --warn-soft: #fbeade;
  --gold: #9a7b12;
  --gold-soft: #f7efd2;
  --info: #2f5f9e;
  --info-soft: #e3ecf8;
  --heat: 31, 111, 74;
  --brand: #1a4a35;        /* St Andrews green */
  --brand-ink: #0c1f17;    /* near-black green: header, sign-in */
  --brand-gold: #c9a24a;   /* brass */
  --brand-cream: #f4efe2;
  --on-dark: #e8efe9;
  --on-dark-muted: #9fb3a8;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(12, 31, 23, .06), 0 2px 8px rgba(12, 31, 23, .05);
  --risk-low: #7cc49b;
  --risk-moderate: #e3b53b;
  --risk-high: #e07b39;
  --risk-severe: #c0392b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b100e;
    --surface: #141b18;
    --text: #e6ebe7;
    --muted: #93a099;
    --border: #25302b;
    --accent: #5cc08e;
    --accent-soft: #1d3328;
    --warn: #f09a62;
    --warn-soft: #3a2519;
    --gold: #e0c25a;
    --gold-soft: #332b12;
    --info: #86b1ea;
    --info-soft: #1b2839;
    --heat: 92, 192, 142;
    --brand: #2e7a55;
    --brand-ink: #060c09;
    --brand-gold: #d6b565;
    --shadow: none;
    --risk-low: #3f8f63;
    --risk-moderate: #c99a22;
    --risk-high: #d0692a;
    --risk-severe: #e0574a;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1 { font-size: 1.55rem; font-weight: 750; letter-spacing: -.025em; margin: 0 0 1rem; }
h2 { font-size: 1.02rem; font-weight: 650; letter-spacing: -.01em; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.neg { color: var(--warn); font-weight: 600; }
.pos { color: var(--accent); font-weight: 600; }

.topbar {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center;
  justify-content: space-between;
  padding: .65rem 1.25rem; background: var(--brand-ink); color: var(--on-dark);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--on-dark); }
.brand-course { color: var(--on-dark-muted); font-size: .88rem; padding-left: .75rem; border-left: 1px solid rgba(255, 255, 255, .15); }
.topbar .logo-word { color: #fff; }

/* ---- logo */
.logo { display: inline-flex; align-items: center; gap: .5rem; }
.logo-mark { width: 30px; height: 30px; flex: none; }
.logo-lg .logo-mark { width: 52px; height: 52px; }
.logo-word { font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -.03em; }
.logo-suffix { font-weight: 800; color: var(--brand-gold); letter-spacing: -.01em; margin-left: .04em; }
.logo-lg .logo-word { font-size: 2.2rem; color: #fff; }
.bare-brand { text-align: center; margin: 3rem 0 1.5rem; }
.tagline { color: var(--on-dark-muted); margin: .5rem 0 0; letter-spacing: .01em; }
.story { color: var(--on-dark-muted); font-size: .8rem; text-align: center; margin: 1.75rem 1rem 2.5rem; line-height: 1.6; }
/* Sign-in and setup: dark branded backdrop */
body.bare {
  background: radial-gradient(1200px 600px at 50% -10%, #1f4a37 0%, var(--brand-ink) 60%) fixed, var(--brand-ink);
  min-height: 100vh;
}
body.bare .card { border: 0; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.powered { color: var(--muted); font-size: .75rem; text-align: center; margin-top: 1.5rem; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.topbar nav a {
  text-decoration: none; color: var(--on-dark-muted); padding: .38rem .72rem; border-radius: 8px; font-weight: 500;
}
.topbar nav a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.topbar nav a.active { color: #fff; background: rgba(255, 255, 255, .12); }
.topbar .linkish { color: var(--on-dark-muted); }
.topbar .linkish:hover { color: #fff; }

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; min-width: 0; overflow-x: auto;
}
.card.ok { border-color: var(--accent); background: var(--accent-soft); }
.card.warn, .card.empty { border-color: var(--warn); background: var(--warn-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
.row-between { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.row-between h1 { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.kpi-label { color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 1.75rem; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: .15rem; }
.kpi-sub { font-size: .8rem; }

table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }

.bar { display: inline-block; width: 90px; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.bar-fill { height: 100%; background: var(--accent); }

.btn {
  display: inline-block; border: 1px solid var(--accent); background: var(--accent); color: var(--surface);
  padding: .5rem 1rem; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: var(--accent); }
input, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 9px; padding: .45rem .6rem;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.daynav { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .75rem; align-items: flex-start; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; align-items: end; }
.form-grid label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.tag-promo { background: var(--warn-soft); color: var(--warn); }
.tag-discount { background: var(--info-soft); color: var(--info); }
.tag-premium { background: var(--gold-soft); color: var(--gold); }
.tag-orphans { background: var(--accent-soft); color: var(--accent); }

.recs { list-style: none; margin: 0; padding: 0; }
.rec { padding: .7rem 0; border-bottom: 1px solid var(--border); }
.rec:last-child { border-bottom: 0; }
.rec-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.rec-head strong { flex: 1; min-width: 12rem; }
.upside { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.rec-action { margin: .2rem 0; }
.rec-why { font-size: .82rem; }

.heat-wrap { overflow-x: auto; }
.heat td, .heat th { text-align: center; padding: .35rem .2rem; border: 2px solid var(--surface); }
.heat td {
  background: rgba(var(--heat), calc(var(--v) * 0.85 + 0.05));
  font-size: .75rem; min-width: 2.2rem; border-radius: 4px;
}
.heat td.soft { outline: 2px dashed var(--info); outline-offset: -3px; }
.heat td.hot { outline: 2px solid var(--gold); outline-offset: -3px; }
.legend { padding: 0 .3rem; border-radius: 3px; }
.legend.soft { outline: 2px dashed var(--info); }
.legend.hot { outline: 2px solid var(--gold); }

.sheet td.time { font-weight: 600; width: 4.5rem; }
.sheet tr.empty-slot { background: var(--warn-soft); }
.sheet tr.partial td.time { color: var(--info); }
.seats { display: inline-flex; gap: 3px; }
.seat { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--accent); }
.seat.on { background: var(--accent); }
.group { display: inline-block; background: var(--accent-soft); border-radius: 4px; padding: 0 .4rem; margin: 1px 4px 1px 0; font-size: .85rem; }
.group.cancelled, .group.rebooked { text-decoration: line-through; opacity: .6; background: transparent; }
.group.no_show { background: var(--warn-soft); color: var(--warn); }

/* ---- weather */
.card.note { border-color: var(--info); background: var(--info-soft); }
.card.alert-banner { border-color: var(--risk-high); background: var(--warn-soft); }
.nowrap { white-space: nowrap; }
.small-btn { padding: .2rem .55rem; font-size: .82rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.outlook { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: .6rem; }
.day { border: 1px solid var(--border); border-top: 4px solid var(--risk-low); border-radius: 8px; padding: .55rem .6rem; }
.day.lvl-moderate { border-top-color: var(--risk-moderate); }
.day.lvl-high { border-top-color: var(--risk-high); }
.day.lvl-severe { border-top-color: var(--risk-severe); }
.day-temp { font-size: 1.15rem; font-weight: 700; }
.hourbar { display: flex; gap: 1px; margin: .45rem 0 .25rem; }
.hb { flex: 1; height: 14px; border-radius: 2px; background: var(--border); }
.hb.lvl-low { background: var(--risk-low); }
.hb.lvl-moderate { background: var(--risk-moderate); }
.hb.lvl-high { background: var(--risk-high); }
.hb.lvl-severe { background: var(--risk-severe); }
.lvl-text { color: var(--muted); }
.tag[class*="lvl-tag-"] { color: #fff; }
.lvl-tag-low { background: var(--risk-low); }
.lvl-tag-moderate { background: var(--risk-moderate); }
.lvl-tag-high { background: var(--risk-high); }
.lvl-tag-severe { background: var(--risk-severe); }
.risk-table td, .alert-log td { vertical-align: top; }
details summary { cursor: pointer; color: var(--accent); }
.email-preview { margin-top: .4rem; padding: .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); max-width: 32rem; }
.email-preview pre { white-space: pre-wrap; font: inherit; margin: .4rem 0; }

/* ---- golfer page */
main.golfer { max-width: 560px; }
.choices { display: grid; gap: .6rem; margin-bottom: .8rem; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choices form { margin: 0; }
.choice {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: .15rem;
  padding: .75rem .9rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.choice:hover:not([disabled]) { border-color: var(--accent); background: var(--accent-soft); }
.choice[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- pro shop */
.import-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.import-grid details { margin-top: .75rem; }
.shop-table td { vertical-align: top; }
.shop-table .tag { margin-right: .3rem; }
.shop-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.shop-strip .strip-item { background: var(--surface); }
.strip-item {
  display: flex; flex-direction: column; gap: .1rem; padding: .6rem .7rem; border-radius: 8px;
  border: 1px solid var(--border); text-decoration: none; color: var(--text);
}
.strip-item:hover { border-color: var(--accent); }
.strip-item.strip-alert { border-color: var(--warn); background: var(--warn-soft); }
@media (max-width: 600px) { .shop-strip { grid-template-columns: 1fr; } }

/* ---- accounts */
main.narrow { max-width: 460px; }
.stack.wide, .stack.wide label { align-items: stretch; width: 100%; }
.stack.wide label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
form.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: .35rem .7rem; }
.linkish:hover { color: var(--accent); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.checklist li.done, .checklist li.done a { color: var(--muted); text-decoration: line-through; }
.checklist li.done { text-decoration: none; }
h2.mt { margin-top: 1.25rem; }
form.mt { margin-top: 1rem; }
.wide-preview { max-width: none; }

@media (max-width: 860px) { .outlook { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
@media (max-width: 600px) {
  .choices.two { grid-template-columns: 1fr; }
  main { padding: 1rem 16px 2rem; }
  .card { padding: .9rem 1rem; }
  .bar { width: 50px; }
  .kpi-value { font-size: 1.35rem; }
}
