/* Olivia Lexikon. A calm dashboard: white cards on a light grey board, black for what is chosen,
   one orange accent. Mobile first; wide screens get a top bar and a filter column. */

:root {
  color-scheme: light;
  --page: #e3e3e0;
  --bg: #f3f3f1;
  --surface: #ffffff;
  --surface-2: #f0f0ed;
  --ink: #141414;
  --ink-2: #474745;
  --muted: #6c6c69;
  --line: #ebebe8;
  --line-strong: #d9d9d4;
  --accent: #cc4b25;
  --accent-bright: #e5582e;
  --accent-ink: #ffffff;
  --accent-soft: #fbe6dd;
  --danger: #b3261e;
  --danger-soft: #fbe5e2;
  --ok: #2c6b38;
  --ok-soft: #e3f1e5;
  --warn-soft: #fbf1dc;
  --focus: #2a78d6;
  --series-1: #e5582e;
  --series-other: #bdbab4;
  --grid: #ecebe7;
  --chip-on: #141414;
  --chip-on-ink: #ffffff;
  --mark: #ffd9c9;

  --c-lexikon: #e5582e;
  --c-stories: #2f6f8f;
  --c-measures: #4e7d3a;
  --c-sick: #b23a48;
  --c-nights: #4f4a8c;
  --c-trousers: #9a7b1f;
  --c-newborn: #b0588e;
  --c-medicine: #0f7b6c;
  --c-creche: #7a5c3e;

  --radius: 24px;
  --radius-sm: 14px;
  --r-pill: 999px;
  --r-tile: 20px;
  --r-small: 12px;
  --r-board: 32px;
  --r-sheet: 28px;
  --r-tabbar: 26px;
  --card-border: 0 solid transparent;
  --font-display: var(--font-ui);
  --font-text: var(--font-ui);
  --heading-weight: 600;
  --heading-tracking: -0.02em;
  --num-weight: 500;
  --num-tracking: -0.02em;
  --label-case: none;
  --label-tracking: normal;
  --line-w: 2px;
  --area-opacity: 0.1;
  --logo-bg: #b4532a;
  --logo-ink: #ffffff;
  --logo-rx: 256px;
  --shadow: 0 1px 2px rgb(20 20 20 / 4%), 0 8px 24px rgb(20 20 20 / 5%);
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --tabbar: 68px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0b0b0b;
    --bg: #141414;
    --surface: #1e1e1e;
    --surface-2: #262626;
    --ink: #f2f2f0;
    --ink-2: #cfcfcb;
    --muted: #9c9c98;
    --line: #2a2a2a;
    --line-strong: #3b3b3b;
    --accent: #ef7650;
    --accent-bright: #e8673d;
    --accent-ink: #1a0d08;
    --accent-soft: #3a2219;
    --danger: #f28b82;
    --danger-soft: #3a211f;
    --ok: #8fcf98;
    --ok-soft: #1f3123;
    --warn-soft: #362d18;
    --focus: #6aa8f0;
    --series-1: #e8673d;
    --series-other: #55534f;
    --grid: #2b2b2b;
    --chip-on: #f2f2f0;
    --chip-on-ink: #141414;
    --mark: #6b3420;
    --c-lexikon: #e8673d;
    --c-stories: #6fb0d2;
    --c-measures: #8fbf73;
    --c-sick: #ef8592;
    --c-nights: #a49ff0;
    --c-trousers: #d9b85a;
    --c-newborn: #e59ac6;
    --c-medicine: #4fc3b0;
    --c-creche: #c9a27c;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0b0b;
  --bg: #141414;
  --surface: #1e1e1e;
  --surface-2: #262626;
  --ink: #f2f2f0;
  --ink-2: #cfcfcb;
  --muted: #9c9c98;
  --line: #2a2a2a;
  --line-strong: #3b3b3b;
  --accent: #ef7650;
  --accent-bright: #e8673d;
  --accent-ink: #1a0d08;
  --accent-soft: #3a2219;
  --danger: #f28b82;
  --danger-soft: #3a211f;
  --ok: #8fcf98;
  --ok-soft: #1f3123;
  --warn-soft: #362d18;
  --focus: #6aa8f0;
  --series-1: #e8673d;
  --series-other: #55534f;
  --grid: #2b2b2b;
  --chip-on: #f2f2f0;
  --chip-on-ink: #141414;
  --mark: #6b3420;
  --c-lexikon: #e8673d;
  --c-stories: #6fb0d2;
  --c-measures: #8fbf73;
  --c-sick: #ef8592;
  --c-nights: #a49ff0;
  --c-trousers: #d9b85a;
  --c-newborn: #e59ac6;
  --c-medicine: #4fc3b0;
  --c-creche: #c9a27c;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.15; font-family: var(--font-display); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); }
h1 { font-size: 28px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; }
code { font-size: 14px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 60%, transparent); outline-offset: 2px; border-radius: 8px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */

.shell { min-height: 100dvh; }
.topbar { display: none; }

main {
  padding: 0 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 36px);
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  outline: none;
}
#page-view { max-width: 1120px; margin: 0 auto; padding-top: max(18px, env(safe-area-inset-top)); }
#page-view.narrow { max-width: 760px; }
.boot-message { padding: 48px 16px; text-align: center; color: var(--muted); }

.tabbar {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  height: var(--tabbar);
  padding: 0 6px;
  border-radius: var(--r-tabbar);
  background: var(--surface);
  box-shadow: 0 6px 28px rgb(0 0 0 / 12%);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  border-radius: var(--r-tile);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] .icon { color: var(--accent-bright); }
.tab-add-circle {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}
body.editing .tabbar { display: none; }
body.editing main { padding-bottom: 0; }

@media (min-width: 900px) {
  body { background: var(--page); }
  .tabbar { display: none; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 28px;
    background: var(--page);
  }
  .brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.1; }
  .brand small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
  .topnav { display: flex; flex: 1; justify-content: center; gap: 4px; min-width: 0; }
  .topnav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: var(--r-pill);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
  }
  .topnav a:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
  .topnav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
  .top-actions { display: flex; align-items: center; gap: 10px; }
  .avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--surface);
    font-weight: 700;
    text-decoration: none;
  }
  main {
    margin: 0 16px 16px;
    padding: 28px 32px 48px;
    border-radius: var(--r-board);
    background: var(--bg);
    min-height: calc(100dvh - 86px);
  }
  #page-view { padding-top: 0; }
}
@media (min-width: 900px) and (max-width: 1279px) {
  .topnav a span:not(.icon) { display: none; }
  .topnav a { width: 42px; padding: 0; justify-content: center; }
  .brand span { display: none; }
}
@media (max-width: 899px) { .hide-narrow { display: none; } }

/* ---------- Buttons and controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font: 600 15px/1.1 var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn-dark { background: var(--chip-on); border-color: var(--chip-on); color: var(--chip-on-ink); }
.btn-danger { color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-block { display: flex; width: 100%; }
.btn-grow { flex: 1; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.plain { border-color: transparent; background: transparent; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font: 600 14px var(--font-ui);
  cursor: pointer;
  text-decoration: none;
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="datetime-local"], input[type="search"], input:not([type]), select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}
input[type="date"], input[type="time"], input[type="datetime-local"] { min-width: 0; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
textarea { display: block; resize: vertical; font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.85; }
.input-small { min-height: 40px; padding: 6px 14px; font-size: 15px; margin-bottom: 10px; }
input[type="checkbox"] { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }
input[type="file"].file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.field { display: block; margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field-label { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; padding: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field-label .optional { font-weight: 400; color: var(--muted); }
.field-help { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.field-error { margin: 6px 0 0; color: var(--danger); font-size: 14px; font-weight: 600; }
.has-error input, .has-error textarea { border-color: var(--danger); }
.form-error { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.control { display: flex; align-items: center; gap: 8px; }
.control .unit { color: var(--muted); font-size: 14px; min-width: 2.2em; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }

/* ---------- Chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font: 500 14px/1.1 var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--ink-2); }
.chip:disabled { opacity: 0.4; cursor: default; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--chip-on); border-color: var(--chip-on); color: var(--chip-on-ink); }
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.chip[aria-pressed="true"] .count { color: inherit; opacity: 0.7; }
.chip-auto { background: var(--surface-2); border-style: dashed; color: var(--ink-2); cursor: default; }
.chip-user { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.chip-add { min-height: 34px; padding: 0 12px; border-style: dashed; color: var(--ink-2); }
.cat-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cat, var(--accent-bright)); flex: none; }

.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow); }
.segmented .chip { border-color: transparent; min-height: 36px; }

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Cards ---------- */

.card { padding: 20px; border-radius: var(--radius); background: var(--surface); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 600; }
.icon-chip {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface);
}
.big-num { font-size: 40px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.05; }
.mid-num { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.up { color: var(--ok); font-weight: 600; }
.accent-text { color: var(--accent); }

/* ---------- Feed ---------- */

.feed-layout { max-width: 1160px; margin: 0 auto; }
.feed-main { min-width: 0; max-width: 760px; margin: 0 auto; }
.feed-aside { display: none; }
@media (min-width: 1180px) {
  .feed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 28px; align-items: start; }
  .feed-main { margin: 0; }
  .feed-aside { display: block; position: sticky; top: 86px; max-height: calc(100dvh - 110px); overflow: auto; padding: 18px; border-radius: var(--radius); background: var(--surface); }
  .filter-btn { display: none; }
}

.feed-top {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -16px;
  padding: max(12px, env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
}
@media (min-width: 900px) { .feed-top { top: 70px; margin: -28px -32px 0; padding: 28px 32px 12px; border-radius: var(--r-board) var(--r-board) 0 0; } }

.search-row { display: flex; gap: 8px; }
.search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 50px;
  padding: 0 4px 0 16px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow);
}
.search:focus-within { box-shadow: 0 0 0 2px var(--focus); }
.search input { flex: 1; min-width: 0; min-height: 0; height: 46px; padding: 0 4px; border: 0; background: transparent; outline: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { width: 38px; height: 38px; border: 0; }
.filter-btn { min-height: 50px; padding: 0 16px; border: 0; box-shadow: var(--shadow); }
@media (max-width: 380px) { .filter-btn-label { display: none; } }

.active-filters { display: flex; flex-wrap: nowrap; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.active-filters::-webkit-scrollbar { display: none; }
.pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--chip-on);
  color: var(--chip-on-ink);
  font: 600 14px var(--font-ui);
  cursor: pointer;
}

.feed-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 10px; color: var(--muted); font-size: 14px; }
.feed-count { font-variant-numeric: tabular-nums; }

.memory-slot:empty { display: none; }
.memory-card { display: flex; align-items: center; gap: 4px; margin: 6px 0 14px; border-radius: var(--radius); background: var(--accent-soft); }
.memory-link { display: flex; flex: 1; align-items: center; gap: 14px; min-width: 0; padding: 14px 4px 14px 16px; color: var(--ink); text-decoration: none; }
.memory-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--surface); color: var(--accent); }
.memory-text { display: flex; flex-direction: column; min-width: 0; }
.memory-preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.memory-card .icon-btn { border: 0; background: transparent; }

.entries { display: flex; flex-direction: column; gap: 10px; }
.entry { --cat: var(--accent-bright); padding: 16px 18px 18px; border-radius: var(--radius); background: var(--surface); }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--muted); font-size: 13px; }
.entry-meta .entry-edit { margin: -6px -8px -6px auto; width: 38px; height: 38px; border: 0; background: transparent; }
.meta-cat, .meta-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: 600 13px var(--font-ui);
  cursor: pointer;
}
.meta-child { font-weight: 500; }
.age { margin-left: 6px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); font-size: 12px; }
.entry-body { margin-top: 8px; font-size: 17px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; hyphens: auto; }
.cat-lexikon .entry-body { font-size: 24px; font-weight: 500; line-height: 1.3; letter-spacing: -0.01em; }
.entry-body.clamp { max-height: 16.5em; overflow: hidden; }
.cat-lexikon .entry-body.clamp { max-height: 9.2em; }
.entry-body.clamp.is-overflowing { -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent); mask-image: linear-gradient(to bottom, #000 72%, transparent); }
.more-toggle { margin-top: 4px; padding: 6px 0; border: 0; background: none; color: var(--accent); font: 600 14px var(--font-ui); cursor: pointer; min-height: 36px; }
mark { padding: 0 2px; border-radius: 4px; background: var(--mark); color: inherit; }

.entry-values { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 12px 0 0; font-size: 14px; }
.entry-values > div { display: flex; flex-direction: column; min-width: 0; }
.entry-values dt { color: var(--muted); font-size: 12px; }
.entry-values dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.entry-values dd button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; text-align: left; }
.entry-values .flags { flex-direction: row; flex-wrap: wrap; gap: 6px; width: 100%; }
.flag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface-2); font-weight: 600; }
.entry-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { min-height: 30px; padding: 0 12px; border: 0; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2); font: 500 13px var(--font-ui); cursor: pointer; }
.tag:hover { background: var(--accent-soft); color: var(--ink); }

.skeleton { height: 112px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.list-status { display: flex; justify-content: center; padding: 18px 0; min-height: 40px; }
.list-end { color: var(--muted); font-size: 14px; }
.sentinel { height: 1px; }
.spinner { width: 28px; height: 28px; margin: 8px auto; border: 3px solid var(--line-strong); border-top-color: var(--accent-bright); border-radius: 50%; animation: spin 0.8s linear infinite; }
.page-spinner { margin: 48px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty-title { color: var(--ink); font-size: 18px; font-weight: 600; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }

.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--ink); font-size: 15px; }
.notice > span:not(.icon) { flex: 1 1 200px; }
.notice > .icon { align-self: flex-start; margin-top: 2px; }
.notice-error { background: var(--danger-soft); }
.notice-ok { background: var(--ok-soft); }

/* ---------- Filters ---------- */

.filter-panel { transition: opacity 0.15s; }
.filter-panel.is-loading { opacity: 0.6; }
.filter-section { padding: 4px 0 18px; }
.filter-section h3 { margin: 0 0 10px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.date-range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.date-range label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; color: var(--muted); }
.date-range input { padding: 8px 10px; }

dialog { color: var(--ink); }
.sheet { width: 100%; max-width: 640px; max-height: 88dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: var(--r-sheet) var(--r-sheet) 0 0; background: var(--surface); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; animation: sheet-up 0.22s ease-out; }
.sheet::backdrop { background: rgb(0 0 0 / 40%); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 4px 22px; }
.sheet-head .icon-btn { border: 0; }
.sheet-body { flex: 1; overflow: auto; padding: 8px 22px; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 22px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: var(--r-sheet); } }

.dialog { width: min(420px, calc(100% - 32px)); padding: 24px; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgb(0 0 0 / 40%); }
.dialog h2 { margin-bottom: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Pages ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 20px; }
.section-title { margin: 28px 0 12px; font-size: 18px; }

.editor { max-width: 760px; margin: 0 auto; padding-bottom: 8px; }
.editor-head { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; }
.editor-who { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .editor-who { grid-template-columns: minmax(0, 1fr) 200px; align-items: start; } }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 0 24px; margin: -4px 0 14px; }
.tag-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 52px; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.tag-box:focus-within { border-color: var(--focus); }
.tag-box input { flex: 1 1 140px; min-height: 38px; padding: 4px 8px; border: 0; background: transparent; outline: none; }
.chip-user .icon { opacity: 0.6; }
.suggestions { margin-top: 10px; }
.place-suggest { margin: -8px 0 18px; }
.place-suggest .chip { max-width: 100%; }
.place-suggest .chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-foot {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px -16px 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
}
@media (max-width: 520px) { .editor-foot .btn-primary { flex: 1; } }
@media (min-width: 900px) { .editor-foot { margin: 8px 0 0; border-radius: var(--r-tile); border: 0; background: var(--surface); padding: 12px; } }
.medicine-info:empty { display: none; }
.reference { margin: 0 0 18px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); }
.reference summary { display: flex; align-items: center; min-height: 32px; font-weight: 600; cursor: pointer; }
.reference input { margin: 12px 0; }
.reference-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.reference-row dt { color: var(--muted); font-size: 12px; }
.reference-row dd { margin: 0; }

.day-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 18px; }
.day-nav-label { min-width: 120px; text-align: center; font-size: 18px; }
.day-nav input { width: auto; flex: 1 1 160px; max-width: 200px; margin-left: auto; }
.memory-year { margin-bottom: 26px; }
.memory-year h2 { margin: 0 0 12px; }

.recent-list { margin: 0; padding: 0; list-style: none; border-radius: var(--radius); background: var(--surface); }
.recent-list li { padding: 14px 18px; border-top: 1px solid var(--line); }
.recent-list li:first-child { border-top: 0; }
.recent-when { font-size: 14px; }

.tiles { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.tile { display: flex; align-items: center; gap: 14px; min-height: 66px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.tile:first-child { border-top: 0; }
.tile > span:nth-child(2) { display: flex; flex: 1; flex-direction: column; }
.tile-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--ink); }
.signed-in { margin: 22px 0 8px; text-align: center; }
.logout-form { margin: 8px 0 24px; }

.settings-jump { display: flex; gap: 8px; margin: 0 -16px 10px; padding: 0 16px 6px; overflow-x: auto; scrollbar-width: none; }
.settings-jump .chip { flex: none; }
.settings-section { margin: 0 0 14px; padding: 20px; border-radius: var(--radius); background: var(--surface); scroll-margin-top: 90px; }
.settings-section h2 { margin-bottom: 12px; }
.settings-section h3 { margin: 6px 0 12px; }
.row-form { display: grid; grid-template-columns: 1fr; gap: 0 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row-form .field { margin-bottom: 10px; }
.row-actions { display: flex; align-items: center; gap: 8px; }
@media (min-width: 620px) { .row-form { grid-template-columns: minmax(0, 1fr) 180px auto; align-items: end; } .row-actions { padding-bottom: 14px; } }
.add-form { border-top: 1px dashed var(--line-strong); }
.stack-form { max-width: 420px; }
.tag-admin, .user-list { margin: 12px 0 0; padding: 0; list-style: none; }
.tag-admin li, .user-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.tag-admin input { flex: 1 1 160px; width: auto; min-height: 40px; }
.user-name { display: flex; flex: 1 1 160px; flex-direction: column; }
.user-list select { width: auto; min-height: 40px; }
.about { display: grid; gap: 8px; margin: 0 0 12px; }
.about div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.about dt { color: var(--muted); }
.about dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.file-list { margin: 6px 0 0; padding-left: 18px; }

.file-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink-2); font-weight: 600; text-align: center; cursor: pointer; }
.file-input:focus-visible + .file-drop, .file-drop:hover { border-color: var(--accent); }
.creche-preview { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.creche-item { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); }
.creche-item.is-error { box-shadow: inset 0 0 0 2px var(--danger); }
.creche-item textarea { font-size: 15px; }

.facts { padding-left: 20px; }
.facts li { margin-bottom: 8px; }
.compare-sample { margin-bottom: 16px; }
.compare-grid { display: grid; gap: 10px; }
@media (min-width: 640px) { .compare-grid { grid-template-columns: 1fr 1fr; } }
.compare-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.compare-sample pre { margin: 0; max-height: 220px; overflow: auto; padding: 12px; border-radius: var(--radius-sm); background: var(--surface); font: 14px/1.5 var(--font-ui); white-space: pre-wrap; overflow-wrap: anywhere; }
.compare-sample pre.is-after { background: var(--ok-soft); }
.progress { width: 100%; height: 10px; margin: 16px 0 6px; accent-color: var(--accent-bright); }

/* ---------- Overview ---------- */

.hero { display: grid; gap: 16px; align-items: center; margin-bottom: 18px; }
@media (min-width: 900px) { .hero { grid-template-columns: auto auto 1fr; } }
.date-tile { display: flex; align-items: center; gap: 12px; }
.date-day { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--surface); font-size: 24px; font-weight: 500; }
.date-text { font-size: 15px; line-height: 1.25; color: var(--ink-2); }
.greet { font-size: 30px; line-height: 1.15; letter-spacing: -0.03em; }
.greet span { display: block; color: color-mix(in srgb, var(--ink) 35%, transparent); }
@media (min-width: 900px) { .greet { text-align: right; font-size: 34px; } }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.dash { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); grid-auto-flow: dense; gap: 14px; }
.dash .card { display: flex; flex-direction: column; gap: 10px; min-width: 0; color: var(--ink); text-decoration: none; }
.dash a.card:hover { box-shadow: var(--shadow); }
.dash .wide { grid-column: span 2; }
@media (max-width: 560px) { .dash .wide { grid-column: auto; } }
.dash-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; font-size: 20px; font-weight: 500; }
.spark { display: block; width: 100%; height: 44px; overflow: visible; }
.spark path { fill: none; stroke: var(--series-1); stroke-width: var(--line-w); stroke-linejoin: round; stroke-linecap: round; }
.spark rect { fill: var(--series-1); }
.spark circle { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.ring { display: block; }
.ring .ring-track { fill: none; stroke: var(--surface-2); }
.ring .ring-fill { fill: none; stroke: var(--accent-bright); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring text { fill: var(--ink); font: 600 18px var(--font-ui); }
.ring .ring-sub { fill: var(--muted); font: 500 10px var(--font-ui); }
.ring-row { display: flex; align-items: center; gap: 16px; }

/* ---------- Statistics ---------- */

.stats-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.stats-bar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.stats-bar .chips::-webkit-scrollbar { display: none; }
.stats-body { transition: opacity 0.15s; }
.stats-body.is-loading { opacity: 0.5; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: var(--r-tile); background: var(--surface); min-width: 0; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .stat { padding: 14px; } .stat-value { font-size: 22px; } }
.stat-value.long { font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.stat-note { color: var(--muted); font-size: 12px; }
.stat.accent { background: var(--chip-on); color: var(--chip-on-ink); }
.stat.accent .stat-label, .stat.accent .stat-note { color: color-mix(in srgb, var(--chip-on-ink) 70%, transparent); }
.two-col { display: grid; gap: 14px; margin-bottom: 14px; }
@media (min-width: 860px) { .two-col { grid-template-columns: 1fr 1fr; } }
.stack { display: flex; flex-direction: column; gap: 14px; }

.insights { display: grid; gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; }
@media (min-width: 860px) { .insights { grid-template-columns: 1fr 1fr; } }
.insights li { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-tile); background: var(--surface); }
.insights .icon { color: var(--accent-bright); margin-top: 2px; }

.bars { display: grid; gap: 8px; margin: 0; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.bar-row .bar-label { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 14px; border-radius: 0 4px 4px 0; background: transparent; }
.bar-fill { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--series-1); }
.bar-fill.other { background: var(--series-other); }
.bar-value { min-width: 4.5em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-value small { color: var(--muted); font-weight: 400; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--series-1); }
.legend i.other { background: var(--series-other); }

.compare-cards { display: grid; gap: 12px; }
@media (min-width: 860px) { .compare-cards { grid-template-columns: 1fr 1fr; } }
.compare-card h3 { margin-bottom: 10px; }

.milestones { display: flex; gap: 10px; margin: 0; padding: 0 0 4px; list-style: none; overflow-x: auto; scrollbar-width: thin; }
.milestones li { flex: none; min-width: 140px; padding: 14px 16px; border-radius: var(--r-tile); background: var(--surface); }
.milestones strong { display: block; font-size: 24px; font-weight: 500; }
.milestones .word { display: block; margin: 4px 0; font-weight: 600; overflow-wrap: anywhere; }

.dups { display: flex; flex-direction: column; gap: 8px; }
.dup { border-radius: var(--r-tile); background: var(--surface); }
.dup summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 16px; cursor: pointer; list-style: none; }
.dup summary::-webkit-details-marker { display: none; }
.dup summary .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dup ul { margin: 0; padding: 0 16px 12px; list-style: none; }
.dup li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.dup li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ruler-wrap { display: grid; gap: 16px; align-items: start; }
@media (min-width: 700px) { .ruler-wrap { grid-template-columns: 220px 1fr; } }
.ruler svg { display: block; width: 100%; max-width: 240px; height: auto; margin: 0 auto; }
.ruler .tick { stroke: var(--line-strong); }
.ruler .tick-major { stroke: var(--muted); }
.ruler .tick-label { fill: var(--muted); font: 11px var(--font-ui); }
.ruler .bar { fill: var(--accent-soft); }
.ruler .bar-top { fill: var(--accent-bright); }
.ruler .mark line { stroke: var(--ink); stroke-width: 2; }
.ruler .mark text { fill: var(--ink); font: 600 12px var(--font-ui); }
.ruler .mark.is-active line { stroke: var(--accent-bright); }
.ruler .mark { cursor: pointer; }
.ruler-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ruler-list button { display: flex; width: 100%; justify-content: space-between; gap: 10px; min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-small); background: var(--surface-2); color: var(--ink); font: 500 14px var(--font-ui); cursor: pointer; }
.ruler-list button[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-ink); }

.steps { display: flex; gap: 0; margin: 0; padding: 4px 0 0; list-style: none; overflow-x: auto; }
.steps li { flex: 1 0 110px; position: relative; padding: 0 8px 0 0; }
.steps li::before { content: ""; display: block; height: 6px; margin-bottom: 10px; border-radius: 3px; background: var(--accent-soft); }
.steps li:last-child::before { background: var(--accent-bright); }
.steps strong { display: block; font-size: 22px; font-weight: 500; }

.then-now { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 12px; margin-bottom: 14px; }

.places { margin: 0; padding: 0; list-style: none; border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.places li a { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.places li:first-child a { border-top: 0; }
.places li a > span { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.places strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Charts ---------- */

.chart { margin: 0; padding: 18px 18px 10px; border-radius: var(--radius); background: var(--surface); }
.chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.chart-title { font-weight: 600; }
.chart-latest { font-size: 14px; font-variant-numeric: tabular-nums; }
.chart-plot { position: relative; }
.chart-plot svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-plot svg:focus-visible { outline-offset: 4px; }
.chart-grid line { stroke: var(--grid); stroke-width: 1; }
.chart-axis { fill: var(--muted); font: 11px var(--font-ui); font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--series-1); stroke-width: var(--line-w); stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--series-1); opacity: var(--area-opacity); }
.chart-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart-bar { fill: var(--series-1); }
.chart-bar.is-active { fill: color-mix(in srgb, var(--series-1) 70%, var(--ink)); }
.chart-cross { stroke: var(--ink-2); stroke-width: 1; }
.chart-tip { position: absolute; top: -6px; display: flex; flex-direction: column; padding: 6px 12px; border-radius: var(--r-small); background: var(--chip-on); color: var(--chip-on-ink); font-size: 13px; white-space: nowrap; pointer-events: none; transform: translateY(-100%); box-shadow: var(--shadow); z-index: 2; }
.chart-tip strong { font-size: 15px; }
.chart-tip .muted { color: inherit; opacity: 0.75; }
.table-toggle { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius-sm); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.data-table th { color: var(--muted); font-weight: 600; }

/* ---------- Toasts ---------- */

.toasts { position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 22px); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); transform: translateX(-50%); pointer-events: none; }
body.editing .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: var(--r-tile); background: var(--chip-on); color: var(--chip-on-ink); box-shadow: var(--shadow); font-size: 15px; pointer-events: auto; animation: toast-in 0.2s ease-out; }
.toast-error { background: var(--danger); color: var(--surface); }
.toast-action { margin-left: auto; border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Login ---------- */

.login-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; background: var(--page); }
.login-card { width: min(390px, 100%); padding: 32px 26px; border-radius: var(--r-board); background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.login-card form { text-align: left; margin-top: 22px; }
.login-card h1 { font-size: 26px; }
.login-mark { border-radius: 50%; margin-bottom: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .chip[aria-pressed="true"], .chip[aria-checked="true"], .pill { border: 2px solid CanvasText; }
  .cat-dot, .bar-fill { forced-color-adjust: none; }
}

/* ---------- Shared by every style: these read the tokens each style sets ---------- */

:is(.card, .stat, .chart, .entry, .insights li, .settings-section, .tiles, .recent-list, .places, .dup, .milestones li,
  .feed-aside, .creche-item, .reference, .table-wrap, .memory-card, .compare-sample pre, .login-card, .dialog, .sheet) { border: var(--card-border); }
:is(.big-num, .mid-num, .stat-value, .kv dd, .milestones strong, .steps strong, .greet, .date-day, .day-nav-label, .chart-tip strong) {
  font-family: var(--font-display);
  font-weight: var(--num-weight);
  letter-spacing: var(--num-tracking);
}
:is(.stat-label, .kv dt, .entry-values dt, .compare-label, .reference-row dt, .data-table th) { text-transform: var(--label-case); letter-spacing: var(--label-tracking); }
.entry-body, textarea { font-family: var(--font-text); }
.cat-lexikon .entry-body { font-family: var(--font-display); }
.brand-mark { display: block; width: 40px; height: 40px; flex: none; }
.brand-mark .logo-bg { fill: var(--logo-bg); }
.brand-mark rect.logo-bg { rx: var(--logo-rx); }
.brand-mark .logo-ink { fill: var(--logo-ink); }
.login-card .brand-mark { width: 56px; height: 56px; margin: 0 auto 12px; }

/* ---------- Style picker (Settings, Appearance) ---------- */

.look-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 12px; margin: 0 0 22px; }
.look-option { display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 12px; border: 2px solid var(--line-strong); border-radius: calc(var(--radius-sm) + 4px); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.look-option:hover { border-color: var(--ink-2); }
.look-option[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.look-text { display: flex; flex-direction: column; padding: 0 4px; }
/* The previews always show the light version, with fixed colours: they are pictures of each style. */
.look-preview { display: grid; grid-template-columns: 20% 1fr 1fr; gap: 6px; height: 84px; padding: 8px; border-radius: 10px; }
.lp-nav { border-radius: 6px; }
.lp-card { display: flex; align-items: flex-end; padding: 6px; border-radius: 8px; background: #fff; }
.lp-accent { width: 100%; height: 45%; border-radius: 4px; }
.lp-line { width: 70%; height: 6px; border-radius: 3px; }
.look-warm { background: #e3e3e0; }
.look-warm .lp-nav { background: #f3f3f1; border-radius: 999px; }
.look-warm .lp-accent { background: #e5582e; }
.look-warm .lp-line { background: #141414; }
.look-sky { background: linear-gradient(160deg, #a9d6fa, #dcefff); }
.look-sky .lp-nav { background: #fff; border-radius: 10px; box-shadow: inset 0 10px 0 -4px #fff, inset 0 0 0 4px #fff, inset 0 -18px 0 -10px #ffd75e; }
.look-sky .lp-card { border-radius: 12px; }
.look-sky .lp-card:first-of-type { background: linear-gradient(135deg, #c9d2ff, #f6c9ef); }
.look-sky .lp-accent { background: #1a8ad8; border-radius: 999px; }
.look-sky .lp-line { background: #ffd75e; }
.look-clean { background: #fafafa; box-shadow: inset 0 0 0 1px #e4e4e7; }
.look-clean .lp-nav { margin: -8px 0 -8px -8px; border-radius: 10px 0 0 10px; background: #fff; box-shadow: 1px 0 0 #e4e4e7; }
.look-clean .lp-card { border-radius: 4px; box-shadow: inset 0 0 0 1px #e4e4e7; }
.look-clean .lp-accent { background: linear-gradient(to top, #ecebfe, #ecebfe 60%, #5b54f0 60%, #5b54f0 66%, transparent 66%); }
.look-clean .lp-line { background: #5b54f0; }

/* ---------- Style: Sky (soft blue, rounded, playful) ---------- */

:root[data-style="sky"] {
  --page: #bfe0fa;
  --page-2: #e1f0fd;
  --bg: #eaf4fd;
  --surface: #ffffff;
  --surface-2: #eef5fc;
  --ink: #0f1d2e;
  --ink-2: #3a4a5e;
  --muted: #5f6f83;
  --line: #e3edf7;
  --line-strong: #cfdcea;
  --accent: #1677c4;
  --accent-bright: #1a8ad8;
  --accent-ink: #ffffff;
  --accent-soft: #dcecfb;
  --sun: #ffd75e;
  --sun-ink: #2b2200;
  --focus: #1677c4;
  --series-1: #1a8ad8;
  --series-other: #b9c6d4;
  --grid: #e8eff7;
  --chip-on: #0f1d2e;
  --chip-on-ink: #ffffff;
  --mark: #fff0b3;
  --grad-1: linear-gradient(135deg, #cdd5ff, #f7d0f0);
  --grad-2: linear-gradient(135deg, #c2eff7, #9fe3e3);
  --radius: 28px;
  --radius-sm: 16px;
  --r-tile: 24px;
  --r-board: 36px;
  --r-sheet: 32px;
  --r-tabbar: 32px;
  --heading-weight: 700;
  --num-weight: 600;
  --area-opacity: 0.14;
  --logo-bg: #1a8ad8;
  --shadow: 0 1px 2px rgb(15 50 90 / 5%), 0 10px 30px rgb(30 100 170 / 9%);
  --font-ui: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root[data-style="sky"]:not([data-theme="light"]) {
    --page: #0b1624;
    --page-2: #0f2238;
    --bg: #101f31;
    --surface: #16283d;
    --surface-2: #1d3249;
    --ink: #eaf3fc;
    --ink-2: #c3d3e4;
    --muted: #8fa3b9;
    --line: #213850;
    --line-strong: #2d4864;
    --accent: #5bb4f2;
    --accent-bright: #2f94dc;
    --accent-ink: #06121f;
    --accent-soft: #173a5a;
    --sun: #f2c94c;
    --sun-ink: #241c00;
    --focus: #6fc0f7;
    --series-1: #2f94dc;
    --series-other: #3d5570;
    --grid: #1f344b;
    --chip-on: #eaf3fc;
    --chip-on-ink: #0f1d2e;
    --mark: #5a4a14;
    --grad-1: linear-gradient(135deg, #2b3166, #4b2b55);
    --grad-2: linear-gradient(135deg, #15445a, #1b4f4f);
    --logo-bg: #2f94dc;
    --logo-ink: #06121f;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  }
}
:root[data-style="sky"][data-theme="dark"] {
  --page: #0b1624;
  --page-2: #0f2238;
  --bg: #101f31;
  --surface: #16283d;
  --surface-2: #1d3249;
  --ink: #eaf3fc;
  --ink-2: #c3d3e4;
  --muted: #8fa3b9;
  --line: #213850;
  --line-strong: #2d4864;
  --accent: #5bb4f2;
  --accent-bright: #2f94dc;
  --accent-ink: #06121f;
  --accent-soft: #173a5a;
  --sun: #f2c94c;
  --sun-ink: #241c00;
  --focus: #6fc0f7;
  --series-1: #2f94dc;
  --series-other: #3d5570;
  --grid: #1f344b;
  --chip-on: #eaf3fc;
  --chip-on-ink: #0f1d2e;
  --mark: #5a4a14;
  --grad-1: linear-gradient(135deg, #2b3166, #4b2b55);
  --grad-2: linear-gradient(135deg, #15445a, #1b4f4f);
  --logo-bg: #2f94dc;
  --logo-ink: #06121f;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%);
}

[data-style="sky"] .card, [data-style="sky"] .stat, [data-style="sky"] .chart, [data-style="sky"] .entry,
[data-style="sky"] .settings-section, [data-style="sky"] .insights li { box-shadow: var(--shadow); }
[data-style="sky"] .stat.accent { background: var(--grad-2); color: var(--ink); }
[data-style="sky"] .stat.accent .stat-label, [data-style="sky"] .stat.accent .stat-note { color: var(--ink-2); }
[data-style="sky"] .memory-card { background: var(--grad-1); }
[data-style="sky"] .date-day { background: var(--sun); color: var(--sun-ink); }
[data-style="sky"] .tabbar { border-radius: 32px; box-shadow: 0 8px 30px rgb(20 80 140 / 18%); }
[data-style="sky"] .tab[aria-current="page"] .icon { padding: 4px 14px; border-radius: 999px; background: var(--sun); color: var(--sun-ink); }
[data-style="sky"] .tab-add-circle { background: var(--accent-bright); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent-bright) 40%, transparent); }

@media (min-width: 900px) {
  [data-style="sky"] body { background: linear-gradient(160deg, var(--page) 0%, var(--page-2) 55%, var(--page) 100%) fixed; }
  [data-style="sky"] .topbar {
    position: fixed;
    top: 16px;
    bottom: 16px;
    left: 16px;
    width: 92px;
    flex-direction: column;
    gap: 14px;
    padding: 20px 0;
    border-radius: 32px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  [data-style="sky"] .brand span { display: none; }
  [data-style="sky"] .brand-mark { width: 48px; height: 48px; }
  [data-style="sky"] .topnav { flex-direction: column; align-items: center; justify-content: center; gap: 10px; overflow-y: auto; scrollbar-width: none; padding: 4px 0; }
  [data-style="sky"] .topnav a { flex: none; width: 50px; height: 50px; min-height: 0; padding: 0; justify-content: center; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); }
  [data-style="sky"] .topnav a span:not(.icon) { display: none; }
  [data-style="sky"] .topnav a:hover { background: var(--accent-soft); }
  [data-style="sky"] .topnav a[aria-current="page"] { background: var(--sun); color: var(--sun-ink); box-shadow: none; }
  [data-style="sky"] .top-actions { flex-direction: column; }
  [data-style="sky"] .top-actions .btn-primary { width: 50px; height: 50px; min-height: 0; padding: 0; gap: 0; border-radius: 50%; font-size: 0; }
  [data-style="sky"] main { margin: 16px 16px 16px 124px; border-radius: 36px; min-height: calc(100dvh - 32px); box-shadow: inset 0 0 0 3px rgb(255 255 255 / 55%); }
  [data-style="sky"] .feed-top { top: 0; }
  [data-style="sky"] .feed-aside { top: 24px; max-height: calc(100dvh - 48px); }
}

/* ---------- Style: Clean (minimal, side menu, thin lines) ---------- */

:root[data-style="clean"] {
  --page: #ffffff;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --line: #ececef;
  --line-strong: #e4e4e7;
  --accent: #5b54f0;
  --accent-bright: #5b54f0;
  --accent-ink: #ffffff;
  --accent-soft: #ecebfe;
  --focus: #5b54f0;
  --series-1: #5b54f0;
  --series-other: #c4c4cc;
  --grid: #f0f0f2;
  --chip-on: #18181b;
  --chip-on-ink: #ffffff;
  --mark: #e0defd;
  --radius: 14px;
  --radius-sm: 10px;
  --r-pill: 10px;
  --r-tile: 12px;
  --r-small: 8px;
  --r-board: 0px;
  --r-sheet: 16px;
  --r-tabbar: 0px;
  --card-border: 1px solid var(--line-strong);
  --num-weight: 600;
  --area-opacity: 0.08;
  --logo-bg: #5b54f0;
  --logo-rx: 112px;
  --shadow: 0 1px 2px rgb(0 0 0 / 5%);
}
@media (prefers-color-scheme: dark) {
  :root[data-style="clean"]:not([data-theme="light"]) {
    --page: #09090b;
    --bg: #0c0c0e;
    --surface: #18181b;
    --surface-2: #222226;
    --ink: #fafafa;
    --ink-2: #d4d4d8;
    --muted: #a1a1aa;
    --line: #26262b;
    --line-strong: #303036;
    --accent: #8b85ff;
    --accent-bright: #7a73f6;
    --accent-ink: #0b0a1f;
    --accent-soft: #25234d;
    --focus: #8b85ff;
    --series-1: #7a73f6;
    --series-other: #3f3f46;
    --grid: #232327;
    --chip-on: #fafafa;
    --chip-on-ink: #18181b;
    --mark: #3b3780;
    --logo-bg: #7a73f6;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  }
}
:root[data-style="clean"][data-theme="dark"] {
  --page: #09090b;
  --bg: #0c0c0e;
  --surface: #18181b;
  --surface-2: #222226;
  --ink: #fafafa;
  --ink-2: #d4d4d8;
  --muted: #a1a1aa;
  --line: #26262b;
  --line-strong: #303036;
  --accent: #8b85ff;
  --accent-bright: #7a73f6;
  --accent-ink: #0b0a1f;
  --accent-soft: #25234d;
  --focus: #8b85ff;
  --series-1: #7a73f6;
  --series-other: #3f3f46;
  --grid: #232327;
  --chip-on: #fafafa;
  --chip-on-ink: #18181b;
  --mark: #3b3780;
  --logo-bg: #7a73f6;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%);
}

[data-style="clean"] :is(.card, .stat, .chart, .entry, .insights li, .settings-section, .search, .segmented) { box-shadow: none; }
[data-style="clean"] :is(.search, .date-day) { border: var(--card-border); }
[data-style="clean"] .search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
[data-style="clean"] .filter-btn { border: 1px solid var(--line-strong); box-shadow: none; }
[data-style="clean"] .segmented { border-radius: 12px; background: var(--surface-2); border-color: transparent; }
[data-style="clean"] .segmented .chip[aria-checked="true"], [data-style="clean"] .segmented .chip[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 10%); }
[data-style="clean"] .chip[aria-checked="true"], [data-style="clean"] .chip[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--ink); }
[data-style="clean"] .stat.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
[data-style="clean"] .stat.accent .stat-label, [data-style="clean"] .stat.accent .stat-note { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
[data-style="clean"] .memory-card { background: var(--accent-soft); border-color: transparent; }
[data-style="clean"] .date-day { border-radius: 14px; }
[data-style="clean"] .greet span { color: var(--muted); }
[data-style="clean"] .tabbar { left: 0; right: 0; bottom: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); border-radius: 0; border-top: 1px solid var(--line-strong); box-shadow: none; }
[data-style="clean"] .tab[aria-current="page"] { color: var(--accent); }
[data-style="clean"] .tab[aria-current="page"] .icon { color: var(--accent); }
[data-style="clean"] .tab-add-circle { width: 48px; height: 48px; border-radius: 14px; }
[data-style="clean"] .toasts { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 12px); }

@media (min-width: 900px) {
  [data-style="clean"] body { background: var(--bg); }
  [data-style="clean"] .topbar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 248px;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    padding: 20px 14px;
    background: var(--page);
    border-right: 1px solid var(--line-strong);
  }
  [data-style="clean"] .brand { padding: 0 8px; }
  [data-style="clean"] .brand span { display: block; }
  [data-style="clean"] .brand-mark { width: 36px; height: 36px; }
  [data-style="clean"] .topnav { flex-direction: column; justify-content: flex-start; gap: 2px; overflow-y: auto; }
  [data-style="clean"] .topnav::before { content: "Main menu"; padding: 8px 12px 6px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
  [data-style="clean"] .topnav a { width: auto; min-height: 42px; padding: 0 12px; justify-content: flex-start; border-radius: 10px; color: var(--ink-2); font-weight: 500; }
  [data-style="clean"] .topnav a span:not(.icon) { display: inline; }
  [data-style="clean"] .topnav a:hover { background: var(--surface-2); }
  [data-style="clean"] .topnav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); font-weight: 600; box-shadow: none; }
  [data-style="clean"] .top-actions { flex-direction: column; align-items: stretch; }
  [data-style="clean"] .avatar { align-self: flex-start; margin-left: 4px; width: 38px; height: 38px; }
  [data-style="clean"] main { margin: 0 0 0 248px; padding: 32px 40px 48px; border-radius: 0; min-height: 100dvh; }
  [data-style="clean"] .feed-top { top: 0; margin: -32px -40px 0; padding: 32px 40px 12px; border-radius: 0; }
  [data-style="clean"] .feed-aside { top: 24px; max-height: calc(100dvh - 48px); }
  [data-style="clean"] .toasts { bottom: 24px; }
}

/* Previews of the three newer looks. */
.look-paper { background: #ece6d9; }
.look-paper .lp-nav { background: #fffdf8; border-radius: 3px; box-shadow: inset 0 0 0 1px #d8cfbd; }
.look-paper .lp-card { background: #fffdf8; border-radius: 3px; box-shadow: inset 0 0 0 1px #d8cfbd; }
.look-paper .lp-accent { height: 30%; background: linear-gradient(to top, #fbe7a1 55%, transparent 55%); border-radius: 0; box-shadow: inset 0 -1px 0 #2f5d9e; }
.look-paper .lp-line { height: 3px; background: #1f1b16; }
.look-moss { background: #1f3a2e; }
.look-moss .lp-nav { background: transparent; box-shadow: inset 0 8px 0 -4px #cfe0d5; }
.look-moss .lp-card { background: #fafaf7; border-radius: 10px; }
.look-moss .lp-card:first-of-type { margin-left: -2px; }
.look-moss .lp-accent { background: #24845a; border-radius: 6px; }
.look-moss .lp-line { background: #c0613a; }
.look-bold { background: #f4f4f0; }
.look-bold .lp-nav { background: #ffd400; border-radius: 0; box-shadow: inset 0 0 0 2px #111; }
.look-bold .lp-card { border-radius: 0; box-shadow: inset 0 0 0 2px #111; }
.look-bold .lp-accent { background: #d62c1a; border-radius: 0; }
.look-bold .lp-line { height: 8px; background: #111; border-radius: 0; }

/* ---------- Style: Paper (a printed family notebook: cream paper, serif, ink blue) ---------- */

:root[data-style="paper"] {
  --page: #ece6d9;
  --bg: #f6f2e9;
  --surface: #fffdf8;
  --surface-2: #f1ece1;
  --ink: #1f1b16;
  --ink-2: #4a4339;
  --muted: #6f665a;
  --line: #e7e0d2;
  --line-strong: #d8cfbd;
  --accent: #2f5d9e;
  --accent-bright: #2f5d9e;
  --accent-ink: #ffffff;
  --accent-soft: #e3eaf4;
  --focus: #2f5d9e;
  --series-1: #2f5d9e;
  --series-other: #c9bfae;
  --grid: #ece5d8;
  --chip-on: #1f1b16;
  --chip-on-ink: #fffdf8;
  --mark: #fbe7a1;
  --c-lexikon: #b5452c;
  --c-stories: #2f5d9e;
  --c-measures: #4f7a3a;
  --c-sick: #a23a4a;
  --c-nights: #4c467f;
  --c-trousers: #8a6d1c;
  --c-newborn: #a24f7e;
  --c-medicine: #1d6f63;
  --c-creche: #7a5a3a;
  --radius: 8px;
  --radius-sm: 6px;
  --r-pill: 6px;
  --r-tile: 8px;
  --r-small: 6px;
  --r-board: 0px;
  --r-sheet: 12px;
  --r-tabbar: 0px;
  --card-border: 1px solid var(--line-strong);
  --shadow: none;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Book Antiqua", Georgia, serif;
  --font-text: var(--font-display);
  --heading-tracking: -0.01em;
  --num-tracking: -0.01em;
  --label-case: uppercase;
  --label-tracking: 0.08em;
  --line-w: 1.75px;
  --area-opacity: 0.06;
  --logo-bg: #2f5d9e;
  --logo-rx: 64px;
}
@media (prefers-color-scheme: dark) {
  :root[data-style="paper"]:not([data-theme="light"]) {
    --page: #12110f; --bg: #191714; --surface: #221f1b; --surface-2: #2b2722;
    --ink: #efe8da; --ink-2: #d2c9b8; --muted: #a59b8a; --line: #2f2a24; --line-strong: #3d372f;
    --accent: #8fb0e0; --accent-bright: #5f8fd0; --accent-ink: #10161f; --accent-soft: #22303f; --focus: #8fb0e0;
    --series-1: #5f8fd0; --series-other: #4c463d; --grid: #2c2823; --chip-on: #efe8da; --chip-on-ink: #1f1b16; --mark: #5c4a17;
    --c-lexikon: #e8673d; --c-stories: #6fb0d2; --c-measures: #8fbf73; --c-sick: #ef8592; --c-nights: #a49ff0;
    --c-trousers: #d9b85a; --c-newborn: #e59ac6; --c-medicine: #4fc3b0; --c-creche: #c9a27c;
    --logo-bg: #5f8fd0; --logo-ink: #10161f;
  }
}
:root[data-style="paper"][data-theme="dark"] {
  --page: #12110f; --bg: #191714; --surface: #221f1b; --surface-2: #2b2722;
  --ink: #efe8da; --ink-2: #d2c9b8; --muted: #a59b8a; --line: #2f2a24; --line-strong: #3d372f;
  --accent: #8fb0e0; --accent-bright: #5f8fd0; --accent-ink: #10161f; --accent-soft: #22303f; --focus: #8fb0e0;
  --series-1: #5f8fd0; --series-other: #4c463d; --grid: #2c2823; --chip-on: #efe8da; --chip-on-ink: #1f1b16; --mark: #5c4a17;
  --c-lexikon: #e8673d; --c-stories: #6fb0d2; --c-measures: #8fbf73; --c-sick: #ef8592; --c-nights: #a49ff0;
  --c-trousers: #d9b85a; --c-newborn: #e59ac6; --c-medicine: #4fc3b0; --c-creche: #c9a27c;
  --logo-bg: #5f8fd0; --logo-ink: #10161f;
}

[data-style="paper"] h1 { font-size: 34px; }
[data-style="paper"] .entry-body { font-size: 18px; }
[data-style="paper"] .greet span { color: var(--muted); font-style: italic; }
[data-style="paper"] .date-day { border-radius: var(--r-small); border: var(--card-border); }
[data-style="paper"] :is(.search, .filter-btn, .segmented) { border: var(--card-border); box-shadow: none; }
[data-style="paper"] .memory-card { background: var(--mark); border-color: transparent; }
[data-style="paper"] .memory-card .memory-icon { border-radius: var(--r-small); }
[data-style="paper"] .stat.accent { background: var(--surface); color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
[data-style="paper"] .stat.accent .stat-label, [data-style="paper"] .stat.accent .stat-note { color: var(--muted); }
[data-style="paper"] .section-title { padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); }
[data-style="paper"] .tabbar { left: 0; right: 0; bottom: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); border-top: 1px solid var(--line-strong); box-shadow: none; }
[data-style="paper"] .tab[aria-current="page"] span:not(.icon) { text-decoration: underline 2px; text-underline-offset: 4px; }
[data-style="paper"] .tab[aria-current="page"] .icon { color: var(--accent); }
[data-style="paper"] .tab-add-circle { border-radius: var(--r-small); }
@media (min-width: 900px) {
  [data-style="paper"] body { background: var(--bg); }
  [data-style="paper"] .topbar { background: var(--surface); border-bottom: 1px solid var(--line-strong); }
  [data-style="paper"] .brand { font-family: var(--font-display); font-size: 18px; }
  [data-style="paper"] .topnav a { border-radius: 0; font-weight: 500; }
  [data-style="paper"] .topnav a:hover { background: transparent; color: var(--ink); }
  [data-style="paper"] .topnav a[aria-current="page"] { background: transparent; box-shadow: inset 0 -2px 0 var(--ink); }
  [data-style="paper"] .avatar { border-radius: var(--r-small); font-family: var(--font-display); }
  [data-style="paper"] main { margin: 0; border-radius: 0; min-height: calc(100dvh - 71px); }
  [data-style="paper"] .feed-top { top: 71px; }
}

/* ---------- Style: Moss (calm Nordic: sage, forest-green side menu, light numbers) ---------- */

:root[data-style="moss"] {
  --page: #dfe3da;
  --bg: #eceee8;
  --surface: #fafaf7;
  --surface-2: #f0f2ec;
  --ink: #1d2420;
  --ink-2: #414b45;
  --muted: #626c66;
  --line: #e4e7e0;
  --line-strong: #d3d8cf;
  --accent: #1f6f4c;
  --accent-bright: #24845a;
  --accent-ink: #ffffff;
  --accent-soft: #dcebe2;
  --sun: #ecdcbc;
  --sun-ink: #3a2c12;
  --focus: #1f6f4c;
  --series-1: #24845a;
  --series-other: #c3cac2;
  --grid: #e6e9e3;
  --chip-on: #1f3a2e;
  --chip-on-ink: #f3f6f1;
  --mark: #f4e3b5;
  --nav-bg: #1f3a2e;
  --nav-ink: #cfe0d5;
  --nav-active: #f3f6f1;
  --c-lexikon: #c0613a;
  --c-stories: #3c6e8f;
  --c-measures: #24845a;
  --c-sick: #b04a4a;
  --c-nights: #4f5a8c;
  --c-trousers: #9a7b2f;
  --c-newborn: #a8608a;
  --c-medicine: #2b7a72;
  --c-creche: #7d6248;
  --radius: 20px;
  --radius-sm: 12px;
  --r-tile: 16px;
  --r-board: 28px;
  --r-sheet: 24px;
  --shadow: none;
  --font-ui: "Avenir Next", Avenir, Seravek, "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --num-weight: 400;
  --num-tracking: -0.03em;
  --logo-bg: #f3f6f1;
  --logo-ink: #1f3a2e;
}
@media (prefers-color-scheme: dark) {
  :root[data-style="moss"]:not([data-theme="light"]) {
    --page: #0e1411; --bg: #121915; --surface: #19221d; --surface-2: #212c26;
    --ink: #e8eee9; --ink-2: #c4cec7; --muted: #93a097; --line: #24302a; --line-strong: #33413a;
    --accent: #6fc39a; --accent-bright: #3f9a6c; --accent-ink: #0b1a12; --accent-soft: #1c3428; --sun: #4a4029; --sun-ink: #f3e7cc;
    --focus: #6fc39a; --series-1: #3f9a6c; --series-other: #3a463f; --grid: #212b25;
    --chip-on: #e8eee9; --chip-on-ink: #19221d; --mark: #4f4420; --nav-bg: #0a100c; --nav-ink: #a9bdb0; --nav-active: #e8eee9;
    --c-lexikon: #e08a62; --c-stories: #7fb0cf; --c-measures: #6fc39a; --c-sick: #e38a8a; --c-nights: #a3abe0;
    --c-trousers: #d6bb72; --c-newborn: #dc9cc0; --c-medicine: #63c0b5; --c-creche: #c4a587;
    --logo-bg: #3f9a6c; --logo-ink: #0b1a12;
  }
}
:root[data-style="moss"][data-theme="dark"] {
  --page: #0e1411; --bg: #121915; --surface: #19221d; --surface-2: #212c26;
  --ink: #e8eee9; --ink-2: #c4cec7; --muted: #93a097; --line: #24302a; --line-strong: #33413a;
  --accent: #6fc39a; --accent-bright: #3f9a6c; --accent-ink: #0b1a12; --accent-soft: #1c3428; --sun: #4a4029; --sun-ink: #f3e7cc;
  --focus: #6fc39a; --series-1: #3f9a6c; --series-other: #3a463f; --grid: #212b25;
  --chip-on: #e8eee9; --chip-on-ink: #19221d; --mark: #4f4420; --nav-bg: #0a100c; --nav-ink: #a9bdb0; --nav-active: #e8eee9;
  --c-lexikon: #e08a62; --c-stories: #7fb0cf; --c-measures: #6fc39a; --c-sick: #e38a8a; --c-nights: #a3abe0;
  --c-trousers: #d6bb72; --c-newborn: #dc9cc0; --c-medicine: #63c0b5; --c-creche: #c4a587;
  --logo-bg: #3f9a6c; --logo-ink: #0b1a12;
}

[data-style="moss"] .date-day { background: var(--sun); color: var(--sun-ink); }
[data-style="moss"] .stat.accent { background: var(--accent-soft); color: var(--ink); }
[data-style="moss"] .stat.accent .stat-label, [data-style="moss"] .stat.accent .stat-note { color: var(--ink-2); }
[data-style="moss"] .memory-card { background: var(--sun); }
[data-style="moss"] .tabbar { background: var(--nav-bg); box-shadow: 0 8px 28px rgb(10 30 20 / 25%); }
[data-style="moss"] .tab { color: var(--nav-ink); }
[data-style="moss"] .tab[aria-current="page"], [data-style="moss"] .tab[aria-current="page"] .icon { color: var(--nav-active); }
[data-style="moss"] .tab[aria-current="page"] .icon { padding: 3px 12px; border-radius: var(--r-pill); background: rgb(255 255 255 / 12%); }
[data-style="moss"] .tab-add-circle { background: var(--nav-active); color: var(--nav-bg); }
@media (min-width: 900px) {
  [data-style="moss"] body { background: var(--nav-bg); }
  [data-style="moss"] .topbar { position: fixed; top: 0; bottom: 0; left: 0; width: 232px; flex-direction: column; align-items: stretch; gap: 22px; padding: 26px 16px 20px; background: var(--nav-bg); }
  [data-style="moss"] .brand { padding: 0 8px; color: var(--nav-active); }
  [data-style="moss"] .brand span { display: block; }
  [data-style="moss"] .brand small { color: var(--nav-ink); opacity: 0.8; }
  [data-style="moss"] .topnav { flex-direction: column; justify-content: flex-start; gap: 4px; overflow-y: auto; }
  [data-style="moss"] .topnav a { width: auto; min-height: 44px; padding: 0 14px; justify-content: flex-start; border-radius: 12px; color: var(--nav-ink); font-weight: 500; }
  [data-style="moss"] .topnav a span:not(.icon) { display: inline; }
  [data-style="moss"] .topnav a:hover { background: rgb(255 255 255 / 6%); }
  [data-style="moss"] .topnav a[aria-current="page"] { background: rgb(255 255 255 / 12%); color: var(--nav-active); box-shadow: none; }
  [data-style="moss"] .top-actions { flex-direction: column; align-items: stretch; }
  [data-style="moss"] .top-actions .btn-primary { background: var(--nav-active); border-color: var(--nav-active); color: var(--nav-bg); }
  [data-style="moss"] .avatar { align-self: flex-start; margin-left: 6px; background: rgb(255 255 255 / 14%); color: var(--nav-active); }
  [data-style="moss"] main { margin: 12px 12px 12px 232px; min-height: calc(100dvh - 24px); }
  [data-style="moss"] .feed-top { top: 0; }
  [data-style="moss"] .feed-aside { top: 24px; max-height: calc(100dvh - 48px); }
}

/* ---------- Style: Bold (Swiss poster: black outlines, square corners, red and yellow) ---------- */

:root[data-style="bold"] {
  --page: #f4f4f0;
  --bg: #f4f4f0;
  --surface: #ffffff;
  --surface-2: #ececE6;
  --ink: #111111;
  --ink-2: #2b2b2b;
  --muted: #5c5c5c;
  --line: #d6d6d0;
  --line-strong: #111111;
  --accent: #d62c1a;
  --accent-bright: #d62c1a;
  --accent-ink: #ffffff;
  --accent-soft: #ffe9e4;
  --sun: #ffd400;
  --sun-ink: #111111;
  --focus: #1d4ed8;
  --series-1: #d62c1a;
  --series-other: #b5b5ad;
  --grid: #e4e4de;
  --chip-on: #111111;
  --chip-on-ink: #ffffff;
  --mark: #ffd400;
  --c-lexikon: #d62c1a;
  --c-stories: #1d4ed8;
  --c-measures: #15803d;
  --c-sick: #be123c;
  --c-nights: #4338ca;
  --c-trousers: #a16207;
  --c-newborn: #be185d;
  --c-medicine: #0f766e;
  --c-creche: #78350f;
  --radius: 4px;
  --radius-sm: 2px;
  --r-pill: 2px;
  --r-tile: 4px;
  --r-small: 2px;
  --r-board: 0px;
  --r-sheet: 6px;
  --r-tabbar: 0px;
  --card-border: 2px solid var(--ink);
  --shadow: none;
  --font-ui: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --heading-weight: 800;
  --heading-tracking: -0.035em;
  --num-weight: 700;
  --num-tracking: -0.04em;
  --label-case: uppercase;
  --label-tracking: 0.06em;
  --line-w: 2.5px;
  --area-opacity: 0;
  --logo-bg: #111111;
  --logo-ink: #ffd400;
  --logo-rx: 0px;
}
@media (prefers-color-scheme: dark) {
  :root[data-style="bold"]:not([data-theme="light"]) {
    --page: #0d0d0d; --bg: #0d0d0d; --surface: #181818; --surface-2: #232323;
    --ink: #f5f5f0; --ink-2: #dcdcd6; --muted: #a8a8a0; --line: #3a3a3a; --line-strong: #f5f5f0;
    --accent: #ff6b52; --accent-bright: #e8462c; --accent-ink: #111111; --accent-soft: #3a1a14; --sun: #ffd400; --sun-ink: #111111;
    --focus: #7aa2ff; --series-1: #e8462c; --series-other: #4a4a4a; --grid: #2a2a2a;
    --chip-on: #f5f5f0; --chip-on-ink: #111111; --mark: #6b5a00;
    --c-lexikon: #e8673d; --c-stories: #6fb0d2; --c-measures: #8fbf73; --c-sick: #ef8592; --c-nights: #a49ff0;
    --c-trousers: #d9b85a; --c-newborn: #e59ac6; --c-medicine: #4fc3b0; --c-creche: #c9a27c;
    --logo-bg: #ffd400; --logo-ink: #111111;
  }
}
:root[data-style="bold"][data-theme="dark"] {
  --page: #0d0d0d; --bg: #0d0d0d; --surface: #181818; --surface-2: #232323;
  --ink: #f5f5f0; --ink-2: #dcdcd6; --muted: #a8a8a0; --line: #3a3a3a; --line-strong: #f5f5f0;
  --accent: #ff6b52; --accent-bright: #e8462c; --accent-ink: #111111; --accent-soft: #3a1a14; --sun: #ffd400; --sun-ink: #111111;
  --focus: #7aa2ff; --series-1: #e8462c; --series-other: #4a4a4a; --grid: #2a2a2a;
  --chip-on: #f5f5f0; --chip-on-ink: #111111; --mark: #6b5a00;
  --c-lexikon: #e8673d; --c-stories: #6fb0d2; --c-measures: #8fbf73; --c-sick: #ef8592; --c-nights: #a49ff0;
  --c-trousers: #d9b85a; --c-newborn: #e59ac6; --c-medicine: #4fc3b0; --c-creche: #c9a27c;
  --logo-bg: #ffd400; --logo-ink: #111111;
}

[data-style="bold"] :is(.btn, .chip, .icon-btn, .icon-chip, .tag-box, input, select, textarea) { border-width: 2px; }
[data-style="bold"] :is(.search, .filter-btn, .segmented, .date-day) { border: var(--card-border); box-shadow: none; }
[data-style="bold"] .btn-primary { box-shadow: 3px 3px 0 var(--ink); border-color: var(--ink); }
[data-style="bold"] .btn-primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
[data-style="bold"] .chip[aria-pressed="true"], [data-style="bold"] .chip[aria-checked="true"], [data-style="bold"] .pill { background: var(--sun); border-color: var(--ink); color: var(--sun-ink); }
[data-style="bold"] .pill { border: 2px solid var(--ink); }
[data-style="bold"] .stat.accent { background: var(--sun); color: var(--sun-ink); }
[data-style="bold"] .stat.accent .stat-label, [data-style="bold"] .stat.accent .stat-note { color: var(--sun-ink); }
[data-style="bold"] .memory-card { background: var(--sun); color: var(--sun-ink); }
[data-style="bold"] .memory-card .memory-link { color: var(--sun-ink); }
[data-style="bold"] .memory-icon, [data-style="bold"] .avatar, [data-style="bold"] .tile-icon, [data-style="bold"] .icon-chip, [data-style="bold"] .icon-btn { border-radius: var(--r-small); }
[data-style="bold"] .date-day { border-radius: 0; background: var(--ink); color: var(--surface); }
[data-style="bold"] .greet span { color: var(--accent); }
[data-style="bold"] .filter-section h3, [data-style="bold"] .card-head h2, [data-style="bold"] .card-head h3, [data-style="bold"] .chart-title { text-transform: uppercase; letter-spacing: 0.04em; font-size: 13px; font-weight: 800; }
[data-style="bold"] .tabbar { left: 0; right: 0; bottom: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); border-top: 2px solid var(--ink); box-shadow: none; }
[data-style="bold"] .tab { color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; }
[data-style="bold"] .tab[aria-current="page"] { color: var(--ink); }
[data-style="bold"] .tab[aria-current="page"] .icon { padding: 3px 12px; background: var(--sun); color: var(--sun-ink); box-shadow: inset 0 0 0 2px var(--ink); }
[data-style="bold"] .tab-add-circle { border-radius: 0; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
@media (min-width: 900px) {
  [data-style="bold"] body { background: var(--bg); }
  [data-style="bold"] .topbar { background: var(--surface); border-bottom: 2px solid var(--ink); }
  [data-style="bold"] .brand { text-transform: uppercase; letter-spacing: 0.02em; font-weight: 800; }
  [data-style="bold"] .topnav a { border-radius: 0; text-transform: uppercase; letter-spacing: 0.04em; font-size: 13px; font-weight: 700; color: var(--ink); }
  [data-style="bold"] .topnav a:hover { background: var(--surface-2); }
  [data-style="bold"] .topnav a[aria-current="page"] { background: var(--sun); color: var(--sun-ink); box-shadow: inset 0 0 0 2px var(--ink); }
  [data-style="bold"] main { margin: 0; border-radius: 0; min-height: calc(100dvh - 72px); }
  [data-style="bold"] .feed-top { top: 72px; }
}
[data-style="moss"] .login-card .brand-mark { --logo-bg: var(--accent); --logo-ink: var(--accent-ink); }
[data-style="bold"] .memory-card :is(.muted, .small, .icon-btn) { color: var(--sun-ink); }
@media (min-width: 900px) {
  [data-style="bold"] .topnav a { padding: 0 10px; font-size: 12px; }
  [data-style="bold"] .brand small { display: none; }
}
/* The uppercase menu is wider, so Bold switches to icons up to a larger width. */
@media (min-width: 900px) and (max-width: 1499px) {
  [data-style="bold"] .topnav a span:not(.icon) { display: none; }
  [data-style="bold"] .topnav a { width: 42px; padding: 0; justify-content: center; }
}
