/* NewPoolEstimate shared stylesheet. Self-hosted, system fonts only. */

:root {
  --bg: #f6f9fa;
  --surface: #ffffff;
  --tint: #eef4f6;
  --tint-2: #e3eef1;
  --text: #1e293b;
  --muted: #5b6b7f;
  --accent: #0e7c86;
  --accent-hover: #0a646c;
  --accent-soft: #dff2f3;
  --line: #cfdbe0;
  --error: #b42318;
  --error-soft: #fdecea;
  --ok: #1f7a4d;
  --ok-soft: #e6f4ec;
  --warn: #8a5a00;
  --warn-soft: #fdf3dc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
  text-wrap: balance;
  color: var(--text);
}
h1 { font-size: 1.6rem; text-align: center; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

p, li, dd, label, legend { text-wrap: pretty; }
p { margin: 0 0 1rem; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: 960px;
  margin-inline: auto;
  padding-inline: 16px;
}
.wrap-wide { max-width: 1320px; }

main.wrap { padding-block: 1.5rem 3rem; }

.site-header { background: var(--surface); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  min-height: 60px;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.header-nav { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.site-footer { padding-block: 1.5rem 2.5rem; text-align: center; }
.site-footer p { margin: 0; }
.site-footer a { text-decoration: none; }

.center { text-align: center; }
.muted { color: var(--muted); }
.prewrap { white-space: pre-wrap; }
.hidden, [hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin: 0 auto 1.25rem;
}
.card-narrow { max-width: 440px; }
.card > :last-child { margin-bottom: 0; }

.prose { max-width: 760px; }
.prose h2 { margin-top: 1.75rem; }
.prose h1 + p { text-align: center; }

/* ---------- Grids ---------- */

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-inline: auto;
}
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 > .field-span, .grid-filters > .field-search { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
  .grid-filters { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .grid-filters > .field-search { grid-column: auto; }
}

/* ---------- Forms ---------- */

.form { margin: 0; }
.field { margin: 0 0 1rem; min-width: 0; }
.grid > .field { margin-bottom: 0; }
.grid + .btn-row, .grid + .field { margin-top: 1rem; }

label, legend {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
}
fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"], input:not([type]),
select, textarea {
  display: block;
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 6rem; }
select { appearance: auto; }

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 124, 134, 0.25);
}
a:focus-visible { border-radius: 4px; }

input[type="checkbox"], input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  vertical-align: -0.15em;
  margin: 0 0.4rem 0 0;
}

.check { display: inline-flex; align-items: center; font-weight: 500; margin: 0 1.25rem 0.5rem 0; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; justify-content: center; }

.input-with-btn { display: grid; grid-template-columns: 1fr 9rem; gap: 0.5rem; }

/* Selectable option cards (radio/checkbox + label) for the calculator. */
.choices {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-inline: auto;
}
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.choice label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 100%;
  min-height: 64px;
  margin: 0;
  padding: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.choice input:checked + label { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + label { box-shadow: 0 0 0 3px rgba(14, 124, 134, 0.25); }

/* Large figure, e.g. estimate result. */
.stat { font-size: 2rem; font-weight: 700; text-align: center; line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.01em; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #ffffff; }
.btn:disabled, .btn.is-disabled { opacity: 0.45; pointer-events: none; }

.btn-ghost { background: var(--surface); color: var(--accent); border-color: var(--line); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent); }
.btn-ghost.is-active { background: var(--accent); color: #ffffff; border-color: var(--accent); }

.btn-danger { background: var(--error); border-color: var(--error); }
.btn-danger:hover { background: #8f1c13; border-color: #8f1c13; }

.btn-small { padding: 0.4rem 0.75rem; min-height: 36px; font-size: 0.9rem; }

/* Buttons side by side share the row equally. */
.btn-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.6rem;
  margin: 0 auto 1rem;
  width: 100%;
}
.btn-row > *, .btn-row > form, .btn-row > form > .btn { width: 100%; margin: 0; }
.btn-row:last-child { margin-bottom: 0; }

.form .btn-row, .card > form > .btn-row { max-width: 32rem; }

.btn-row-tight {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.4rem;
  min-width: max-content;
  margin: 0;
}
.btn-row-tight .btn { white-space: nowrap; }

.tabs { margin-bottom: 1.5rem; }
.pager { max-width: 24rem; margin-top: 1.25rem; }

.form-inline { margin-top: 1rem; }
.assign-form { display: grid; grid-template-columns: minmax(10rem, 1fr) 6rem; gap: 0.4rem; min-width: 18rem; }
.assign-form select { min-height: 36px; padding-block: 0.35rem; }

/* ---------- Messages ---------- */

.error { color: var(--error); }
p.error, .notice {
  border-radius: 8px;
  padding: 0.7rem 1rem;
  text-align: center;
}
p.error { background: var(--error-soft); }
.notice { max-width: 640px; margin: 0 auto 1.25rem; }
.notice-ok { background: var(--ok-soft); color: var(--ok); }
.notice-error { background: var(--error-soft); color: var(--error); }

/* ---------- Tables (zebra, no rules) ---------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 auto 1.25rem;
}
.card .table-wrap { box-shadow: none; }

.table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.93rem;
}
.table th, .table td {
  padding: 0.65rem 0.8rem;
  text-align: left;
  vertical-align: top;
  border: 0;
}
.table thead th {
  background: var(--tint-2);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}
.table tbody tr:nth-child(even) { background: var(--tint); }
.table tbody tr.is-new td { font-weight: 600; }
.table tbody tr.is-inactive td { color: var(--muted); }

/* ---------- Tags ---------- */

.tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--tint-2);
  color: var(--text);
  white-space: nowrap;
}
.tag-new { background: var(--accent-soft); color: var(--accent-hover); }
.tag-delivered, .tag-contacted, .tag-paid { background: var(--ok-soft); color: var(--ok); }
.tag-unassigned, .tag-overdue, .tag-disputed { background: var(--error-soft); color: var(--error); }
.tag-sent, .tag-viewed { background: var(--warn-soft); color: var(--warn); }
.tag-void { background: var(--tint-2); color: var(--muted); }

/* ---------- Detail lists ---------- */

.details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem 1rem;
  margin: 0;
}
.details dt { font-weight: 600; color: var(--muted); font-size: 0.88rem; margin-top: 0.6rem; }
.details dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 640px) {
  .details { grid-template-columns: 12rem 1fr; }
  .details dt, .details dd { padding: 0.45rem 0.6rem; margin: 0; border-radius: 6px; }
  .details dt:nth-of-type(even), .details dd:nth-of-type(even) { background: var(--tint); }
}

.filters .btn-row { max-width: 40rem; margin-top: 1rem; }

@media (min-width: 640px) {
  h1 { font-size: 1.9rem; }
  .card { padding: 1.75rem; }
}



.calc-main { max-width: 760px; }
.calc-head { text-align: center; margin: 0 auto 1.5rem; }
.calc-head p { color: var(--muted); max-width: 32rem; margin: 0 auto; }
.calc-card h2 { text-align: center; }
.calc-card .grid + .field, .calc-card .grid + fieldset { margin-top: 1rem; }
.calc-card legend { text-align: center; width: 100%; margin-bottom: 0.6rem; }
.calc-card .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) {
  .calc-card .choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.calc-card .choices.choices-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 26rem; }
.calc-card .choices-2 .choice label { min-height: 52px; }
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.5rem 0.75rem;
  margin-inline: auto;
}
.check-grid .check {
  display: flex;
  margin: 0;
  padding: 0.55rem 0.75rem;
  background: var(--tint);
  border-radius: 8px;
}
.check-grid .check label, .calc-card .field.check label { margin: 0; font-weight: 500; cursor: pointer; }
.calc-card .field.check { display: flex; flex-wrap: wrap; align-items: flex-start; margin: 0 0 1rem; }
.calc-card .field.check input { margin-top: 0.2rem; flex: 0 0 auto; }
.calc-card .field.check label { flex: 1 1 0; min-width: 0; }
.calc-card .field.check .field-error { flex-basis: 100%; }
.field-hint { font-size: 0.88rem; color: var(--muted); text-align: center; margin: 0.6rem 0 0; }
.field-error { color: var(--error); font-size: 0.88rem; font-weight: 600; margin: 0.35rem 0 0; }
.calc-card [aria-invalid="true"] { border-color: var(--error); }
.calc-card input[type="checkbox"][aria-invalid="true"] { outline: 2px solid var(--error); outline-offset: 2px; }
.calc-actions { max-width: 20rem; margin-top: 0.5rem; }
.result-card { text-align: center; background: var(--accent-soft); }
.result-card:focus { outline: none; box-shadow: 0 0 0 3px rgba(14, 124, 134, 0.25); }
.result-card h2 { font-size: 1.05rem; color: var(--muted); }
.result-summary { font-weight: 600; margin-bottom: 0.5rem; }
.result-note { font-size: 0.88rem; color: var(--muted); max-width: 30rem; margin: 0 auto; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.lead-status { border-radius: 8px; padding: 0.8rem 1rem; text-align: center; margin: 1rem 0 0; }
.lead-status:focus { outline: none; }
.lead-status.is-ok { background: var(--ok-soft); color: var(--ok); }
.lead-status.is-error { background: var(--error-soft); color: var(--error); }
.calc-foot p + p { margin-top: 0.35rem; }
@media (min-width: 640px) {
  .result-card .stat { font-size: 2.4rem; }
}
/* Pool shape cards: centered wrap so a short last row stays centered (5 in-ground shapes, 2 above-ground shapes). */
.calc-card .choices.choices-shape { display: flex; flex-wrap: wrap; justify-content: center; }
.calc-card .choices-shape .choice { flex: 0 0 calc((100% - 0.75rem) / 2); }
@media (min-width: 640px) {
  .calc-card .choices-shape .choice { flex-basis: calc((100% - 3rem) / 5); }
}
.calc-card .choices.choices-shape.choices-shape-2 { max-width: 26rem; }
.calc-card .choices-shape.choices-shape-2 .choice { flex-basis: calc((100% - 0.75rem) / 2); }
.calc-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("../images/background.jpg?v=1.3.0") center / cover no-repeat;
}
.calc-foot { padding-block: 0 2rem; }
.foot-card { padding: 0.75rem 1.25rem; margin-bottom: 0; text-align: center; font-size: 0.92rem; }
.foot-card p + p { margin-top: 0.2rem; }
.foot-brand { font-weight: 600; color: var(--muted); }
.pre-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; }
.pre-page main.wrap { padding-block: 1.5rem; }
.pre-card { text-align: center; margin: 0 auto; }
.pre-brand { margin: 1.5rem 0 0; font-size: 0.92rem; }
.pre-soon { font-size: 1.3rem; font-weight: 600; color: var(--accent); margin: 0.25rem auto 0; }
.pre-builders { margin: 0 auto; max-width: 30rem; }
.pre-builders + .pre-builders { margin-top: 0.35rem; }
.pre-builders a { text-decoration: none; font-weight: 600; }
