/* Mobile-first: one column up to 640px, 44px+ tap targets, 16px+ text so iOS
   does not zoom into fields. No inline styles anywhere (strict CSP). */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 0 1rem 2rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: #111;
  background: #f6f6f4;
}
main { max-width: 40rem; margin: 0 auto; }
h1 { font-size: 1.5rem; margin: 1rem 0 0.25rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.5rem; }
.subtitle { margin: 0 0 0.5rem; color: #444; }
.helper, .help { margin: 0.25rem 0 0.5rem; color: #444; font-size: 0.9375rem; }

/* Sticky header: who, where, which day, and the way out. */
.session-header {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 -1rem 1rem;
  padding: 0.5rem 1rem;
  background: #fff;
  border-bottom: 2px solid #111;
}
.report-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 0 0.75rem; line-height: 1.4; }
.report-name { flex-basis: 100%; }
.end-panel { margin-top: 0.25rem; }
.end-link, .end-cancel {
  display: block;
  min-height: 44px;
  padding: 0.625rem 0;
  font-weight: 600;
  color: #8a1020;
}
.end-form { margin: 0.5rem 0 0; }

/* Section cards */
.section, .start-form {
  margin: 0 0 1rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid #d4d4d0;
  border-radius: 8px;
}
.section-flash { border-color: #0a5c2b; }
.field { margin: 0 0 1rem; }
label { display: block; margin: 0 0 0.25rem; font-weight: 600; }
input, select, textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.75rem;
  font: inherit;
  font-size: 1rem;
  color: #111;
  background: #fff;
  border: 1px solid #767676;
  border-radius: 6px;
}
textarea { min-height: 6rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 3px solid #1a5fd0;
  outline-offset: 2px;
}
[aria-invalid="true"] { border-color: #b00020; border-width: 2px; }

/* Green/red feedback accents */
.flag-green { padding-left: 0.75rem; border-left: 6px solid #1b8a3d; }
.flag-red { padding-left: 0.75rem; border-left: 6px solid #c62828; }

button {
  min-height: 48px;
  width: 100%;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  color: #fff;
  background: #111;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: progress; }
@media (min-width: 40rem) {
  button { width: auto; min-width: 12rem; }
}

/* Status and errors */
.tick {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0 0.25rem;
  font-size: 1rem;
  line-height: 1.5rem;
  text-align: center;
  color: #fff;
  background: #1b8a3d;
  border-radius: 999px;
}
.saved { margin: 0 0 0.75rem; color: #0a5c2b; font-weight: 600; }
.field-error, .form-error { margin: 0.25rem 0 0; color: #b00020; font-weight: 600; }
.form-error { margin: 0 0 1rem; padding: 0.75rem; background: #fdecee; border-radius: 6px; }
.notice { margin: 0 0 1rem; padding: 0.75rem 1rem; background: #e8f0fb; border: 1px solid #9db8e4; border-radius: 6px; }

/* Progress */
.progress { margin: 0 0 1rem; }
.progress progress { display: block; width: 100%; height: 1rem; }
.progress-text { margin: 0.25rem 0 0; font-weight: 600; }

.banner { padding: 0.75rem 1rem; margin: 1rem 0; border-radius: 4px; }
.banner-error { position: sticky; bottom: 0.5rem; background: #b00020; color: #fff; font-weight: 600; }
.ping-ok { color: #0a5c2b; font-weight: 600; }
[hidden] { display: none !important; }
.htmx-indicator { opacity: 0; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; transition: opacity 200ms ease-in; }

/* Admin (desktop-first, still usable on a phone) */
body.admin main { max-width: none; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; margin: 0.75rem 0; }
.admin-nav form { margin: 0; }
.admin-nav a { font-weight: 600; }
button.linklike {
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: #1a5fd0;
  background: none;
  border: 0;
  text-decoration: underline;
}
.admin-login { max-width: 24rem; }
.table-wrap { overflow-x: auto; }
.admin-table { border-collapse: collapse; background: #fff; }
.admin-table th, .admin-table td { padding: 0.375rem 0.625rem; border-bottom: 1px solid #d4d4d0; text-align: left; }
.admin-table th { white-space: nowrap; background: #ececE8; }
.mark { text-align: center; font-weight: 700; }
.mark-yes { color: #0a5c2b; }
.mark-no { color: #b00020; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 1rem; margin: 0.5rem 0; }
.filters .field { margin: 0; }
.filters select { min-height: 44px; }
.filters button { width: auto; min-width: 8rem; }
.totals { font-weight: 700; }
.status-expired, .status-ended { color: #666; }

/* Admin grid: the cell text carries the state; the tint is only a hint. */
.legend { max-width: 60rem; color: #333; }
.grid-table td { padding: 0; }
.grid-table td a { display: block; padding: 0.5rem 0.75rem; min-height: 44px; box-sizing: border-box; color: inherit; font-weight: 600; text-decoration: none; }
.grid-table td a:hover, .grid-table td a:focus { text-decoration: underline; }
.grid-table tfoot td { padding: 0.375rem 0.625rem; font-weight: 600; }
.cell-none { background: #f3f3f0; color: #555; }
.cell-incomplete { background: #fff1c9; }
.cell-complete { background: #d8f0de; }
.cell-ended { background: #e4e4e8; }

/* Admin session detail */
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.detail { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; }
.detail dt { font-weight: 700; }
.detail dd { margin: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table pre { margin: 0; font-size: 0.75rem; white-space: pre-wrap; overflow-wrap: anywhere; }
td.ua { max-width: 18rem; overflow-wrap: anywhere; font-size: 0.8125rem; }
.confirm-panel { border: 2px solid #b00020; padding: 0.75rem 1rem; max-width: 36rem; background: #fff; }
.notice { background: #e8eef7; border: 1px solid #b9c7de; padding: 0.5rem 0.75rem; }

/* "Not at this store?" banner, shown until the first section is saved. */
.store-check { margin: 0 0 1rem; padding: 0.75rem 1rem; background: #fff6e0; border: 2px solid #e0a800; border-radius: 6px; }
.store-check p { margin: 0.25rem 0; }
.store-check-link, .store-check-cancel { display: inline-block; min-height: 44px; line-height: 44px; font-weight: 600; }
.store-check-form { display: inline-block; margin: 0.5rem 1rem 0 0; }
