:root {
  --night: #120A33;
  --purple: #29166F;
  --purple-dark: #1E0F57;
  --purple-soft: #ECE8F7;
  --green: #067A38;
  --green-bright: #3FD07F;
  --green-soft: #E3F3E9;
  --ground: #F1EEF8;
  --ink: #14171F;
  --muted: #555B66;
  --line: #CBD0D9;
  --warn: #B3470B;
  --warn-soft: #FDEEE3;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  font-family: Inter, system-ui, sans-serif;
  font-weight: 500;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 480px; min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; background: var(--ground); }
.loading { margin: auto; color: #fff; padding: 40px; }
h1, h2, .brand { font-family: 'Space Grotesk', sans-serif; font-weight: 700; margin: 0; }
button, input { font-family: inherit; }
a { color: var(--purple); }

/* Dark hero with logo rings */
.hero {
  position: relative; z-index: 0; overflow: hidden;
  background: var(--night); color: #fff;
  padding: calc(48px + env(safe-area-inset-top)) 24px 32px;
}
.hero .rings { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.hero.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hero p { color: #D4D0E8; margin: 0; line-height: 1.5; }
.hero .top { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px; margin-left: -10px; border: none; background: transparent; color: inherit;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 10px;
}
.app-badge {
  width: 88px; height: 88px; border-radius: 26px; background: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px #0C9A4A;
}
.brand { font-size: 32px; }

/* White sheet */
.sheet {
  flex: 1; background: #fff; border-radius: 28px 28px 0 0; margin-top: -16px; position: relative;
  padding: 28px 24px calc(32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px;
}
.sheet h1 { font-size: 26px; }
.lead { color: var(--muted); font-size: 15px; line-height: 1.45; margin: -8px 0 0; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 700; }
.field .hint { font-size: 12px; color: var(--muted); }
.input {
  height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 16px; color: var(--ink); background: #fff; width: 100%;
}
.input:focus { outline: 3px solid rgba(41, 22, 111, 0.25); border-color: var(--purple); }
.input.code { height: 60px; font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; letter-spacing: 0.25em; text-transform: uppercase; }
.pw { position: relative; }
.pw .input { padding-right: 70px; }
.pw button { position: absolute; right: 4px; top: 4px; height: 42px; padding: 0 12px; border: none; background: transparent; color: var(--purple); font-weight: 700; font-size: 14px; cursor: pointer; }

.btn {
  height: 52px; border-radius: 12px; border: none; font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; width: 100%;
}
.btn.primary { background: var(--purple); color: #fff; }
.btn.go { background: var(--green); color: #fff; }
.btn.light { background: #fff; color: var(--purple); }
.btn.outline { background: #fff; color: var(--purple); border: 1px solid var(--purple); }
.btn.ghost { background: transparent; color: var(--muted); height: 44px; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.link-row { display: flex; justify-content: center; gap: 6px; font-size: 15px; align-items: center; }
.link-row button { border: none; background: none; font: inherit; font-weight: 700; color: var(--green); cursor: pointer; padding: 12px 4px; }

.error { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 700; }
.note { background: var(--ground); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: #2E2A45; line-height: 1.45; }
.spacer { margin-top: auto; }

/* Home */
.church-head { padding: calc(40px + env(safe-area-inset-top)) 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.church-id { display: flex; align-items: center; gap: 12px; }
.church-id .mark {
  width: 52px; height: 52px; border-radius: 26px; background: rgba(255,255,255,0.15); box-shadow: 0 0 0 2px #0C9A4A;
  display: flex; align-items: center; justify-content: center; font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; flex-shrink: 0;
}
.church-id .name { font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.church-id .sub { font-size: 12px; color: #CEC8EA; }
.church-head h1 { font-size: 28px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #0B2416; background: var(--green-bright); padding: 4px 8px; border-radius: 6px; }

.content { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card { background: #fff; border: 1px solid #E2DCF2; box-shadow: 0 2px 8px rgba(41,22,111,0.07); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card h2 { font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.big-code { font-family: 'Space Grotesk', sans-serif; font-size: 36px; font-weight: 700; letter-spacing: 0.2em; color: var(--purple); }
.row { display: flex; gap: 10px; }
.row .btn { height: 46px; font-size: 15px; }
.switcher { height: 44px; border-radius: 10px; border: 1px solid #4A3A8F; background: rgba(255,255,255,0.08); color: #fff; font-size: 14px; font-weight: 600; padding: 0 10px; }
.switcher option { color: var(--ink); }
.done-tick { width: 72px; height: 72px; border-radius: 36px; background: var(--green-soft); color: var(--green); display: flex; align-items: center; justify-content: center; align-self: center; }
.center-text { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- step 2 ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.content.with-nav { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.section { font-family: Inter, sans-serif; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 4px 0 -4px; }
.label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.strong { font-weight: 700; font-size: 15px; color: var(--ink); }
.muted { color: var(--muted); font-size: 14px; }
.card.tight { padding: 4px 14px; gap: 0; }
.card .row .btn { flex: 1; }
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 20;
  background: #fff; border-top: 1px solid #E3E6EC; display: flex; justify-content: space-around;
  padding: 6px 8px calc(10px + env(safe-area-inset-bottom));
}
.bottom-nav button { border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 76px; padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.bottom-nav button.on { color: var(--purple); font-weight: 700; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 30; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; max-width: 90%; }
.church-head h1 { font-size: 26px; }
.church-head .icon-btn { margin-left: -10px; }

.date-row { display: flex; gap: 14px; align-items: center; }
.date-badge { width: 52px; height: 56px; border-radius: 12px; background: var(--purple-soft); color: var(--purple); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.date-badge span { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.date-badge b { font-family: 'Space Grotesk', sans-serif; font-size: 22px; line-height: 1; }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ok { color: var(--green); font-weight: 700; font-size: 14px; }
.bad { color: var(--warn); font-weight: 700; font-size: 14px; }
.link-btn { border: none; background: none; color: var(--purple); font: inherit; font-size: 13px; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 8px 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 16px; background: var(--purple-soft); color: var(--purple-dark); }
.chip.confirmed { background: var(--green-soft); color: var(--green); }
.chip.declined { background: #F1F2F4; color: #6B7180; text-decoration: line-through; }
.chip button { border: none; background: none; font-size: 18px; line-height: 1; color: inherit; cursor: pointer; padding: 0 2px; min-width: 24px; min-height: 24px; }

.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.pill-btn { flex-shrink: 0; height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.pill-btn.on { background: var(--purple); color: #fff; border-color: var(--purple); }
.ev-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ev-title h2 { font-size: 20px; }
.tag { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: var(--purple-soft); color: var(--purple-dark); white-space: nowrap; }
.tag.ok { background: var(--green-soft); color: var(--green); }
.tag.warn { background: var(--warn-soft); color: #9A3B08; }
.tag.draft { background: #FFF4CC; color: #6B4E00; }
.slot-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.slot-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #EEF0F3; padding-top: 10px; }
.place { display: flex; align-items: center; gap: 8px; background: var(--ground); border-radius: 10px; padding: 4px 4px 4px 12px; }
.place .person { flex: 1; font-weight: 700; }
.x { width: 40px; height: 40px; border: none; border-radius: 8px; background: var(--warn-soft); color: #9A3B08; font-size: 20px; font-weight: 700; cursor: pointer; }
select.input { appearance: auto; }
.pick { border-style: dashed; color: var(--muted); }

.admin-tile { text-align: left; border: 1px solid #E2DCF2; background: #fff; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; box-shadow: 0 2px 8px rgba(41,22,111,0.07); }
.part-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #EEF0F3; }
.part-row:last-child { border-bottom: none; }
.small-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.stepper button { width: 38px; height: 40px; border: none; background: var(--ground); color: var(--purple); font-size: 20px; font-weight: 700; cursor: pointer; }
.stepper button:disabled { opacity: 0.4; cursor: default; }
.stepper span { width: 32px; text-align: center; font-weight: 700; }
.bin { width: 40px; height: 40px; border: none; border-radius: 10px; background: var(--warn-soft); color: #9A3B08; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid #EEF0F3; font-size: 15px; }
.check-row input, .small-check input { width: 20px; height: 20px; accent-color: var(--purple); }
fieldset.card { margin: 0; }
.btn.danger { color: #9A3B08; }

/* Netlify's "Powered by Netlify" badge sits bottom-right on free sites: lift the menu above it */
body.has-badge .bottom-nav { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
body.has-badge .content.with-nav { padding-bottom: calc(176px + env(safe-area-inset-bottom)); }
body.has-badge .toast { bottom: calc(156px + env(safe-area-inset-bottom)); }
.date-card { border: 2px solid var(--green); background: #F4FAF6; }

/* declined alerts */
.tag.bad { background: #FBE3E3; color: #A1281F; }
.place.declined { background: #FBE3E3; }
.place.declined .person { text-decoration: line-through; color: #7A2A24; }
.card.attention { border: 2px solid #C0392B; background: #FFF6F5; }
.card.attention h2 { color: #A1281F; }
.attention-row { text-align: left; border: none; background: #fff; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card.attention-ok { border: 1px solid #CDE9D7; background: #F4FAF6; }
.part-head { display: flex; justify-content: space-between; padding: 12px 0 4px; }
.part-row.off .strong { color: #8A8F99; }
.big-check { width: 22px; height: 22px; accent-color: var(--purple); flex-shrink: 0; }
.check-row.card { gap: 12px; align-items: center; font-size: 14px; }

/* part times */
.time-tag { display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 700; color: var(--purple); background: var(--purple-soft); padding: 2px 7px; border-radius: 6px; vertical-align: middle; white-space: nowrap; }
.my-time { margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--purple); }
.part-row.wrap { flex-wrap: wrap; row-gap: 8px; }
.part-main { flex: 1 1 100%; min-width: 0; }
.part-ctrls { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.mins { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; height: 40px; background: #fff; font-size: 13px; color: var(--muted); }
.mins input { width: 40px; border: none; font: inherit; font-size: 16px; font-weight: 700; color: var(--ink); text-align: right; background: transparent; padding: 0; }
.mins input:focus { outline: none; }
.mins:focus-within { outline: 3px solid rgba(41,22,111,0.25); border-color: var(--purple); }
.start-row { flex-direction: row; align-items: center; justify-content: space-between; }
.slot-foot { gap: 8px; }

/* swaps */
.btn.swap { background: var(--green-soft); color: var(--green); border: 1px solid var(--green); }
.btn.swap.small { width: auto; height: 36px; padding: 0 12px; font-size: 13px; flex: 0 0 auto; }
.swap-panel { background: var(--ground); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.swap-panel p { margin: 0; font-size: 13px; color: var(--muted); }
.swap-out { background: var(--green-soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #1F3B2A; }
.swap-out b { color: var(--green); font-size: 14px; }
.swap-out .link-btn { align-self: flex-start; }
.card.swap-in { border: 2px solid var(--green); background: #F4FAF6; }
.card.swap-in h2 { color: var(--green); }
.swap-item { background: #fff; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.swap-item p { margin: 0; color: var(--ink); font-size: 15px; }
.card .row .btn { min-width: 0; padding: 0 8px; }

/* turns */
.place .turn { font-size: 12px; font-weight: 700; color: var(--purple); background: #fff; border-radius: 6px; padding: 3px 6px; white-space: nowrap; }
.turn-label { font-size: 12px; font-weight: 700; color: var(--purple); margin: 2px 0 -4px 2px; }
.up { width: 36px; height: 40px; border: none; border-radius: 8px; background: var(--purple-soft); color: var(--purple); font-size: 18px; font-weight: 700; cursor: pointer; }
.chip small { font-size: 11px; font-weight: 700; opacity: 0.85; }

/* person times */
.place-wrap { background: var(--ground); border-radius: 10px; display: flex; flex-direction: column; }
.place-wrap.declined { background: #FBE3E3; }
.place-wrap .place { background: transparent; }
.person-time { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0 12px 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.person-time label { display: inline-flex; align-items: center; gap: 6px; }
.person-time input[type=time] { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 15px; color: var(--ink); background: #fff; }
.person-time .link-btn { padding: 4px 0; }
.person-time input[type=time] { width: 112px; padding: 0 4px; font-size: 14px; }
.person-time { gap: 8px; }

/* notes */
.add-note { margin: 0 12px 8px; align-self: flex-start; font-size: 13px; }
.note-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin: 0 12px 10px; padding: 8px 10px; background: #FFF8E1; border-radius: 8px; font-size: 13px; color: #4A3B00; }
.note-line .link-btn { padding: 0; }
.note-edit { margin: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.note-edit textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; resize: vertical; }
.note-edit textarea:focus { outline: 3px solid rgba(41,22,111,0.25); border-color: var(--purple); }
.danger-link { color: #9A3B08; align-self: flex-start; }
.admin-note { background: #FFF8E1; border-radius: 10px; padding: 10px 12px; font-size: 14px; color: #4A3B00; display: flex; flex-direction: column; gap: 2px; }
.admin-note b { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

/* members */
.card.member { gap: 6px; }
.member-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.member-actions .btn { height: 44px; font-size: 14px; }
.member-actions .btn.ghost { grid-column: span 2; }
.reset-box { border: 2px solid var(--purple); }
.big-pw { font-family: 'Space Grotesk', monospace; font-size: 28px; font-weight: 700; letter-spacing: 0.06em; color: var(--purple); word-break: break-all; }
.pill { white-space: nowrap; }

/* church look */
.mark.logo { object-fit: cover; background: #000; padding: 0; }
.mark.logo.small { width: 40px; height: 40px; border-radius: 20px; }
.look-preview { position: relative; z-index: 0; overflow: hidden; border-radius: 14px; padding: 18px 16px; color: #fff; display: flex; flex-direction: column; gap: 12px; }
.look-preview .rings { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.look-preview .pill { color: #0B2416; }
.look-h1 { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }
.look-btn { flex: 1; height: 40px; border-radius: 10px; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch { width: 44px; height: 44px; border-radius: 22px; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.logo-row { display: flex; gap: 14px; align-items: center; }
.logo-big { width: 96px; height: 96px; border-radius: 48px; object-fit: cover; background: #000; flex-shrink: 0; }
.logo-big.empty { background: var(--ground); color: var(--muted); font-size: 12px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; }
.file-btn { cursor: pointer; }
.file-btn:focus-within { outline: 3px solid rgba(41,22,111,0.35); }

/* calendar */
.cal-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; text-decoration: none; font-size: 13px; }
.cal-panel { background: var(--ground); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cal-panel p { margin: 0; font-size: 13px; color: var(--muted); }
.cal-panel .btn { height: 46px; font-size: 15px; }
.cal-panel .link-btn { align-self: flex-start; }
.card.cal-all { gap: 10px; }
.card.cal-all .btn { height: 46px; font-size: 14px; }

/* install */
.card.install { gap: 10px; }
.card.install.on-dark { margin-top: 18px; text-align: left; color: var(--ink); }
.install-row { display: flex; gap: 12px; align-items: flex-start; }
.install-icon { width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0; }
.install-steps { margin: 6px 0 0; padding-left: 18px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.install-steps svg { vertical-align: -3px; color: #0A84FF; }
.card.install .link-btn { align-self: flex-start; color: var(--muted); }
/* when installed, leave room for the phone's status bar */
@media (display-mode: standalone) { .hero { padding-top: calc(28px + env(safe-area-inset-top)); } }

/* notifications */
.card.push { gap: 10px; }
.card.push.on { border: 1px solid #CDE9D7; background: #F4FAF6; }
.push-row { display: flex; gap: 12px; align-items: flex-start; color: var(--purple); }
.push-row svg { flex-shrink: 0; margin-top: 2px; }
.push-row p { margin: 2px 0 0; }
.card.push .row .btn { height: 44px; font-size: 14px; }
