/* Case pages. Two parents, two fixed colours (validated pair, light + dark):
   --me is always the account holder, --other always the co-parent. Text never
   wears those colours — a dot beside the name carries identity. */
:root {
  color-scheme: light;
  --page: #f4f3ee;
  --surface: #fcfcfb;
  --sunk: #efeee8;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7d7b75;
  --hair: #e1e0d9;
  --axis: #c3c2b7;
  --me: #2a78d6;
  --other: #eb6834;
  --good: #0ca30c;
  --good-ink: #006300;
  --warn: #fab219;
  --crit: #d03b3b;
  --mark-late: #fbe3df;
  --mark-warn: #fdf0cf;
  --mark-good: #dff3df;
  --link: #1c5cab;
  --shadow: 0 1px 2px rgba(11, 11, 11, .05), 0 6px 20px rgba(11, 11, 11, .04);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.5 var(--sans);
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.9rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 2.2rem 0 .8rem; }
h3 { font-size: 1.02rem; margin: 1.4rem 0 .5rem; }
p { margin: .5rem 0; }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); }
.dim { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---- frame ------------------------------------------------------------ */
.frame { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
  padding: 1.4rem 1rem 1rem 1.3rem; display: flex; flex-direction: column; gap: 1.2rem;
}
.brand { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; line-height: 1.25; }
.brand span { display: block; font: 400 .78rem/1.35 var(--sans); color: var(--muted); margin-top: .25rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .42rem .65rem; border-radius: 8px; color: var(--ink-2); text-decoration: none;
}
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--surface); }
.nav .count {
  font-size: .74rem; font-variant-numeric: tabular-nums; padding: 0 .42rem; border-radius: 99px;
  background: var(--sunk); color: var(--ink-2);
}
.nav a[aria-current="page"] .count { background: transparent; color: inherit; box-shadow: inset 0 0 0 1px currentColor; }
.nav hr { border: 0; border-top: 1px solid var(--hair); margin: .5rem .3rem; width: auto; }
.asof { margin-top: auto; font-size: .78rem; color: var(--muted); line-height: 1.4; }
.asof b { color: var(--ink-2); font-weight: 600; }
.asof button { margin-top: .5rem; }
main { padding: 2rem clamp(1rem, 3.2vw, 2.8rem) 4rem; max-width: 1180px; width: 100%; }
.lede { color: var(--ink-2); max-width: 68ch; margin: .5rem 0 0; }
.head { margin-bottom: 1.4rem; }
.head .clause {
  display: inline-block; font-size: .78rem; letter-spacing: .02em; color: var(--ink-2);
  background: var(--sunk); border-radius: 99px; padding: .12rem .6rem; margin-bottom: .55rem;
}

@media (max-width: 860px) {
  .frame { display: block; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
          padding: .8rem 1rem .2rem; gap: .6rem 1rem; }
  .brand span, .asof { display: none; }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; padding-bottom: .5rem; }
  .nav a { white-space: nowrap; }
  .nav hr { display: none; }
  main { padding-top: 1rem; }
}

/* ---- pieces ----------------------------------------------------------- */
.card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 1.1rem 1.25rem; }
.card + .card { margin-top: 1rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
.cols > .card + .card { margin-top: 0; }
.cols + .card, .card + .cols, .cols + .cols { margin-top: 1rem; }

.who { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.who::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--muted); flex: none; }
.who.me::before { background: var(--me); }
.who.other::before { background: var(--other); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: .9rem 1.4rem; margin: .7rem 0 .2rem; }
.tile .label { font-size: .8rem; color: var(--ink-2); }
.tile .value { font-size: 1.75rem; font-weight: 600; line-height: 1.15; letter-spacing: -.01em; }
.tile .sub { font-size: .8rem; color: var(--muted); }
.tile .value .unit { font-size: .95rem; font-weight: 500; color: var(--ink-2); margin-left: .15rem; }

/* highlighter marks: the accent device (no stripes, no rules) */
.mark { padding: .05em .32em; border-radius: .3em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.mark.late { background: var(--mark-late); }
.mark.warn { background: var(--mark-warn); }
.mark.good { background: var(--mark-good); }

.pill {
  display: inline-flex; align-items: center; gap: .32rem; white-space: nowrap;
  font-size: .8rem; padding: .08rem .55rem .08rem .45rem; border-radius: 99px;
  background: var(--sunk); color: var(--ink);
}
.pill::before { font-size: .72rem; line-height: 1; }
.pill.on_time::before, .pill.paid_on_time::before, .pill.ok::before { content: "✓"; color: var(--good-ink); font-weight: 700; }
.pill.late, .pill.paid_late, .pill.overdue { background: var(--mark-late); }
.pill.late::before, .pill.paid_late::before, .pill.overdue::before { content: "●"; color: var(--crit); }
.pill.none::before, .pill.refused::before { content: "○"; color: var(--crit); font-weight: 700; }
.pill.none, .pill.refused, .pill.warnlevel { background: var(--mark-warn); }
.pill.warnlevel::before { content: "!"; font-weight: 700; }
.pill.pending::before, .pill.open::before, .pill.unconfirmed::before { content: "…"; color: var(--ink-2); font-weight: 700; }
.pill.info::before { content: "i"; color: var(--ink-2); font: italic 700 .8rem var(--serif); }
.tag { display: inline-block; font-size: .74rem; color: var(--ink-2); background: var(--sunk); border-radius: 5px; padding: 0 .4rem; margin: 0 .2rem .2rem 0; text-decoration: none; }
a.tag:hover { color: var(--ink); }
.screen { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.screen.reviewed { color: var(--good-ink); }
.screen.proposed { color: var(--ink-2); text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.callnote { display: block; font-size: .84rem; color: var(--ink-2); max-width: 62ch; margin-top: .2rem; }
.callnote b { font-weight: 600; color: var(--ink); }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 1rem 0; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--sunk); border-radius: 10px; padding: 3px; gap: 2px; }
.seg a { padding: .3rem .7rem; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: .86rem; white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(11, 11, 11, .12); }
.seg .n { font-variant-numeric: tabular-nums; color: var(--muted); margin-left: .25rem; }

.tablewrap { overflow-x: auto; margin: 0 -1.25rem; padding: 0 1.25rem; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: .78rem; padding: .35rem .7rem .35rem 0; border-bottom: 1px solid var(--axis); white-space: nowrap; vertical-align: bottom; }
td { padding: .55rem .7rem .55rem 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
td .subject { font-weight: 550; color: var(--ink); text-decoration: none; }
td .subject:hover { text-decoration: underline; }
td .snip { display: block; color: var(--ink-2); font-size: .84rem; max-width: 62ch; }
.id { font: .76rem ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--muted); }
.empty { color: var(--muted); padding: .8rem 0; }

button, .btn {
  font: inherit; font-size: .86rem; cursor: pointer; border-radius: 8px; padding: .34rem .75rem;
  border: 1px solid var(--axis); background: var(--surface); color: var(--ink); text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { border-color: var(--ink-2); }
button.primary, .btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
button.quiet { border-color: transparent; background: transparent; color: var(--ink-2); padding-inline: .45rem; }
button.quiet:hover { background: var(--sunk); color: var(--ink); }
input[type=text], input[type=date], input[type=search], select, textarea {
  font: inherit; font-size: .9rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px; padding: .36rem .55rem; max-width: 100%;
}
textarea { width: 100%; min-height: 15rem; line-height: 1.5; resize: vertical; }
:focus-visible { outline: 2px solid var(--me); outline-offset: 2px; }
form.inline { display: inline-flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
td form.inline { flex-wrap: nowrap; gap: 0; }

details.method { margin-top: 1.4rem; color: var(--ink-2); font-size: .88rem; }
details.method summary { cursor: pointer; color: var(--ink); }
details.method li { margin: .3rem 0; max-width: 78ch; }

/* ---- clocks (Today) ---------------------------------------------------- */
.clock { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem 1rem; padding: .7rem 0; border-bottom: 1px solid var(--hair); }
.clock:last-child { border-bottom: 0; padding-bottom: .2rem; }
.clock .what a { font-weight: 550; color: var(--ink); text-decoration: none; }
.clock .what a:hover { text-decoration: underline; }
.clock .when { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.clock .detail { grid-column: 1 / -1; color: var(--ink-2); font-size: .86rem; }
.banner { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; background: var(--mark-warn); border-radius: 12px; padding: .7rem 1rem; margin-bottom: 1rem; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1.2rem; margin: .4rem 0; }
.kv dt { color: var(--muted); font-size: .86rem; }
.kv dd { margin: 0; }

/* ---- message ---------------------------------------------------------- */
.msg { padding: 1rem 0; border-bottom: 1px solid var(--hair); }
.msg:last-child { border-bottom: 0; }
.msg.focus { background: var(--sunk); margin: 0 -1.25rem; padding: 1rem 1.25rem; border-radius: 10px; border-bottom: 0; }
.msg header { display: flex; flex-wrap: wrap; gap: .2rem 1rem; align-items: baseline; font-size: .86rem; color: var(--ink-2); }
.msg .body { max-width: 72ch; }
.msg .body p { margin: .55rem 0; }
.cite { font: .8rem/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--sunk); border-radius: 10px; padding: .7rem .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- week strip (Calls) ----------------------------------------------- */
.strip { display: flex; flex-wrap: wrap; gap: 3px; margin: .6rem 0 .4rem; }
.strip a { width: 15px; height: 26px; border-radius: 4px; background: var(--sunk); display: block; }
.strip a.flag { background: var(--warn); }
.strip a.held { background: var(--good); }
.strip a.missed { background: var(--crit); }
.strip a.other { background: var(--muted); }
.strip a.prop, .legend i.prop { opacity: .45; }
.strip a:hover, .strip a:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-size: .8rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; background: var(--sunk); margin-right: .35rem; vertical-align: -1px; }
.legend i.flag { background: var(--warn); } .legend i.held { background: var(--good); }
.legend i.missed { background: var(--crit); } .legend i.other { background: var(--muted); }
.legend i.line { height: 3px; width: 16px; border-radius: 2px; vertical-align: 3px; }
.legend i.me { background: var(--me); } .legend i.oth { background: var(--other); }
.week:target td { background: var(--sunk); }
.week ul { margin: 0; padding: 0; list-style: none; }
.week li { margin-bottom: .35rem; }

/* ---- charts ----------------------------------------------------------- */
.chartbox { position: relative; margin: .4rem 0 .2rem; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--hair); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--me); } .chart .line.s2 { stroke: var(--other); }
.chart .dot { stroke: var(--surface); stroke-width: 2; cursor: default; }
.chart .dot.s1 { fill: var(--me); } .chart .dot.s2 { fill: var(--other); }
.chart .dot.quiet { fill: var(--axis); } .chart .dot.late { fill: var(--crit); }
.chart .dot:hover, .chart .dot:focus { stroke: var(--ink); outline: none; }
.chart .endlabel { fill: var(--ink-2); font: 12px var(--sans); }
.chart .endval { fill: var(--ink); font-weight: 600; }
.chart .limit { stroke: var(--ink-2); stroke-width: 1; }
.chart .limitlabel { fill: var(--ink-2); font: 11px var(--sans); }
.tip {
  position: fixed; z-index: 10; pointer-events: none; max-width: 280px;
  background: var(--ink); color: var(--surface); font-size: .8rem; line-height: 1.35;
  padding: .4rem .6rem; border-radius: 8px; opacity: 0; transition: opacity .08s;
}
.tip.on { opacity: 1; }

/* ---- timeline --------------------------------------------------------- */
.month { font: 600 .8rem var(--sans); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin: 1.6rem 0 .3rem; }
.entry { display: grid; grid-template-columns: 5.4rem minmax(0, 1fr); gap: .1rem .9rem; padding: .6rem 0; border-bottom: 1px solid var(--hair); }
.entry .date { color: var(--ink-2); font-size: .84rem; font-variant-numeric: tabular-nums; }
.entry .kind { font-size: .74rem; color: var(--muted); }
.entry .meta { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.entry .title { font-weight: 550; color: var(--ink); text-decoration: none; }
a.title:hover { text-decoration: underline; }

/* ---- case file -------------------------------------------------------- */
.clause { border-bottom: 1px solid var(--hair); padding: .55rem 0; }
.clause summary { cursor: pointer; display: flex; gap: .8rem; align-items: baseline; list-style: none; }
.clause summary::-webkit-details-marker { display: none; }
.clause .no { font: 600 .95rem var(--serif); color: var(--muted); min-width: 2.2rem; }
.clause .t { font-weight: 550; }
.clause p { margin: .5rem 0 .3rem 3rem; color: var(--ink-2); max-width: 76ch; }
.doctext { white-space: pre-wrap; font: .88rem/1.6 var(--sans); max-width: 80ch; }

/* ---- print: the report leaves the chrome behind ------------------------ */
@media print {
  :root { --page: #fff; --surface: #fff; --shadow: none; }
  .side, .bar, .noprint { display: none !important; }
  .frame { display: block; }
  main { padding: 0; max-width: none; }
  body { font-size: 10.5pt; }
  .card { padding: 0; margin-top: 1.2rem; break-inside: auto; }
  .tablewrap { overflow: visible; margin: 0; padding: 0; }
  tr { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  h2 { break-after: avoid; }
}
