:root {
  --ink: #173b3a;
  --muted: #557370;
  --cream: #fffaf0;
  --paper: #ffffff;
  --teal: #16766f;
  --teal-dark: #0f5e59;
  --teal-soft: #dff5ef;
  --yellow: #ffc94a;
  --yellow-soft: #fff1b9;
  --coral: #f4775b;
  --coral-soft: #ffe2d9;
  --lavender: #7669b6;
  --lavender-soft: #e8e3fa;
  --line: #d8e6e2;
  --shadow: 0 12px 30px rgb(30 75 70 / 12%);
  --radius-lg: 28px;
  --radius-md: 20px;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 20%, rgb(255 201 74 / 15%) 0 100px, transparent 102px),
    radial-gradient(circle at 94% 70%, rgb(118 105 182 / 10%) 0 140px, transparent 142px),
    var(--cream);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button, input, select { font: inherit; }

button { color: inherit; }

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 4px solid rgb(22 118 111 / 28%);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  left: 1rem;
  top: -5rem;
  padding: .8rem 1rem;
  border-radius: 12px;
  color: white;
  background: var(--teal-dark);
}

.skip-link:focus { top: 1rem; }

.site-header {
  width: min(1180px, calc(100% - 32px));
  min-height: 78px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  font-weight: 900;
  letter-spacing: -.04em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  border-radius: 15px;
  color: var(--teal-dark);
  background: var(--yellow);
  transform: rotate(-5deg);
  box-shadow: 0 5px 0 #e6a922;
}

.parent-link, .logout-link, .icon-button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .65rem 1rem;
  background: rgb(255 255 255 / 75%);
  cursor: pointer;
  font-weight: 800;
}

.parent-link:hover, .logout-link:hover, .icon-button:hover { background: white; transform: translateY(-1px); }
.header-actions { display: flex; align-items: center; gap: .55rem; }
.logout-link { color: var(--muted); }

#app { width: min(1180px, calc(100% - 32px)); margin: 0 auto 4rem; }

.loading-state, .error-state {
  min-height: 60vh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.loading-star { color: var(--yellow); font-size: 3.5rem; animation: breathe 1.3s ease-in-out infinite; }

.error-state .big-emoji { font-size: 4rem; }

.primary-button, .secondary-button, .done-button {
  min-height: 54px;
  border: 0;
  border-radius: 17px;
  padding: .8rem 1.25rem;
  cursor: pointer;
  font-weight: 900;
}

.primary-button, .done-button {
  color: white;
  background: var(--teal);
  box-shadow: 0 6px 0 var(--teal-dark);
}

.primary-button:hover, .done-button:hover { transform: translateY(-2px); }
.primary-button:active, .done-button:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--teal-dark); }
.secondary-button { color: var(--teal-dark); background: var(--teal-soft); }
.small-button { min-height: 42px; padding: .55rem .8rem; box-shadow: none; }
.danger-button { color: #853526; background: var(--coral-soft); }

.dashboard-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.2rem 0;
}

.child-switcher { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.child-switcher-label { flex: none; color: var(--muted); font-size: .9rem; font-weight: 900; }
.child-switcher-buttons { display: flex; flex-wrap: wrap; gap: .55rem; }
.child-switch {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 2px solid var(--line);
  border-radius: 17px;
  padding: .55rem .9rem;
  color: var(--muted);
  background: white;
  box-shadow: 0 5px 15px rgb(30 75 70 / 7%);
  cursor: pointer;
  font-weight: 900;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.child-switch:hover { transform: translateY(-2px); border-color: var(--teal); }
.child-switch.active { border-color: var(--teal); color: white; background: var(--teal); box-shadow: 0 5px 0 var(--teal-dark); }
.child-switcher.compact { justify-content: center; margin: .5rem 0 1.2rem; }
.child-switcher.compact .child-switch { min-height: 44px; padding: .45rem .75rem; }

.profile-chip, .points-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 46px;
  padding: .55rem .9rem;
  border-radius: 999px;
  background: white;
  box-shadow: 0 5px 18px rgb(30 75 70 / 8%);
  font-weight: 900;
}

.points-chip { background: var(--yellow-soft); }

.family-topline {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: .9rem;
  margin: .9rem 0 1.2rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: .45rem .8rem;
  background: rgb(255 255 255 / 78%);
  box-shadow: 0 5px 18px rgb(30 75 70 / 6%);
}
.family-topline strong { font-weight: 900; }
.family-topline span { color: var(--muted); }

.hero {
  position: relative;
  min-height: 350px;
  overflow: hidden;
  display: grid;
  grid-template-columns: .82fr 1.18fr;
  align-items: stretch;
  border-radius: 34px;
  background: #e4f5ec;
  box-shadow: var(--shadow);
}

.hero-copy {
  z-index: 1;
  align-self: center;
  padding: clamp(2rem, 5vw, 4rem);
}

.eyebrow {
  margin: 0 0 .55rem;
  color: var(--teal-dark);
  font-size: .88rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 580px;
  margin-bottom: .8rem;
  font-size: clamp(2.2rem, 6vw, 4.7rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.hero-copy > p:last-child {
  max-width: 450px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  line-height: 1.5;
}

.hero-image { position: relative; min-height: 300px; }

.hero-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 56% center;
  mask-image: linear-gradient(to right, transparent 0, black 23%);
}

.week-planning {
  margin-top: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 27px;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: white;
  box-shadow: var(--shadow);
}
.week-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1rem; }
.week-heading h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.15rem); letter-spacing: -.035em; }
.week-heading > p { max-width: 480px; margin-bottom: .1rem; color: var(--muted); line-height: 1.4; }
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(125px, 1fr));
  gap: .65rem;
  overflow-x: auto;
  padding: .15rem .1rem .45rem;
  scroll-snap-type: x proximity;
}
.week-day {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  border: 2px solid #e4edeb;
  border-radius: 18px;
  padding: .75rem;
  background: #fbfdfc;
  scroll-snap-align: start;
}
.week-day.today { border-color: var(--teal); background: var(--teal-soft); }
.week-day.complete { border-color: #e8b329; background: var(--yellow-soft); }
.week-day.future { background: #f7f8f8; }
.week-day header { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; text-transform: capitalize; }
.week-day header span { color: var(--muted); font-size: .8rem; font-weight: 900; text-transform: uppercase; }
.week-day header strong { font-size: 1.35rem; }
.week-moments { display: flex; justify-content: space-between; gap: .25rem; margin: .8rem 0; }
.week-moments span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: white; filter: grayscale(.65); opacity: .65; }
.week-moments span.done { background: var(--yellow); filter: none; opacity: 1; box-shadow: 0 3px 0 #daa51f; }
.week-child-scores { display: grid; gap: .3rem; }
.week-child-scores > span { display: flex; align-items: center; justify-content: space-between; gap: .35rem; border-radius: 9px; padding: .22rem .35rem; background: rgb(255 255 255 / 82%); }
.week-child-scores i { font-size: 1rem; font-style: normal; }
.week-child-scores b { color: var(--teal-dark); font-size: .75rem; }
.week-day-status { margin: .65rem 0 0; color: var(--muted); font-size: .72rem; font-weight: 900; text-align: center; }
.week-day > em { position: absolute; right: .4rem; bottom: .35rem; border-radius: 999px; padding: .17rem .4rem; color: white; background: var(--teal); font-size: .62rem; font-style: normal; font-weight: 900; }
.week-legend { margin: .55rem 0 0; color: var(--muted); font-size: .78rem; }
.week-legend span { color: var(--teal); font-weight: 900; }
.collective-missions { margin-top: 2.7rem; }
.collective-missions .section-heading { margin-top: 0; }
.home-moment-grid { margin-top: 1.2rem; }
.collective-status { margin-top: .8rem; border-radius: 999px; padding: .3rem .6rem; color: var(--teal-dark); background: rgb(255 255 255 / 72%); font-size: .76rem; font-weight: 900; }

.duo-invite {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.2rem;
  margin-top: 1.4rem;
  border: 2px solid #d7d0f3;
  border-radius: 23px;
  padding: 1rem 1.2rem;
  background: linear-gradient(100deg, white, var(--lavender-soft));
  box-shadow: 0 7px 20px rgb(73 59 134 / 8%);
}
.duo-invite h2, .duo-invite p { margin-bottom: .2rem; }
.duo-invite .eyebrow { margin-bottom: .2rem; color: var(--lavender); }
.duo-avatars { display: flex; }
.duo-avatars span { width: 54px; height: 54px; display: grid; place-items: center; border: 4px solid white; border-radius: 50%; background: var(--yellow-soft); font-size: 1.7rem; }
.duo-avatars span + span { margin-left: -13px; background: var(--lavender-soft); }
.duo-avatars.large { justify-content: center; margin-bottom: 1rem; }
.duo-avatars.large span { width: 68px; height: 68px; font-size: 2.1rem; }
.duo-launch { white-space: nowrap; }

.group-moment-shell { max-width: 980px; margin: 1rem auto; }
.group-moment-header { text-align: center; }
.group-moment-header > .secondary-button { display: block; margin: 0 0 1.5rem; }
.group-moment-header h1 { max-width: none; margin-bottom: .6rem; font-size: clamp(2.25rem, 6vw, 4.2rem); }
.group-moment-header > p:last-child { color: var(--muted); font-size: 1.05rem; }
.group-moment-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2rem; }
.group-moment-card {
  --moment-color: var(--teal);
  --moment-soft: var(--teal-soft);
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid transparent;
  border-radius: 27px;
  padding: 1.4rem;
  text-align: center;
  color: var(--ink);
  background: var(--moment-soft);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease;
}
.group-moment-card[data-color="sunny"] { --moment-color: #a86100; --moment-soft: var(--yellow-soft); }
.group-moment-card[data-color="coral"] { --moment-color: #a64431; --moment-soft: var(--coral-soft); }
.group-moment-card[data-color="lavender"] { --moment-color: #514591; --moment-soft: var(--lavender-soft); }
.group-moment-card:hover { transform: translateY(-5px); border-color: var(--moment-color); }
.group-moment-card > span { font-size: 4.3rem; }
.group-moment-card strong { margin: .8rem 0 .35rem; font-size: 1.35rem; }
.group-moment-card small { min-height: 45px; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.group-moment-card em { margin-top: 1rem; color: var(--moment-color); font-size: .85rem; font-style: normal; font-weight: 900; }

.duo-shell { margin-top: 1rem; }
.duo-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; }
.duo-header h1 { margin-bottom: .35rem; font-size: clamp(2.2rem, 5vw, 4rem); }
.duo-header p:last-child { margin-bottom: 0; color: var(--muted); }
.duo-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; }
.duo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 1rem; align-items: stretch; }
.duo-lane {
  --lane-accent: var(--teal);
  --lane-dark: var(--teal-dark);
  --lane-soft: var(--teal-soft);
  min-height: 650px;
  overflow: hidden;
  border: 3px solid var(--lane-accent);
  border-radius: 30px;
  background: white;
  box-shadow: var(--shadow);
}
.duo-lane-2 { --lane-accent: var(--lavender); --lane-dark: #514591; --lane-soft: var(--lavender-soft); }
.duo-lane-3 { --lane-accent: var(--coral); --lane-dark: #9b402e; --lane-soft: var(--coral-soft); }
.duo-lane-4 { --lane-accent: #b66b00; --lane-dark: #855000; --lane-soft: var(--yellow-soft); }
.duo-child-header { display: flex; align-items: center; gap: .8rem; padding: 1.15rem 1.3rem; color: white; background: var(--lane-accent); }
.duo-avatar { width: 58px; height: 58px; flex: none; display: grid; place-items: center; border: 3px solid rgb(255 255 255 / 65%); border-radius: 19px; background: rgb(255 255 255 / 20%); font-size: 2rem; }
.duo-child-header span:not(.duo-avatar) { display: block; font-size: .8rem; font-weight: 800; opacity: .85; }
.duo-child-header h2 { margin: 0; color: white; font-size: clamp(1.45rem, 3vw, 2rem); }
.duo-picker { padding: clamp(1.1rem, 3vw, 1.6rem); }
.duo-picker > p { color: var(--muted); font-weight: 800; }
.duo-routines { display: grid; gap: .75rem; }
.duo-routine-button { min-height: 82px; display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: .7rem; border: 2px solid var(--line); border-radius: 18px; padding: .7rem .85rem; text-align: left; background: white; cursor: pointer; }
.duo-routine-button:hover { border-color: var(--lane-accent); transform: translateY(-2px); }
.duo-routine-button > span:nth-child(2) { min-width: 0; }
.duo-routine-button strong, .duo-routine-button small { display: block; }
.duo-routine-button strong { margin-bottom: .25rem; font-size: 1rem; }
.duo-routine-button small { color: var(--muted); }
.duo-routine-button > span:last-child { color: var(--lane-accent); font-size: 1.8rem; }
.duo-routine-emoji { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 15px; background: var(--lane-soft); font-size: 1.65rem; }
.duo-run { padding: 1rem; }
.duo-run-topline { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; font-size: .8rem; }
.duo-run-topline strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duo-run-topline > span { color: var(--muted); font-weight: 900; }
.duo-progress { height: 9px; overflow: hidden; margin: .7rem 0 1rem; border-radius: 99px; background: #e8efed; }
.duo-progress span { display: block; width: var(--duo-progress); height: 100%; border-radius: inherit; background: var(--lane-accent); transition: width .3s ease; }
.duo-current-step { min-height: 470px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 23px; padding: 1.25rem; text-align: center; background: var(--lane-soft); }
.duo-step-emoji { display: block; margin-bottom: .5rem; font-size: clamp(4.2rem, 9vw, 6.3rem); }
.duo-current-step > p { margin-bottom: .35rem; color: var(--lane-dark); font-size: .78rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.duo-current-step h3 { margin-bottom: .55rem; font-size: clamp(1.55rem, 3.2vw, 2.25rem); line-height: 1.05; }
.duo-current-step small { max-width: 390px; min-height: 48px; color: var(--muted); font-size: .95rem; line-height: 1.45; }
.duo-done-button { width: min(100%, 330px); min-height: 66px; margin-top: 1.2rem; border: 0; border-radius: 17px; padding: .75rem 1rem; color: white; background: var(--lane-accent); box-shadow: 0 6px 0 var(--lane-dark); cursor: pointer; font-size: 1.12rem; font-weight: 900; }
.duo-done-button:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--lane-dark); }
.duo-undo-button { min-height: 42px; margin-top: .8rem; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: .82rem; text-decoration: underline; }
.duo-finished, .duo-empty { min-height: 530px; display: grid; place-content: center; justify-items: center; padding: 1.5rem; text-align: center; background: var(--lane-soft); }
.duo-finished > span, .duo-empty > span { font-size: 5rem; }
.duo-finished h3, .duo-empty h3 { margin: .7rem 0 .3rem; font-size: 2rem; }
.duo-finished p, .duo-empty p { color: var(--muted); }

.section-heading { margin: 3rem 0 1.25rem; }
.section-heading h2 { margin-bottom: .35rem; font-size: clamp(1.65rem, 4vw, 2.35rem); letter-spacing: -.035em; }
.section-heading p { margin-bottom: 0; color: var(--muted); }

.routine-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

.routine-card {
  --card-color: var(--teal);
  --card-soft: var(--teal-soft);
  position: relative;
  min-height: 290px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  text-align: left;
  background: var(--paper);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease;
}

.routine-card[data-color="sunny"] { --card-color: #b66b00; --card-soft: var(--yellow-soft); }
.routine-card[data-color="coral"] { --card-color: #a64431; --card-soft: var(--coral-soft); }
.routine-card[data-color="lavender"] { --card-color: #514591; --card-soft: var(--lavender-soft); }
.routine-card:hover { transform: translateY(-5px); border-color: var(--card-color); }
.routine-card.suggested::after {
  content: "Bonne mission pour maintenant";
  position: absolute;
  right: 1rem;
  top: 1rem;
  max-width: 120px;
  color: var(--card-color);
  font-size: .75rem;
  font-weight: 900;
  text-align: right;
}

.routine-emoji {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin-bottom: 1.2rem;
  border-radius: 24px;
  background: var(--card-soft);
  font-size: 2.4rem;
}

.routine-card h3 { max-width: 75%; margin-bottom: .45rem; font-size: 1.45rem; letter-spacing: -.025em; }
.routine-card p { min-height: 48px; margin-bottom: 1rem; color: var(--muted); line-height: 1.45; }
.routine-status { margin-top: auto; }
.routine-status-row { display: flex; justify-content: space-between; margin-bottom: .55rem; color: var(--muted); font-size: .9rem; font-weight: 800; }
.routine-status-row strong { color: var(--card-color); }

.progress-track { height: 12px; overflow: hidden; border-radius: 99px; background: #e8efed; }
.progress-fill { width: var(--progress); height: 100%; border-radius: inherit; background: var(--card-color); transition: width .35s ease; }
.complete-badge { color: var(--teal-dark); }

.run-shell { max-width: 880px; margin: 1rem auto; }
.run-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.back-button { display: inline-flex; align-items: center; gap: .5rem; }
.run-points { color: var(--muted); font-weight: 900; }
.run-heading { text-align: center; margin: 1.5rem 0; }
.run-heading .routine-emoji { margin: 0 auto .8rem; }
.run-heading h1 { margin-bottom: .35rem; font-size: clamp(2rem, 6vw, 3.3rem); }
.run-heading p { color: var(--muted); }

.step-dots { display: flex; justify-content: center; gap: .5rem; margin: 1.2rem 0 1.8rem; }
.step-dot { width: clamp(22px, 7vw, 54px); height: 9px; border-radius: 99px; background: #dce8e5; }
.step-dot.done { background: var(--teal); }
.step-dot.current { background: var(--yellow); }

.current-step-card {
  position: relative;
  overflow: hidden;
  border-radius: 34px;
  padding: clamp(1.5rem, 5vw, 3rem);
  background: white;
  box-shadow: var(--shadow);
  text-align: center;
}

.step-number { color: var(--muted); font-size: .9rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.current-step-emoji { display: block; margin: .65rem 0; font-size: clamp(4.5rem, 13vw, 7rem); filter: drop-shadow(0 7px 0 rgb(23 59 58 / 8%)); }
.current-step-card h2 { margin-bottom: .7rem; font-size: clamp(1.7rem, 5vw, 2.7rem); letter-spacing: -.04em; }
.current-step-card > p { max-width: 560px; margin: 0 auto 1.6rem; color: var(--muted); font-size: 1.1rem; line-height: 1.55; }
.done-button { width: min(100%, 410px); min-height: 70px; font-size: 1.25rem; }

.completed-list { margin-top: 1.4rem; }
.completed-list h3 { color: var(--muted); font-size: .95rem; }
.completed-chips { display: flex; flex-wrap: wrap; gap: .55rem; }
.completed-chip { border: 1px solid #bcded5; border-radius: 999px; padding: .55rem .8rem; background: var(--teal-soft); cursor: pointer; font-weight: 800; }
.completed-chip:hover { background: white; }

.celebration-card {
  position: relative;
  overflow: hidden;
  border-radius: 34px;
  padding: clamp(2rem, 7vw, 4rem);
  background: linear-gradient(145deg, var(--yellow-soft), white 42%, var(--teal-soft));
  box-shadow: var(--shadow);
  text-align: center;
}
.celebration-emoji { display: block; font-size: clamp(5rem, 18vw, 9rem); animation: pop .55s ease both; }
.celebration-card h2 { margin: .5rem 0; font-size: clamp(2rem, 7vw, 3.7rem); }
.celebration-card p { color: var(--muted); font-size: 1.15rem; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 24px; border-radius: 4px; background: var(--yellow); animation: fall 2.3s linear infinite; }

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 1.2rem;
  max-width: calc(100% - 32px);
  transform: translate(-50%, 140%);
  border-radius: 15px;
  padding: .85rem 1.1rem;
  color: white;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 800;
  transition: transform .25s ease;
}
.toast.visible { transform: translate(-50%, 0); }

.parent-dialog {
  width: min(920px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  border: 0;
  border-radius: 25px;
  padding: 0;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 24px 80px rgb(0 0 0 / 25%);
}
.parent-dialog::backdrop { background: rgb(15 48 46 / 55%); backdrop-filter: blur(4px); }
.dialog-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.4rem; background: rgb(255 250 240 / 94%); border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; }
.dialog-close { width: 46px; height: 46px; border: 0; border-radius: 50%; background: white; cursor: pointer; font-size: 1.2rem; }
.dialog-body { padding: clamp(1rem, 4vw, 2rem); }
.pin-form { max-width: 430px; margin: 2rem auto; text-align: center; }
.pin-form .lock { display: block; font-size: 3.5rem; }
.pin-form label { display: block; margin-bottom: .6rem; font-weight: 900; }
.form-row { display: flex; gap: .7rem; align-items: end; }
.field { flex: 1; }
.field label { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .85rem; font-weight: 900; }
.field input, .field select {
  width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 13px; padding: .65rem .8rem; color: var(--ink); background: white;
}
.parent-section { margin-bottom: 2.2rem; }
.parent-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.parent-section-heading h3 { margin: 0; font-size: 1.35rem; }
.profile-admin { display: flex; flex-wrap: wrap; gap: .7rem; }
.profile-admin-card { display: flex; align-items: center; gap: .7rem; border: 1px solid var(--line); border-radius: 16px; padding: .8rem; background: white; }
.profile-admin-avatar { font-size: 1.8rem; }
.child-customizer { border-radius: 19px; padding: 1rem; background: var(--teal-soft); }
.parent-child-tabs { display: flex; flex-wrap: wrap; gap: .6rem; }
.parent-child-tab {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 2px solid transparent;
  border-radius: 15px;
  padding: .55rem .9rem;
  color: var(--teal-dark);
  background: white;
  cursor: pointer;
  font-weight: 900;
}
.parent-child-tab.active { border-color: var(--teal); color: white; background: var(--teal); }
.customizer-help { margin: .8rem 0 0; color: var(--muted); line-height: 1.45; }
.parent-routine { margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 20px; background: white; }
.parent-routine summary { padding: 1rem 1.2rem; cursor: pointer; font-weight: 900; font-size: 1.05rem; }
.parent-routine-content { padding: 0 1rem 1rem; }
.admin-step { display: grid; grid-template-columns: 50px 42px 1fr auto; align-items: center; gap: .7rem; padding: .75rem 0; border-top: 1px solid #edf2f0; transition: opacity .15s ease; }
.admin-step.disabled-step { opacity: .55; }
.admin-step-emoji { font-size: 1.55rem; text-align: center; }
.admin-step-copy strong, .admin-step-copy small { display: block; }
.admin-step-copy small { margin-top: .15rem; color: var(--muted); }
.admin-step-copy em { display: inline-block; margin-top: .35rem; border-radius: 999px; padding: .18rem .48rem; color: var(--teal-dark); background: var(--teal-soft); font-size: .72rem; font-style: normal; font-weight: 900; }
.task-toggle { position: relative; display: block; width: 48px; height: 29px; cursor: pointer; }
.task-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.task-toggle span { position: absolute; inset: 0; border-radius: 999px; background: #cbd8d5; transition: background .18s ease; }
.task-toggle span::after { content: ""; position: absolute; width: 23px; height: 23px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 2px 5px rgb(0 0 0 / 20%); transition: transform .18s ease; }
.task-toggle input:checked + span { background: var(--teal); }
.task-toggle input:checked + span::after { transform: translateX(19px); }
.task-toggle input:focus-visible + span { outline: 4px solid rgb(22 118 111 / 28%); outline-offset: 3px; }
.admin-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .3rem; }
.admin-actions button { width: 38px; height: 38px; border: 0; border-radius: 10px; color: var(--ink); background: #f0f5f3; cursor: pointer; font-size: 1rem; font-weight: 900; }
.admin-actions button:hover:not(:disabled) { color: var(--teal-dark); background: var(--teal-soft); }
.admin-actions button:focus-visible { outline: 3px solid rgb(22 118 111 / 28%); outline-offset: 2px; }
.admin-actions button:disabled { opacity: .3; cursor: not-allowed; }
.admin-actions .step-order-button { color: var(--teal-dark); background: var(--teal-soft); }
.add-step-form { display: grid; grid-template-columns: 70px 1fr 1.4fr auto; gap: .6rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.add-step-form input { min-width: 0; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; padding: .5rem .6rem; }
.parent-note { border-radius: 14px; padding: .9rem 1rem; color: var(--muted); background: var(--teal-soft); line-height: 1.45; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #dcefe8;
}
.login-stage {
  position: relative;
  width: min(1180px, 100%);
  min-height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  display: flex;
  align-items: center;
  border-radius: 36px;
  padding: clamp(1.2rem, 5vw, 4.5rem);
  background: var(--teal-soft);
  box-shadow: 0 28px 90px rgb(15 48 46 / 24%);
}
.login-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 58% center; }
.login-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgb(228 245 236 / 98%) 0 28%, rgb(228 245 236 / 78%) 42%, transparent 68%); }
.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  border: 1px solid rgb(255 255 255 / 80%);
  border-radius: 28px;
  padding: clamp(1.4rem, 4vw, 2.4rem);
  background: rgb(255 250 240 / 94%);
  box-shadow: 0 18px 55px rgb(18 66 62 / 22%);
  backdrop-filter: blur(12px);
}
.login-card, .login-card * { min-width: 0; }
.login-brand { display: flex; align-items: center; gap: .65rem; margin-bottom: 2rem; font-size: 1.35rem; }
.login-brand span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: var(--teal-dark); background: var(--yellow); box-shadow: 0 4px 0 #dba820; }
.login-brand strong { font-weight: 900; letter-spacing: -.035em; }
.login-card h1 { margin-bottom: .55rem; font-size: clamp(2.5rem, 6vw, 4rem); }
.login-intro { margin-bottom: 1.7rem; color: var(--muted); line-height: 1.5; }
.login-card form { display: grid; grid-template-columns: minmax(0, 1fr); }
.login-card form > label { display: block; margin: 1rem 0 .4rem; color: var(--ink); font-size: .9rem; font-weight: 900; }
.login-card input { width: 100%; min-height: 56px; border: 2px solid var(--line); border-radius: 15px; padding: .75rem .9rem; color: var(--ink); background: white; font-size: 1rem; }
.login-card input:focus { border-color: var(--teal); }
.password-field { display: grid; grid-template-columns: minmax(0, 1fr) 52px; gap: .5rem; }
.password-field button { width: 52px; height: 56px; border: 0; border-radius: 13px; background: var(--teal-soft); cursor: pointer; }
.login-error { min-height: 1.4em; margin: .7rem 0 .3rem; color: #9b402e; font-size: .85rem; font-weight: 900; }
.login-submit { width: 100%; min-height: 60px; border: 0; border-radius: 17px; padding: .8rem 1rem; color: white; background: var(--teal); box-shadow: 0 6px 0 var(--teal-dark); cursor: pointer; font-size: 1.02rem; font-weight: 900; }
.login-submit:hover { transform: translateY(-2px); }
.login-submit:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--teal-dark); }
.login-submit:disabled { opacity: .65; cursor: wait; transform: none; }
.login-help { margin: 1.2rem 0 0; color: var(--muted); font-size: .78rem; text-align: center; }

@keyframes breathe { 50% { transform: scale(1.18) rotate(8deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.45) rotate(-12deg); } 70% { transform: scale(1.08) rotate(3deg); } }
@keyframes fall { to { transform: translateY(650px) rotate(600deg); } }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding-bottom: 1rem; }
  .hero-image { min-height: 220px; }
  .hero-image img { mask-image: linear-gradient(to bottom, transparent 0, black 25%); }
  .routine-grid { grid-template-columns: 1fr; }
  .routine-card { min-height: 235px; }
  .routine-card h3 { max-width: 85%; }
  .duo-invite { grid-template-columns: auto 1fr; }
  .duo-invite .duo-launch { grid-column: 1 / -1; width: 100%; }
  .group-moment-grid { grid-template-columns: 1fr; }
  .group-moment-card { min-height: 210px; }
  .home-moment-grid .group-moment-card { min-height: 240px; }
  .add-step-form { grid-template-columns: 60px 1fr; }
  .add-step-form input:nth-of-type(3), .add-step-form button { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .duo-header { align-items: stretch; flex-direction: column; }
  .duo-header-actions { display: grid; grid-template-columns: 1fr; }
  .duo-header .secondary-button { width: 100%; }
  .duo-grid { grid-template-columns: 1fr; }
  .duo-lane { min-height: 0; }
  .duo-current-step, .duo-finished, .duo-empty { min-height: 430px; }
}

@media (max-width: 560px) {
  .site-header, #app { width: min(100% - 22px, 1180px); }
  .parent-label, .logout-label { display: none; }
  .parent-link, .logout-link { width: 48px; padding: 0; }
  .dashboard-topline { align-items: flex-start; flex-direction: column; }
  .child-switcher { width: 100%; align-items: flex-start; flex-direction: column; }
  .child-switcher-buttons { width: 100%; }
  .child-switch { flex: 1; justify-content: center; }
  .child-switcher.compact { align-items: stretch; }
  .child-switcher.compact .child-switcher-buttons { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .3rem; }
  .child-switcher.compact .child-switch { flex: 0 0 auto; }
  .profile-chip, .points-chip { font-size: .9rem; }
  .hero { min-height: auto; border-radius: 26px; }
  .hero-copy { padding: 2rem 1.4rem 1rem; }
  .hero-image { min-height: 180px; }
  .family-topline { align-items: flex-start; flex-direction: column; padding: .8rem; }
  .week-heading { align-items: flex-start; flex-direction: column; gap: .35rem; }
  .week-grid { margin-right: -.9rem; }
  .week-day { min-width: 130px; }
  .duo-invite { grid-template-columns: 1fr; text-align: center; }
  .duo-avatars { justify-content: center; }
  .routine-card { border-radius: 23px; }
  .run-topbar .back-label { display: none; }
  .current-step-card { border-radius: 25px; }
  .form-row { flex-direction: column; align-items: stretch; }
  .admin-step { grid-template-columns: 48px 34px 1fr; }
  .admin-actions { grid-column: 3; }
  .login-body { padding: 0; }
  .login-stage { min-height: 100vh; min-height: 100dvh; align-items: flex-end; border-radius: 0; padding: clamp(5rem, 18svh, 8rem) .75rem .75rem; }
  .login-background { object-position: 63% center; }
  .login-shade { background: linear-gradient(0deg, rgb(228 245 236 / 98%) 0 58%, rgb(228 245 236 / 32%) 82%, transparent); }
  .login-card { width: 100%; border-radius: 23px; padding: 1.15rem; }
  .login-brand { margin-bottom: .7rem; }
  .login-card h1 { margin-bottom: .35rem; font-size: clamp(2.15rem, 12vw, 2.5rem); line-height: 1; }
  .login-intro { margin-bottom: .45rem; font-size: .92rem; }
  .login-card form > label { margin-top: .65rem; }
  .login-card input, .password-field button { min-height: 52px; height: 52px; }
  .login-error { min-height: 1.15em; margin: .45rem 0 .2rem; }
  .login-submit { min-height: 54px; }
  .login-help { margin-top: .8rem; }
}

@media (max-width: 340px) {
  .login-stage { padding-inline: .5rem; padding-bottom: .5rem; }
  .login-card { padding: 1rem; }
  .login-brand span { width: 38px; height: 38px; }
  .login-brand { font-size: 1.2rem; }
  .login-card h1 { font-size: 2.05rem; }
  .login-intro { font-size: .86rem; }
  .password-field { grid-template-columns: minmax(0, 1fr) 48px; }
  .password-field button { width: 48px; }
  .login-submit { font-size: .92rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
