:root {
  --ink: #14231d;
  --muted: #5b6b63;
  --paper: #f1f5f1;
  --card: #ffffff;
  --spearmint: #1f8a6b;
  --spearmint-deep: #14624d;
  --mint: #8fe0c2;
  --mint-soft: #e4f5ec;
  --gold: #f2b23e;
  --gold-soft: #fbeecb;
  --line: #d9e4dd;
  --danger: #b8442b;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(20, 35, 29, .05), 0 10px 30px rgba(20, 35, 29, .07);
  --font-display: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 460px;
  margin: 0 auto;
  padding: 18px 18px calc(28px + env(safe-area-inset-bottom));
  min-height: 100dvh;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 22px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--spearmint);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -.01em;
}

/* Cards + typography */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card + .card { margin-top: 14px; }

h1, h2 {
  font-family: var(--font-display);
  letter-spacing: -.02em;
  margin: 0;
}

h1 { font-size: 1.5rem; font-weight: 800; }

h2 { font-size: 1.05rem; font-weight: 700; }

.lede { color: var(--muted); margin: 6px 0 18px; }

.eyebrow {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--spearmint);
  margin: 0 0 8px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--mint-soft);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--spearmint-deep);
  font: inherit;
  font-weight: 600;
  padding: 9px;
  border-radius: 8px;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--card);
  box-shadow: 0 1px 2px rgba(20, 35, 29, .08);
}

/* Fields */
.field { margin-bottom: 14px; }

.label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfdfb;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.input:focus-visible {
  outline: none;
  border-color: var(--spearmint);
  box-shadow: 0 0 0 3px rgba(31, 138, 107, .16);
}

.input::placeholder { color: #9aa8a0; }

/* Buttons */
.btn {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  padding: 13px;
  cursor: pointer;
  transition: transform .05s ease, background .15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--spearmint); color: #fff; }

.btn-primary:hover { background: var(--spearmint-deep); }

.btn:disabled { opacity: .5; cursor: not-allowed; }

.ghost {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 10px;
  cursor: pointer;
}

/* Invite code — the signature moment */
.invite { text-align: center; }

.invite-badge {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--gold-soft);
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.code-row {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 18px 0 8px;
}

.code-tile {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.9rem;
  width: 44px;
  height: 58px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1.5px solid var(--line);
  border-bottom: 3px solid var(--gold);
  border-radius: 10px;
  color: var(--ink);
}

.code-hint {
  color: var(--muted);
  font-size: .9rem;
  margin: 10px 0 20px;
}

.copy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 15px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
}

/* Members */
.members { list-style: none; margin: 12px 0 0; padding: 0; }

.member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--mint-soft);
  color: var(--spearmint-deep);
  font-weight: 700;
}

.member-name { font-weight: 600; flex: 1; }

.role {
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--spearmint-deep);
}

.role.parent { background: var(--gold-soft); color: #8a5a10; }

/* Utility */
.error {
  background: #fbeceb;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: .88rem;
  margin-bottom: 14px;
}

.next {
  color: var(--muted);
  font-size: .88rem;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: rise .2s ease;
}

.view { animation: rise .22s ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast { animation: rise .2s ease, none; }

@media (prefers-reduced-motion: reduce) {
  .view, .toast { animation: none; }
  .btn:active { transform: none; }
}

/* Section headers with an inline action */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.add {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--spearmint-deep);
  font: inherit;
  font-weight: 600;
  font-size: .85rem;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
}

.add:hover { border-color: var(--mint); background: var(--mint-soft); }

/* Lists of chores / rewards */
.list { list-style: none; margin: 14px 0 0; padding: 0; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.row-main { flex: 1; min-width: 0; }

.row-title { font-weight: 600; }

.row-sub { color: var(--muted); font-size: .84rem; margin-top: 2px; }

.row-del {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  cursor: pointer;
}

.row-del:hover { background: #fbeceb; color: var(--danger); }

.empty { color: var(--muted); font-size: .9rem; padding: 14px 0 2px; }

/* Native selects reuse the input styling but keep a caret */
select.input { appearance: none; background-image: none; padding-right: 14px; }

.link-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  color: var(--spearmint);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 10px;
}

.btn-secondary {
  background: #fff;
  color: var(--spearmint-deep);
  border: 1.5px solid var(--line);
  margin-top: 8px;
}

.btn-secondary:hover { border-color: var(--mint); background: var(--mint-soft); }

.field-row { display: flex; gap: 12px; }

.field-row .field { flex: 1; }

/* Per-kid "today" status */
.status-list { list-style: none; margin: 14px 0 0; padding: 0; }

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.status:first-child { border-top: 0; }

.status-main { flex: 1; min-width: 0; }

.status-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
}

.status-count {
  font-weight: 700;
  font-size: .9rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status-count.done { color: var(--spearmint); }

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--mint-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--spearmint);
  border-radius: 999px;
  transition: width .3s ease;
}

.bar-fill.full { background: var(--gold); }

/* Edit + delete actions on a chore row */
.row-actions { display: flex; gap: 2px; flex: none; }

.row-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  cursor: pointer;
}

.row-btn:hover { background: var(--mint-soft); color: var(--spearmint-deep); }

.row-btn.del:hover { background: #fbeceb; color: var(--danger); }
