/* Layout and components. All values come from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--fs-md);
  line-height: var(--lh-text);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.has-tabs { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
h1, h2, h3, p, dl, dd, ol, ul, fieldset { margin: 0; padding: 0; }
ol, ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--s2); top: -100px; padding: var(--s2) var(--s3); background: var(--text); color: var(--bg); border-radius: var(--r-sm); z-index: 10; }
.skip:focus { top: var(--s2); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: var(--r-sm); }

.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1, "lnum" 1; }
.muted { color: var(--text-3); font-weight: 400; }
.js .nojs-only { display: none; }
html:not(.js) .js-only { display: none; }

/* ---------- page frame ---------- */

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-left)) var(--s7) max(var(--gutter), env(safe-area-inset-right));
  animation: page-in var(--t-slow) var(--ease-out) both;
}
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

.topbar {
  display: flex; align-items: center; gap: var(--s2);
  min-height: 56px;
  padding-top: env(safe-area-inset-top);
  margin: 0 calc(-1 * var(--s3));
}
.topbar .eyebrow { flex: 1; padding-left: var(--s3); }
.topbar .back + .eyebrow { padding-left: 0; }
.eyebrow { font-size: var(--fs-sm); color: var(--text-2); letter-spacing: .01em; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: var(--tap); height: var(--tap); flex: none;
  border: 0; background: none; border-radius: var(--r-md);
  color: var(--text-2); text-decoration: none;
  transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast);
}
a.icon-btn:active, button.icon-btn:active { transform: scale(.92); }
@media (hover: hover) { a.icon-btn:hover { color: var(--text); } }

.page-head { padding: var(--s4) 0 var(--s5); }
.title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-2xl);
  line-height: var(--lh-tight);
  letter-spacing: -.01em;
  font-variation-settings: "opsz" 72, "SOFT" 30;
  text-wrap: balance;
}
.lede { color: var(--text-2); margin-top: var(--s3); text-wrap: pretty; }
.label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: var(--s3);
}
.label .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.empty-line { color: var(--text-2); font-size: var(--fs-sm); margin-top: var(--s4); text-wrap: pretty; }

/* ---------- bottom tabs ---------- */

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 5;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 0 max(var(--s2), env(safe-area-inset-left)) env(safe-area-inset-bottom) max(var(--s2), env(safe-area-inset-right));
  background: var(--bg);
  border-top: var(--hairline);
  view-transition-name: tabs;
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 60px;
  font-size: var(--fs-xs); font-weight: 500;
  color: var(--text-3); text-decoration: none;
  transition: color var(--t-fast);
}
.tab::before {
  content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 2px;
  background: var(--accent);
  transform: scaleX(0); transition: transform var(--t-base) var(--ease-out);
}
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] .icon { color: var(--accent-text); }
.tab[aria-current="page"]::before { transform: scaleX(1); }
.tab:active .icon { transform: scale(.9); }
.tab .icon { transition: transform var(--t-fast) var(--ease-out); }
@media (min-width: 40rem) {
  .tabs { left: 50%; right: auto; width: var(--page-max); transform: translateX(-50%); border-inline: var(--hairline); }
}

/* ---------- hero streak ---------- */

.hero { padding: var(--s5) 0 var(--s6); text-align: left; }
.hero-num {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: 400;
  line-height: .9;
  letter-spacing: -.035em;
  font-variation-settings: "opsz" 144, "SOFT" 60, "WONK" 0;
  margin-left: -.04em;
}
.hero-label { font-family: var(--font-display); font-size: var(--fs-xl); font-variation-settings: "opsz" 36; line-height: 1.2; margin-top: var(--s2); }
.hero-hint { color: var(--text-2); font-size: var(--fs-sm); margin-top: var(--s1); min-height: 1.5em; }
.hero-meta {
  display: flex; gap: var(--s6);
  margin-top: var(--s5); padding-top: var(--s4);
  border-top: var(--hairline);
}
.hero-meta dt, .streak-row dt, .figures dt { font-size: var(--fs-xs); color: var(--text-2); }
.hero-meta dd { font-size: var(--fs-xl); line-height: 1.2; }

/* odometer */
.odo { display: inline-flex; }
.odo-reels { display: inline-flex; }
.odo-digit { display: inline-block; height: 1em; overflow: hidden; line-height: 1; }
.odo-reel { display: flex; flex-direction: column; transition: transform 900ms var(--ease-roll); }
.odo-reel > span { height: 1em; line-height: 1; }
.hero-num .odo-digit { height: .92em; }
/* Tabular figures keep the reels from jittering; pull them together so "18" doesn't read as "1 8". */
.odo-digit + .odo-digit { margin-left: -.04em; }
.hero-num .odo-digit + .odo-digit { margin-left: -.09em; }
.hero-num .odo-reel > span { height: .92em; line-height: .92; }

/* ---------- week strip & cells ---------- */

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: var(--s5); }
.week .cell {
  display: flex; align-items: flex-end; justify-content: center;
  aspect-ratio: 1 / 1.15; min-height: var(--tap);
  border-radius: var(--r-sm);
  background: var(--cell-empty);
  text-decoration: none;
  font-size: var(--fs-xs); font-weight: 500;
  color: var(--text-2);
  padding-bottom: 4px;
  animation: cell-in var(--t-base) var(--ease-out) both;
}
.week li:nth-child(1) .cell { animation-delay: 40ms; }
.week li:nth-child(2) .cell { animation-delay: 70ms; }
.week li:nth-child(3) .cell { animation-delay: 100ms; }
.week li:nth-child(4) .cell { animation-delay: 130ms; }
.week li:nth-child(5) .cell { animation-delay: 160ms; }
.week li:nth-child(6) .cell { animation-delay: 190ms; }
.week li:nth-child(7) .cell { animation-delay: 220ms; }
.week .cell[data-today] { box-shadow: inset 0 0 0 1.5px var(--text); }
.week li { position: relative; }
.week li:has([data-selected])::after {
  content: ""; position: absolute; left: 32%; right: 32%; bottom: -8px; height: 2px; border-radius: 1px;
  background: var(--text); animation: bar-in var(--t-base) var(--ease-out) both 200ms;
}
@keyframes bar-in { from { transform: scaleX(0); } }
.week.small { gap: 3px; margin-top: var(--s2); max-width: 140px; }
.week.small .cell { aspect-ratio: 1; min-height: 0; border-radius: var(--r-xs); padding: 0; }
.week.small .cell[data-today] { box-shadow: inset 0 0 0 1px var(--text-2); }

[data-s="in"]:is(.cell, .cal-cell, .swatch) { background: var(--state-in); color: var(--on-in); }
[data-s="none"]:is(.cell, .cal-cell, .swatch) { background: var(--state-none); color: var(--on-none); }
[data-s="over"]:is(.cell, .cal-cell, .swatch) {
  background-color: var(--state-over);
  background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--hatch) 3px 4.5px);
  color: var(--on-over);
}
@keyframes cell-in { from { opacity: 0; transform: scale(.82); } }

/* ---------- check-in ---------- */

.checkin { border-top: var(--hairline); padding-top: var(--s4); }
.day-switch { display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center; margin: 0 calc(-1 * var(--s3)) var(--s4); }
.day-title {
  text-align: center;
  font-family: var(--font-display); font-weight: 500; font-size: var(--fs-lg);
  font-variation-settings: "opsz" 36;
  display: flex; align-items: center; justify-content: center; gap: var(--s2); flex-wrap: wrap;
}
.badge {
  font-family: var(--font-text); font-size: var(--fs-xs); font-weight: 600;
  color: var(--accent-text); border: 1px solid currentColor; border-radius: var(--r-xs);
  padding: 0 6px; line-height: 1.6;
}
.group + .group { margin-top: var(--s5); }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.toggles { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }

.choice, .toggle {
  position: relative; overflow: hidden; isolation: isolate;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--r-md);
  text-align: left;
  transition: transform var(--t-fast) var(--ease-out), border-color var(--t-base);
  touch-action: manipulation;
}
.choice:active, .toggle:active { transform: scale(.97); }
.choice { min-height: 84px; padding: var(--s4); }
.toggle { min-height: 72px; padding: var(--s3); }

.fill {
  position: absolute; z-index: -1;
  left: var(--x, 50%); top: var(--y, 50%);
  width: 300%; aspect-ratio: 1; border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform var(--t-slow) var(--ease-spring);
}
.choice[aria-pressed="true"] .fill, .toggle[aria-pressed="true"] .fill { transform: translate(-50%, -50%) scale(1); }
.choice[aria-pressed="false"] .fill, .toggle[aria-pressed="false"] .fill { transition-duration: var(--t-base); transition-timing-function: var(--ease-in-out); }

.choice[data-kind="in"] .fill { background: var(--state-in); }
.choice[data-kind="over"] .fill { background: var(--state-over); }
.choice[aria-pressed="true"] { border-color: transparent; }
.choice[data-kind="in"][aria-pressed="true"] { color: var(--on-in); }
.choice[data-kind="over"][aria-pressed="true"] { color: var(--on-over); }
.choice .choice-body { display: flex; flex-direction: column; justify-content: space-between; gap: var(--s4); height: 100%; }
.choice .choice-text { font-weight: 600; font-size: var(--fs-lg); line-height: 1.1; }
.choice .icon, .choice .tick { width: 24px; height: 24px; }
.choice-body { position: relative; transition: color var(--t-base); }
.choice .tick, .toggle .tick { position: absolute; top: 0; left: 0; }

.tick { fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.tick path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset var(--t-base) var(--ease-out); }
[aria-pressed="true"] .tick path { stroke-dashoffset: 0; transition-delay: 120ms; transition-duration: 340ms; }
[aria-pressed="true"] .choice-icon, [aria-pressed="true"] .toggle-mark > .icon { opacity: 0; transform: scale(.6); }
.choice-icon, .toggle-mark > .icon { transition: opacity var(--t-fast), transform var(--t-base) var(--ease-out); }

.toggle .fill { background: var(--state-in-wash); }
.toggle[aria-pressed="true"] { border-color: var(--state-in); }
.toggle-body { display: flex; flex-direction: column; gap: var(--s2); font-weight: 500; font-size: var(--fs-sm); }
.toggle-mark { position: relative; width: 22px; height: 22px; color: var(--text-2); }
.toggle[aria-pressed="true"] .toggle-mark { color: var(--state-in); }
.toggle .tick { width: 22px; height: 22px; }

/* note */
.note textarea, .field input, .inline-form input {
  width: 100%;
  border: 1px solid var(--line-input);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: var(--s3);
  font-size: var(--fs-md);
  line-height: 1.4;
  transition: border-color var(--t-fast);
}
.note textarea { resize: vertical; min-height: 3.2em; field-sizing: content; max-height: 12em; }
.note textarea:focus, .field input:focus, .inline-form input:focus { outline: none; border-color: var(--text); }
textarea::placeholder, input::placeholder { color: var(--text-3); opacity: 1; }
.note-bar { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s2); flex-wrap: wrap; }
.share {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s3) 0 var(--s2); margin-left: calc(-1 * var(--s2));
  border: 0; background: none; border-radius: var(--r-sm);
  font-size: var(--fs-sm); color: var(--text-2);
}
.share .icon { width: 20px; height: 20px; }
.share[aria-pressed="true"] { color: var(--accent-text); }
.share[aria-pressed="true"] .off-only, .share[aria-pressed="false"] .on-only { display: none; }
.save-state { font-size: var(--fs-xs); color: var(--text-3); margin-left: auto; transition: opacity var(--t-base); }
.save-state:empty { opacity: 0; }

/* ---------- buttons ---------- */

.btn, .btn-secondary, .btn-line, .btn-text, .btn-quiet {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s4);
  border-radius: var(--r-sm);
  font-weight: 600; font-size: var(--fs-md); text-decoration: none;
  transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast);
}
.btn { background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); }
.btn.btn-secondary, .btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--line-strong); }
.btn-line { background: var(--surface); border: 1px solid var(--line-strong); font-size: var(--fs-sm); padding: 0 var(--s3); }
.btn-text { background: none; border: 0; color: var(--text-2); padding: 0 var(--s2); margin-left: calc(-1 * var(--s2)); font-weight: 500; font-size: var(--fs-sm); }
.btn-quiet { background: none; border: 1px solid var(--line-strong); font-size: var(--fs-sm); min-height: 36px; }
.btn-block { width: 100%; }
.btn .icon, .btn-line .icon, .btn-text .icon { width: 18px; height: 18px; }
:is(.btn, .btn-secondary, .btn-line, .btn-text, .btn-quiet):active { transform: scale(.97); }
.btn-text:hover { color: var(--text); }

/* ---------- forms & auth ---------- */

.stack { display: flex; flex-direction: column; gap: var(--s4); }
.field label { display: block; font-size: var(--fs-sm); font-weight: 500; margin-bottom: 6px; }
.field .hint { font-size: var(--fs-xs); color: var(--text-2); margin-top: 6px; }
.form-error { color: var(--accent-text); font-size: var(--fs-sm); font-weight: 500; }
.form-ok { color: var(--text-2); font-size: var(--fs-sm); }
.form-block { padding: var(--s5) 0; border-top: var(--hairline); }
.page-head + .form-block, .empty + .form-block { border-top: 0; }
.inline-form { display: flex; gap: var(--s2); }
.inline-form input { flex: 1; min-width: 0; }
.inline-form + .form-error { margin-top: var(--s2); }
.code-input { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: .12em; text-transform: uppercase; }

body.auth .page { display: flex; min-height: 100dvh; align-items: center; padding-top: env(safe-area-inset-top); }
.auth-card { width: 100%; padding: var(--s7) 0; display: flex; flex-direction: column; gap: var(--s4); }
.auth-card .title { margin-bottom: var(--s2); }
.auth-card .lede { margin: 0 0 var(--s2); }
.auth-card .btn + .btn { margin-top: calc(-1 * var(--s1)); }
.brand {
  font-family: var(--font-display); font-size: var(--fs-md); font-weight: 600;
  color: var(--accent-text); letter-spacing: .02em;
  display: inline-flex; align-items: center; gap: var(--s2);
}
.brand::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--accent); }
.auth-alt { font-size: var(--fs-sm); color: var(--text-2); }
.auth-alt a { color: var(--text); text-underline-offset: 3px; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.segmented button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); border: 0; background: none; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2);
}
.segmented button + button { border-left: 1px solid var(--line-strong); }
.segmented button[aria-checked="true"] { background: var(--text); color: var(--bg); }
.segmented .icon { width: 18px; height: 18px; }

/* ---------- lists ---------- */

.plain-list { border-top: var(--hairline); }
.list-link {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 56px; border-bottom: var(--hairline); text-decoration: none;
}
.list-link > span:first-child { flex: 1; font-weight: 500; }
.list-link .icon { color: var(--text-3); width: 18px; height: 18px; }

.members { border-top: var(--hairline); }
.member {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4) 0; border-bottom: var(--hairline); text-decoration: none;
  transition: opacity var(--t-fast);
}
.member:active { opacity: .6; }
.member-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.member-name { font-weight: 600; font-size: var(--fs-lg); }
.member-status { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); }
.member-status .icon { width: 16px; height: 16px; stroke-width: 2.25; }
.member-status[data-s="in"] .icon { color: var(--state-in); }
.member-status[data-s="over"] .icon { color: var(--state-over); }
.member-streak { display: flex; flex-direction: column; align-items: flex-end; }
.member-streak .num { font-size: 2.75rem; line-height: 1; font-variation-settings: "opsz" 144, "SOFT" 60; letter-spacing: -.02em; }
.member-streak .unit { font-size: var(--fs-xs); color: var(--text-2); }

.stagger > li { animation: rise var(--t-slow) var(--ease-out) both; }
.stagger > li:nth-child(2) { animation-delay: 60ms; }
.stagger > li:nth-child(3) { animation-delay: 120ms; }
.stagger > li:nth-child(4) { animation-delay: 180ms; }
.stagger > li:nth-child(n+5) { animation-delay: 240ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.group-switch { display: flex; gap: var(--s4); margin-top: var(--s3); overflow-x: auto; scrollbar-width: none; }
.group-switch a { text-decoration: none; color: var(--text-2); font-size: var(--fs-sm); padding: var(--s2) 0; white-space: nowrap; border-bottom: 2px solid transparent; }
.group-switch a[aria-current] { color: var(--text); border-color: var(--accent); }

.invite { margin-top: var(--s6); }
.invite-box { border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.invite-code { font-size: var(--fs-2xl); letter-spacing: .1em; line-height: 1.2; }
.invite-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.row-actions { display: flex; gap: var(--s4); margin-top: var(--s3); flex-wrap: wrap; }

/* ---------- history ---------- */

.streak-row { display: flex; gap: var(--s6); margin-top: var(--s4); }
.streak-row dd { font-size: var(--fs-2xl); line-height: 1.1; }

.month { padding-bottom: var(--s5); }
.month-head { display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center; margin: 0 calc(-1 * var(--s3)) var(--s3); }
.month-head h2 { text-align: center; font-family: var(--font-display); font-weight: 500; font-size: var(--fs-lg); font-variation-settings: "opsz" 36; }

.cal { display: flex; flex-direction: column; gap: 5px; }
.cal-head, .cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-head span { text-align: center; font-size: var(--fs-xs); color: var(--text-3); padding-bottom: 2px; }
.cal-cell {
  position: relative;
  display: flex; align-items: flex-start; justify-content: flex-start;
  aspect-ratio: 1; min-height: 40px;
  padding: 4px 5px;
  border-radius: var(--r-sm);
  background: var(--cell-empty);
  font-size: var(--fs-xs); font-weight: 500; font-variant-numeric: tabular-nums;
  color: var(--text-2); text-decoration: none;
  animation: cell-in var(--t-base) var(--ease-out) both;
}
.cal-cell[data-future] { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--text-3); }
.cal-cell[data-today] { box-shadow: inset 0 0 0 1.5px var(--text); }
.cal-cell[data-extra]::after {
  content: ""; position: absolute; right: 5px; bottom: 5px;
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}
a.cal-cell:active { transform: scale(.94); }
/* wave: delay grows left→right, with a slight lag per row */
.cal-cell { animation-delay: calc(var(--row, 0) * 25ms + var(--col-delay, 0ms)); }
.cal-cell.h1 { --row: 1; } .cal-cell.h2 { --row: 2; } .cal-cell.h3 { --row: 3; } .cal-cell.h4 { --row: 4; } .cal-cell.h5 { --row: 5; }
.cal-cell.w1 { --col-delay: 35ms; } .cal-cell.w2 { --col-delay: 70ms; } .cal-cell.w3 { --col-delay: 105ms; }
.cal-cell.w4 { --col-delay: 140ms; } .cal-cell.w5 { --col-delay: 175ms; } .cal-cell.w6 { --col-delay: 210ms; }

.legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: var(--s3); font-size: var(--fs-xs); color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: var(--r-xs); background: var(--cell-empty); }
.swatch.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); margin: 0 3.5px; }

.stats { padding: var(--s5) 0; border-top: var(--hairline); }
.figures { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s3); }
.figures dd { margin-top: 2px; }
.figures .num { font-size: var(--fs-2xl); line-height: 1.1; }
.figures .of { font-size: var(--fs-sm); color: var(--text-3); margin-left: 3px; }

.trend-list li { display: grid; grid-template-columns: 1fr auto 3ch; align-items: center; gap: var(--s4); min-height: 52px; border-bottom: var(--hairline); }
.trend-list li:first-child { border-top: var(--hairline); }
.trend-name { font-size: var(--fs-sm); }
.trend-val { font-size: var(--fs-xl); text-align: right; }
.spark { overflow: visible; display: block; }
.spark-base { stroke: var(--line); stroke-width: 1; }
.spark-line { fill: none; stroke: var(--text-2); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-end { fill: var(--accent); }
.spark-hit { fill: transparent; }

.notes { padding: var(--s5) 0; border-top: var(--hairline); }
.note-list li { display: grid; grid-template-columns: 4.5em 1fr; gap: var(--s3); padding: var(--s3) 0; border-bottom: var(--hairline); font-size: var(--fs-sm); }
.note-list time { color: var(--text-2); }
.note-list p { white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- empty state ---------- */

.empty { padding: var(--s5) 0 var(--s6); }
.empty-art { width: 140px; height: auto; margin-bottom: var(--s5); }
.empty-art rect { fill: var(--cell-empty); animation: cell-in var(--t-base) var(--ease-out) both; }
.empty-art .ea1, .empty-art .ea4, .empty-art .eb2, .empty-art .eb3 { fill: var(--state-in); }
.empty-art .ea5, .empty-art .eb5 { fill: var(--state-over); }
.empty-art .ea0, .empty-art .eb6 { fill: var(--state-none); }
.empty-art .ea1, .empty-art .eb1 { animation-delay: 40ms; } .empty-art .ea2, .empty-art .eb2 { animation-delay: 80ms; }
.empty-art .ea3, .empty-art .eb3 { animation-delay: 120ms; } .empty-art .ea4, .empty-art .eb4 { animation-delay: 160ms; }
.empty-art .ea5, .empty-art .eb5 { animation-delay: 200ms; } .empty-art .ea6, .empty-art .eb6 { animation-delay: 240ms; }
.empty-art rect { transform-box: fill-box; transform-origin: center; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg);
  padding: var(--s2) var(--s4); border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 500;
  transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- transitions ---------- */

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 160ms var(--ease-in-out) both; }
::view-transition-new(root) { animation: vt-in 300ms var(--ease-out) both; }
::view-transition-group(tabs) { animation: none; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }
/* With view transitions, the page itself doesn't need its own entry animation. */
@supports (view-transition-name: none) { .page { animation: none; } }
html.theme-switching::view-transition-old(root),
html.theme-switching::view-transition-new(root) { animation-duration: 360ms; animation-timing-function: var(--ease-in-out); transform: none; }
html.theme-switching::view-transition-new(root) { animation-name: vt-fade; }
@keyframes vt-fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation-duration: 1ms !important; animation-delay: 0ms !important;
    transition-duration: 1ms !important; transition-delay: 0ms !important;
  }
}

@media (forced-colors: active) {
  [data-s="in"]:is(.cell, .cal-cell, .swatch, .mk) { background: Highlight; forced-color-adjust: none; }
  .choice[aria-pressed="true"], .toggle[aria-pressed="true"] { outline: 3px solid Highlight; }
}

/* ---------- "Sonstiges" free-text activity ---------- */

.other-row { margin-top: var(--s3); }
.other-row input {
  width: 100%; border: 1px solid var(--line-input); border-radius: var(--r-sm);
  background: var(--surface); padding: var(--s3); font-size: var(--fs-md);
  transition: border-color var(--t-fast);
}
.other-row input:focus { outline: none; border-color: var(--text); }
.other-row .hint { font-size: var(--fs-xs); color: var(--text-2); margin-top: 6px; }
.js .other-row[data-collapsed] { display: none; }
.js .other-row:not([data-collapsed]) { animation: rise var(--t-base) var(--ease-out) both; }

/* ---------- user icons ---------- */

.ubadge {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  color: var(--text);
}
.ubadge .icon { width: 20px; height: 20px; }
.title-with-badge { display: flex; align-items: center; gap: var(--s3); }
.title-with-badge .ubadge { width: 44px; height: 44px; }

.hint-line { font-size: var(--fs-sm); color: var(--text-2); margin: calc(-1 * var(--s1)) 0 var(--s3); }
.icon-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.icon-grid button {
  display: grid; place-items: center; aspect-ratio: 1; min-height: var(--tap);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--text-2);
  transition: transform var(--t-fast) var(--ease-out), border-color var(--t-fast);
}
.icon-grid button:active { transform: scale(.92); }
.icon-grid button[aria-pressed="true"] { border: 1.5px solid var(--accent); color: var(--accent-text); background: var(--accent-wash); }

/* ---------- shared calendar ---------- */

.month > .label { margin-bottom: 0; }
.month-head h3 { text-align: center; font-family: var(--font-display); font-weight: 500; font-size: var(--fs-lg); font-variation-settings: "opsz" 36; }
.gcal-cell { flex-direction: column; justify-content: space-between; aspect-ratio: auto; min-height: 50px; padding: 4px; background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.gcal-cell[data-all] { background: var(--surface-sunk); box-shadow: none; }
.gcal-cell[data-today] { box-shadow: inset 0 0 0 1.5px var(--text); }
.gcal-cell[aria-current="date"] { box-shadow: inset 0 0 0 2px var(--accent); }
.gcal-day { line-height: 1; padding: 1px 0 0 1px; }
.marks { display: flex; flex-wrap: wrap; gap: 2px; }
.marks.n3, .marks.n4 { display: grid; grid-template-columns: repeat(2, max-content); }
.marks.n3 .mk, .marks.n4 .mk { width: 14px; height: 14px; }
.marks.n3 .mk .icon, .marks.n4 .mk .icon { width: 10px; height: 10px; }
.marks-count { font-size: var(--fs-xs); color: var(--text-2); }

.mk {
  display: inline-grid; place-items: center; flex: none;
  width: 17px; height: 17px; border-radius: var(--r-xs);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text-3);
}
.mk .icon { width: 12px; height: 12px; stroke-width: 2.25; }
.mk[data-s="in"] { background: var(--state-in); color: var(--on-in); box-shadow: none; }
.mk[data-s="none"] { background: var(--state-none); color: var(--on-none); box-shadow: none; }
.mk[data-s="over"] { background: var(--state-over); color: var(--on-over); box-shadow: none; }
.mk.lg[data-s="over"] { background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--hatch) 3px 4.5px); }
.mk.lg { width: 32px; height: 32px; border-radius: var(--r-sm); }
.mk.lg .icon { width: 18px; height: 18px; stroke-width: 2; }
.legend .mk { width: 14px; height: 14px; }
.legend .mk .icon { width: 10px; height: 10px; }
.swatch.all { background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line-strong); }

.day-detail { margin-top: var(--s5); border-top: var(--hairline); padding-top: var(--s4); scroll-margin-top: var(--s5); animation: rise var(--t-slow) var(--ease-out) both; }
.day-detail-title { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-lg); font-variation-settings: "opsz" 36; margin-bottom: var(--s3); }
.day-detail li { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) 0; border-bottom: var(--hairline); }
.day-detail li:last-child { border-bottom: 0; }
.day-detail li > div { flex: 1; min-width: 0; padding-top: 4px; }
.day-detail strong { font-weight: 600; }
.day-extras { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); margin-top: var(--s1); font-size: var(--fs-sm); color: var(--text-2); }
.day-extras span { display: inline-flex; align-items: center; gap: 5px; }
.day-extras .icon { width: 15px; height: 15px; }
.day-note { margin-top: var(--s1); font-size: var(--fs-sm); color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }

.member > .ubadge { align-self: flex-start; margin-top: 2px; }
.note-other { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.note-other .icon { width: 15px; height: 15px; color: var(--text-2); }
.note-text { white-space: pre-line; overflow-wrap: anywhere; }
.note-other + .note-text { margin-top: 2px; color: var(--text-2); }
.members ~ .month, .empty-line + .month { margin-top: var(--s6); }
.member-status[data-s="none"]::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--state-none); margin-right: 3px; }
