/* Troop 224 — single stylesheet. Mobile-first; wider layouts in @media blocks.
   Look: a well-made troop handbook. Serif (Lora) for titles only; Inter for
   everything else. Admin screens are dense on desktop; family pages stay
   roomy. Touch targets are >= 44px on phones everywhere and on family pages
   at every width. Icons are SVG masks (.icon-*) so they take currentColor. */

:root {
  --color-navy: #1a3a5c;
  --color-khaki: #d4b896;
  --color-olive: #556b2f;
  --color-tan: #f5efe6;
  --color-red: #b23b2e;
  --color-text: #1f2b38;
  --color-text-muted: #6b7280;
  --color-border: #d9cfbf;
  --color-row-driver: #e6ebd8;
  --color-row-attention: #f5e6b3;
  --color-row-inactive: #ede4d3;
  --color-card: #fff;
  --color-navy-hover: #244b73;
  --color-navy-tint: #e8edf3;
  --color-red-tint: #f6e3e0;
  --color-amber: #8a6a12;
  --color-attention-border: #e3cf86;
  --color-zebra: rgba(212, 184, 150, .06);
  --color-idle: #b3b9c2;

  --font-serif: "Lora", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;

  --radius: 3px;
  --shadow: 0 1px 2px rgba(26, 58, 92, .06);
  --tap: 44px;     /* phone + family touch target */
  --ctl: 30px;     /* compact admin control height on desktop */
  --ctl-sheet: 28px; /* spreadsheet row controls on desktop */
  --ease: 150ms ease;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--color-tan); color: var(--color-text); font-family: var(--font-sans); font-size: var(--fs-base); line-height: 1.4; }
.area-family { font-size: var(--fs-md); line-height: 1.5; }
a { color: var(--color-navy); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; color: var(--color-navy); }
h1 { font-size: var(--fs-xl); font-weight: 700; margin: 4px 0 16px; }
h1::after { content: ""; display: block; width: 60px; height: 2px; background: var(--color-khaki); margin-top: 8px; }
h1 small { font-family: var(--font-sans); font-size: var(--fs-base); font-weight: 400; letter-spacing: 0; }
h2 { font-size: var(--fs-lg); margin: 20px 0 8px; }
h3 { font-size: var(--fs-md); margin: 12px 0 6px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
small, .muted { color: var(--color-text-muted); }
small { font-size: var(--fs-sm); }
.mt { margin-top: 12px; }
.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; }

/* ---- Icons: <i class="icon icon-car" aria-hidden="true"></i> ---- */
.icon { display: inline-block; width: 16px; height: 16px; flex: 0 0 16px; vertical-align: -3px; background-color: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.icon-chevron-down { --i: url(../img/icons/chevron-down.svg); }
.icon-chevron-right { --i: url(../img/icons/chevron-right.svg); }
.icon-check { --i: url(../img/icons/check.svg); }
.icon-x { --i: url(../img/icons/x.svg); }
.icon-car { --i: url(../img/icons/car.svg); }
.icon-utensils { --i: url(../img/icons/utensils.svg); }
.icon-user { --i: url(../img/icons/user.svg); }
.icon-dollar { --i: url(../img/icons/dollar.svg); }
.icon-calendar { --i: url(../img/icons/calendar.svg); }
.icon-alert { --i: url(../img/icons/alert-triangle.svg); color: var(--color-red); }
.icon-help { --i: url(../img/icons/help-circle.svg); }
.icon-clock { --i: url(../img/icons/clock.svg); }
.icon-send { --i: url(../img/icons/send.svg); }
.icon-mail { --i: url(../img/icons/mail.svg); }
.icon-refresh { --i: url(../img/icons/refresh.svg); }

/* ---- Top bar + nav ---- */
.topbar { background: var(--color-navy); color: #fff; display: flex; flex-wrap: wrap; align-items: center; padding: 0 16px; min-height: 48px; position: relative; }
.brand { color: #fff; font-family: var(--font-serif); font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.01em; text-decoration: none; padding: 10px 0; flex: 1; }
.brand:hover { text-decoration: none; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-burger { font-size: 1.4rem; cursor: pointer; min-width: var(--tap); min-height: var(--tap); display: flex; align-items: center; justify-content: center; }
.nav { display: none; width: 100%; flex-direction: column; padding-bottom: 8px; }
.nav-toggle:checked ~ .nav { display: flex; }
.nav a, .nav .linklike { color: rgba(255,255,255,.85); font-size: var(--fs-base); font-weight: 500; text-decoration: none; padding: 10px 4px; min-height: var(--tap); display: flex; align-items: center; border-top: 1px solid rgba(255,255,255,.12); }
.nav a:hover, .nav .linklike:hover { color: #fff; text-decoration: none; }
.nav a.active { color: #fff; font-weight: 600; }
.nav-logout { margin: 0; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; padding: 0; width: 100%; text-align: left; }

.container { max-width: 1240px; margin: 0 auto; padding: 16px; }
.crumbs { margin: 0 0 6px; font-size: var(--fs-sm); }
.page-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.page-head h1 { margin-right: auto; }
.page-head form { margin: 0; }

/* ---- Cards ---- */
.card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 12px; }
.area-family .card { padding: 18px 20px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 24px auto; }
.card.attention { background: #fbf3d6; border-color: var(--color-attention-border); }
.card-add > summary { color: var(--color-navy); }
.cards { display: grid; gap: 0; }
.row-muted { opacity: .55; }
.badge { display: inline-block; font-size: var(--fs-xs); font-weight: 600; line-height: 1.5; background: var(--color-row-inactive); color: var(--color-text-muted); border-radius: var(--radius); padding: 0 6px; margin-left: 4px; vertical-align: middle; text-transform: lowercase; }
.badge-green { background: var(--color-row-driver); color: var(--color-olive); }
.badge-yellow { background: var(--color-row-attention); color: var(--color-amber); }
.badge-red { background: var(--color-red-tint); color: var(--color-red); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 5px 0; }
ul.plain li + li { border-top: 1px solid var(--color-border); }
.area-family ul.plain li { padding: 8px 0; }

/* Disclosure: chevron replaces the native marker on every <summary>. */
summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; width: 16px; height: 16px; flex: 0 0 16px; background-color: var(--color-text-muted);
  -webkit-mask: url(../img/icons/chevron-right.svg) center / contain no-repeat; mask: url(../img/icons/chevron-right.svg) center / contain no-repeat; }
details[open] > summary::before { transform: rotate(90deg); }
.card > summary { min-height: var(--tap); padding: 2px 0; }
.card[open] > summary { margin-bottom: 8px; }

/* ---- Flash + toast ---- */
.flash { border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; border: 1px solid; }
.flash-success { background: var(--color-row-driver); border-color: #b9c79a; }
.flash-error { background: var(--color-red-tint); border-color: #e2b1aa; }
.flash-info { background: var(--color-navy-tint); border-color: #b8c7d8; }
.mode-banner { border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; border: 1px solid; font-size: .95em; }
.mode-dev { background: #eceef1; border-color: var(--color-idle); color: var(--color-text); }
.mode-staged { background: var(--color-row-attention); border-color: var(--color-attention-border); color: #5c4709; }
.mode-live { background: var(--color-row-driver); border-color: #b9c79a; color: var(--color-olive); }
.toast { position: fixed; left: 16px; right: 16px; bottom: 16px; background: var(--color-navy); color: #fff; padding: 10px 14px; border-radius: var(--radius); box-shadow: 0 2px 8px rgba(26,58,92,.2); opacity: 0; transform: translateY(20px); transition: all .2s; pointer-events: none; z-index: 50; text-align: center; }
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--color-red); }

/* ---- Forms + buttons ---- */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-weight: 500; font-size: var(--fs-sm); }
.form label.check, label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; min-height: var(--tap); }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], input[type=date], input[type=datetime-local], input[type=number], input:not([type]), select, textarea {
  width: 100%; min-height: var(--tap); padding: 6px 8px; border: 1px solid var(--color-border); border-radius: var(--radius); background: #fff; color: var(--color-text);
  font-size: var(--fs-md); /* 16px on phones stops iOS zooming on focus */
}
textarea { min-height: 70px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--color-navy); outline-offset: 1px;
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--color-navy); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 6px 14px; border-radius: var(--radius); border: 1px solid var(--color-navy); background: var(--color-navy); color: #fff; text-decoration: none; font-weight: 500; font-size: var(--fs-base); cursor: pointer; transition: background-color var(--ease), color var(--ease), border-color var(--ease); }
.btn:hover { background: var(--color-navy-hover); border-color: var(--color-navy-hover); text-decoration: none; }
.btn-secondary { background: transparent; color: var(--color-navy); }
.btn-secondary:hover { background: var(--color-navy-tint); border-color: var(--color-navy); }
.btn-secondary.is-active { background: var(--color-navy-tint); }
.btn-danger { background: var(--color-red); border-color: var(--color-red); color: #fff; }
.btn-danger:hover { background: #962f24; border-color: #962f24; }
.delete-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); }
.confirm-dialog { max-width: min(440px, calc(100vw - 32px)); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; color: var(--color-text); background: var(--color-card); }
.confirm-dialog::backdrop { background: rgba(31, 43, 56, .45); }
.confirm-dialog h3 { margin-top: 0; }
.confirm-dialog .btn-row { justify-content: flex-end; margin-top: 12px; }
.btn-small { min-height: 32px; padding: 3px 10px; font-size: var(--fs-sm); }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.saving { opacity: .6; }
.searchbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.searchbar input[type=search] { flex: 1 1 220px; }
.inline-form { display: inline; margin: 0; }
.area-family .btn { font-size: var(--fs-md); padding: 8px 18px; }

/* ---- Tables (become cards on phones) ---- */
.table { width: 100%; border-collapse: collapse; background: var(--color-card); font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table th { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); background: transparent; white-space: nowrap; }
.table th .icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.table tbody tr:nth-child(even) { background: var(--color-zebra); }
.table.compact td, .table.compact th { padding: 4px 6px; }
.cards-on-mobile thead { display: none; }
.cards-on-mobile tr { display: block; border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 8px; background: var(--color-card); padding: 4px 10px; }
.cards-on-mobile td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 4px 0; }
.cards-on-mobile td::before { content: attr(data-label); font-weight: 500; color: var(--color-text-muted); font-size: var(--fs-sm); flex: 0 0 35%; }
.cards-on-mobile td > * { text-align: right; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Status colours (spreadsheet + lists) ---- */
.st-driver, .table tbody tr.st-driver { background: var(--color-row-driver); }
.st-out, .table tbody tr.st-out { color: var(--color-text-muted); background: var(--color-row-inactive); }
.st-attn, .table tbody tr.st-attn { background: var(--color-row-attention); }
.rsvp-yes { color: var(--color-olive); font-weight: 600; }
.rsvp-no, .rsvp-sick { color: var(--color-text-muted); }
.rsvp-maybe, .rsvp-pending { color: var(--color-amber); }

/* Email status dot (8px) */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-muted); vertical-align: 1px; flex: 0 0 8px; }
.dot-ok { background: var(--color-olive); }
.dot-sent { background: var(--color-navy); }
.dot-bad { background: var(--color-red); }
.dot-idle { background: var(--color-khaki); }
.status-cell { display: inline-flex; align-items: center; gap: 6px; }
.dot-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--fs-sm); color: var(--color-text-muted); margin: 0 0 8px; }
.dot-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ---- Dashboard ---- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
.stat { display: flex; flex-direction: column; gap: 2px; background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; text-decoration: none; color: var(--color-text); }
.stat:hover { text-decoration: none; border-color: var(--color-khaki); }
.stat-label { font-family: var(--font-serif); font-weight: 600; font-size: var(--fs-md); color: var(--color-navy); letter-spacing: -.01em; }
.stat .num { font-size: var(--fs-xl); font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-desc { font-size: var(--fs-sm); color: var(--color-text-muted); }
.stat-warn { background: #fbf3d6; border-color: var(--color-attention-border); }
.stat-warn .num { color: var(--color-red); }
.dash-grid { display: grid; gap: 12px; }
.dash-grid > .card { margin: 0; }
.flag-list li { display: flex; gap: 8px; align-items: flex-start; }
.flag-list .icon { margin-top: 2px; }
.card-title { display: flex; align-items: center; gap: 8px; }

/* ---- Patrols ---- */
.patrol-grid { display: grid; gap: 12px; }
.roster li { display: grid; gap: 4px; border-bottom: 1px solid var(--color-border); }
.splash { text-align: center; padding: 40px 0; max-width: 560px; margin: 0 auto; }
.splash h1::after { margin-left: auto; margin-right: auto; }

/* ---- Campouts ---- */
.campout-cards { display: grid; gap: 10px; }
.campout-card { display: block; text-decoration: none; color: var(--color-text); margin: 0; }
.campout-card:hover { text-decoration: none; border-color: var(--color-khaki); }
.campout-card strong { font-family: var(--font-serif); font-size: var(--fs-md); font-weight: 600; color: var(--color-navy); letter-spacing: -.01em; }
.campout-card .icon { color: var(--color-text-muted); }
.sheet-head h1 { margin-bottom: 8px; }
.sheet-head h1 small { font-size: var(--fs-base); }
.sheet-head p { margin: 6px 0 10px; font-size: var(--fs-sm); }
.totals { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 12px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.totals strong { font-size: var(--fs-xs); letter-spacing: .05em; color: var(--color-text-muted); }
.sheet select { min-width: 110px; }
.entry-grid { display: grid; gap: 16px; }
.entry-grid h3 { margin: 0; }
.inline-status select { width: auto; }

/* Spreadsheet patrol sections: one-line header (serif name, count, food buyer). */
.sheet-patrol { padding: 0; overflow: hidden; }
.sheet-patrol > summary { flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; margin: 0; background: #faf6ef; border-bottom: 1px solid transparent; }
.sheet-patrol[open] > summary { margin: 0; border-bottom-color: var(--color-border); }
.sheet-patrol .patrol-name { font-family: var(--font-serif); font-size: var(--fs-lg); font-weight: 600; color: var(--color-navy); letter-spacing: -.01em; }
.sheet-patrol .table-wrap { padding: 0; }
.sheet-patrol .table th:first-child, .sheet-patrol .table td:first-child { padding-left: 12px; }
.buyer-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 2px 6px; border-radius: var(--radius); font-size: var(--fs-sm); color: var(--color-text-muted); }
.buyer-line select { width: auto; min-width: 180px; }
.sheet-patrol .buyer-line { margin-left: auto; }
.pay-cell { display: inline-flex; align-items: center; gap: 4px; }
.pay-cell .icon { color: var(--color-text-muted); }
.pay-cell small { font-size: var(--fs-xs); }

/* Scout RSVP check button (admin sheet): 20px circle, gray = no answer /
   maybe / sick, green = yes, red = no. ::after widens the hit area to 44px
   on phones. */
.name-cell { display: inline-flex; align-items: center; gap: 12px; }
.rsvp-check { position: relative; flex: 0 0 20px; width: 20px; height: 20px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--color-idle); border-radius: 50%; background: #fff; color: var(--color-idle); cursor: pointer;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease); }
.rsvp-check::after { content: ""; position: absolute; inset: -12px; }
.rsvp-check .icon { width: 12px; height: 12px; flex: 0 0 12px; vertical-align: 0; }
.rsvp-check:hover { border-color: var(--color-olive); color: var(--color-olive); }
.rsvp-check.is-yes { background: var(--color-olive); border-color: var(--color-olive); color: #fff; cursor: default; }
.rsvp-check.is-no { background: var(--color-red); border-color: var(--color-red); color: #fff; }
.rsvp-check.is-no:hover { background: var(--color-red); border-color: var(--color-red); color: #fff; }

/* ---- Campout sub-screens ---- */
.subnav { display: flex; gap: 2px; overflow-x: auto; margin: 0 0 12px; border-bottom: 1px solid var(--color-border); }
.subnav a { padding: 10px 12px; min-height: var(--tap); display: flex; align-items: center; white-space: nowrap; text-decoration: none; color: var(--color-text-muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--color-navy); text-decoration: none; }
.subnav a.active { color: var(--color-navy); border-bottom-color: var(--color-navy); }
.driver-cards { display: grid; gap: 12px; }
.driver-card h2 { margin-top: 0; }
.assign-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--color-border); }
.assign-form { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
.inline-list li { display: inline-block; margin-right: 14px; }
.warn-text { color: var(--color-red); }
.mb { margin-bottom: 12px; }
.seats-input { width: 64px !important; }
.meal-cell { display: flex; gap: 6px; }
.add-adult { display: flex; gap: 8px; margin-top: 10px; }
.add-adult select { flex: 1; }
.adult-edit-grid { display: grid; gap: 8px; margin-bottom: 4px; }
.adult-edit-grid label { display: grid; gap: 2px; font-size: var(--fs-sm); font-weight: 500; }
.table tbody tr.adult-edit-row { background: var(--color-navy-tint); }
.link-remove { display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); padding: 0; border: 0; background: none; color: var(--color-text-muted); cursor: pointer; vertical-align: middle; }
.link-remove:hover { color: var(--color-red); }

/* ---- Email + logs ---- */
.tpl-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
@media (min-width: 900px) { .tpl-editor { grid-template-columns: minmax(0, 1fr) 280px; } .tpl-tags { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; } }
.tpl-main textarea.mono, textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.45; width: 100%; }
.tpl-tags li { margin-bottom: 8px; }
.tag-btn { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--color-navy-tint); color: var(--color-navy); border: 1px solid #b8c7d8; border-radius: var(--radius); padding: 1px 6px; cursor: pointer; }
.tag-btn:hover { border-color: var(--color-navy); }
.tpl-sample { display: flex; flex-wrap: wrap; gap: 8px 16px; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 8px 12px; }
.tpl-sample label { flex: 1 1 200px; }
.text-bad { color: var(--color-red); }
.email-preview { width: 100%; height: 480px; border: 1px solid var(--color-border); border-radius: var(--radius); background: #fff; }
.audience { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 10px 14px; display: grid; gap: 4px; }
.patrol-checks { display: grid; grid-template-columns: repeat(2, 1fr); }
.money-input { width: 96px !important; }
.audit-table td { word-break: break-word; }

/* Email batches */
.seg-links { display: inline-flex; border: 1px solid var(--color-navy); border-radius: var(--radius); overflow: hidden; }
.seg-links a { padding: 6px 12px; min-height: var(--tap); display: inline-flex; align-items: center; color: var(--color-navy); text-decoration: none; font-size: var(--fs-sm); font-weight: 500; }
.seg-links a + a { border-left: 1px solid var(--color-navy); }
.seg-links a.active { background: var(--color-navy); color: #fff; }
.batch-filters .searchbar { margin-bottom: 8px; }
.batch-filters .inline-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--color-text-muted); }
.filter-more { margin-bottom: 8px; }
.filter-checks { display: grid; gap: 12px; margin-top: 8px; }
.filter-checks fieldset { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 6px 12px; margin: 0; }
.filter-checks legend { font-size: var(--fs-sm); font-weight: 600; color: var(--color-text-muted); }
.trigger { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.trigger .icon { color: var(--color-navy); }
.badge-trigger { font-size: var(--fs-sm); color: var(--color-text-muted); }
.num-cell { font-variant-numeric: tabular-nums; }
.table tbody tr.batch-rows { background: var(--color-tan); }
.batch-rows > td { padding: 8px 12px; }
.meta-list { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0 0 10px; }
.meta-list dt { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); margin-top: 6px; }
.meta-list dd { margin: 0; }
.json-rule pre, .email-text { white-space: pre-wrap; word-break: break-word; background: var(--color-tan); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 8px 10px; font-size: var(--fs-sm); max-height: 420px; overflow: auto; margin: 6px 0 0; }
.count-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.count-chip { background: var(--color-navy-tint); border-radius: var(--radius); padding: 2px 8px; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.count-chip.chip-bad { background: var(--color-red-tint); color: var(--color-red); }
.resend-grid { display: grid; gap: 16px; }
.resend-grid h3 { margin-top: 0; }
.radio-block { align-items: flex-start !important; }
.radio-block input { margin-top: 3px; flex: 0 0 auto; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.timeline li { padding-left: 18px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-olive); }
.timeline li.pending::before { background: var(--color-border); }
.timeline li.pending { color: var(--color-text-muted); }
.copy-row { display: flex; gap: 8px; margin-bottom: 6px; }
.copy-row input { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: var(--fs-sm) !important; }
.nowrap { white-space: nowrap; }

/* ---- Login ---- */
.login-card { max-width: 360px; margin: 48px auto; padding: 20px; }
.login-card h1 { text-align: center; margin-bottom: 4px; }
.login-card h1::after { margin: 8px auto 0; }
.login-card .login-sub { text-align: center; color: var(--color-text-muted); margin: 0 0 16px; }

/* ---- Packing list (screen + print) ---- */
.packing h1 small { font-size: var(--fs-sm); font-weight: 400; color: var(--color-text-muted); }
.packing h3 small { font-weight: 400; color: var(--color-text-muted); }
.print-cols { display: grid; gap: 12px; }
.print-block { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 8px 12px; background: var(--color-card); break-inside: avoid; }
.print-block ol, .print-block ul { margin: 4px 0; padding-left: 22px; }
.small { font-size: var(--fs-sm); }

/* ---- Family pages (roomy; 44px targets at every width) ---- */
.area-family h1 { font-size: var(--fs-2xl); }
.area-family h2 { font-size: var(--fs-xl); }
.area-family h3 { font-size: var(--fs-lg); margin-top: 18px; }
.person-row { display: grid; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.person-row:last-child { border-bottom: 0; }
.person-name { font-weight: 600; }
.seg { display: grid; grid-template-columns: 1fr 1fr 56px; border: 1px solid var(--color-navy); border-radius: var(--radius); overflow: hidden; }
.seg-btn { min-height: var(--tap); border: 0; border-right: 1px solid var(--color-navy); background: #fff; color: var(--color-navy); font-weight: 500; cursor: pointer; transition: background-color var(--ease), color var(--ease); }
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover:not([disabled]):not(.active) { background: var(--color-navy-tint); }
.seg-btn.active.seg-yes { background: var(--color-olive); color: #fff; }
.seg-btn.active.seg-no { background: var(--color-text-muted); color: #fff; }
.seg-btn.active.seg-maybe { background: var(--color-khaki); color: var(--color-text); }
.seg-btn[disabled] { opacity: .6; cursor: not-allowed; }
.adult-block { border-bottom: 1px solid var(--color-border); padding-bottom: 8px; }
.adult-block:last-child { border-bottom: 0; }
.adult-block .person-row { border-bottom: 0; }
.logistics { background: var(--color-tan); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 12px; }
.drive-form { display: grid; gap: 8px; }
.drive-form label { display: grid; gap: 4px; font-weight: 500; font-size: var(--fs-base); }
.meal-summary { margin: 8px 0 0; font-size: var(--fs-base); }
.untrained-note { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; padding: 8px 12px; background: var(--color-row-attention); border: 1px solid var(--color-attention-border); border-radius: var(--radius); color: var(--color-text); }
.untrained-note .icon { margin-top: 3px; color: var(--color-amber); }
.not-cleared { margin: 0; font-size: var(--fs-base); }
.badge-case { text-transform: none; }
.driving-only-note { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--color-olive); font-weight: 500; }
.meal-cards { display: grid; gap: 10px; }
.meal-card { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 12px; }
.meal-card h3 { margin: 0 0 6px; }
.meal-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: var(--tap); }
.meal-slot.taken { color: var(--color-text-muted); }
.slot-label { font-weight: 600; min-width: 48px; }
.acting { display: grid; gap: 4px; font-weight: 600; margin-bottom: 10px; }
.pay-row { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.retro-answers dt { font-weight: 600; margin-top: 10px; }
.retro-answers dd { margin: 2px 0 0; white-space: normal; }
.retro-radios { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 6px 12px; display: grid; gap: 2px; }
.retro-status { color: var(--color-olive); font-weight: 600; align-self: center; }
.role-checks { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 6px 12px; display: grid; gap: 2px; }
.buying-total { font-weight: 600; margin: 4px 0 0; }
.pay-actions { display: flex; gap: 8px; align-items: center; }
.pay-actions select { flex: 1; }

/* ---- Wider screens ---- */
@media (min-width: 720px) {
  h1 { font-size: var(--fs-2xl); }
  .container { padding: 20px 24px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-2 .span-2 { grid-column: span 2; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .dash-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
  .patrol-grid { grid-template-columns: repeat(2, 1fr); }
  .campout-cards { grid-template-columns: repeat(2, 1fr); }
  .driver-cards { grid-template-columns: repeat(2, 1fr); }
  .patrol-checks { grid-template-columns: repeat(3, 1fr); }
  .print-cols { grid-template-columns: repeat(2, 1fr); }
  .assign-form { grid-template-columns: 1fr 120px auto; }
  .entry-grid { grid-template-columns: repeat(2, 1fr); }
  .person-row, .pay-row { grid-template-columns: 1fr 340px; align-items: center; }
  .drive-form { grid-template-columns: 1fr 140px auto; align-items: end; }
  .meal-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .roster li { grid-template-columns: 1fr 200px; align-items: center; }
  .toast { left: auto; right: 24px; max-width: 380px; }
  .cards-on-mobile thead { display: table-header-group; }
  .cards-on-mobile tr { display: table-row; border: 0; padding: 0; margin: 0; border-radius: 0; background: transparent; }
  .cards-on-mobile td { display: table-cell; border-bottom: 1px solid var(--color-border); padding: 6px 10px; }
  .cards-on-mobile td::before { content: none; }
  .cards-on-mobile td > * { text-align: left; }
  .sheet td, .sheet th { white-space: nowrap; }
  .sheet td:last-child { white-space: normal; }
  .sheet .meal-cell select { width: auto; display: inline-block; }

  /* Admin density: compact controls on desktop (phones keep 44px). */
  .area-admin input[type=text], .area-admin input[type=email], .area-admin input[type=tel], .area-admin input[type=password],
  .area-admin input[type=search], .area-admin input[type=date], .area-admin input[type=datetime-local], .area-admin input[type=number],
  .area-admin input:not([type]), .area-admin select, .area-admin textarea { min-height: var(--ctl); font-size: var(--fs-base); }
  .area-admin textarea { min-height: 70px; }
  .area-admin .btn { min-height: var(--ctl); }
  .area-admin .btn-small { min-height: 26px; padding: 2px 8px; font-size: var(--fs-xs); }
  .area-admin .form label.check, .area-admin label.check { min-height: var(--ctl); }
  .area-admin .card > summary { min-height: 28px; }
  .area-admin .subnav a { min-height: 36px; padding: 6px 12px; }
  .area-admin .table select, .area-admin .table input:not([type=checkbox]) { min-height: 28px; padding: 2px 6px; font-size: var(--fs-sm); }
  .area-admin .sheet select { min-width: 96px; }
  .area-admin .buyer-line select { min-height: 28px; padding: 2px 6px; font-size: var(--fs-sm); }
  .area-admin .sheet-patrol > summary { flex-wrap: nowrap; min-height: 40px; padding: 4px 12px; }

  /* Spreadsheet rows ~36px: 28px controls + 3px padding top/bottom + 1px border. */
  .area-admin .sheet td { padding-top: 3px; padding-bottom: 3px; }
  .area-admin .sheet td:first-child { line-height: 1.2; }
  .area-admin .sheet select, .area-admin .sheet input:not([type=checkbox]) { height: var(--ctl-sheet); min-height: var(--ctl-sheet); vertical-align: middle; }
  .name-cell { gap: 8px; }
  .rsvp-check::after { content: none; }
  .area-admin .link-remove { min-width: 20px; min-height: 20px; }
  .adult-edit-grid { grid-template-columns: repeat(4, 1fr); }
  .meta-list { grid-template-columns: 140px 1fr; }
  .meta-list dt { margin-top: 0; }
  .filter-checks { grid-template-columns: 1fr 2fr; }
  .filter-checks fieldset:last-child { columns: 2; }
  .resend-grid { grid-template-columns: 1fr 2fr; }
  .area-admin .seg-links a { min-height: var(--ctl); }
}

@media (min-width: 960px) {
  .nav-burger { display: none; }
  .nav { display: flex; flex-direction: row; width: auto; padding: 0; gap: 2px; margin-left: auto; }
  .nav a, .nav .linklike { border: 0; padding: 0 10px; min-height: 48px; border-bottom: 2px solid transparent; }
  .nav a.active { border-bottom-color: var(--color-khaki); }
  .brand { flex: 0 0 auto; margin-right: 24px; }
  .topbar { flex-wrap: nowrap; height: 48px; }
  .patrol-grid { grid-template-columns: repeat(3, 1fr); }
  .campout-cards { grid-template-columns: repeat(3, 1fr); }
  .driver-cards { grid-template-columns: repeat(3, 1fr); }
  .entry-grid { grid-template-columns: repeat(4, 1fr); }
}

@media print {
  .topbar, .toast, .no-print, .flash, .subnav { display: none !important; }
  .print-cols { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .print-block { border-color: #999; }
  .packing h2 { margin: 10px 0 4px; font-size: 14px; }
  body { background: #fff; font-size: 12px; }
  h1::after { display: none; }
  .container { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* Fix parent names */
.placeholder-table input { width: 100%; min-width: 8em; }
.placeholder-table tr.is-fixed { background: var(--color-row-driver); }

/* Family page: driving offer from an adult not cleared to camp */
.driving-offer { margin: 12px 0 0; padding: 12px; border: 1px solid var(--color-attention-border); border-radius: var(--radius); background: var(--color-row-attention); }
.driving-offer h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; }
.driving-offer p { margin: 0 0 8px; }
.offer-form { display: grid; gap: 8px; }
.offer-form fieldset { margin: 0; padding: 0; border: 0; }
.offer-form > label { display: grid; gap: 4px; font-weight: 500; max-width: 160px; }

/* Family home: subtle link for parents who are also leaders. */
.leader-login { margin: 24px 0 8px; text-align: center; font-size: 13px; }
.leader-login a { color: var(--color-text-muted); text-decoration: none; }
.leader-login a:hover, .leader-login a:focus { text-decoration: underline; }

/* Public campout pages (/campouts). */
.public-signed-in { margin: 0 0 10px; font-size: var(--fs-sm); color: var(--color-text-muted); }
tr.row-link { cursor: pointer; }
tr.row-link:hover { background: var(--color-navy-tint); }
.tabs { display: flex; gap: 4px; margin: 12px 0; border-bottom: 1px solid var(--color-border); }
.tabs a { padding: 8px 14px; min-height: var(--tap); display: inline-flex; align-items: center; color: var(--color-text-muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.active { color: var(--color-navy); border-bottom-color: var(--color-navy); }
.public-patrol h2 .muted { font-weight: 400; font-size: var(--fs-base); }
.public-roster li.is-attending { color: #2e7d32; font-weight: 500; }
.public-roster .check { display: inline-block; width: 1.1em; font-weight: 700; }
.public-sub { margin: 14px 0 4px; font-size: var(--fs-base); }
.card > .public-sub:first-of-type { margin-top: 4px; }
.public-pairs li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.public-past-head { margin-top: 28px; color: var(--color-text-muted); }
.table.public-past tbody tr, .cards-on-mobile.public-past tr { background: var(--color-row-inactive); color: var(--color-text-muted); }
.table.public-past a { color: var(--color-text-muted); }
.table.public-past tbody tr.row-link:hover { background: var(--color-border); }
.stats-compact { gap: 8px; margin: 10px 0 4px; }
.stats-compact .stat { padding: 8px 12px; }
.stats-compact .stat-label { font-size: var(--fs-base); }
.stats-compact .num { font-size: var(--fs-lg); }
.stats-compact .num small { font-size: var(--fs-sm); font-weight: 500; color: var(--color-text-muted); }
.stat-ok { background: var(--color-row-driver); border-color: #b9c79a; }
.stat-ok .num { color: #2e7d32; }
