:root {
  --ink: #14231f;
  --muted: #65736d;
  --paper: #f5f3ed;
  --card: rgba(255, 255, 252, 0.9);
  --line: rgba(20, 35, 31, 0.11);
  --forest: #174f3f;
  --forest-dark: #0f392d;
  --mint: #cce3d8;
  --amber: #e28b42;
  --amber-soft: #fff0df;
  --blue: #789eb2;
  --shadow: 0 24px 70px rgba(35, 50, 44, 0.11);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(255,255,255,.7), transparent 48%),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  opacity: .46;
  pointer-events: none;
}

.ambient-one {
  width: 34rem;
  height: 34rem;
  right: -14rem;
  top: -17rem;
  background: radial-gradient(circle, #c5ded0 0, transparent 68%);
}

.ambient-two {
  width: 26rem;
  height: 26rem;
  left: -12rem;
  bottom: -13rem;
  background: radial-gradient(circle, #f3c797 0, transparent 68%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-card {
  width: min(100%, 29rem);
  padding: 3.25rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 4rem;
  height: 3.3rem;
  display: flex;
  align-items: end;
  gap: .35rem;
  margin-bottom: 2.25rem;
}

.brand-mark span {
  display: block;
  flex: 1;
  border-radius: 1rem 1rem .3rem .3rem;
  background: var(--forest);
}

.brand-mark span:nth-child(1) { height: 55%; opacity: .52; }
.brand-mark span:nth-child(2) { height: 100%; }
.brand-mark span:nth-child(3) { height: 75%; opacity: .76; }
.brand-mark.small { width: 1.7rem; height: 1.5rem; gap: .15rem; margin: 0; }

.eyebrow {
  margin: 0 0 .6rem;
  color: var(--forest);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

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

.login-card h1 {
  margin-bottom: .55rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 10vw, 4.2rem);
  font-weight: 500;
  letter-spacing: -.06em;
  line-height: .95;
}

.lead { color: var(--muted); font-size: 1.04rem; }

.login-form { display: grid; gap: 1rem; margin-top: 2rem; }
.login-form label { display: grid; gap: .42rem; }
.login-form label span { font-size: .79rem; font-weight: 750; }

.login-form input {
  width: 100%;
  padding: .88rem 1rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: .8rem;
  outline: 0;
  background: rgba(255,255,255,.82);
}

.login-form input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(23,79,63,.11);
}

.primary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 3rem;
  padding: .82rem 1.15rem;
  color: white;
  border: 0;
  border-radius: .8rem;
  background: var(--forest);
  box-shadow: 0 9px 20px rgba(23,79,63,.18);
  font-weight: 760;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}

.primary-button:hover { background: var(--forest-dark); transform: translateY(-1px); }
.primary-button.compact { width: 100%; margin-top: 1.3rem; }
.push-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .55rem;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
}
.notification-button,
.notification-test {
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  color: var(--forest);
  background: rgba(255,255,255,.7);
  font-size: .72rem;
  font-weight: 780;
  cursor: pointer;
}
.notification-button:disabled,
.notification-test:disabled { opacity: .55; cursor: wait; }
.push-controls > p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: .68rem;
}
.link-button { text-decoration: none; margin-top: 1rem; }
.privacy-note { margin: 1.2rem 0 0; color: var(--muted); font-size: .76rem; }

.topbar {
  max-width: 82rem;
  margin: 0 auto;
  padding: 1.3rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-identity {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--ink);
  font-weight: 820;
  letter-spacing: -.02em;
  text-decoration: none;
}
.top-tagline {
  margin: 0;
  padding-left: 1.25rem;
  border-left: 1px solid var(--line);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 2.25vw, 1.85rem);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .88;
  white-space: nowrap;
}
.top-tagline em { color: var(--forest); font-weight: 500; }

.top-actions { display: flex; align-items: center; gap: 1rem; }
.top-metrics {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.top-metric {
  display: inline-flex;
  align-items: baseline;
  gap: .28rem;
  padding: .38rem .65rem;
  border: 1px solid rgba(23,79,63,.15);
  border-radius: 999px;
  color: var(--forest);
  background: rgba(228,240,233,.72);
  font-size: .68rem;
  font-weight: 730;
  white-space: nowrap;
}
.top-metric strong { font-family: Georgia, serif; font-size: .96rem; line-height: 1; }
.top-metric.attention {
  color: #8c4a17;
  border-color: rgba(226,139,66,.22);
  background: rgba(255,240,223,.78);
}
.user-pill {
  padding: .4rem .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.55);
  font-size: .78rem;
  font-weight: 700;
}

.text-button {
  padding: .4rem;
  color: var(--muted);
  border: 0;
  background: none;
  cursor: pointer;
}

.dashboard-shell { max-width: 82rem; margin: 0 auto; padding: 2rem 2rem 5rem; }

.check-panel {
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 1.3rem;
  background: rgba(255,255,252,.72);
  box-shadow: 0 16px 40px rgba(35,50,44,.07);
}

.status-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: 1.3rem;
  font-size: .78rem;
  font-weight: 720;
}

.status-dot { width: .55rem; height: .55rem; border-radius: 50%; background: #b8aaa0; }
.status-dot.ready { background: #4eaa78; box-shadow: 0 0 0 5px rgba(78,170,120,.1); }
.check-panel > p { margin-bottom: .18rem; color: var(--muted); font-size: .76rem; }
.check-panel > strong { font-size: 1.15rem; }
.bottom-check-panel {
  width: min(100%, 24rem);
  margin: 1.4rem 0 0 auto;
}

.message-history {
  padding: 1.35rem;
  margin-bottom: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: var(--card);
  box-shadow: 0 12px 36px rgba(35,50,44,.065);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  padding: 0 .1rem 1rem;
}
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 1.55rem; font-weight: 500; }
.section-heading > span { color: var(--muted); font-size: .72rem; font-weight: 750; }
.history-list { display: grid; gap: .45rem; }
.history-item { border-radius: .85rem; background: #f6f6f1; overflow: hidden; }
.history-item.attention { background: var(--amber-soft); box-shadow: inset 3px 0 var(--amber); }
.history-item > summary {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) auto auto;
  gap: .85rem;
  align-items: center;
  padding: .85rem 1rem;
  list-style: none;
  cursor: pointer;
}
.history-item > summary::-webkit-details-marker { display: none; }
.history-item > summary:focus-visible { outline: 3px solid rgba(23,79,63,.2); outline-offset: -3px; }
.history-child { color: var(--forest); font-size: .74rem; font-weight: 820; }
.history-main { display: grid; min-width: 0; }
.history-main strong { overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.history-main small { color: var(--muted); font-size: .68rem; }
.history-item mark { padding: .12rem .38rem; color: #8c4a17; border-radius: 99px; background: #ffd8b1; font-size: .66rem; }
.history-chevron { color: var(--forest); font-size: 1.1rem; transition: transform .18s ease; }
.history-item[open] .history-chevron { transform: rotate(180deg); }
.history-body {
  padding: 1rem;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.48);
}
.history-body > p { margin: 0; color: var(--ink); font-size: .78rem; line-height: 1.65; white-space: pre-line; }
.history-empty { padding: 1.2rem; border-radius: .85rem; color: var(--muted); background: #f6f6f1; font-size: .8rem; }

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

.child-card {
  min-width: 0;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: var(--card);
  box-shadow: 0 12px 36px rgba(35,50,44,.065);
}

.child-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .8rem;
  align-items: center;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}

.child-avatar {
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border-radius: .85rem;
  color: var(--forest-dark);
  background: var(--mint);
  font-family: Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
}

.child-avatar.tone-2 { color: #365a6b; background: #d9e7ec; }
.child-avatar.tone-3 { color: #84512b; background: #f4dcc6; }
.child-header h2 { margin: 0; font-size: 1.05rem; }
.child-header p { margin: .08rem 0 0; color: var(--muted); font-size: .75rem; }
.count-badge { color: var(--muted); font-size: .7rem; font-weight: 750; }

.empty-state { min-height: 10rem; display: flex; align-items: center; gap: 1rem; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: .9rem; }
.empty-state p { margin: .15rem 0 0; font-size: .78rem; }
.checkmark {
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--forest);
  background: #e4f0e9;
  font-weight: 850;
}

.feed { display: grid; gap: .8rem; margin-top: 1rem; }
.feed-item { padding: 1rem; border-radius: .9rem; background: #f6f6f1; }
.feed-item.attention { background: var(--amber-soft); box-shadow: inset 3px 0 var(--amber); }
.feed-meta { display: flex; justify-content: space-between; gap: .5rem; color: var(--muted); font-size: .68rem; font-weight: 730; }
.feed-meta mark { padding: .12rem .38rem; color: #8c4a17; border-radius: 99px; background: #ffd8b1; }
.feed-item h3 { margin: .65rem 0 .15rem; font-size: .93rem; line-height: 1.3; }
.feed-item p { margin-bottom: 0; color: var(--muted); font-size: .76rem; }
.feed-item .sender { color: var(--ink); font-weight: 650; }
.attachments { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.attachments a { color: var(--forest); font-size: .7rem; font-weight: 750; }

.news-item { padding: 0; }
.news-item > summary {
  display: block;
  padding: 1rem;
  list-style: none;
  cursor: pointer;
}
.news-item > summary::-webkit-details-marker { display: none; }
.news-item > summary:focus-visible {
  outline: 3px solid rgba(23,79,63,.2);
  outline-offset: 2px;
  border-radius: .9rem;
}
.read-more {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .8rem;
  color: var(--forest);
  font-size: .7rem;
  font-weight: 800;
}
.read-more-open { display: none; }
.news-item[open] .read-more-closed { display: none; }
.news-item[open] .read-more-open { display: inline; }
.chevron {
  display: inline-block;
  font-size: 1rem;
  line-height: .6;
  transition: transform .18s ease;
}
.news-item[open] .chevron { transform: rotate(180deg); }
.full-news-text {
  padding: 1rem;
  border-top: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255,255,255,.48);
  font-size: .78rem;
  line-height: 1.65;
  white-space: pre-line;
}
.news-attachments { padding: 0 1rem 1rem; }

.first-run {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: center;
  padding: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: var(--card);
}

.first-run-icon { color: var(--mint); font-family: Georgia, serif; font-size: 5rem; line-height: 1; }
.first-run h2 { margin: 0 0 .5rem; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.first-run p:last-child { max-width: 40rem; margin-bottom: 0; color: var(--muted); }

.flash {
  padding: .85rem 1rem;
  margin: 0 0 1rem;
  border: 1px solid;
  border-radius: .8rem;
  font-size: .82rem;
}

.flash-success { color: #1f6348; border-color: #bcdcca; background: #e8f3ed; }
.flash-error { color: #8a3f2c; border-color: #ebc6b8; background: #fff0ea; }
.flash-info { color: #355d71; border-color: #c7dbe5; background: #edf5f8; }

@media (max-width: 900px) {
  .children-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar, .dashboard-shell { padding-left: 1rem; padding-right: 1rem; }
  .topbar { padding-top: 1rem; }
  .top-identity { gap: .65rem; }
  .top-tagline { padding-left: .65rem; font-size: 1.03rem; }
  .user-pill { display: none; }
  .top-actions { gap: .45rem; }
  .top-metric { padding: .34rem .5rem; }
  .top-metric span { display: none; }
  .dashboard-shell { padding-top: .5rem; }
  .login-shell { padding: 1rem; }
  .login-card { padding: 2rem 1.4rem; border-radius: 1.4rem; }
  .history-item > summary { grid-template-columns: 4rem minmax(0, 1fr) auto; gap: .55rem; }
  .history-item mark { display: none; }
  .first-run { grid-template-columns: 1fr; gap: 1rem; padding: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
