:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #16a085;
  --accent-ink: #ffffff;
  --err: #b91c1c;
  --err-bg: #fef2f2;
  --err-line: #fecaca;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.card {
  max-width: 720px;
  margin: 32px auto;
  padding: 32px;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}

.logo { text-align: center; margin-bottom: 16px; }
.logo img { max-height: 72px; max-width: 240px; }

.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.form-header .brand {
  height: 56px;
  width: auto;
  max-width: 45%;
  object-fit: contain;
}

h1 { margin: 0 0 8px; font-size: 1.6rem; }
.lead { color: var(--muted); margin: 0 0 24px; }

fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 0 0 20px;
}
legend { padding: 0 8px; font-weight: 600; color: var(--ink); }

label {
  display: block;
  margin: 12px 0 4px;
  font-weight: 500;
}
fieldset > label:first-of-type { margin-top: 0; }

label.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
  margin: 14px 0 4px;
}
label.check span { flex: 1; }
label.check input { width: auto; margin-top: 4px; }

.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-group label.radio {
  flex: 1 1 0;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 400;
}
.radio-group label.radio input { width: auto; margin: 0; }
.radio-group label.radio:has(input:checked) {
  border-color: var(--accent);
  background: rgba(22, 160, 133, .06);
}
.radio-group[aria-invalid="true"] label.radio { border-color: var(--err); background: var(--err-bg); }

.muted { color: var(--muted); font-weight: 400; }

input[type="text"],
input[type="tel"],
input[type="file"],
select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 160, 133, .15);
}
input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--err);
  background: var(--err-bg);
}
input[aria-invalid="true"]:focus,
select[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .15);
}

.row { display: flex; gap: 16px; }
.row > .row-field { flex: 1; min-width: 0; }
.row > .row-field > label { margin-top: 0; }

.req { color: var(--err); margin-left: 2px; }
.hint { display: block; color: var(--muted); margin-top: 4px; font-size: 0.85rem; }
.hint.center { text-align: center; }
small.err {
  display: block;
  color: var(--err);
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}

.alert {
  background: var(--err-bg);
  color: var(--err);
  border: 1px solid var(--err-line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
}

.contact-note {
  background: #f9fafb;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 0 0 20px;
  color: var(--ink);
  font-size: 0.92rem;
}

.privacy-notice {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 20px;
}
.privacy-notice p { margin: 0 0 8px; }
.privacy-notice p:last-child { margin-bottom: 0; }
.privacy-notice a { color: var(--accent); }

button[type="submit"] {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 8px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button[type="submit"]:hover { filter: brightness(.96); }

/* Thank-you page */
.card--success { text-align: center; }
.card--success .lead { max-width: 480px; margin: 0 auto 24px; }
.success-icon { margin: 8px auto 16px; }
.ref-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 24px;
  margin: 8px auto 12px;
}
.ref-box small { color: var(--muted); font-size: 0.8rem; }
.ref-box code {
  font: 600 1.4rem/1 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--ink);
  letter-spacing: 0.1em;
}
.actions { margin-top: 24px; }
.btn-secondary {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-weight: 500;
}
.btn-secondary:hover { background: rgba(22, 160, 133, .06); }

/* Admin */
body.admin { background: #fff; }
.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.admin-bar h1 { font-size: 1.2rem; margin: 0; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  margin-left: 8px;
  font-size: 0.9rem;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { background: #f9fafb; font-weight: 600; }
td small { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 32px; }

@media (max-width: 560px) {
  .card { margin: 0; border-radius: 0; padding: 20px; }
  .row { flex-direction: column; gap: 0; }
  .form-header { gap: 12px; }
  .form-header .brand { height: 40px; }
}
