/*
  OUR LIFE app, refined look. RUNTIME: browser, static file on Cloudflare Pages. PERMANENT.
  Written 16 Oct 2026 (MO: "looks a little childish, can we sophisticate it a bit").

  Loaded LAST on every page under /app/, after shared.css and any page's own <style>,
  so it wins on equal selectors. It changes the look only: colours, type, spacing,
  the page links (text tabs instead of icon tiles) and section headers.
  Emojis are taken out of headings, labels and buttons by sections.js (SEC.plain),
  never out of data.

  What breaks it: a page that stops loading this file keeps the old look, nothing
  else. How MO would notice: that page has emoji tiles and a sans-serif title again.
  Rollback: delete the <link href="/app/refined.css"> line from the pages.
*/
:root {
  --bg: #F7F4EF; --card: #FFFFFF; --line: #E7E1D8; --ink: #22201E; --soft: #857E75;
  --accent: #2F5D5A; --good: #4D7A62; --warn: #A8722A; --bad: #A4433B; --bar: #EFEAE3;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171615; --card: #201E1C; --line: #34302C; --ink: #EDE8E1; --soft: #9C948A;
          --accent: #8DBDB7; --good: #8CBFA0; --warn: #D9A25A; --bad: #E07A70; --bar: #2A2724; }
}

html, body { background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
main { max-width: 680px; padding-top: max(24px, env(safe-area-inset-top)); }

/* Title: a serif display line, quiet subtitle. */
header { margin: 10px 0 6px; align-items: flex-start; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1.05; letter-spacing: -0.3px; }
.sub { font-size: 12.5px; margin-top: 6px; }
.who { width: 36px; height: 36px; font-family: var(--serif); font-weight: 600; font-size: 17px; }
@media (max-width: 420px) { h1 { font-size: 34px; } }

/* Page links: text in a 4-across grid (6 on wider screens) with an underline on the open page,
   so every page shows without swiping (MO 16 Oct). */
/* Centred rows that wrap, so a short last row sits in the middle (MO 17 Oct 2026).
   14px between links (was 18), so each row fits a 375px phone and Hours and Wellness no
   longer sit alone on a line (21 Oct 2026). */
nav.apps { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 14px; overflow: visible; margin: 18px 0 22px; padding: 0; }
nav.apps::-webkit-scrollbar { display: none; }
nav.apps .brk { flex-basis: 100%; height: 0; }  /* end of a row: every day / home / fun and people */
nav.apps a { display: block; justify-self: center; text-align: center; white-space: nowrap; padding: 6px 0 8px; margin-bottom: -1px; border: 0; border-bottom: 1.5px solid transparent;
  border-radius: 0; background: none; color: var(--soft); font-size: 13px; font-weight: 500; overflow: visible; }
nav.apps a.on { color: var(--ink); border-color: var(--ink); }
nav.apps img, nav.apps .ico { display: none; }
/* 28 Oct 2026: main pills on one row, the rest in one sideways-swiping row (sections.js nav). */
nav.apps { display: block; margin: 14px 0 16px; }
nav.apps .mainrow { display: flex; justify-content: center; gap: 10px; margin-bottom: 8px; }
nav.apps .mainrow a.main { margin: 0; }
/* MO 28 Oct 2026: no sideways swiping. The other pages sit in a tidy grid, four across, all visible. */
/* Centred (MO 28 Oct 2026): equal quarter-width cells in centred rows, so the short last row sits in the middle. */
nav.apps .morerow { display: flex; flex-wrap: wrap; justify-content: center; padding: 0 2px; }
nav.apps .morerow a { flex: 0 0 25%; text-align: center; padding: 5px 0 6px; font-size: 13px; letter-spacing: .1px; overflow: hidden; text-overflow: ellipsis; }
/* Today, Coming up, To-dos: the every-day three, as outlined pills on their own row; the open one fills (MO 24 Oct 2026). */
nav.apps a.main { font-size: 14.5px; font-weight: 600; color: var(--ink); padding: 7px 16px; margin: 0 0 10px; border: 1px solid var(--line, #E6DED5); border-radius: 999px; }
nav.apps a.main.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
/* Small line drawing before each tab name, in the tab's own colour (MO 2 Nov 2026). */
nav.apps svg.ln { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; fill: none; stroke: var(--c, currentColor);
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
nav.apps a.main svg.ln { width: 15px; height: 15px; vertical-align: -2.5px; }
/* 5 Nov 2026 (MO: "combine tabs on top and group ... taking up more and more of the screen"):
   the other pages fold into three group buttons on one row; tapping one opens its pages below. */
nav.apps .mainrow a.main { margin: 0; padding: 6px 14px; }
nav.apps .grprow { display: flex; justify-content: center; gap: 8px; }
nav.apps .grpbtn { display: inline-flex; align-items: center; gap: 2px; font: inherit; font-size: 13px; font-weight: 500; color: var(--soft);
  background: none; border: 0; border-bottom: 1.5px solid transparent; padding: 5px 4px 6px; cursor: pointer; white-space: nowrap; }
nav.apps .grpbtn.on { color: var(--ink); border-color: var(--ink); }
nav.apps .grpbtn .chev { width: 13px; height: 13px; margin-left: 2px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
nav.apps .grpbtn.grp-open .chev { transform: rotate(180deg); }
nav.apps .grpbtn.grp-open { color: var(--ink); }
nav.apps .grppanel { display: none; flex-wrap: wrap; justify-content: center; gap: 2px 16px; margin: 6px 4px 0; padding: 6px 8px; border: 1px solid var(--line, #E6DED5); border-radius: 12px; background: var(--card); }
nav.apps .grppanel.grp-open { display: flex; }
nav.apps .grppanel a { padding: 6px 2px 7px; font-size: 13.5px; }

/* Cards: softer corners, more air, hairlines instead of boxes inside. */
.card { border-radius: 14px; padding: 18px; margin-bottom: 12px; box-shadow: none; }
.label { color: var(--soft); font-size: 10.5px; font-weight: 600; letter-spacing: 1.6px; margin-bottom: 8px; }
html details.fold > summary { font-weight: 500; }
html details.fold > summary .label { color: var(--ink); }
html details.fold > summary .n { font-weight: 500; }
html details.fold > summary::after { content: ''; width: 7px; height: 7px; border-right: 1.5px solid var(--soft); border-bottom: 1.5px solid var(--soft);
  transform: rotate(45deg); margin: -4px 2px 0 4px; transition: transform .2s; flex: none; }
html details.fold[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
html p.intro { font-size: 13px; margin: 0 0 18px; }

.row { padding: 12px 0; }
.row .t { font-weight: 500; }
.row .r { font-weight: 500; }
.big, .acct .big { font-family: var(--serif); font-weight: 600; font-size: 32px; letter-spacing: 0; font-variant-numeric: lining-nums tabular-nums; }
.soon { color: var(--warn); font-weight: 600; }

/* Chips and pills: small, flat, no colour blocks. */
.chip, .pill, .tag { font-weight: 600; font-size: 10.5px; letter-spacing: .4px; border-radius: 99px; padding: 1px 8px; }

/* Buttons and links: outlined, ink, never bright. */
a.link { border-color: var(--line); color: var(--ink); border-radius: 99px; font-weight: 500; padding: 6px 14px; }
.add { color: var(--ink); border-radius: 99px; font-weight: 500; }
.btn, .save { border-width: 1px; border-radius: 99px; font-weight: 600; }
.pair button, nav.tabs button, .filters button { border-radius: 99px; font-weight: 500; }
nav.tabs button.on, .filters button.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
input.find, input[type=search], dialog select, dialog input, dialog textarea { border-radius: 10px; }
dialog { border-radius: 16px; }
dialog h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; }

footer { font-size: 11.5px; letter-spacing: .3px; margin-top: 28px; }

/* Edit boxes on a phone (MO 18 Oct 2026: "difficult to edit through the screen").
   Text in the boxes stays 16px: below that an iPhone zooms the page in on every tap.
   Save and Cancel stay pinned at the bottom of the box, so no hunting for them. */
dialog { max-height: calc(100dvh - 24px); overflow: auto; padding: 16px 16px 0; width: min(94vw, 460px); }
dialog h2 { font-size: 21px; margin: 0 0 2px; }
dialog label { margin: 10px 0 3px; font-size: 11.5px; }
dialog select, dialog input, dialog textarea { font-size: 16px; padding: 9px 11px; }
dialog textarea { resize: vertical; min-height: 44px; line-height: 1.4; }
dialog .hint { font-size: 11.5px; }
dialog .flds { display: grid; grid-template-columns: 1fr 1fr; column-gap: 10px; }
dialog .fld { grid-column: 1 / -1; min-width: 0; }
dialog .fld.half { grid-column: auto; }
dialog form > .acts:last-child { position: sticky; bottom: 0; z-index: 1; background: var(--card); margin: 12px -16px 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
dialog form > .acts:not(:last-child) { margin-top: 10px; }
dialog .err:empty { display: none; }

/* A link styled as an .add button (Share to Long Table, 25 Oct 2026). */
a.add { text-decoration: none; display: inline-block; }

/* Money in green, money out red (MO 25 Oct 2026). .pos was set on amounts but never styled. */
.row .r.pos { color: var(--good); }
.row .r.neg { color: var(--bad); }
/* Each drawing carries its own muted tint (sections.js TINT); on the filled open pill it goes light. */
svg.ln { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--c, currentColor); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
nav.apps a.main.on svg.ln { stroke: currentColor; }
/* Drawings that replace an emoji at the start of a label, link or button (sections.js GLYPH). */
svg.ln.g { width: 15px; height: 15px; margin-right: 7px; vertical-align: -3px; }
.label svg.ln.g { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2.5px; }
