/* MyHome — components.
 *
 * Organised by the design's own component inventory. Every fixed dimension in
 * here comes from the handoff's fixed-geometry table, and every fixed dimension
 * is paired with an overflow rule in the same block — the two belong together,
 * because a fixed box without a truncation rule is the bug the rule exists to
 * prevent.
 */

/* ======================================================================
 * Shell
 * ==================================================================== */

/* The app is one scroller filling the screen, with the header and the tab
 * bar floating over it (wave 7, Liquid Glass): content scrolls *under* the
 * chrome, which is what gives the glass something to show through. Before
 * wave 7 it was a column — opaque header, scroller, opaque tab bar.
 *
 * height, not min-height: the screen scrolls inside .app__main and the tab
 * bar stays on screen. With min-height a list longer than the viewport grew
 * the page and pushed the tab bar below the fold (first-use feedback). */
.app {
  height: 100dvh;
  background: var(--app-bg);
  background-attachment: fixed;
  color: var(--foreground);
  position: relative;
  overflow: hidden;
}

.app__main {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: var(--header-h);
  scrollbar-width: none;
}

/* Hidden scrollbars in the scroller, the sheets and the person filter: the
 * design's chrome floats over the content, and a bar along the right edge
 * would run underneath the glass. Scrolling itself is untouched. */
.app__main::-webkit-scrollbar,
.sheet::-webkit-scrollbar {
  display: none;
}

/* Wider viewports keep the single column and centre it; the handoff leaves
 * anything more than that undesigned. */
.app__column {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
}

/* Room under the last row for the floating tab bar and the FAB above it;
 * 100px on a screen with no FAB. */
.app__tail {
  height: 140px;
}

.app__tail--short {
  height: 100px;
}

.screen {
  animation: shadIn 0.26s var(--ease) both;
}

/* ======================================================================
 * Liquid Glass materials (wave 7, ADR-0016)
 *
 * Glass is the control layer only — tab bar, header controls, FAB, sheets,
 * toast, celebration card. Content stays solid, and nothing inside a glass
 * surface is glass again. Every value comes from tokens.css, where the
 * reduced-transparency and increased-contrast overrides swap them, so no
 * rule here needs a variant for either.
 * ==================================================================== */

.glass {
  background: var(--glass-sheen), var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--glass-shadow);
  border: var(--glass-border);
  color: var(--foreground);
}

/* Larger surfaces are thicker glass: sheets and the celebration card. */
.glass--thick {
  background: var(--glass-sheen), var(--glass-thick-bg);
  -webkit-backdrop-filter: var(--glass-thick-filter);
  backdrop-filter: var(--glass-thick-filter);
}

/* The main action only: "+ Aufgabe" and a sheet's primary button. */
.glass--tint {
  background: var(--glass-sheen), var(--glass-tint-bg);
  box-shadow: var(--glass-tint-shadow);
  color: var(--tint-fg);
  border-color: transparent;
}

/* A 44px glass circle: the header's back button, the login screen's theme
 * toggle. */
.glass-circle {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The springy press. The overshoot in the curve is the "liquid" in the
 * name; the reduced-motion backstop in base.css flattens it. Each control
 * states its own scale (back and theme 1.1, avatar 1.12, FAB 1.08). */
.glass-press {
  --press: 1.1;
  transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1), background 0.2s var(--ease);
}

.glass-press:active {
  transform: scale(var(--press));
}

/* ======================================================================
 * Header — a transparent overlay
 * ==================================================================== */

/* It covers the top of the scroller and lets taps through, except on its
 * own controls. */
.header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  pointer-events: none;
}

/* The scroll edge effect: an 86px band of the page colour fading out
 * downwards, blurred a little, so a title stays legible over a card sliding
 * under it. The mask takes away the band's own lower edge. */
.header__edge {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 86px;
  background: linear-gradient(to bottom, var(--background) 30%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}

/* Three columns — the side groups take equal shares, the middle is the 40px
 * logo — so the logo is centred at any width and the title truncates before
 * it reaches it. */
.header__bar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 4px 14px 10px;
  pointer-events: auto;
}

.header__side {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header__side--end {
  justify-content: flex-end;
}

.header__center {
  width: 40px;
  height: 40px;
  justify-self: center;
}

.header__logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: var(--shadow-xs);
  object-fit: contain;
  pointer-events: none;
}

.header__logo--dark,
[data-theme='dark'] .header__logo--light {
  display: none;
}

[data-theme='dark'] .header__logo--dark {
  display: block;
}

/* The login screen has no header, so it carries the mark itself, larger; the
 * same light/dark swap as the header logo. */
.login__logo img {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  object-fit: contain;
}

.login__logo .login__logo--dark,
[data-theme='dark'] .login__logo .login__logo--light {
  display: none;
}

[data-theme='dark'] .login__logo .login__logo--dark {
  display: block;
}

.header__title {
  margin: 0;
  flex: 1;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* At 375 px a side column is 145 px, and beside the 44 px back circle the
 * design's 24 px cut "Aufgabe" (98 px) to 94. Narrow phones get 22 px, which
 * keeps every title whole there (e2e i18n journey). */
@media (max-width: 379px) {
  .header__title {
    font-size: 22px;
  }
}

/* One glass capsule, 44px tall, holding the theme toggle and the avatar. */
.header__capsule {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  padding: 0 4px;
  border-radius: 99px;
}

/* Inside the capsule the toggle is a plain 36px circle: no glass on glass. */
.theme-toggle {
  --press: 1.12;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
}

.theme-toggle:hover {
  background: var(--glass-pill);
}

/* Circles everywhere in content since wave 7: period arrows, steppers, the
 * profile's photo buttons. Bordered variant on a card, borderless on glass. */
.icon-button {
  width: var(--icon-btn);
  height: var(--icon-btn);
  flex: none;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.18s var(--ease);
}

.icon-button:hover {
  background: var(--accent);
}

.icon-button--outlined {
  border-color: var(--border);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}

.icon-button--36 {
  width: 36px;
  height: 36px;
}

.icon-button--44 {
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: var(--primary-foreground);
}

.avatar-button {
  --press: 1.12;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 99px;
  background: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

/* ======================================================================
 * Segmented control — the shadcn Tabs pattern
 * ==================================================================== */

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 99px;
  background: var(--muted);
}

.segmented__item {
  flex: 1;
  min-width: 0;
  height: 30px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted-foreground);
  background: transparent;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.segmented__item[aria-selected='true'],
.segmented__item[aria-pressed='true'] {
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-xs);
}

.segmented__item > span {
  font-size: 12.5px;
  font-weight: 500;
}

/* The profile and admin variants are 32px and have no icon. */
.segmented--32 .segmented__item {
  height: 32px;
}

/* ======================================================================
 * Period navigator
 *
 * A 32px / 1fr / 32px grid rather than flexbox with space-between: explicit
 * product feedback is that the label stays optically centred no matter how
 * long the date string is, and only a grid with equal side tracks does that.
 * ==================================================================== */

.period {
  display: grid;
  grid-template-columns: var(--icon-btn) 1fr var(--icon-btn);
  align-items: center;
  gap: 8px;
  padding: 12px 14px 4px;
}

.period__label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 0;
  background: transparent;
}

.period__primary {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  max-width: 100%;
}

.period__secondary {
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted-foreground);
  text-align: center;
  max-width: 100%;
}

/* ======================================================================
 * Person filter — a sideways-scrolling row of pill links under the period
 * navigator. The current choice takes the segmented control's selected look
 * so the two controls above the list read as one family.
 * ==================================================================== */

.person-filter {
  display: flex;
  gap: 6px;
  padding: 8px 14px 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.person-filter::-webkit-scrollbar {
  display: none;
}

.person-filter__chip {
  flex: none;
  max-width: 160px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.person-filter__chip:has(.person-filter__avatar) {
  padding-left: 4px;
}

.person-filter__chip[aria-current='true'] {
  background: var(--secondary);
  border-color: var(--foreground);
  color: var(--foreground);
}

.person-filter__avatar {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 99px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 600;
}

.person-filter__avatar[data-unassigned] {
  background: transparent;
  color: var(--ink-muted);
}

/* ======================================================================
 * Section head — eyebrow, count pill, rule, chevron
 * ==================================================================== */

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 8px;
  width: 100%;
  background: transparent;
}

.section-head__rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-head__chevron {
  color: var(--muted-foreground);
  transition: transform 0.25s var(--ease);
}

.section-head[aria-expanded='true'] .section-head__chevron {
  transform: rotate(180deg);
}

.count-pill {
  height: 18px;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 600;
}

.count-pill--outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
}

.count-pill--mono {
  font-family: 'Geist Mono', ui-monospace, monospace;
  padding: 0 7px;
  font-size: 10px;
}

/* ======================================================================
 * The urgency tint
 *
 * A tinted surface reads two custom properties — --hue from the category and
 * --lvl from the derived urgency — and computes everything else. The ramp
 * values live in tokens.css; this only selects a row of them.
 *
 * --ink is supplied by the server per card, because the handoff's tabled ink
 * does not clear 4.5:1 on every hue (see web/templates/urgency.go). The
 * fallback below is the tabled value, so a fragment rendered without a
 * computed ink still looks right on the hues where the table holds.
 * ==================================================================== */

.tinted {
  --fillL: var(--fillL0);
  --fillC: var(--fillC0);
  --edgeL: var(--edgeL0);
  --edgeC: var(--edgeC0);
  --ink-tabled: oklch(var(--inkL) var(--inkC) var(--hue));
  --ink: var(--ink-light, var(--ink-tabled));
  --ink-muted: var(--ink-muted-light, var(--muted-foreground));

  background: oklch(var(--fillL) var(--fillC) var(--hue));
  border: 1px solid oklch(var(--edgeL) var(--edgeC) var(--hue));
  color: var(--ink);
  /* Slow enough that an urgency step is noticed rather than blinked past. */
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease),
    box-shadow 0.18s var(--ease);
}

.tinted[data-lvl='1'] { --fillL: var(--fillL1); --fillC: var(--fillC1); --edgeL: var(--edgeL1); --edgeC: var(--edgeC1); }
.tinted[data-lvl='2'] { --fillL: var(--fillL2); --fillC: var(--fillC2); --edgeL: var(--edgeL2); --edgeC: var(--edgeC2); }
.tinted[data-lvl='3'] { --fillL: var(--fillL3); --fillC: var(--fillC3); --edgeL: var(--edgeL3); --edgeC: var(--edgeC3); }
.tinted[data-lvl='4'] { --fillL: var(--fillL4); --fillC: var(--fillC4); --edgeL: var(--edgeL4); --edgeC: var(--edgeC4); }

.tinted[data-lvl='3'] { --ink-tabled: oklch(var(--inkL3) var(--inkC3) var(--hue)); }
.tinted[data-lvl='4'] { --ink-tabled: oklch(var(--inkL4) var(--inkC4) var(--hue)); }

/* The server computes an ink per theme, because the theme is resolved in the
 * browser and it cannot know which one will be in force. Both arrive as custom
 * properties on the row; this picks between them. */
[data-theme='dark'] .tinted {
  --ink: var(--ink-dark, var(--ink-tabled));
  --ink-muted: var(--ink-muted-dark, var(--muted-foreground));
}

/* Secondary ink: a neutral grey while the fill is still pale, the card's own
 * ink once it is saturated enough that grey stops reading. The grey is the
 * server's --ink-muted-light/-dark: the muted token where it clears 4.5:1 on
 * this hue, walked darker or lighter where it does not (MutedInk). */
.tinted[data-lvl='2'],
.tinted[data-lvl='3'],
.tinted[data-lvl='4'] {
  --ink-muted: var(--ink);
}

/* A completed task leaves the colour system altogether. */
.tinted[data-done] {
  background: var(--card);
  border-color: var(--border);
  color: var(--muted-foreground);
  --ink-muted: var(--muted-foreground);
}

/* ======================================================================
 * Task row — 96px, fixed
 * ==================================================================== */

.task {
  height: var(--row-h);
  margin: 0 14px 8px;
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  /* The neon glow is the rim colour spread out: zero in light (--glow 0px),
   * 20px in dark. */
  box-shadow: var(--shadow-xs), 0 0 var(--glow) -6px oklch(var(--edgeL) var(--edgeC) var(--hue));
  width: calc(100% - 28px);
  text-align: left;
}

.task:hover {
  box-shadow: var(--shadow-sm), 0 0 var(--glow) -6px oklch(var(--edgeL) var(--edgeC) var(--hue));
}

.task:active {
  transform: scale(0.99);
}

.task__avatar {
  width: var(--av);
  height: var(--av);
  flex: none;
  position: relative;
}

.task__initials {
  width: 100%;
  height: 100%;
  border-radius: 99px;
  border: 1px solid oklch(var(--edgeL) var(--edgeC) var(--hue));
  background: oklch(0.60 0.17 var(--hue));
  color: var(--avatar-ink, oklch(0.99 0.012 var(--hue)));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 600;
}

/* An unclaimed task shows an em dash on a transparent disc: the slot keeps its
 * size so every row's centre column starts at the same x. */
.task__initials[data-unassigned] {
  background: transparent;
  color: var(--ink-muted);
}

/* 22px category chip, pinned to the avatar's bottom-right with a 3px overhang. */
.task__cat {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 22px;
  height: 22px;
  border-radius: 99px;
  background: oklch(1 0 0 / 0.82);
  color: oklch(0.32 0.09 var(--hue));
  display: flex;
  align-items: center;
  justify-content: center;
}

.tinted[data-done] .task__cat {
  background: var(--card);
  color: var(--muted-foreground);
}

.task__body {
  flex: 1;
  min-width: 0;
  height: var(--av);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

/* 36px is exactly two lines at 14.5px/1.25, so a one-line title and a two-line
 * title occupy the same box and the meta line never moves. */
.task__title {
  height: var(--title-h);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.25;
}

.task__meta {
  height: var(--meta-h);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-muted);
}

/* The right rail is 104px whatever is in it. */
.task__rail {
  width: var(--rail);
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* ---- Status pill — 20px, the only status indicator on the card -------
 *
 * The neutral pill is the base and the coloured one is the variant, which is
 * the opposite of how it reads on screen and is deliberate: this pill also
 * appears on the 64px done row, which has left the colour system and has no
 * --hue, no --edgeL and no --ink to read. Written the other way round it
 * collapsed there — an undefined custom property makes the whole `border`
 * shorthand invalid at computed-value time, and that takes border-style down
 * with it, so the done pill lost its outline entirely and kept a half-white
 * fill on a neutral card. The base below is exactly what the prototype paints
 * on a completed row: transparent, --border, --muted-foreground, --radius-sm.
 */

.status-pill {
  height: var(--badge-h);
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px 0 6px;
}

.status-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--muted-foreground);
  flex: none;
}

/* On a live card the pill takes the card's own colours. These substitutions
 * are safe where the :root aliases were not: --edgeL, --edgeC, --hue and --ink
 * are all declared on .tinted itself, so they resolve against the card that
 * declares them and reach the pill already resolved. */
.tinted:not([data-done]) .status-pill {
  border-radius: 99px;
  border-color: oklch(var(--edgeL) var(--edgeC) var(--hue));
  background: oklch(1 0 0 / 0.5);
  color: var(--ink);
}

.tinted:not([data-done]) .status-pill__dot {
  background: oklch(0.45 0.16 var(--hue));
}

/* Above the ink flip the pill's near-opaque white fill would glare, so it
 * drops its fill and the dot goes white. The prototype used a white wash at
 * 0.18 here; it lifts the pill's background just enough that the near-white
 * ink fell to 3.3–3.8:1 on every hue at level 4. With no fill the pill's ink
 * sits on the card's own fill, which Ink already holds to 4.6:1. Same
 * specificity as the rule above, so these have to stay below it. */
.tinted[data-lvl='3'] .status-pill,
.tinted[data-lvl='4'] .status-pill {
  background: transparent;
  border-color: oklch(1 0 0 / 0.38);
}

.tinted[data-lvl='3'] .status-pill__dot,
.tinted[data-lvl='4'] .status-pill__dot {
  background: oklch(1 0 0 / 0.85);
}

/* Dark mode flips the other way: the ink is near-white up to level 3 and dark
 * at 4, so the translucent treatment covers 0–3 there and level 4 keeps the
 * light fill. A half-white fill under near-white ink measured 2.4:1. */
[data-theme='dark'] .tinted:not([data-done]):not([data-lvl='4']) .status-pill {
  background: transparent;
  border-color: oklch(1 0 0 / 0.38);
}

[data-theme='dark'] .tinted:not([data-done]):not([data-lvl='4']) .status-pill__dot {
  background: oklch(1 0 0 / 0.85);
}

[data-theme='dark'] .tinted[data-lvl='4']:not([data-done]) .status-pill {
  background: oklch(1 0 0 / 0.5);
  border-color: oklch(var(--edgeL) var(--edgeC) var(--hue));
}

[data-theme='dark'] .tinted[data-lvl='4']:not([data-done]) .status-pill__dot {
  background: oklch(0.45 0.16 var(--hue));
}

.tinted[data-done] .status-pill__dot {
  background: var(--muted-foreground);
}

/* ---- Action button — 32px, full rail width, a verb ------------------- */

.task-action {
  width: 100%;
  height: var(--act-h);
  border-radius: var(--radius-sm);
  background: oklch(0.32 0.09 var(--hue));
  color: var(--action-ink, oklch(0.99 0.012 var(--hue)));
  border: 1px solid oklch(0.32 0.09 var(--hue));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 7px;
  box-shadow: var(--shadow-xs);
  transition: opacity 0.18s var(--ease);
}

.task-action:hover {
  opacity: 0.88;
}

.task-action:active {
  transform: scale(0.97);
}

.task-action .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}

.tinted[data-done] .task-action {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
}

/* ---- Snooze — 22px, full rail width ---------------------------------- */

.task-snooze {
  width: 100%;
  height: var(--snooze-h);
  border-radius: var(--radius-sm);
  border: 1px solid oklch(1 0 0 / 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink-muted);
  transition: background 0.18s var(--ease);
}

.task-snooze:hover {
  background: oklch(1 0 0 / 0.3);
}

.task-snooze .icon {
  width: 11px;
  height: 11px;
}

.task-snooze > span {
  font-size: 10px;
  font-weight: 600;
}

/* Once paused, the card itself shows it: bell-off, the end time, dimmed. Only
 * the bell dims — the prototype faded the whole button to 0.75, which took the
 * end time to 3:1 on every hue. */
.task-snooze[data-paused] .icon {
  opacity: 0.75;
}

/* ======================================================================
 * Done row — 64px
 * ==================================================================== */

.done-row {
  height: var(--row-sm);
  width: calc(100% - 28px);
  margin: 0 14px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-foreground);
  text-align: left;
}

/* The prototype fades the whole done row to 0.7. That took the status pill's
 * muted ink to 2.9:1 (light) and 4.1:1 (dark), so the fade is kept only where
 * there is no text to read — the avatar — and the rest of the row recedes
 * through the muted ink, which already clears 4.5:1 on --card. */
.done-row__avatar {
  opacity: 0.7;
}

.done-row__avatar {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 99px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.done-row__title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: line-through;
}

.done-row__rail {
  width: var(--rail);
  flex: none;
  display: flex;
  justify-content: flex-end;
}

/* ======================================================================
 * Week / month compact row — 56px, avatar 34px
 * ==================================================================== */

.row-compact {
  height: var(--row-compact);
  width: calc(100% - 28px);
  margin: 0 14px 8px;
  border-radius: var(--radius);
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  box-shadow: var(--shadow-xs), 0 0 var(--glow) -6px oklch(var(--edgeL) var(--edgeC) var(--hue));
  text-align: left;
}

/* A completed row has left the colour system, and its glow with it. */
.tinted[data-done].task,
.tinted[data-done].row-compact {
  box-shadow: var(--shadow-xs);
}

.row-compact__avatar {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 99px;
  border: 1px solid oklch(var(--edgeL) var(--edgeC) var(--hue));
  background: oklch(0.60 0.17 var(--hue));
  color: var(--avatar-ink, oklch(0.99 0.012 var(--hue)));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

/* A completed row has no --hue (Tint emits nothing), so the hue-derived fill
 * fell back to hue 0 — a red avatar with 3.9:1 initials on a neutral row. It
 * takes the done row's neutral avatar instead. */
.tinted[data-done] .row-compact__avatar {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
  opacity: 0.7;
}

.row-compact__avatar[data-unassigned] {
  background: transparent;
  color: var(--ink-muted);
}

.row-compact__body {
  flex: 1;
  min-width: 0;
}

.row-compact__title {
  font-size: 13.5px;
  font-weight: 600;
}

.row-compact__meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
}

.row-compact__rail {
  width: var(--rail);
  flex: none;
  display: flex;
  justify-content: flex-end;
}

.day-group__head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 16px 8px;
  width: 100%;
  background: transparent;
}

.day-group__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.day-group__head[data-today] .day-group__label {
  color: var(--foreground);
}

/* ======================================================================
 * Skeleton — the same geometry as a real row, to the pixel
 *
 * This is not decoration. If the skeleton and the row it replaces differ by
 * even a few pixels, every row below shifts the moment data lands. Each
 * measurement below is read from the same token as the real row; the three
 * text bars are the handoff's 78% / 52% / 36%.
 * ==================================================================== */

.skeleton-list {
  padding: 14px 0 0;
}

.skeleton-row {
  height: var(--row-h);
  width: calc(100% - 28px);
  margin: 0 14px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.skeleton-row__avatar {
  width: var(--av);
  height: var(--av);
  flex: none;
  border-radius: 99px;
  background: var(--muted);
}

.skeleton-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-row__rail {
  width: var(--rail);
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.skeleton-bar {
  background: var(--muted);
  border-radius: 99px;
}

.skeleton-bar--title { height: 13px; width: 78%; }
.skeleton-bar--meta  { height: 13px; width: 52%; }
.skeleton-bar--sub   { height: 11px; width: 36%; }

.skeleton-bar--pill   { height: var(--badge-h); width: 70px; }
.skeleton-bar--action { height: var(--act-h);   width: 100%; border-radius: var(--radius-sm); }
.skeleton-bar--snooze { height: var(--snooze-h); width: 100%; border-radius: var(--radius-sm); }

/* The pulse is applied by a class rather than by the element, so app.js can
 * leave it off entirely under reduced motion instead of relying on the media
 * query to clamp an animation that is still running. */
.pulse {
  animation: pulse 1.4s ease-in-out infinite;
}

/* ======================================================================
 * Empty state
 * ==================================================================== */

.empty {
  padding: 34px 26px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.empty__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty__icon .icon {
  width: 26px;
  height: 26px;
  stroke-width: 1.8;
}

.empty__title {
  margin-top: 16px;
}

.empty__body {
  margin-top: 6px;
  color: var(--muted-foreground);
  max-width: 28ch;
  text-wrap: pretty;
}

/* ======================================================================
 * Buttons and inputs
 * ==================================================================== */

/* 44px pills since wave 7 — the HIG's minimum hit target — whatever the
 * label. */
.btn {
  height: var(--control-h);
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 18px;
  border: 1px solid transparent;
  transition: opacity 0.18s var(--ease), background 0.18s var(--ease);
}

.btn--block {
  width: 100%;
}

.btn--primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-xs);
}

.btn--primary:hover {
  opacity: 0.9;
}

/* Speichern on the task detail: solid, 48px, no gloss and no disabled fade —
 * product feedback was that it must read as a solid button whatever draft.js
 * has done to it. Neon in dark (tokens.css). */
.btn--save {
  height: 48px;
  background: var(--save-bg);
  color: var(--save-fg);
  box-shadow: var(--save-shadow);
  font-weight: 600;
}

.btn--save:disabled {
  opacity: 1;
  cursor: default;
}

.btn--outline {
  border-color: var(--border);
  background: var(--card);
  color: var(--foreground);
}

.btn--outline:hover {
  background: var(--accent);
}

.btn--destructive {
  border-color: var(--border);
  color: var(--destructive);
}

.btn--destructive:hover {
  background: var(--accent);
}

.btn:active {
  transform: scale(0.99);
}

/* A <summary> styled as a button (the admin rows, the series delete): no
 * disclosure triangle, and the pointer a button has. */
summary.btn {
  cursor: pointer;
  list-style: none;
}

summary.btn::-webkit-details-marker {
  display: none;
}

.btn--sm {
  height: 36px;
  padding: 0 14px;
  font-size: 12px;
}

.btn--xs {
  height: 24px;
  border-radius: 99px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 600;
  gap: 5px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input {
  height: var(--control-h);
  width: 100%;
  border: 1px solid var(--input);
  border-radius: 99px;
  background: transparent;
  color: var(--foreground);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-xs);
}

.input::placeholder {
  color: var(--muted-foreground);
}

/* ======================================================================
 * Autosave status line
 *
 * There is no save button. This line is the entire feedback channel, so it
 * carries aria-live and has a real error state with a retry beside it.
 * ==================================================================== */

.save-status {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  color: var(--muted-foreground);
}

.save-status__label {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  font-weight: 500;
}

.save-status[data-state='saving'] .icon {
  animation: spin 0.9s linear infinite;
}

.save-status[data-state='error'] {
  color: var(--destructive);
}

.save-status[data-state='error'] .btn--xs {
  border-color: var(--destructive);
  color: var(--destructive);
}

/* ======================================================================
 * Rich-text editor
 * ==================================================================== */

.richtext {
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background: transparent;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

/* The editable area clips inside the frame, so the frame carries the ring. */
.richtext:has(.richtext__area:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.richtext__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
}

.richtext__tool {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.richtext__tool:hover {
  background: var(--accent);
}

.richtext__tool[aria-pressed='true'] {
  background: var(--secondary);
  color: var(--foreground);
}

.richtext__tool .icon {
  width: 15px;
  height: 15px;
}

.richtext__area {
  padding: 11px 12px;
  min-height: 84px;
  font-size: 13.5px;
  line-height: 1.6;
  outline: none;
  color: var(--foreground);
}

/* ======================================================================
 * Task detail pickers
 * ==================================================================== */

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-chip {
  width: var(--cat-chip-w);
  height: var(--cat-chip-h);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  box-shadow: var(--shadow-xs);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.cat-chip[aria-pressed='true'] {
  background: var(--secondary);
  border-color: var(--foreground);
}

.cat-chip__dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: oklch(0.62 0.16 var(--hue));
  flex: none;
}

.cat-chip > span {
  font-size: 12.5px;
  font-weight: 500;
}

.chip--dashed {
  border-style: dashed;
  background: transparent;
  color: var(--muted-foreground);
  box-shadow: none;
}

.assignee {
  width: var(--assignee-w);
  height: var(--assignee-h);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: var(--shadow-xs);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.assignee[aria-pressed='true'] {
  background: var(--secondary);
  border-color: var(--foreground);
}

.assignee__avatar {
  width: 40px;
  height: 40px;
  border-radius: 99px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 600;
}

/* 62px, not 76px: the tile is 76px wide with padding, and the label must
 * ellipsise before it reaches the edge. */
.assignee__name {
  font-size: 11.5px;
  font-weight: 500;
  max-width: 62px;
  text-align: center;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.status-option {
  height: var(--status-opt-h);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  box-shadow: var(--shadow-xs);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.status-option[aria-pressed='true'] {
  background: var(--secondary);
  border-color: var(--foreground);
}

.status-option > span {
  font-size: 12.5px;
  font-weight: 500;
}

.status-option .icon {
  width: 14px;
  height: 14px;
}

.meta-cards {
  display: flex;
  gap: 8px;
}

.meta-card {
  flex: 1;
  min-width: 0;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  text-align: left;
}

.meta-card__label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.meta-card__value {
  font-size: 13.5px;
  font-weight: 500;
}

/* The date card's value is a native date field, dressed as the card's own
 * text so the two cards still read as a pair. color-scheme lets the
 * browser's picker icon follow dark mode. */
.meta-card__date {
  font-family: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  min-width: 0;
  color-scheme: light;
  cursor: pointer;
}

/* The calendar icon and the picker are drawn by the browser in the field's
 * color-scheme. "light dark" followed the operating system, not the app's
 * own toggle: a dark app on a light Mac drew a black icon on a dark card, and
 * the picker looked absent (first-use feedback). */
[data-theme='dark'] .meta-card__date {
  color-scheme: dark;
}

.meta-card__date::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.85;
}

/* The base :focus-visible ring does not cover all of a date field in
 * Chromium: on its calendar button, the last stop inside it, the field matches
 * only :focus-within. So the field states its own ring for both. */
.meta-card__date:focus,
.meta-card__date:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}


/* ======================================================================
 * Cards and list rows shared by categories, users and settings
 * ==================================================================== */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 14px;
  box-shadow: var(--shadow-xs);
}

.card--16 {
  padding: 16px;
}

.card__title {
  font-size: 13px;
  font-weight: 600;
}

.card__body {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted-foreground);
  margin-top: 5px;
}

.list-row {
  height: var(--row-sm);
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xs);
  text-align: left;
  transition: background 0.18s var(--ease);
}

button.list-row:hover {
  background: var(--accent);
}

.list-row__body {
  flex: 1;
  min-width: 0;
}

.list-row__name {
  font-size: 14px;
  font-weight: 500;
}

.list-row__detail {
  font-size: 11.5px;
  color: var(--muted-foreground);
}

.swatch-tile {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--radius-sm);
  background: oklch(0.62 0.16 var(--hue));
  color: var(--swatch-ink, oklch(0.99 0.012 var(--hue)));
  display: flex;
  align-items: center;
  justify-content: center;
}

.swatch-tile .icon {
  width: 19px;
  height: 19px;
}

.role-pill {
  width: var(--role-pill-w);
  flex: none;
  height: var(--badge-h);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}

.role-pill[data-role='admin'] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}

.role-pill > span {
  font-size: 10px;
  font-weight: 600;
}

/* ---- Switch — iOS size, 51 × 31px, 27px white knob --------------------
 * Green track when on (--switch-on), as on the phone the household holds.
 * The knob is white in both themes; the track carries the state, and
 * aria-checked carries it for a screen reader. */

.switch {
  width: var(--switch-w);
  height: var(--switch-h);
  flex: none;
  border-radius: 99px;
  background: var(--muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 1px;
  justify-content: flex-start;
  transition: background 0.25s var(--ease);
}

.switch[aria-checked='true'] {
  background: var(--switch-on);
  border-color: var(--switch-on);
  justify-content: flex-end;
}

.switch__knob {
  width: 27px;
  height: 27px;
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.22);
}

/* The Bedienungshilfen rows: 64px at least, but the detail may take a second
 * line rather than lose the end of its sentence. */
.list-row--a11y {
  height: auto;
  min-height: var(--row-sm);
  padding: 10px 12px;
}

/* ---- End-of-day stepper ---------------------------------------------- */

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
}

.stepper__value {
  width: 96px;
  text-align: center;
}

/* ======================================================================
 * Category editor — swatches, hue slider, icon picker
 * ==================================================================== */

.preview-tile {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: var(--radius-sm);
  background: oklch(0.62 0.16 var(--hue));
  color: var(--swatch-ink, oklch(0.99 0.012 var(--hue)));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease);
}

.preview-tile .icon {
  width: 22px;
  height: 22px;
}

.swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: oklch(0.62 0.16 var(--hue));
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.16s var(--ease);
}

.swatch:hover {
  transform: scale(1.07);
}

.swatch[aria-pressed='true'] {
  border-color: var(--foreground);
}

.swatch__check {
  width: 15px;
  height: 15px;
  stroke: #fff;
  stroke-width: 3;
  opacity: 0;
}

.swatch[aria-pressed='true'] .swatch__check {
  opacity: 1;
}

.hue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* The value is shown as a hex code, never as degrees — explicit product
 * feedback. The server renders it; color.js keeps it current while dragging. */
.hex-chip {
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
}

.hex-chip__swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: oklch(0.62 0.16 var(--hue));
  flex: none;
}

.hex-chip__value {
  font-size: 11px;
  font-weight: 600;
  font-family: 'Geist Mono', ui-monospace, monospace;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.hue-slider {
  position: relative;
  height: 28px;
  margin-top: 10px;
}

.hue-slider__track {
  position: absolute;
  left: 0;
  right: 0;
  top: 9px;
  height: 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: linear-gradient(
    to right,
    oklch(0.62 0.16 0), oklch(0.62 0.16 30), oklch(0.62 0.16 60),
    oklch(0.62 0.16 90), oklch(0.62 0.16 120), oklch(0.62 0.16 150),
    oklch(0.62 0.16 180), oklch(0.62 0.16 210), oklch(0.62 0.16 240),
    oklch(0.62 0.16 270), oklch(0.62 0.16 300), oklch(0.62 0.16 330),
    oklch(0.62 0.16 360)
  );
}

.hue-slider__knob {
  position: absolute;
  top: 4px;
  left: calc(var(--hue) / 360 * 100%);
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border-radius: 99px;
  background: oklch(0.62 0.16 var(--hue));
  border: 3px solid var(--background);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

/* A real range input drives the whole thing, invisible on top of the painted
 * track: keyboard support, screen-reader support and touch handling all come
 * for free rather than being reimplemented in the 400-line JS budget. */
.hue-slider__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.hue-slider__input:focus-visible {
  outline: none;
}

.hue-slider__input:focus-visible + .hue-slider__knob {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.icon-choice {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
}

.icon-choice[aria-pressed='true'] {
  background: var(--secondary);
  border-color: var(--foreground);
}

.icon-choice .icon {
  width: 18px;
  height: 18px;
}

/* ======================================================================
 * Notification channel cards
 * ==================================================================== */

.channel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 13px;
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.2s var(--ease);
}

.channel[aria-pressed='true'] {
  border-color: var(--foreground);
}

.channel__head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.channel__icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--muted);
  color: var(--foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}

.channel__name {
  font-size: 13.5px;
  font-weight: 500;
}

.channel__note {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted-foreground);
}

.channel__note--warn {
  color: var(--destructive);
}

.channel__action {
  width: 76px;
  height: 28px;
  flex: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
}

.channel__flow {
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted-foreground);
}

/* ======================================================================
 * Weekly statistics
 * ==================================================================== */

.stats-hero__week {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.stats-hero__row {
  display: flex;
  align-items: flex-end;
  gap: 11px;
  margin-top: 6px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 52px;
}

.stat-row__avatar {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 99px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
}

.stat-row__name {
  width: 56px;
  flex: none;
  font-size: 13px;
  font-weight: 500;
}

.stat-row__track {
  flex: 1;
  min-width: 0;
  height: 8px;
  border-radius: 99px;
  background: var(--muted);
  overflow: hidden;
}

.stat-row__fill {
  height: 100%;
  border-radius: 99px;
  background: var(--muted-foreground);
  animation: barGrow 0.55s var(--ease) both;
}

.stat-row__fill[data-leader] {
  background: var(--primary);
}

.stat-row__count {
  width: 24px;
  flex: none;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Geist Mono', ui-monospace, monospace;
}

/* The Sunday message preview, drawn as a chat bubble: one corner squared off
 * so it reads as something that was sent rather than as another card. */
.bubble {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-top-left-radius: 4px;
  background: var(--muted);
  padding: 13px;
  font-size: 13px;
  line-height: 1.6;
}

/* ======================================================================
 * FAB, tab bar, toast
 *
 * The tab bar floats: a glass capsule inset 12px from the sides and 14px
 * from the bottom (plus the home indicator's safe area), at most the
 * column's width. The FAB floats above its right end with a 10px gap. Both
 * are fixed rather than absolute so they stay put on a page that scrolls as a
 * whole — the login screen's taller cousins, a sheet opened without
 * JavaScript.
 * ==================================================================== */

:root {
  --dock-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  /* The capsule's side inset at any width: 12px on a phone, centred on the
   * 430px column on anything wider. */
  --dock-side: max(12px, calc(50% - 215px + 12px));
  /* The bar's height in force: --tabbar-h, or the minimised height while the
   * screen scrolls down. Declared here rather than on the bar so the FAB,
   * which rides above it, moves with it. */
  --tabbar-now: var(--tabbar-h);
}

:root:has(.tabbar[data-min]) {
  --tabbar-now: max(48px, calc(var(--tabbar-h) * 0.76));
}

.fab {
  --press: 1.08;
  position: fixed;
  right: var(--dock-side);
  bottom: calc(var(--dock-bottom) + var(--tabbar-now) + 10px);
  height: var(--fab-h);
  padding: 0 20px 0 15px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  gap: 7px;
  animation: zoomIn 0.25s var(--ease) both;
  transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1), bottom 0.45s cubic-bezier(0.3, 1.25, 0.5, 1),
    filter 0.2s var(--ease);
  z-index: 20;
}

/* The FAB is rendered as a plain <a class="fab"> by the list screens, which
 * predate the glass classes; it takes the tinted glass either way. */
a.fab {
  background: var(--glass-sheen), var(--glass-tint-bg);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--glass-tint-shadow);
  color: var(--tint-fg);
}

.fab:hover {
  filter: brightness(1.07);
}

.fab:active {
  transform: scale(var(--press));
}

.fab .icon {
  width: 19px !important;
  height: 19px !important;
  stroke-width: 2.4;
}

.fab .t-button {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

/* --tabbar-scale is --tabbar-h over its 66px default, set by tabbar.js when
 * the person resizes the bar: CSS cannot divide one length by another. */
.tabbar {
  position: fixed;
  left: var(--dock-side);
  right: var(--dock-side);
  bottom: var(--dock-bottom);
  height: var(--tabbar-now);
  border-radius: 99px;
  padding: 4px;
  display: flex;
  z-index: 6;
  transition: height 0.45s cubic-bezier(0.3, 1.25, 0.5, 1);
}

/* While the grip is dragged the bar follows the pointer directly; the spring
 * is for minimising, and on a drag it made the bar trail the finger. */
.tabbar:has(> .tabbar__grip[data-dragging]) {
  transition: none;
}

/* Minimised: max(48, height × .76) — see --tabbar-now — and no labels. */
.tabbar[data-min] .t-tab {
  display: none;
}

/* The resize grip: a 36 × 5px pill centred on the capsule's top edge, with a
 * taller invisible hit area for a thumb. touch-action none, or the drag
 * scrolls the page. */
.tabbar__grip {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 56px;
  height: 20px;
  margin-left: -28px;
  cursor: ns-resize;
  touch-action: none;
  z-index: 1;
}

.tabbar__grip::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 7.5px;
  height: 5px;
  border-radius: 99px;
  background: var(--glass-grip);
}

.tabbar__grip:hover::after,
.tabbar__grip:focus-visible::after,
.tabbar__grip[data-dragging]::after {
  background: var(--muted-foreground);
}

.tabbar__tab {
  flex: 1;
  min-width: 0;
  border-radius: 99px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--foreground);
  text-decoration: none;
  transition: background 0.3s var(--ease), color 0.2s var(--ease), transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.tabbar__tab:active {
  transform: scale(0.94);
}

/* !important because the icon helper writes its size inline, and an inline
 * style beats any selector: without it the icons kept their size while the
 * bar around them grew. The scale is capped at 1.5 as the design's own. */
.tabbar__tab .icon {
  width: calc(21px * min(1.5, var(--tabbar-scale, 1))) !important;
  height: calc(21px * min(1.5, var(--tabbar-scale, 1))) !important;
  stroke-width: 1.9;
}

.tabbar[data-min] .tabbar__tab .icon {
  width: calc(20px * min(1.5, var(--tabbar-scale, 1))) !important;
  height: calc(20px * min(1.5, var(--tabbar-scale, 1))) !important;
}

/* The current tab is lifted on a pill and drawn in the primary colour. */
.tabbar__tab[aria-current='page'] {
  background: var(--glass-pill);
  color: var(--tab-active);
}

.tabbar__tab[aria-current='page'] .icon {
  stroke-width: 2.4;
}

.tabbar__tab[aria-current='page'] .t-tab {
  font-weight: 700;
}

/* Ellipsised, never wrapped: six labels must not push each other in any of
 * the three languages. */
.tabbar__tab .t-tab {
  max-width: 100%;
  padding: 0 2px;
  font-size: calc(10px * min(1.4, var(--tabbar-scale, 1)));
}

/* A glass pill under the header — the bottom of the screen belongs to the
 * FAB and the tab bar now. */
.toast {
  position: fixed;
  left: max(24px, calc(50% - 215px + 24px));
  right: max(24px, calc(50% - 215px + 24px));
  top: 92px;
  border-radius: 99px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-sheen), var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--glass-shadow);
  border: var(--glass-border);
  color: var(--foreground);
  animation: toastIn 0.25s var(--ease) both;
  z-index: 40;
}

.toast .icon {
  width: 15px;
  height: 15px;
  color: var(--muted-foreground);
}

.toast__text {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
}

/* ======================================================================
 * Sheet and scrim
 * ==================================================================== */

.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: flex-end;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  animation: scrimIn 0.18s linear both;
  z-index: 50;
}

.scrim--center {
  align-items: center;
  justify-content: center;
  padding: 22px;
}

/* Inset 8px on every side with a 28px radius, so the sheet sits inside the
 * device's own corner, and thick glass. Everything inside it is solid: no
 * glass on glass. */
.sheet {
  width: 100%;
  max-width: 414px;
  margin: 0 auto;
  max-height: calc(100% - 44px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  background: var(--glass-sheen), var(--glass-thick-bg);
  -webkit-backdrop-filter: var(--glass-thick-filter);
  backdrop-filter: var(--glass-thick-filter);
  box-shadow: var(--glass-shadow);
  border: var(--glass-border);
  color: var(--foreground);
  border-radius: var(--radius-lg);
  padding: 10px 18px 22px;
  animation: sheetUp 0.28s var(--ease) both;
}

.sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  margin: 0 auto 14px;
}

.sheet__body {
  color: var(--muted-foreground);
  margin-top: 6px;
}

/* The action row wraps at 45% with a 120px floor so all three buttons keep
 * their full labels rather than ellipsising — the handoff is specific here,
 * because "Speichern / Löschen / Abbrechen" does not fit on one line. */
.sheet__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.sheet__actions .btn {
  flex: 1 1 45%;
  min-width: 120px;
  padding: 0 12px;
}

/* ---- Snooze reminder timeline ---------------------------------------- */

.timeline {
  display: flex;
  align-items: flex-end;
}

.timeline__tick {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.timeline__badge {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.timeline__tick[data-state='paused'] .timeline__badge,
.timeline__tick[data-state='paused'] .timeline__time {
  color: var(--muted-foreground);
}

.timeline__tick[data-state='now'] .timeline__badge {
  color: var(--foreground);
}

.timeline__rail {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 26px;
}

.timeline__rail::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 2px;
  background: var(--border);
}

.timeline__dot {
  position: relative;
  width: 11px;
  height: 11px;
  border-radius: 99px;
  background: var(--primary);
  border: 2px solid var(--primary);
}

.timeline__tick[data-state='now'] .timeline__dot {
  background: var(--foreground);
  border-color: var(--foreground);
}

/* A reminder the pause swallows is drawn hollow and one size smaller, so the
 * cost of the choice is visible before it is made. */
.timeline__tick[data-state='paused'] .timeline__dot {
  width: 9px;
  height: 9px;
  background: var(--background);
  border-color: var(--border);
}

.timeline__time {
  font-size: 10.5px;
  font-weight: 600;
  font-family: 'Geist Mono', ui-monospace, monospace;
  white-space: nowrap;
}

.timeline__legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted-foreground);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--primary);
  border: 2px solid var(--primary);
  flex: none;
}

.legend-dot--hollow {
  background: var(--background);
  border-color: var(--border);
}

.snooze-option {
  height: 56px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xs);
  text-align: left;
  transition: background 0.18s var(--ease);
}

.snooze-option:hover {
  background: var(--accent);
}

.snooze-option__icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--muted);
  color: var(--foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}

.snooze-option__label {
  font-size: 13.5px;
  font-weight: 600;
}

.snooze-option__detail {
  font-size: 11.5px;
  color: var(--muted-foreground);
}

.snooze-option__until {
  height: var(--badge-h);
  flex: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 7px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'Geist Mono', ui-monospace, monospace;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted-foreground);
}

/* ======================================================================
 * Celebration
 * ==================================================================== */

/* Thick glass, 28px radius, 24px padding (wave 7). */
.celebration {
  width: 100%;
  max-width: 386px;
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-sheen), var(--glass-thick-bg);
  -webkit-backdrop-filter: var(--glass-thick-filter);
  backdrop-filter: var(--glass-thick-filter);
  color: var(--foreground);
  padding: 24px;
  box-shadow: var(--glass-shadow);
  animation: zoomIn 0.3s var(--ease) both;
}

.celebration__icon {
  width: 44px;
  height: 44px;
  border-radius: 99px;
  background: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}

.celebration__icon .icon {
  width: 22px;
  height: 22px;
}

.celebration__title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 16px;
  text-wrap: balance;
}

.celebration__body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted-foreground);
  margin-top: 8px;
}

.celebration__kicker {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 16px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* Confetti is created by confetti.js and never rendered under reduced motion.
 * The shards are absolutely positioned inside the scrim and carry their own
 * --tx / --ty / --rot. */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti__shard {
  position: absolute;
  left: 50%;
  top: 48%;
  animation: confetti 1.3s cubic-bezier(0.15, 0.7, 0.3, 1) both;
}

/* ======================================================================
 * Utilities used by more than one screen
 * ==================================================================== */

.pad {
  padding: 14px 14px 40px;
}

/* A second .pad block directly under a first: no extra gap between them. */
.pad--flush {
  padding-top: 0;
}

.stack-8 > * + *  { margin-top: 8px; }
.stack-14 > * + * { margin-top: 14px; }

.label-mt {
  margin: 18px 0 8px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.grow {
  flex: 1;
  min-width: 0;
}

.muted {
  color: var(--muted-foreground);
}

/* ---- Row links ---------------------------------------------------------
 * Tapping a row opens the task (round-2 handoff item 14). The link is the
 * title, so a screen reader announces one named link per row rather than an
 * anonymous clickable box, and its ::after stretches over the whole row so the
 * tap target is the row. The rail sits above the stretched area, so its
 * status button and snooze bell keep their own taps.
 */
.task,
.row-compact,
.done-row {
  position: relative;
}

.task__rail,
.row-compact__rail,
.done-row__rail {
  position: relative;
  z-index: 1;
}

.row-link {
  color: inherit;
  text-decoration: none;
}

.row-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

/* The ring is drawn on the row the link covers, not on the title's text box:
 * inset, in the card's ink, so it reads against the fill at every level. */
.row-link:focus-visible {
  outline: none;
}

.row-link:focus-visible::after {
  outline: 2px solid var(--ink, var(--focus));
  outline-offset: -3px;
}

/* A visually hidden control is focused through the label that stands in for
 * it (the avatar's file input behind the camera button). */
label:has(+ .visually-hidden:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* The WhatsApp pairing code (admin). Square, crisp at any density, and on
 * white in both themes: a QR code on a dark card does not scan. */
.whatsapp-qr {
  display: block;
  margin: 12px auto;
  width: 264px;
  height: 264px;
  max-width: 100%;
  image-rendering: pixelated;
  background: #fff;
  padding: 8px;
  border-radius: var(--radius-sm);
}
