/* =========================================================================
   TAREFAS DE CASA — design tokens
   Identidade: verde-água pastel + neutros claros. Tipografia Space Grotesk
   (display, com personalidade geométrica sem ser infantil) + Inter (corpo).
   Elemento de assinatura: "nível de água" animado no card de pontos — o
   tema aquático reforça o verde-água e transforma pontuação em algo vivo.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #F7F9F7;
  --surface: #FFFFFF;
  --surface-tint: #EFF7F4;

  --aqua-50:  #EAF6F2;
  --aqua-100: #D3EDE5;
  --aqua-300: #A7DBCB;
  --aqua-500: #7BC4AE;
  --aqua-600: #5FAE97;
  --aqua-700: #468C79;

  --peach-100: #FCE9D6;
  --peach-300: #F9CE9D;
  --peach-600: #E0985A;

  --lavender-100: #EAE3F3;
  --lavender-500: #B29ED6;

  --rose-100: #F7DEE1;
  --rose-500: #E39AA2;

  --ink-900: #26332F;
  --ink-700: #47554F;
  --ink-500: #7C8B85;
  --ink-300: #B7C2BD;
  --line: #E7EDE9;

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --radius-pill: 999px;

  --shadow-soft: 0 10px 30px rgba(38, 51, 47, 0.06);
  --shadow-card: 0 6px 18px rgba(95, 174, 151, 0.14);
  --shadow-press: 0 2px 8px rgba(95, 174, 151, 0.16);

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;

  --nav-h: 78px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: linear-gradient(180deg, #EEF6F3 0%, #F7F9F7 340px);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: var(--font-body);
}

:focus-visible {
  outline: 2.5px solid var(--aqua-600);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------------------------- App shell -------------------------------- */

#app-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

#phone {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

@media (min-width: 560px) {
  body { background: linear-gradient(160deg, #DDEFEA, #F7F9F7 55%, #F3EEF8); }
  #app-shell { padding: 32px 12px; align-items: flex-start; }
  #phone {
    min-height: min(880px, calc(100vh - 64px));
    border-radius: 40px;
    box-shadow: 0 30px 70px rgba(38, 51, 47, 0.18), 0 0 0 10px #fff, 0 0 0 11px #dfe7e3;
    overflow: hidden;
  }
}

#screen {
  flex: 1;
  padding: calc(20px + var(--safe-top)) 20px calc(var(--nav-h) + 28px);
  overflow-y: auto;
}

#screen.no-nav { padding-bottom: 28px; }

/* ------------------------------ Topbar ---------------------------------- */

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.topbar .hello { font-size: 22px; font-weight: 700; }
.topbar .hello span.wave { display: inline-block; animation: wave 1.8s ease-in-out infinite; transform-origin: 70% 70%; }
.topbar .date { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.avatar-btn {
  width: 42px; height: 42px; border-radius: var(--radius-pill);
  background: var(--aqua-100); color: var(--aqua-700);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  border: 2px solid var(--surface); box-shadow: var(--shadow-card);
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-8deg); }
  45% { transform: rotate(14deg); }
  60% { transform: rotate(0deg); }
}

/* --------------------------- Points hero (assinatura) -------------------- */

.points-hero {
  position: relative;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, #FBFEFD, var(--surface));
  box-shadow: var(--shadow-soft);
  padding: 22px 22px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.water-jar {
  position: relative;
  width: 86px; height: 86px;
  border-radius: 30px;
  background: var(--aqua-50);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(95,174,151,0.18);
}

.water-jar .water {
  position: absolute;
  left: -25%;
  width: 150%;
  bottom: 0;
  height: var(--fill, 30%);
  min-height: 10px;
  transition: height 0.7s cubic-bezier(.34,1.56,.64,1);
}

.water-jar .wave-shape {
  position: absolute;
  top: -14px; left: 0;
  width: 200%;
  height: 24px;
  background: var(--aqua-500);
  border-radius: 46%;
  opacity: 0.9;
  animation: wave-drift 5.2s linear infinite;
}
.water-jar .wave-shape.two {
  background: var(--aqua-300);
  opacity: 0.85;
  top: -10px;
  animation-duration: 7.8s;
  animation-direction: reverse;
}
.water-jar .water-body {
  position: absolute; inset: 8px 0 0 0;
  background: var(--aqua-600);
}

@keyframes wave-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.water-jar .leaf {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  font-size: 15px; opacity: 0.9;
}

.points-hero .info { flex: 1; }
.points-hero .points-value {
  font-size: 34px; font-weight: 700; line-height: 1;
  display: flex; align-items: baseline; gap: 6px;
}
.points-hero .points-value small { font-size: 14px; font-weight: 500; color: var(--ink-500); }
.points-hero .points-label { font-size: 13px; color: var(--ink-500); margin-top: 6px; }

/* droplet burst on completion */
.droplet {
  position: fixed;
  width: 8px; height: 10px;
  background: var(--aqua-500);
  border-radius: 50% 50% 50% 0;
  transform: rotate(45deg);
  pointer-events: none;
  animation: droplet-float 900ms ease-out forwards;
  z-index: 500;
}
@keyframes droplet-float {
  0% { opacity: 0.95; transform: translateY(0) rotate(45deg) scale(1); }
  100% { opacity: 0; transform: translateY(-46px) rotate(45deg) scale(0.5); }
}

/* ------------------------------ Sections --------------------------------- */

.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-title { font-size: 15.5px; font-weight: 700; }
.section-count { font-size: 12.5px; color: var(--ink-500); }

/* -------------------------------- Cards ----------------------------------- */

.task-card {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 13px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease, background .3s ease, opacity .3s ease;
}
.task-card:active { transform: scale(0.985); }

.task-card.completed { background: var(--aqua-50); border-color: var(--aqua-100); }
.task-card.completed .task-name { color: var(--ink-700); text-decoration: line-through; text-decoration-color: var(--aqua-300); text-decoration-thickness: 1.5px; }
.task-card.locked-other { opacity: 0.72; }

.task-card.pop { animation: card-pop 520ms ease; }
@keyframes card-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.028); }
  100% { transform: scale(1); }
}

.check-btn {
  width: 30px; height: 30px; border-radius: var(--radius-pill);
  border: 2px solid var(--aqua-300);
  background: var(--surface);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .25s ease, border-color .25s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}
.check-btn svg { width: 15px; height: 15px; opacity: 0; transform: scale(0.4); transition: opacity .22s ease, transform .3s cubic-bezier(.34,1.56,.64,1); }
.task-card.completed .check-btn { background: var(--aqua-600); border-color: var(--aqua-600); transform: scale(1.04); }
.task-card.completed .check-btn svg { opacity: 1; transform: scale(1); }
.task-card.locked-other .check-btn { border-color: var(--ink-300); background: var(--surface-tint); }

.task-body { flex: 1; min-width: 0; }
.task-name { font-size: 14.5px; font-weight: 600; line-height: 1.32; }
.task-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.chip {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill);
  color: var(--aqua-700); background: var(--aqua-100);
  display: inline-flex; align-items: center; gap: 4px;
}
.chip.chip-pts { background: var(--peach-100); color: var(--peach-600); }
.chip.chip-soft { background: var(--surface-tint); color: var(--ink-500); }
.chip.chip-lavender { background: var(--lavender-100); color: var(--lavender-500); }
.chip.chip-done-by { background: transparent; color: var(--ink-500); padding-left: 0; }

/* ------------------------------ Buttons ------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; border-radius: var(--radius-pill);
  font-weight: 700; font-size: 14.5px;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--aqua-600); color: #fff; box-shadow: var(--shadow-card); }
.btn-primary:disabled { opacity: 0.5; }
.btn-ghost { background: var(--surface-tint); color: var(--ink-700); }
.btn-block { width: 100%; }
.btn-danger-soft { background: var(--rose-100); color: #A24956; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-pill); }

.text-link { color: var(--aqua-700); font-weight: 600; font-size: 13.5px; }

/* -------------------------------- Login ------------------------------------ */

.login-screen {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: 20px 26px calc(30px + var(--safe-bottom));
}
.login-badge {
  width: 74px; height: 74px; border-radius: 26px; margin: 0 auto 20px;
  background: linear-gradient(160deg, var(--aqua-300), var(--aqua-600));
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
}
.login-badge svg { width: 34px; height: 34px; }
.login-title { text-align: center; font-size: 25px; font-weight: 700; margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--ink-500); font-size: 14px; margin-bottom: 30px; line-height: 1.5; }

.field-label { font-size: 13px; font-weight: 600; color: var(--ink-700); margin-bottom: 7px; display: block; }
.field-input {
  width: 100%; padding: 15px 16px; border-radius: var(--radius-md);
  border: 1.5px solid var(--line); background: var(--surface);
  font-size: 16px; color: var(--ink-900);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field-input:focus { border-color: var(--aqua-500); box-shadow: 0 0 0 4px var(--aqua-50); }
.field-error { color: #B4515C; font-size: 12.5px; margin-top: 8px; font-weight: 500; }

.login-people { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 24px; }
.login-chip {
  font-size: 12.5px; font-weight: 600; padding: 8px 13px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-700);
}
.login-chip:active { background: var(--aqua-50); }

/* -------------------------------- Bottom nav --------------------------------- */

#bottom-nav {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
#bottom-nav.hidden { display: none; }
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--ink-500); font-size: 11px; font-weight: 600;
  padding: 6px 14px; border-radius: 14px; transition: color .2s ease, background .2s ease;
}
.nav-item svg { width: 21px; height: 21px; }
.nav-item.active { color: var(--aqua-700); background: var(--aqua-50); }

/* -------------------------------- Admin home --------------------------------- */

.child-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-soft);
  display: flex; align-items: center; gap: 14px;
}
.child-card:active { transform: scale(0.99); }
.child-avatar {
  width: 52px; height: 52px; border-radius: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 18px; color: #fff;
}
.child-card .stats { flex: 1; }
.child-card .name-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.child-card .name { font-size: 16.5px; font-weight: 700; }
.child-card .grid-stats { display: flex; gap: 14px; }
.mini-stat { font-size: 12px; color: var(--ink-500); }
.mini-stat b { display: block; font-size: 15px; color: var(--ink-900); font-family: var(--font-display); }
.chevron { color: var(--ink-300); flex-shrink: 0; }

.status-pill { font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-pill); }
.status-pill.ok { background: var(--aqua-100); color: var(--aqua-700); }
.status-pill.nao_ok { background: var(--rose-100); color: #A24956; }
.status-pill.pendente { background: var(--surface-tint); color: var(--ink-500); }

/* -------------------------------- Detail screen ------------------------------- */

.back-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.back-btn {
  width: 38px; height: 38px; border-radius: var(--radius-pill); background: var(--surface);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-soft);
}
.back-row .title { font-size: 19px; font-weight: 700; }
.back-row .subtitle { font-size: 12.5px; color: var(--ink-500); }

.summary-row { display: flex; gap: 10px; margin-bottom: 22px; }
.summary-box {
  flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 10px; text-align: center; box-shadow: var(--shadow-soft);
}
.summary-box b { display: block; font-family: var(--font-display); font-size: 19px; }
.summary-box span { font-size: 10.5px; color: var(--ink-500); font-weight: 600; }

.eval-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl);
  padding: 18px; box-shadow: var(--shadow-soft); margin-top: 4px;
}
.eval-buttons { display: flex; gap: 10px; margin-top: 12px; }
.eval-btn {
  flex: 1; padding: 12px; border-radius: var(--radius-md); font-weight: 700; font-size: 13.5px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-700);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.eval-btn.selected.ok { background: var(--aqua-100); border-color: var(--aqua-300); color: var(--aqua-700); }
.eval-btn.selected.nao_ok { background: var(--rose-100); border-color: var(--rose-500); color: #A24956; }
.eval-meta { font-size: 12px; color: var(--ink-500); margin-top: 10px; }

/* -------------------------------- Task management ------------------------------ */

.manage-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-soft);
}
.manage-card.inactive { opacity: 0.55; }
.manage-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.manage-name { font-size: 14.5px; font-weight: 700; }
.manage-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.manage-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.switch { position: relative; width: 42px; height: 24px; border-radius: var(--radius-pill); background: var(--ink-300); flex-shrink: 0; transition: background .25s ease; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .25s cubic-bezier(.34,1.56,.64,1); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch.on { background: var(--aqua-600); }
.switch.on::after { transform: translateX(18px); }

.fab {
  position: absolute; right: 20px; bottom: calc(var(--nav-h) + 20px + var(--safe-bottom));
  width: 56px; height: 56px; border-radius: 20px;
  background: var(--aqua-600); color: #fff; box-shadow: var(--shadow-card);
  display: flex; align-items: center; justify-content: center; z-index: 30;
}
.fab:active { transform: scale(0.94); }

/* -------------------------------- Forms ------------------------------------ */

.form-screen { padding-bottom: 110px; }
.form-group { margin-bottom: 20px; }
textarea.field-input { resize: vertical; min-height: 70px; }

.pill-toggle { display: flex; gap: 8px; background: var(--surface-tint); padding: 4px; border-radius: var(--radius-pill); }
.pill-toggle button {
  flex: 1; padding: 10px; border-radius: var(--radius-pill); font-weight: 600; font-size: 13.5px; color: var(--ink-500);
  transition: background .2s ease, color .2s ease;
}
.pill-toggle button.active { background: var(--surface); color: var(--aqua-700); box-shadow: var(--shadow-soft); }

.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-option {
  padding: 9px 15px; border-radius: var(--radius-pill); border: 1.5px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink-700); background: var(--surface);
}
.chip-option.active { background: var(--aqua-600); border-color: var(--aqua-600); color: #fff; }

.points-select { display: flex; gap: 8px; }
.points-option {
  flex: 1; padding: 12px 0; text-align: center; border-radius: var(--radius-md);
  border: 1.5px solid var(--line); font-weight: 700; font-family: var(--font-display); font-size: 15px;
  color: var(--ink-700); background: var(--surface);
}
.points-option.active { background: var(--peach-300); border-color: var(--peach-300); color: #7A4A15; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; }
.toggle-row .label { font-size: 14px; font-weight: 600; }

.form-sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto;
  padding: 14px 20px calc(14px + var(--safe-bottom)); background: linear-gradient(0deg, var(--bg) 60%, transparent);
}

/* -------------------------------- Filters / history ------------------------------ */

.filter-tabs { display: flex; gap: 8px; background: var(--surface-tint); padding: 4px; border-radius: var(--radius-pill); margin-bottom: 18px; }
.filter-tabs button { flex: 1; padding: 9px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 700; color: var(--ink-500); }
.filter-tabs button.active { background: var(--surface); color: var(--aqua-700); box-shadow: var(--shadow-soft); }

.person-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.person-tabs button {
  flex: 1; padding: 10px; border-radius: var(--radius-md); font-weight: 700; font-size: 13.5px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-700);
}
.person-tabs button.active { background: var(--aqua-600); border-color: var(--aqua-600); color: #fff; }

.day-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-soft); }
.day-card .day-top { display: flex; align-items: center; justify-content: space-between; }
.day-card .day-date { font-weight: 700; font-size: 14px; text-transform: capitalize; }
.day-card .day-pts { font-family: var(--font-display); font-weight: 700; color: var(--peach-600); font-size: 14px; }
.day-card .day-tasks { font-size: 12.5px; color: var(--ink-500); margin-top: 6px; line-height: 1.5; }
.day-card .day-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

/* -------------------------------- Empty states ------------------------------ */

.empty-state { text-align: center; padding: 34px 18px; color: var(--ink-500); }
.empty-state .icon { font-size: 34px; margin-bottom: 10px; }
.empty-state .title { font-weight: 700; color: var(--ink-700); font-size: 14.5px; margin-bottom: 4px; }
.empty-state .sub { font-size: 13px; }

/* -------------------------------- Modal / bottom sheet ------------------------------ */

#modal-root:empty { display: none; }
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(38,51,47,0.32); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in .2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: 480px; background: var(--surface);
  border-radius: 26px 26px 0 0; padding: 26px 22px calc(24px + var(--safe-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,0.18);
  animation: sheet-up .28s cubic-bezier(.32,.72,0,1);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 38px; height: 4px; background: var(--line); border-radius: var(--radius-pill); margin: 0 auto 18px; }
.sheet-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; text-align: center; }
.sheet-sub { font-size: 13px; color: var(--ink-500); text-align: center; margin-bottom: 20px; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px); transform: translateX(-50%);
  background: var(--ink-900); color: #fff; font-size: 13px; font-weight: 600;
  padding: 11px 18px; border-radius: var(--radius-pill); z-index: 200;
  animation: toast-in .25s ease, toast-out .25s ease 1.9s forwards;
  box-shadow: var(--shadow-soft);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }

/* -------------------------------- utility ------------------------------ */
.stack-8 > * + * { margin-top: 8px; }
.muted { color: var(--ink-500); }
.hidden { display: none !important; }
