/* Family Intelligence Hub - one stylesheet, no build step, no CDN. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f0ed;
  --border: #e2e0dc;
  --text: #1c1b19;
  --muted: #6b6862;
  --accent: #7a5c3e;
  --accent-ink: #ffffff;
  --ok: #2f6b46;
  --warn: #8a6100;
  --error: #9b2c2c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --surface: #201f1c;
    --surface-2: #292824;
    --border: #35332e;
    --text: #ece9e3;
    --muted: #9c968c;
    --accent: #c9a97f;
    --accent-ink: #1c1b19;
    --ok: #6fbf8b;
    --warn: #d9a441;
    --error: #e08383;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .875em;
  background: var(--surface-2);
  padding: .1em .35em;
  border-radius: 4px;
}

/* ---------- layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: .85rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .72rem;
  font-weight: 700;
}

.topbar nav { display: flex; gap: 1rem; margin-left: auto; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); font-size: .93rem; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar .who { color: var(--muted); font-size: .9rem; margin-right: .5rem; }

main {
  max-width: 1020px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

footer {
  max-width: 1020px;
  margin: 0 auto;
  padding: 1.5rem;
  color: var(--muted);
  font-size: .85rem;
  border-top: 1px solid var(--border);
}
footer .sep { margin: 0 .5rem; opacity: .5; }

h1 { font-size: 1.6rem; letter-spacing: -.02em; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; letter-spacing: -.01em; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.err { color: var(--error); }
.warn { color: var(--warn); }
.empty { padding: 1.5rem 0; }

.narrow { max-width: 420px; margin: 0 auto; }
.hero { text-align: center; padding: 3rem 0 2rem; }
.hero h1 { font-size: 2.1rem; }
.lede { font-size: 1.05rem; max-width: 56ch; margin: 0 auto 1rem; }
.cta-row { display: flex; gap: .75rem; justify-content: center; margin-top: 1.5rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0 .75rem;
  flex-wrap: wrap;
}
.section-head h1, .section-head h2 { margin: 0; }
.filters { display: flex; gap: .4rem; }

/* ---------- cards & grids ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
}
.grid-2, .grid-3 { display: grid; gap: 1rem; margin: 1.5rem 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card .btn { margin-top: .75rem; margin-right: .5rem; }

.statrow { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1.1rem;
  min-width: 110px;
}
.stat-n { display: block; font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; }
.stat-l { color: var(--muted); font-size: .82rem; }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  padding: .8rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.row:last-child { border-bottom: 0; }
.row-when { color: var(--muted); font-size: .9rem; }
.row-when strong { color: var(--text); font-weight: 550; display: block; }
.row-what { display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; }
.row-what > div { flex-basis: 100%; }
.row-tentative { opacity: .82; }
.row-done .row-what strong { text-decoration: line-through; color: var(--muted); }

@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; gap: .25rem; }
}

/* ---------- tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: .93rem;
}
.table th {
  text-align: left;
  font-weight: 550;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table td { padding: .75rem .9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.small { font-size: .86rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* ---------- pills ---------- */
.pill {
  display: inline-block;
  font-size: .74rem;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.pill-ok { color: var(--ok); border-color: currentColor; }
.pill-warn { color: var(--warn); border-color: currentColor; }
.pill-error { color: var(--error); border-color: currentColor; }
.pill-soft { opacity: .8; }

/* ---------- forms ---------- */
.stack { display: flex; flex-direction: column; gap: .9rem; }
.stack label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 550; }
.stack small { font-weight: 400; color: var(--muted); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select {
  font: inherit;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

details { border: 1px solid var(--border); border-radius: 8px; padding: .7rem .9rem; }
details summary { cursor: pointer; font-weight: 550; font-size: .9rem; }
details .stack { margin-top: .9rem; }

.inline { display: inline; }
.inline-form {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.25rem;
}
.inline-form input[type=text] { flex: 1 1 180px; width: auto; }
.inline-form input[type=date], .inline-form select { width: auto; }

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 550;
  font-size: .93rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  text-align: center;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-small { padding: .3rem .7rem; font-size: .84rem; }

button.link {
  font: inherit;
  font-size: .88rem;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
}
button.link:hover { text-decoration: underline; }
.link-danger { color: var(--error); }

.checkbox {
  font-size: 1.1rem;
  line-height: 1;
  background: none;
  border: 0;
  padding: 0 .35rem 0 0;
  cursor: pointer;
  color: var(--muted);
}
.checkbox:hover { color: var(--accent); }
.checkbox.checked { color: var(--ok); }

/* ---------- flash ---------- */
.flash {
  padding: .7rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: .92rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.flash-success { border-color: var(--ok); color: var(--ok); }
.flash-error { border-color: var(--error); color: var(--error); }
.flash-info { color: var(--muted); }
