:root {
  color-scheme: light;
  --paper: #faf8f3;
  --ink: #2b2014;
  --ink-mid: #6b5a45;
  --ink-muted: #7d6e5c;
  --ink-faint: #7a6b59; /* darkened from Teacher Studio for contrast */
  --line: #e8e5db;
  --ink-ghost: #bfb3a2;
  --primary-line: #eeceac;
  --line-card: #eceadf;
  --line-input: #ddd9cd;
  --primary: #b4530a;
  --primary-deep: #94430a;
  --primary-soft: #fdf6ee;
  --teal: #12958a;
  --red: #c73a4a;
  --chip-bg: #f2f0e9;
  --radius-card: 16px;
  --radius-input: 11px;
  --shadow-primary: 0 10px 24px rgb(180 83 10 / 22%);
  --font-serif: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 'Spline Sans', system-ui, sans-serif;
}
h1, h2 { font-family: var(--font-serif); font-weight: 600; margin: 0; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Header, copied from Teacher Studio: logo tile, product name, then "Family" where Studio says "Teacher Studio". */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  height: 58px; padding: 0 26px; border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 86%); backdrop-filter: blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; text-decoration: none; }
.brand-mark {
  display: grid; width: 33px; height: 33px; place-items: center; border-radius: 11px; color: #fff;
  background: linear-gradient(135deg, #c2651a, #e09a3c); box-shadow: 0 8px 18px rgb(170 95 25 / 35%);
}
.brand-product { margin-left: 4px; padding-left: 14px; color: var(--ink-faint); font-size: 13px; font-weight: 500; border-left: 1px solid var(--line); }
.family-menu { display: flex; align-items: center; gap: 11px; }
.menu-chip { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.family-avatar {
  display: grid; width: 36px; height: 36px; place-items: center; flex: none; border-radius: 50%; color: #fff;
  font-size: 13px; font-weight: 700; background: linear-gradient(145deg, #c2651a, #e09a3c);
}
.menu-copy { display: grid; min-width: 0; max-width: 200px; }
.menu-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink); }
.menu-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-muted); font-size: 11px; }
.signout-btn {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--line-input); border-radius: 10px; background: #fff;
  color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer;
}
.signout-btn:hover { background: var(--primary-soft); }

/* Sign in / create account: the Studio split layout (story panel left, form card right), from the prototype's p-auth. */
.on-auth .topbar { display: none; }
.auth-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(340px, .95fr) minmax(420px, 1.05fr); }
.auth-story {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  padding: 46px clamp(32px, 6vw, 88px); color: #fff;
  background: radial-gradient(circle at 78% 12%, rgb(224 154 60 / 20%), transparent 42%), linear-gradient(150deg, #241811 0%, #382415 58%, #46301c 100%);
}
.auth-story::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(circle, rgb(255 255 255 / 22%) 1px, transparent 1.5px); background-size: 96px 96px; opacity: .5; }
.auth-story > * { position: relative; }
.brand-light { color: #fff; font-size: 16px; }
.brand-light .brand-product { color: #e5b98a; border-color: rgb(255 255 255 / 20%); }
.story-copy { max-width: 600px; margin: 60px 0; }
.story-copy .eyebrow { margin: 0 0 6px; color: #e5b98a; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.story-copy h1 { margin: 0; font-family: var(--font-serif); font-weight: 600; font-size: clamp(40px, 4.6vw, 68px); line-height: 1.03; letter-spacing: -.03em; }
.story-copy p:not(.eyebrow) { margin: 22px 0 0; max-width: 500px; color: #e8d5c0; font-size: 17px; line-height: 1.7; }
.story-proof { display: flex; flex-wrap: wrap; gap: 10px; }
.story-proof span { padding: 9px 14px; color: #eddfc9; font-size: 12px; font-weight: 500; border: 1px solid rgb(255 255 255 / 18%); border-radius: 999px; background: rgb(255 255 255 / 7%); }
/* One column up to 430px; 100vw here counted the scrollbar and pushed the page sideways on narrow screens. */
.auth-panel { display: grid; padding: 40px 20px; grid-template-columns: minmax(0, 430px); place-content: center; }
.auth-card { width: 100%; padding: 32px; border: 1px solid #e9e6dd; border-radius: 20px; background: #fff; box-shadow: 0 24px 70px rgb(60 42 20 / 9%); }
.auth-card h2 { margin: 0; font-size: 24px; line-height: 1.25; }
.auth-card .sub { margin: 4px 0 22px; color: var(--ink-muted); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 26px; border-radius: 12px; background: var(--chip-bg); }
.auth-tabs button { min-height: 44px; padding: 10px; color: var(--ink-muted); font-weight: 600; border: 0; border-radius: 9px; background: transparent; cursor: pointer; }
.auth-tabs button[aria-selected='true'] { color: var(--ink); background: #fff; box-shadow: 0 3px 12px rgb(60 42 20 / 10%); }
.auth-card .field { display: grid; gap: 6px; margin-bottom: 16px; }
.auth-card .field label { margin: 0; font-size: 13px; color: #4c3d2c; }
.auth-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgb(180 83 10 / 12%); }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 64px; }
.input-wrap .show { position: absolute; right: 2px; top: 50%; min-width: 44px; min-height: 44px; transform: translateY(-50%); border: 0; background: none; color: var(--ink-mid); font-size: 12px; font-weight: 600; cursor: pointer; }
.auth-card .check { margin: 4px 0 18px; min-height: 0; color: var(--ink-mid); font-size: 13px; }
.auth-card .check input { width: 18px; height: 18px; margin-top: 2px; }
.auth-card .error { margin: 0 0 12px; min-height: 0; }
.auth-card .error:empty { display: none; }
/* Sign-up shows every problem at once, one per line, and marks the fields. */
.form-error-line { display: block; }
.form-error-line + .form-error-line { margin-top: 4px; }
.auth-card input[aria-invalid='true'] { border-color: var(--red); }
.auth-card .check a { color: var(--primary); font-weight: 600; }
.invite-note { margin: -10px 0 18px; padding: 10px 12px; border-radius: var(--radius-input); background: var(--primary-soft); color: var(--ink); font-size: 14px; }
.auth-links { margin: 14px 0 0; text-align: center; }
.linkish { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.auth-note { max-width: 420px; margin: 18px auto 0; color: var(--ink-muted); font-size: 12px; text-align: center; }
.auth-note a { color: var(--primary); font-weight: 600; }
@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; min-height: 0; }
  .auth-story { padding: 22px 20px 26px; }
  .story-copy { margin: 24px 0 8px; }
  .story-copy h1 { font-size: 34px; }
  .story-copy p:not(.eyebrow) { font-size: 14.5px; margin-top: 10px; }
  .story-proof { display: none; }
  .auth-panel { padding: 20px 16px 40px; place-content: start center; }
  .auth-card { padding: 22px; }
}

.card {
  max-width: 440px; margin: 40px auto; padding: 28px 24px;
  background: #fff; border: 1px solid var(--line-card); border-radius: var(--radius-card);
}
@media (max-width: 820px) { .card { margin: 16px; } }
.card h1 { font-size: 28px; }
.card p.lead { color: var(--ink-mid); margin: 6px 0 20px; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--chip-bg); border-radius: var(--radius-input); margin-bottom: 20px; }
.tabs button {
  flex: 1; min-height: 44px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-mid); font-weight: 600; cursor: pointer;
}
.tabs button[aria-selected='true'] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 10%); }

label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
input[type='text'], input[type='email'], input[type='password'] {
  width: 100%; min-height: 44px; padding: 10px 12px; font-size: 16px; /* 16px stops iOS zoom */
  border: 1px solid var(--line-input); border-radius: var(--radius-input); background: #fff; color: var(--ink);
}
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 16px 0; min-height: 44px; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--primary); }
.primary {
  width: 100%; min-height: 48px; border: 0; border-radius: var(--radius-input);
  background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-primary);
}
.primary:hover { background: var(--primary-deep); }
.primary:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; color: var(--primary); font-weight: 600; cursor: pointer; min-height: 44px; }
.error { color: var(--red); font-size: 14px; min-height: 20px; margin: 10px 0 0; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Signed-in shell: a full-height children panel beside the page, like the Studio class list. */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 58px); }
.rail {
  position: sticky; top: 58px; display: flex; flex-direction: column; justify-content: space-between; gap: 22px;
  height: calc(100dvh - 58px); padding: 22px 16px 22px 22px; overflow-y: auto; align-self: start;
  border-right: 1px solid var(--line); background: var(--paper);
}
.rail-stack { display: grid; gap: 14px; align-content: start; }
.rail-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 4px; }
.rail-title {
  margin: 0; font-family: 'Spline Sans', system-ui, sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint);
}
.rail-count { color: var(--ink-ghost); font-size: 11px; font-weight: 600; }
.rail .children { margin: 0; }
.rail-note { display: flex; gap: 10px; padding: 14px; border: 1px solid #d7ece4; border-radius: 13px; background: #f2faf7; }
.rail-note .icon { width: 18px; height: 18px; color: #0f8378; margin-top: 1px; }
.rail-note strong { font-size: 12px; }
.rail-note p { margin: 5px 0 0; color: var(--ink-muted); font-size: 11px; line-height: 1.5; }
.content { min-width: 0; padding: 36px clamp(24px, 4vw, 56px) 70px; }
.eyebrow { margin: 0 0 10px; color: var(--primary); font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.page-heading { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.setup { max-width: 640px; }
.setup h1 { font-size: 28px; }
.step-title { font-size: 22px; margin: 4px 0 16px; color: var(--ink-mid); }
.add-child {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px;
  padding: 0 14px; border: 1px solid var(--line-input); border-radius: var(--radius-input);
  background: #fff; color: var(--primary); font-weight: 600; cursor: pointer;
}
.add-child:hover { background: var(--primary-soft); }
/* the Studio "New class" look: a dashed outline */
.rail .add-child { min-height: 46px; border: 1px dashed #d4d0c2; border-radius: 13px; background: transparent; color: var(--ink-mid); font-size: 13px; }
.rail .add-child:hover { border-color: #e0b285; color: var(--primary); background: var(--primary-soft); }
@media (max-width: 820px) {
  .shell { display: block; min-height: 0; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .rail { display: none; }
}

.guard {
  display: flex; gap: 10px; align-items: center; margin: 0 0 16px; padding: 12px 14px;
  background: #eef7f5; border: 1px solid #d6ece8; border-radius: 12px;
  color: var(--ink-soft); font-weight: 500;
}
.guard .icon { color: var(--teal); flex: none; }
.paths { display: grid; gap: 12px; }
.path { position: relative; display: block; margin: 0; font-weight: 400; font-size: 16px; cursor: pointer; }
.path input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.path-body {
  display: block; padding: 16px; min-height: 44px; background: #fff;
  border: 2px solid var(--line-input); border-radius: var(--radius-card);
}
.path:hover .path-body { border-color: var(--ink-faint); }
.path input:checked + .path-body { border-color: var(--primary); background: var(--primary-soft); }
.path input:focus-visible + .path-body { outline: 3px solid var(--primary); outline-offset: 2px; }
.path-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.path-head .icon { color: var(--primary); }
.path-name { font-weight: 700; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--chip-bg); color: var(--ink-mid); border: 1px solid var(--line-input); }
.path-text { display: block; margin-top: 6px; color: var(--ink-mid); font-size: 16px; }
/* selected state is not colour alone: filled check mark + thicker border */
.path input:checked + .path-body .path-name::after { content: '\2713  Selected'; margin-left: 8px; font-weight: 600; font-size: 14px; color: var(--primary-deep); }
.setup .error { margin-bottom: 12px; }
.setup .primary { max-width: 100%; }
.secondary {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  background: #fff; border: 1px solid var(--line-input); border-radius: var(--radius-input);
  color: var(--ink); font-weight: 600; cursor: pointer;
}
#connect, #connected { max-width: 640px; }
.step-count { margin: 0 0 4px; color: var(--ink-mid); font-size: 14px; font-weight: 600; }
.hint { margin: 4px 0 0; color: var(--ink-mid); }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.actions .primary { flex: 1; }
.success {
  display: flex; gap: 12px; align-items: flex-start; margin: 8px 0 20px; padding: 16px;
  background: var(--primary-soft); border: 1px solid var(--line-card); border-radius: var(--radius-input);
}
.success .icon { color: var(--primary); flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Add your child: two path cards (prototype P2) */
.setup { max-width: 760px; }
.setup > .eyebrow { margin-bottom: 4px; }
.add-title { margin: 0; font-family: var(--font-serif); font-size: clamp(26px, 3.2vw, 34px); font-weight: 600; letter-spacing: -.02em; }
.setup:has(#add-title[hidden]) > .eyebrow { display: none; }
.tight { margin: 6px 0 14px; color: var(--ink-mid); }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.choice {
  position: relative; display: flex; flex-direction: column; padding: 22px; background: #fff;
  border: 1px solid var(--line-card); border-radius: 20px;
}
.choice.school { border-top: 5px solid var(--teal); }
.choice.home { border-top: 5px solid var(--primary); }
.choice:hover { box-shadow: 0 10px 28px rgb(60 42 20 / 8%); }
.choice:focus-within { outline: 3px solid var(--primary); outline-offset: 3px; }
.choice .ico { display: grid; width: 46px; height: 46px; place-items: center; margin-bottom: 12px; border-radius: 14px; }
.choice .ico .icon { width: 24px; height: 24px; }
.choice.school .ico { background: #e3f4f1; color: var(--teal); }
.choice.home .ico { background: var(--primary-soft); color: var(--primary); }
.choice .tag { align-self: flex-start; margin-bottom: 10px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; }
.choice.school .tag { background: #e3f4f1; color: #0d6f66; }
.choice.home .tag { background: var(--primary-pill-bg, #f8e8d6); color: var(--primary-pill-ink, #8a4a12); }
.choice h2 { margin: 0 0 4px; font-family: var(--font-serif); font-size: 22px; font-weight: 600; line-height: 1.2; }
.choice .who { margin: 0 0 14px; color: var(--ink-muted); font-size: 13.5px; }
.choice ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.choice ul + ul { margin-top: 8px; }
.choice li { display: flex; gap: 8px; }
.choice li::before { flex: none; width: 18px; font-weight: 700; }
.choice ul.yes li::before { content: "\2713"; color: var(--teal); }
.choice ul.no li::before { content: "\2715"; color: var(--ink-ghost); }
.choice .need { margin: 14px 0 16px; color: var(--ink-muted); font-size: 12.5px; }
.choice .choose-btn { margin-top: auto; width: 100%; }
.choice.school .choose-btn { background: var(--teal); box-shadow: 0 10px 24px rgb(18 149 138 / 22%); }
/* the whole card is the click target; the button inside stays the real, focusable control */
.choice .choose-btn::after { content: ''; position: absolute; inset: 0; border-radius: 20px; }
.choice .choose-btn:focus-visible { outline: 0; }

/* Steps: numbered stepper (prototype A1/A2, B1-B3) */
.stepper { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 12.5px; color: var(--ink-muted); }
.stepper .s { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.stepper .s b { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: var(--chip-bg); color: var(--ink-mid); font-size: 11px; }
.stepper .s.current { color: var(--ink); font-weight: 600; }
.stepper .s.current b { background: var(--primary); color: #fff; }
.stepper .s.done b { background: var(--teal); color: #fff; }
.stepper .bar { flex: 0 1 60px; height: 1px; background: var(--line-input); }
.stepper .of { margin-left: auto; white-space: nowrap; }
.setup .wiz { max-width: 640px; padding: 22px 24px; background: #fff; border: 1px solid var(--line-card); border-radius: var(--radius-card); }
.setup .wiz .step-title { margin: 0 0 4px; color: var(--ink); font-family: var(--font-serif); font-size: 24px; font-weight: 600; }
.setup .wiz fieldset.mail { margin: 16px 0 20px; padding: 0; border: 0; background: none; }
.setup .wiz .eyebrow { margin-bottom: 4px; }
.setup .step-title { color: var(--ink); }
/* "Tara Iyer is connected" */
.found { display: flex; gap: 14px; align-items: center; max-width: 640px; padding: 16px; margin: 4px 0 14px; border: 1px solid #cfe8e3; border-radius: 14px; background: #f1faf8; }
.found-avatar { flex: none; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 700; background: linear-gradient(145deg, #0f7f76, #2bb3a6); }
.found-copy { display: grid; gap: 2px; }
.found-copy strong { font-family: var(--font-serif); font-size: 19px; font-weight: 600; }
.found-copy > span { color: var(--ink-mid); font-size: 13px; }
.found .ok { margin-left: auto; color: #0d6f66; font-weight: 700; }
@media (max-width: 720px) {
  .choices { gap: 12px; margin-top: 14px; }
  .choice { padding: 16px; }
  .choice .ico { display: none; }
  .choice .need { margin: 10px 0 12px; }
  .choice ul { gap: 6px; }
  .stepper { gap: 8px; font-size: 12px; }
  .stepper .bar { flex-basis: 18px; }
  .setup .wiz { padding: 18px 16px; }
  .setup .wiz .actions { background: #fff; }
}
@media (max-width: 719px) { .choices { grid-template-columns: 1fr; } }
.children { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.children { gap: 8px; }
/* a child card, like a Studio class card */
.child-btn {
  display: grid; gap: 7px; width: 100%; min-height: 44px; padding: 13px 14px; background: #fff;
  border: 1px solid var(--line-card); border-radius: 13px; color: var(--ink); text-align: left; cursor: pointer;
  transition: border-color 150ms ease;
}
.child-btn:hover { border-color: var(--primary-line); }
.child-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.child-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.grade-badge { flex: none; padding: 3px 8px; border-radius: 999px; background: var(--chip-bg); color: var(--ink-mid); font-size: 10.5px; font-weight: 700; }
.child-btn small { font-weight: 400; font-size: 12px; color: var(--ink-muted); }
.child-btn[aria-current='true'] { background: var(--primary-soft); border-color: var(--primary-line); box-shadow: 0 6px 18px rgb(180 83 10 / 8%); }
.report { max-width: 940px; }
.report h1 { font-size: clamp(30px, 3.4vw, 42px); letter-spacing: -0.025em; line-height: 1.15; }
.r-meta { display: flex; gap: 10px; align-items: center; margin: 8px 0 22px; color: var(--ink-muted); font-size: 14px; }
.r-meta:empty, .r-meta span:empty { display: none; }
.weekpicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px; font-weight: 600; }
.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line-input); border-radius: var(--radius-input); color: var(--ink); cursor: pointer;
}
.icon-btn:disabled { opacity: .4; cursor: default; }
.dots { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 0 0 20px; padding: 0; }
.dots li { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-mid); }
.dots li span {
  display: flex; align-items: center; justify-content: center; height: 44px; margin-bottom: 4px;
  border: 2px solid var(--line-input); border-radius: 999px; background: #fff;
}
.dots li.played span { background: var(--primary); border-color: var(--primary); color: #fff; }
.dots li.today { color: var(--ink); }
.dots li.today span { border-color: var(--ink); border-width: 2px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 0 0 24px; }
.stats div { padding: 16px 18px; background: #fff; border: 1px solid var(--line-card); border-radius: var(--radius-card); }
.stats dt { color: var(--ink-faint); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.stats dd { margin: 6px 0 0; font-family: var(--font-serif); font-size: 30px; font-weight: 600; line-height: 1; }
@media (max-width: 820px) {
  .rail .children { display: none; }
  .stats dd { font-size: 22px; }
}
#r-skills { margin-top: 28px; }
.topic { background: #fff; border: 1px solid var(--line-card); border-radius: var(--radius-card); margin-top: 10px; }
.topic summary { min-height: 44px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; cursor: pointer; }
.topic summary small { font-weight: 400; font-size: 12px; color: var(--ink-mid); }
.topic ul { list-style: none; margin: 0; padding: 0 16px 12px; }
.topic li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-card); }
.state { flex: none; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line-input); background: var(--chip-bg); }
.state.mastered { background: #e3f4f2; border-color: var(--teal); color: #0b625a; }
.state.needs-help { background: #fbe9eb; border-color: var(--red); color: #8f2531; }
fieldset.mail { border: 1px solid var(--line-card); border-radius: var(--radius-input); margin: 0 0 20px; padding: 8px 16px 16px; background: #fff; }
fieldset.mail legend { padding: 0 6px; font-weight: 600; font-size: 14px; color: var(--ink-mid); }
.check.disabled { color: var(--ink-faint); }
select { width: 100%; min-height: 44px; padding: 10px 12px; font-size: 16px; border: 1px solid var(--line-input); border-radius: var(--radius-input); background: #fff; color: var(--ink); }
#r-settings { margin-top: 28px; }
.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 20px;
  background: var(--primary-soft); border-bottom: 1px solid var(--line-card); font-size: 14px;
}
.banner #banner-text { flex: 1 1 260px; }
.secondary.danger { color: var(--red); border-color: var(--red); margin-top: 16px; }
.primary.danger-fill { background: var(--red); box-shadow: none; }
.primary.danger-fill:hover { background: #a82e3c; }
dialog { max-width: 440px; width: calc(100% - 32px); padding: 24px; border: 1px solid var(--line-card); border-radius: var(--radius-card); color: var(--ink); }
dialog::backdrop { background: rgb(43 32 20 / 45%); }
dialog h2 { font-size: 22px; margin-bottom: 8px; }
.notice { color: var(--ink-mid); font-size: 14px; margin: 10px 0; }
.notice:empty { display: none; }
.optional { font-weight: 400; color: var(--ink-mid); }
fieldset.plain { border: 0; margin: 14px 0 0; padding: 0; }
fieldset.plain legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; margin: 0; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; background: #fff;
  border: 2px solid var(--line-input); border-radius: 999px; font-weight: 600; color: var(--ink);
}
.chip input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.chip input:checked + span::before { content: '\2713\00a0'; color: var(--primary-deep); }
.chip input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.path.disabled { cursor: default; }
.path.disabled .path-body { background: var(--chip-bg); border-style: dashed; color: var(--ink-mid); }
.card-login { display: grid; gap: 8px; margin: 12px 0; padding: 16px; background: #fff; border: 2px dashed var(--primary); border-radius: var(--radius-card); }
.card-login div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-login dt { color: var(--ink-mid); font-weight: 600; font-size: 14px; }
.card-login dd { margin: 0; font-family: ui-monospace, Consolas, monospace; font-size: 20px; font-weight: 700; letter-spacing: 1px; }
#home-1, #home-2, #home-3 { max-width: 640px; }
/* the shared login card (same markup as Teacher Studio's), sized for one card on a page */
.family-card { margin: 12px 0; max-width: 480px; }
.login-card { min-width: 0; padding: 16px; border: 2px dashed var(--primary); border-radius: var(--radius-card); background: #fff; }
.login-card h2 { margin: 0 0 12px; overflow-wrap: anywhere; font-size: 18px; }
.login-card-credentials { display: flex; justify-content: space-between; gap: 12px; }
.login-card-credentials > div { display: grid; min-width: 0; align-content: start; gap: 4px; }
.login-card-credentials span, .login-card-address span { color: #806b57; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.login-card-credentials code { overflow-wrap: anywhere; font-size: 17px; font-weight: 700; }
.login-card-qr { width: 112px; height: 112px; flex: 0 0 auto; shape-rendering: crispEdges; }
.login-card-address { display: grid; margin: 12px 0; padding: 10px 0; gap: 3px; border-top: 1px dashed #e5d7c8; border-bottom: 1px dashed #e5d7c8; }
.login-card-address code { overflow-wrap: anywhere; font-size: 14px; }
.login-card-address small { color: #806b57; font-size: 13px; }
.login-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 420px) { .login-card-qr { width: 88px; height: 88px; } }
/* underline tabs, like the Studio class page (the phone bottom bar below overrides this) */
.tabs.owner-tabs { max-width: none; gap: 4px; margin: 0 0 22px; padding: 4px; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.owner-tabs button { flex: none; min-height: 42px; padding: 0 16px; border-radius: 0; border-bottom: 3px solid transparent; color: var(--ink-muted); }
.owner-tabs button:hover { color: var(--primary); }
.owner-tabs button[aria-selected='true'] { background: transparent; box-shadow: none; color: var(--primary); border-bottom-color: var(--primary); }
/* an owner sees one pane at a time: hide every pane that is not the selected tab's */
#report[data-owner="1"][data-tab="progress"] [data-pane]:not([data-pane="progress"]),
#report[data-owner="1"][data-tab="topics"] [data-pane]:not([data-pane="topics"]),
#report[data-owner="1"][data-tab="goals"] [data-pane]:not([data-pane="goals"]),
#report[data-owner="1"][data-tab="settings"] [data-pane]:not([data-pane="settings"]) { display: none; }
.goal-progress { margin: 12px 0 4px; font-weight: 600; }
.topics-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.topics-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: #fff; border: 1px solid var(--line-card); border-radius: var(--radius-input); }
.topics-list .what { font-weight: 600; }
.topics-list .what small { display: block; font-weight: 400; color: var(--ink-mid); font-size: 12px; }
.state.done { background: #e3f4f2; border-color: var(--teal); color: #0b625a; }
.state.in-progress { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-deep); }
#owner-settings { margin-top: 12px; }
#owner-settings .card-login { margin: 12px 0; }
#account .step-title { margin-top: 24px; }
.danger-zone { margin: 28px 0 8px; padding: 12px 16px; border: 1px solid var(--line-card); border-radius: var(--radius-input); }
.danger-zone summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--red); cursor: pointer; }
/* ---- phone patterns (spec section 6): one media query ---- */
.avatar, .switch { display: none; }
.avatar {
  width: 44px; height: 44px; align-items: center; justify-content: center; border: 0; border-radius: 999px;
  background: linear-gradient(145deg, #c2651a, #e09a3c); color: #fff; font-weight: 700; cursor: pointer;
}
.switch {
  align-items: center; gap: 8px; min-height: 44px; margin-bottom: 12px; padding: 0 14px;
  background: #fff; border: 1px solid var(--line-input); border-radius: var(--radius-input);
  color: var(--ink); font-weight: 700; cursor: pointer;
}
.owner-tabs svg { display: none; }
.stepbar { height: 6px; margin: 6px 0 12px; border-radius: 999px; background: var(--chip-bg); overflow: hidden; }
.stepbar span { display: block; height: 100%; width: var(--p); background: var(--primary); border-radius: 999px; }
.skills-card { background: #fff; border: 1px solid var(--line-card); border-radius: var(--radius-card); margin-top: 10px; }
.skills-card > summary { min-height: 44px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; cursor: pointer; }
.skills-card > summary::after { content: '\203A'; font-size: 22px; color: var(--ink-mid); transition: transform .15s; }
.skills-card[open] > summary::after { transform: rotate(90deg); }
.skills-card > #skills-list { padding: 0 12px 12px; }
.skills-card .topic:first-child { margin-top: 0; }
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; max-height: 85vh; overflow: auto;
  border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet h2 { margin-bottom: 8px; }
.sheet .children { margin: 0 0 12px; }
.sheet .add-child { margin-bottom: 8px; }
.sheet-item {
  display: block; width: 100%; min-height: 48px; margin-bottom: 4px; padding: 0 12px; background: transparent;
  border: 0; border-radius: var(--radius-input); color: var(--ink); font-size: 16px; font-weight: 600; text-align: left; cursor: pointer;
}
.sheet-item:hover { background: var(--primary-soft); }
.sheet .link { display: block; margin: 4px auto 0; }
@media (max-width: 820px) {
  #account-open, #signout { display: none !important; }
  .tabs.owner-tabs { border-bottom: 0; }
  .owner-tabs button { border-bottom: 0; border-radius: var(--radius-input); }
  .avatar:not([hidden]) { display: flex; }
  .switch { display: inline-flex; }
  .content { padding-bottom: 88px; }
  /* owner tabs become a fixed bottom bar, clear of the home indicator */
  .owner-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-width: none; margin: 0; gap: 0; border-radius: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line-card);
  }
  .owner-tabs[hidden] { display: none; }
  .owner-tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; font-size: 12px; }
  .owner-tabs button[aria-selected='true'] { background: var(--primary-soft); color: var(--primary-deep); box-shadow: none; border-bottom: 0; }
  .owner-tabs svg { display: block; }
  /* the primary action of a setup step sticks to the bottom of the screen */
  .setup .actions { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--paper); }
  /* The last step's weekly goal and email choices sit above Finish; a pinned Finish let parents skip past them unseen. */
  #home-3 .actions { position: static; }
}
.people { list-style: none; margin: 8px 0 16px; padding: 0; display: grid; gap: 8px; }
.people li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: #fff; border: 1px solid var(--line-card); border-radius: var(--radius-input); }
.people .who { overflow-wrap: anywhere; }
.people .who small { display: block; color: var(--ink-mid); font-size: 12px; }
.people button { min-height: 44px; }
#invite-form { margin-top: 8px; }
.teacher-note { margin-top: 20px; padding: 14px 16px; background: var(--primary-soft); border: 1px solid var(--line-card); border-radius: var(--radius-input); }
.teacher-note .step-title { margin: 0 0 4px; font-size: 18px; }
.teacher-note p { margin: 0; }
#r-plan { margin-top: 20px; }
.state.late { background: #fbe9eb; border-color: var(--red); color: #8f2531; }
.state.not-yet { background: var(--chip-bg); }
[hidden] { display: none !important; }

/* Goals: what is not built yet. */
.soon-title { margin: 24px 0 8px; font-size: 16px; }
.soon-list { margin: 0; padding-left: 20px; color: var(--muted, #6b5a45); }
#r-tips { margin-top: 20px; }

/* Settings spacing: a heading and a button no longer touch the text above them. */
#owner-settings .step-title { margin-top: 30px; }
#owner-settings .step-title:first-child { margin-top: 4px; }
#owner-settings .secondary, #owner-settings .hint + .secondary { margin-top: 12px; }
