:root {
  --bg: #f5f7f8;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --focus: #14b8a6;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: contain;
}
header {
  position: sticky; top: 0; z-index: 5;
  background: var(--brand); color: var(--brand-ink);
  padding: 12px 16px;
  padding-top: calc(env(safe-area-inset-top) + 12px);
}
header h1 { margin: 0; font-size: 18px; font-weight: 600; }
header p  { margin: 2px 0 0; font-size: 13px; opacity: .85; }

main { padding: 12px 12px 120px; max-width: 640px; margin: 0 auto; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.card h2 {
  margin: 0 0 10px; font-size: 13px; font-weight: 600;
  color: var(--brand); letter-spacing: .04em; text-transform: uppercase;
}
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 6px; }

input[type="text"], input[type="date"], input[type="number"], textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; min-height: 48px;
  appearance: none; -webkit-appearance: none;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, textarea:focus {
  outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(20,184,166,.18);
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row.full { grid-template-columns: 1fr; }

/* Yes/No segmented control */
.yesno { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; position: relative; }
.yesno input { position: absolute; opacity: 0; pointer-events: none; }
.yesno label {
  display: flex; align-items: center; justify-content: center;
  margin: 0; min-height: 48px; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; font-weight: 500; color: var(--ink);
}
.yesno input:checked + label { background: var(--brand); color: #fff; border-color: var(--brand); }
.conditional { display: none; }
.conditional.show { display: block; }

/* Sticky submit */
.submit-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 12px calc(env(safe-area-inset-bottom) + 12px);
  background: linear-gradient(180deg, rgba(245,247,248,0) 0%, var(--bg) 35%);
}
.submit-bar .inner { max-width: 640px; margin: 0 auto; }
button.primary {
  width: 100%; font: inherit; font-weight: 600; font-size: 17px;
  background: var(--brand); color: #fff; border: 0; border-radius: 12px;
  padding: 16px; min-height: 56px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(15,118,110,.25);
}
button.primary:active { transform: translateY(1px); }
button.primary[disabled] { opacity: .6; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 999px;
  font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10;
}
.toast.show { opacity: 1; }
.toast.err  { background: var(--danger); }
.toast.ok   { background: var(--ok); }

.hint { font-size: 12px; color: var(--muted); margin: 4px 2px 0; }
