/* Homeschool — one stylesheet, no framework.
   Dark, high contrast, big touch targets. The child's screen is the one that
   matters most for tap size: a checkbox he misses is a checkbox he stops using. */

:root {
  --bg: #0f0e24;
  --card: #1b1a3a;
  --card-2: #232152;
  --line: #322f63;
  --text: #eceafd;
  --muted: #a09dc8;
  --accent: #6366f1;
  --accent-2: #4f46e5;
  --good: #22c55e;
  --bad: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.spacer { width: 40px; }

/* ---- login ---- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 340px; text-align: center; }
.login-card .logo {
  width: 64px; height: 64px; margin: 0 auto 16px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--accent), var(--accent-2));
  border-radius: 18px; font-size: 32px; color: #fff;
}
.login-card h1 { margin: 0 0 4px; font-size: 26px; }
.login-card form { margin-top: 20px; display: grid; gap: 10px; }
.error { color: var(--bad); font-size: 14px; min-height: 20px; }

/* ---- inputs ---- */

input, textarea, select {
  width: 100%; padding: 13px 14px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 11px;
  font-size: 16px; /* 16px stops iOS zooming the page on focus */
  font-family: inherit;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  padding: 13px 16px;
  background: linear-gradient(160deg, var(--accent), var(--accent-2));
  color: #fff; border: 0; border-radius: 11px;
  font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer;
}
button:disabled { opacity: .55; }
button.secondary { background: var(--card); border: 1px solid var(--line); color: var(--text); }
button.small { padding: 8px 12px; font-size: 14px; }
.icon-btn {
  background: none; border: 0; color: var(--muted);
  font-size: 22px; padding: 4px 10px; width: auto;
}

/* ---- bars ---- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 16px) 18px 14px;
  border-bottom: 1px solid var(--line);
}
.date-label { font-size: 20px; font-weight: 700; }
.sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- parent home tiles ---- */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: left; display: grid; gap: 4px;
  color: var(--text); font-weight: 400;
}
.tile-name { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tile-value { font-size: 24px; font-weight: 700; }
.tile-detail { font-size: 13px; color: var(--muted); }

/* ---- lists and items ---- */

.list { display: grid; gap: 10px; padding: 16px; }
.item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.item-body { flex: 1; min-width: 0; }
.item-title { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.item-detail { font-size: 14px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.item-meta { font-size: 12px; color: var(--muted); margin-top: 5px; }
.item.done .item-title { text-decoration: line-through; color: var(--muted); }
.item.preview { opacity: .6; }

/* The tick target. 46px square, which is above the 44px iOS minimum. */
.tickbox {
  flex: 0 0 auto; width: 46px; height: 46px; padding: 0;
  border-radius: 12px; font-size: 24px; line-height: 1;
  background: var(--card-2); border: 2px solid var(--line); color: #fff;
}
.item.done .tickbox { background: var(--good); border-color: var(--good); }

/* ---- progress ---- */

.progress-line {
  display: flex; justify-content: space-between;
  padding: 14px 16px 8px; font-size: 15px; font-weight: 600;
}
.bar { height: 8px; margin: 0 16px; background: var(--card); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }
.bar-fill.full { background: var(--good); }

/* ---- day navigation ---- */

.daynav { display: flex; gap: 10px; padding: 8px 16px 20px; }
.daynav button { flex: 1; background: var(--card); border: 1px solid var(--line); color: var(--text); }
.daynav.inline { padding: 12px 16px 4px; align-items: center; }
.daynav.inline button { flex: 0 0 44px; }
.daynav-label { flex: 1; text-align: center; font-weight: 600; font-size: 15px; }

/* ---- panels, collapsibles, chips ---- */

.panel { padding: 0 0 8px; }
.sec { margin: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sec-head {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: none; border: 0; padding: 15px 16px; color: var(--text); font-size: 16px; font-weight: 600;
}
.sec-chevron { transition: transform .2s; color: var(--muted); font-size: 20px; }
.sec.open .sec-chevron { transform: rotate(90deg); }
.sec-body { display: none; padding: 0 16px 16px; gap: 10px; grid-template-columns: 1fr; }
.sec.open .sec-body { display: grid; }

.picker { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 13px; font-size: 14px; font-weight: 600;
  background: var(--card-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 99px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.field { display: grid; gap: 6px; }
.field-label { font-size: 14px; color: var(--muted); }

.empty { color: var(--muted); text-align: center; padding: 26px 16px; font-size: 15px; }
.msg { min-height: 20px; font-size: 14px; padding: 0 16px; }
.msg.ok { color: var(--good); }
.msg.bad { color: var(--bad); }

/* ---- child screen ---- */

#child-app { min-height: 100vh; display: flex; flex-direction: column; }
#child-app .list { flex: 1; align-content: start; }
.child-bar { align-items: flex-start; }

/* ---- the child's note on an assignment ----
   Visually distinct from the assignment's own detail, because these are his
   words and it should be obvious at a glance which is which. */

.item-group { display: grid; gap: 0; }
/* The tappable words next to the tick box. A button for keyboard and
   screen-reader reasons, stripped back to look like plain text. */
.item-tap {
  flex: 1; min-width: 0; text-align: left;
  background: none; border: 0; padding: 0; color: inherit;
  font-size: inherit; font-weight: 400;
}
.child-note {
  margin-top: 8px; padding: 9px 11px;
  background: rgba(99, 102, 241, .14);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 14px; line-height: 1.45;
  white-space: pre-wrap;          /* keep the line breaks he typed */
  overflow-wrap: anywhere;
}
.child-note-who {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px;
}
.item-group .note-editor { margin-top: -2px; border-radius: 0 0 12px 12px; }

/* ---- notes ----
   Feature-specific classes live here rather than in a per-feature stylesheet,
   matching MyHealthApp. Presentation is shared; data models never are. */

.note-row {
  display: block; width: 100%; text-align: left;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px; color: var(--text); font-weight: 400;
}
.note-row .item-title { font-size: 16px; font-weight: 600; }
.note-editor {
  display: grid; gap: 10px;
  background: var(--card-2); border: 1px solid var(--accent);
  border-radius: 12px; padding: 14px;
}
.note-editor textarea { min-height: 180px; line-height: 1.5; }

/* ---- parent bottom nav ---- */

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .nav-item {
  flex: 1; background: none; border: 0; color: var(--muted);
  font-size: 11px; font-weight: 600; padding: 9px 0 7px;
  display: grid; justify-items: center; gap: 3px;
}
.bottom-nav .nav-item svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.bottom-nav .nav-item.active { color: var(--accent); }
#parent-app .tab { padding-bottom: 78px; }
