/* Kotona, version 2: the shared system.
   Load order on every page: theme.css (colors and fonts), photos.css (pictures
   and person colors), v2.css (this file), then palette.js.
   Phone first: everything here is the 390px layout, and the two media queries
   at the foot widen it. Page-specific layout goes in a <style> block in the page.
   SYSTEM.md lists every class and the markup to copy. */

/* ---------- 1. Tokens ---------- */
:root {
  --pad: 16px;            /* side padding inside every block */
  --gap: 10px;            /* space between blocks; the field shows through it */
  --tap: 48px;            /* the smallest thing a thumb is asked to hit */
  --ans: 52px;            /* an answer button */
  --row: 52px;            /* a timeline row */
  --tcol: 58px;           /* the time column */
  --top-h: 48px;          /* the one-line header on a phone */
  --dock-h: 115px;        /* the bottom bar on a phone: add field over five tabs */
  --rail-w: 208px;        /* the sidebar from tablet up */
  --addbar-h: 64px;       /* the add field across the top of the page from tablet up */

  --t-hero: 100px;        /* the one hero figure on a screen. It is a time. */
  --t-head: 16.5px;       /* section heads, wide */
  --t-body: 15.5px;
  --t-sub: 13.5px;        /* second lines */
  --t-min: 12.5px;        /* nothing is smaller than this */
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: var(--t-body); line-height: 1.4; font-weight: 450; -webkit-font-smoothing: antialiased; }
img, svg { display: block; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote, table { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.d { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1; }
.fig { font-family: var(--font-figures); font-weight: 900; letter-spacing: -.01em; }
.mono { font-family: var(--font-mono); letter-spacing: -.03em; }
.muted { color: var(--ink-2); }
.lk { font-weight: 700; font-size: 14px; color: var(--accent); text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: var(--tap); }

/* ---------- 3. The shell ----------
   Phone: a one-line header that scrolls away, the page, and a bottom bar that
   stays: the add field with a camera, over five tabs.
   Tablet and up: .rail becomes a sidebar and the add field runs across the top. */
.app { min-height: 100vh; min-height: 100dvh; }
.rail, .dock { display: contents; }
.top { position: relative; z-index: 42; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--top-h); padding: 0 var(--pad); background: var(--rail); color: var(--rail-ink); }
.logo { display: flex; align-items: center; min-height: var(--top-h); }
.logo svg { height: 24px; width: auto; }
.lg-m { stroke: var(--rail-ink); } .lg-w { fill: var(--rail-ink); } .lg-d { fill: var(--rail-fig); }
.me { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: var(--tap); min-height: var(--top-h); text-decoration: none; font-size: var(--t-sub); line-height: 1.3; color: var(--rail-ink-2); }
.me .pb { box-shadow: 0 0 0 2px var(--rail); }
.me span { display: none; }
.me strong { display: block; color: var(--rail-ink); font-weight: 700; font-size: 14px; }

/* Colors and themes: the control in the bar, and the panel it opens (palette.js builds the panel).
   A swatch shows a choice's field, its signal color and its bar. */
.tsw { position: relative; flex: none; display: block; width: 22px; height: 22px; border-radius: var(--radius-s); overflow: hidden; background: var(--a, var(--bg)); box-shadow: 0 0 0 1.5px var(--sw-line, var(--ink-2)); }
.tsw::before { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 50%; background: var(--b, var(--sig)); }
.tsw::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 32%; background: var(--c, var(--rail)); }
.th { display: flex; align-items: center; gap: 8px; margin-left: auto; height: var(--top-h); min-width: var(--tap); padding: 0 6px; border: 0; border-radius: 0; background: none; color: var(--rail-ink); font-weight: 650; font-size: 14px; line-height: 1; white-space: nowrap; --sw-line: var(--rail-ink-2); }
.th .chev { width: 8px; height: 8px; border-width: 2px; margin: 0 2px 0 1px; }
.th[aria-expanded="true"] .chev { transform: rotate(-135deg) translate(-2px, -2px); }
.thp-mask { position: fixed; inset: 0; z-index: 40; background: var(--mask); }
.thp { position: absolute; top: var(--top-h); left: 0; right: 0; z-index: 41; padding: 2px var(--pad) 14px; background: var(--surface); color: var(--ink); border-bottom: var(--rule) solid var(--ink); }
.thp-h { padding: 12px 0 8px; }
.thp-h h2 { font-family: var(--font-display); font-weight: 800; font-size: var(--t-head); letter-spacing: -.015em; line-height: 1.15; }
.thp-h p, .thp-end { font-size: var(--t-sub); line-height: 1.35; color: var(--ink-2); }
.thp-h p { margin-top: 2px; }
.thp-g { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; }
.thp-o { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 8px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; color: var(--ink); text-align: left; font-size: var(--t-body); line-height: 1.15; }
.thp-o b { font-weight: 650; min-width: 0; }
.thp-o[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-top-color: var(--ink); --sw-line: var(--surface); }
.thp-o[aria-pressed="true"] b { font-weight: 750; }
.thp-end { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--ink); font-weight: 600; }
@media (max-width: 359px) { .th span { display: none; } }

.page { display: block; min-width: 0; padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 24px); }

.add, .tabs { background: var(--rail); color: var(--rail-ink); }
.add { position: fixed; left: 0; right: 0; bottom: calc(51px + env(safe-area-inset-bottom)); z-index: 30; display: flex; gap: 8px; padding: 8px var(--pad) 8px;
  --f-bg: var(--rail-field); --f-ink: var(--rail-ink); --f-ink-2: var(--rail-ink-2); --f-btn: var(--rail-ink); --f-btn-ink: var(--rail); }
.add input { flex: 1; min-width: 0; height: var(--tap); padding: 0 12px; border: 0; border-radius: var(--radius-m); background: var(--f-bg); color: var(--f-ink); font-size: 16px; }
.add input::placeholder { color: var(--f-ink-2); opacity: 1; }
.cam { flex: none; width: 52px; height: var(--tap); padding: 0; border: 0; border-radius: var(--radius-m); background: var(--f-btn); color: var(--f-btn-ink); display: grid; place-items: center; }
.cam svg { width: 26px; height: 26px; }
.cam .lens { fill: var(--f-btn); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--rail-line); }
.tabs a { display: flex; align-items: center; justify-content: center; gap: 6px; height: 50px; font-family: var(--font-display); font-weight: 800; font-size: 13.5px; letter-spacing: -.01em; text-decoration: none; color: var(--rail-ink); }
.tabs a[aria-current] { background: var(--rail-on); color: var(--rail-on-ink); }
/* a count on a tab: only things that need her */
.n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--radius-s); background: var(--sig); color: var(--sig-ink); font-family: var(--font-figures); font-weight: 900; font-size: 15px; line-height: 1; }

/* ---------- 4. People ----------
   <i class="pb pD ph-dana" role="img" aria-label="Dana">D</i>   a ringed headshot
   <i class="pb pT" role="img" aria-label="Theo">T</i>           a lettered bullet (no photo)
   <i class="pb hp" role="img" aria-label="Kayla, sitter">K</i>  a helper: ink, no color
   Sizes: default 28, .s 24, .m 36, .l 56, .xl 96. */
.pb { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background-color: var(--pc, var(--ink)); color: var(--p-ink); font-family: var(--font-figures); font-weight: 800; font-size: 15px; line-height: 1; font-style: normal; flex: none; }
.pb.s { width: 24px; height: 24px; font-size: 13.5px; }
.pb.m { width: 36px; height: 36px; font-size: 19px; }
.pb.l { width: 56px; height: 56px; font-size: 28px; }
.pb.xl { width: 96px; height: 96px; font-size: 46px; }
.pb.l[class*="ph-"] { border-width: 4px; }
.pb.xl[class*="ph-"] { border-width: 5px; }
.pb.hp { --pc: var(--ink); color: var(--surface); border-radius: var(--radius-m); }   /* helpers: a square ink marker, so paid help never reads as a seventh family color */
.pbs { display: inline-flex; gap: 4px; flex: none; align-items: center; }

/* ---------- 5. Small parts ---------- */
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: var(--radius-s); background: var(--ink); color: var(--surface); font-family: var(--font-figures); font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.chip.due { background: var(--accent-2); color: var(--accent-2-ink); }                 /* a deadline */
.chip.line { background: none; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
/* "not the usual": the sticker on anything that differs from the standing week */
.flag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--radius-s); background: var(--flag); color: var(--flag-ink); font-family: var(--font-figures); font-weight: 800; font-size: 13.5px; line-height: 1; white-space: nowrap; }
/* the day plate: which day a thing is about. Yellow while it needs her. */
.dp { display: inline-grid; place-items: center; min-width: 38px; height: 28px; padding: 0 6px; border-radius: var(--radius-s); background: var(--sig); color: var(--sig-ink); font-family: var(--font-figures); font-weight: 900; font-size: 15px; line-height: 1; flex: none; }
.dp.wait { background: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.dp.off { background: var(--surface-2); color: var(--ink-2); }

.b { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 14px; border: 0; border-radius: var(--radius-m); background: var(--ink); color: var(--surface); font-weight: 700; font-size: 14.5px; white-space: nowrap; text-decoration: none; }
.b.o { background: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.arrow { width: var(--tap); padding: 0; }
.arrow::before { content: ""; width: 9px; height: 9px; border-top: 2.5px solid currentColor; border-right: 2.5px solid currentColor; transform: rotate(45deg); margin-left: -4px; }
.arrow.back::before { transform: rotate(-135deg); margin-left: 4px; }
.chev { width: 9px; height: 9px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); flex: none; }
details[open] > summary .chev { transform: rotate(-135deg) translate(-2px, -2px); }
.ck { width: 22px; height: 22px; border-radius: var(--radius-s); box-shadow: inset 0 0 0 2px var(--ink); flex: none; display: inline-grid; place-items: center; }
.ck.on { background: var(--ink); }
.ck.on::before { content: ""; width: 10px; height: 5px; border-left: 2.5px solid var(--surface); border-bottom: 2.5px solid var(--surface); transform: rotate(-45deg) translate(1px, -1px); }
.field { display: flex; align-items: center; width: 100%; height: var(--tap); padding: 0 14px; border: 0; background: var(--surface-2); border-radius: var(--radius-m); color: var(--ink); font-size: 16px; box-shadow: inset 0 -2px 0 var(--ink); }
.field::placeholder { color: var(--ink-2); opacity: 1; }

/* ---------- 6. Blocks ----------
   .sec is a block. .sh is its head: a heavy rule, a short wide word, and at
   most one thing on the right (a count, a link). */
.sec { background: var(--surface); min-width: 0; margin-top: var(--gap); }
.sh { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 var(--pad); border-top: var(--rule) solid var(--ink); }
.sh h2 { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 800; font-size: var(--t-head); letter-spacing: -.015em; line-height: 1.1; }
.sh .aside { font-size: var(--t-sub); color: var(--ink-2); font-weight: 550; }

/* The date line: day, date, the weather in a few words, day arrows. */
.day { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 1px 4px 1px var(--pad); }
.day h1 { font-family: var(--font-display); font-weight: 800; font-size: 16px; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.day .wx { flex: 1; min-width: 0; font-size: var(--t-sub); font-weight: 550; line-height: 1.25; }
.day .long { display: none; }
.day .nav { display: flex; flex: none; }
.day .nav .b { background: none; color: var(--ink); }
.day .nav .now { display: none; }

/* Next: the one hero on a screen. A flat slab in the signal color, a narrow
   time as large as the phone allows, who takes it, one note. */
.nx { position: relative; background: var(--next); color: var(--next-ink); border-left: 6px solid var(--next-edge); padding: calc(9px + var(--motif-pad-t, 0px)) var(--pad) calc(14px + var(--motif-pad-b, 0px)) calc(var(--pad) - 6px); }
/* A theme's one motif: a flat drawn strip on one edge of the slab (theme.css sets --motif). */
.nx::after { content: ""; position: absolute; left: -6px; right: 0; top: var(--motif-t, auto); bottom: var(--motif-b, 0); height: var(--motif-h, 0px); background: var(--motif, none) left bottom / var(--motif-size, auto 100%) var(--motif-rep, repeat-x); pointer-events: none; }
.nx-k { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; font-size: 14px; font-weight: 600; }
.nx-k b { font-family: var(--font-display); font-weight: 800; font-size: 15px; letter-spacing: -.015em; margin-right: 6px; }
.nx .pb { box-shadow: 0 0 0 2px var(--next-key, var(--next)); }
.nx .pbs { gap: 6px; }
.hero { display: block; font-family: var(--font-figures); font-weight: 900; font-size: var(--t-hero); line-height: .8; letter-spacing: -.025em; color: var(--next-fig); margin: 3px 0 10px -3px; }
.hero small { font-size: .27em; letter-spacing: 0; margin-left: 5px; }
.nx h2 { font-size: 22px; font-weight: 750; line-height: 1.15; letter-spacing: -.01em; }
.nx .who { font-size: 16px; font-weight: 600; margin-top: 3px; }
.nx .note { font-size: 14.5px; color: var(--next-ink-2); margin-top: 2px; font-weight: 500; }

/* Fact rows: a label, the fact, a small note. Who has the children, who is
   home tonight, the working facts of dinner, every page of the Family book. */
.facts > div { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; min-height: 44px; padding: 7px var(--pad); border-top: 1px solid var(--line); }
.facts > div:first-child { border-top: 0; }
.facts dt { font-family: var(--font-figures); font-weight: 800; font-size: 15px; color: var(--ink-2); line-height: 1.15; }
.facts dd { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 650; line-height: 1.25; }
.facts dd small { display: block; font-size: var(--t-sub); font-weight: 450; color: var(--ink-2); }
.facts .end { font-size: var(--t-sub); color: var(--ink-2); font-weight: 550; text-align: right; }
.facts .fig { font-size: 24px; line-height: 1; font-weight: 900; }

/* Needs you: one line each; a line opens to the reason, its source, and
   answers that fit the question. data-state on the <details> picks the view:
   open (the question), write (a text Kotona wrote), asked, settled. */
.ny { border-top: 1px solid var(--line); }
.ny > summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 14px; column-gap: 10px; align-items: center; min-height: 56px; padding: 8px var(--pad); }
.ny-t { font-weight: 750; font-size: 16px; line-height: 1.2; }
.ny-w { display: block; font-size: var(--t-sub); font-weight: 550; color: var(--ink-2); margin-top: 2px; }
.ny-w:empty { display: none; }
.ny-b { padding: 0 var(--pad) 16px; }
.ny [data-view] { display: none; }
.ny[data-state="open"] [data-view="open"],
.ny[data-state="write"] [data-view="write"],
.ny[data-state="asked"] [data-view="asked"],
.ny[data-state="settled"] [data-view="settled"] { display: block; }
.ny[data-state="asked"] .dp { background: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.ny[data-state="settled"] .dp { background: var(--surface-2); color: var(--ink-2); }
.ny[data-state="settled"] .ny-t { font-weight: 550; color: var(--ink-2); text-decoration: line-through; }
.why { font-size: var(--t-body); line-height: 1.4; }
.src { font-family: var(--font-mono); font-size: var(--t-min); letter-spacing: -.03em; color: var(--ink-2); margin-top: 8px; line-height: 1.4; }
/* a source that is a photograph: the picture, small, beside its line */
.srcp { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.srcp .pic { width: 56px; height: 56px; flex: none; }
.srcp .src { margin-top: 0; }
/* a text Kotona wrote for her to send from her own phone */
.msg-to { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; }
.msg { margin-top: 8px; padding: 12px 14px; background: var(--surface-2); border-left: var(--rule) solid var(--ink); font-size: var(--t-body); line-height: 1.4; }
.msg a { font-family: var(--font-mono); font-size: 14px; letter-spacing: -.03em; color: var(--accent); white-space: nowrap; }

/* Answers: at least 48px tall (these are 52), set apart, two across on a phone.
   Every answer has the same weight; none is the "right" one.
   .go is the one press that does something outside Kotona. .q is "Later". */
.ans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.a { display: flex; align-items: center; gap: 9px; min-height: var(--ans); padding: 6px 12px; border: 0; border-radius: var(--radius-m); background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); font-weight: 700; font-size: 16px; line-height: 1.15; text-align: left; text-decoration: none; }
.a.go { background: var(--ink); color: var(--surface); box-shadow: none; }
.a.q { background: var(--surface-2); box-shadow: none; }
.a.w { grid-column: 1 / -1; }
.a.c { justify-content: center; text-align: center; }
.a .pb { margin-left: -2px; }

/* The timeline: one list for the whole house. Time, what, who.
   li.q     the standing week: quiet
   li.next  what is next: a signal edge
   li.chg   different from the usual week: an ink edge; put a .flag in it
   li.gap   nobody has it yet: a signal edge, and it also sits in Needs you
   li.todo  a to-do due that day: a box where the time would be
   li.done  struck through
   li.tl-h  a small head inside the list ("To do today") */
.tl > li { position: relative; display: grid; grid-template-columns: var(--tcol) minmax(0, 1fr) auto; column-gap: 10px; align-items: start; min-height: var(--row); padding: 9px var(--pad); border-top: 1px solid var(--line); }
.tl .t { font-family: var(--font-figures); font-weight: 900; font-size: 23px; line-height: 1; letter-spacing: -.01em; white-space: nowrap; padding-top: 1px; }
.tl .t small { font-size: var(--t-min); font-weight: 800; margin-left: 2px; letter-spacing: 0; }
.tl b { display: block; font-weight: 700; font-size: var(--t-body); line-height: 1.25; }
.tl .sub { display: block; font-size: var(--t-sub); color: var(--ink-2); line-height: 1.35; margin-top: 1px; }
.tl .flag, .tl .chip { margin: 4px 0 2px; }
.tl .pbs { align-self: center; }
.tl li.q .t { font-weight: 700; color: var(--ink-2); }
.tl li.q b { font-weight: 550; }
.tl li.next .t { font-weight: 900; color: var(--ink); }
.tl li.next b { font-weight: 700; }
.tl li.next::before, .tl li.gap::before, .tl li.chg::before { content: ""; position: absolute; left: 0; top: -1px; bottom: 0; width: 6px; background: var(--sig); }
.tl li.chg::before { background: var(--flag); }
.tl li.gap .sub { color: var(--ink); font-weight: 650; }
.tl li.todo { align-items: center; }
.tl li.todo b { font-weight: 600; }
.tl li.done b { text-decoration: line-through; color: var(--ink-2); font-weight: 500; }
.tl li.done .t { color: var(--ink-2); }
.tl li.tl-h { display: flex; align-items: center; justify-content: space-between; min-height: 38px; padding-top: 8px; padding-bottom: 6px; background: var(--surface-2); font-family: var(--font-display); font-weight: 800; font-size: 13.5px; letter-spacing: -.01em; }
.tl li.tl-h span { font-family: var(--font-body); font-weight: 550; font-size: var(--t-sub); color: var(--ink-2); letter-spacing: 0; }
/* one row that opens: dinner before 3 pm, then its working facts */
.tl-o { border-top: 1px solid var(--line); }
.tl-o > summary { display: grid; grid-template-columns: var(--tcol) minmax(0, 1fr) 14px; column-gap: 10px; align-items: center; min-height: 60px; padding: 9px var(--pad); }
.tl-o > summary .t { font-family: var(--font-figures); font-weight: 900; font-size: 23px; line-height: 1; white-space: nowrap; }
.tl-o > summary .t small { font-size: var(--t-min); font-weight: 800; margin-left: 2px; }
.tl-o > summary b { display: block; font-weight: 700; line-height: 1.25; }
.tl-o > summary .sub { display: block; font-size: var(--t-sub); color: var(--ink-2); margin-top: 1px; }
.tl-o .facts { border-top: 1px solid var(--line); background: var(--surface-2); }
.tl-o .acts { display: flex; gap: 8px; padding: 10px var(--pad) 14px; background: var(--surface-2); }

/* The week strip: seven days, Monday first. A day carries marks, not a count:
   a helper's marker on the days they come, "Late" for a late night, a .flag
   for anything unusual. .s is the phone's short word, .w the wide one. */
.wk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.wk-d { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-height: 124px; padding: 9px 5px 10px 7px; border-left: 1px solid var(--line); text-decoration: none; color: inherit; min-width: 0; }
.wk-d:first-child { border-left: 0; }
.wk-d .dn { font-family: var(--font-figures); font-weight: 800; font-size: 14px; line-height: 1; }
.wk-d .dt { font-family: var(--font-figures); font-weight: 900; font-size: 26px; line-height: .9; margin-bottom: 3px; }
.wk-d.past { color: var(--ink-2); }
.wk-d.now { background: var(--ink); color: var(--surface); }
.wk-d.now .pb.hp { --pc: var(--surface); color: var(--ink); }
.wk-d.now .flag { background: var(--surface); color: var(--ink); }
.wk-m { display: flex; align-items: center; gap: 5px; max-width: 100%; font-family: var(--font-figures); font-weight: 700; font-size: 13.5px; line-height: 1.15; }
.wk-m .w { display: none; }
.wk-m .pb { width: 22px; height: 22px; font-size: 13.5px; }
.wk-m .flag { padding: 0 4px; }

/* The cover photo, with the family's name on a flat plate. On a phone's Home it runs across the top. */
.cover-b { position: relative; min-height: 180px; }
.cover-b .pic { position: absolute; inset: 0; }
.cover-n { position: absolute; left: 0; top: 0; padding: 9px 14px; background: var(--ink); color: var(--surface); font-family: var(--font-display); font-weight: 800; font-size: 14px; letter-spacing: -.015em; line-height: 1.1; }

/* Totals that can be hidden with one tap (Money). Mark each total with .amt.tot.
   v2.js sets data-totals="hidden" on <html> and keeps the choice on the device. */
.amt { font-family: var(--font-mono); letter-spacing: -.03em; white-space: nowrap; }
:root[data-totals="hidden"] .tot { color: transparent !important; background: var(--mask); border-radius: var(--radius-s); user-select: none; -webkit-user-select: none; }
:root[data-totals="hidden"] .tot * { visibility: hidden; }
.tot-sw { display: inline-flex; align-items: center; gap: 9px; min-height: var(--tap); padding: 0 12px 0 10px; border: 0; border-radius: var(--radius-m); background: none; box-shadow: inset 0 0 0 2px var(--ink); font-weight: 700; font-size: 14.5px; }
.tot-sw::before { content: ""; width: 26px; height: 12px; border-radius: var(--radius-s); background: var(--ink); }
.tot-sw .off, :root[data-totals="hidden"] .tot-sw .on { display: none; }
:root[data-totals="hidden"] .tot-sw .off { display: inline; }
:root[data-totals="hidden"] .tot-sw::before { background: var(--mask); }

/* The closing line: what Kotona read and did, in one sentence. It opens to
   the routine things filed under her rules, each with an undo. */
.closing { margin-top: var(--gap); border-top: 1px solid var(--line); }
.closing > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); padding: 10px var(--pad); font-size: var(--t-sub); color: var(--ink-2); font-weight: 550; line-height: 1.35; }
.filed > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px var(--pad); border-top: 1px solid var(--line); font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.filed small { display: block; font-size: var(--t-sub); font-weight: 450; color: var(--ink-2); }

/* ---------- 7. Tablet and up: the sidebar ---------- */
@media (min-width: 760px) {
  :root { --pad: 18px; --gap: 28px; --tcol: 64px; }
  .app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .rail { display: flex; flex-direction: column; position: sticky; top: 0; z-index: 25; height: 100vh; background: var(--rail); color: var(--rail-ink); padding-top: 22px; }
  .top { display: contents; }
  .logo { padding: 0 20px 14px; }
  .logo svg { height: 30px; }
  .th { margin: 0 12px 12px; padding: 0 10px; gap: 10px; background: var(--rail-field); border-radius: var(--radius-m); font-size: 15px; }
  .th .chev { margin-left: auto; margin-right: 4px; }
  .thp { position: fixed; top: 126px; left: 12px; right: auto; width: 388px; padding: 2px 14px 14px; border: 2px solid var(--ink); }
  .thp-mask { background: none; }
  .tabs { position: static; display: block; order: 1; border: 0; padding: 0; }
  .tabs a { justify-content: space-between; height: 48px; padding: 0 20px; font-size: 15px; }
  .me { order: 3; margin-top: auto; align-items: flex-start; padding: 16px 20px 18px; border-top: 1px solid var(--rail-line); }
  .me span { display: block; }
  /* the add field leaves the bar and runs across the top of the page */
  .add { left: var(--rail-w); bottom: auto; top: 0; height: var(--addbar-h); padding: 10px 28px; align-items: center; background: var(--bg); border-bottom: 1px solid var(--line);
    --f-bg: var(--surface-2); --f-ink: var(--ink); --f-ink-2: var(--ink-2); --f-btn: var(--ink); --f-btn-ink: var(--bg); }
  .add input { max-width: 560px; box-shadow: inset 0 -2px 0 var(--ink); }
  .page { padding: calc(var(--addbar-h) + 14px) 28px 56px; }
  .day { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "d nav" "wx nav"; align-items: center; column-gap: 16px; row-gap: 2px; padding: 0; min-height: 56px; }
  .day { margin-bottom: 12px; }
  .day h1 { grid-area: d; }
  .day .wx { grid-area: wx; }
  .day .nav { grid-area: nav; }
  .day h1 { font-size: 26px; font-weight: 900; }
  .day .wx { font-size: 15px; }
  .day .long { display: inline; }
  .day .short { display: none; }
  .day .nav { gap: 6px; }
  .day .nav .b { box-shadow: inset 0 0 0 2px var(--ink); }
  .day .nav .now { display: inline-flex; }
}

/* ---------- 8. Desktop ---------- */
@media (min-width: 1280px) {
  :root { --rail-w: 224px; }
  .page { padding-left: 36px; padding-right: 36px; max-width: 1400px; }
  .add { padding-left: 36px; }
  .day { display: flex; gap: 18px; }
  .day .wx { padding-top: 5px; }
  .wk-d { min-height: 132px; padding: 12px 12px 14px; }
  .wk-d .dn { font-size: 15px; }
  .wk-m .s { display: none; }
  .wk-m .w { display: inline; }
  .wk-m { font-size: 15px; font-weight: 650; font-family: var(--font-body); }
}

/* ---------- 9. Adding: what Kotona read (add.js) ----------
   Phone: a card that rises above the dock. From tablet up: a card under the add field. */
/* What was just added, on the screen it lands on (Home, Week): a short flash */
@keyframes w-new { 0%, 35% { background-color: var(--sig); color: var(--sig-ink); } 100% { background-color: transparent; } }
.w-new { animation: w-new 2.6s ease-out; }
.adp-mask { position: fixed; inset: 0; z-index: 28; background: var(--mask); }
.adp { position: fixed; left: 0; right: 0; bottom: calc(var(--dock-h) + env(safe-area-inset-bottom)); z-index: 29; max-height: calc(100vh - var(--dock-h) - 40px); overflow: auto;
  padding: 0 var(--pad) 14px; background: var(--surface); color: var(--ink); border-top: var(--rule) solid var(--ink); }
.adp-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; }
.adp-h h2 { font-family: var(--font-display); font-weight: 800; font-size: var(--t-head); letter-spacing: -.015em; line-height: 1.1; }
.adp-x { width: var(--tap); height: var(--tap); margin-right: -12px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--ink); }
.adp > .src { margin: 0 0 6px; }
.adp .facts > div { padding-left: 0; padding-right: 0; grid-template-columns: 64px minmax(0, 1fr) auto; }
.adp-who { display: inline-flex; align-items: center; gap: 6px; }
.adp-who .pb { margin-right: 2px; }
.adp-k { margin-top: 10px; font-family: var(--font-figures); font-weight: 800; font-size: 15px; color: var(--ink-2); }
.adp-to { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.adp-to .a { justify-content: center; text-align: center; min-height: var(--tap); padding: 4px 6px; font-size: 14.5px; }
.adp-to .a[aria-pressed="true"] { background: var(--ink); color: var(--surface); box-shadow: none; }
.adp-f { margin-top: 10px; font-size: var(--t-sub); color: var(--ink-2); line-height: 1.4; }
.adp .ans { margin-top: 12px; }
.adp-photo { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; align-items: center; padding: 4px 0 8px; }
.adp-photo .pic { width: 120px; height: 120px; animation: adp-read 1.1s ease-in-out infinite alternate; }
.adp-photo p { font-size: var(--t-body); line-height: 1.4; }
@keyframes adp-read { from { opacity: 1; } to { opacity: .55; } }
.adp .srcp { margin-top: 0; }
.adp-tl { margin: 10px calc(var(--pad) * -1) 0; }
.adp-tl > li { grid-template-columns: var(--tcol) minmax(0, 1fr) auto; }
.adp-tl .t { font-size: 18px; padding-top: 3px; }
.adp-tl li.todo { align-items: start; }
.adp-note { position: fixed; left: 50%; bottom: calc(var(--dock-h) + 16px); z-index: 35; transform: translateX(-50%); width: min(92vw, 440px); padding: 12px 14px; background: var(--ink); color: var(--surface); font-size: 14.5px; font-weight: 600; line-height: 1.4; border-radius: var(--radius-m); }
@media (min-width: 760px) {
  .adp-mask { background: none; }
  .adp { left: calc(var(--rail-w) + 28px); right: auto; bottom: auto; top: var(--addbar-h); width: 520px; max-height: calc(100vh - var(--addbar-h) - 24px); border: 2px solid var(--ink); border-top-width: var(--rule); }
  .adp-note { bottom: 32px; left: calc(50% + var(--rail-w) / 2); }
}
@media (min-width: 1280px) { .adp { left: calc(var(--rail-w) + 36px); } }

/* ---------- as a picture on a public page (?shot=1) ---------- */
html.shot { scrollbar-width: none; }
html.shot::-webkit-scrollbar { display: none; }
html.shot *, html.shot *::before, html.shot *::after { animation: none !important; transition: none !important; }
