/*
 * One stylesheet for the whole site.
 *
 * Light first: the booking page is read on a customer's phone, often in a
 * hurry, and the board is read on a phone in a van or on a doorstep in
 * daylight. Dark is designed too, not inverted, and follows the system. Every
 * control is at least 48 px tall — gloves, dirty hands, one thumb.
 */
:root {
  color-scheme: light;
  --ink: #17202a;
  --bg: #f5f6f3;
  --panel: #ffffff;
  --raise: #eceee9;
  --line: #d9ddd5;
  --muted: #5a6470;
  --accent: #1f4e79;
  --accent-ink: #ffffff;
  --soft: #e3ecf5;
  --amber: #f2a33a;
  --good: #1d7a43;
  --good-soft: #e0f2e6;
  --bad: #b3261e;
  --bad-soft: #fbe3e0;
  --warn: #8a5a00;
  --warn-soft: #fbf0d6;
  --radius: 14px;
  --tap: 48px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #e9edf1;
    --bg: #0f1418;
    --panel: #172027;
    --raise: #1f2a33;
    --line: #2e3a44;
    --muted: #9eabb7;
    --accent: #7fb3e6;
    --accent-ink: #0b1a28;
    --soft: #1c2f42;
    --amber: #f2b85e;
    --good: #7fcf9a;
    --good-soft: #1b3123;
    --bad: #f08f86;
    --bad-soft: #3d1f1c;
    --warn: #f0c76a;
    --warn-soft: #3a2f14;
  }
}

* { box-sizing: border-box; }
/* `hidden` must win over every display rule below. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
h1 { font-size: clamp(26px, 5vw, 40px); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 10px; }
h2 { font-size: 20px; margin: 28px 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 16px; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.lede { font-size: 18px; color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--bad); }
.ok { color: var(--good); }

/* ── Frame ──────────────────────────────────────────────────────────── */

.masthead {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 10;
}
.wordmark { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; font-size: 18px; }
.wordmark img { width: 28px; height: 28px; }
.masthead nav { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.masthead nav a { color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.masthead nav a[aria-current="page"], .masthead nav a:hover { color: var(--ink); background: var(--raise); }

main { max-width: 760px; margin: 0 auto; padding: 24px 18px 40px; }
main.wide { max-width: 1180px; }

.tabbar { display: none; }
@media (max-width: 760px) {
  .masthead nav.app { display: none; }
  body.app { padding-bottom: 72px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--panel); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 60px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600;
  }
  .tabbar a span { font-size: 20px; line-height: 1; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
}

.siteftr { border-top: 1px solid var(--line); padding: 22px 18px 30px; color: var(--muted); font-size: 14px; text-align: center; }
.siteftr nav { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.siteftr button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 4px; min-height: auto; text-decoration: underline; }

/* ── Controls ───────────────────────────────────────────────────────── */

label { display: block; font-weight: 600; margin: 14px 0 6px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 14px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: var(--tap);
}
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); vertical-align: middle; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: 0;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 750;
  cursor: pointer; text-decoration: none; touch-action: manipulation;
}
button.quiet, .button.quiet { background: var(--raise); color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad); }
button.big { min-height: 60px; font-size: 18px; width: 100%; }
button:disabled { opacity: .55; cursor: default; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 12px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 640px) { .two, .three { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 8px; }

/* ── Lists and cards ────────────────────────────────────────────────── */

.list { list-style: none; padding: 0; margin: 0; }
.list > li {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; min-height: 60px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px;
}
.list > li a.fill { color: inherit; text-decoration: none; flex: 1; min-width: 0; }
.list .when { font-variant-numeric: tabular-nums; font-weight: 750; min-width: 52px; }
.list .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { color: var(--muted); font-size: 14px; }

.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--raise); flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--muted); }
.avatar.big { width: 88px; height: 88px; font-size: 28px; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.good { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.pill.warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.pill.bad { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.pill.accent { color: var(--accent); border-color: var(--accent); background: var(--soft); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat .n { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.chips button { min-height: 40px; white-space: nowrap; }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips button[aria-pressed="false"] { background: var(--raise); color: var(--ink); border: 1px solid var(--line); }

.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 12px 0; }
.slots button { min-height: 56px; font-size: 18px; font-variant-numeric: tabular-nums; }

.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); padding: 18px; width: min(560px, 94vw); max-height: 90vh; }
dialog::backdrop { background: rgb(0 0 0 / .6); }

/* ── The booking page ─────────────────────────────────────────────────── */

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 8px 0; }
.choice { display: flex; flex-direction: column; gap: 2px; text-align: left; align-items: flex-start; padding: 12px 14px; min-height: 64px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; font-weight: 600; }
.choice small { color: var(--muted); font-weight: 500; }
.choice[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--soft); }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 8px 0; }
.cal .dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.cal button { min-height: 56px; padding: 4px; flex-direction: column; gap: 0; font-size: 16px; font-variant-numeric: tabular-nums;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.cal button small { font-size: 11px; font-weight: 600; color: var(--muted); }
.cal button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cal button[aria-pressed="true"] small { color: var(--accent-ink); }
.cal button:disabled { opacity: .4; text-decoration: line-through; }
.cal .gap { min-height: 56px; }

.photo-preview { max-width: 220px; max-height: 220px; border-radius: 12px; border: 1px solid var(--line); display: block; margin-top: 8px; }

.total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 750; padding: 12px 0; border-top: 1px solid var(--line); }

/* ── The marketing page ─────────────────────────────────────────────── */

.hero { padding: 24px 0 8px; }
.hero h1 { font-size: clamp(32px, 6vw, 52px); }
.cta { font-size: 18px; min-height: 56px; padding: 0 24px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.features .panel { margin: 0; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 8px; }

/* ── The invoice, on paper ──────────────────────────────────────────── */

@media print {
  .invoice { border: 0 !important; padding: 0 !important; }
  :root { --ink: #000; --bg: #fff; --panel: #fff; --line: #999; --muted: #333; --raise: #f2f2f2; }
  .masthead, .tabbar, .siteftr, .no-print { display: none !important; }
  body.app { padding-bottom: 0; }
  main { max-width: none; padding: 0; }
  .panel { border-color: #999; }
}

/* ── The board ──────────────────────────────────────────────────────── */

.board-section h2 { display: flex; align-items: baseline; gap: 10px; }
.board-section h2 .count { color: var(--muted); font-size: 15px; font-weight: 600; }
.day { margin-top: 18px; }
.day h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; }
.day.today h3 { color: var(--accent); }
.jobcard { flex-direction: column; align-items: stretch !important; gap: 4px !important; }
.jobcard .top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.jobcard .top .grow { font-weight: 700; }
.jobcard.urgent { border-left: 5px solid var(--bad); }
.warning { color: var(--bad); font-weight: 700; font-size: 14px; }

.answers { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 14px; }
.answers dt { color: var(--muted); font-size: 14px; }
.answers dd { margin: 0; font-weight: 600; }
@media (max-width: 640px) { .answers { grid-template-columns: 1fr; } .answers dd { margin-bottom: 6px; } }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

.lines { width: 100%; border-collapse: collapse; }
.lines th, .lines td { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.lines th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lines td.n, .lines th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines input, .lines select { min-height: 42px; padding: 8px; }
.lines .qty { width: 80px; }
.lines .price { width: 100px; }
.lines .kind { width: 120px; }
@media (max-width: 640px) {
  .lines.edit thead { display: none; }
  .lines.edit tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .lines.edit td { border: 0; padding: 0; }
  .lines.edit td.desc { grid-column: 1 / -1; }
  .lines.edit .qty, .lines.edit .price, .lines.edit .kind { width: 100%; }
}

.link-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-box code { font-size: 17px; font-weight: 700; padding: 10px 12px; background: var(--soft); border-radius: 10px; word-break: break-all; }

.invoice { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.invoice .head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.invoice h1 { font-size: 28px; }
