:root {
  --paper: #f5eedf;
  --card: #fbf7ee;
  --ink: #3b2a1e;
  --ink-soft: #7a6652;
  --line: #e3d8c3;
  --sage: #6b8467;
  --sage-deep: #4f6a4c;
  --gold: #b8903f;
  --wine: #8b2e3a;
  --display: 'Young Serif', Georgia, 'Times New Roman', serif;
  --body: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.2; margin: 0; }
a { color: var(--sage-deep); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

#app { min-height: 100dvh; max-width: 560px; margin: 0 auto; position: relative; }

/* ---------- Top bar and tabs ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 18px 10px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 24px; letter-spacing: 0.2px; }
.top .who { border: 0; background: none; padding: 0; border-radius: 50%; }

main { padding: 18px 16px calc(var(--tab-h) + var(--safe-b) + 90px); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: center;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabs-inner { display: flex; width: 100%; max-width: 560px; }
.tab {
  flex: 1; height: var(--tab-h); border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  position: relative;
}
.tab svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--sage-deep); }
.tab[aria-current="page"]::after {
  content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold);
}

/* ---------- Buttons and fields ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 12px 22px; min-height: 46px;
  background: var(--sage-deep); color: var(--paper); font-weight: 700;
}
.btn:active { background: var(--sage); }
.btn.quiet { background: transparent; color: var(--sage-deep); border: 1.5px solid var(--sage); }
.btn.danger { background: transparent; color: var(--wine); border: 1.5px solid var(--wine); }
.btn.small { min-height: 38px; padding: 7px 16px; font-size: 15px; }
.btn[disabled] { opacity: 0.55; }
.linkbtn { border: 0; background: none; padding: 6px 0; color: var(--ink-soft); font-size: 15px; font-weight: 600; }
.linkbtn.wine { color: var(--wine); }

label { display: block; font-weight: 700; font-size: 15px; margin: 14px 0 5px; }
input[type=text], input[type=password], input[type=tel], input[type=datetime-local], input[type=date], input[type=number], textarea, select {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--card);
}
input:focus, textarea:focus, select:focus { border-color: var(--sage); outline: none; box-shadow: 0 0 0 3px rgba(107, 132, 103, 0.25); }
textarea { resize: vertical; min-height: 96px; }
.hint { color: var(--ink-soft); font-size: 15px; margin: 4px 0 0; }
.error { color: var(--wine); font-weight: 600; margin: 12px 0 0; min-height: 1.2em; }

/* ---------- Avatars ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-grid; place-items: center;
  font-family: var(--display); font-size: 18px; color: var(--paper);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1.5px var(--line);
}
.avatar.big { width: 96px; height: 96px; font-size: 40px; }
.avatar.small { width: 30px; height: 30px; font-size: 13px; border-width: 1.5px; }

/* ---------- Sign in ---------- */
.gate { padding: 12vh 24px 40px; }
.gate .mark { width: 76px; height: 76px; border-radius: 20px; display: block; margin-bottom: 22px; }
.gate h1 { font-size: 36px; margin-bottom: 8px; }
.gate p { color: var(--ink-soft); margin: 0 0 8px; }
.gate .btn { width: 100%; margin-top: 22px; }

/* ---------- Feed: photos are mounted like prints in a family album ---------- */
.post { margin: 0 0 30px; }
.post-head { display: flex; align-items: center; gap: 11px; margin: 0 4px 10px; }
.post-head .names { flex: 1; min-width: 0; }
.post-head strong { display: block; font-weight: 700; line-height: 1.2; }
.post-head time { color: var(--ink-soft); font-size: 14px; }

.print {
  position: relative; background: var(--card);
  padding: 12px 12px 14px;
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px -8px rgba(59, 42, 30, 0.35);
  transform: rotate(-0.5deg);
}
.post:nth-child(even) .print { transform: rotate(0.5deg); }
.print .mount { position: relative; display: block; background: var(--line); }
.print .mount img { display: block; width: 100%; max-height: 78vh; object-fit: cover; }
.print .mount::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(135deg, var(--wine) 50%, transparent 50%) top left / 20px 20px no-repeat,
    linear-gradient(225deg, var(--wine) 50%, transparent 50%) top right / 20px 20px no-repeat,
    linear-gradient(45deg, var(--wine) 50%, transparent 50%) bottom left / 20px 20px no-repeat,
    linear-gradient(315deg, var(--wine) 50%, transparent 50%) bottom right / 20px 20px no-repeat;
}
.print .cap { margin: 12px 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.print.textonly { transform: none; padding: 16px 18px; }
.print.textonly .cap { margin: 0; }

.actions { display: flex; align-items: center; gap: 18px; margin: 12px 6px 0; }
.act { border: 0; background: none; padding: 6px 2px; display: inline-flex; gap: 7px; align-items: center; font-weight: 700; color: var(--ink-soft); }
.act svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.act.on { color: var(--wine); }
.act.on svg { fill: var(--wine); }
.act.del { margin-left: auto; font-weight: 600; font-size: 15px; }
.likedby { margin: 2px 6px 0; font-size: 15px; color: var(--ink-soft); }

.comments { margin: 10px 4px 0; }
.comment { display: flex; gap: 9px; margin: 9px 0; align-items: flex-start; }
.comment .bubble { flex: 1; min-width: 0; background: rgba(227, 216, 195, 0.45); padding: 8px 12px; border-radius: 4px 16px 16px 16px; }
.comment strong { display: block; font-weight: 700; font-size: 14px; line-height: 1.3; color: var(--ink-soft); }
.comment .txt { overflow-wrap: anywhere; white-space: pre-wrap; }
.comment .x { border: 0; background: none; color: var(--ink-soft); font-size: 13px; padding: 0 0 0 6px; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form input { flex: 1; border-radius: 999px; padding: 10px 16px; }

.empty { text-align: center; padding: 56px 24px; color: var(--ink-soft); }
.empty h2 { color: var(--ink); font-size: 22px; margin-bottom: 8px; }

.fab {
  position: fixed; z-index: 7;
  right: max(16px, calc(50% - 280px + 16px));
  bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  height: 56px; padding: 0 22px 0 18px; border-radius: 999px; border: 0;
  background: var(--gold); color: #2d2014; font-weight: 800;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 20px -6px rgba(59, 42, 30, 0.55);
}
.fab svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }

/* ---------- Sheets ---------- */
.scrim { position: fixed; inset: 0; background: rgba(59, 42, 30, 0.5); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto;
  background: var(--paper); border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(24px + var(--safe-b));
  animation: rise 0.22s ease-out;
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-head h2 { font-size: 24px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.row .btn { flex: 1; }
.photo-pick { margin-top: 12px; }
.photo-pick img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; margin-top: 10px; }

/* ---------- Events ---------- */
.day { margin: 26px 0 10px; font-size: 20px; }
.day:first-child { margin-top: 0; }
.event { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--sage); border-radius: 6px 16px 16px 6px; padding: 14px 16px; margin-bottom: 12px; }
.event h3 { font-family: var(--body); font-weight: 700; font-size: 18px; }
.event .when { color: var(--sage-deep); font-weight: 700; }
.event .meta { color: var(--ink-soft); font-size: 15px; margin-top: 2px; overflow-wrap: anywhere; }
.rsvp { display: flex; gap: 8px; margin-top: 12px; }
.rsvp button { flex: 1; min-height: 42px; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; font-weight: 700; font-size: 15px; }
.rsvp button[aria-pressed="true"].going { background: var(--sage-deep); color: var(--paper); border-color: var(--sage-deep); }
.rsvp button[aria-pressed="true"].maybe { background: var(--gold); color: #2d2014; border-color: var(--gold); }
.rsvp button[aria-pressed="true"].no { background: var(--wine); color: var(--paper); border-color: var(--wine); }
.who-list { margin: 10px 0 0; font-size: 15px; color: var(--ink-soft); }
.who-list b { color: var(--ink); }

/* ---------- Chat ---------- */
.thread { display: flex; gap: 13px; align-items: center; width: 100%; text-align: left; padding: 12px 4px; border: 0; background: none; border-bottom: 1px solid var(--line); }
.thread .t { flex: 1; min-width: 0; }
.thread strong { display: block; }
.thread .last { color: var(--ink-soft); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat { display: flex; flex-direction: column; min-height: calc(100dvh - 82px - env(safe-area-inset-top, 0px) - var(--tab-h) - var(--safe-b) - 78px); }
main.chat-on { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 78px); }
.chat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.chat-head h2 { font-size: 22px; }
.msgs { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding-bottom: 12px; }
.msg { max-width: 82%; padding: 9px 14px; border-radius: 18px 18px 18px 4px; background: var(--card); border: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }
.msg .from { display: block; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.msg.mine { align-self: flex-end; background: var(--sage-deep); border-color: var(--sage-deep); color: var(--paper); border-radius: 18px 18px 4px 18px; }
.composer {
  position: fixed; left: 0; right: 0; z-index: 6; display: flex; justify-content: center;
  bottom: calc(var(--tab-h) + var(--safe-b)); background: var(--paper); border-top: 1px solid var(--line);
}
.composer form { display: flex; gap: 8px; width: 100%; max-width: 560px; padding: 10px 14px; }
.composer input { flex: 1; border-radius: 999px; padding: 11px 18px; }

/* ---------- Family ---------- */
.people { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.person { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 10px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.person .avatar { width: 76px; height: 76px; font-size: 32px; }
.person strong { line-height: 1.2; }
.person small { color: var(--ink-soft); }
.profile { text-align: center; }
.profile .avatar { margin: 4px auto 10px; }
.profile h2 { font-size: 28px; }
.profile .bio { color: var(--ink-soft); margin: 8px 0 0; white-space: pre-wrap; }
.section-title { font-size: 20px; margin: 30px 0 4px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(var(--tab-h) + var(--safe-b) + 84px);
  background: var(--ink); color: var(--paper); padding: 11px 20px; border-radius: 999px; font-weight: 600; width: max-content; max-width: 90vw; text-align: center;
}

@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

.notice { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--gold); border-radius: 6px 16px 16px 6px; padding: 14px 16px; margin-bottom: 22px; }
.notice strong { display: block; font-family: var(--display); font-weight: 400; font-size: 19px; }
.notice p { margin: 4px 0 0; color: var(--ink-soft); }

/* chores */
.chore-people { display: grid; gap: 10px; margin-top: 14px; }
.chore-person { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; font: inherit; color: var(--ink); }
.cp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.cp-name { font-weight: 700; font-size: 17px; }
.cp-count { font-size: 14px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bar { display: block; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--sage); border-radius: 99px; transition: width .3s; }
.bar.wide { margin: 8px 0 4px; }
.chore-sheet { margin-top: 6px; }
.chore-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 10px; }
.chore-head h3 { font-size: 22px; margin: 0; }
.slot h4 { margin: 20px 0 8px; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.chore { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; margin: 0 0 8px; padding: 10px 14px; text-align: left; font: inherit; font-size: 17px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.chore .box { flex: none; width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--sage); display: grid; place-items: center; background: var(--paper); }
.chore .box svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.chore.done .box { background: var(--sage-deep); border-color: var(--sage-deep); }
.chore.done .box svg { opacity: 1; }
.chore.done { background: transparent; color: var(--ink-soft); }
.chore.done .ct { text-decoration: line-through; text-decoration-color: var(--line); }
.chore small { display: block; font-size: 13px; text-decoration: none; color: var(--ink-soft); }

/* emergency */
.sos-card { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; font: inherit; color: var(--ink); padding: 14px 16px; margin: 0 0 18px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--wine); border-radius: 14px; }
.sos-card strong { font-family: 'Young Serif', serif; font-weight: 400; font-size: 19px; }
.sos-card span { color: var(--ink-soft); font-size: 15px; }
.sos-call { display: flex; flex-direction: column; gap: 2px; margin: 14px 0; padding: 18px; border-radius: 16px; background: var(--wine); color: #fff; text-decoration: none; }
.sos-call strong { font-family: 'Young Serif', serif; font-weight: 400; font-size: 30px; }
.sos-call span { font-size: 15px; opacity: .9; }
.address-card { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.address-card small { font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin-bottom: 4px; }
.address-card strong { font-size: 22px; line-height: 1.25; }
.address-card span { margin-top: 8px; font-size: 14px; color: var(--ink-soft); }
.dial { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; margin: 0 0 8px; padding: 10px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none; }
.dial span { display: flex; flex-direction: column; }
.dial small { color: var(--ink-soft); font-size: 13px; }
.dial b { color: var(--sage-deep); font-size: 17px; white-space: nowrap; }
.step-card { margin: 0 0 10px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.step-card h3 { margin: 0 0 6px; font-size: 18px; }
.step-card p { margin: 4px 0; font-size: 16px; }
.facts { display: grid; gap: 8px; }
.fact { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.fact span { font-size: 13px; color: var(--ink-soft); }
.fact em { color: var(--ink-soft); font-size: 15px; }

/* dashboard */
.dash-h { margin: 26px 0 10px; font-size: 19px; }
.behind { display: grid; gap: 8px; }
.bh { padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--wine); border-radius: 12px; display: flex; flex-direction: column; gap: 2px; }
.bh span { font-size: 14px; color: var(--ink-soft); }
.wk { display: grid; gap: 5px; }
.wk-row { display: grid; grid-template-columns: 72px repeat(7, 1fr); gap: 5px; align-items: center; }
.wk-head span { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.wk-head span.now { color: var(--wine); }
.wk-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.cell { display: grid; place-items: center; height: 34px; border-radius: 8px; font-size: 12px; font-weight: 700; background: var(--line); color: var(--ink-soft); }
.cell.full { background: var(--sage-deep); color: #fff; font-size: 15px; }
.cell.part { background: #e8d9a8; color: #6b5316; }
.cell.zero { background: #ecc9c9; color: var(--wine); }
.cell.future, .cell.none { background: transparent; border: 1px dashed var(--line); }
.ptlist { display: grid; gap: 10px; }
.pt { display: grid; grid-template-columns: 72px 1fr 34px; align-items: center; gap: 8px; }
.pt-name { font-weight: 700; font-size: 15px; }
.pt-bar { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pt-bar > span { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.pt-n { text-align: right; font-size: 17px; }
.pt-s { grid-column: 2 / 4; margin-top: -6px; color: var(--ink-soft); font-size: 13px; }
.extra { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.extra > span { flex: 1; min-width: 0; }
.extra small { color: var(--ink-soft); }
.extra b { color: var(--sage-deep); }
.extra .x { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--ink-soft); padding: 4px 8px; }
.pv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.pv { width: 64px; min-height: 40px; text-align: center; font: inherit; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); }
.pv.saved { border-color: var(--sage-deep); background: #e3ecdf; }

/* groups */
.gbar { margin: 0 0 16px; }
.gtop { display: flex; align-items: center; gap: 10px; }
.gtop h2 { flex: 1; margin: 0; font-size: 22px; text-align: center; }
.seg { display: flex; gap: 6px; margin-top: 12px; padding: 4px; background: var(--line); border-radius: 12px; }
.seg-b { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 700; font-size: 15px; color: var(--ink-soft); }
.seg-b.on { background: var(--card); color: var(--sage-deep); box-shadow: 0 1px 3px rgba(59,42,30,.15); }
.group-card { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 4px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px; }
.group-open { flex: 1; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.group-open strong { font-family: 'Young Serif', serif; font-weight: 400; font-size: 19px; }
.group-open small { color: var(--ink-soft); font-size: 14px; }
.mem-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mem-name { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.mem-post { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
.mem-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--sage-deep); }
.tabs-inner .tab { font-size: 12px; }

/* albums */
.album-card { border-left-color: var(--gold); }
.album-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.album { display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 10px; }
.album img, .album-empty { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; background: var(--line); display: block; margin-bottom: 6px; }
.album strong { font-family: 'Young Serif', serif; font-weight: 400; font-size: 16px; padding: 0 4px; }
.album small { color: var(--ink-soft); font-size: 13px; padding: 0 4px; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.thumb { padding: 0; border: 0; background: var(--line); aspect-ratio: 1; border-radius: 4px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox { position: fixed; inset: 0; z-index: 90; background: #130d08; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.lightbox img { max-width: 100%; max-height: calc(100% - 130px); object-fit: contain; }
.lb-top, .lb-nav { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; }
.lb-top { top: env(safe-area-inset-top); }
.lb-nav { bottom: env(safe-area-inset-bottom); padding-bottom: 18px; }
.lb-who { color: #e9dfc9; font-size: 15px; flex: 1; }
.lb-btn { min-height: 44px; padding: 0 18px; border: 1.5px solid #8a7a62; border-radius: 99px; background: transparent; color: #f5eedf; font: inherit; font-weight: 700; }
.lb-btn[hidden] { display: none; }

/* tagging */
.tagpick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tagchip { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 4px 14px 4px 6px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--paper); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; }
.tagchip[aria-pressed="true"] { background: var(--sage-deep); border-color: var(--sage-deep); color: #fff; }
.with { color: var(--sage-deep); font-weight: 600; font-size: 15px; }

.group-link { border-left-color: var(--sage); }

.bar[hidden] { display: none; }
button.mount { width: 100%; padding: 0; border: 0; cursor: zoom-in; font: inherit; }
.lightbox img { touch-action: pinch-zoom; }

.duty-note { background: var(--sage-deep); color: #fff; border-radius: 16px; padding: 14px 16px; margin: 10px 0 6px; font-weight: 600; font-size: 17px; }
.duty-note p { margin: 0; }
.duty-note p + p { margin-top: 6px; }

/* math catch-up */
.math-link { margin: 8px 0 4px; }
.math-cards { display: grid; gap: 12px; margin-top: 14px; }
.math-card, .math-sum { display: block; width: 100%; text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.math-sum { margin: 10px 0 14px; }
.mc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mc-name { font-family: var(--display); font-size: 19px; }
.mpill { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: #e9e1cf; color: var(--ink-soft); }
.mpill.ok { background: #dfeadb; color: var(--sage-deep); }
.mpill.warn { background: #f6e6c2; color: #8a5a0a; }
.mpill.bad { background: #f3d6d6; color: var(--wine); }
.mbar { position: relative; height: 14px; background: #e3d8c3; border-radius: 8px; margin: 12px 0 8px; }
.mfill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--sage); border-radius: 8px; }
.mshould { position: absolute; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; background: var(--gold); border-radius: 2px; }
.mc-nums { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--ink-soft); }
.mc-nums b { color: var(--ink); }
.mc-catch { margin-top: 10px; font-size: 14px; font-weight: 700; color: #8a5a0a; }
.mweek { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 10px; }
.mweek.off { background: transparent; border-style: dashed; color: var(--ink-soft); }
.mweek h3 { margin: 0; font-size: 16px; }
.mweek-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; color: var(--ink-soft); }
.mdays { display: grid; gap: 4px; }
.mday { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 1px 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); min-width: 0; }
.mday .dn { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 700; }
.mday .dd { font-size: 13px; font-weight: 700; }
.mday .goal { font-size: 12px; font-weight: 700; text-align: center; }
.mday .goal.small { font-size: 10px; color: var(--ink-soft); font-weight: 600; }
.mday .tag { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--ink-soft); }
.mday input { width: 24px; height: 24px; margin: 0; accent-color: var(--sage-deep); }
.mday.done { background: #dfeadb; border-color: var(--sage); }
.mday.today { border: 2px solid var(--gold); }
.mday.missed { background: #f7e1e1; border-color: #d9a3a3; }
.mday.missed .tag { color: var(--wine); }
.mday.sat { background: #fbf0cf; }
.mday.buf { border-style: dashed; }
.mday.hol { opacity: .65; border-style: dashed; }

.daily-tabs { display: flex; background: #e9e1cf; border-radius: 12px; padding: 3px; margin: 4px 0 8px; }
.daily-tabs button { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--ink-soft); padding: 9px 0; border-radius: 10px; }
.daily-tabs button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(59,42,30,.15); }

.reacts { display: flex; gap: 6px; margin-top: 6px; }
.react { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 9px; font-size: 14px; line-height: 1.3; color: var(--ink-soft); }
.react span { font-size: 12px; font-weight: 700; }
.react.on { background: #dfeadb; border-color: var(--sage); color: var(--ink); }

.react-wrap { position: relative; display: inline-block; }
.react.add { color: var(--ink-soft); }
.react-pop { display: none; position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 5; gap: 4px; padding: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 4px 14px rgba(59,42,30,.2); }
.react-pop.open { display: flex; }
.react-pop .react { border: 0; font-size: 20px; padding: 4px 7px; }
.reacts { align-items: center; flex-wrap: wrap; }

.comment.reply { margin-left: 34px; }
.comment .to { font-style: normal; font-weight: 600; font-size: 12px; color: var(--ink-soft); }
.comment .reply-btn { display: inline-block; margin: 6px 0 0; padding: 0; font-weight: 700; }
.reply-box .comment-form { margin: 8px 0 2px; }

.reading { margin-top: 6px; }
.book-row { margin-top: 8px; }
.book-row input { width: 100%; border-radius: 12px; padding: 10px 14px; }
.par-sum { display: flex; gap: 8px; margin: 10px 0 14px; }
.par-sum div { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; }
.par-sum b { display: block; font-family: var(--display); font-size: 24px; }
.par-sum span { font-size: 12px; color: var(--ink-soft); }
.par-cards { display: grid; gap: 12px; }
.par-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.par-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; font-size: 15px; }
.par-row > span:last-child { text-align: right; }
.par-k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--ink-soft); }
.par-sub { font-size: 13px; color: var(--ink-soft); text-align: right; margin-top: 2px; }
.par-book { font-size: 13px; color: var(--ink-soft); font-style: italic; margin-top: 2px; text-align: right; }
.par-card .mbar { margin: 8px 0 2px; }

.par-link { display: block; width: 100%; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.par-link:active .par-row { opacity: .6; }

.par-sum4 b { font-size: 22px; }
.par-sum4 { margin-bottom: 12px; }
.par-sum4 div { padding: 10px 2px; }
.par-card + .par-cards { margin-top: 12px; }
.seen.away { color: var(--wine); font-weight: 700; }

/* compact family list */
.people { grid-template-columns: 1fr; gap: 8px; }
.person { flex-direction: row; justify-content: flex-start; text-align: left; gap: 12px; padding: 8px 12px; border-radius: 14px; }
.person .avatar { width: 40px; height: 40px; font-size: 18px; flex: none; }
.person strong { font-size: 16px; }
.person small { margin-left: auto; font-size: 12px; }
.small-link { display: block; margin: 18px auto 0; font-size: 13px; color: var(--ink-soft); }

.prayer-card { border-left-color: var(--ink-soft); }
.prayer { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; }
.prayer summary { font-family: var(--display); font-size: 19px; cursor: pointer; }
.prayer-body { white-space: pre-wrap; margin: 10px 0 12px; line-height: 1.55; }

.lang-tabs { margin: 10px 0 4px; }

.rosary-btn { width: 100%; margin: 10px 0 14px; padding: 16px; font-size: 18px; }
.rosary-sets { margin: 8px 0 12px; }
.rosary-list ol { margin: 8px 0 0 20px; padding: 0; line-height: 1.7; }
.rosary-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rosary-top .lang-tabs { margin: 0; }
.rosary-bar { height: 6px; border-radius: 3px; background: var(--line); margin: 12px 0 8px; overflow: hidden; }
.rosary-bar span { display: block; height: 100%; background: var(--ink-soft); }
.rosary-phase { margin: 0 0 6px; font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.rosary-dots { display: flex; gap: 8px; margin-bottom: 10px; }
.rosary-dots span { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink-soft); }
.rosary-dots .done { background: var(--ink-soft); }
.rosary-dots .now { background: var(--card); box-shadow: 0 0 0 3px var(--line); }
.rosary-mystery { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.rosary-mystery small { color: var(--ink-soft); font-size: 14px; }
.rosary-mystery strong { font-family: var(--display); font-size: 22px; }
.rosary-mystery span { font-size: 13px; color: var(--ink-soft); }
.rosary-card h3 { margin: 0 0 6px; font-family: var(--display); font-size: 22px; }
.rosary-count { font-size: 16px; color: var(--ink-soft); font-family: inherit; }
.rosary-card .prayer-body { font-size: 18px; }
.rosary-words summary { font-size: 15px; color: var(--ink-soft); cursor: pointer; }
.rosary-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 12px; }
.rosary-nav .btn { padding: 16px; font-size: 18px; }
.rosary-top .lang-tabs { width: 190px; flex: none; }

.today-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; }
.today-card h3 { margin: 0 0 6px; font-family: var(--display); font-size: 17px; color: var(--ink-soft); font-weight: 400; }
.today-card p { margin: 4px 0; }
.today-big { font-family: var(--display); font-size: 22px; }
.today-big small { display: block; font-family: inherit; font-size: 14px; color: var(--ink-soft); }
.today-ev { line-height: 1.35; }
.meal-row { display: flex; gap: 10px; align-items: baseline; }
.meal-row b { flex: none; width: 5.6em; font-weight: 600; color: var(--ink-soft); }
.meal-row.tonight span { font-weight: 600; }
.meal-row .none { color: var(--ink-soft); opacity: .6; }
.event .linkbtn + .linkbtn { margin-left: 22px; }
.rosary-refl { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; margin: 0 0 12px; }
.rosary-refl summary { cursor: pointer; font-weight: 600; color: var(--sage-deep); }
.rosary-refl p { margin: 10px 0 0; line-height: 1.55; }
.rosary-fruit { color: var(--ink-soft); font-size: 15px; }
.meal-day { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; display: grid; gap: 8px; }
.meal-head { display: flex; justify-content: space-between; align-items: baseline; }
.meal-head span { color: var(--ink-soft); font-size: 14px; }
.meal-cooklab { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); }
.meal-cooklab select { flex: 1; min-width: 0; }
.meal-cook { color: var(--ink-soft); font-weight: 400; }
.meal-day p { margin: 0; }
.feast-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 14px; margin-bottom: 8px; border-left: 4px solid var(--gold); background: var(--card); border-radius: 0 10px 10px 0; }
.feast-row span { color: var(--ink-soft); font-size: 14px; }
.today-feast { font-size: 17px; margin: 0 0 10px; padding: 8px 12px; border-left: 4px solid var(--gold); background: var(--card); border-radius: 0 10px 10px 0; }
.today-ev.feast { color: var(--ink-soft); }
.prayer-cat { margin: 18px 0 8px; font-family: var(--display); font-size: 15px; font-weight: 400; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.prayer-tools { margin-top: 8px; flex-wrap: wrap; gap: 8px; }
.prayer-search { margin: 14px 0 4px; }
.prayer-hint { margin: 0 0 4px; }
.prayer-star { float: right; margin: -8px -10px -8px 8px; min-width: 44px; min-height: 44px; padding: 0; border: 0; background: none; font-size: 24px; line-height: 1; color: var(--ink-soft); cursor: pointer; }
.prayer-star.on { color: var(--gold); }
.photo-month { margin: 20px 0 8px; font-family: var(--display); font-size: 18px; font-weight: 400; color: var(--ink-soft); }

.readings-link { margin: 8px 0 12px; }
.readings-link a { text-decoration: none; display: inline-block; }
.hs-list { list-style: none; margin: 6px 0 0; padding: 0; }
.hs-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hs-list li small { color: var(--ink-soft); display: block; }
.hs-st { font-size: 13px; font-weight: 700; }
.hs-st.present { color: var(--sage-deep); }
.hs-st.absent { color: var(--wine); }
.keep-row { margin-top: 10px; }
.keep-row span { text-align: left; font-size: 14px; }
.keep-book { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 12px; }
.keep-book figure { margin: 0; }
.keep-book img { width: 100%; height: auto; border-radius: 10px; display: block; }
.keep-book figcaption { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
@media (min-width: 700px) { .keep-book { grid-template-columns: 1fr 1fr; } }
@media print {
  header.top, nav.tabs, .keep-noprint, .toast { display: none !important; }
  body, main { background: #fff !important; }
  .keep-book { grid-template-columns: 1fr 1fr; gap: 10px; }
  .keep-book figure { break-inside: avoid; }
  h2.day { margin: 0 0 8px; }
}
.feat-state { color: var(--ink-soft); }
.feat-state.on { color: var(--sage-deep); }

/* Advice page */
.adv-field { display: block; width: 100%; box-sizing: border-box; margin: 8px 0; padding: 12px 14px; font: inherit; color: var(--ink); background: var(--card, #fbf6ec); border: 1px solid var(--line, #e3d9c4); border-radius: 14px; }

/* Prayer requests */
.pr-item { border-left: 4px solid var(--sage-deep, #4f6b4c); }
.pr-item.pr-soon { border-left-color: #c8891f; background: #fbf1dc; }
.pr-item.pr-pinned { border-left-color: var(--gold, #b8933f); }

.pr-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 16px; }
.pr-actions .btn { flex: 0 1 auto; padding: 8px 12px; font-size: 0.9rem; min-height: 0; }

/* Family page: people strip, grouped rows, settings */
.people-strip { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px 6px; padding: 2px 16px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.people-strip::-webkit-scrollbar { display: none; }
.chip-person { flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; }
.chip-person .avatar { width: 56px; height: 56px; font-size: 24px; }
.chip-person strong { font-size: 14px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-person small { font-size: 11px; color: var(--ink-soft); margin-top: -3px; }
.fam-group { margin: 0 0 18px; }
.fam-head { font-family: var(--body); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); margin: 0 0 6px 4px; }
.fam-list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.fam-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 10px 14px; background: none; border: 0; border-top: 1px solid var(--line); font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.fam-row:first-child { border-top: 0; }
.fam-row:active { background: var(--paper); }
.fam-row > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fam-row strong { font-family: var(--display); font-weight: 400; font-size: 17px; }
.fam-row small { color: var(--ink-soft); font-size: 14px; }
.fam-row > b { color: var(--ink-soft); font-size: 22px; font-weight: 400; }
.feat-group { margin: 16px 0 0; }
.feat-group .mem-row { justify-content: flex-start; }
.feat-sub { padding-left: 28px; }
.feat-note { display: block; font-size: 13px; color: var(--ink-soft); font-weight: 400; }
.feat-sub input[type=checkbox] { align-self: flex-start; margin-top: 2px; }
.feat-group .mem-row input[type=checkbox] { align-self: flex-start; margin-top: 2px; flex: none; }
.feat-note { margin-top: 2px; line-height: 1.35; }
.feat-warn { color: var(--wine); }

/* ---------- Recipe box ---------- */
.recipe-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 8px 14px; background: none; border: 0; border-top: 1px solid var(--line); font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.recipe-row:first-child { border-top: 0; }
.recipe-row:active { background: var(--paper); }
.recipe-row img, .recipe-nophoto { flex: none; width: 48px; height: 48px; border-radius: 10px; object-fit: cover; }
.recipe-nophoto { font-style: normal; display: grid; place-items: center; background: #e9e1cf; color: var(--sage-deep); font-family: var(--display); font-size: 22px; }
.recipe-row > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.recipe-row strong { font-family: var(--display); font-weight: 400; font-size: 17px; }
.recipe-row small { color: var(--ink-soft); font-size: 14px; }
.recipe-row > b { color: var(--ink-soft); font-size: 22px; font-weight: 400; }
.recipe-row > b.recipe-fav { color: var(--gold); font-size: 18px; }
.recipe-hero { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; margin: 12px 0 4px; }
.recipe-head { margin: 8px 0 10px; }
.recipe-head .prayer-star { margin-top: 0; }
.recipe-scale { margin-top: 6px; }
.recipe-scale button.on { color: var(--gold); }
.recipe-peoplelab { font-weight: 400; display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 15px; margin: 4px 0 6px; }
.recipe-peoplelab .recipe-people { flex: none; width: 84px; margin: 0; padding: 8px 10px; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.recipe-ings { list-style: none; margin: 0; padding: 4px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.recipe-ings li { border-top: 1px solid var(--line); }
.recipe-ings li:first-child { border-top: 0; }
.recipe-ings label { font-weight: 400; margin: 0; display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; font-size: 17px; line-height: 1.4; cursor: pointer; }
.recipe-ings input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--sage-deep); }
.recipe-ings input:checked + span { color: var(--ink-soft); text-decoration: line-through; }
.recipe-sub { padding: 12px 0 4px; font-family: var(--display); color: var(--sage-deep); }
.recipe-asis { color: var(--ink-soft); font-size: 13px; }
.recipe-tip { display: block; color: var(--wine); font-size: 14px; }
.recipe-note { margin: 8px 2px 0; }
.recipe-steps { margin: 0; padding: 4px 14px 4px 34px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.recipe-steps li { padding: 8px 0; line-height: 1.55; font-size: 17px; }
.recipe-steps li::marker { color: var(--gold); font-family: var(--display); }
.recipe-notes { white-space: pre-wrap; margin: 0; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 14px; font-style: italic; }
