/* family.css: "My family" (family.html, js/family.js). Class prefix fm-.
   Colors: the site tokens in css/pages.css (light and dark) plus the status tones and child colors below.
   Look follows the approved sample: a phone-like dashboard (navy bar, a card per child, this week strip). Phone first. */

.fm-page {
  --fm-ok: #17603E; --fm-okbg: #E3F3E9;
  --fm-warn: #7A4A00; --fm-warnbg: #FFF2D9;
  --fm-stop: #A8231B; --fm-stopbg: #FBE4E2;
  --fm-info: #1E4A72; --fm-infobg: #E3EDF8;
  --fm-unk: #3F4C5A; --fm-unkbg: #EEF1F5;
  --fm-tint: #EEF3F9; --fm-late: #2468A8;
  /* child colors: white text on them passes 4.5:1 in both themes */
  --fm-k-blue: #2463A0; --fm-k-pink: #A23E86; --fm-k-green: #17703F; --fm-k-orange: #A14A00; --fm-k-purple: #6A4BB0; --fm-k-teal: #0E6872;
}
[data-theme="dark"] .fm-page {
  --fm-ok: #6FD39A; --fm-okbg: #173326;
  --fm-warn: #F2C26B; --fm-warnbg: #3A2C12;
  --fm-stop: #FF9A91; --fm-stopbg: #3D1D1B;
  --fm-info: #9CC8F2; --fm-infobg: #1B2E44;
  --fm-unk: #C3CFDB; --fm-unkbg: #1E2B38;
  --fm-tint: #1C2E42; --fm-late: #7DB6EE;
}
.fm-c-blue { --kc: var(--fm-k-blue); } .fm-c-pink { --kc: var(--fm-k-pink); } .fm-c-green { --kc: var(--fm-k-green); }
.fm-c-orange { --kc: var(--fm-k-orange); } .fm-c-purple { --kc: var(--fm-k-purple); } .fm-c-teal { --kc: var(--fm-k-teal); }

.fm-page .wrap { max-width: 1100px; padding-left: 16px; padding-right: 16px; }
.fm-page main :focus-visible { outline: 3px solid var(--focus-ring, var(--accent)); outline-offset: 2px; }
.fm-page [hidden] { display: none !important; }

.fm-intro { padding: 24px 0 14px; }
.fm-intro h1 { margin: 0 0 6px; font-size: 1.9rem; font-weight: 800; color: var(--ink); }
.fm-lead { margin: 0 0 6px; max-width: 680px; color: var(--muted); }
.fm-indep { margin: 0; font-size: .86rem; font-weight: 600; color: var(--ink); }

.fm-grid { display: grid; gap: 18px; padding-bottom: 32px; }
@media (min-width: 900px) { .fm-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.fm-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.fm-card, .fm-import { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow-sm); }
.fm-card h2, .fm-import h2 { margin: 0 0 6px; font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.fm-import { border-color: var(--gold); background: var(--warn-bg); margin-bottom: 16px; }
.fm-import p { margin: 0 0 10px; }
.fm-hint { margin: 0 0 12px; color: var(--muted); font-size: .92rem; }
.fm-small { margin: 8px 0 0; font-size: .82rem; color: var(--muted); }
.fm-note { margin: 0; padding: 10px 12px; border-left: 3px solid var(--gold); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: .9rem; }
.fm-warn { margin: 8px 0; padding: 8px 12px; border-radius: 10px; background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--text); font-size: .88rem; }
.fm-status { margin: 8px 0 0; min-height: 1.2em; font-size: .88rem; color: var(--text); }
.fm-status.fm-err { color: var(--bad); font-weight: 600; }
.fm-btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fm-btnrow .btn { min-height: 44px; }
.fm-danger { color: var(--bad) !important; }
.fm-card a:not(.btn), .fm-dash a:not(.btn):not(.fm-qa-b) { color: var(--accent); font-weight: 600; }

/* ---------- dashboard (the sample's phone panel) */
.fm-dash { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); outline: none; }
.fm-pbar { background: linear-gradient(90deg, #14324F, #1E4A72); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fm-pbar h2 { margin: 0; font-size: 1rem; font-weight: 800; color: #fff; }
.fm-pbar span { font-weight: 700; font-size: .9rem; }
.fm-pbody { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.fm-kids { display: flex; flex-direction: column; gap: 12px; }
.fm-empty { margin: 0; color: var(--muted); }

.fm-kid { border: 1px solid var(--border); border-left: 5px solid var(--kc, var(--border)); border-radius: 14px; overflow: hidden; background: var(--surface); }
.fm-kid-h { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 12px; }
.fm-av { width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-weight: 800; flex: none; background: var(--kc, var(--navy)); }
.fm-kid-t { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.fm-kid-t h3 { margin: 0; font-size: 1rem; font-weight: 800; color: var(--ink); }
.fm-kid-t > span { font-size: .8rem; color: var(--muted); }
.fm-kid-t .fm-dist { font-size: .76rem; }
.fm-edit { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; }
.fm-edit:hover { background: var(--hover); border-color: var(--border); }
.fm-edit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fm-st { padding: 8px 12px; font-size: .88rem; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.fm-st-r { font-weight: 600; }
.fm-t-ok { background: var(--fm-okbg); color: var(--fm-ok); }
.fm-t-info { background: var(--fm-infobg); color: var(--fm-info); }
.fm-t-warn { background: var(--fm-warnbg); color: var(--fm-warn); }
.fm-t-stop { background: var(--fm-stopbg); color: var(--fm-stop); }
.fm-t-unk { background: var(--fm-unkbg); color: var(--fm-unk); }
.fm-times { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); text-align: center; font-size: .74rem; color: var(--muted); padding: 8px 6px; gap: 4px; }
.fm-times b { display: block; font-size: 1rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.fm-nobell, .fm-kid-note, .fm-alert, .fm-cov, .fm-how-att { margin: 0; padding: 4px 12px 8px; font-size: .82rem; color: var(--text); }
.fm-nobell { font-weight: 600; padding-top: 8px; }
.fm-alert { padding-top: 8px; }
.fm-src { color: var(--muted); }
.fm-cov { color: var(--muted); }
.fm-badge { display: inline-block; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; border-radius: 6px; padding: 1px 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); }
.fm-qa { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 12px 12px; }
.fm-qa-b { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  font-size: .8rem; font-weight: 700; text-decoration: none; }
.fm-qa-b:hover { border-color: var(--accent); background: var(--hover); }
.fm-qa-gold { background: var(--gold); border-color: var(--gold); color: #14324F; }
.fm-qa-gold:hover { background: #F5C364; border-color: #F5C364; }

.fm-wk-h { margin: 0 0 6px; font-size: .9rem; font-weight: 800; color: var(--ink); }
.fm-week { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; text-align: center; }
.fm-day { border-radius: 10px; background: var(--fm-tint); padding: 6px 2px; display: flex; flex-direction: column; gap: 2px; align-items: center; font-size: .74rem; color: var(--muted); }
.fm-day b { font-size: .82rem; color: var(--ink); }
.fm-day.is-today { outline: 2px solid var(--navy-2); outline-offset: -2px; }
[data-theme="dark"] .fm-day.is-today { outline-color: var(--accent); }
.fm-dots { display: flex; gap: 3px; min-height: 10px; flex-wrap: wrap; justify-content: center; }
.fm-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; box-shadow: inset 0 0 0 0 transparent; }
.fm-dots .fm-dot { border-bottom: 3px solid var(--kc, transparent); height: 12px; }
.fm-dot-off { background: var(--fm-stop); } .fm-dot-early { background: var(--gold); } .fm-dot-late { background: var(--fm-late); } .fm-dot-unk { background: var(--muted); }
.fm-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); margin-top: 6px; }
.fm-legend .fm-dot { margin-right: 4px; vertical-align: -1px; }
.fm-b { min-height: 44px; }
.fm-local { display: flex; gap: 6px; align-items: flex-start; }
.fm-local svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; margin-top: 1px; }

/* ---------- forms */
.fm-field { margin: 0 0 12px; min-width: 0; }
.fm-label { display: block; margin: 0 0 6px; font-size: .9rem; font-weight: 700; color: var(--ink); }
.fm-sub { font-weight: 600; font-size: .84rem; }
.fm-opt { font-weight: 500; color: var(--muted); font-size: .82rem; }
.fm-page input[type=text], .fm-page input[type=search], .fm-page input[type=tel], .fm-page input[type=number], .fm-page input[type=time], .fm-page select, .fm-page textarea {
  width: 100%; min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.fm-page textarea { resize: vertical; }
.fm-row { display: flex; gap: 8px; align-items: center; }
.fm-row input { flex: 1; min-width: 0; }
.fm-row .btn { flex: none; min-height: 44px; }
.fm-two { display: grid; gap: 0 12px; }
@media (min-width: 480px) { .fm-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.fm-combo { position: relative; }
.fm-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; list-style: none; margin: 0; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); max-height: 320px; overflow: auto; }
.fm-opt, .fm-opt-none { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; min-height: 44px; justify-content: center; }
.fm-opt.is-active, .fm-opt:hover { background: var(--hover); }
.fm-opt-name { font-weight: 700; color: var(--ink); }
.fm-opt-sub { font-size: .8rem; color: var(--muted); }
.fm-opt-none { color: var(--muted); cursor: default; }
.fm-addr-results { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fm-addr-pick { width: 100%; min-height: 44px; text-align: left; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.fm-addr-pick:hover { border-color: var(--accent); }
.fm-addr-pick span { color: var(--muted); font-size: .84rem; }
.fm-picked { margin: 0 0 12px; min-height: 1.2em; }
.fm-colors { border: 0; padding: 0; }
.fm-color-list { display: flex; flex-wrap: wrap; gap: 6px; }
.fm-sw-c { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 10px 4px 6px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: .84rem; position: relative; }
.fm-sw-c input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fm-chip { width: 22px; height: 22px; border-radius: 999px; background: var(--kc); }
.fm-sw-c:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 700; }
.fm-sw-c:has(input:focus-visible) { outline: 3px solid var(--focus-ring, var(--accent)); outline-offset: 2px; }
.fm-check { display: flex; gap: 8px; align-items: center; min-height: 44px; font-size: .92rem; cursor: pointer; }
.fm-check input { width: 24px; height: 24px; flex: none; margin: 0; }

/* ---------- lists */
.fm-next, .fm-sum { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.fm-next li, .fm-sum li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: .9rem; flex-wrap: wrap; }
.fm-next li:first-child, .fm-sum li:first-child { border-top: 0; }
.fm-nd { flex: 0 0 96px; color: var(--ink); }
.fm-next li > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fm-sum li b { flex: 0 0 100%; color: var(--ink); }
.fm-ev { display: block; }
.fm-none { color: var(--muted); }

/* ---------- notifications */
.fm-toggles { display: flex; flex-direction: column; }
.fm-tg { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .92rem; min-height: 44px; cursor: pointer; }
.fm-tg small { display: block; color: var(--muted); font-size: .78rem; }
.fm-sw { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 26px; border-radius: 999px; background: var(--track); border: 1px solid var(--muted); position: relative; cursor: pointer; margin: 0; }
.fm-sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s ease; }
.fm-sw:checked { background: var(--good); border-color: var(--good); }
.fm-sw:checked::after { left: 22px; }
[data-theme="dark"] .fm-sw:checked::after { background: #0B1520; }
.fm-quiet { margin-top: 12px; }
.fm-quiet-row label { font-size: .88rem; }
.fm-quiet-row input { max-width: 140px; }
.fm-how { margin-top: 10px; font-size: .88rem; }
.fm-how summary { cursor: pointer; font-weight: 700; color: var(--ink); min-height: 32px; padding: 4px 0; }
.fm-how ol, .fm-how p { margin: 6px 0 0; padding-left: 20px; }
.fm-how p { padding-left: 0; }

/* ---------- share */
.fm-qr { margin-top: 10px; width: 200px; max-width: 100%; }
.fm-qr svg { width: 100%; height: auto; display: block; border-radius: 6px; }

/* ---------- emergency card */
.fm-contact { border: 0; padding: 0; margin: 0 0 4px; min-width: 0; }
.fm-ecard-preview { margin-top: 12px; }
.fm-ecard { border: 2px solid var(--navy); border-radius: 14px; padding: 12px 14px; background: var(--surface); color: var(--text); max-width: 3.6in; font-size: .86rem; }
[data-theme="dark"] .fm-ecard { border-color: var(--accent); }
.fm-ec-h { margin: 0 0 6px; font-weight: 800; color: var(--ink); font-size: 1rem; }
.fm-ec-kids, .fm-ec-c { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.fm-ec-sub { margin: 4px 0 2px; font-weight: 800; color: var(--ink); }
.fm-ec-ph { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fm-ec-notes { margin: 4px 0; }
.fm-ec-foot { margin: 6px 0 0; font-size: .74rem; color: var(--muted); }
.fm-print-sheet { display: none; }

.fm-privacy ul { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }

@media (max-width: 420px) {
  .fm-intro h1 { font-size: 1.6rem; }
  .fm-pbody { padding: 10px; }
  .fm-row { flex-wrap: wrap; }
  .fm-row .btn { width: 100%; }
  .fm-quiet-row { flex-wrap: nowrap; }
  .fm-quiet-row input { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fm-sw::after { transition: none; }
}

/* ---------- print: only the wallet card, twice on one Letter page, with cut lines */
@media print {
  @page { size: letter; margin: 0.5in; }
  .fm-page main > :not(.fm-grid), .fm-page .fm-grid > .fm-col > :not(.fm-emerg-sec), .site-foot, .topbar, .offline-notice { display: none !important; }
  .fm-page .fm-grid { display: block; padding: 0; }
  .fm-page .fm-emerg-sec { border: 0; box-shadow: none; padding: 0; background: #fff; }
  .fm-print-sheet { display: block !important; }
  .fm-cut { border: 1.5px dashed #555; padding: 0.12in; width: 3.75in; margin: 0 0 0.25in; break-inside: avoid; }
  .fm-cut .fm-ecard { border: 1.5px solid #14324F; max-width: none; font-size: 9pt; color: #111; background: #fff; }
  .fm-cut .fm-ec-h, .fm-cut .fm-ec-sub { color: #14324F; }
  .fm-cut .fm-ec-foot { color: #444; }
  .fm-cut-note { font-size: 8pt; color: #555; margin: 0; }
}
