:root {
  color-scheme: light;
  --ink: #18392f;
  --muted: #65766f;
  --green: #236347;
  --green-dark: #194a35;
  --line: #dbe5df;
  --paper: #fff;
  --canvas: #f3f7f4;
  --accent: #d8e9dc;
  --danger: #9f3333;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

body { overflow-wrap: break-word; }
a { color: var(--green); }
a:hover { color: var(--green-dark); }

.site-header {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  min-height: 4.3rem;
  padding: .7rem clamp(1rem, 4vw, 3rem);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--green-dark);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.03em;
  text-decoration: none;
  white-space: nowrap;
}

.course-name { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.site-header nav { display: flex; flex: 1; flex-wrap: wrap; gap: .45rem 1rem; }
.site-header nav a { color: var(--ink); font-size: .9rem; text-decoration: none; }
.site-header nav a:hover { color: var(--green); }
.manage-button { padding: .4rem .9rem; font-size: .9rem; text-decoration: none; }
.account { position: relative; color: var(--muted); white-space: nowrap; }
.account summary { cursor: pointer; list-style: none; font-weight: 600; color: var(--ink); }
.account summary::-webkit-details-marker { display: none; }
.account summary::after { content: " \25BE"; }
.account-menu { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 10; display: grid; gap: .6rem; min-width: 11rem; padding: .8rem 1rem; background: #fff; border: 1px solid #d9dfd6; border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.account-menu a { color: var(--ink); text-decoration: none; font-size: .9rem; }
.account-menu a:hover { color: var(--green); }
.account-menu form { margin: 0; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.image-grid figure { margin: 0; display: grid; gap: .4rem; align-content: start; }
.image-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid #d9dfd6; }
.image-grid figcaption { display: grid; gap: .3rem; font-size: .85rem; overflow-wrap: anywhere; }
.image-grid figcaption form { margin: 0; }

.container { width: min(1160px, calc(100% - 2rem)); margin: 2rem auto 4rem; }
.site-footer { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 1.4rem; color: var(--muted); text-align: center; border-top: 1px solid var(--line); }
.footer-brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); text-decoration: none; font-size: .9rem; }
.footer-brand img { display: block; height: 28px; width: auto; }
.footer-name { color: var(--ink); font-weight: 700; letter-spacing: .01em; }
.footer-brand:hover .footer-name { color: var(--green); text-decoration: underline; }

h1, h2, h3 { color: var(--ink); line-height: 1.2; }
h1 { margin: 0 0 .5rem; font-size: clamp(1.8rem, 3vw, 2.45rem); letter-spacing: -.035em; }
h2 { margin: 0 0 1rem; font-size: 1.2rem; }
p { margin: .4rem 0 1rem; }

.page-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.page-heading { margin: 0 0 1.4rem; }
.page-heading p { color: var(--muted); }
.eyebrow { margin: 0 0 .35rem; color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }

.card {
  margin: 0 0 1.2rem;
  padding: clamp(1rem, 2.2vw, 1.5rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 18px rgb(24 57 47 / 4%);
}

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.metric { display: grid; gap: .3rem; }
.metric span, .metric a { color: var(--muted); font-size: .88rem; }
.metric strong { color: var(--green-dark); font-size: 2rem; }
.quick-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.quick-link { display: grid; gap: .4rem; color: var(--ink); text-decoration: none; }
.quick-link strong { color: var(--green); font-size: 1.05rem; }
.quick-link span { color: var(--muted); }
.section-heading { margin-bottom: .7rem; }
.section-heading h2 { margin: 0; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: .55rem 1rem;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

button:hover, .button:hover { color: #fff; background: var(--green-dark); border-color: var(--green-dark); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button.danger { background: var(--danger); border-color: var(--danger); }
.button.small { min-height: 2rem; padding: .3rem .7rem; font-size: .84rem; }
.link-button { min-height: auto; padding: 0; color: var(--green); background: transparent; border: 0; font-weight: 600; }
.link-button:hover { color: var(--green-dark); background: transparent; text-decoration: underline; }
.row-actions, td form.inline-form { display: flex; flex-wrap: nowrap; gap: .5rem; align-items: center; }
.row-actions form, td form.inline-form { margin: 0; }
.row-actions .button, td form.inline-form button { width: auto; white-space: nowrap; }

label { display: grid; align-content: start; gap: .35rem; color: var(--ink); font-size: .9rem; font-weight: 650; }
input, select, textarea {
  width: 100%;
  min-height: 2.5rem;
  padding: .55rem .65rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c8d5ce;
  border-radius: 6px;
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgb(35 99 71 / 15%); border-color: var(--green); }
input[type="checkbox"] { width: 1rem; min-height: 1rem; accent-color: var(--green); }
fieldset { min-width: 0; margin: 0; padding: .85rem; border: 1px solid var(--line); border-radius: 8px; }
legend { padding: 0 .3rem; color: var(--ink); font-size: .9rem; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.span-all { grid-column: 1 / -1; }
.checkbox-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem 1rem; }
.picker-tools { display: flex; gap: 1rem; align-items: center; margin-bottom: .75rem; }
.picker-tools input { flex: 1; }
.member-list { max-height: 20rem; overflow-y: auto; padding: .25rem; }
.check[hidden], [hidden] { display: none !important; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 450; }
.check input { width: auto; flex: none; }
.form-grid > .check { align-self: end; min-height: 2.5rem; }
.hint { margin: -.25rem 0 0; font-size: .85rem; }
.hole-nav { display: flex; gap: .5rem; flex-wrap: wrap; }
.hole-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.hole-image img { display: block; width: 100%; max-height: 28rem; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.hole-placeholder { display: grid; place-items: center; min-height: 14rem; color: var(--muted); background: #f3f6f1; border: 1px dashed var(--line); border-radius: 8px; text-align: center; padding: 1rem; }
.hole-details { white-space: pre-wrap; }
.login-card { max-width: 510px; margin: clamp(2rem, 10vh, 7rem) auto; padding: clamp(1.4rem, 5vw, 2.5rem); }
.login-card .button { width: 100%; margin: 1rem 0; }

.alert { margin: 0 0 1rem; padding: .8rem 1rem; color: #7a2525; background: #fff1f0; border: 1px solid #efc6c2; border-radius: 7px; }
.alert:empty { display: none; }
.notice { margin: 0 0 1rem; padding: .8rem 1rem; color: #1f5130; background: #edf7ee; border: 1px solid #bfdcc4; border-radius: 7px; }
.badge { display: inline-block; vertical-align: middle; margin-left: .4rem; padding: .15rem .6rem; font-size: .75rem; font-weight: 600; color: var(--green); background: #edf7ee; border: 1px solid #bfdcc4; border-radius: 999px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1rem; margin: .6rem 0; }
.badge.full, .badge.blocked, .alert-badge { color: #7a2525; background: #fff1f0; border-color: #efc6c2; }
.badge.mine { color: #1d3f73; background: #eaf1fb; border-color: #bcd0ec; }
.sheet-nav { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; margin-bottom: 1rem; }
.sheet-nav .inline-form { margin: 0; }
.tee-sheet .inline-form { display: inline-flex; margin: 0 0 0 .5rem; }
.slot-past, .slot-beyond { opacity: .6; }
.slot-blocked { background: #fbf3f2; }
.slot-mine { background: #f1f6fd; }
.plain-list { margin: 0; padding: 0; list-style: none; }
.calendar-grid { table-layout: fixed; min-width: 42rem; }
.calendar-grid th { text-align: center; }
.calendar-grid td { height: 6.5rem; padding: .3rem; vertical-align: top; border: 1px solid var(--line); }
.calendar-grid td.out-month { background: #f7f7f5; opacity: .6; }
.calendar-grid td.today { outline: 2px solid var(--green); outline-offset: -2px; }
.calendar-title { align-self: center; min-width: 9rem; text-align: center; }
.day-number { font-weight: 600; text-decoration: none; }
.cal-event { margin-top: .2rem; padding: .1rem .3rem; font-size: .72rem; line-height: 1.25; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; }
.cal-booking { color: #1d3f73; background: #eaf1fb; }
.cal-closure { color: #7a2525; background: #fff1f0; }
.feed-url { width: 100%; }
.plain-list li { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.passcode { font-size: 1.4rem; letter-spacing: .2em; }
.score-table th, .score-table td { text-align: center; white-space: nowrap; }
.score-table td:first-child, .score-table th:first-child { text-align: left; }
.score-input { width: 3.2rem; padding: .3rem; text-align: center; }
.picker-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.picker-row { display: flex; align-items: flex-end; gap: .6rem; }
.picker-row label { flex: 1; min-width: 0; }
.picker-row button { flex: none; }
.guest-row { display: grid; grid-template-columns: 2fr 1fr; gap: .6rem; margin-bottom: .5rem; }
@media (max-width: 700px) { .guest-row { grid-template-columns: 1fr; } }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .7rem .65rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .77rem; letter-spacing: .04em; text-transform: uppercase; }
td form { margin: 0; }
.course-editor { min-width: 980px; margin-bottom: 1rem; }
.course-editor input { min-width: 4.4rem; padding: .35rem; }
.course-editor td:nth-child(2) input { min-width: 9rem; }
.link-list { padding-left: 1.2rem; }

@media (max-width: 850px) {
  .site-header { flex-wrap: wrap; gap: .55rem 1rem; }
  .site-header nav { order: 3; flex-basis: 100%; flex-wrap: wrap; gap: .4rem; }
  .site-header nav a { flex: none; padding: .45rem .8rem; background: var(--canvas); border: 1px solid var(--line); border-radius: 999px; }
  .manage-button { margin-left: auto; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .container { width: min(100% - 1rem, 1160px); margin-top: 1rem; margin-bottom: 2rem; }
  .site-header { padding: .6rem .75rem; min-height: 0; }
  .brand { margin-right: auto; }
  .manage-button { margin-left: 0; }
  .page-heading, .section-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid, .quick-links, .form-grid, .checkbox-grid, .picker-controls, .hole-layout { grid-template-columns: 1fr; }
  .span-all { grid-column: auto; }
  .course-name { display: none; }
  .card { padding: .9rem; border-radius: 10px; }
  .metric strong { font-size: 1.6rem; }
  input, select, textarea { font-size: 16px; min-height: 2.8rem; }
  input[type="checkbox"] { width: 1.2rem; min-height: 1.2rem; }
  .check { min-height: 2.6rem; }
  button, .button { min-height: 2.8rem; }
  .button.small { min-height: 2.4rem; }
  form > button[type="submit"], .form-grid button[type="submit"], .inline-form button, .inline-form .button { width: 100%; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form label { width: 100%; }
  td form.inline-form { flex-direction: row; }
  td form.inline-form button, td .row-actions .button { width: auto; }
  .picker-row { align-items: stretch; flex-direction: column; }
  .picker-row button { width: 100%; }
  .account-menu { right: -.25rem; }
  .table-wrap { margin: 0 -.9rem; padding: 0 .9rem; }
  table { font-size: .85rem; }
  th, td { padding: .55rem .45rem; }
  .score-input { width: 2.9rem; min-height: 2.6rem; padding: .2rem; }
  .score-table td:first-child, .score-table th:first-child { position: sticky; left: 0; z-index: 1; background: var(--paper); box-shadow: 1px 0 0 var(--line); }
  .course-editor { min-width: 760px; }
  .page-heading > .button { width: 100%; }
  .hole-nav .button { flex: 1; }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .login-card { margin: 1.5rem auto; }
}

.condition-banner { margin: 0 0 1rem; padding: .7rem 1rem; color: #6b4a00; background: #fff6dc; border: 1px solid #ecd48a; border-radius: 7px; display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.condition-banner.severe { color: #7a2525; background: #fff1f0; border-color: #efc6c2; }
.condition-banner strong { margin-right: .25rem; }
.badge.ok { color: var(--green); }
.badge.slow { color: #6b4a00; background: #fff6dc; border-color: #ecd48a; }
.badge.late { color: #7a2525; background: #fff1f0; border-color: #efc6c2; }
.badge.waiting { color: var(--muted); background: #f3f6f4; border-color: var(--line); }
.club-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; justify-content: center; margin-bottom: .4rem; }
.offline-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; padding: .6rem 1rem; color: #fff; background: var(--green-dark); text-align: center; }
.offline-banner:empty { display: none; }
.pace-form { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: .2rem 0; }
.pace-form select, .pace-form input { min-height: 2rem; width: auto; }
.print-only { display: none; }
@media print {
  .site-header, .site-footer, .no-print, .sheet-nav, .row-actions, .offline-banner { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
  table { font-size: 11pt; }
}

/* ---------- Polish layer ---------- */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { display: flex; flex-direction: column; min-height: 100vh; -webkit-font-smoothing: antialiased; }
main.container { flex: 1 0 auto; width: min(1160px, calc(100% - 2rem)); }
.site-footer { flex-shrink: 0; margin-top: auto; background: var(--paper); }
:focus-visible { outline: 3px solid rgb(35 99 71 / 40%); outline-offset: 2px; border-radius: 4px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }
::selection { background: var(--accent); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

.skip-link { position: absolute; left: .5rem; top: -4rem; z-index: 100; padding: .6rem 1rem; color: #fff; background: var(--green-dark); border-radius: 6px; text-decoration: none; }
.skip-link:focus { top: .5rem; color: #fff; }

.site-header { position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 var(--line), 0 6px 16px rgb(24 57 47 / 4%); }
.site-header nav a { position: relative; padding: .35rem .15rem; border-bottom: 2px solid transparent; font-weight: 500; transition: color .15s, border-color .15s; }
.site-header nav a:hover { border-bottom-color: var(--accent); }
.site-header nav a.active { color: var(--green); font-weight: 700; border-bottom-color: var(--green); }
.manage-button.current { background: var(--green-dark); }
.alert-badge { margin-left: .25rem; }
.account summary { padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--canvas); }
.account[open] summary { border-color: var(--green); }
.account-menu { gap: 0; padding: .4rem; min-width: 12rem; border-color: var(--line); border-radius: 10px; }
.account-menu a, .account-menu .link-button { display: block; width: 100%; padding: .55rem .7rem; border-radius: 6px; text-align: left; font-size: .9rem; color: var(--ink); text-decoration: none; }
.account-menu a:hover, .account-menu .link-button:hover { background: var(--canvas); color: var(--green); text-decoration: none; }
.account-menu form { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0 0 1rem; font-size: .88rem; color: var(--muted); }
.breadcrumb a { text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { text-decoration: underline; }

h1 { font-size: clamp(1.6rem, 3vw, 2.15rem); }
.group-title { margin: 1.8rem 0 .8rem; padding-bottom: .4rem; font-size: .8rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.page-heading { flex-wrap: wrap; align-items: flex-start; }
.page-heading > .button, .page-heading > div.no-print { flex-shrink: 0; }
.page-heading p { margin-bottom: 0; max-width: 60ch; }

.card { transition: box-shadow .15s, border-color .15s; }
a.card.quick-link:hover { border-color: var(--green); box-shadow: 0 6px 22px rgb(24 57 47 / 10%); transform: translateY(-1px); }
a.card.quick-link { transition: box-shadow .15s, border-color .15s, transform .15s; }
a.card.quick-link strong::after { content: " \2192"; opacity: 0; transition: opacity .15s; }
a.card.quick-link:hover strong::after { opacity: 1; }
.metric-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 0; }
.dashboard-grid .card, .quick-links .card { margin-bottom: 0; }
.quick-links { margin-bottom: 1.2rem; }
.dashboard-grid { margin-bottom: 1rem; }
.section-heading a { font-size: .88rem; font-weight: 600; text-decoration: none; }
.section-heading a:hover { text-decoration: underline; }
.empty { display: grid; gap: .7rem; justify-items: start; padding: .4rem 0; color: var(--muted); }
.empty p { margin: 0; }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.error-card { max-width: 38rem; margin: clamp(1.5rem, 8vh, 5rem) auto; text-align: left; }
.small-print { margin: .2rem 0 0; font-size: .85rem; text-align: center; }
.login-card { text-align: center; }
.login-card .eyebrow { font-size: .8rem; }

.alert, .notice { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; border-radius: 8px; }
.alert.notice { display: block; color: #1f5130; background: #edf7ee; border-color: #bfdcc4; }
.alert.error { color: #7a2525; background: #fff1f0; border-color: #efc6c2; }
.alert code { display: inline-block; margin-top: .3rem; padding: .3rem .5rem; background: #fff; border: 1px solid var(--line); border-radius: 5px; word-break: break-all; user-select: all; }

button:disabled, .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.is-submitting button[type="submit"] { opacity: .65; cursor: progress; }
button, .button { transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.button.secondary:hover { color: var(--green-dark); background: var(--canvas); border-color: var(--green); }
.button.danger:hover { background: #7f2626; border-color: #7f2626; }
input::placeholder, textarea::placeholder { color: #93a39b; }
textarea { min-height: 6rem; resize: vertical; }
input[type="file"] { padding: .4rem; }
code { padding: .1rem .35rem; font-size: .85em; background: var(--canvas); border: 1px solid var(--line); border-radius: 4px; }

table { border-radius: 8px; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #f8fbf9; }
tbody tr:last-child td { border-bottom: 0; }
thead th { position: sticky; top: 0; background: var(--paper); border-bottom: 2px solid var(--line); white-space: nowrap; }
.calendar-grid tbody tr:hover, .score-table tbody tr:hover { background: transparent; }
.badge { margin-left: 0; white-space: nowrap; }
td .badge, li .badge { margin-left: .3rem; }
.badge.ok { background: #edf7ee; }
small.muted { font-size: .82rem; }

.plain-list li:last-child { border-bottom: 0; }

@media (max-width: 850px) {
  .site-header { position: static; }
  .site-header nav a { border-bottom: 1px solid var(--line); padding: .45rem .8rem; }
  .site-header nav a.active { color: #fff; background: var(--green); border-color: var(--green); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .metric-grid.two { grid-template-columns: 1fr; }
  .site-header nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .3rem; scrollbar-width: thin; }
  .site-header nav a { white-space: nowrap; }
  .account-menu { right: 0; }
  .page-heading > .button, .page-heading > div.no-print { width: 100%; }
  .page-heading > div.no-print .button { width: 100%; }
  .button-row .button { flex: 1; }
  .offline-banner { font-size: .9rem; }
  .container { padding-bottom: 3rem; }
}
@media print {
  .breadcrumb, .skip-link, .condition-banner { display: none !important; }
  .site-header { position: static; box-shadow: none; }
  thead th { position: static; }
}