:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --text: #24211d;
  --muted: #6f6a62;
  --line: #e4dfd6;
  --accent: #2f6f62;
  --accent-text: #ffffff;
  --danger: #b3402f;
  --radius: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --surface: #272522;
    --text: #f1ede6;
    --muted: #a8a299;
    --line: #3a3733;
    --accent: #7cc4b3;
    --accent-text: #12201d;
    --danger: #ef8d7c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
}

h1 { font-size: 26px; line-height: 1.2; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 24px 0 8px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.row > .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.stack { display: grid; gap: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; min-height: 44px; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--accent); }
input[type="color"] { padding: 4px; width: 56px; flex: none; }
textarea { min-height: 88px; resize: vertical; }

button, .button {
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
button.quiet { background: transparent; color: var(--accent); padding: 10px; }
button.danger { background: transparent; color: var(--danger); padding: 10px; }
button:disabled { opacity: 0.55; cursor: progress; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.done { color: var(--muted); text-decoration: line-through; }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photos div { position: relative; aspect-ratio: 1; }
.photos img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.photos button {
  position: absolute;
  top: 2px;
  right: 2px;
  min-height: 36px;
  padding: 4px 10px;
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  font-size: 13px;
}

nav {
  position: fixed;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  position: relative;
  min-height: 58px;
  padding: 6px 2px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
nav button[aria-current="page"] { color: var(--accent); font-weight: 700; }
nav .badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 26px);
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: var(--bg);
  font-size: 12px;
  line-height: 18px;
}

#toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  max-width: 528px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  opacity: 0;
  transition: opacity 160ms ease-out;
  pointer-events: none;
}
#toast.show { opacity: 1; }

.signin { min-height: 80vh; display: grid; align-content: center; gap: 14px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}
