:root {
  color-scheme: dark;
  --bg: #151c1b;
  --paper: #202927;
  --ink: #edf2ec;
  --muted: #adbbb2;
  --line: #3a4b43;
  --green: #9adbb4;
  --green-hover: #c4edcf;
  --green-light: #2b4035;
  --accent: #dfad86;
  --danger: #f0aaa7;
  --button-bg: #347b5f;
  --button-hover: #43936f;
  --field: #18221f;
  --field-border: #64766a;
  --soft: #26322d;
  --nested: #1b2522;
  --track: #364b3e;
  --check-border: #9bb7a4;
  --complete-border: #578968;
  --focus: #d5a477;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7f4;
  --paper: #fff;
  --ink: #26332e;
  --muted: #64736b;
  --line: #dae3db;
  --green: #28745d;
  --green-hover: #17533f;
  --green-light: #e7f2eb;
  --accent: #9c6247;
  --danger: #a24d4d;
  --button-bg: #28745d;
  --button-hover: #1c604b;
  --field: #fff;
  --field-border: #bacbc0;
  --soft: #f6f8f5;
  --nested: #fbfcfa;
  --track: #dce7de;
  --check-border: #95aa9c;
  --complete-border: #c7dccd;
  --focus: #b88361;
}
* { box-sizing: border-box; }
html { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--green); }
a:hover { color: var(--green-hover); }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
[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; }
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1080px; margin: auto; padding: 12px 24px 0; }
.header-top { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.header-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.header-tools form { margin: 0; }
.header-tools .icon-button { width: 36px; height: 36px; font-size: 1.3rem; }
.install-button { min-height: 36px; }
.brand { color: var(--ink); font-weight: 750; font-size: 1.18rem; text-decoration: none; white-space: nowrap; }
nav { display: flex; flex-wrap: wrap; gap: 2px 20px; margin-top: 4px; }
nav a { display: inline-block; padding: 8px 0 10px; color: var(--muted); text-decoration: none; font-size: .92rem; border-bottom: 2px solid transparent; }
nav a.current { color: var(--green); border-color: var(--green); font-weight: 650; }
.page { max-width: 940px; min-height: calc(100vh - 165px); margin: 0 auto; padding: 38px 24px 80px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-weight: 600; font-size: .9rem; }
h1 { margin: 0; font-size: clamp(1.85rem, 1.4rem + 1.4vw, 2.35rem); line-height: 1.2; font-weight: 720; }
h2 { font-size: 1.25rem; margin: 0 0 16px; }
.button, .small-button, .icon-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border-radius: 6px; font-weight: 650; white-space: nowrap; }
.button { min-height: 42px; padding: 9px 17px; color: #fff; border: 1px solid var(--button-bg); background: var(--button-bg); }
.button:hover { color: #fff; background: var(--button-hover); }
.small-button, .icon-button { min-height: 34px; padding: 5px 10px; background: var(--paper); color: var(--green); border: 1px solid var(--line); font-size: .82rem; }
.small-button:hover, .icon-button:hover { background: var(--green-light); }
.icon-button { width: 34px; padding: 0; font-size: 1.1rem; }
.small-button.danger { color: var(--danger); }
.progress-section { padding: 19px 0 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.progress-copy strong { font-size: 1rem; }
.progress-copy span { color: var(--green); font-weight: 750; }
.progress-track { height: 9px; border-radius: 20px; overflow: hidden; background: var(--track); }
.progress-fill { height: 100%; background: var(--button-bg); transition: width .2s ease; }
.completion-message { color: var(--green); font-weight: 650; margin: 12px 0 0; }
.today-list { display: grid; gap: 11px; }
.prayer-card { min-width: 0; padding: 17px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.prayer-card.is-complete { border-color: var(--complete-border); }
.prayer-main { display: flex; gap: 15px; align-items: flex-start; min-width: 0; }
.prayer-check { appearance: none; width: 28px; height: 28px; flex: 0 0 28px; margin: 0; border: 2px solid var(--check-border); border-radius: 6px; background: var(--field); cursor: pointer; position: relative; }
.prayer-check:checked { border-color: var(--button-bg); background: var(--button-bg); }
.prayer-check:checked::after { content: '✓'; position: absolute; inset: -3px 0 0; color: white; text-align: center; font-size: 22px; font-weight: 700; }
.prayer-check:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.prayer-content { flex: 1; min-width: 0; }
.prayer-title { display: block; font-size: 1rem; font-weight: 650; line-height: 1.45; cursor: pointer; overflow-wrap: anywhere; }
.prayer-description { margin: 3px 0 0; color: var(--muted); font-size: .9rem; white-space: pre-wrap; }
.prayer-text, .note-details { margin-top: 10px; font-size: .88rem; }
.prayer-text summary, .note-details summary { color: var(--green); cursor: pointer; font-weight: 600; width: max-content; }
.prayer-text p { white-space: pre-wrap; margin: 9px 0 0; padding: 12px 14px; background: var(--soft); border-left: 3px solid var(--complete-border); border-radius: 3px; }
.note-form { margin-top: 9px; }
.note-form textarea { width: 100%; resize: vertical; }
.note-actions { display: flex; align-items: center; gap: 12px; margin-top: 7px; }
.form-status { color: var(--green); font-size: .84rem; }
.child-list { display: grid; gap: 9px; margin: 15px 0 0 24px; padding-left: 16px; border-left: 2px solid var(--line); }
.child-list .prayer-card { background: var(--nested); padding: 13px 14px; }
.intentions-today { margin-top: 30px; }
.manage-list, .intention-list { display: grid; gap: 10px; }
.manage-item, .intention-item { min-width: 0; padding: 15px 17px; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.manage-row, .intention-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.manage-name { min-width: 0; }
.manage-name strong, .intention-item strong { display: block; overflow-wrap: anywhere; }
.manage-name span, .meta { display: block; color: var(--muted); font-size: .8rem; margin-top: 3px; }
.manage-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.manage-actions form { margin: 0; }
.manage-children { margin: 13px 0 0 20px; padding-left: 13px; border-left: 2px solid var(--line); display: grid; gap: 9px; }
.manage-children .manage-item { background: var(--nested); }
.is-inactive { opacity: .65; }
.editor-form { max-width: 700px; display: grid; gap: 18px; }
.compact-form { background: var(--paper); border: 1px solid var(--line); border-radius: 7px; padding: 22px; }
.compact-form h2 { margin-bottom: 0; }
.field { display: grid; gap: 6px; }
.field label, .date-picker label { font-weight: 650; font-size: .9rem; }
.field input, .field textarea, .field select, .note-form textarea, .date-picker input { border: 1px solid var(--field-border); border-radius: 5px; background: var(--field); color: var(--ink); padding: 9px 11px; min-height: 42px; min-width: 0; }
.field textarea { resize: vertical; white-space: pre-wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.weekday-field { border: 0; margin: 0; padding: 0; }
.weekday-field legend { font-weight: 650; font-size: .9rem; margin-bottom: 9px; }
.weekday-options { display: flex; flex-wrap: wrap; gap: 7px; }
.weekday-options label { cursor: pointer; }
.weekday-options input { position: absolute; opacity: 0; }
.weekday-options span { display: block; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); min-width: 43px; padding: 7px; text-align: center; font-size: .85rem; }
.weekday-options input:checked + span { border-color: var(--green); background: var(--green-light); color: var(--green); font-weight: 700; }
.weekday-options input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch-line { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.switch-line input { width: 19px; height: 19px; accent-color: var(--green); }
.form-footer { display: flex; justify-content: flex-end; align-items: center; gap: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.text-link { text-decoration: none; font-weight: 600; }
.section-title { margin: 32px 0 14px; }
.intention-item p { margin: 4px 0; color: var(--muted); font-size: .9rem; white-space: pre-wrap; }
.date-picker { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.date-picker label { width: 100%; }
.history-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.history-heading h2 { margin: 0; }
.history-heading span { color: var(--muted); font-size: .9rem; }
.history-list { padding-top: 8px; }
.history-item { display: flex; gap: 13px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.history-mark { color: #9a6f5d; font-size: 1.25rem; line-height: 1; width: 24px; text-align: center; }
.history-mark.done { color: var(--green); }
.history-note { margin: 4px 0 0; color: var(--muted); font-size: .86rem; white-space: pre-wrap; }
.history-children { margin-left: 24px; padding-left: 16px; border-left: 2px solid var(--line); }
.history-list h3 { font-size: 1rem; margin: 28px 0 2px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { padding: 18px 17px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.stat span { display: block; color: var(--muted); font-size: .86rem; }
.stat strong { display: block; font-size: 2rem; margin-top: 9px; line-height: 1; color: var(--green); }
.range-stats { margin-top: 34px; }
.range-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 13px 0; }
.range-row .progress-track { grid-column: 1 / -1; }
.empty-state { padding: 30px 0; color: var(--muted); }
.empty-state .button { margin-top: 10px; }
.error-state h1 { color: var(--ink); }
.site-footer { max-width: 1080px; margin: auto; padding: 22px 24px 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: .83rem; display: flex; justify-content: space-between; gap: 12px; }
.site-footer div { display: flex; flex-wrap: wrap; gap: 16px; }
.auth-body { min-height: 100vh; }
.auth-shell { width: min(100% - 32px, 440px); margin: 0 auto; padding: clamp(26px, 9vh, 90px) 0 40px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 36px; }
.auth-top .icon-button { width: 38px; height: 38px; font-size: 1.3rem; }
.auth-form { display: grid; gap: 22px; padding: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.auth-form h1 { font-size: 1.65rem; }
.auth-form .button { width: 100%; }
.auth-error { margin: 0; padding: 10px 12px; border: 1px solid var(--danger); border-radius: 5px; color: var(--danger); font-size: .92rem; }
@media (max-width: 700px) {
  .header-inner { padding: 12px 16px 0; }
  nav { margin-top: 8px; gap: 0 17px; }
  nav a { padding: 8px 0 9px; font-size: .84rem; }
  .page { padding: 26px 16px 60px; }
  .page-heading { align-items: start; }
  .page-heading .button { font-size: .85rem; padding: 8px 10px; }
  .manage-row, .intention-item { display: block; }
  .manage-actions { justify-content: flex-start; margin-top: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .site-footer { padding: 20px 16px 28px; }
}
@media (max-width: 430px) {
  .page-heading { flex-wrap: wrap; }
  .child-list { margin-left: 9px; padding-left: 9px; }
  .prayer-card { padding: 14px; }
  .prayer-main { gap: 11px; }
  .compact-form { padding: 16px; }
  .auth-form { padding: 22px; }
  .site-footer { display: block; }
  .site-footer div { margin-top: 8px; }
}
@media (max-width: 360px) {
  .header-tools { width: 100%; justify-content: flex-end; }
}
