:root {
  --bg: #f3f2ed;          /* warm off-white page */
  --card: #ffffff;
  --fg: #1f2925;
  --heading: #1e3329;     /* green-tinted near-black, like the reference headings */
  --muted: #5f6964;       /* 5.7:1 on white */
  --line: #e1e3de;
  --field: #d9dcd6;
  --accent: #2a5c4a;      /* 7.3:1 against white text */
  --accent-hover: #224b3c;
  --tint: #e5efe9;
  --danger: #a12b2b;
  --danger-tint: #fcefee;
  --warn-bg: #fff5d9;
  --warn-fg: #6d4c00;
  --off-bg: #f6f6f3;
  --off-fg: #a9aeab;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
main { max-width: calc(640px + 32px); margin: 0 auto; padding: 16px 16px 48px; }
a { color: var(--accent); }
h1, h2 { margin: 0; line-height: 1.3; color: var(--heading); }
p { margin: 0; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Icons */
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.big { width: 48px; height: 48px; stroke-width: 1.6; color: var(--accent); }

/* Header */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: inherit; text-decoration: none; border-radius: 10px; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; flex: none; }
.mark { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { display: grid; line-height: 1.25; }
.brand-name { font-weight: 500; font-size: 1.15rem; color: var(--heading); }
.tagline { font-size: .72rem; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.header-icon { color: var(--accent); display: grid; }
.header-icon .icon { width: 22px; height: 22px; }

/* Intro */
.intro { margin-bottom: 14px; }
.intro h1 { font-size: 1.2rem; font-weight: 600; }
.lede { color: var(--muted); font-size: .9rem; margin-top: 10px; }

/* Card */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: 0 1px 2px rgba(31, 41, 37, .03); }
.card > h1 { font-size: 1.25rem; font-weight: 600; margin-bottom: 12px; }

/* Steps */
.step { border: 0; margin: 0; padding: 0; min-width: 0; }
.step + .step { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.step h2 { font-size: 1rem; font-weight: 600; }
#step-times h2 { margin-bottom: 12px; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--tint); color: var(--accent); display: grid; place-items: center; flex: none; }
.step-icon .icon { width: 17px; height: 17px; }
.step-title { flex: 1; min-width: 0; display: grid; }
.month { font-size: .78rem; color: var(--muted); min-height: 1.2em; }
.week-nav { display: flex; gap: 0; margin-right: -8px; }
.nav-btn {
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent;
  color: var(--heading); display: grid; place-items: center; cursor: pointer; min-height: 0;
}
.nav-btn:hover:not(:disabled) { background: var(--tint); color: var(--accent); }
.nav-btn:disabled { color: var(--off-fg); cursor: default; }

/* Date cells */
.days { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.day {
  min-height: 62px; padding: 6px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  color: var(--heading); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.day .dow { font-size: .75rem; text-transform: uppercase; color: var(--muted); }
.day .dnum { font-size: .95rem; font-weight: 700; line-height: 1.2; }
.day:hover:not(:disabled) { border-color: var(--accent); }
.day[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.day[aria-pressed="true"] .dow { color: rgba(255, 255, 255, .85); }
.day:disabled { background: var(--off-bg); color: var(--off-fg); cursor: not-allowed; }
.day:disabled .dow { color: var(--off-fg); }
.day:disabled .dnum { font-weight: 500; }
.days-msg { grid-column: 1 / -1; color: var(--muted); padding: 12px 0; }

/* Time chips */
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  color: var(--heading); font: inherit; font-size: .9rem; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--tint); border-color: var(--accent); color: var(--heading); }
.slots-msg { color: var(--muted); font-size: .9rem; }
.note-tz { color: var(--muted); font-size: .8rem; margin-top: 12px; }

/* Form */
#details { display: grid; gap: 14px; }
label { display: grid; gap: 8px; font-size: .9rem; color: var(--fg); }
.optional { color: var(--muted); }
input, textarea, select {
  font: inherit; font-size: 16px; color: inherit; width: 100%; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--field); border-radius: 8px; background: #fff;
}
input::placeholder, textarea::placeholder { color: #9aa19d; }
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.session-type { margin-bottom: 20px; }
.chosen { color: var(--accent); font-size: .9rem; font-weight: 600; }
.chosen.empty { color: var(--muted); font-weight: 400; }
#error { color: var(--danger); background: var(--danger-tint); font-weight: 600; font-size: .9rem; padding: 10px 12px; border-radius: 8px; }
#error:empty { display: none; }
/* Messages next to the step they are about, so they show where the client is looking on a phone. */
.inline-error { margin-top: 10px; color: var(--danger); background: var(--danger-tint); font-weight: 600; font-size: .9rem; padding: 8px 12px; border-radius: 8px; }
.inline-error:empty { display: none; }
.cf-turnstile { min-height: 65px; }

/* Buttons */
button, .button {
  font: inherit; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--heading); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { border-color: var(--danger); color: var(--danger); font-weight: 600; }
button.danger:hover { background: var(--danger-tint); }
button:disabled { cursor: default; }
button.primary:disabled { opacity: .6; }
.wide { width: 100%; min-height: 50px; font-size: 1.05rem; }
.footnote { color: var(--muted); font-size: .78rem; text-align: center; margin-top: -4px; }

/* Success */
.success { text-align: center; display: grid; justify-items: center; gap: 10px; padding: 28px 18px; }
.success h2 { font-size: 1.2rem; font-weight: 600; }
.success p { max-width: 30rem; }

/* Booking pages for the worker and client */
.status { display: inline-block; font-weight: 600; padding: 6px 12px; border-radius: 8px; background: var(--off-bg); color: #3f4743; }
.status-pending { background: var(--warn-bg); color: var(--warn-fg); }
.status-confirmed { background: var(--tint); color: var(--accent); }
.warning { background: var(--warn-bg); color: var(--warn-fg); padding: 10px 12px; border-radius: 8px; margin-top: 12px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 16px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; color: var(--heading); }
.note { white-space: pre-line; font-weight: 400; }
.actions { display: grid; gap: 10px; margin-top: 20px; }
.actions:empty { display: none; }
.actions form { margin: 0; }
.actions button, .actions .button { width: 100%; min-height: 50px; font-size: 1.05rem; }

/* Week | Month toggle */
.view-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--off-bg); }
.toggle-btn { min-height: 40px; padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .9rem; font-weight: 600; }
.toggle-btn[aria-pressed="true"] { background: var(--card); color: var(--heading); box-shadow: 0 1px 2px rgba(31, 41, 37, .1); }

/* Days with times: tinted, so they stand out from the grey days without any. */
.day.open { background: var(--tint); border-color: #c9dccf; }
.day.open .dnum { color: var(--accent); }
.day.open[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.day.open[aria-pressed="true"] .dnum { color: #fff; }

/* Month grid: no gaps, and it bleeds 6px into the card padding, so seven ~46px cells fit a 375px screen
   (inner card width ~313px + 12px). Cells are tall with big numbers so they're easy to read and tap. */
.days.month { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; margin: 0 -6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.days.month .dow-head { padding: 8px 0; text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--off-bg); border-bottom: 1px solid var(--line); }
.days.month .day { position: relative; min-height: 56px; padding: 0; border: 0; border-radius: 0; box-shadow: inset -1px -1px 0 var(--line); }
.days.month .dnum { font-size: 18px; }
.days.month .day:disabled { background: var(--off-bg); }
.days.month .day.open::after { content: ""; position: absolute; bottom: 8px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--accent); }
.days.month .day.open[aria-pressed="true"]::after { background: #fff; }
.days.month .day:hover:not(:disabled) { box-shadow: inset 0 0 0 2px var(--accent); }
.days.month .day[aria-pressed="true"] { box-shadow: none; }
.days.month .day:focus-visible { outline-offset: -3px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-size: .8rem; color: var(--muted); }
.key { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); vertical-align: -2px; }
.key-open { background: var(--tint); border-color: #c9dccf; }
.key-off { background: var(--off-bg); }

/* Support type, length and how often */
.type-list { display: grid; gap: 8px; margin: 12px 0 14px; }
.type-option { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 1rem; color: var(--heading); }
.type-option input { width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--accent); }
.type-option:has(input:checked) { border-color: var(--accent); background: var(--tint); font-weight: 600; }
.repeat-fields { margin-bottom: 12px; }

/* Specific time and the date check */
.link-button { margin-top: 12px; padding: 8px 0; border: 0; background: none; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.specific { display: grid; gap: 12px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--off-bg); }
.specific button { justify-self: start; }
.wide-row { flex-basis: 100%; }
.preview { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.preview li { display: flex; gap: 10px; align-items: baseline; }
.preview .mark { width: 1.2em; flex: none; font-weight: 700; }
.preview .ok .mark { color: var(--accent); }
.preview .no { color: var(--muted); }
.preview .no .mark { color: var(--danger); }
.preview .summary { display: block; margin-top: 6px; font-weight: 600; color: var(--heading); }
.group-title { margin-top: 16px; }
.group-list { margin-top: 8px; }
.group-list .row { grid-template-columns: 1fr; }

/* Admin */
.admin { display: grid; gap: 16px; }
/* Six sections: wrap onto two lines on a phone rather than scroll sideways. */
.admin-nav { display: flex; flex-wrap: wrap; gap: 4px; margin: -6px 0 16px; }
.admin-nav a { flex: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 10px; color: var(--heading); text-decoration: none; font-weight: 600; font-size: .9rem; }
.admin-nav a[aria-current="page"] { background: var(--tint); color: var(--accent); }
.card h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 10px; }
.card h3 { font-size: .95rem; font-weight: 600; margin: 4px 0 0; color: var(--heading); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h1, .card-head h2 { margin: 0; }
.banner { background: var(--warn-bg); color: var(--warn-fg); padding: 12px 14px; border-radius: 10px; font-weight: 600; }
.banner a { color: inherit; }
.notice { background: var(--tint); color: var(--accent); padding: 10px 12px; border-radius: 8px; font-weight: 600; }
.form-errors { color: var(--danger); background: var(--danger-tint); padding: 10px 12px; border-radius: 8px; font-size: .9rem; }
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }
.muted { color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.row-main { display: grid; gap: 2px; color: inherit; text-decoration: none; min-height: 44px; }
.row-main strong { color: var(--heading); }
.row-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row-actions form { margin: 0; }
.row-actions button { width: 100%; }
.row-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.day-heading { font-size: .8rem; color: var(--muted); font-weight: 600; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .02em; }
.tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { flex: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--off-bg); color: #3f4743; }
.badge-pending { background: var(--warn-bg); color: var(--warn-fg); }
.badge-confirmed { background: var(--tint); color: var(--accent); }
.status-line { font-size: .9rem; }
.status-line a { color: var(--muted); }
.status-line.attention a { color: var(--danger); font-weight: 600; }
.trail { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: .9rem; }
.bad { color: var(--danger); font-weight: 600; }
.admin form.section { display: grid; gap: 14px; }
.day-hours { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; display: grid; gap: 8px; min-width: 0; }
.day-hours legend { font-weight: 600; color: var(--heading); padding: 0 4px; }
.ranges { display: grid; gap: 8px; }
.range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 44px; gap: 6px; align-items: center; }
.range span { color: var(--muted); font-size: .85rem; }
.remove-range { padding: 0; width: 44px; }
.add-range { justify-self: start; }
label.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
label.check input { width: 22px; height: 22px; min-height: 0; flex: none; }
.type-row { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.type-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; color: var(--muted); }
.fields-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.fields-2 input { min-width: 0; }
.override-list .row { grid-template-columns: 1fr auto; align-items: center; }
.override-list form { margin: 0; }
.warning ul { margin: 6px 0 0; padding-left: 18px; }

/* Privacy page */
.prose h2 { margin: 18px 0 6px; }
.prose p, .prose li { margin: 0 0 8px; }
.prose ul { padding-left: 20px; margin: 0 0 8px; }

/* Support type pages, clients and the weekly summary */
.remove-type { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.week-title { font-weight: 600; color: var(--heading); margin-bottom: 12px; }
.week-nav-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.pick-week { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-bottom: 12px; }
.links { margin-bottom: 10px; font-weight: 600; }
.client-week h2 { margin-bottom: 2px; }
.client-week > .muted { margin-bottom: 10px; overflow-wrap: anywhere; }
/* Plain tables copy cleanly into a document; on a phone the table scrolls inside its card, not the page. */
.sessions { display: block; overflow-x: auto; border-collapse: collapse; width: 100%; font-size: .9rem; margin-bottom: 12px; }
.sessions th, .sessions td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
.sessions thead th { color: var(--muted); font-weight: 600; }
.sessions tfoot th, .sessions tfoot td { font-weight: 700; border-bottom: 0; }
.week-total { font-weight: 700; color: var(--heading); }
.invoiced { color: var(--accent); font-weight: 600; }
.mark-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.mark-row form { margin: 0; }
.mark-form { display: grid; gap: 10px; }
.mark-form button { justify-self: start; }

@media print {
  body { background: #fff; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .site-header, .admin-nav, .no-print, form, .notice { display: none !important; }
  .card { border: 0; box-shadow: none; padding: 0 0 12pt; break-inside: avoid; }
  .admin { gap: 8pt; }
  .sessions { display: table; overflow: visible; }
  a { color: inherit; text-decoration: none; }
}

@media (min-width: 640px) {
  main { padding: 40px 16px 80px; }
  .card { padding: 20px; }
  .intro h1 { font-size: 1.3rem; }
  .days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
}
