:root {
  --ink: #1f2a3a;
  --muted: #5d6878;
  --line: #d9dfe8;
  --bg: #e3e9f3;
  --card: #ffffff;
  --field-bg: #f6f9fc;
  --field-border: #b8c4d6;
  --brand-green: #0e9a4a;
  --accent: #1d72d2;
  --accent-dark: #155ba8;
  --error: #c0262d;
  --error-bg: #fdecec;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

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

.wrap { max-width: 760px; margin: 0 auto; padding-inline: 16px; }
body.admin .wrap { max-width: 1200px; }

/* Header / footer */
.site-header .wrap { padding-block: 28px 20px; }
.brand { display: inline-block; max-width: 100%; text-decoration: none; }
.brand img { display: block; width: 360px; max-width: 100%; height: auto; }
.brand-text { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.brand-check { color: var(--brand-green); }
.brand-health { font-weight: 400; font-style: italic; }

main { padding-block: 0 24px; }

.site-footer { color: var(--muted); font-size: 0.85rem; }
.site-footer .wrap { padding-block: 8px 32px; }
.site-footer a { color: inherit; }

/* Card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(31, 42, 58, 0.08);
}
.card-head { padding: 36px 48px 28px; border-bottom: 1px solid var(--line); }
.card-head h1 { margin: 0 0 6px; font-size: 1.9rem; line-height: 1.25; }
.card-head p { margin: 0; color: var(--muted); font-size: 1.05rem; }
.card-body { padding: 32px 48px 40px; }
.center { text-align: center; }

h1 { margin: 0 0 8px; font-size: 1.5rem; line-height: 1.25; }
.lede { margin: 0; color: var(--muted); }
.muted { margin: 0; color: var(--muted); }

.alert {
  margin-bottom: 24px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error);
  font-weight: 500;
}

/* Fields */
.field { margin: 0 0 28px; padding: 0; border: 0; min-width: 0; }
label, legend { display: block; margin-bottom: 8px; padding: 0; font-weight: 600; font-size: 0.97rem; }
.req { color: var(--error); }

input[type=text], input[type=email], input[type=tel], input[type=date], input[type=search], textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 6px;
}
textarea { resize: vertical; min-height: 140px; }
input:focus, textarea:focus { outline: 3px solid rgba(29, 114, 210, 0.2); border-color: var(--accent); }
.has-error input, .has-error textarea, .has-error .dropzone { border-color: var(--error); }

.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px 20px; }
.cell { grid-column: span 6; min-width: 0; }
.cell.half { grid-column: span 3; }
.cell.third { grid-column: span 2; }
.sublabel { margin: 4px 0 10px; font-weight: 400; font-size: 0.8rem; color: var(--muted); }

.help { margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; }
.error { margin: 6px 0 0; color: var(--error); font-size: 0.875rem; }

.choice { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; font-weight: 400; cursor: pointer; }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }

/* File drop zone: the real file input covers the box, so click and drag-and-drop both work natively. */
.dropzone {
  position: relative;
  border: 1px dashed #6b7a90;
  border-radius: 6px;
  background: #f8fafd;
  transition: background 0.15s;
}
.dropzone.dragging, .dropzone:hover { background: #eef3fb; }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone:focus-within { outline: 3px solid rgba(29, 114, 210, 0.2); }
.dropzone-text { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 24px 16px; text-align: center; }
.dropzone-text svg { color: #a9b5c6; }
.dropzone-text strong { font-size: 1.1rem; }
.dropzone-text span { color: var(--muted); font-size: 0.875rem; }
.file-list { margin: 8px 0 0; padding-left: 20px; font-size: 0.875rem; color: var(--muted); }
.file-list:empty { display: none; }

/* Buttons */
button, .button {
  display: inline-block;
  padding: 12px 28px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button:hover, .button:hover { background: var(--accent-dark); }
button:disabled { opacity: 0.65; cursor: default; }
button.secondary { color: var(--ink); background: #e6ebf2; font-weight: 600; }
button.secondary:hover { background: #d8dfe9; }
.actions { margin: 36px -48px -40px; padding: 24px 16px; border-top: 1px solid var(--line); text-align: center; }

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.check {
  width: 56px; height: 56px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #e3f4ea; color: var(--brand-green);
  font-size: 1.75rem; font-weight: 700;
}

/* Terms */
.terms { font-size: 0.95rem; }
.terms h1 { font-size: 1.2rem; }
.terms h2 { margin: 24px 0 8px; font-size: 1rem; }
.terms ul { padding-left: 22px; }
.terms hr { margin: 32px auto 16px; width: 50%; border: 0; border-top: 1px solid var(--ink); }
.print-row { margin: 0 0 16px; text-align: right; }

/* Admin */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.tabs a { padding: 8px 16px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.tabs a[aria-current] { background: var(--card); box-shadow: 0 1px 3px rgba(31, 42, 58, 0.08); }
.admin-bar { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search { display: flex; gap: 8px; align-items: center; }
.search input { width: 240px; max-width: 100%; background: #fff; }
.search button, .admin-actions .button { padding: 10px 16px; }

.table-scroll { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(31, 42, 58, 0.08); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef2f7; font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.nowrap { white-space: nowrap; }
.clip { min-width: 220px; }
.empty { text-align: center; color: var(--muted); padding: 32px; }

.detail { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 12px 24px; margin: 24px 0 0; }
.detail dt { font-weight: 600; }
.detail dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.staff-note { margin-top: 16px; padding: 10px 14px; border-left: 4px solid #e0a800; border-radius: 6px; background: #fff7df; }
.attachment { margin-bottom: 16px; }
.attachment img, .attachment video { display: block; max-width: min(100%, 420px); max-height: 320px; margin-bottom: 6px; border-radius: 6px; border: 1px solid var(--line); }

/* Staff tools: login, notes, trash, hand-entered submissions */
.login { max-width: 440px; margin: 0 auto; }
.login input[type=password] { width: 100%; padding: 10px 12px; font: inherit; color: inherit; background: var(--field-bg); border: 1px solid var(--field-border); border-radius: 6px; }
.tabs { align-items: center; }
.tabs .logout { margin: 0 0 0 auto; }
button.link { padding: 8px 4px; color: var(--accent); background: none; font-weight: 600; }
button.link:hover { background: none; text-decoration: underline; }
.button.secondary { color: var(--ink); background: #e6ebf2; font-weight: 600; }
.button.secondary:hover { background: #d8dfe9; }
button.danger { background: var(--error); }
button.danger:hover { background: #9e1f25; }
.staff-tools label { margin-bottom: 6px; }
.staff-tools textarea { min-height: 80px; margin-bottom: 8px; background: #fff; }
.staff-tools .saved { margin-left: 8px; }
.entry-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.entry-actions form { margin: 0; }
.notice { margin: 0 0 20px; padding: 10px 14px; border-radius: 8px; background: #eef3fb; }
.trash-link { margin-top: 16px; }

@media (max-width: 640px) {
  .site-header .wrap { padding-block: 20px 14px; }
  .brand-text { font-size: 1.6rem; }
  .brand img { width: 270px; }
  .card-head { padding: 24px 20px 20px; }
  .card-head h1 { font-size: 1.45rem; }
  .card-body { padding: 24px 20px 28px; }
  .actions { margin: 28px -20px -28px; }
  .actions button { width: 100%; }
  .cell.half, .cell.third { grid-column: span 6; }
  .detail { grid-template-columns: 1fr; gap: 2px; }
  .detail dd { margin-bottom: 12px; }
  .search { width: 100%; }
  .search input { flex: 1; width: auto; }
}

@media print {
  body { background: #fff; }
  .site-footer, .print-row { display: none; }
  .card { box-shadow: none; }
  .card-body { padding: 0; }
}
