:root {
  --bg: #f5f6f1;
  --card: #ffffff;
  --text: #1d2420;
  --muted: #67706a;
  --line: #e3e6df;
  --accent: #1f8a4c;
  --accent-soft: #e3f3e9;
  --danger: #c0392b;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --card: #1b211e;
    --text: #eef2ee;
    --muted: #9aa59e;
    --line: #2a322d;
    --accent: #3fbf72;
    --accent-soft: #1d3326;
    --danger: #ff6b5b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}
#app {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 24px);
}
[hidden] { display: none !important; }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; margin: 0; }
p { margin: 0; }
code { font-size: 0.85em; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* telas centrais */
.center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding-top: 8vh; }
.center form, .center .wide { width: 100%; max-width: 360px; }
.logo { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.12); }
.steps { text-align: left; margin: 0; padding-left: 1.3em; display: grid; gap: 8px; }
.ios-share { display: inline-block; width: 1em; height: 1.1em; vertical-align: -0.15em;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M8 7l4-4 4 4M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-7'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M8 7l4-4 4 4M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-7'/%3E%3C/svg%3E") center/contain no-repeat; }
.divider { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 360px; color: var(--muted); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.stack { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.stack.tight { gap: 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; min-width: 0; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
label { font-weight: 600; font-size: 0.9rem; }

/* campos e botões */
input, textarea {
  font: inherit; color: inherit; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
button, .file-btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 12px;
  padding: 12px 16px; cursor: pointer; color: inherit; background: none;
}
button:disabled { opacity: 0.5; }
.primary { background: var(--accent); color: #fff; }
.secondary { background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.link { padding: 8px; color: var(--accent); font-weight: 500; }
.link.danger, .danger { color: var(--danger); }
.icon-btn { padding: 8px 10px; font-size: 1.3rem; line-height: 1; border-radius: 10px; }
.wide { width: 100%; }

/* lista */
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.banner { display: block; width: 100%; text-align: left; background: var(--accent-soft); color: var(--text);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 0.95rem; font-weight: 400; }
.banner.action { font-weight: 600; color: var(--accent); }
.add { display: flex; gap: 6px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px; margin-bottom: 16px; position: sticky; top: calc(env(safe-area-inset-top) + 6px); z-index: 2;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.06); }
.add input { border: 0; box-shadow: none !important; padding: 10px; }
.add-btn { font-size: 1.4rem; padding: 6px 14px; line-height: 1; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px 6px 6px; }
.check { width: 44px; height: 44px; flex: none; padding: 0; position: relative; }
.check::before { content: ""; position: absolute; inset: 11px; border: 2px solid var(--muted); border-radius: 50%; }
.item.done .check::before { background: var(--accent); border-color: var(--accent); }
.item.done .check::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 0.9rem; }
.body { flex: 1; min-width: 0; text-align: left; padding: 6px 4px; display: flex; flex-direction: column; font-weight: 400; border-radius: 8px; }
.name { font-weight: 600; overflow-wrap: anywhere; }
.note { color: var(--muted); font-size: 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 0.75rem; margin-top: 2px; }
.item.done .name { text-decoration: line-through; color: var(--muted); }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; flex: none; cursor: zoom-in; }
.done-section { margin-top: 20px; }
.done-section summary { color: var(--muted); font-weight: 600; padding: 8px 2px; cursor: pointer; }
.done-section .items { margin: 8px 0; }

/* folhas (dialogs) */
.sheet {
  border: 0; padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px); width: 100%; max-width: 560px;
  background: var(--bg); color: var(--text); border-radius: 20px 20px 0 0;
  margin: auto auto 0; max-height: 92dvh; overflow: auto;
}
.sheet::backdrop { background: rgb(0 0 0 / 0.45); }
@media (min-width: 600px) { .sheet { border-radius: 20px; margin: auto; } }
.preview { width: 100%; max-height: 280px; object-fit: contain; border-radius: 12px; background: var(--card); }
.photo[open] { display: flex; flex-direction: column; gap: 12px; }
.photo img { width: 100%; max-height: 75dvh; object-fit: contain; border-radius: 12px; }
.members { margin: 0; padding-left: 1.2em; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 0.95rem;
  max-width: calc(100% - 32px); z-index: 10; box-shadow: 0 6px 20px rgb(0 0 0 / 0.2); }

.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
