:root {
  --bg: #f6f7f4;
  --card: #ffffff;
  --ink: #1b2420;
  --muted: #5f6b66;
  --line: #e2e6e1;
  --green: #0f5e31;        /* La Valle logo green */
  --green-ink: #025f1d;    /* site primary green */
  --green-bright: #43b02a; /* site accent green */
  --green-soft: #e6f2ea;
  --clay: #025f1d;         /* primary action (site green) */
  --clay-soft: #fdeaea;
  --radius: 14px;
  --tap: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Libre Franklin", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 110px; }
header.hero {
  background: #fff;
  color: var(--ink);
  padding: 22px 16px 24px;
  border-bottom: 4px solid var(--green-ink);
}
header.hero img.logo { display: block; width: 190px; max-width: 60%; height: auto; margin: 0 0 16px; }
header.hero .wrap { padding: 0 16px; }
header.hero .eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--green-bright); margin: 0 0 6px; font-weight: 700; }
header.hero h1 { margin: 0 0 8px; font-size: 26px; line-height: 1.15; font-weight: 800; color: var(--green-ink); }
header.hero p { margin: 0; color: var(--muted); font-size: 15px; }
header.hero a { color: var(--green-ink); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
}
.card h2 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.card .hint { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
label.field small { color: var(--muted); font-weight: 400; }
input[type=text], input[type=tel], textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
textarea { min-height: 84px; resize: vertical; }

/* segmented control */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--tap); border-radius: 9px; font-weight: 700; font-size: 15px;
  color: var(--muted); cursor: pointer; user-select: none;
}
.seg input:checked + span { background: #fff; color: var(--green-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* day blocks */
.day { border-top: 1px solid var(--line); padding: 14px 0; }
.day:first-of-type { border-top: 0; padding-top: 4px; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.day-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.day-head .note { color: var(--muted); font-size: 13px; }
.day-actions { display: flex; gap: 6px; }
.day-actions button, .linkbtn {
  font: inherit; font-size: 13px; font-weight: 700; color: var(--green-ink);
  background: var(--green-soft); border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer;
  min-height: 32px;
}
.day-actions button.clear { background: transparent; color: var(--muted); }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (min-width: 420px) { .slots { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 560px) { .slots { grid-template-columns: repeat(8, 1fr); } }
.slot { position: relative; }
.slot input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; }
.slot span {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--tap); border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 14px; font-weight: 700; color: var(--muted); background: #fff;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.slot input:checked + span { background: var(--green-ink); border-color: var(--green-ink); color: #fff; }
.slot input:focus-visible + span { box-shadow: 0 0 0 3px var(--green-soft); }
.slot-count { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* weekend collapse */
details.weekend { border-top: 1px solid var(--line); padding-top: 12px; }
details.weekend summary {
  cursor: pointer; font-weight: 800; font-size: 16px; list-style: none; display: flex; align-items: center; gap: 8px; min-height: var(--tap);
}
details.weekend summary::-webkit-details-marker { display: none; }
details.weekend summary::after { content: "+"; margin-left: auto; font-size: 22px; color: var(--muted); }
details.weekend[open] summary::after { content: "–"; }
details.weekend summary small { color: var(--muted); font-weight: 400; font-size: 13px; }

/* sticky submit bar */
.submitbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(246,247,244,.92); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.submitbar .inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.submitbar .summary { flex: 1; font-size: 14px; color: var(--muted); }
.btn {
  font: inherit; font-weight: 800; font-size: 16px; color: #fff; background: var(--clay);
  border: 0; border-radius: 12px; padding: 0 22px; min-height: 50px; cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--green-ink); border: 2px solid var(--green-ink); }

.alert { border-radius: 10px; padding: 12px 14px; font-size: 15px; margin: 12px 0; }
.alert.error { background: var(--clay-soft); color: #a90707; }
.alert.ok { background: var(--green-soft); color: var(--green-ink); }

/* success screen */
.done { text-align: center; padding: 40px 12px; }
.done .ball { font-size: 56px; }
.done h2 { font-size: 24px; margin: 8px 0; }
.done p { color: var(--muted); }
.done .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.done .btn { width: 100%; }

/* results page */
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--line); }
.heat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table.heat { border-collapse: separate; border-spacing: 4px; min-width: 100%; }
table.heat th { font-size: 12px; color: var(--muted); font-weight: 700; text-align: center; padding: 2px 0; white-space: nowrap; }
table.heat th.day { text-align: left; position: sticky; left: 0; background: var(--card); padding-right: 8px; font-size: 14px; color: var(--ink); }
table.heat td { min-width: 40px; height: 40px; border-radius: 8px; text-align: center; font-weight: 800; font-size: 14px; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--muted); }
table.heat td.na { background: transparent; border-color: transparent; cursor: default; }
table.heat td.h1 { background: #d7ebe0; color: var(--green-ink); }
table.heat td.h2 { background: #a9d4bd; color: var(--green-ink); }
table.heat td.h3 { background: #43b02a; color: #fff; }
table.heat td.h4 { background: #2e8a3a; color: #fff; }
table.heat td.h5 { background: var(--green-ink); color: #fff; }
table.heat td.selected { outline: 3px solid var(--clay); }
.who { margin-top: 12px; font-size: 14px; }
.who b { display: block; margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--green-soft); color: var(--green-ink); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700; }
.chip.off { background: var(--bg); color: var(--muted); text-decoration: line-through; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.tabs button { font: inherit; font-weight: 700; font-size: 15px; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.tabs button.active { background: #fff; color: var(--green-ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.win { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.win:first-child { border-top: 0; }
.win .count { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 18px; background: var(--green); color: #fff; }
.win .count.partial { background: #a9d4bd; color: var(--green-ink); }
.win .meta { flex: 1; min-width: 0; }
.win .meta b { display: block; font-size: 15px; }
.win .meta span { font-size: 13px; color: var(--muted); }

.kids { display: grid; gap: 10px; }
.kid { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.kid b { font-size: 15px; }
.kid .sub { color: var(--muted); font-size: 13px; }
.kid .pref { float: right; font-size: 12px; font-weight: 800; background: var(--green-soft); color: var(--green-ink); border-radius: 999px; padding: 2px 8px; }
.kid p { margin: 6px 0 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
footer { text-align: center; font-size: 13px; color: var(--muted); padding: 20px; }
footer a { color: var(--green-ink); }
