:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --border: #e4ddd2;
  --primary: #1f7a5a;
  --primary-ink: #ffffff;
  --accent: #e8b53c;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --heat-0: #efebe4;
  --heat-1: #cfe8dc;
  --heat-2: #93cfb3;
  --heat-3: #4fae83;
  --heat-4: #1f7a5a;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181a;
    --surface: #1d2326;
    --text: #eef2f1;
    --muted: #9aa7a3;
    --border: #2f3a3d;
    --primary: #3fb68b;
    --primary-ink: #08241a;
    --danger: #fda29b;
    --danger-bg: #3a1a17;
    --heat-0: #262e31;
    --heat-1: #25463a;
    --heat-2: #2f7358;
    --heat-3: #3a9a74;
    --heat-4: #5fd3a6;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main, .site-header, .site-footer { width: min(100% - 24px, 560px); margin-inline: auto; }
main { padding-bottom: 24px; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--primary); }
.muted, .hint { color: var(--muted); font-size: .9rem; }
.hint { margin: 0; }

.site-header { padding: 16px 0 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: var(--primary-ink); font-weight: 800; }
.site-footer { padding: 8px 0 32px; color: var(--muted); font-size: .85rem; }
.site-footer p { margin: 0 0 4px; }

.hero { padding: 16px 0 8px; }
.lead { font-size: 1.05rem; color: var(--muted); }
.event-head { padding: 8px 0; }
.event-head h1 { overflow-wrap: anywhere; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-weight: 600; font-size: .95rem; }
.field span { color: var(--text); }
input[type=text], input[type=date], input[type=password] {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-weight: 400;
  color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
input:focus-visible, .btn:focus-visible, .cell:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
details { border-top: 1px solid var(--border); padding-top: 10px; }
summary { cursor: pointer; font-weight: 600; min-height: 32px; }
details .field { margin-top: 10px; }
details .hint { margin-top: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.btn.primary { color: var(--primary-ink); background: var(--primary); border-color: var(--primary); }
.btn.whatsapp { color: #fff; background: #1a9c53; border-color: #1a9c53; width: 100%; margin-top: 10px; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.btn:active { transform: translateY(1px); }

.error { margin: 0; padding: 10px 12px; color: var(--danger); background: var(--danger-bg); border-radius: 10px; font-weight: 600; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }

.steps ol { padding-left: 20px; display: grid; gap: 6px; margin: 0; }

.shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.status { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.status.err { color: var(--danger); font-weight: 600; }
.live { margin-left: 6px; padding: 2px 8px; font-size: .75rem; font-weight: 700; color: var(--primary); border: 1px solid var(--primary); border-radius: 999px; }

.month { margin-bottom: 8px; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekdays { color: var(--muted); font-size: .75rem; font-weight: 700; text-align: center; margin-bottom: 4px; }
.cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 46px; padding: 0; font: inherit; font-weight: 600; color: var(--text);
  background: var(--heat-0); border: 2px solid transparent; border-radius: 10px;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.cell.empty { background: none; }
.cell small { font-size: .65rem; font-weight: 700; line-height: 1; opacity: .85; }

/* The picker: horizontal drags are ours, vertical drags still scroll the page. */
.pick { touch-action: pan-y; cursor: pointer; }
.pick[aria-pressed=true] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

.heat { cursor: pointer; }
.heat.l1 { background: var(--heat-1); }
.heat.l2 { background: var(--heat-2); }
.heat.l3 { background: var(--heat-3); color: #fff; }
.heat.l4 { background: var(--heat-4); color: #fff; }
@media (prefers-color-scheme: dark) { .heat.l3, .heat.l4 { color: #07251a; } }
.heat.best { border-color: var(--accent); }
.heat.selected { outline: 3px solid var(--text); outline-offset: 1px; }

.day-detail { margin: 12px 0 8px; padding: 10px 12px; background: var(--bg); border-radius: 10px; min-height: 44px; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; margin-bottom: 8px; }
.legend i { width: 18px; height: 18px; border-radius: 5px; background: var(--heat-0); }
.legend i.l1 { background: var(--heat-1); } .legend i.l2 { background: var(--heat-2); }
.legend i.l3 { background: var(--heat-3); } .legend i.l4 { background: var(--heat-4); }

.ranking { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.ranking li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.ranking li.best { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.ranking .when { font-weight: 700; }
.ranking .when::first-letter { text-transform: uppercase; }
.ranking .count { color: var(--primary); font-weight: 700; font-size: .9rem; }
.ranking .who { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.empty-state { padding: 16px; text-align: center; color: var(--muted); background: var(--bg); border-radius: 10px; }

@media (prefers-reduced-motion: no-preference) { .btn, .cell { transition: background-color .12s, border-color .12s; } }
