/* Simen: the family app's design system (spec, section 13), in the colours of the brand guide.
   One typeface (Nunito), four sizes, eight colours, three cards, one icon family. */

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("fonts/nunito-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("fonts/nunito-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */

:root {
  /* The eight colours: the brand's five on a warm cream ground.
     Forest (#4A6F61) acts; sage marks what is done and the creche; sun is "now"; coral is affection; sky is TV and information. */
  --ground: #fbf7f1;
  --surface: #ffffff;
  --ink: #24352e;
  --accent: #4a6f61;
  --sage: #8fb89f;
  --sun: #f7c56b;
  --coral: #f39b8b;
  --sky: #a7c7e7;

  /* Neutrals and inks drawn from those colours (text on a tint must stay AA) */
  --muted: #5f6b64;
  --line: #eee6da;
  --accent-ink: #3d5e52;
  --on-accent: #ffffff;
  --sage-ink: #2e6b4c;
  --sun-ink: #8a5a12;
  --coral-ink: #a4483a;
  --sky-ink: #36608a;

  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --sage-soft: color-mix(in srgb, var(--sage) 20%, var(--surface));
  --sun-soft: color-mix(in srgb, var(--sun) 28%, var(--surface));
  --coral-soft: color-mix(in srgb, var(--coral) 22%, var(--surface));
  --sky-soft: color-mix(in srgb, var(--sky) 24%, var(--surface));
  --hover: color-mix(in srgb, var(--ink) 4%, transparent);
  --press: color-mix(in srgb, var(--ink) 8%, transparent);

  /* Caution is the sun's ink, never red (spec: no alarm colours). */
  --amber: var(--sun-ink);
  --amber-soft: var(--sun-soft);

  /* The four sizes (rem, so the system font size wins) */
  --fs-s: 0.8125rem;
  --fs-m: 0.9375rem;
  --fs-l: 1.1875rem;
  --fs-xl: 1.75rem;

  --r-small: 10px;
  --r-field: 12px;
  --r-control: 14px;
  --r-tile: 16px;
  --r-sheet: 18px;
  --r-card: 22px;
  --r-pill: 999px;

  --shadow: 0 1px 2px rgb(36 53 46 / 0.05), 0 10px 28px -14px rgb(36 53 46 / 0.16);
  --shadow-lift: 0 2px 4px rgb(36 53 46 / 0.06), 0 18px 40px -16px rgb(36 53 46 / 0.26);
  --shadow-accent: 0 8px 18px -8px color-mix(in srgb, var(--accent) 55%, transparent);
  --shadow-press: 0 1px 2px rgb(36 53 46 / 0.08), 0 2px 8px -2px rgb(36 53 46 / 0.12);
  --shadow-knob: 0 1px 3px rgb(0 0 0 / 0.25);
  --knob: #ffffff;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 160ms;
  --slow: 240ms;

  --tabbar-h: 68px;

  color-scheme: light;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 100%;
  color: var(--ink);
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
  accent-color: var(--accent);
}

/* Dark: a green night. The pastel brand colours work as they are on it; sage takes over the actions. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #141b17;
    --surface: #1b241f;
    --ink: #e8efea;
    --accent: #8fb89f;
    --muted: #a6b3ab;
    --line: #2b3630;
    --accent-ink: #b5d3c0;
    --on-accent: #12201a;
    --sage-ink: #a9d1b8;
    --sun-ink: #f7c56b;
    --coral-ink: #f39b8b;
    --sky-ink: #a7c7e7;
    --accent-soft: color-mix(in srgb, var(--sage) 16%, var(--surface));
    --sage-soft: color-mix(in srgb, var(--sage) 16%, var(--surface));
    --sun-soft: color-mix(in srgb, var(--sun) 14%, var(--surface));
    --coral-soft: color-mix(in srgb, var(--coral) 14%, var(--surface));
    --sky-soft: color-mix(in srgb, var(--sky) 14%, var(--surface));
    --hover: color-mix(in srgb, var(--ink) 6%, transparent);
    --press: color-mix(in srgb, var(--ink) 11%, transparent);
    --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 10px 28px -16px rgb(0 0 0 / 0.6);
    --shadow-lift: 0 18px 40px -16px rgb(0 0 0 / 0.7);
    --shadow-accent: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ground: #141b17;
  --surface: #1b241f;
  --ink: #e8efea;
  --accent: #8fb89f;
  --muted: #a6b3ab;
  --line: #2b3630;
  --accent-ink: #b5d3c0;
  --on-accent: #12201a;
  --sage-ink: #a9d1b8;
  --sun-ink: #f7c56b;
  --coral-ink: #f39b8b;
  --sky-ink: #a7c7e7;
  --accent-soft: color-mix(in srgb, var(--sage) 16%, var(--surface));
  --sage-soft: color-mix(in srgb, var(--sage) 16%, var(--surface));
  --sun-soft: color-mix(in srgb, var(--sun) 14%, var(--surface));
  --coral-soft: color-mix(in srgb, var(--coral) 14%, var(--surface));
  --sky-soft: color-mix(in srgb, var(--sky) 14%, var(--surface));
  --hover: color-mix(in srgb, var(--ink) 6%, transparent);
  --press: color-mix(in srgb, var(--ink) 11%, transparent);
  --shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 10px 28px -16px rgb(0 0 0 / 0.6);
  --shadow-lift: 0 18px 40px -16px rgb(0 0 0 / 0.7);
  --shadow-accent: none;
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font-size: var(--fs-m);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
h1 { font-size: var(--fs-xl); line-height: 1.15; font-weight: 850; letter-spacing: -0.015em; text-wrap: balance; }
h2 { font-size: var(--fs-l); line-height: 1.3; font-weight: 800; letter-spacing: -0.005em; text-wrap: balance; }
h3 { font-size: var(--fs-m); line-height: 1.4; font-weight: 800; }
p { text-wrap: pretty; }
strong { font-weight: 750; }

a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { text-decoration-color: currentColor; }

::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--ink); }
input, textarea { caret-color: var(--accent); }
* { scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; scrollbar-width: thin; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: var(--r-small); }

.icon { flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-s); }
.num, time { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Shell and navigation ---------- */

.shell { min-height: 100dvh; }

.content {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
  align-content: start;
}

.shell.simple .content { padding-bottom: 40px; max-width: 460px; }

.nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.nav-brand, .nav-more { display: none; }

.nav-main { display: flex; justify-content: space-around; max-width: 560px; margin: 0 auto; }

.tab {
  flex: 1;
  max-width: 120px;
  min-height: 56px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-s);
  font-weight: 650;
  border-radius: var(--r-control);
}
.tab .tab-icon { width: 56px; height: 30px; display: grid; place-items: center; border-radius: var(--r-pill); transition: background var(--fast) var(--ease), color var(--fast) var(--ease); }
.tab:hover .tab-icon { background: var(--hover); }
.tab.active { color: var(--ink); font-weight: 750; }
.tab.active .tab-icon { background: var(--accent-soft); color: var(--accent); }

@media (min-width: 960px) {
  .shell:not(.simple) { display: grid; grid-template-columns: 248px 1fr; }
  .shell:not(.simple) .content { max-width: 720px; padding: 40px 32px 64px; }

  .nav {
    position: sticky;
    inset: 0 auto auto 0;
    align-self: start;
    height: 100dvh;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; font-weight: 700; font-size: var(--fs-l); letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
  .nav-main, .nav-more { display: grid; gap: 2px; margin: 0; max-width: none; }
  .nav-more { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
  .tab {
    max-width: none;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    font-size: var(--fs-m);
  }
  .tab .tab-icon { width: auto; height: auto; background: none !important; }
  .tab:hover { background: var(--hover); }
  .tab.active { background: var(--accent-soft); color: var(--accent-ink); }
  .tab.active .tab-icon { color: var(--accent); }
}


/* ---------- Page header ---------- */

.page-head { display: grid; gap: 4px; padding: 4px 2px 6px; }
.page-head .sub { color: var(--muted); }
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.back {
  display: inline-flex; align-items: center; gap: 2px;
  min-height: 44px; margin: -8px 0 -6px -8px; padding: 0 10px 0 4px;
  color: var(--muted); text-decoration: none; font-weight: 650; border-radius: var(--r-control);
  justify-self: start;
}
.back:hover { color: var(--ink); background: var(--hover); }

.subnav { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); justify-self: start; margin-top: 6px; }
.subnav a { min-height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: var(--r-pill); color: var(--muted); text-decoration: none; font-weight: 600; font-size: var(--fs-s); }
.subnav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.subnav a:not([aria-current="page"]):hover { background: var(--hover); color: var(--ink); }

/* Hoje's header: greeting, child, date, and the menu behind the avatar */
.today-top { display: flex; align-items: center; gap: 12px; padding: 2px 2px 2px; }
.today-top .who { flex: 1; min-width: 0; display: grid; gap: 2px; }
.today-top .greet { color: var(--muted); font-size: var(--fs-s); font-weight: 650; }
.today-top h1 { overflow-wrap: anywhere; }

.avatar {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 700; font-size: var(--fs-m);
}

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; border-radius: 50%; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover .avatar { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  width: min(260px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sheet);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  display: grid;
  animation: pop var(--fast) var(--ease);
  transform-origin: top right;
}
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 12px;
  min-height: 46px; padding: 0 12px;
  border: 0; border-radius: var(--r-field); background: none;
  color: var(--ink); text-decoration: none; font: inherit; font-weight: 650; text-align: left; width: 100%;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--hover); }
.menu-panel .icon { color: var(--muted); }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(-4px); } }

/* ---------- Cards: raised, highlight, tile ---------- */

.card {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}
:root[data-theme="dark"] .card { border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card { border: 1px solid var(--line); } }

.card.now { background: var(--sun-soft); box-shadow: none; border: 0; }
.card.now h2 { color: var(--ink); }

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-head .icon-chip + span, .card-head h2 span { min-width: 0; }

.icon-chip {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-small);
  background: var(--accent-soft);
  color: var(--accent);
}
.card.now .icon-chip { background: var(--surface); }
.icon-chip.sage { background: var(--sage-soft); color: var(--sage-ink); }
.icon-chip.sun { background: var(--sun-soft); color: var(--sun-ink); }
.icon-chip.coral { background: var(--coral-soft); color: var(--coral-ink); }
.icon-chip.sky { background: var(--sky-soft); color: var(--sky-ink); }
.icon-chip.amber { background: var(--amber-soft); color: var(--amber); }

.tile-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-s); font-weight: 600; }
.tile-label .icon { color: var(--accent); }
.tile-value { font-size: var(--fs-l); font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tile-value small { font-size: var(--fs-s); font-weight: 650; color: var(--muted); margin-left: 2px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 359px) { .grid-2 { grid-template-columns: 1fr; } }

/* Meta lines, badges and pills */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: var(--fs-s); font-weight: 650; }
.meta > span { display: inline-flex; align-items: center; gap: 5px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 26px; padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-s); font-weight: 750;
  background: var(--accent-soft); color: var(--accent-ink);
  white-space: nowrap;
}
.badge.sage { background: var(--sage-soft); color: var(--sage-ink); }
.badge.coral { background: var(--coral-soft); color: var(--coral-ink); }
.badge.sky { background: var(--sky-soft); color: var(--sky-ink); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.plain { background: var(--ground); color: var(--muted); }

.pills { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pills li {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--ground); color: var(--ink);
  font-size: var(--fs-s); font-weight: 650;
}
.pills li.missing { background: var(--amber-soft); color: var(--amber); }
.card.now .pills li { background: var(--surface); }

/* ---------- Buttons ---------- */

button, .button {
  appearance: none;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: var(--r-control);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
button:hover, .button:hover { background: color-mix(in srgb, var(--ink) 3%, var(--surface)); border-color: color-mix(in srgb, var(--ink) 14%, var(--line)); }
button:active, .button:active { transform: scale(0.97); }
button:disabled, button[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.primary, button.primary, a.button.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}
.primary:hover, button.primary:hover, a.button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); border-color: transparent; }
.block, button.block, a.button.block { width: 100%; min-height: 52px; }

button.ghost, .button.ghost { background: transparent; border-color: transparent; color: var(--accent-ink); }
button.ghost:hover, .button.ghost:hover { background: var(--accent-soft); }

button.link {
  min-height: 44px; min-width: 0; padding: 0 8px;
  background: transparent; border: 0; box-shadow: none;
  color: var(--muted); font-weight: 600;
}
button.link:hover { color: var(--ink); background: var(--hover); }

button.danger { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); }
button.danger:hover { background: var(--amber-soft); }

button.icon-btn { padding: 0; width: 44px; border-radius: 50%; }
button.icon-btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
button.icon-btn.quiet:hover { background: var(--hover); color: var(--ink); }

button.undo { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--surface); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions > * { flex: 1 1 auto; }
.actions > .primary { flex: 1.6 1 auto; }
.actions.end { justify-content: flex-end; }
.actions.end > * { flex: 0 0 auto; }

/* Toggles (aria-pressed) and the segmented group that holds them */
button.toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent-ink);
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: color-mix(in srgb, var(--ink) 5%, var(--surface));
  border-radius: var(--r-tile);
}
.card .segmented { background: var(--ground); }
.segmented > button {
  flex: 1;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: var(--r-small);
  font-size: var(--fs-s);
}
.segmented > button:hover { background: var(--hover); color: var(--ink); }
.segmented > button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-press);
}

/* ---------- Forms ---------- */

label { font-size: var(--fs-s); font-weight: 600; color: var(--ink); }
.hint { font-size: var(--fs-s); color: var(--muted); font-weight: 450; }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--r-field);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
textarea { padding: 12px 14px; line-height: 1.5; resize: vertical; min-height: 96px; }
select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235f6b64' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink) 18%, var(--line)); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
input:disabled, select:disabled, textarea:disabled { background: var(--ground); color: var(--muted); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
input[type="time"], input[type="date"], input[type="month"], input[type="number"] { font-variant-numeric: tabular-nums; }

input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: var(--fs-s);
  color: var(--muted);
}
input[type="file"]::file-selector-button {
  min-height: 40px; margin-right: 12px; padding: 0 14px;
  border-radius: var(--r-small); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer;
}

.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 380px) { .field-row.wrap { grid-template-columns: 1fr; } }

.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 160px; }
.inline-form button { flex: 0 0 auto; }

.check {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px;
  font-size: var(--fs-m); font-weight: 550;
  cursor: pointer;
}

fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
legend { padding: 0; margin-bottom: 4px; font-size: var(--fs-s); font-weight: 600; }

/* Day and option chips (checkbox chips) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer; }
.chip-check span {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink);
  font-size: var(--fs-s); font-weight: 600;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.chip-check input:checked + span { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-ink); }
.chip-check input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.chip-check input:disabled + span { opacity: 0.55; }

/* Disclosure */
details.more > summary, details.disclosure > summary {
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  border-radius: var(--r-small);
}
details.more > summary::-webkit-details-marker, details.disclosure > summary::-webkit-details-marker { display: none; }
details.more > summary::after, details.disclosure > summary::after {
  content: "";
  width: 20px; height: 20px; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform var(--fast) var(--ease);
}
details[open].more > summary::after, details[open].disclosure > summary::after { transform: rotate(180deg); }
details.more > summary:hover, details.disclosure > summary:hover { color: var(--ink); }
details.more[open] > :not(summary) { animation: fade var(--slow) var(--ease); }
details.disclosure > summary { color: var(--ink); }
details.disclosure > summary h2 { display: flex; align-items: center; gap: 10px; }

@keyframes fade { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Status, callouts, empty and loading ---------- */

.callout {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: var(--fs-m);
}
.callout > .icon { margin-top: 1px; color: var(--accent); }
.callout.amber, .safety { background: var(--ground); box-shadow: inset 0 0 0 1px var(--line); }
.callout.amber > .icon { color: var(--amber); }
.callout.sage { background: var(--sage-soft); }
.callout.sage > .icon { color: var(--sage-ink); }
.callout .callout-body { display: grid; gap: 8px; flex: 1; min-width: 0; }
.callout .callout-body .actions { margin-top: 2px; }

.error {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: var(--amber-soft);
  color: var(--ink);
  font-weight: 650;
}
.error::before {
  content: "";
  width: 20px; height: 20px; flex: none; margin-top: 1px;
  background: var(--amber);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5V13M12 16.5h.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5V13M12 16.5h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

.done-line, .running {
  display: flex; align-items: center; gap: 8px;
  color: var(--sage-ink);
  font-weight: 750;
}
.saved { display: inline-flex; align-items: center; gap: 6px; color: var(--sage-ink); font-weight: 600; font-size: var(--fs-s); }

.undo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.empty {
  display: grid; justify-items: center; text-align: center; gap: 10px;
  padding: 28px 18px;
}
.empty .icon-chip { width: 52px; height: 52px; border-radius: var(--r-tile); }
.empty p { max-width: 36ch; color: var(--muted); }
.empty .actions { width: 100%; max-width: 360px; margin-top: 4px; }

.loading { display: grid; gap: 14px; }
.skeleton {
  border-radius: var(--r-card);
  background: linear-gradient(90deg, color-mix(in srgb, var(--ink) 5%, var(--surface)) 0%, color-mix(in srgb, var(--ink) 9%, var(--surface)) 50%, color-mix(in srgb, var(--ink) 5%, var(--surface)) 100%);
  background-size: 200% 100%;
  /* still: nothing on screen blinks (spec, section 13) */
}
.skeleton.line { height: 14px; border-radius: var(--r-pill); }
.skeleton.title { height: 30px; width: 55%; border-radius: var(--r-small); }
.skeleton.block { height: 120px; }
.skeleton.short { width: 35%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--fs-s);
}
.banner .icon { color: var(--muted); margin-top: 1px; }
.banner.amber { background: var(--amber-soft); border-color: transparent; }
.banner.amber .icon { color: var(--amber); }
.banner button.link { min-height: 32px; padding: 0 6px; margin-left: auto; color: var(--ink); text-decoration: underline; }

/* ---------- Lists ---------- */

.rows { list-style: none; padding: 0; display: grid; }
.rows > li { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 4px; min-width: 0; }
.rows > li:first-child { border-top: 0; padding-top: 2px; }
.rows > li:last-child { padding-bottom: 2px; }
.row-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-main strong { min-width: 0; }

ol.numbered { list-style: none; padding: 0; display: grid; gap: 12px; counter-reset: n; }
ol.numbered > li { counter-increment: n; display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
ol.numbered > li::before {
  content: counter(n);
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: var(--fs-s); font-weight: 700; font-variant-numeric: tabular-nums;
}
ol.numbered[start="2"] { counter-reset: n 1; }

ul.bullets { padding-left: 20px; display: grid; gap: 6px; }
ul.bullets li::marker { color: var(--muted); }

/* Choices: tap a row to pick it */
.choices { list-style: none; padding: 0; display: grid; gap: 8px; }
.choices button {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  min-height: 56px;
  padding: 10px 12px 10px 16px;
  font-weight: 650;
}
.choices button .choice-text { display: grid; gap: 2px; min-width: 0; }
.choices button .choice-text small { color: var(--muted); font-size: var(--fs-s); font-weight: 550; }
.choices button .icon { color: var(--muted); }

/* The daily checklist and the materials at home */
.checklist { list-style: none; padding: 0; display: grid; }
.checklist li + li { border-top: 1px solid var(--line); }
.checklist button {
  width: 100%;
  justify-content: flex-start;
  gap: 14px;
  min-height: 52px;
  padding: 8px 4px;
  border: 0;
  border-radius: var(--r-field);
  background: transparent;
  text-align: left;
  font-weight: 550;
}
.checklist button:hover { background: var(--hover); }
.checklist button:disabled { opacity: 1; cursor: default; }
.checklist .box {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--muted) 45%, var(--line));
  color: transparent;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.checklist button[aria-checked="true"] .box { background: var(--sage-ink); border-color: var(--sage-ink); color: var(--surface); animation: tick var(--slow) var(--ease); }
.checklist button[aria-checked="true"] .label { color: var(--muted); }
.checklist.compact button { min-height: 46px; }
.checklist.columns { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); column-gap: 16px; }
.checklist.columns li + li { border-top: 0; }
@keyframes tick { 40% { transform: scale(1.15); } }

/* The afternoon timeline */
.timeline { list-style: none; padding: 0; display: grid; }
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 52px 18px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 0;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 52px; margin-left: 18.5px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--line);
}
.timeline li:first-child::before { top: 50%; }
.timeline li:last-child::before { bottom: 50%; }
.timeline .when { color: var(--muted); font-size: var(--fs-s); font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline .dot {
  position: relative; z-index: 1;
  width: 12px; height: 12px; margin-left: 3px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid color-mix(in srgb, var(--muted) 50%, var(--line));
}
.timeline .what { font-weight: 650; min-width: 0; }
.timeline .len { color: var(--muted); font-size: var(--fs-s); font-variant-numeric: tabular-nums; }
.timeline li.past .what, .timeline li.past .dot { opacity: 0.55; }
.timeline li.current .dot { width: 16px; height: 16px; margin-left: 1px; border: 0; background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); }
.timeline li.current .what { color: var(--accent-ink); font-weight: 700; }
.timeline li.dropped .what { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.timeline li.dropped .dot { border-style: dashed; }

/* Weekend blocks: a horizontal strip of the day's five moments */
.blocks {
  list-style: none; padding: 2px; margin: 0 -2px;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr);
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.blocks::-webkit-scrollbar { display: none; }
.blocks li { scroll-snap-align: start; }
.blocks button {
  width: 100%; height: 100%;
  display: grid; justify-items: start; align-content: start; gap: 4px;
  padding: 12px 14px;
  text-align: left;
  font-weight: 550;
}
.blocks .when { color: var(--muted); font-size: var(--fs-s); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.blocks .what { font-weight: 750; line-height: 1.3; }
.blocks button[aria-pressed="true"] .when { color: var(--accent-ink); }
.blocks .done { color: var(--sage-ink); }

/* Progress of the current step */
.progress { height: 6px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--sun) 45%, var(--surface)); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--slow) var(--ease); }

/* "Agora": the step, its minutes and the suggestion */
.now-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.now-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent-ink); font-size: var(--fs-s); }
.now-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.now-left { font-weight: 750; font-size: var(--fs-s); color: var(--ink); font-variant-numeric: tabular-nums; }
.now-suggestion { display: flex; gap: 10px; align-items: flex-start; }

/* TV quick log */
.tv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tv-actions button { min-height: 44px; padding: 0 8px; font-variant-numeric: tabular-nums; }

/* ---------- Week ---------- */

.week { list-style: none; padding: 0; display: grid; gap: 12px; }
.day-head { display: flex; align-items: center; gap: 12px; }
.date-chip {
  width: 48px; height: 52px; flex: none;
  display: grid; place-content: center; justify-items: center;
  border-radius: var(--r-control);
  background: var(--ground);
  line-height: 1.05;
}
.date-chip .dow { font-size: var(--fs-s); font-weight: 750; color: var(--muted); text-transform: lowercase; }
.date-chip .dom { font-size: var(--fs-l); font-weight: 700; font-variant-numeric: tabular-nums; }
.week li.today .date-chip { background: var(--accent); color: var(--on-accent); }
.week li.today .date-chip .dow { color: inherit; opacity: 0.85; }
.day-head .day-title { flex: 1; min-width: 0; display: grid; gap: 2px; }
.day-head .day-title strong { font-size: var(--fs-m); }
.day-tools { display: flex; gap: 4px; }

.week li.blocked { background: transparent; box-shadow: none; border: 1.5px dashed var(--line); }
.week li.blocked .date-chip { opacity: 0.6; }
.week .block { display: grid; gap: 4px; }
.week .block + .block { padding-top: 10px; border-top: 1px solid var(--line); }
.slot-name { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-s); font-weight: 750; }
.block-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.block-title a { color: var(--ink); text-decoration: none; font-weight: 750; font-size: var(--fs-l); letter-spacing: -0.01em; line-height: 1.3; }
.block-title a:hover { color: var(--accent-ink); text-decoration: underline; }
.block-title .len { color: var(--muted); font-size: var(--fs-s); white-space: nowrap; font-variant-numeric: tabular-nums; }
.reasons { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.reasons li { min-height: 26px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: var(--r-pill); background: var(--ground); color: var(--muted); font-size: var(--fs-s); font-weight: 650; }

.drag-handle { touch-action: none; cursor: grab; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.week li.dragging { opacity: 0.9; box-shadow: var(--shadow-lift); transform: scale(1.01); }
.week li.drop-target { outline: 2px dashed var(--accent); outline-offset: 3px; }

.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--ground); border-radius: var(--r-control); padding: 12px 14px; display: grid; gap: 2px; }
.stat .v { font-size: var(--fs-l); font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: var(--fs-s); color: var(--muted); font-weight: 650; }

.habits { list-style: none; padding: 0; display: grid; gap: 10px; }
.habits li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.habit-dots { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.habit-dots i { height: 6px; border-radius: var(--r-pill); background: var(--line); }
.habit-dots i.on { background: var(--sage); }
.habits .count { color: var(--muted); font-size: var(--fs-s); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Library ---------- */

.filters { display: grid; gap: 12px; }
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 44px !important; }
.filter-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 420px) { .filter-row { grid-template-columns: 1fr 1fr; } .filter-row > :last-child { grid-column: 1 / -1; } }
.filter-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.library { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.library a.card {
  height: 100%;
  color: inherit; text-decoration: none;
  gap: 8px;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.library a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.library .title { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-l); font-weight: 750; letter-spacing: -0.01em; line-height: 1.3; }
.library .title .icon { color: var(--sun-ink); margin-top: 3px; }
.library .opening { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.library .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }

.result-count { color: var(--muted); font-size: var(--fs-s); font-weight: 600; padding: 0 2px; }

/* ---------- Editable rows (routine steps, play boxes) ---------- */

.edit-list { list-style: none; padding: 0; display: grid; counter-reset: s; }
.edit-list > li {
  counter-increment: s;
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.edit-list > li:first-child { border-top: 0; padding-top: 4px; }
.edit-top { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; }
.edit-top::before {
  content: counter(s);
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ground); color: var(--muted);
  font-size: var(--fs-s); font-weight: 700; font-variant-numeric: tabular-nums;
}
.minutes-field { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-s); font-weight: 600; }
.minutes-field input { width: 76px !important; text-align: center; padding: 0 8px !important; }
.edit-bottom { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; padding-left: 38px; }
/* The flags flow in the same row as the minutes and the controls. */
.edit-flags { display: contents; }
.row-actions { display: flex; gap: 4px; margin-left: auto; }
.row-actions button { width: 40px; min-width: 40px; min-height: 40px; padding: 0; border-radius: var(--r-field); background: var(--surface); }

/* ---------- Photos ---------- */

.photo { display: block; width: 100%; max-height: 240px; border-radius: var(--r-control); object-fit: cover; background: var(--ground); }
.photo-picker { display: grid; gap: 8px; }
.photo-picker .pick {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 14px;
  border: 1.5px dashed color-mix(in srgb, var(--muted) 40%, var(--line));
  border-radius: var(--r-field);
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.photo-picker .pick:hover { border-color: var(--accent); color: var(--accent-ink); }
.photo-picker .pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-picker .pick:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

.upload-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.upload {
  position: relative;
  display: grid; justify-items: start; gap: 6px;
  padding: 14px;
  border: 1.5px dashed color-mix(in srgb, var(--muted) 40%, var(--line));
  border-radius: var(--r-tile);
  background: var(--surface);
  cursor: pointer;
}
.upload:hover { border-color: var(--accent); }
.upload:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.upload strong { font-size: var(--fs-m); }
.upload small { color: var(--muted); font-size: var(--fs-s); }
.upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload .icon { color: var(--accent); }

.source { white-space: pre-wrap; color: var(--muted); font-size: var(--fs-s); background: var(--ground); padding: 12px 14px; border-radius: var(--r-field); max-height: 320px; overflow: auto; }

/* ---------- History ---------- */

.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border-radius: var(--r-pill); padding: 4px; box-shadow: var(--shadow); }
.month-nav strong { font-size: var(--fs-m); }
.month-nav button { border-color: transparent; border-radius: 50%; }

.entries { list-style: none; padding: 0; display: grid; }
.entries li { display: grid; grid-template-columns: 56px 1fr; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.entries li:first-child { border-top: 0; padding-top: 2px; }
.entries .when { color: var(--muted); font-size: var(--fs-s); font-weight: 750; font-variant-numeric: tabular-nums; padding-top: 2px; }
.entries .body { display: grid; gap: 8px; min-width: 0; }
.entries .body .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.entries.milestones .when { color: var(--coral-ink); }

.bars { list-style: none; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 7.5rem 1fr 3.5rem; gap: 10px; align-items: center; font-size: var(--fs-s); }
.bars .label { color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .track { height: 10px; border-radius: var(--r-pill); background: var(--ground); overflow: hidden; }
.bars .fill { display: block; height: 100%; border-radius: inherit; background: var(--sky); }
.bars .value { text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; }

/* ---------- Activity runner ---------- */

.runner {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: var(--surface);
  padding: calc(12px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  animation: rise var(--slow) var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.runner-top { display: flex; align-items: center; gap: 8px; }
.runner-title { flex: 1; min-width: 0; display: grid; }
.runner-title strong { font-size: var(--fs-m); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runner-title span { color: var(--muted); font-size: var(--fs-s); }
.runner-steps { display: flex; gap: 6px; margin: 14px 0 0; }
.runner-steps i { flex: 1; height: 5px; border-radius: var(--r-pill); background: var(--line); transition: background var(--slow) var(--ease); }
.runner-steps i.on { background: var(--accent); }
.runner-notes { display: grid; gap: 8px; margin-top: 16px; }
.runner-step { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 24px 0; max-width: 640px; width: 100%; margin: 0 auto; }
.runner-count { color: var(--accent-ink); font-weight: 700; font-size: var(--fs-s); }
.runner-text { font-size: var(--fs-xl); line-height: 1.3; font-weight: 750; letter-spacing: -0.015em; text-wrap: pretty; animation: fade var(--slow) var(--ease); }
.runner-actions, .runner-reactions { width: 100%; max-width: 640px; margin: 0 auto; }
.runner-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 12px; }
.runner-actions button { min-height: 60px; font-size: var(--fs-l); }
.runner-reactions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.runner-reactions button {
  min-height: 112px;
  display: grid; justify-items: center; align-content: center; gap: 10px;
  padding: 12px 6px;
  border-radius: var(--r-card);
  font-size: var(--fs-m);
}
.runner-reactions button .icon { color: var(--accent); }
.runner-reactions button:first-child .icon { color: var(--coral-ink); }
.runner-reactions button:first-child { background: var(--coral-soft); border-color: transparent; }

/* ---------- Sign-in and first run ---------- */

.welcome { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 32px 8px 8px; }
.welcome p { color: var(--muted); }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: var(--fs-s); font-weight: 600; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* ---------- Additions used across screens ---------- */

.section-title { font-size: var(--fs-m); font-weight: 750; color: var(--muted); padding: 0 2px; }
.stack-tight { display: grid; gap: 8px; min-width: 0; }

.creche-line {
  display: flex; align-items: center; gap: 8px;
  justify-self: start;
  min-height: 36px; padding: 6px 14px 6px 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-s); font-weight: 650;
}
.creche-line .icon { color: var(--sage-ink); }

.tv-actions.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 359px) { .tv-actions.three { grid-template-columns: 1fr 1fr; } }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 12px; border-top: 1px solid var(--line);
  font-size: var(--fs-m); font-weight: 550; cursor: pointer;
}
.switch-row > span { display: grid; gap: 2px; }
button.switch {
  flex: none;
  width: 52px; min-width: 52px; height: 32px; min-height: 32px;
  padding: 3px;
  border: 0; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--muted) 35%, var(--line));
  justify-content: flex-start;
  /* the 44 px target comes from the whole row, which is its label */
}
button.switch span { width: 26px; height: 26px; border-radius: 50%; background: var(--knob); box-shadow: var(--shadow-knob); transition: transform var(--fast) var(--ease); }
button.switch[aria-checked="true"] { background: var(--accent); }
button.switch[aria-checked="true"] span { transform: translateX(20px); }
button.switch:hover { background: color-mix(in srgb, var(--muted) 45%, var(--line)); }
button.switch[aria-checked="true"]:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
button.switch:active { transform: none; }

.icon.inline { display: inline-block; vertical-align: -2px; margin-right: 2px; }
.callout.small-callout { padding: 8px 12px; font-size: var(--fs-s); }
.callout.small-callout > .icon { margin-top: 0; }
.card.stack { gap: 16px; }
.card h3 { margin-top: 6px; }
.card > .done-line, .card > .callout { margin: 0; }
.card.empty { padding: 28px 18px; justify-items: center; }

input.switch-input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 52px; height: 32px; flex: none;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--muted) 35%, var(--line));
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}
input.switch-input::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--knob); box-shadow: var(--shadow-knob);
  transition: transform var(--fast) var(--ease);
}
input.switch-input:checked { background: var(--accent); }
input.switch-input:checked::after { transform: translateX(20px); }

/* Headings that receive focus after navigation (FocusOnNavigate) are not controls: no ring. */
[tabindex="-1"]:focus { outline: none; }

@media (min-width: 960px) {
  .nav-main { justify-content: stretch; }
}
.box-when { display: block; font-weight: 550; letter-spacing: 0; }

/* ---------- Hoje: quick tiles and "Agora" ---------- */

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 960px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tiles .tile { min-height: 132px; align-content: space-between; }
.tile-top { display: grid; gap: 4px; }
.tile-title { font-size: var(--fs-l); font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; overflow-wrap: anywhere; }
button.tile-button {
  display: grid; justify-items: start; align-content: space-between; gap: 6px;
  text-align: left; font-weight: 550;
  height: auto; padding: 14px 16px;
  border-radius: var(--r-card);
}
button.tile-button:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--surface); }
button.tile-button[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.tile-dots { display: flex; gap: 4px; width: 100%; }
.tile-dots i { flex: 1; height: 6px; border-radius: var(--r-pill); background: var(--line); }
.tile-dots i.on { background: var(--sage); }
.tile .tv-actions button { min-height: 44px; }
button.tile-link {
  min-height: 32px; padding: 0; justify-content: flex-start;
  border: 0; background: none; color: var(--accent-ink);
  font-size: var(--fs-s); font-weight: 600; text-align: left;
}
button.tile-link:hover { background: none; text-decoration: underline; }

.now-row { display: flex; align-items: center; gap: 12px; }
.now-row h2 { flex: 1; min-width: 0; }
.now-min { display: inline-flex; align-items: baseline; gap: 3px; color: var(--ink); font-variant-numeric: tabular-nums; }
.now-min strong { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.now-min small { font-size: var(--fs-s); font-weight: 600; }
.card.now .icon-chip { width: 44px; height: 44px; border-radius: var(--r-control); background: var(--surface); color: var(--sun-ink); }
.now-suggestion { font-size: var(--fs-m); }


/* ---------- Week rows ---------- */

.slot-row { display: flex; align-items: center; gap: 8px; }
.slot-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.slot-title { color: var(--ink); text-decoration: none; font-weight: 750; font-size: var(--fs-m); line-height: 1.35; }
.slot-title:hover { color: var(--accent-ink); text-decoration: underline; }
.slot-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: var(--fs-s); font-weight: 650; }
.slot-sub .done-line { gap: 4px; font-size: var(--fs-s); }
.slot-reasons { color: var(--muted); font-size: var(--fs-s); }
.day-tools { margin-left: auto; }

.day-head .day-title strong { overflow-wrap: anywhere; }
.day-tools .icon-btn { width: 40px; min-width: 40px; }

.summary { color: var(--muted); font-weight: 650; padding: 0 2px; }

/* ---------- Week at a glance (Sunday planning) ---------- */

.week-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(96px, 1fr);
  gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -16px; padding: 2px 16px;
}
.week-strip::-webkit-scrollbar { display: none; }
.strip-day {
  scroll-snap-align: start;
  display: grid; align-content: start; gap: 2px;
  min-height: 112px; padding: 12px;
  border-radius: var(--r-tile);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.strip-day:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-1px); }
.strip-day .dow { color: var(--muted); font-size: var(--fs-s); font-weight: 750; }
.strip-day .dom { font-size: var(--fs-l); font-weight: 700; font-variant-numeric: tabular-nums; }
.strip-day .what { font-size: var(--fs-s); font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.strip-day .done-line { font-size: var(--fs-s); gap: 4px; }
.strip-day.today { background: var(--accent-soft); border-color: transparent; }
.strip-day.today .dow, .strip-day.today .dom { color: var(--accent-ink); }
.strip-day.blocked { background: transparent; border-style: dashed; color: var(--muted); }
.week li { scroll-margin-top: 16px; }

@media (min-width: 1200px) {
  .shell:not(.simple) .content:has(.week-strip) { max-width: 1100px; }
  .week-strip { margin: 0; padding: 0; grid-auto-flow: row; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .week { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .week li.weekend { grid-row: span 2; }
}

/* ---------- The family's own photos ---------- */

.photo.tile-photo { height: 64px; max-height: none; border-radius: var(--r-field); }
.photo.memory { max-height: 320px; aspect-ratio: 4 / 3; border-radius: var(--r-tile); box-shadow: var(--shadow); }
button.tile-button { justify-content: stretch; align-items: stretch; }
/* Date and time inputs have a wide intrinsic size: let the grid cell decide. */
.field, .field input, .field select { min-width: 0; }

/* ---------- Last review round ---------- */

.actions.split { flex-wrap: nowrap; }
.actions.split > * { flex: 1 1 0; min-width: 0; }
.actions.split > .primary { flex: 1.6 1 0; }
.tile-action { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-weight: 750; font-size: var(--fs-s); }
textarea.auto { min-height: 0; field-sizing: content; resize: none; }
/* On a phone the reorder controls wrap under the day name instead of squeezing it. */
.day-head { flex-wrap: wrap; }
.day-head .day-title { flex: 1 1 120px; }

/* The page behind the step-by-step runner does not scroll while it is open. */
body:has(.runner) { overflow: hidden; }

/* Day header on a phone: the reorder and lock buttons sit under the day name, next to the date chip. */
@media (max-width: 479px) {
  .day-head { display: grid; grid-template-columns: 48px 1fr; column-gap: 12px; row-gap: 0; align-items: start; }
  .day-head .date-chip { grid-row: span 2; }
  .day-head .day-title { padding-top: 2px; }
  .day-head .day-tools { grid-column: 2; margin: 0 0 0 -10px; justify-content: flex-start; }
}

/* ---------- Brand ---------- */

.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); }
.logo .wordmark { font-weight: 900; font-size: 1.5rem; letter-spacing: -0.01em; line-height: 1; color: var(--accent); }
:root[data-theme="dark"] .logo .wordmark { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo .wordmark { color: var(--ink); } }
.nav-brand { padding: 0 10px 22px; }
.welcome .logo { flex-direction: column; gap: 14px; }
.welcome .logo .wordmark { font-size: 2.25rem; }
.tile-label .icon.tv { color: var(--sky-ink); }
.brand-title { margin: 0; line-height: 0; }
/* The drawn name: SIM in the action colour, E coral, N sun yellow (the colours of the mark). */
.wordmark-svg { display: inline-block; max-width: 100%; height: auto; }
.wordmark-svg .wm-base { stroke: var(--accent); }
.wordmark-svg .wm-e { stroke: var(--coral); }
.wordmark-svg .wm-n { stroke: var(--sun); }
:root[data-theme="dark"] .wordmark-svg .wm-base { stroke: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wordmark-svg .wm-base { stroke: var(--ink); }
}

/* ---------- Desktop: use the width ---------- */

.columns { display: grid; gap: 14px; align-content: start; }
.today-layout, .today-main, .today-side, .today-late { display: grid; gap: 14px; align-content: start; min-width: 0; }

@media (min-width: 960px) {
  .shell:not(.simple) .content { max-width: 1180px; padding: 36px 40px 64px; }
  .shell:not(.simple) .content:has(.page-head.narrow) { max-width: 760px; }
}

@media (min-width: 1100px) {
  .today-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
    grid-template-areas: "main side" "late side";
    column-gap: 20px;
  }
  .today-main { grid-area: main; }
  .today-late { grid-area: late; }
  .today-side { grid-area: side; position: sticky; top: 24px; }
  .today-side .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .columns { display: block; columns: 2; column-gap: 20px; }
  .columns > * { break-inside: avoid; margin-bottom: 20px; }
  .columns > :last-child { margin-bottom: 0; }
}

/* The sidebar's surface runs the full height of the page, however long the content is. */
@media (min-width: 960px) {
  .shell:not(.simple) { background: linear-gradient(to right, var(--surface) 247px, var(--line) 247px, var(--line) 248px, transparent 248px); }
  .nav { background: transparent; border-right: 0; }
}
.tile-dots i, .habit-dots i { background: color-mix(in srgb, var(--ink) 12%, var(--surface)); }
.tile-dots i.on, .habit-dots i.on { background: var(--sage-ink); }

/* Small phones: more room for step names in the timeline. */
@media (max-width: 419px) {
  .timeline li { grid-template-columns: 42px 18px 1fr auto; gap: 8px; }
  .timeline li::before { left: 42px; margin-left: 16px; }
}

/* A day with a single tool (the lock) keeps it on the name's row. */
@media (max-width: 479px) {
  .day-head:has(.day-tools > :only-child) { display: flex; align-items: center; }
  .day-head:has(.day-tools > :only-child) .date-chip { grid-row: auto; }
  .day-head:has(.day-tools > :only-child) .day-tools { margin: 0 0 0 auto; }
}
