/* ============================================================
   Family Chores — "Fridge Door" visual identity
   Warm paper, grape primary, gold points, pinned-note cards.
   ============================================================ */

:root {
  --paper:      #fbf7f0;
  --paper-2:    #f3ecdf;
  --card:       #ffffff;
  --ink:        #2b2440;
  --muted:      #8a8299;

  --grape:      #6d3bd1;
  --grape-deep: #4f2aa0;
  --gold:       #f6b93b;
  --gold-deep:  #e6980f;
  --mint:       #2fb383;
  --coral:      #e0554e;
  --sky:        #3aa0e0;

  --line:       #e7dfd0;
  --radius:     18px;
  --radius-sm:  12px;
  --shadow:     0 6px 20px rgba(43, 36, 64, 0.08);
  --shadow-lift:0 12px 30px rgba(43, 36, 64, 0.14);

  --display: "Baloo 2", system-ui, sans-serif;
  --body:    "Nunito", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(109, 59, 209, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
}

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; color: var(--ink); }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.35rem; margin-bottom: .3rem; }
h3 { font-size: 1.05rem; margin: 1.1rem 0 .5rem; }

a { color: var(--grape); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .85rem 1.4rem; flex-wrap: wrap;
  background: var(--card);
  border-bottom: 3px solid var(--grape);
  box-shadow: var(--shadow);
}
.topbar h1 { color: var(--grape-deep); display: flex; align-items: center; gap: .4rem; }
.family-name { color: var(--muted); font-weight: 700; font-size: .9rem; }
.topbar nav { display: flex; gap: 1.3rem; flex-wrap: wrap; align-items: center; }
.topbar nav a { color: var(--ink); font-weight: 700; font-size: .95rem; position: relative; }
.topbar nav a:hover { color: var(--grape); text-decoration: none; }
.topbar nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px;
  background: var(--gold); transform: scaleX(0); transition: transform .18s ease;
}
.topbar nav a:hover::after { transform: scaleX(1); }

main { max-width: 980px; margin: 1.75rem auto; padding: 0 1.1rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Cards: pinned notes ---------- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem 1.4rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.card::before {
  content: "";
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9a8b, var(--coral));
  box-shadow: 0 2px 5px rgba(43,36,64,.25);
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.1rem; }

/* ---------- Buttons ---------- */
button, .btn {
  font-family: var(--display); font-weight: 600; font-size: 1rem;
  padding: .7rem 1rem; border-radius: var(--radius-sm);
  border: none; cursor: pointer; width: 100%;
  background: var(--grape); color: #fff;
  box-shadow: 0 3px 0 var(--grape-deep);
  transition: transform .1s ease, box-shadow .1s ease;
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--grape-deep); }
button:active, .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--grape-deep); }

button.mini { width: auto; padding: .4rem .8rem; font-size: .85rem; box-shadow: 0 2px 0 var(--grape-deep); }
button.ghost { background: #fff; color: var(--coral); border: 2px solid var(--coral); box-shadow: none; }
button.ghost:hover { background: #fff5f4; }
button.ghost-brand { background: #fff; color: var(--grape); border: 2px solid var(--grape); box-shadow: none; }
button.ghost-brand:hover { background: #f6f1ff; }
button[disabled] { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Forms ---------- */
form { display: flex; flex-direction: column; gap: .8rem; }
label { font-family: var(--body); font-weight: 700; font-size: .9rem; color: var(--ink); }
input, select {
  font: inherit; font-weight: 600;
  padding: .65rem .8rem; border-radius: var(--radius-sm);
  border: 2px solid var(--line); width: 100%; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus {
  outline: none; border-color: var(--grape);
  box-shadow: 0 0 0 3px rgba(109, 59, 209, .15);
}
fieldset { border: 2px solid var(--line); border-radius: var(--radius-sm); }
fieldset legend { font-family: var(--display); font-weight: 600; padding: 0 .4rem; }
fieldset label { display: inline-flex; align-items: center; gap: .3rem; margin-right: .7rem; font-weight: 600; }
fieldset input { width: auto; }

.error { color: var(--coral); font-weight: 700; font-size: .9rem; min-height: 1em; margin: 0; }
.success { color: var(--mint); font-weight: 700; font-size: .9rem; margin: 0 0 .5rem; }
.empty, .loading { color: var(--muted); font-weight: 600; }

/* ---------- Daily dashboard chores ---------- */
.tally { float: right; font-family: var(--display); font-weight: 700; color: var(--grape); background: #f6f1ff; padding: .1rem .6rem; border-radius: 999px; font-size: .9rem; }
ul.chores, .chore-list { list-style: none; padding: 0; margin: 0; }
ul.chores li { padding: .55rem 0; border-bottom: 1px dashed var(--line); }
ul.chores li label { display: flex; align-items: center; gap: .7rem; cursor: pointer; font-weight: 600; }
ul.chores li input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--mint); }
ul.chores li em { margin-left: auto; color: var(--gold-deep); font-style: normal; font-weight: 800; font-size: .85rem; }
ul.chores li.done label span { text-decoration: line-through; color: var(--muted); }
ul.chores li.missed span { color: var(--coral); }

/* ---------- Chore management list ---------- */
.chore-list li { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.chore-list li .chore-main { flex: 1 1 auto; font-weight: 600; }
.chore-list li strong { font-family: var(--display); }
.chore-list li.editing { display: block; }

/* ---------- Weekly report ---------- */
table.report { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.report th, table.report td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--line); }
table.report th { background: var(--grape); color: #fff; font-family: var(--display); font-weight: 600; }
table.report tr:last-child td { border-bottom: none; }
table.report tr:nth-child(even) td { background: var(--paper); }

/* ---------- Auth pages ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; }
.auth-card { width: min(92vw, 400px); text-align: center; }
.auth-card h1 { color: var(--grape-deep); font-size: 1.7rem; margin-bottom: .3rem; }
.auth-card h2 { font-size: 1.1rem; color: var(--muted); font-family: var(--body); font-weight: 700; margin-bottom: 1rem; }
.auth-card hr { border: none; border-top: 1px dashed var(--line); margin: 1.3rem 0; }

/* ---------- Members list ---------- */
.member-list { list-style: none; padding: 0; margin: 0; }
.member-list li { padding: .7rem 0; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .6rem; }
.member-list .m-identity { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.member-list .m-identity strong { font-family: var(--display); }
.member-list .m-detail { color: var(--muted); font-weight: 600; font-size: .85rem; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.member-list .row-actions { display: inline-flex; gap: .4rem; }
.row-actions { display: inline-flex; gap: .4rem; }

.role-tag { font-family: var(--display); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; padding: .12rem .5rem; border-radius: 999px; color: #fff; font-weight: 600; }
.role-tag.parent { background: var(--grape); }
.role-tag.child  { background: var(--mint); }

/* Inline edit form */
.member-list li.editing { display: block; padding: 1.1rem; background: var(--paper); border-radius: var(--radius-sm); border: 2px dashed var(--line); }
.edit-form { display: flex; flex-direction: column; gap: .8rem; }
.edit-form label.inline { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); gap: .25rem; font-weight: 700; }
.edit-form label.inline input, .edit-form label.inline select { width: 100%; min-width: 0; }
.edit-form .row-actions { margin-top: .3rem; justify-content: flex-end; }
.edit-form .row-actions button.mini { width: auto; }
.edit-form fieldset.edit-days { display: flex; flex-wrap: wrap; gap: .5rem; padding: .6rem; }
.edit-form fieldset.edit-days label { width: auto; display: inline-flex; align-items: center; gap: .25rem; font-size: .85rem; }
.edit-form fieldset.edit-days input { width: auto; }

/* Balances + reward badges (parent) */
.balances { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.badge { background: #fff8e6; border: 2px solid var(--gold); border-radius: 999px; padding: .3rem .8rem; font-weight: 700; font-size: .9rem; }
.badge strong { color: var(--gold-deep); }

/* ============================================================
   KIDS interface
   ============================================================ */
body.kids { --grape: #7c3aed; }
.kid-card { width: min(94vw, 430px); text-align: center; }
.kid-card h1 { font-size: 1.7rem; margin-bottom: 1.1rem; color: var(--grape-deep); }

.kid-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px,1fr)); gap: .9rem; }
.kid-pick { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.1rem .5rem; border: 3px solid var(--line); border-radius: 20px; background: #fff; cursor: pointer; width: auto; box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.kid-pick:hover { border-color: var(--grape); transform: translateY(-3px) rotate(-1.5deg); box-shadow: var(--shadow-lift); }
.kid-avatar { font-size: 2.6rem; line-height: 1; }
.kid-name { font-family: var(--display); font-weight: 700; font-size: 1rem; color: var(--ink); }

.pin-dots { display: flex; justify-content: center; gap: .9rem; margin: 1.1rem 0; }
.pin-dots span { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--grape); transition: background .15s ease, transform .15s ease; }
.pin-dots span.filled { background: var(--grape); transform: scale(1.1); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-top: .6rem; }
.keypad button { font-family: var(--display); font-size: 1.5rem; padding: 1rem; border-radius: 16px; background: #fff; color: var(--ink); border: 3px solid var(--line); box-shadow: var(--shadow); font-weight: 700; }
.keypad button:hover { border-color: var(--grape); transform: translateY(-2px); }
.keypad button:active { transform: translateY(1px); }
.keypad button.ghost { background: var(--paper-2); border-color: var(--line); color: var(--grape-deep); }

.kid-bar h1 { font-size: 1.4rem; color: var(--grape-deep); }
.kid-main { max-width: 660px; margin: 1.4rem auto; padding: 0 1.1rem; }
.progress { font-family: var(--display); font-size: 1.15rem; font-weight: 700; text-align: center; margin-bottom: 1.2rem; padding: .7rem; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border: 2px dashed var(--gold); }
ul.chores.big { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .8rem; }
ul.chores.big li { border: none; padding: 0; }
.chore-toggle { display: flex; align-items: center; gap: .9rem; width: 100%; padding: 1.1rem 1.2rem; border-radius: 18px; border: 3px solid var(--line); background: #fff; font-family: var(--body); font-size: 1.1rem; font-weight: 700; cursor: pointer; text-align: left; color: var(--ink); box-shadow: var(--shadow); }
.chore-toggle:hover { border-color: var(--grape); transform: translateY(-2px); }
.chore-toggle .check { font-size: 1.6rem; transition: transform .2s ease; }
.chore-toggle .label { flex: 1; }
.chore-toggle .pts { font-family: var(--display); color: var(--gold-deep); font-weight: 700; }
.chore-toggle.done { background: #eafaf3; border-color: var(--mint); box-shadow: none; }
.chore-toggle.done .check { transform: scale(1.15); }
.chore-toggle.done .label { text-decoration: line-through; color: var(--muted); }

.points-hero { font-family: var(--display); font-size: 2.2rem; font-weight: 700; text-align: center; margin: .5rem 0 1.5rem; color: var(--ink); }
.points-hero strong { color: var(--gold-deep); }
.reward-cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .8rem; }
.reward-cards li { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.2rem; border: 3px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.reward-cards li.locked { opacity: .55; box-shadow: none; }
.reward-title { flex: 1; font-family: var(--display); font-weight: 600; }
.reward-cost { font-family: var(--display); color: var(--gold-deep); font-weight: 700; }
.reward-cards .need { font-size: .8rem; color: var(--muted); font-weight: 700; }
.reward-cards button.mini { width: auto; }

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
