:root {
  --bg: #f6f1e7;
  --card: #fffdf8;
  --ink: #1f3b36;
  --muted: #6c7a74;
  --line: #e4dccb;
  --accent: #e8a33d;
  --good: #2f7d6d;
  --bad: #b8492f;
  --radius: 16px;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100dvh; font-size: 16px; line-height: 1.4; }
#app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(92px + env(safe-area-inset-bottom)); }
.loading { text-align: center; padding: 30vh 0; color: var(--muted); }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 4px 8px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }

/* header */
.top { display: flex; align-items: center; gap: 12px; padding: calc(18px + env(safe-area-inset-top)) 4px 6px; }
.top .grow { flex: 1; min-width: 0; }
.top small { color: var(--muted); display: block; }
.pill { background: var(--ink); color: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 700; white-space: nowrap; }
.pill b { color: var(--accent); }

/* avatars */
.av { --c: var(--good); width: 40px; height: 40px; border-radius: 50%; background: var(--c); color: #fff;
  display: inline-grid; place-items: center; font-weight: 800; flex: none; }
.av.sm { width: 26px; height: 26px; font-size: .75rem; }
.av.lg { width: 76px; height: 76px; font-size: 1.9rem; }

/* cards and rows */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--line); min-height: 58px; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 650; overflow-wrap: anywhere; }
.row .s { color: var(--muted); font-size: .86rem; }
.row.done .t { text-decoration: line-through; color: var(--muted); }
.empty { padding: 18px 14px; color: var(--muted); }
.pts { font-weight: 800; color: var(--accent); white-space: nowrap; }
.warn { color: var(--bad); }

.btn { background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 14px; font-weight: 700; white-space: nowrap; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.good { background: var(--good); }
.btn.bad { background: transparent; color: var(--bad); border: 1.5px solid var(--bad); }
.btn.small { padding: 7px 11px; font-size: .88rem; }
.btn.block { display: block; width: 100%; padding: 14px; }
.btn:disabled { opacity: .4; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.link { color: var(--good); font-weight: 700; text-decoration: underline; }
.tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; }
.tick.on { background: var(--good); border-color: var(--good); }
.tick.wait { background: var(--accent); border-color: var(--accent); }
.proof { width: 100%; max-height: 320px; object-fit: cover; display: block; background: #ddd; }
.thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex: none; background: #ddd; }

/* bottom nav */
nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav button { flex: 1; max-width: 112px; padding: 10px 2px 9px; font-size: .72rem; font-weight: 700; color: var(--muted); position: relative; }
nav button svg { display: block; margin: 0 auto 3px; width: 24px; height: 24px; }
nav button.on { color: var(--ink); }
nav .badge { position: absolute; top: 5px; left: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 999px;
  min-width: 18px; height: 18px; font-size: .68rem; display: grid; place-items: center; padding: 0 5px; }

/* calendar */
.calhead { display: flex; align-items: center; justify-content: space-between; margin: 14px 4px 10px; }
.calhead b { font-size: 1.15rem; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal button { aspect-ratio: 1; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 650;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.cal button.out { visibility: hidden; }
.cal button.today { border-color: var(--accent); border-width: 2px; }
.cal button.sel { background: var(--ink); color: #fff; border-color: var(--ink); }
.dots { display: flex; gap: 2px; height: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--good)); }

/* lists */
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; margin: 14px 0; }
.seg button { flex: 1; padding: 9px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); }
.add { display: flex; gap: 8px; margin-bottom: 12px; }
.add input { flex: 1; }

/* forms */
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; min-height: 46px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-weight: 700; font-size: .88rem; margin: 14px 0 5px; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1rem; }
label.check input { width: 22px; height: 22px; accent-color: var(--good); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { margin: 0; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: block; padding: 8px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: .88rem; }
.chips input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips input:checked + span.sw { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
.chips input:focus-visible + span { outline: 2px solid var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.err { color: var(--bad); font-weight: 650; margin-top: 12px; min-height: 1.2em; }
.hint { color: var(--muted); font-size: .86rem; margin-top: 6px; }

dialog { border: 0; border-radius: 20px; padding: 20px; width: min(520px, calc(100vw - 24px)); max-height: 90dvh; background: var(--bg); color: var(--ink); }
dialog::backdrop { background: rgba(20, 35, 32, .55); }
dialog h3 { margin: 0 0 4px; font-size: 1.25rem; }
dialog .actions { display: flex; gap: 8px; margin-top: 20px; }
dialog .actions .btn { flex: 1; padding: 13px; }
dialog .actions .btn.bad { flex: 0 0 auto; }

/* sign-in screens */
.gate { padding-top: 12vh; text-align: center; }
.gate h1 { font-size: 2rem; margin-bottom: 6px; }
.gate > p { color: var(--muted); margin-bottom: 26px; }
.gate form { text-align: left; }
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.people button { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px 8px; font-weight: 750; font-size: 1.05rem; }
.people .av { display: grid; margin: 0 auto 10px; }
.pin { text-align: center; font-size: 1.8rem; letter-spacing: .5em; }
.setuprow { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 6px; margin-bottom: 8px; }

#toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 650; opacity: 0; transition: .2s; pointer-events: none; z-index: 20; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
