/* ParentX — visual design v2 ("Two lines, one child").
   Harbour teal + ochre for the two households, linen ground, Newsreader display over Hanken Grotesk.
   Class names are unchanged from v1 so every view keeps working; new classes are marked "v2". */
:root {
  --bg: #f4f1ea; --surface: #fffdf8; --surface-2: #ede8dd; --ink: #17201f; --ink-2: #3e4745; --muted: #5e6664;
  --line: #e2dccf; --line-strong: #cfc8b8; --accent: #1f4e4f; --accent-hover: #163a3b; --accent-ink: #fffdf8; --accent-soft: #dde8e4;
  --warm: #7f5716; --warm-strong: #b07a2a; --warm-soft: #f1e4cc;
  --ok: #2f5a38; --ok-soft: #dfebdf; --warn: #7a4a00; --warn-soft: #f8ebcd; --bad: #8f3727; --bad-strong: #a2412f; --bad-soft: #f5e0d8; --info: #2f5486; --info-soft: #e3eaf4;
  --primary-parent: #1f4e4f; --primary-parent-soft: #dde8e4; --alternate-parent: #b07a2a; --alternate-parent-soft: #f1e4cc;
  --mark-head: #17201f; --mark-a: #1f4e4f; --mark-b: #b07a2a;
  --hero-bg: #1f4e4f; --hero-ink: #f4f1ea; --hero-muted: #cfe0dc; --hero-a: #8fc2bc; --hero-b: #e2b872;
  --radius: 18px; --radius-sm: 12px; --shadow: 0 1px 2px rgba(23,32,31,.04);
  --font: "Hanken Grotesk", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  --font-display: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121817; --surface: #1a2120; --surface-2: #222b29; --ink: #eef0ec; --ink-2: #cdd3cf; --muted: #9da7a3; --line: #2c3634; --line-strong: #3b4745;
    --accent: #8fc2bc; --accent-hover: #a9d3ce; --accent-ink: #0e1a19; --accent-soft: #1d3331; --warm: #e2b872; --warm-strong: #e2b872; --warm-soft: #33291a;
    --ok: #8cc79a; --ok-soft: #1b2f21; --warn: #e8bb62; --warn-soft: #362a12; --bad: #ee9384; --bad-strong: #ee9384; --bad-soft: #3b1f1b; --info: #9bb6e4; --info-soft: #1c2840;
    --primary-parent: #8fc2bc; --primary-parent-soft: #1d3331; --alternate-parent: #e2b872; --alternate-parent-soft: #33291a;
    --mark-head: #eef0ec; --mark-a: #8fc2bc; --mark-b: #e2b872;
    --hero-bg: #1d3331; --hero-ink: #eef0ec; --hero-muted: #b9cfca;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121817; --surface: #1a2120; --surface-2: #222b29; --ink: #eef0ec; --ink-2: #cdd3cf; --muted: #9da7a3; --line: #2c3634; --line-strong: #3b4745;
  --accent: #8fc2bc; --accent-hover: #a9d3ce; --accent-ink: #0e1a19; --accent-soft: #1d3331; --warm: #e2b872; --warm-strong: #e2b872; --warm-soft: #33291a;
  --ok: #8cc79a; --ok-soft: #1b2f21; --warn: #e8bb62; --warn-soft: #362a12; --bad: #ee9384; --bad-strong: #ee9384; --bad-soft: #3b1f1b; --info: #9bb6e4; --info-soft: #1c2840;
  --primary-parent: #8fc2bc; --primary-parent-soft: #1d3331; --alternate-parent: #e2b872; --alternate-parent-soft: #33291a;
  --mark-head: #eef0ec; --mark-a: #8fc2bc; --mark-b: #e2b872;
  --hero-bg: #1d3331; --hero-ink: #eef0ec; --hero-muted: #b9cfca;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1, h2 { font-family: var(--font-display); font-weight: 500; letter-spacing: -.02em; }
h1 { font-size: 2rem; } h2 { font-size: 1.35rem; letter-spacing: -.012em; } h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .86rem; } .muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Brand (v2) */
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand .mark-svg { width: 28px; height: 28px; flex: none; }
.wordmark { font-family: var(--font-display); font-size: 1.45rem; font-weight: 500; letter-spacing: -.03em; line-height: 1; }
.wordmark-x { color: var(--mark-b); font-style: italic; font-weight: 400; }
.brand-mark { display: none; } /* v1 "P" tile, retired */
.login-brand { margin-bottom: 28px; }
.login-brand .mark-svg { width: 40px; height: 40px; }
.login-brand .wordmark { font-size: 2rem; }

/* Layout */
.app { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 18px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; min-height: 44px; padding: 0 4px; border-radius: 12px; }
.who-name { display: none; font-size: .9rem; font-weight: 600; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--warm-soft); color: var(--warm); font-size: .8rem; font-weight: 700; }
.iconbtn { position: relative; border: 0; background: transparent; color: var(--ink); width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.iconbtn:hover { background: var(--surface-2); }
.badge-dot { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--bad-strong); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
main { padding: 12px 20px 104px; max-width: 1080px; width: 100%; margin: 0 auto; }
.sidenav { display: none; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 4px 6px env(safe-area-inset-bottom); }
.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 2px; font-size: 11.5px; font-weight: 500; color: var(--muted); text-decoration: none; background: none; border: 0; font-family: inherit; cursor: pointer; }
.tabbar a[aria-current="page"], .tabbar button[aria-current="page"] { color: var(--accent); font-weight: 700; }
.tabbar svg, .sidenav svg { width: 23px; height: 23px; }
@media (min-width: 900px) {
  .app { grid-template-columns: 256px 1fr; }
  .topbar { grid-column: 1 / -1; padding: 12px 24px; border-bottom-color: var(--line); background: var(--surface); }
  .who-name { display: inline; }
  .sidenav { display: flex; flex-direction: column; gap: 2px; padding: 20px 14px; position: sticky; top: 69px; height: calc(100vh - 69px); background: var(--surface); border-right: 1px solid var(--line); }
  .sidenav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 500; }
  .sidenav a:hover { background: var(--surface-2); }
  .sidenav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
  .sidenav svg { width: 20px; height: 20px; }
  .nav-sep { margin: 10px 12px; }
  .tabbar { display: none; }
  main { padding: 36px 48px 56px; }
  h1 { font-size: 2.5rem; }
}

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.tight { padding: 12px 16px; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.page-head h1 { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); padding: 12px 0; }
.list > li:first-child { border-top: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.item-link { display: block; color: inherit; text-decoration: none; }
.item-link:hover .item-title { text-decoration: underline; }
.item-title { font-weight: 600; }
.amount { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.kpi { font-family: var(--font-display); font-size: 1.9rem; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '+ '; font-weight: 700; } details[open] > summary::before { content: '− '; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); } .pill.warm { background: var(--warm-soft); color: var(--warm); }
.pill.court::before { content: '§'; font-family: var(--font-display); font-weight: 600; }

/* Notices */
.notice { border-radius: var(--radius-sm); padding: 12px 14px; font-size: .92rem; margin-bottom: 12px; background: var(--info-soft); color: var(--ink); border: 0; }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); }
.notice.ok { background: var(--ok-soft); }
.notice.warm { background: var(--warm-soft); }
.notice.source { background: var(--surface-2); }
blockquote.src { margin: 6px 0 0; padding: 10px 14px; background: var(--surface-2); border-radius: 10px; font-family: var(--font-display); font-size: 1rem; line-height: 1.5; color: var(--ink-2); font-style: normal; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.hint { font-size: .84rem; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 13px; min-height: 46px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 12px; font-weight: 500; cursor: pointer; background: var(--surface); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-grid { display: grid; gap: 0 14px; } @media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 18px; border-radius: 14px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--accent); padding: 8px 10px; min-height: 44px; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .88rem; border-radius: 10px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fab { position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 25; box-shadow: 0 8px 24px rgba(23,32,31,.22); border-radius: 999px; }
@media (min-width: 900px) { .fab { position: static; box-shadow: none; border-radius: 14px; } }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.chip { border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2); border-radius: 999px; min-height: 38px; padding: 6px 14px; font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Money sub-tabs (v2) */
.segmented { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; margin-bottom: 18px; background: var(--surface-2); border-radius: 14px; }
.segmented a { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 18px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: .94rem; text-decoration: none; }
.segmented a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(23,32,31,.1); }

/* Home (v2) */
.home-head p { margin-bottom: 4px; }
.home-grid { display: grid; gap: 28px; grid-template-areas: "hero" "main" "aside"; align-content: start; }
.home-hero { grid-area: hero; display: flex; flex-direction: column; gap: 10px; }
.home-hero > p { margin: 0; }
.home-main { grid-area: main; display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.home-aside { grid-area: aside; display: flex; flex-direction: column; gap: 22px; }
@media (min-width: 1100px) { .home-grid { grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); grid-template-areas: "main hero" "main aside"; grid-template-rows: auto 1fr; } }
.section > .small.muted { margin-top: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; text-decoration: none; padding: 8px 0; }
.tasks { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tasks > li + li { border-top: 1px solid var(--line); }
.task { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 15px 18px; min-height: 64px; color: var(--ink); text-decoration: none; }
.task:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); color: var(--ink); }
.task-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.task-title { font-weight: 600; line-height: 1.35; }
.task-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.task-amount { font-family: var(--font-display); font-size: 1.15rem; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.verb { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.verb.accent { color: var(--accent); } .verb.warm { color: var(--warm); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--line-strong); color: var(--ink); }
.tile-label { font-size: .86rem; color: var(--muted); }
.tile-value { font-family: var(--font-display); font-size: 1.4rem; font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile-sub { font-size: .88rem; color: var(--ink-2); }
.tile-note { font-size: .8rem; color: var(--muted); }
.hero { display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: 22px; background: var(--hero-bg); color: var(--hero-ink); text-decoration: none; }
.hero:hover { color: var(--hero-ink); }
.hero-top { display: flex; justify-content: space-between; font-size: .86rem; color: var(--hero-muted); }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.hero-date { font-family: var(--font-display); font-size: 1.95rem; font-weight: 500; letter-spacing: -.02em; line-height: 1.1; }
.hero-move { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: .92rem; }
.hero-move svg { color: var(--hero-muted); }
.hero .dot { width: 10px; height: 10px; border-radius: 50%; }
.hero .dot.a { background: var(--hero-a); } .hero .dot.b { background: var(--hero-b); }
.hero-note { font-size: .9rem; line-height: 1.5; color: var(--hero-muted); border-top: 1px solid color-mix(in srgb, var(--hero-ink) 18%, transparent); padding-top: 12px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 10px; }
.timeline li::before { content: ''; position: absolute; left: -25px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline li.warn::before { border-color: var(--warn); } .timeline li.bad::before { border-color: var(--bad); } .timeline li.ok::before { border-color: var(--ok); background: var(--ok); }
.timeline .when { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { font-size: .75rem; font-weight: 600; color: var(--muted); text-align: center; padding: 4px 0; }
.cal .day { min-height: 64px; border-radius: 10px; padding: 5px; font-size: .8rem; position: relative; border: 2px solid transparent; background: var(--surface-2); }
.cal .day.primary { background: var(--primary-parent-soft); } .cal .day.alternate { background: var(--alternate-parent-soft); }
.cal .day.unknown { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface) 4px, var(--surface) 8px); }
.cal .day.out { opacity: .4; } .cal .day.today { border-color: var(--ink); }
.cal .num { font-weight: 650; font-size: .9rem; font-variant-numeric: tabular-nums; }
.cal .mark { display: block; font-size: .75rem; line-height: 1.25; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .clash { position: absolute; top: 3px; right: 5px; color: var(--bad); font-weight: 800; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .84rem; color: var(--ink-2); margin: 10px 0; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
@media (max-width: 480px) { .cal .mark { display: none; } .cal .day { min-height: 52px; } }

/* Messages */
.msg { max-width: 86%; padding: 11px 14px; border-radius: 18px 18px 18px 4px; margin: 10px 0; background: var(--surface); border: 1px solid var(--line); }
.msg.mine { margin-left: auto; background: var(--accent-soft); border-color: transparent; border-radius: 18px 18px 4px 18px; }
.msg .meta { font-size: .78rem; color: var(--muted); margin-top: 5px; display: flex; gap: 8px; flex-wrap: wrap; }
.msg .body { white-space: pre-wrap; word-wrap: break-word; line-height: 1.5; }
.calm { border: 1px dashed var(--line-strong); background: var(--surface); padding: 12px; border-radius: 12px; margin-top: 8px; }
.assist { border: 0; border-radius: 16px; padding: 16px; background: var(--surface-2); margin-top: 10px; }

/* Overlay */
.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 8px; width: min(92vw, 460px); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-size: .92rem; box-shadow: 0 10px 28px rgba(0,0,0,.2); }
.toast.bad { background: var(--bad-strong); color: #fff; }
dialog { border: 0; border-radius: 20px; padding: 0; width: min(94vw, 560px); background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(18,24,23,.5); }
dialog .dlg-body { padding: 22px; max-height: 82vh; overflow: auto; }
.more-list a { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 600; }
.more-list svg { width: 22px; height: 22px; color: var(--muted); }
.offline { position: sticky; top: 64px; z-index: 19; background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .88rem; padding: 7px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; height: 18px; margin: 10px 0; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .big { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink-2); margin-bottom: 4px; }
.login { max-width: 420px; margin: 10vh auto; padding: 0 20px; }
.login h1 { margin-bottom: .4rem; }
.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 8px 12px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
pre { background: var(--surface-2); padding: 10px; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; }

/* Folded court-order references */
details.ref { margin: 8px 0; }
details.ref > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; color: var(--muted); font-size: .86rem; font-weight: 600; }
details.ref > summary::before { content: ''; }
details.ref > summary:hover { color: var(--accent); }
details.ref[open] > summary { color: var(--accent); }
details.ref .ref-body { margin-top: 6px; }

/* Court order search */
mark { background: color-mix(in srgb, var(--warm-strong) 30%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }
.order-text { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.6; }
.card.struck .order-text { text-decoration: line-through; opacity: .7; }
a.iconbtn { text-decoration: none; }

/* Keep every page inside the window width */
main { min-width: 0; }
.app > * { min-width: 0; }
.card, form { min-width: 0; max-width: 100%; }
.row > input, .row > select + input { flex: 1 1 auto; min-width: 0; }
.chips { max-width: 100%; flex-wrap: wrap; overflow-x: visible; }
blockquote.src { overflow-wrap: anywhere; }
input[type=search] { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 13px; min-height: 46px; -webkit-appearance: none; appearance: none; }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn { color: var(--ink); }

/* Photo album */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photo-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.photo-tile { position: relative; display: block; padding: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); cursor: pointer; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.photo-tile:hover img { transform: scale(1.03); }
.photo-tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-tag { position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); padding: 2px 8px; border-radius: 999px; font-size: .72rem; background: rgba(0,0,0,.55); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-view img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: #000; display: block; }
@media (prefers-reduced-motion: reduce) { .photo-tile img { transition: none; } }

/* Unread count on the Messages menu item */
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--bad-strong, #b3412f); color: #fff; font-size: .75rem; font-weight: 700; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.tabbar a { position: relative; }
.tabbar .nav-count { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; font-size: .68rem; box-shadow: 0 0 0 2px var(--surface); }

/* Currency picker next to an amount: compact, the amount gets the room */
.cur-select { flex: 0 0 6.5rem !important; width: 6.5rem !important; min-width: 0; text-overflow: ellipsis; }
.cur-select + input { flex: 1 1 auto; min-width: 7rem; }

/* Finances */
.fin-bar { display: block; height: 6px; margin-top: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.fin-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.fin-detail td { background: var(--surface-2); }
.segmented { flex-wrap: wrap; }

/* Per-message archive */
.msg .msg-actions { margin-top: 4px; gap: 6px; align-items: center; }
.msg .msg-actions .btn.small { min-height: 32px; padding: 0 10px; font-size: .8rem; }
.msg.archived { opacity: .7; border-style: dashed; }

/* Primary / alternate care parent identity */
.ptag { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.ptag .pdot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ptag.primary .pdot { background: var(--primary-parent); } .ptag.alternate .pdot { background: var(--alternate-parent); }
.ptag-role { font-weight: 500; color: var(--muted); }
.ptag.primary .ptag-role { color: var(--primary-parent); } .ptag.alternate .ptag-role { color: color-mix(in srgb, var(--alternate-parent) 75%, var(--ink)); }
.avatar.primary { background: var(--primary-parent-soft); color: var(--primary-parent); box-shadow: 0 0 0 2px var(--primary-parent); }
.avatar.alternate { background: var(--alternate-parent-soft); color: color-mix(in srgb, var(--alternate-parent) 70%, var(--ink)); box-shadow: 0 0 0 2px var(--alternate-parent); }
.who-role { display: none; font-size: .72rem; font-weight: 600; line-height: 1.1; }
.who-role.primary { color: var(--primary-parent); } .who-role.alternate { color: color-mix(in srgb, var(--alternate-parent) 75%, var(--ink)); }
@media (min-width: 900px) { .who-role { display: block; } }
.who-text { display: flex; flex-direction: column; }
.msg.from-primary { background: var(--primary-parent-soft); border-color: transparent; border-left: 4px solid var(--primary-parent); }
.msg.from-alternate { background: var(--alternate-parent-soft); border-color: transparent; border-left: 4px solid var(--alternate-parent); }
.msg.mine.from-primary, .msg.mine.from-alternate { border-left-width: 0; }
.msg.mine.from-primary { border-right: 4px solid var(--primary-parent); } .msg.mine.from-alternate { border-right: 4px solid var(--alternate-parent); }
.care-key { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .85rem; margin: 0 0 12px; }
.thread-card { display: flex; align-items: center; gap: 10px; }
.thread-card .thread-link { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.thread-card .thread-arch { flex: none; min-height: 40px; }
.login-alt { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.login-alt p { margin: 0 0 8px; }
.login-new { margin-top: 22px; }
.login-legal { margin-top: 8px; }
.login-new a, .login-legal a { color: var(--accent); }
.child-row { border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px 2px; margin: 0 0 12px; }
.child-row legend { font-weight: 700; padding: 0 6px; }

/* Family set-up */
.upload-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.upload-row:first-of-type { border-top: 0; }
.file-btn { cursor: pointer; flex: none; }
.check.inline { display: inline-flex; margin-left: 6px; }
.form-grid.three { align-items: end; } @media (min-width: 640px) { .form-grid.three { grid-template-columns: 2fr 1.2fr 1fr; } }
.sticky-actions { padding: 10px 0; }
@media (min-width: 900px) { .sticky-actions { position: sticky; bottom: 0; background: var(--bg); z-index: 2; border-top: 1px solid var(--line); } }
.setup-cta { display: grid; gap: 6px; text-decoration: none; color: inherit; border-left: 4px solid var(--accent); margin-bottom: 16px; }
.setup-cta .btn { justify-self: start; margin-top: 4px; }
