:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --surface: #fffdfa;
  --ink: #172b3c;
  --quiet: #52616a;
  --line: #deddd3;
  --accent: #ad4b25;
  --accent-bg: #f8e7dc;
  --green: #285b4b;
  --green-bg: #e5eee7;
  --hero: #172d40;
  --hero-deep: #112437;
  --hero-text: #fff8ed;
  --hero-muted: #c5d2d8;
  --hero-line: #647787;
  --peach: #ffc294;
  --focus: #aa4a22;
  --shadow: 0 8px 24px #182a3810;
  --sans: "Segoe UI", system-ui, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --radius: 16px;
  --hero-radius: 25px;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --quick: 130ms;
  --enter: 220ms;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101b25;
  --surface: #172632;
  --ink: #f7f0e6;
  --quiet: #b9c6cd;
  --line: #3b4b58;
  --accent: #ffbe98;
  --accent-bg: #442f29;
  --green: #a9dcc8;
  --green-bg: #233e38;
  --focus: #ffc294;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.5 var(--sans); min-height: 100vh; }
h1, h2, h3, p, ul { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 500; line-height: 1.1; }
h1 { font-size: clamp(2.15rem, 5.2vw, 3.45rem); letter-spacing: -.052em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); letter-spacing: -.035em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; color: inherit; }
button, input, select, textarea, [tabindex] { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .65; }
button, .button { transition: background-color var(--quick) ease-out, color var(--quick) ease-out, border-color var(--quick) ease-out; }
svg:not(.icon-library) { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }

.topbar { position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { width: min(100% - 40px, 1120px); min-height: 75px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 740; letter-spacing: -.03em; white-space: nowrap; }
.brand-mark { width: 33px; aspect-ratio: 1; border-radius: 10px; background: var(--hero); color: var(--peach); position: relative; flex: none; }
.brand-mark::before, .brand-mark::after { position: absolute; content: ""; background: currentColor; border-radius: 2px; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.brand-mark::before { height: 17px; width: 2px; }
.brand-mark::after { width: 13px; height: 2px; margin-top: -2px; }
.top-actions, .navigation, .week-arrows { display: flex; align-items: center; gap: 4px; }
.navigation button, .icon-button, .week-arrows button { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 11px; background: transparent; }
.navigation button { padding-inline: 11px; color: var(--quiet); font-size: .875rem; font-weight: 700; }
.navigation button[aria-current] { color: var(--ink); background: var(--paper); border-color: var(--line); }
.navigation button:hover, .icon-button:hover { background: var(--paper); }
.navigation button:active, .icon-button:active { border-color: var(--accent); }
.nav-count { min-width: 20px; padding: 1px 5px; border-radius: 12px; font-size: .72rem; background: var(--accent-bg); color: var(--accent); }
.profile-button { padding-inline: 10px; font-size: .875rem; font-weight: 700; }
#profile-name { max-width: 84px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#profile-name:empty { display: none; }
.demo-label { color: var(--accent); font-size: .72rem; font-weight: 750; background: var(--accent-bg); border-radius: 6px; padding: 3px 7px; }

.container { width: min(100% - 40px, 1120px); margin: 0 auto; padding: 42px 0 64px; }
.page-heading, .section-heading, .coverage-head, .coverage-foot, .week-heading, .dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-heading { margin-bottom: 23px; align-items: flex-end; }
.page-heading p { margin-top: 9px; }
.muted, .legend { color: var(--quiet); }
.button { border: 1px solid transparent; border-radius: 11px; min-height: 46px; display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 8px 15px; font-weight: 700; line-height: 1.25; text-align: center; }
.primary { background: var(--ink); color: var(--surface); }
.primary:hover, .primary:active { background: var(--accent); color: var(--surface); }
.outline { background: transparent; border-color: var(--line); color: var(--ink); }
.outline:hover, .outline:active { border-color: var(--accent); color: var(--accent); }
.danger { background: var(--accent-bg); color: var(--accent); }
.danger:hover, .danger:active { border-color: var(--accent); }
.card, .day-card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.access { max-width: 540px; padding: clamp(20px, 5vw, 38px); margin: 8vh auto 0; box-shadow: var(--shadow); }
.access h1 { font-size: clamp(2rem, 7vw, 3rem); margin-bottom: 13px; }
.access form { display: grid; gap: 16px; margin-top: 22px; }
.access > button { margin-top: 16px; }

.week-card { position: relative; overflow: hidden; color: var(--hero-text); background: linear-gradient(125deg, var(--hero), var(--hero-deep)); border-radius: var(--hero-radius); padding: clamp(18px, 3.4vw, 34px); display: grid; grid-template-columns: 1.3fr .9fr; gap: clamp(18px, 4vw, 50px); box-shadow: var(--shadow); }
.week-card::before, .week-card::after { content: ""; pointer-events: none; position: absolute; border: 1px solid #cfdeeb23; width: 340px; aspect-ratio: 1; border-radius: 50%; right: -116px; top: -176px; }
.week-card::after { right: -99px; top: -159px; }
.week-card :focus-visible { outline-color: var(--peach); }
.week-label { color: var(--peach); font-size: .84rem; font-weight: 700; }
.week-heading h2 { font-size: clamp(1.65rem, 4.7vw, 3.03rem); margin-top: 5px; }
.week-arrows { gap: 6px; flex: none; }
.week-arrows button { color: var(--hero-text); border-color: var(--hero-line); }
.week-arrows button:hover, .week-arrows button:active { border-color: var(--peach); color: var(--peach); }
.week-days { margin-top: 18px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.week-day { min-height: 55px; border: 1px solid var(--hero-line); background: #ffffff09; color: var(--hero-text); border-radius: 10px; display: grid; place-items: center; align-content: center; gap: 0; padding: 3px 0; font-size: .95rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.week-day small { font-weight: 600; color: var(--hero-muted); font-size: .72rem; }
.week-day:hover, .week-day:active { border-color: var(--peach); }
.week-day.is-today { background: var(--peach); color: var(--hero-deep); border-color: var(--peach); }
.week-day.is-today small { color: var(--hero-deep); }
.week-dot { width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.covered .week-dot { background: currentColor; }
.coverage { align-self: end; display: grid; gap: 11px; padding: 16px 0 4px; position: relative; }
.coverage-head { align-items: baseline; color: var(--hero-muted); font-size: .88rem; }
.coverage-head strong { font-family: var(--serif); font-size: 2rem; font-weight: 500; color: var(--hero-text); line-height: 1; }
progress { appearance: none; border: 0; width: 100%; height: 7px; border-radius: 99px; background: var(--hero-line); color: var(--peach); }
progress::-webkit-progress-bar { background: var(--hero-line); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--peach); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--peach); border-radius: 99px; }
.coverage-foot { min-height: 44px; color: var(--hero-muted); font-size: .81rem; }
.coverage-foot button { border: 0; min-height: 44px; padding: 0; background: transparent; color: var(--peach); text-decoration: underline; text-underline-offset: 3px; }
.section-heading { margin: 26px 0 11px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; }
.legend span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

.days, .needs, .members, .share-grid { display: grid; gap: 10px; }
.day-card { padding: 13px 15px; scroll-margin-top: 89px; }
.day-card.today { border-color: var(--accent); }
.day-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.day-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.date-tile { min-width: 43px; height: 44px; display: grid; place-items: center; align-content: center; border: 1px solid var(--line); border-radius: 9px; line-height: 1; font-weight: 740; font-variant-numeric: tabular-nums; background: var(--paper); }
.date-tile small { font-size: .62rem; margin-top: 3px; color: var(--quiet); }
.today .date-tile { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-bg); }
.day-title h3 { font-size: 1rem; letter-spacing: -.018em; }
.day-status { color: var(--quiet); font-size: .78rem; }
.day-status.covered { color: var(--green); }
.day-line .button { min-height: 44px; font-size: .82rem; padding-inline: 10px; }
.button.is-joined { background: var(--green-bg); color: var(--green); border-color: transparent; }
.button.is-joined:hover, .button.is-joined:active { border-color: var(--green); }
.signups { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin-top: 10px; }
.signups li { border-radius: 9px; padding: 0 0 0 8px; color: var(--ink); background: var(--paper); display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; font-size: .82rem; }
.signups li > span { padding-block: 5px; }
.signups small { color: var(--quiet); font-size: inherit; }
.signups button { min-width: 44px; min-height: 44px; display: grid; place-items: center; color: var(--quiet); background: transparent; border: 1px solid transparent; border-radius: 8px; }
.signups button:hover, .signups button:active { color: var(--accent); border-color: var(--line); }
.signups button svg { width: 14px; height: 14px; }

.filters { display: flex; gap: 5px; margin-bottom: 14px; }
.filters button { min-height: 44px; color: var(--quiet); border: 1px solid transparent; padding: 5px 13px; border-radius: 10px; background: transparent; font-weight: 650; }
.filters button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-bg); background: var(--accent-bg); }
.filters button:hover, .filters button:active { border-color: var(--line); }
.need-filters { overflow-x: auto; }
.need-filters button { white-space: nowrap; }
.filter-count { display: inline-grid; place-items: center; min-width: 22px; min-height: 22px; padding: 0 5px; margin-left: 3px; border-radius: 20px; background: var(--paper); color: var(--quiet); font-size: .75rem; }
.need-filters button[aria-pressed="true"] .filter-count { background: var(--surface); color: var(--accent); }
.need-card, .member-card, .share-card, .empty { padding: 18px; }
.need-card, .member-card { overflow-wrap: anywhere; }
.need-card { display: flex; flex-direction: column; gap: 14px; }
.need-top, .need-author, .need-footer { display: flex; align-items: center; }
.need-top { justify-content: space-between; gap: 10px; }
.need-author { min-width: 0; gap: 10px; }
.need-avatar { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--accent-bg); color: var(--accent); font-family: var(--serif); font-size: 1.15rem; font-weight: 700; }
.need-author-name { font-size: .9rem; font-weight: 700; }
.need-meta, .member-card p { color: var(--quiet); font-size: .8rem; }
.need-meta { margin-top: 1px; }
.need-more { border: 1px solid var(--line); flex: none; }
.need-text { font-size: 1.05rem; font-weight: 690; }
.need-text, .need-note { white-space: pre-wrap; }
.need-note { padding: 10px 12px; border-radius: 10px; color: var(--quiet); background: var(--paper); font-size: .9rem; }
.need-note > span { display: block; font-size: .72rem; font-weight: 700; margin-bottom: 3px; }
.need-footer { gap: 12px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 14px; margin-top: auto; }
.need-summary { display: grid; justify-items: start; gap: 5px; min-width: 0; }
.need-status { border-radius: 20px; background: var(--accent-bg); color: var(--accent); padding: 3px 8px; font-size: .73rem; font-weight: 700; }
.need-status.answered { color: var(--green); background: var(--green-bg); }
.need-prayer-count { color: var(--quiet); font-size: .78rem; }
.button.need-pray { min-height: 46px; padding: 8px 11px; font-size: .82rem; border-color: var(--line); background: var(--surface); flex: none; }
.button.need-pray:hover, .button.need-pray:active { border-color: var(--accent); color: var(--accent); }
.button.need-pray[aria-pressed="true"] { background: var(--green-bg); border-color: var(--green-bg); color: var(--green); }
.need-empty .section-icon { margin-bottom: 12px; }
.need-actions, .member-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.need-actions .button, .member-actions .button { min-height: 44px; padding-inline: 10px; font-size: .83rem; }
.need-actions [aria-pressed="true"] { background: var(--green-bg); color: var(--green); }
.member-card h2, .need-card h2 { font: 700 1.08rem/1.3 var(--sans); letter-spacing: -.01em; }
.member-card p { margin-top: 5px; }
.share-card { display: grid; align-content: start; justify-items: start; gap: 11px; }
.section-icon { display: grid; place-items: center; width: 44px; aspect-ratio: 1; border-radius: 12px; background: var(--accent-bg); color: var(--accent); margin-bottom: 1px; }
.empty { color: var(--quiet); }
.empty p + .button { margin-top: 12px; }

dialog { max-width: min(100% - 32px, 520px); width: 100%; max-height: min(90vh, 100% - 24px); border: 1px solid var(--line); border-radius: var(--hero-radius); padding: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow: auto; }
dialog[open] { animation: dialog-enter var(--enter) var(--ease); }
dialog::backdrop { background: #0b1929a8; }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.dialog-header { margin-bottom: 10px; }
.dialog-header h2 { overflow-wrap: anywhere; }
.dialog-header .icon-button { flex: none; }
.form, .dialog-actions, .settings-list { display: grid; gap: 13px; }
.field { display: grid; gap: 5px; font-size: .89rem; font-weight: 650; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; min-height: 46px; padding: 8px 11px; background: var(--paper); color: var(--ink); font-weight: 400; font-size: 1rem; }
.field textarea { resize: vertical; min-height: 100px; }
.check-row { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: .89rem; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; margin-top: 4px; }
.day-picker { margin: 0; padding: 0; border: none; min-width: 0; }
.day-picker legend { font-size: .89rem; font-weight: 650; margin-bottom: 5px; }
.day-picker > div { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day-choice { min-height: 44px; position: relative; display: grid; place-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; font-size: .86rem; font-weight: 700; cursor: pointer; }
.day-choice:has(:checked) { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.day-choice:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.day-choice input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.form-error { color: var(--accent); margin-top: 10px; font-size: .9rem; font-weight: 650; }
.toast { position: fixed; z-index: 3; bottom: 22px; right: 20px; max-width: min(390px, 100% - 40px); border-radius: 12px; color: var(--hero-text); background: var(--hero-deep); padding: 11px 16px; box-shadow: var(--shadow); font-size: .92rem; }
.toast:empty { visibility: hidden; }

@media (min-width: 750px) {
  .days, .needs, .members, .share-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 790px) {
  .topbar-inner, .container { width: min(100% - 28px, 1120px); }
  .topbar-inner { min-height: 63px; gap: 5px; }
  .navigation { position: fixed; inset: auto 0 0; background: var(--surface); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 4px 8px calc(6px + env(safe-area-inset-bottom)); gap: 3px; }
  .navigation button { position: relative; display: grid; place-items: center; align-content: center; min-height: 53px; min-width: 0; gap: 1px; padding: 2px; font-size: .72rem; }
  .nav-count { position: absolute; top: 2px; left: calc(50% + 7px); }
  .container { padding: 25px 0 calc(86px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 570px) {
  .brand { font-size: .9rem; gap: 7px; }
  .brand-mark { width: 29px; }
  .top-actions { gap: 0; }
  #profile-name { display: none; }
  .page-heading { align-items: flex-start; gap: 9px; margin-bottom: 18px; }
  .page-heading p { font-size: .87rem; margin-top: 7px; }
  .heading-action { font-size: .79rem; padding: 6px 9px; white-space: nowrap; }
  .heading-action svg { width: 16px; height: 16px; }
  .week-card { grid-template-columns: 1fr; padding: 16px; gap: 0; border-radius: 19px; }
  .week-arrows { gap: 4px; }
  .week-arrows button { min-width: 44px; }
  .week-days { margin-top: 13px; }
  .coverage { gap: 7px; padding: 13px 0 0; }
  .coverage-head strong { font-size: 1.55rem; }
  .coverage-foot { min-height: 23px; }
  .section-heading { margin-top: 21px; }
  .day-card { padding: 10px 12px; scroll-margin-top: 73px; }
  dialog { width: 100%; max-width: none; max-height: calc(100% - 20px); margin: auto 0 0; border-radius: 20px 20px 0 0; padding: 14px 16px calc(19px + env(safe-area-inset-bottom)); }
}
@media (max-width: 350px) {
  h1 { font-size: 1.95rem; }
  .page-heading { flex-wrap: wrap; }
  .page-heading h1 { overflow-wrap: anywhere; }
  .week-day { font-size: .83rem; }
  .need-footer { flex-wrap: wrap; }
  .topbar-inner { width: calc(100% - 20px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
