:root {
  color-scheme: light;
  --bg: #fbf4ea;
  --surface: #fffaf3;
  --surface-strong: #ffffff;
  --ink: #2d2723;
  --muted: #796f66;
  --line: #eadccd;
  --mint: #45b984;
  --sun: #e8a23b;
  --coral: #ef6f6c;
  --blue: #4a78d0;
  --shadow: 0 14px 35px rgba(78, 52, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(69, 185, 132, 0.12), transparent 30rem),
    linear-gradient(180deg, #fbf4ea 0%, #f7eadb 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 22px 16px 96px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--coral);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  line-height: 1.03;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--coral);
  color: white;
  box-shadow: var(--shadow);
  font-size: 1.8rem;
  line-height: 1;
}

.household-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 22px 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.75);
}

.household-switch a {
  min-height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.household-switch a.active {
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(78, 52, 28, 0.08);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.summary-grid article,
.panel,
.task-card,
.shopping-row,
.task-dialog form,
.setup-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.9);
}

.summary-grid article {
  padding: 16px;
}

.summary-grid span {
  display: block;
  margin-bottom: 3px;
  font-size: 2rem;
  font-weight: 900;
}

.summary-grid p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.panel {
  margin-top: 14px;
  padding: 14px;
  box-shadow: 0 10px 22px rgba(78, 52, 28, 0.06);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title a,
.text-button {
  border: 0;
  background: transparent;
  color: var(--coral);
  font-weight: 900;
}

.stack,
.shopping-list,
.shopping-preview {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  padding: 12px;
  background: var(--surface-strong);
}

.task-card.is-done {
  opacity: 0.58;
}

.task-card.is-done h3 {
  text-decoration: line-through;
}

.check-form {
  margin: 0;
}

.check-button,
.mini-check {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--coral);
  font-weight: 900;
}

.check-button {
  width: 34px;
  height: 34px;
}

.meta-row,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.household-tag,
.shopping-row small {
  border-radius: 999px;
  background: color-mix(in srgb, var(--tag-color), white 78%);
  color: color-mix(in srgb, var(--tag-color), black 32%);
  padding: 4px 8px;
  font-weight: 900;
}

.badge-row {
  margin-top: 8px;
}

.badge-row span {
  border-radius: 999px;
  background: #f8eee4;
  padding: 4px 8px;
}

.empty {
  margin: 0;
  color: var(--muted);
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.filter-row span {
  white-space: nowrap;
  border-radius: 999px;
  background: #f8eee4;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.shopping-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 9px 10px;
  background: var(--surface-strong);
}

.shopping-row.is-done span {
  color: var(--muted);
  text-decoration: line-through;
}

.mini-check {
  width: 28px;
  height: 28px;
}

.quick-add {
  display: grid;
  grid-template-columns: 112px 1fr 42px;
  gap: 8px;
  margin-bottom: 12px;
}

.quick-add input,
.quick-add select,
.quick-add button,
.task-dialog input,
.task-dialog select,
.task-dialog textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.quick-add input,
.quick-add select,
.task-dialog input,
.task-dialog select,
.task-dialog textarea {
  padding: 11px 12px;
}

.quick-add button,
.primary-button {
  border: 0;
  background: var(--coral);
  color: white;
  font-weight: 900;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.94);
  backdrop-filter: blur(16px);
}

.bottom-nav a {
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.bottom-nav a.active {
  background: #f3e4d6;
  color: var(--ink);
}

.task-dialog {
  width: min(calc(100% - 24px), 520px);
  max-height: calc(100dvh - 32px);
  border: 0;
  padding: 0;
  background: transparent;
}

.task-dialog::backdrop {
  background: rgba(45, 39, 35, 0.35);
  backdrop-filter: blur(4px);
}

.task-dialog form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.close-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: #f8eee4;
  color: var(--ink);
  font-size: 1.2rem;
}

.task-dialog label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.toggle-line {
  display: flex !important;
  grid-template-columns: auto 1fr;
  flex-direction: row;
  align-items: center;
}

.toggle-line input {
  width: 18px;
  height: 18px;
}

.primary-button {
  min-height: 48px;
  border-radius: 8px;
}

.setup-card {
  padding: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.setup-card p {
  color: var(--muted);
  line-height: 1.5;
}

.setup-error {
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: #f8eee4;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.family-grid {
  display: grid;
  gap: 10px;
}

.family-grid article {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 3px 12px;
  align-items: center;
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px;
}

.family-grid span {
  grid-row: span 2;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--avatar-color);
  color: white;
  font-weight: 900;
}

.family-grid small {
  color: var(--muted);
  font-weight: 700;
}

@media (min-width: 760px) {
  .app-shell {
    padding-top: 34px;
  }

  .panel {
    padding: 18px;
  }
}
