/* Flock: one hand-written stylesheet, no build step needed. */
:root {
  --bg: #f6f1e6;
  --card: #ffffff;
  --ink: #17231f;
  --muted: #66716c;
  --line: #e7e0d1;
  --brand: #0f3d33;
  --brand-2: #17594a;
  --gold: #e2ad48;
  --gold-soft: #fbf0d9;
  --violet: #6b5cf6;
  --violet-soft: #efedff;
  --green: #16a34a;
  --green-soft: #e6f6ec;
  --red: #dc2626;
  --red-soft: #fdecec;
  --amber: #b45309;
  --amber-soft: #fef3e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 35, 31, .05), 0 4px 16px rgba(23, 35, 31, .05);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--brand); color: #e9efe9; padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; font-size: 1.15rem; color: #fff; text-decoration: none; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--gold); color: var(--brand); display: grid; place-items: center; font-weight: 800; }
.church-name { font-size: .78rem; color: #b9cbc3; font-weight: 500; display: block; line-height: 1.2; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #d6e2dc; text-decoration: none; font-weight: 600; font-size: .93rem; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.on { background: rgba(255,255,255,.12); color: #fff; }
.nav .count { margin-left: auto; background: var(--gold); color: var(--brand); border-radius: 99px; font-size: .72rem; padding: 0 7px; font-weight: 800; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #8fa89d; padding: 16px 12px 4px; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.1); font-size: .85rem; }
.side-foot button { background: none; border: 0; color: #b9cbc3; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
.main { padding: 28px 32px 60px; max-width: 1180px; width: 100%; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Pieces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 20px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #cfc6b3; }
.btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.primary:hover { background: #5a4be3; }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: .82rem; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--red); }
.btn.on { background: var(--violet-soft); border-color: #cfc8ff; color: #4636d8; }
.btn.on-done { background: var(--green-soft); border-color: #bfe5cc; color: #127a39; }

.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 1px 9px; font-size: .74rem; font-weight: 600; background: #f1ede4; color: #5d5a50; border: 1px solid transparent; white-space: nowrap; }
.pill.gold { background: var(--gold-soft); color: #8a5a07; border-color: #f2dcae; }
.pill.violet { background: var(--violet-soft); color: #4636d8; border-color: #dcd7ff; }
.pill.green { background: var(--green-soft); color: #127a39; border-color: #c4e8d1; }
.pill.red { background: var(--red-soft); color: var(--red); border-color: #f7cccc; }
.pill.amber { background: var(--amber-soft); color: var(--amber); border-color: #f6dcb5; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { text-decoration: none; padding: 5px 12px; border-radius: 99px; font-size: .85rem; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.tabs a.on { background: var(--violet); border-color: var(--violet); color: #fff; }

.search { display: flex; gap: 8px; margin: 14px 0 18px; }
.search input { flex: 1; }

label { font-weight: 600; font-size: .88rem; display: block; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; font: inherit; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #cbc5ff; border-color: var(--violet); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin: 0; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--violet); flex: none; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.err { color: var(--red); font-size: .82rem; margin-top: 4px; }
.field + .field { margin-top: 14px; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 600; }
.flash.ok { background: var(--green-soft); color: #11632f; border: 1px solid #c4e8d1; }
.flash.error { background: var(--red-soft); color: #9f1d1d; border: 1px solid #f7cccc; }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--violet-soft); color: #4636d8; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar.sm { width: 28px; height: 28px; font-size: .7rem; }

/* People cards */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.person { display: flex; gap: 12px; padding: 14px; text-decoration: none; }
.person:hover { border-color: #d6cdb9; }
.person .name { font-weight: 700; }
.person .meta { font-size: .8rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.person .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }

/* Follow-ups */
.fu { padding: 16px 18px; }
.fu + .fu { border-top: 1px solid var(--line); }
.fu-title { font-weight: 700; }
.fu-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.fu-actions form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.fu-actions select, .fu-actions input[type=date] { width: auto; padding: 5px 8px; font-size: .82rem; border-radius: 8px; }
.report { background: #faf8f3; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-top: 10px; font-size: .86rem; }
details.add-report { margin-top: 10px; }
details.add-report summary { cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--violet); list-style: none; }
details.add-report summary::-webkit-details-marker { display: none; }
.lock { font-size: .78rem; color: var(--muted); margin-top: 6px; }

/* Stats */
.stat { padding: 18px; }
.stat .k { font-size: .85rem; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 1.9rem; font-weight: 800; margin-top: 6px; }
.bar { height: 8px; background: #efebe1; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--violet); border-radius: 99px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart .col span { width: 100%; background: var(--brand-2); border-radius: 5px 5px 0 0; min-height: 2px; }
.chart .col small { font-size: .65rem; color: var(--muted); white-space: nowrap; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.red { color: var(--red); font-weight: 700; }

.away-list .item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.away-list .item:last-child { border-bottom: 0; }
.weeks { color: var(--amber); font-weight: 700; font-size: .85rem; white-space: nowrap; }

.banner { background: linear-gradient(135deg, #fff9ec, #fbf0d9); border: 1px solid #f2dcae; border-radius: var(--radius); padding: 18px 20px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.pagination { margin-top: 18px; }
.pagination nav { display: flex; justify-content: center; }
.pagination svg { width: 18px; }

/* ---------- Public pages (door form, login) ---------- */
.public { min-height: 100vh; display: flex; justify-content: center; padding: 28px 16px 60px; background: radial-gradient(circle at top, #fffaf0, var(--bg) 60%); }
.public .box { width: 100%; max-width: 460px; }
.public .head { text-align: center; margin-bottom: 22px; }
.public .head .logo-mark { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 12px; font-size: 1.4rem; }
.public h1 { font-size: 1.55rem; }
.photo-pick { display: flex; align-items: center; gap: 12px; }
.photo-pick input { font-size: .85rem; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choices label { margin: 0; font-weight: 500; font-size: .86rem; }
.choices input { display: none; }
.choices span { display: inline-block; border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 99px; cursor: pointer; }
.choices input:checked + span { background: var(--violet-soft); border-color: var(--violet); color: #4636d8; }
.hp { position: absolute; left: -9999px; }

/* Printable QR poster */
.poster { max-width: 560px; margin: 0 auto; text-align: center; padding: 40px 32px; background: #fff; border-radius: 22px; border: 1px solid var(--line); }
.poster h1 { font-size: 2.2rem; color: var(--brand); }
.poster #qr { display: inline-block; padding: 16px; background: #fff; border: 6px solid var(--brand); border-radius: 18px; margin: 24px 0 18px; }
.poster #qr img, .poster #qr canvas { display: block; }

@media print {
  .side, .no-print { display: none !important; }
  .shell { display: block; }
  body, .main { background: #fff; padding: 0; }
  .poster { border: 0; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 10; }
  .topbar button { background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }
  .main { padding: 18px 16px 50px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .g4.stats, .g3.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 1.45rem; }
  .table-wrap { overflow-x: auto; }
}
.main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .main-side { grid-template-columns: 1fr; } }

/* ---------- Church logo ---------- */
.logo-img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.topbar-brand { display: flex; align-items: center; gap: 8px; }
.topbar-brand .logo-img { width: 28px; height: 28px; }
.brand-logo { display: block; width: 112px; height: 112px; margin: 0 auto 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 6px 18px rgba(15,61,51,.08); }
.poster .brand-logo { width: 120px; height: 120px; margin-bottom: 16px; box-shadow: none; }

/* ---------- Day and month pickers (birthdays, anniversaries) ---------- */
.daymonth { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }

/* ---------- Developer area ---------- */
.status-table td { vertical-align: top; }
.facts { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.log-entry { padding: 12px 16px; }
.log-entry + .log-entry { border-top: 1px solid var(--line); }
.log-msg { font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.log-detail { margin-top: 6px; }
.log-detail summary { cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--violet); }
.log-detail pre { margin: 8px 0 0; padding: 12px; background: #17231f; color: #dfe9e4; border-radius: 10px; font: .76rem/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; }
ul.plain, ol.plain { margin: 0; padding-left: 20px; font-size: .88rem; }
ul.plain li + li, ol.plain li + li { margin-top: 6px; }

/* ---------- Door check-in (phone number only) ---------- */
.checkin-card h2 { font-size: 1.3rem; }
.big-input { font-size: 1.3rem !important; padding: 14px 16px !important; letter-spacing: .03em; }
.big-btn { width: 100%; justify-content: center; padding: 14px; font-size: 1.05rem; }
.ghost-card { background: #fff; }
.or { display: flex; align-items: center; gap: 12px; margin: 22px 0 12px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Usher's register ---------- */
.reg-summary { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.reg-count { display: flex; align-items: baseline; gap: 8px; }
.reg-count span { font-size: 2.6rem; font-weight: 800; color: var(--green); line-height: 1; }
.reg-count small { font-weight: 700; color: var(--muted); }
.reg-recent { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-basis: 100%; }
.reg-recent .pill { text-decoration: none; }
.reg-tools { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 8px 0 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.reg-tools input { flex: 1; min-width: 220px; font-size: 1.05rem; padding: 12px 14px; }
.reg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.reg-row { margin: 0; }
.reg-row[hidden] { display: none; }
.reg-row button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; font: inherit; text-align: left; cursor: pointer; color: var(--ink); min-height: 62px; transition: background .12s, border-color .12s; }
.reg-row button:hover { border-color: #cfc6b3; }
.reg-name { flex: 1; min-width: 0; font-weight: 700; display: flex; flex-direction: column; }
.reg-name .tiny { font-weight: 500; }
.reg-tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; font-weight: 800; flex: none; }
.reg-row.on button { background: var(--green-soft); border-color: #9fd9b4; }
.reg-row.on .reg-tick { background: var(--green); border-color: var(--green); color: #fff; }
.reg-row.busy button { opacity: .7; }
.reg-row.failed button { border-color: var(--red); background: var(--red-soft); }
#none { cursor: pointer; margin-top: 8px; }
.reg-add { margin-top: 20px; }
.reg-add summary { cursor: pointer; }

/* Door pages: photo picker (take a photo / choose from phone) */
.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; opacity: 0; }
.photo-pick { flex-wrap: wrap; }
.photo-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-btns label { position: relative; margin: 0; cursor: pointer; }
.photo-preview.has-photo { background-size: cover; background-position: center; }
