/* greenhouse-surveys — one small stylesheet, no build step. */

:root {
  --paper: #f7f6f2;
  --ink: #1c1b18;
  --ink-soft: #5c5850;
  --line: #dcd8cf;
  --card: #ffffff;
  --accent: #2f5d50;
  --accent-ink: #24483e;
  --accent-soft: #e6efeb;
  --accent-wash: #eef4f1;
  --danger: #a33a2f;
  --danger-soft: #f8e6e3;
  --wa: #128c5b;
  --radius: 10px;
  --tap: 48px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: var(--accent); }
em { font-style: normal; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--accent); }
code { font-size: 0.92em; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}

.wrap--wide { max-width: 1100px; }

h1 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 32px 0 10px; }

.from { color: var(--ink-soft); font-size: 0.95rem; margin: 0 0 6px; }
.intro { margin: 0 0 8px; }
.consent { color: var(--ink-soft); font-size: 0.9rem; margin: 0 0 28px; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.9rem; }
.sign { color: var(--ink-soft); margin: 18px 0 0; }

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

/* Questions */
.q { margin: 0 0 34px; padding: 0; border: 0; min-width: 0; }
.q__label { float: left; width: 100%; font-weight: 600; font-size: 1.08rem; line-height: 1.35; margin: 0 0 8px; padding: 0; } /* float: legends otherwise render in the fieldset border, outside any panel */
.q__label + * { clear: both; }
.q__num { color: var(--ink-soft); font-weight: 500; margin-right: 6px; }
.q__opt { color: var(--ink-soft); font-weight: 500; font-size: 0.9rem; white-space: nowrap; }
.q__help { color: var(--ink-soft); font-size: 0.95rem; margin: -2px 0 12px; }
.q__error {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 10px;
  padding: 0 0 0 12px;
  border-left: 3px solid var(--danger);
}
.q--error .q__label { color: var(--danger); }

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 8px;
  min-height: var(--tap);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.card input { width: 22px; height: 22px; margin: 0; flex: 0 0 auto; accent-color: var(--accent); }
.card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.card:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.card input:focus-visible { outline: none; }

/* The price band is the one question we most need a clear answer to: give it its own panel. */
.q--band {
  background: var(--accent-wash);
  border: 1.5px solid var(--accent-soft);
  border-radius: 14px;
  padding: 18px 16px 10px;
}
.q--band .q__label { font-size: 1.15rem; }
.q--band .q__help { color: var(--accent-ink); font-weight: 500; }
.q--band .card { padding: 14px 16px; }
.q--band .card span:last-child { font-variant-numeric: tabular-nums; }

textarea, input[type="text"], input[type="tel"], input[type="password"], select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: var(--tap);
}
textarea { min-height: 96px; resize: vertical; }
textarea::placeholder, input::placeholder { color: #9a958b; }
textarea:focus, input:focus, select:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.field { margin: 10px 0 0; }
.field label { display: block; font-size: 0.92rem; color: var(--ink-soft); margin: 0 0 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 22px;
  min-height: var(--tap);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn--block { width: 100%; font-size: 1.1rem; min-height: 56px; }
.btn--ghost { background: transparent; color: var(--accent); font-weight: 500; }
.btn--ghost:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn--small { padding: 8px 14px; font-size: 0.92rem; min-height: 44px; }
.btn--danger { color: var(--danger); border-color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn--wa { background: var(--wa); border-color: var(--wa); color: #fff; font-weight: 600; }
.btn--wa:hover { background: #0e6f49; border-color: #0e6f49; }
.btn--wa svg { width: 18px; height: 18px; fill: currentColor; flex: 0 0 auto; }

.notice {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 10px 14px;
  border-radius: 6px;
  margin: 0 0 18px;
}
.notice--danger { background: var(--danger-soft); border-color: var(--danger); }

/* Rank list */
.rank { list-style: none; padding: 0; margin: 0; }
.rank__item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 8px 8px 12px;
  margin: 0 0 8px;
  min-height: var(--tap);
}
.rank__pos {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.rank__item:first-child .rank__pos { background: var(--accent); color: #fff; }
.rank__text { flex: 1; min-width: 0; line-height: 1.3; }
.rank__item select { width: auto; padding: 8px 10px; min-height: 44px; }
.rank__btns { display: none; gap: 6px; flex: 0 0 auto; }
.rank__btns button {
  font: inherit;
  width: var(--tap); height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--accent);
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rank__btns button svg { width: 22px; height: 22px; }
.rank__btns button:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.rank__btns button:active:not(:disabled) { background: var(--accent); color: #fff; }
.rank__btns button:disabled { opacity: 0.25; cursor: default; }
.rank--js .rank__btns { display: flex; }
.rank--js .rank__item select { display: none; }
.rank__item.is-moved { animation: rank-pop 240ms ease-out; }
@keyframes rank-pop { from { background: var(--accent-soft); } to { background: var(--card); } }

/* Admin */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 24px; }
.topbar form { margin: 0; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.linkline { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 0 0 18px; font-size: 0.92rem; }
.linkline code { background: var(--card); border: 1.5px solid var(--line); border-radius: 6px; padding: 4px 8px; word-break: break-all; }

.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin: 20px 0 22px; overflow-x: auto; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  min-height: var(--tap);
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 3px solid transparent;
  margin-bottom: -1.5px;
  white-space: nowrap;
}
.tabs a.is-active { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.tabs a:hover { color: var(--ink); }

.table-scroll { overflow-x: auto; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: #f1efe9; font-size: 0.88rem; color: var(--ink-soft); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-weight: 600; font-size: 1.05rem; }
.nowrap { white-space: nowrap; }

.stat { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.stat--off { background: #ebe8e0; color: var(--ink-soft); font-weight: 500; }
.stat--sent { background: #fbefd6; color: #7a5410; }

/* Recipients list — stacks to cards on narrow screens, so the WhatsApp button never scrolls off. */
.people { list-style: none; margin: 0; padding: 0; }
.person {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 8px;
}
.person__name { font-weight: 600; }
.person__phone { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.person__actions { display: flex; gap: 8px; justify-content: flex-end; }
.person__actions form { margin: 0; }
.person.is-answered { border-color: var(--accent-soft); background: var(--accent-wash); }

.summary { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0 0 18px; }
.summary b { font-size: 1.4rem; font-weight: 700; margin-right: 4px; font-variant-numeric: tabular-nums; }
.summary span { color: var(--ink-soft); }

.bars { margin: 0 0 8px; }
.bar { display: grid; grid-template-columns: minmax(160px, 1fr) 2fr 80px; gap: 10px; align-items: center; padding: 5px 0; font-size: 0.95rem; }
.bar__track { background: #ece9e1; height: 18px; border-radius: 4px; overflow: hidden; }
.bar__fill { background: var(--accent); height: 100%; min-width: 0; }
.bar__n { text-align: right; font-variant-numeric: tabular-nums; }
.bar__n b { font-weight: 700; }
.bar__n span { color: var(--ink-soft); }
.bar.is-top span:first-child { font-weight: 600; }

.result { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; min-width: 0; }
.result h3 { margin: 0 0 8px; font-size: 1rem; }
.result ul { margin: 0; padding-left: 18px; }
.result li { margin: 0 0 6px; }
.result .table-scroll { border: 0; border-radius: 0; }
.result table { border: 1.5px solid var(--line); border-radius: var(--radius); }

.paste textarea { min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.95rem; }

@media (max-width: 720px) {
  .person { grid-template-columns: 1fr 1fr; }
  .person__name { grid-column: 1 / -1; }
  .person__actions { grid-column: 1 / -1; justify-content: stretch; }
  .person__actions form:first-child { flex: 1; }
  .person__actions form:first-child .btn { width: 100%; }
}

@media (max-width: 560px) {
  .bar { grid-template-columns: 1fr auto; gap: 2px 10px; }
  .bar__track { grid-column: 1 / -1; }
  .topbar h1 { font-size: 1.3rem; }
}
