/* Diffa web client — Bear's layout in Material Design 3's colours.
   Every colour is a custom property declared here and redefined for dark mode. */

/* A tile of Settings' Colours (.palette, js/palette.js) takes these blocks too, its accent's --m3-* set on it,
   so every colour below is worked out there for that accent and theme. */
:root, .palette {
  /* The accent (SPEC §3.5) is a Material Design 3 colour scheme: js/accent.js sets every role of
     its light and dark schemes on <html> (--m3-l-* / --m3-d-*, with --accent-l-* / --accent-d-*)
     from the chosen one; these defaults are brown's. Each colour below is one of its roles, so the
     surfaces, text and outlines are all of the accent too. */
  --m3-l-primary: #8a4e39;
  --m3-l-on-primary: #ffffff;
  --m3-l-primary-container: #ffdbcf;
  --m3-l-on-primary-container: #6e3824;
  --m3-l-surface: #fff8f6;
  --m3-l-surface-lowest: #ffffff;
  --m3-l-surface-low: #fff1ed;
  --m3-l-surface-container: #ffe9e3;
  --m3-l-surface-high: #ffe2d9;
  --m3-l-surface-highest: #ffded4;
  --m3-l-secondary-container: #ffdbcf;
  --m3-l-on-secondary-container: #72351f;
  --m3-l-on-surface: #291711;
  --m3-l-on-surface-strong: #190a06;
  --m3-l-on-surface-variant: #5f3f34;
  --m3-l-outline: #845f53;
  --m3-l-outline-variant: #ebbcad;
  --m3-l-tertiary-container: #f3e2a7;
  --m3-l-on-tertiary-container: #51461a;
  --m3-l-secondary: #8f4c34;
  --m3-l-on-secondary: #ffffff;
  --m3-l-tertiary: #6a5e2f;
  --m3-l-on-tertiary: #ffffff;
  --m3-d-primary: #ffb59c;
  --m3-d-on-primary: #522210;
  --m3-d-primary-container: #6e3824;
  --m3-d-on-primary-container: #ffdbcf;
  --m3-d-surface: #1f0f0a;
  --m3-d-surface-lowest: #190a06;
  --m3-d-surface-low: #291711;
  --m3-d-surface-container: #2d1b15;
  --m3-d-surface-high: #39251f;
  --m3-d-surface-highest: #443029;
  --m3-d-secondary-container: #72351f;
  --m3-d-on-secondary-container: #ffdbcf;
  --m3-d-on-surface: #fddbd1;
  --m3-d-on-surface-strong: #fff8f6;
  --m3-d-on-surface-variant: #ebbcad;
  --m3-d-outline: #b1877a;
  --m3-d-outline-variant: #5f3f34;
  --m3-d-tertiary-container: #51461a;
  --m3-d-on-tertiary-container: #f3e2a7;
  --m3-d-secondary: #ffb59c;
  --m3-d-on-secondary: #55200c;
  --m3-d-tertiary: #d6c68d;
  --m3-d-on-tertiary: #393005;

  --accent-l: var(--m3-l-primary);
  --accent-l-text: var(--m3-l-on-primary);
  --accent-l-tint: rgba(138, 78, 57, 0.12);
  --accent-l-tint-strong: rgba(138, 78, 57, 0.2);
  --accent-l-selection: rgba(138, 78, 57, 0.18);
  --accent-l-focus: rgba(138, 78, 57, 0.45);
  --accent-d: var(--m3-d-primary);
  --accent-d-text: var(--m3-d-on-primary);
  --accent-d-tint: rgba(255, 181, 156, 0.16);
  --accent-d-tint-strong: rgba(255, 181, 156, 0.26);
  --accent-d-selection: rgba(255, 181, 156, 0.3);
  --accent-d-focus: rgba(255, 181, 156, 0.55);

  --accent: var(--accent-l);
  --accent-text: var(--accent-l-text);
  --accent-tint: var(--accent-l-tint);
  --accent-tint-strong: var(--accent-l-tint-strong);
  --selection: var(--accent-l-selection);
  --focus-ring: var(--accent-l-focus);

  /* The accent's neutral palettes (SPEC §3.5): every pane's surfaces and text are the scheme's
     surface roles, tinted with the accent's hue as Material 3 Expressive's are. The dark block
     redefines these, so the roles below follow the theme without being declared again. */
  --neutral-surface: var(--m3-l-surface);
  --neutral-low: var(--m3-l-surface-low);
  --neutral-container: var(--m3-l-surface-container);
  --neutral-card: var(--m3-l-surface-lowest);
  --neutral-field: var(--m3-l-surface-lowest);
  --neutral-highest: var(--m3-l-surface-highest);
  --neutral-text: var(--m3-l-on-surface);
  --neutral-text-strong: var(--m3-l-on-surface-strong);
  --neutral-muted: var(--m3-l-on-surface-variant);
  --neutral-outline: var(--m3-l-outline);
  --neutral-outline-variant: var(--m3-l-outline-variant);
  /* The panes (SPEC §3.5): the sidebar, the note list, the editor, Reminders and the Calendar stay
     neutral grey, M3's tones with no chroma, whatever the accent. The dark block redefines these. */
  --pane-surface: #f9f9f9;
  --pane-low: #f3f3f3;
  --pane-line: #e2e2e2;
  --pane-noon: #c6c6c6;
  --pane-container: #eeeeee; /* the sidebar */
  --pane-selected: #dadada; /* the sidebar's open item, M3's tone 87 */

  /* The surfaces, from the lowest container (cards) to the highest (quiet fields). */
  --editor-bg: var(--pane-surface);
  /* A reminder list's card on Reminders: M3's secondary container (.list-card maps its scheme again). */
  --list-card-bg: var(--m3-l-secondary-container);
  --list-card-shadow: rgba(0, 0, 0, 0.08);
  --list-bg: var(--pane-low);
  --sidebar-bg: var(--pane-container);
  --auth-bg: var(--neutral-container);
  /* The boot screen and Decrypting… in its place: the sidebar's grey whatever the accent, as the
     Android app's splash screen (res/values colors.xml) that fades into it. */
  --boot-bg: var(--pane-container);
  --card-bg: var(--neutral-card);
  --menu-bg: var(--neutral-card);
  --field-bg: var(--neutral-field);
  --field-bg-quiet: var(--neutral-highest);
  /* M3's hover state layer: the colour of what is drawn on a thing, at 8% over it. Mixed from roles
     the dark block redefines, so these four follow the theme without being declared again. */
  --hover: color-mix(in srgb, var(--text) 8%, transparent);
  --pressed: color-mix(in srgb, var(--text) 10%, transparent); /* Material 3's pressed state layer */
  /* Material's ripple (js/ripple.js): what is drawn on the button, at 12%, whatever its fill. */
  --ripple: color-mix(in srgb, currentColor 12%, transparent);
  --accent-hover: color-mix(in srgb, var(--accent-text) 8%, var(--accent));
  --danger-hover: color-mix(in srgb, var(--danger-text) 8%, var(--danger));
  /* Pressed over a filled button: what is drawn on it at 10%, laid over its fill as a background-image. */
  --accent-pressed: color-mix(in srgb, var(--accent-text) 10%, transparent);
  --danger-pressed: color-mix(in srgb, var(--danger-text) 10%, transparent);
  --side-selected-hover: color-mix(in srgb, var(--side-selected-text) 8%, var(--side-selected));
  /* The sidebar's open item: a grey a step darker than the sidebar, whatever the accent, its text and
     icon the strong text (js/accent.js PANE and app.js embedSurfaces for the GNOME app's open row). The
     selected note is the primary container, plainly the accent's on the grey list even where its
     secondary is calm (olive's, teal's). */
  --side-selected: var(--pane-selected);
  --side-selected-text: var(--text-strong);
  --row-selected: var(--accent-container);
  /* An avatar or chip in the accent: M3's primary container and the text on it. */
  --accent-container: var(--m3-l-primary-container);
  --accent-container-text: var(--m3-l-on-primary-container);

  --text: var(--neutral-text);
  --text-strong: var(--neutral-text-strong);
  --muted: var(--neutral-muted); /* at least 5.1:1 on every surface */
  --scrollbar-thumb: var(--neutral-outline); /* a thin scrollbar's thumb, plain enough to find */
  --faint: var(--neutral-outline-variant);
  /* The month view's day numbers outside the month: the outline, over 5.1:1 on the surface. */
  --other-month: var(--neutral-outline);
  /* Markdown's marks and the placeholders read at 5.1:1 too: the outline, and M3's text fields'
     on-surface-variant (the outline is too light on a field or a list card). */
  --marker: var(--neutral-outline);
  --placeholder: var(--neutral-muted);

  --code-bg: var(--neutral-container);
  --code-text: var(--neutral-muted);
  --highlight-bg: #fff1a6;
  --highlight-text: #2b2b2d;
  --quote-bar: var(--neutral-outline-variant);
  --checkbox: var(--neutral-outline);
  --grid-line: var(--neutral-highest);
  --cal-line: color-mix(in srgb, var(--pane-line) 70%, var(--pane-surface)); /* the month's and week's lines, a shade fainter */
  --cal-noon: var(--pane-noon); /* the week's line at 12:00, harder than the other hours' */
  --cal-today: #e8e8e8; /* today's column in the week, its cell in the month: a grey of the panes', whatever the accent */
  --weekend-bg: var(--pane-low);
  --night-shade: rgb(0 0 0 / 0.035); /* the week's hours before 07:00 and from 22:00 */
  /* M3's error and on-error. */
  --danger: #ba1a1a;
  --danger-text: #ffffff;
  --success: #1d6f39;
  --accepted: var(--success); /* Going?'s Accept pressed */
  --accepted-text: #ffffff;
  --warning: #d9a21b; /* the tints of a conflict's compare */
  --warning-ink: #8a5900; /* a conflict's mark: the warning darkened to read at 5.1:1 */
  --overdue: #a64100; /* a reminder past its day: orange, never the error's red */
  /* A count on a calendar's own colour (the week's bubbles, calendar.js inkOn()): the same in both themes. */
  --ink-on-dark: #ffffff;
  --ink-on-light: #1b1b1b;
  /* The alert red (SPEC §5): Due pressed, each notification's dot, More's tab dot in the apps. */
  --alert: var(--danger);
  --on-alert: var(--danger-text);
  --due-rest-ink: var(--alert); /* Due not pressed: the warning alone, a notification dot's red */
  --due-glow: color-mix(in srgb, var(--alert) 65%, transparent); /* Due pressed, glowing */
  /* The sync button on the apps' More (SPEC §5, Tab bar (apps)): the accent once synced, orange with a
     dot otherwise, 3:1 or more on the card's tone it sits on, as the tags and the foot's buttons. */
  --sync-due: #b25400;
  --sync-due-dot: #9a6f00;
  /* The apps' tab bar (SPEC §5, Tab bar (apps)): the accent's surface container, drawn by the app. */
  --tab-bar-bg: var(--neutral-container);
  /* Settings and the apps' More (SPEC §3.5): the page in the accent's surface container, its groups and
     cards on it white (dark: the accent's high surface). */
  --theme-page-bg: var(--m3-l-surface-container);
  --theme-group-bg: var(--m3-l-surface-lowest);
  /* The Calendar's editor, Material 3 Expressive: its surface, M3's error and secondary containers, a
     tertiary container (the primary's turned round the hue wheel, below, where the browser can), and an
     invitee's answer as a container of its own. */
  --event-editor-bg: var(--m3-l-surface-container);
  --event-editor-shadow: color-mix(in srgb, var(--m3-l-on-surface) 10%, transparent);
  /* The pane the Android app's event editor holds its buttons in: the primary container, greyed by the surface. */
  --event-foot-bg: color-mix(in oklch, var(--m3-l-primary-container) 40%, var(--m3-l-surface-container));
  --secondary: var(--m3-l-secondary);
  --on-secondary: var(--m3-l-on-secondary);
  --secondary-container: var(--m3-l-secondary-container);
  --on-secondary-container: var(--m3-l-on-secondary-container);
  --tertiary: var(--m3-l-tertiary);
  --on-tertiary: var(--m3-l-on-tertiary);
  --tertiary-container: var(--m3-l-tertiary-container);
  --on-tertiary-container: var(--m3-l-on-tertiary-container);
  --error-container: #ffdad6;
  --on-error-container: #93000a;
  --accepted-container: color-mix(in srgb, var(--success) 22%, var(--field-bg));
  --declined-container: color-mix(in srgb, var(--danger) 16%, var(--field-bg));
  /* History's changes: a removed or added line, and the words that changed within it. */
  --diff-del-bg: color-mix(in srgb, var(--danger) 9%, var(--card-bg));
  --diff-del-word: color-mix(in srgb, var(--danger) 26%, var(--card-bg));
  --diff-add-bg: color-mix(in srgb, var(--success) 11%, var(--card-bg));
  --diff-add-word: color-mix(in srgb, var(--success) 32%, var(--card-bg));
  /* The band standing for unchanged lines folded away, and under the pointer. */
  --diff-fold: color-mix(in srgb, var(--muted) 7%, var(--editor-bg));
  --diff-fold-hover: color-mix(in srgb, var(--muted) 14%, var(--editor-bg));
  /* A note changed elsewhere too (SPEC §5): its bar, and Compare's two sides, this device's and the other's. */
  --warning-tint: color-mix(in srgb, var(--warning) 16%, var(--editor-bg));
  --compare-ours-bg: color-mix(in srgb, var(--accent) 9%, var(--card-bg));
  --compare-ours-hover: color-mix(in srgb, var(--accent) 16%, var(--card-bg));
  --compare-theirs-bg: color-mix(in srgb, var(--warning) 14%, var(--card-bg));
  --compare-theirs-hover: color-mix(in srgb, var(--warning) 24%, var(--card-bg));
  --shadow: rgba(0, 0, 0, 0.14);
  --shadow-soft: rgba(0, 0, 0, 0.06);
  /* The Android app's bar's glow at its densest (PaneBar.kt): its centre, and 35% of the way out. */
  --glow-core: color-mix(in srgb, var(--accent) 45%, transparent);
  --glow-mid: color-mix(in srgb, var(--accent) 18%, transparent);
  --backdrop: rgba(30, 30, 32, 0.32);
  --toast-track: rgba(255, 255, 255, 0.2);
  --transparent: rgba(0, 0, 0, 0);
  /* The iOS app's round header buttons, glass over the pane scrolling under them. */
  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-edge: rgba(0, 0, 0, 0.07);

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* A note's # and ## headings with `headings` "serif" (SPEC §3.5): the device's own serif, none shipped. */
  --serif: ui-serif, "New York", "Iowan Old Style", Charter, Georgia, "Noto Serif", "DejaVu Serif", serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  /* One size for every title (SPEC §3.5), each pane's (Notes, Reminders, the Calendar's month,
     Settings), larger on a phone; a note's first-level heading and an event's title in its editor a
     touch under it, one size together. */
  --title-size: 1.75rem;
  --h1-size: calc(var(--title-size) * 0.95);
  --sidebar-width: 15rem;
  --list-width: 20rem;
  --radius: 8px;
  color-scheme: light;
  /* How much of a connected calendar's colour (--event, set per event) tints its events, and the
     editor's chosen calendar, so the two look alike; the other calendars there take a third of it. */
  --event-tint-mix: 34%;
  /* And how much at the height of a new event's pulse, once saved. */
  --event-pulse-mix: 60%;
}

/* The type scale: every text in the app is at one of these four sizes or the title's above. On a
   phone they are Apple's 17/15/13 px, in the Android app Material's 16/14/12 and 22 px (below). */
:root {
  --text-xs: 0.75rem; /* small labels: uppercase headings, dates, chips, counts, hours */
  --text-s: 0.875rem; /* secondary: previews, hints, statuses, field labels, buttons, fields */
  --text-m: 1rem;     /* body: rows, items, a note's text, a reminder's, dialog and settings items */
  --text-l: 1.15rem;  /* headings: dialogs', an event's title, the brand (More's in the apps: 24 px, below) */
}

/* Dark: js/theme-boot.js sets data-theme from the `theme` pref or the system (SPEC §3.5). */
:root[data-theme="dark"], .palette.palette-dark {
  color-scheme: dark;
  --event-tint-mix: 40%;
  --event-pulse-mix: 66%;
  --accent: var(--accent-d);
  --accent-text: var(--accent-d-text);
  --accent-tint: var(--accent-d-tint);
  --accent-tint-strong: var(--accent-d-tint-strong);
  --selection: var(--accent-d-selection);
  --focus-ring: var(--accent-d-focus);

  /* The surfaces and text are the light block's roles of the dark scheme, redefined here. */
  --list-card-bg: var(--m3-d-secondary-container);
  --list-card-shadow: rgba(0, 0, 0, 0.35);
  --neutral-surface: var(--m3-d-surface);
  --neutral-low: var(--m3-d-surface-low);
  --neutral-container: var(--m3-d-surface-container);
  --neutral-card: var(--m3-d-surface-high);
  --neutral-field: var(--m3-d-surface-highest);
  --neutral-highest: var(--m3-d-surface-highest);
  --neutral-text: var(--m3-d-on-surface);
  --neutral-text-strong: var(--m3-d-on-surface-strong);
  --neutral-muted: var(--m3-d-on-surface-variant);
  --neutral-outline: var(--m3-d-outline);
  --neutral-outline-variant: var(--m3-d-outline-variant);
  --pane-surface: #131313;
  --pane-low: #1b1b1b;
  --pane-line: #353535;
  --pane-noon: #474747;
  --pane-container: #1f1f1f;
  --pane-selected: #393939; /* tone 24 */
  --accent-container: var(--m3-d-primary-container);
  --accent-container-text: var(--m3-d-on-primary-container);

  --code-bg: var(--neutral-card);
  --highlight-bg: #6b5a17;
  --highlight-text: #fbf3cf;
  --cal-today: #262626;
  --theme-page-bg: var(--m3-d-surface-container);
  --theme-group-bg: var(--m3-d-surface-high);
  --night-shade: rgb(0 0 0 / 0.18);
  --danger: #ffb4ab;
  --danger-text: #690005;
  --success: #5fbf7a;
  --accepted: var(--success);
  --accepted-text: #00391a;
  --warning: #e8b931;
  --warning-ink: var(--warning);
  --overdue: #ffa25c;
  --due-rest-ink: var(--alert);
  --due-glow: color-mix(in srgb, var(--alert) 65%, transparent);
  --sync-due: #ffa24d;
  --sync-due-dot: #e8b931;
  --event-editor-bg: var(--m3-d-surface-container);
  --event-editor-shadow: rgba(0, 0, 0, 0.4);
  --event-foot-bg: color-mix(in oklch, var(--m3-d-primary-container) 40%, var(--m3-d-surface-container));
  --secondary: var(--m3-d-secondary);
  --on-secondary: var(--m3-d-on-secondary);
  --secondary-container: var(--m3-d-secondary-container);
  --on-secondary-container: var(--m3-d-on-secondary-container);
  --tertiary: var(--m3-d-tertiary);
  --on-tertiary: var(--m3-d-on-tertiary);
  --tertiary-container: var(--m3-d-tertiary-container);
  --on-tertiary-container: var(--m3-d-on-tertiary-container);
  --error-container: #93000a;
  --on-error-container: #ffdad6;
  --accepted-container: color-mix(in srgb, var(--success) 26%, var(--field-bg));
  --declined-container: color-mix(in srgb, var(--danger) 24%, var(--field-bg));
  --diff-del-bg: color-mix(in srgb, var(--danger) 16%, var(--card-bg));
  --diff-del-word: color-mix(in srgb, var(--danger) 38%, var(--card-bg));
  --diff-add-bg: color-mix(in srgb, var(--success) 14%, var(--card-bg));
  --diff-add-word: color-mix(in srgb, var(--success) 34%, var(--card-bg));
  --diff-fold: color-mix(in srgb, var(--muted) 10%, var(--editor-bg));
  --diff-fold-hover: color-mix(in srgb, var(--muted) 18%, var(--editor-bg));
  --warning-tint: color-mix(in srgb, var(--warning) 14%, var(--editor-bg));
  --compare-ours-bg: color-mix(in srgb, var(--accent) 14%, var(--card-bg));
  --compare-ours-hover: color-mix(in srgb, var(--accent) 22%, var(--card-bg));
  --compare-theirs-bg: color-mix(in srgb, var(--warning) 13%, var(--card-bg));
  --compare-theirs-hover: color-mix(in srgb, var(--warning) 21%, var(--card-bg));
  --shadow: rgba(0, 0, 0, 0.5);
  --shadow-soft: rgba(0, 0, 0, 0.3);
  --glow-core: color-mix(in srgb, var(--accent) 45%, transparent);
  --glow-mid: color-mix(in srgb, var(--accent) 18%, transparent);
  --backdrop: rgba(0, 0, 0, 0.55);
  --toast-track: rgba(0, 0, 0, 0.15);
  --glass-bg: rgba(52, 52, 56, 0.6);
  --glass-edge: rgba(255, 255, 255, 0.1);
}

/* --- base ------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--editor-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }
/* Read by a screen reader, not drawn (an alert's words, said as it shows). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.close-sidebar { display: none; } /* the iOS app's phone sidebar alone has one (below) */

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

.offscreen { position: fixed; left: -9999px; top: 0; }

.icon { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; }
.icon svg { width: 100%; height: 100%; }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: var(--transparent);
  color: var(--muted);
}
/* Hovers only where something hovers (a tap leaves :hover on what was tapped in the apps' web views),
   and every button answers a press with Material's pressed state layer, over its fill (SPEC §5). */
@media (hover: hover) { .icon-button:hover { background: var(--hover); color: var(--text); } }
.icon-button:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
/* Material's ripple (js/ripple.js, SPEC §5): a disc the press grows, clipped to the button's shape. */
diffa-ripple { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
diffa-ripple-disc { position: absolute; border-radius: 50%; background: var(--ripple); opacity: 0; }
.icon-button:disabled { opacity: 0.38; cursor: default; pointer-events: none; } /* Material's disabled icon */
.icon-button[aria-pressed="true"] { color: var(--accent); }
#favorite-button[aria-pressed="true"] svg { fill: currentColor; }
/* A menu's Unfavorite (the note menu's): its star filled, as the button's and the Android app's. */
.menu-item.menu-pressed svg { fill: currentColor; }
.icon-button .icon { width: 1.3rem; height: 1.3rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--field-bg-quiet);
  color: var(--text);
  font-weight: 500;
}
@media (hover: hover) { .button:hover { background-image: linear-gradient(var(--hover), var(--hover)); } }
.button:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.button.primary { background: var(--accent); color: var(--accent-text); }
@media (hover: hover) { .button.primary:hover { background: var(--accent-hover); } }
.button.primary:active { background-image: linear-gradient(var(--accent-pressed), var(--accent-pressed)); }
.button.danger { background: var(--danger); color: var(--danger-text); }
@media (hover: hover) { .button.danger:hover { background: var(--danger-hover); } }
.button.danger:active { background-image: linear-gradient(var(--danger-pressed), var(--danger-pressed)); }
/* In the Android app a button squeezes under the finger as the app's own Today and due shapes do,
   and springs back on M3 Expressive's fast spatial spring as it is let go: a tap's pressed layer
   alone lasts too short a moment to be felt (SPEC §5). The event and booking page editors (both a
   .calendar-panel) squeeze their own way. */
html.shell-android :is(.icon-button, .button):not(.calendar-panel *, .jump-bar) { transition: scale 0.35s cubic-bezier(0.34, 1.5, 0.64, 1); }
html.shell-android :is(.icon-button, .button):not(.calendar-panel *, .jump-bar):active { transition: scale 0.08s ease-out; }
html.shell-android .icon-button:not(.calendar-panel *):active { scale: 0.86; }
html.shell-android .button:not(.calendar-panel *, .jump-bar):active { scale: 0.95; }
/* As specific as the rules above (their :not counts as a class), else it never applies: squeezed and
   back at once, no spring. */
@media (prefers-reduced-motion: reduce) {
  html.shell-android :is(.icon-button, .button):not(.calendar-panel *, .jump-bar),
  html.shell-android :is(.icon-button, .button):not(.calendar-panel *, .jump-bar):active { transition: none; }
}
.button.small { min-height: 1.9rem; padding: 0 0.75rem; font-size: var(--text-s); }
/* Disabled takes no hover or press, as Material's; in the Android app its container and label are
   Material's too: the text at 12% and at 38%, whatever the button's own colours. */
.button:disabled { opacity: 0.55; cursor: default; pointer-events: none; }
html.shell-android .button:disabled { opacity: 1; background: color-mix(in srgb, var(--text) 12%, transparent); color: color-mix(in srgb, var(--text) 38%, transparent); box-shadow: none; }
.danger-text, .danger-text .icon { color: var(--danger) !important; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 0.8rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--field-bg-quiet);
  outline: none;
}
:is(input, select):focus { box-shadow: 0 0 0 3px var(--focus-ring); }

.form-status { min-height: 1.3em; margin: 0.25rem 0 0; color: var(--muted); font-size: var(--text-s); }
.form-status.form-error { color: var(--danger); }

/* --- boot and sign-in ------------------------------------------------------------------- */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--boot-bg);
}
.boot-logo { border-radius: 18px; opacity: 0.85; }
/* The app's launch screen has shown the icon already (SPEC §5, Offline). */
.shell-app .boot-logo { visibility: hidden; }
/* In the boot screen's place while the launch opens the cache (unlock.js, SPEC §5): Material 3
   Expressive's loading indicator, a padlock on the cookie turning and breathing in the accent, and
   "Decrypting…" under it. It goes with the boot screen, nothing after. */
.decrypting {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--boot-bg);
  color: var(--muted);
  font-size: var(--text-m);
  font-weight: 500;
  animation: decrypting-in 0.25s ease-out;
}
.decrypting[hidden] { display: none; }
.decrypting-badge { position: relative; display: grid; place-items: center; width: 4.5rem; height: 4.5rem; }
.decrypting .cookie {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: var(--accent);
  animation: decrypting-turn 3s linear infinite;
}
.decrypting .cookie path { d: var(--cookie-rest); animation: decrypting-breathe 0.9s ease-in-out infinite alternate; }
.decrypting-lock { position: relative; width: 2.2rem; height: 2.2rem; fill: none; stroke: var(--accent-text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.decrypting-body { fill: var(--accent-text); }
.decrypting-keyhole { stroke: var(--accent); stroke-width: 2.4; }
@keyframes decrypting-in { from { opacity: 0; } }
@keyframes decrypting-turn { to { rotate: 360deg; } }
@keyframes decrypting-breathe { to { d: var(--cookie-pressed); } }
@media (prefers-reduced-motion: reduce) {
  .decrypting, .decrypting .cookie, .decrypting .cookie path { animation: none; }
}

.auth {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: var(--auth-bg);
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  padding: 2.25rem 2rem 1.75rem;
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: 0 12px 40px var(--shadow-soft), 0 1px 3px var(--shadow-soft);
  text-align: center;
}

.auth-logo { width: 88px; height: 88px; border-radius: 20px; box-shadow: 0 6px 18px var(--shadow-soft); }
.auth-title { margin: 1rem 0 0.25rem; font-size: var(--title-size); font-weight: 700; letter-spacing: -0.01em; color: var(--text-strong); }
.auth-tagline { margin: 0 0 1.5rem; color: var(--muted); font-size: var(--text-m); line-height: 1.4; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  margin-bottom: 1.25rem;
  border-radius: 9px;
  background: var(--field-bg-quiet);
}
.auth-tabs button {
  min-height: 2rem;
  border: 0;
  border-radius: 7px;
  background: var(--transparent);
  color: var(--muted);
  font-weight: 500;
  font-size: var(--text-s);
}
.auth-tabs button[aria-selected="true"] { background: var(--card-bg); color: var(--text); box-shadow: 0 1px 3px var(--shadow-soft); }

.auth-form { display: grid; gap: 0.85rem; text-align: left; }
.auth-form label { display: grid; gap: 0.35rem; font-size: var(--text-s); font-weight: 500; color: var(--muted); }
.auth-form input { color: var(--text); font-weight: 400; font-size: var(--text-m); }
.auth-submit { margin-top: 0.4rem; min-height: 2.6rem; font-size: var(--text-m); }
.auth-note { margin: 0; font-size: var(--text-xs); line-height: 1.45; color: var(--muted); }
.auth-status { margin: 0; min-height: 1.3em; text-align: center; font-size: var(--text-s); color: var(--muted); }
.auth-status.form-error { color: var(--danger); }
.auth-forgot { justify-self: center; padding: 0.25rem 0.5rem; border: 0; background: none; font: inherit; font-size: var(--text-s); color: var(--muted); text-decoration: underline; cursor: pointer; }
.auth.signup .signin-only { display: none; }
/* The recovery key, shown once (Settings > Account): its characters apart, the whole of it selectable. */
.recovery-code { display: block; padding: 0.8rem; border-radius: var(--radius); background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text-strong); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--text-m); letter-spacing: 0.04em; text-align: center; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.auth-links { display: flex; justify-content: center; gap: 1.25rem; margin: 1rem 0 0; font-size: var(--text-s); }
.auth-links a { color: var(--muted); }
.auth:not(.signup) .signup-only { display: none; }

/* --- three panes ------------------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) var(--list-width) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.app.hide-sidebar { grid-template-columns: 0 var(--list-width) minmax(0, 1fr); }
.app.hide-sidebar .sidebar { visibility: hidden; }
.app.hide-list { grid-template-columns: 0 0 minmax(0, 1fr); }
.app.hide-list .sidebar, .app.hide-list .list-pane { visibility: hidden; }

.sidebar, .list-pane, .editor-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }

.pane-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 3.25rem;
  padding: 0.6rem 0.75rem 0.4rem;
  flex: none;
}

.narrow-only { display: none; }

/* A pane's thin scrollbar under the pointer turns full width where it is drawn over the pane
   (app.js widenScrollbarsOnHover); !important beats the per-pane rules, some of which are more
   specific. One that takes room stays thin. Every thin pane's thumb, overlay or not, is in a colour
   that shows; the list is app.js's THIN_SCROLLERS, every pane with scrollbar-width: thin. */
.scroll-wide { scrollbar-width: auto !important; }
.sidebar-scroll, .list-body, #editor .cm-scroller, .reminders-body, .jump-results,
.month-day-list, .settings-body {
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* --- sidebar ------------------------------------------------------------------------------ */

.sidebar { background: var(--sidebar-bg); }

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: 3.25rem; padding: 0.6rem 0.75rem 0.4rem 1.1rem; }
.brand { display: inline-flex; flex: none; align-items: center; gap: 0.5rem; font-weight: 700; font-size: var(--text-l); color: var(--text-strong); }
/* The camel alone, in the accent colour, its eye cut out of the sidebar. */
.brand-mark { width: 24px; height: 24px; color: var(--accent); }
.brand-eye { fill: var(--sidebar-bg); }

/* Notes, the Calendar and Reminders stay put at the top; the favorite tags and lists, then the tags,
   follow with no more space between them than between any two rows, and the tags alone give way and
   scroll (SPEC §5). The whole column scrolls only if the favorites don't fit. */
.sidebar > #sections { flex: none; padding: 0.25rem 0.5rem 0; }
.sidebar-scroll { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; padding: 0 0.5rem; scrollbar-width: thin; }
.sidebar-scroll > * { flex: none; margin: 0; }
.sidebar-scroll > :empty { display: none; }
.sidebar-scroll > #tag-tree { flex: 0 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
/* Trash, Settings and the sync status stay at the bottom, under the scrolling list (SPEC §5). */
.sidebar-foot { position: relative; z-index: 1; flex: none; display: flex; flex-direction: column; padding: 0.25rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px)); }
/* The Android app's bar's glow (SPEC §5, PaneBar.kt): --glow, 0 to 1, set by app.js glowOf on what
   casts it, eases between its steps. In the accent, an ellipse as wide as the bar radiating from the
   middle of its edge, faint and short at a quarter, dense and long at 1. */
@property --glow { syntax: "<number>"; inherits: true; initial-value: 0; }
.glow::after, .sidebar-foot::before {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; pointer-events: none;
  height: calc(6px + 22px * var(--glow));
  background: radial-gradient(farthest-side at 50% 0, var(--glow-core), var(--glow-mid) 35%, var(--transparent));
  opacity: calc(min(var(--glow) * 4, 1) * (0.12 + 0.33 * var(--glow)) / 0.45);
  transition: --glow 0.3s ease;
}
@media (prefers-reduced-motion: reduce) { .glow::after, .sidebar-foot::before { transition: none; } }
/* While rows are hidden under it (--glow on the sidebar, app.js), it glows up over them. */
.sidebar-foot::before {
  top: auto; bottom: 100%;
  background: radial-gradient(farthest-side at 50% 100%, var(--glow-core), var(--glow-mid) 35%, var(--transparent));
}
.sidebar-foot .sync-status { align-self: flex-start; max-width: 100%; margin-top: 0.15rem; padding-left: 0.7rem; }

.sections, .tag-tree { list-style: none; margin: 0; padding: 0; }

.side-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 2.05rem;
  padding: 0 0.6rem;
  border: 0;
  border-radius: 7px;
  background: var(--transparent);
  color: var(--text);
  text-align: left;
  font-size: var(--text-m);
}
@media (hover: hover) { .side-item:hover { background: var(--hover); } }
.side-item[aria-current="true"] { background: var(--side-selected); color: var(--side-selected-text); font-weight: 600; }
@media (hover: hover) { .side-item[aria-current="true"]:hover { background: var(--side-selected-hover); } }
.side-item:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.side-item .icon { color: var(--muted); width: 1.15rem; height: 1.15rem; }
.side-item[aria-current="true"] .icon { color: var(--side-selected-text); }
.side-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* Tag icons line up with the section icons; sub-tags indent under their parent,
   and the expand chevron sits at the right so it never pushes the icon. */
.tag-item { gap: 0.1rem; padding: 0 0.25rem 0 calc(0.6rem + var(--depth, 0) * 1.1rem); }
.tag-open { display: flex; align-items: center; gap: 0.6rem; flex: 1; min-width: 0; min-height: 2.05rem; padding: 0; border: 0; background: var(--transparent); text-align: left; }
.tree-toggle { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem; flex: none; padding: 0; border: 0; border-radius: 6px; background: var(--transparent); color: var(--muted); }
@media (hover: hover) { .tree-toggle:hover { background: var(--hover); } }
.tree-toggle:active { background: var(--pressed); }
.tree-toggle .icon { width: 0.85rem; height: 0.85rem; transition: transform 0.15s ease; }
.tree-toggle.open .icon { transform: rotate(90deg); }

.side-icon { display: inline-flex; }
/* Sits under Trash at the sidebar's foot; a long label ("Sync problem · 3 waiting · retry in 12s") ellipsizes. */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.3rem 0.5rem;
  border: 0;
  border-radius: 6px;
  background: var(--transparent);
  color: var(--muted);
  font-size: var(--text-xs);
}
.sync-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .sync-status:hover { background: var(--hover); } }
.sync-status:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.sync-status .icon { width: 0.95rem; height: 0.95rem; }
.sync-status[data-state="synced"] .icon { color: var(--accent); }
.sync-status[data-state="offline"] .icon, .sync-status[data-state="error"] .icon { color: var(--danger); }
.sync-status[data-state="syncing"] .icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* The buttons that show or hide the sidebar carry the sync state as a dot: red while not
   syncing (waiting, offline, failed), yellow while syncing, none once synced. */
.sync-dot { position: relative; }
.sync-dot::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--danger);
}
.app[data-sync="syncing"] .sync-dot::after { background: var(--warning); }
.app[data-sync="synced"] .sync-dot::after { display: none; }

/* --- note list -------------------------------------------------------------------------------- */

.list-pane { background: var(--list-bg); }

.list-title { flex: 1; min-width: 0; margin: 0 0 0 0.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--title-size); line-height: 1.2; font-weight: 700; color: var(--text-strong); }

.app.embedded :is(#search-button, #reminders-search-button, #calendar-search-button) { display: none; } /* the app's header has one */
.list-head .icon-button#new-note { color: var(--accent); }

/* The note list's header floats over it, its buttons alone; between them, the list under it takes the
   clicks. The title is the list's first row, on the buttons' line, and scrolls away with the notes, as
   Reminders' does. */
.list-head { position: absolute; top: 0; left: 0; right: 0; z-index: 5; pointer-events: none; }
.list-head > * { pointer-events: auto; }
/* The buttons after the sidebar's on the right: from search, or New Note where search is the GNOME
   app's header bar's (hidden above). */
.list-head #search-button { margin-left: auto; }
.app.embedded .list-head #new-note { margin-left: auto; }
/* On the web the title's row stays put under the buttons (SPEC §5): a bar in the list's background, the
   buttons bare icons on it, what scrolls under it lit by its glow (.glow, app.js barGlow). A phone's
   title, on a row of its own, scrolls under the buttons' row instead, the bar (below). The iOS app's
   buttons float over the notes as glass, the title scrolling away (.shell-bars). */
.list-head .icon-button { border-radius: 50%; }
html:not(.shell-bars) .list-body > .notes-title { position: sticky; top: 0; z-index: 4; background: var(--list-bg); }
html:not(.shell-bars) .list-body { scroll-padding-top: 3.25rem; } /* a note gone to, clear of the bar */
.shell-bars .glow::after { content: none; }
/* What scrolls: the title, a tag's reminders and events, the Trash's note, then the notes. */
.list-body {
  display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin;
  overflow-anchor: none; /* app.js fillList draws rows in place of the spacer's height: nothing moves */
}
/* Where the header would put it: right of the sidebar button (0.75rem, 2rem, a 0.35rem gap and the
   title's 0.25rem), centred on the buttons' row; clear of search and New Note on the right. */
.list-body > .notes-title {
  flex: none;
  display: block;
  min-height: 3.25rem;
  margin: 0;
  padding: 0.6rem 5.5rem 0.4rem 3.35rem;
  line-height: 2.25rem;
}

/* Go To's clear button in the theme's colour instead of the browser's blue. */
.jump-field::-webkit-search-cancel-button {
  -webkit-appearance: none;
  width: 0.9rem;
  height: 0.9rem;
  background-color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  cursor: pointer;
}

.list-actions { padding: 0 0.75rem 0.5rem; display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; flex: none; }
.list-note { flex: 1; margin: 0; font-size: var(--text-xs); line-height: 1.35; color: var(--muted); }

/* A tag's open reminders and events, over its notes (renderTagItems): one line each, lined up with the
   notes' text, scrolling away with the title. */
.tag-items { flex: none; list-style: none; margin: 0; padding: 0 0.5rem 0.5rem; }
.tag-item-row {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.45rem 0.6rem;
  border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: var(--text-s); text-align: left; cursor: pointer;
}
@media (hover: hover) { .tag-item-row:hover { background: var(--hover); } }
.tag-item-row:active { background: var(--pressed); }
.tag-item-row .icon { width: 1.05rem; height: 1.05rem; color: var(--muted); }
.tag-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-item-where { flex: none; font-size: var(--text-xs); color: var(--muted); }

.note-list { flex: none; list-style: none; margin: 0; padding: 0 0.5rem 1rem; }

.note-row {
  display: flex;
  gap: 0.75rem;
  /* A finger resting on it opens its menu (holdForMenu), not iOS's text selection and callout. */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  margin-bottom: 2px;
  padding: 0.75rem 0.8rem 0.7rem;
  border-radius: 10px;
  cursor: pointer;
  outline: none;
}
/* Stands for the rows not drawn yet (fillList in app.js), so the scrollbar keeps its size. */
.note-rest { pointer-events: none; }
@media (hover: hover) { .note-row:hover { background: var(--hover); } }
.note-row[aria-selected="true"] { background: var(--row-selected); }
.note-row:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.note-main { flex: 1; min-width: 0; }
.note-title-line { display: flex; align-items: center; gap: 0.3rem; }
.note-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; font-size: var(--text-m); color: var(--text-strong); }
.note-flag { width: 0.9rem; height: 0.9rem; color: var(--accent); }
.note-favorite svg { fill: currentColor; }
/* Settings > Preview: 3 lines, 1 line or none (the note-list's data-preview). */
.note-list[data-preview="1"] .note-preview { -webkit-line-clamp: 1; }
.note-list[data-preview="0"] .note-preview { display: none; }
.note-preview {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0.25rem 0 0.35rem;
  font-size: var(--text-s);
  line-height: 1.4;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.note-date { font-size: var(--text-xs); color: var(--muted); }

/* With no rows the list takes no room, so the message sits in the middle. */
.note-list:empty { display: none; }
.list-empty { margin: auto 1rem; padding-bottom: 4rem; text-align: center; color: var(--muted); font-size: var(--text-m); }

/* --- editor pane ------------------------------------------------------------------------------- */

.editor-pane { position: relative; background: var(--editor-bg); }
.editor-head { padding-right: 1rem; }
.editor-head.no-note .icon-button:not(.narrow-only, .wide-only) { visibility: hidden; }
/* Outside the apps the header floats over the note too, as theirs does (.shell-bars below): the text
   scrolls under its buttons, behind the apps' see-through veil, and starts clear of its height
   (--note-head: its min-height, or a phone's 44px buttons and padding). The conflict bar or Find and
   Replace, when open, takes that room instead. */
/* The app's pane alone: a shared link's page (.editor-pane too) keeps its header in the flow. Between
   its buttons the note under it takes the clicks, its scrollbar's top too, as the list's header does. */
html:not(.shell-bars) #editor-pane { --note-head: 3.25rem; }
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  html:not(.shell-bars) #editor-pane { --note-head: calc(44px + 1rem); }
}
html:not(.shell-bars) .editor-head { position: absolute; top: 0; left: 0; right: 0; z-index: 5; pointer-events: none; }
html:not(.shell-bars) .editor-head > * { pointer-events: auto; }
html:not(.shell-bars) #editor .cm-content { margin-top: var(--note-head); }
html:not(.shell-bars) .conflict-bar:not([hidden]) { margin-top: var(--note-head); }
html:not(.shell-bars) #editor .cm-panels-top { padding-top: var(--note-head); }
html:not(.shell-bars) .conflict-bar:not([hidden]) ~ .editor-body #editor .cm-content,
html:not(.shell-bars) #editor .cm-editor:has(.cm-panels-top .find-panel) .cm-content { margin-top: 0; }
/* The conflict bar already clear of it: Find and Replace right under the bar. */
html:not(.shell-bars) .conflict-bar:not([hidden]) ~ .editor-body #editor .cm-panels-top { padding-top: 0; }
/* On one line, the header a fixed height over the note (a shared note's "Edited by" with a long name). */
.editor-head .note-badge { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.note-badge { margin-left: 0.5rem; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--accent-tint); color: var(--accent); font-size: var(--text-xs); font-weight: 600; }
.note-badge:empty { display: none; }
/* Another version met on the same lines (SPEC §5): a triangle after the title, a bar over the text. */
.note-conflict { display: inline-flex; flex: none; color: var(--warning-ink); }
.note-conflict .icon { width: 0.95rem; height: 0.95rem; }
.conflict-bar {
  display: flex; flex: none; align-items: center; gap: 0.6rem; margin: 0 1rem 0.5rem; padding: 0.45rem 0.5rem 0.45rem 0.75rem;
  border-radius: var(--radius); background: var(--warning-tint); color: var(--text); font-size: var(--text-s);
}
.conflict-bar[hidden] { display: none; }
.conflict-bar p { flex: 1; min-width: 0; margin: 0; }
.conflict-bar-icon { display: inline-flex; color: var(--warning-ink); }
.conflict-bar .button { flex: none; min-height: 1.9rem; padding: 0 0.85rem; background-color: var(--card-bg); }

.editor-body { position: relative; flex: 1; min-height: 0; display: flex; }
.editor { flex: 1; min-width: 0; height: 100%; }

.empty-view {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.empty-mark { width: min(14rem, 45%); height: auto; color: var(--faint); }
.empty-eye { fill: var(--editor-bg); }


/* --- CodeMirror, Bear-style ---------------------------------------------------------------------- */

#editor .cm-editor { height: 100%; background: var(--editor-bg); color: var(--text); }
#editor .cm-editor.cm-focused { outline: none; }
#editor .cm-scroller { font-family: var(--font); font-size: var(--text-m); line-height: 1.75; overflow-x: hidden; scrollbar-width: thin; }
#editor .cm-content { max-width: 44rem; margin: 0 auto; padding: 1.25rem 2rem 0; caret-color: var(--accent); }
#editor .cm-line { padding: 0; }
#editor .cm-cursor { border-left: 2px solid var(--accent); }
#editor .cm-selectionBackground { background: var(--selection) !important; }
#editor .cm-placeholder { color: var(--placeholder); }
#editor.read-only .cm-content { opacity: 0.85; }
/* Words, created and modified, centered under the last line: the text's next sibling in the
   scroller (a row of its own), not in it, and the room below the text that lets its last line
   scroll up to the middle. */
#editor .cm-scroller { flex-wrap: wrap; align-content: flex-start; }
#editor .cm-content { min-height: 0; } /* CodeMirror's 100% would push the line a screen down */
#editor .cm-note-stats { flex: 0 0 100%; padding: 2.5rem 2rem 45vh; text-align: center; font-size: var(--text-xs); line-height: 1.5; color: var(--muted); user-select: none; }
/* An asterism, the old books' mark for a break, between the text and its stats; silent to a screen reader. */
/* The plain content first, for an engine without alt text (iOS 17.0–17.3's): the mark shows, read out. */
#editor .cm-note-stats:not(:empty)::before { content: "⁂"; content: "⁂" / ""; display: block; margin-bottom: 1.25rem; font-size: var(--text-l); line-height: 1; }

#editor .cm-h { font-weight: 700; color: var(--text-strong); line-height: 1.35; }
#editor .cm-h1 { font-size: var(--h1-size); padding-top: 0.35em; padding-bottom: 0.15em; letter-spacing: -0.01em; }
#editor .cm-h2 { font-size: 1.4em; padding-top: 0.45em; padding-bottom: 0.1em; }
#editor .cm-h3 { font-size: 1.2em; padding-top: 0.35em; }
[data-headings="serif"] #editor :is(.cm-h1, .cm-h2) { font-family: var(--serif); }
#editor .cm-h4, #editor .cm-h5, #editor .cm-h6 { font-size: 1.05em; padding-top: 0.25em; }
#editor .cm-md-mark { color: var(--marker); font-weight: 400; }
#editor .cm-h .cm-md-mark { font-size: 0.7em; }

#editor .cm-strong { font-weight: 700; color: var(--text-strong); }
#editor .cm-em { font-style: italic; }
#editor .cm-strike { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
#editor .cm-underline { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
#editor .cm-highlight { background: var(--highlight-bg); color: var(--highlight-text); border-radius: 3px; padding: 0.05em 0; }
#editor .cm-inline-code { font-family: var(--mono); font-size: 0.9em; color: var(--code-text); background: var(--code-bg); border-radius: 4px; padding: 0.1em 0.2em; }

#editor .cm-codeblock { font-family: var(--mono); font-size: 0.9em; line-height: 1.6; background: var(--code-bg); color: var(--code-text); padding: 0 1rem; }
#editor .cm-codeblock-first { border-top-left-radius: 8px; border-top-right-radius: 8px; padding-top: 0.35em; }
#editor .cm-codeblock-last { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; padding-bottom: 0.35em; }
#editor .cm-codeblock .cm-inline-code { background: none; padding: 0; }

#editor .cm-quote { padding-left: 1rem; color: var(--muted); box-shadow: inset 3px 0 0 var(--quote-bar); }
#editor .cm-rule { color: var(--faint); letter-spacing: 0.3em; }
#editor .cm-table { font-family: var(--mono); font-size: 0.9em; }
#editor .cm-list-mark { color: var(--accent); font-weight: 700; }

#editor .cm-tag {
  color: var(--accent);
  background: var(--accent-tint);
  border-radius: 0.6em;
  padding: 0.1em 0.4em;
  cursor: pointer;
  font-weight: 500;
}
@media (hover: hover) { #editor .cm-tag:hover { background: var(--accent-tint-strong); } }
#editor .cm-h .cm-tag { font-size: 0.6em; vertical-align: 0.25em; }

#editor .cm-link, #editor .cm-wikilink { color: var(--accent); cursor: pointer; text-decoration: underline; text-decoration-color: var(--accent-tint-strong); text-underline-offset: 3px; }
@media (hover: hover) { #editor .cm-link:hover, #editor .cm-wikilink:hover { text-decoration-color: var(--accent); } }
#editor .cm-link-url { font-size: 0.85em; }

#editor .cm-task { padding-left: 0; }
#editor .cm-task-done { color: var(--muted); }
#editor .cm-task-done .cm-tag { color: var(--muted); background: var(--hover); }
#editor .cm-todo {
  display: inline-block;
  position: relative;
  width: 1.05em;
  height: 1.05em;
  margin: 0 0.5em 0 0.1em;
  vertical-align: -0.15em;
  border: 1.5px solid var(--checkbox);
  border-radius: 0.3em;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
@media (hover: hover) { #editor .cm-todo:hover { border-color: var(--accent); } }
#editor .cm-todo-checked { background: var(--accent); border-color: var(--accent); }
#editor .cm-todo-checked::after {
  content: "";
  position: absolute;
  left: 0.3em;
  top: 0.1em;
  width: 0.28em;
  height: 0.55em;
  border: solid var(--accent-text);
  border-width: 0 0.13em 0.13em 0;
  transform: rotate(45deg);
}


#editor .cm-panels { background: var(--list-bg); color: var(--text); border: 0; }
#editor .cm-panels-top { border: 0; }
/* Find in the note (Mod-F): a field, the match count, previous/next and close. */
#editor .find-panel { display: flex; align-items: center; gap: 0.35rem; max-width: 44rem; margin: 0 auto; padding: 0.5rem 2rem; font-size: var(--text-s); }
#editor .find-panel input { flex: 1; min-width: 0; min-height: 1.9rem; padding: 0 0.6rem; border: 0; border-radius: 7px; background: var(--field-bg); color: var(--text); font-size: var(--text-s); }
#editor .find-count { min-width: 4.5rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
#editor .find-button { min-width: 1.9rem; min-height: 1.9rem; padding: 0 0.5rem; border: 0; border-radius: 7px; background: var(--field-bg-quiet); color: var(--text); }
@media (hover: hover) { #editor .find-button:hover { background: var(--accent-tint-strong); color: var(--accent); } }
#editor .find-button:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
#editor .cm-searchMatch { background: var(--highlight-bg); color: var(--highlight-text); }
#editor .cm-searchMatch-selected { background: var(--accent-tint-strong); }
#editor .cm-selectionMatch { background: var(--accent-tint); }

/* --- reminder lists (SPEC §5): in place of the note list and the editor ---------------------------- */

.app[data-mode="reminders"] { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.app.hide-sidebar[data-mode="reminders"], .app.hide-list[data-mode="reminders"] { grid-template-columns: 0 minmax(0, 1fr); }
.app.hide-list[data-mode="reminders"] .sidebar { visibility: hidden; }

.list-dot { width: 0.55rem; height: 0.55rem; margin: 0 0.3rem 0 0.25rem; flex: none; border-radius: 50%; background: var(--accent); }
/* The number of a list's items that are due, in a circle (a pill past 9) of the accent. */
.side-count {
  flex: none;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.reminders-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--editor-bg); }
.reminders-head { padding-right: 1rem; }
.reminders-head #new-list { color: var(--accent); }
/* A tag's name opens its menu (Favorite, Rename, Delete), a chevron pointing down after it. */
.list-title:has(.title-menu) { display: flex; }
.title-menu {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.15rem 0.45rem 0.15rem 0.35rem;
  margin-left: -0.35rem;
  border: 0;
  border-radius: 7px;
  background: var(--transparent);
  color: inherit;
  font: inherit;
  text-align: left;
}
.title-menu[aria-expanded="true"] { background: var(--hover); }
@media (hover: hover) { .title-menu:hover { background: var(--hover); } }
.title-menu:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.title-menu-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-menu .icon { width: 0.95rem; height: 0.95rem; flex: none; color: var(--muted); transform: rotate(90deg); }
.list-rename-input {
  width: 100%;
  min-height: 0;
  padding: 0 0.3rem;
  margin-left: -0.3rem;
  border-radius: 7px;
  background: var(--field-bg-quiet);
  color: inherit;
  font: inherit;
}

/* Reminders: every list a card, like a sticky note, dealt into two columns (one on a narrow pane), each
   column stacking its own cards at their own heights (app.js renderReminders). */
.reminders-body {
  --board-pad: 1.25rem;
  flex: 1;
  overflow-y: auto;
  /* While a field is typed into on a touch screen, at least the keyboard's height (app.js followKeyboard),
     so the last line can rise above it. */
  padding: 0 var(--board-pad) max(30vh, var(--keyboard, 0px) + 2rem);
  scroll-padding-top: 3.5rem; /* a card shown (Go To, an alert) clear of the buttons */
  scrollbar-width: thin;
}
/* Reminders' header floats over the board, its buttons alone; between them, the board under it takes
   the clicks. The title is the board's first row, on the buttons' line, and scrolls away with the cards. */
.reminders-pane { position: relative; }
.reminders-head { position: absolute; top: 0; left: 0; right: 0; z-index: 5; pointer-events: none; }
.reminders-head > * { pointer-events: auto; }
.reminders-head #reminders-collapse { margin-left: auto; }
/* On the web the title's row stays put under the buttons, as the note list's (above), in the pane's
   background, the cards scrolling under it. */
.reminders-head .icon-button { border-radius: 50%; }
html:not(.shell-bars) .reminders-body > .reminders-title { position: sticky; top: 0; z-index: 4; background: var(--editor-bg); }
/* Where the header would put it: right of the sidebar button (0.75rem, 2rem, a 0.35rem gap and the
   title's 0.25rem), centred on the buttons' row; clear of Collapse Lists, search and New List on the
   right. */
.reminders-body > .reminders-title {
  display: block;
  min-height: 3.25rem;
  margin: 0 calc(-1 * var(--board-pad)) 1rem;
  padding: 0.6rem 7.9rem 0.4rem 3.35rem;
  line-height: 2.25rem;
}
/* Due, right after the title (app.js paintDue): the warning on the M3 Expressive shape for how many
   items are due (shapes.js ladderShape), no number, morphing as it changes, unseen until pressed (no
   fill, no shadow: the warning alone, in the notification dot's alert red); pressed, the shape in the
   alert red, glowing, slowly turning and wandering while it breathes toward the next shape (shapes.js
   breathe), and only the items due are shown, nothing dragged (SPEC §5). */
.due-filter {
  display: inline-flex;
  align-items: center;
  margin: -0.25rem 0 -0.25rem 0.6rem; /* the title's line keeps its height */
  padding: 0.15rem;
  border: 0;
  border-radius: 999px;
  vertical-align: top;
  background: var(--transparent);
  color: var(--accent);
  font-family: var(--font);
  line-height: 1;
}
.due-filter[hidden] { display: none; }
.due-filter:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.due-filter-badge { position: relative; display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; }
.due-filter-badge .ladder-shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: var(--transparent);
  transition: fill 0.3s, filter 0.3s;
}
.due-filter-icon { position: relative; display: inline-flex; color: var(--due-rest-ink); transition: color 0.3s; }
.due-filter[aria-pressed="true"] .due-filter-icon { color: var(--on-alert); }
/* Pressed: the alert red glowing, the glow swelling and fading; the shape turning once in 14 s (its
   `transform`, so the swing of a morph, its `rotate`, still adds to it) and the badge wandering a
   couple of pixels about its place. Reduced motion: the glow alone, still. */
.due-filter[aria-pressed="true"] .ladder-shape {
  fill: var(--alert);
  filter: drop-shadow(0 0 3px var(--due-glow)) drop-shadow(0 0 7px var(--due-glow));
  animation: due-glow 2.6s ease-in-out infinite alternate, due-turn 14s linear infinite;
}
.due-filter[aria-pressed="true"] .due-filter-badge { animation: due-wander 9s ease-in-out infinite; }
@keyframes due-glow { to { filter: drop-shadow(0 0 5px var(--due-glow)) drop-shadow(0 0 14px var(--due-glow)); } }
@keyframes due-turn { to { transform: rotate(360deg); } }
@keyframes due-wander {
  25% { translate: 1.5px -1px; }
  50% { translate: -0.5px 1.5px; }
  75% { translate: -1.5px -0.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .due-filter[aria-pressed="true"] :is(.ladder-shape, .due-filter-badge) { animation: none; }
}
.due-filter-icon .icon { width: 1.15rem; height: 1.15rem; }
/* Due pressed: nothing is dragged, so no grip and no open hand. */
.board.due-only .reminder-grip { display: none; }
.board.due-only .list-card-head, .board.due-only .reminder-row { cursor: auto; }
.board { display: flex; align-items: flex-start; gap: 1rem; max-width: 72rem; margin: 0 auto; }
.board-column { display: flex; flex: 1 1 0; flex-direction: column; gap: 1rem; min-width: 0; }
.list-card {
  position: relative;
  padding: 0.55rem 0.7rem 0.8rem 0.35rem;
  border-radius: 14px;
  background: var(--list-card-bg);
  box-shadow: 0 1px 3px var(--list-card-shadow), 0 6px 18px var(--list-card-shadow);
}
/* Picked up (app.js startListDrag): lifted, a little larger (its transform, inline), the shadow deeper. */
.list-card.dragging { z-index: 3; box-shadow: 0 8px 16px var(--shadow-soft), 0 16px 40px var(--shadow); }
/* A card picked up in one column, or Collapse Lists on: every card only its head meanwhile (app.js
   startListDrag, toggleReorder), the heads one group, M3 Expressive's segmented list: close together,
   every corner small, the first and last as the others, flat on the pane but for a hairline shadow. */
.board.collapsed .board-column { gap: 3px; }
.board.collapsed .list-card {
  padding: 0;
  border-radius: 6px;
  box-shadow: 0 1px 2px var(--list-card-shadow);
  transition: transform 0.35s cubic-bezier(0.42, 1.67, 0.21, 0.9), border-radius 0.35s cubic-bezier(0.42, 1.67, 0.21, 0.9), box-shadow 0.2s;
}
/* The one picked up follows the pointer, no transition, and is a pill; the others slide on the spring. */
.board.collapsed .list-card.dragging {
  border-radius: 999px;
  box-shadow: 0 8px 16px var(--shadow-soft), 0 16px 40px var(--shadow);
  transition: border-radius 0.35s cubic-bezier(0.42, 1.67, 0.21, 0.9), box-shadow 0.2s;
}
@media (prefers-reduced-motion: reduce) { .board.collapsed .list-card, .board.collapsed .list-card.dragging { transition: none; } }
/* Folded, the grip at the end of the line: a finger on it picks the card up at once (app.js pressToDrag),
   48 px tall for a finger, and the browser scrolls nothing from it. */
.list-card-grip {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  min-height: 48px;
  margin: -0.55rem -0.45rem -0.55rem 0;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}
.board.collapsed .list-card > :not(.list-card-head) { display: none; }
/* The card's padding the head's, so the whole line is the handle (pressToDrag is on the head). */
.board.collapsed .list-card-head { margin-bottom: 0; padding: 0.55rem 0.7rem 0.55rem 0.35rem; }
/* Collapse Lists on: the whole line is the card's handle, the open hand over it but on its buttons, its
   name (read only) no field when clicked (app.js listCard). */
.board.collapsed .list-card-head { cursor: grab; -webkit-user-select: none; user-select: none; }
.board.collapsed .list-card .list-name { cursor: grab; }
.board.collapsed .list-card .list-name:focus:not(:focus-visible) { background: var(--transparent); }
/* Something picked up (pressToDrag): no text selected on the way, the hand closed over it. */
.is-dragging, .is-dragging * { -webkit-user-select: none; user-select: none; cursor: grabbing !important; }
/* Where a dragged card would go: a bar in the accent above or below the card it would go before or after. */
.list-card.drop-before::before, .list-card.drop-after::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.list-card.drop-before::before { top: -0.6rem; }
.list-card.drop-after::after { bottom: -0.6rem; }
/* Folded in more than one column, in the 3 px between the heads. */
.board.collapsed .list-card.drop-before::before { top: -3px; }
.board.collapsed .list-card.drop-after::after { bottom: -3px; }
/* Shown from elsewhere (Go To, the Calendar, an alert): briefly outlined in the accent. */
.list-card.is-shown { animation: card-shown 1.6s ease-out; }
@keyframes card-shown {
  0%, 40% { outline: 2px solid var(--accent); outline-offset: 2px; }
  100% { outline: 2px solid var(--transparent); outline-offset: 2px; }
}
@media (prefers-reduced-motion: reduce) { .list-card.is-shown { animation-duration: 0.01s; } }

/* The head drags the card and an open item's row drags it (pressToDrag): a finger held there is the
   drag's, not iOS's callout. */
.list-card-head { display: flex; align-items: center; gap: 0.2rem; margin-bottom: 0.35rem; -webkit-touch-callout: none; }
/* Over the text fields' look (input[type="text"]): plain text until typed in. */
.list-card .list-name {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 0.2rem 0.35rem;
  border: 0;
  border-radius: 7px;
  background: var(--transparent);
  color: var(--text-strong);
  font: inherit;
  font-size: var(--text-l);
  font-weight: 650;
  text-overflow: ellipsis;
  box-shadow: none;
}
.list-card .list-name::placeholder { color: var(--placeholder); }
/* No background on hover: the text cursor alone says it can be clicked into. */
.list-card .list-name:not(:focus) { cursor: text; }
.list-card .list-name:focus { background: var(--field-bg-quiet); box-shadow: none; outline: none; }
.list-card-head .icon-button { flex: none; color: var(--muted); }
/* The Theme droplet over the items' alarm, the actions over their grip: an open item's alarm ends
   1.85rem in from the card's content (the row's 0.25rem padding, the grip's 1.5rem less its -0.3rem,
   the row's 0.4rem gap), so the droplet's right edge does too: the actions' width, its left margin and
   the head's 0.2rem gap make up 1.85rem. */
.list-card-head .list-card-actions { margin-left: calc(1.65rem - 2rem); }

.reminder-items { list-style: none; margin: 0; padding: 0; }
.list-card .reminder-row { background: var(--transparent); }
.list-card .completed-group { margin-top: 0.6rem; }

/* The Theme button (SPEC §5): Lucide's droplet filled, boldly, in the accent it goes on to (--next-l and
   --next-d, set by js/app.js), on hover too. At every width at the far right of the sidebar's head, the camel's row. */
.icon-button.theme-button, .icon-button.theme-button:hover { color: var(--next-l); }
:root[data-theme="dark"] .icon-button.theme-button, :root[data-theme="dark"] .icon-button.theme-button:hover { color: var(--next-d); }
.theme-button svg path { fill: currentColor; }
.sidebar-head .theme-button { margin-left: auto; }

/* A list's card in its scheme, a post-it on the board: with its own accent (SPEC §3.6) js/app.js
   sets that scheme's --m3-* and --accent-* on it, otherwise the page's come down to it; the colours the
   card draws with are mapped from them again here, as :root maps the page's. The event editor likewise,
   in the page's scheme over the Calendar. */
.list-card, .calendar-panel {
  --accent: var(--accent-l);
  --accent-text: var(--accent-l-text);
  --accent-tint: var(--accent-l-tint);
  --accent-tint-strong: var(--accent-l-tint-strong);
  --selection: var(--accent-l-selection);
  --focus-ring: var(--accent-l-focus);
  --list-card-bg: var(--m3-l-secondary-container);
  --card-bg: var(--m3-l-surface-lowest);
  --field-bg: var(--m3-l-surface-lowest);
  --field-bg-quiet: var(--m3-l-surface-highest);
  --row-selected: var(--m3-l-secondary-container);
  --accent-container: var(--m3-l-primary-container);
  --accent-container-text: var(--m3-l-on-primary-container);
  --secondary-container: var(--m3-l-secondary-container);
  --on-secondary-container: var(--m3-l-on-secondary-container);
  --text: var(--m3-l-on-surface);
  --text-strong: var(--m3-l-on-surface-strong);
  --muted: var(--m3-l-on-surface-variant);
  --faint: var(--m3-l-outline-variant);
  --marker: var(--m3-l-outline);
  --placeholder: var(--m3-l-on-surface-variant);
  --checkbox: var(--m3-l-outline);
  --scrollbar-thumb: var(--m3-l-outline);
  --hover: color-mix(in srgb, var(--text) 8%, transparent);
  --pressed: color-mix(in srgb, var(--text) 10%, transparent);
  --accent-hover: color-mix(in srgb, var(--accent-text) 8%, var(--accent));
  color: var(--text);
}
:root[data-theme="dark"] :is(.list-card, .calendar-panel) {
  --accent: var(--accent-d);
  --accent-text: var(--accent-d-text);
  --accent-tint: var(--accent-d-tint);
  --accent-tint-strong: var(--accent-d-tint-strong);
  --selection: var(--accent-d-selection);
  --focus-ring: var(--accent-d-focus);
  --list-card-bg: var(--m3-d-secondary-container);
  --card-bg: var(--m3-d-surface-high);
  --field-bg: var(--m3-d-surface-highest);
  --field-bg-quiet: var(--m3-d-surface-highest);
  --row-selected: var(--m3-d-secondary-container);
  --accent-container: var(--m3-d-primary-container);
  --accent-container-text: var(--m3-d-on-primary-container);
  --secondary-container: var(--m3-d-secondary-container);
  --on-secondary-container: var(--m3-d-on-secondary-container);
  --text: var(--m3-d-on-surface);
  --text-strong: var(--m3-d-on-surface-strong);
  --muted: var(--m3-d-on-surface-variant);
  --faint: var(--m3-d-outline-variant);
  --marker: var(--m3-d-outline);
  --placeholder: var(--m3-d-on-surface-variant);
  --checkbox: var(--m3-d-outline);
  --scrollbar-thumb: var(--m3-d-outline);
}

.reminder-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.45rem 0.25rem 0.45rem 0.35rem;
  border-radius: 10px;
  background: var(--editor-bg);
  -webkit-touch-callout: none;
}
.reminder-row:focus-within { background: var(--hover); }
.reminder-row.dragging { z-index: 2; background: var(--card-bg); box-shadow: 0 6px 22px var(--shadow); }
/* Ticked (vanish in app.js): the check pops in on a spring, the text pales and is struck through, then
   the row fades as its space folds shut. --vanish-delay carries it all on through a redraw. */
.reminder-row:is(.is-vanishing, .is-leaving) { /* leaving: moved past today under Due, folding away unticked */
  overflow: hidden;
  pointer-events: none;
  animation: reminder-fold 0.6s linear forwards; /* VANISH_MS, app.js */
  animation-delay: var(--vanish-delay, 0s);
}
@keyframes reminder-fold {
  0% { max-height: var(--row-height); }
  45% {
    opacity: 1;
    max-height: var(--row-height);
    padding-top: var(--row-pad);
    padding-bottom: var(--row-pad);
    animation-timing-function: cubic-bezier(0.3, 0, 0.8, 0.15); /* M3's emphasized accelerate */
  }
  100% { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
}
.reminder-row.is-vanishing .reminder-check {
  animation: check-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) backwards; /* M3 Expressive's fast spatial spring */
  animation-delay: var(--vanish-delay, 0s);
}
.reminder-row.is-vanishing .reminder-check .icon {
  animation: check-pop-icon 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  animation-delay: var(--vanish-delay, 0s);
}
@keyframes check-pop { from { scale: 0.8; } }
@keyframes check-pop-icon { from { scale: 0; opacity: 0; } }
/* A title shown through its links' overlay (has-links) pales there, not in its hidden textarea. */
.reminder-row.is-vanishing :is(.reminder-field:not(.has-links) > .reminder-text, .reminder-text + .reminder-links, .todo-text) {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--faint);
  animation: reminder-strike 0.25s cubic-bezier(0.2, 0, 0, 1) backwards;
  animation-delay: var(--vanish-delay, 0s);
}
@keyframes reminder-strike { from { color: var(--text-strong); text-decoration-color: var(--transparent); } }

.reminder-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.12rem;
  flex: none;
  padding: 0;
  border: 1.6px solid var(--checkbox);
  border-radius: 50%;
  background: var(--transparent);
  color: var(--transparent);
}
.reminder-check .icon { width: 0.95rem; height: 0.95rem; }
@media (hover: hover) { .reminder-check:hover { border-color: var(--accent); color: var(--accent); } }
.reminder-check:active { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 0.45rem var(--pressed); }
.reminder-check[aria-checked="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.reminder-check-add { border-style: dashed; color: var(--faint); }

.reminder-main { flex: 1; min-width: 0; display: grid; gap: 0.1rem; }
.reminder-main .reminder-text, .reminder-notes {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0.1rem 0;
  border: 0;
  border-radius: 0;
  background: var(--transparent);
  outline: none;
  box-shadow: none;
}
/* A long title wraps onto more lines, grown to fit it (app.js) as the notes are. */
.reminder-main .reminder-text { resize: none; overflow: hidden; font-size: var(--text-m); line-height: 1.4; color: var(--text-strong); }
.reminder-main .reminder-text::placeholder, .reminder-notes::placeholder { color: var(--placeholder); }
.reminder-main .reminder-text:focus, .reminder-notes:focus { box-shadow: none; }
.reminder-notes { resize: none; overflow: hidden; font-size: var(--text-s); line-height: 1.4; color: var(--muted); }
/* Notes show when there are some, or while the line is being edited: not while its check or alarm has
   the focus of a click, a line popping in under an item being ticked. */
:is(.reminder-row:not(:focus-within), .reminder-row:has(.reminder-check:focus, .reminder-alarm:focus)) .reminder-field:has(.reminder-notes:placeholder-shown) { display: none; }
/* Links in a title or notes (app.js withLinks): the same text drawn over the field while it isn't being
   edited, wrapped as the textarea wraps it; only the links take clicks. */
.reminder-field { position: relative; min-width: 0; }
.reminder-links { display: none; position: absolute; inset: 0; padding: 0.1rem 0; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; pointer-events: none; }
.reminder-field.has-links > textarea:not(:focus) { color: var(--transparent); text-decoration-color: var(--transparent); }
.reminder-field.has-links > textarea:not(:focus) + .reminder-links { display: block; }
.reminder-text + .reminder-links { font-size: var(--text-m); line-height: 1.4; color: var(--text-strong); }
.reminder-notes + .reminder-links { font-size: var(--text-s); line-height: 1.4; color: var(--muted); }
.reminder-row.is-done .reminder-text + .reminder-links { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.reminder-links a { pointer-events: auto; color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-tint-strong); text-underline-offset: 3px; }
@media (hover: hover) { .reminder-links a:hover { text-decoration-color: var(--accent); } }
/* A #tag in a reminder's title, drawn as the editor draws one (#editor .cm-tag), opens its tag. */
.reminder-links a.reminder-tag { text-decoration: none; border-radius: 4px; background: var(--accent-tint); }
@media (hover: hover) { .reminder-links a.reminder-tag:hover { background: var(--accent-tint-strong); } }
.reminder-due { font-size: var(--text-xs); color: var(--muted); }
/* The to-dos from notes' card (app.js todoCard): named by its icon alone; a line's text opens its note. */
.todo-card-head { min-height: 2rem; padding: 0 0.35rem; color: var(--muted); }
.todo-card-icon { width: 1.4rem; height: 1.4rem; }
.list-card .todo-card-name { margin: 0; line-height: 1.3; overflow: hidden; white-space: nowrap; }
.board.collapsed .todo-card { display: none; } /* not one of the lists being reordered */
/* Only text: the button under it opens the note. */
.reminder-main .todo-text {
  padding: 0.1rem 0;
  color: var(--text-strong);
  font-size: var(--text-m);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.reminder-row.is-done .todo-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
/* The note's name under a to-do: a small tonal button that opens the note at the line. */
.reminder-main .todo-note {
  justify-self: start;
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
  margin-top: 0.15rem;
  padding: 0.05rem 0.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--muted);
  font: inherit;
  font-size: var(--text-xs);
  line-height: 1.4;
  text-align: start;
  overflow-wrap: anywhere;
  cursor: pointer;
}
@media (hover: hover) { .reminder-main .todo-note:hover { background: var(--accent-tint-strong); color: var(--accent); } }
.reminder-main .todo-note:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
/* An event's: the Calendar's icon before its title (alone when the to-do's text is the title). */
/* A note's, its text being the note's title: the Notes icon alone. */
.reminder-main .todo-event, .reminder-main .todo-icon-only { display: inline-flex; align-items: center; gap: 0.3rem; }
.reminder-main .todo-event .icon, .reminder-main .todo-icon-only .icon { width: 1.05em; height: 1.05em; }
.reminder-due.overdue { color: var(--overdue); font-weight: 600; }
/* In the calendar, as in the list: past its day and still open. */
.cal-chip.cal-reminder.overdue:not(.selected) .cal-label { color: var(--overdue); } /* selected: on the accent */
.reminder-row.is-done .reminder-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }

/* Centred on the title's first line, as the check is (its 0.1rem padding and half its 1.4 line), not
   hung from the row's top: the same overhang above and below that 1.6rem line, so the row keeps its
   height (the button 2rem here, 44px on a phone, reaching into the row's padding). */
.reminder-row { --alarm-size: 2rem; }
.reminder-alarm { flex: none; margin-block: calc(0.8rem - var(--alarm-size) / 2); }
/* An open item's grip, at the far right after the alarm: a finger on it picks the item up at once, no
   hold (pressToDrag), and nothing scrolls or swipes from it; as tall as the alarm, on the same line. */
.reminder-grip {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: var(--alarm-size);
  margin-block: calc(0.8rem - var(--alarm-size) / 2);
  margin-left: -0.3rem;
  cursor: grab;
  touch-action: none;
}
.reminder-grip .icon { width: 1.15rem; height: 1.15rem; }
/* The grip and an alarm with no due day in the muted text colour, a shade under the text's contrast,
   so a set alarm's accent stands out; the text's own while the pointer is over the line. */
.reminder-alarm, .reminder-grip { color: var(--muted); }
@media (hover: hover) { .reminder-row:hover :is(.reminder-alarm:not([aria-pressed="true"]), .reminder-grip) { color: var(--text); } }
.reminder-alarm[aria-pressed="true"] { color: var(--accent); }
.reminder-row:has(.overdue) .reminder-alarm { color: var(--overdue); }
/* With a mouse, a reminder's alarm shows only while the pointer is over its line, or the focus is in it
   (its due day says the rest); a touch screen, which can't hover, always shows it, one beside a mouse
   or trackpad too (a touch-screen laptop, an iPad with a trackpad): a finger finds no invisible button. */
@media (hover: hover) and (pointer: fine) and (not (any-pointer: coarse)) {
  .reminder-alarm, .reminder-grip { opacity: 0; transition: opacity 0.12s ease; }
  .reminder-row:is(:hover, :focus-within) :is(.reminder-alarm, .reminder-grip) { opacity: 1; }
}

.reminder-add .reminder-check { cursor: default; }
/* The add line's cancel at its far right, on the title's line as an item's alarm is: only while the line
   is being typed in or holds text. */
.reminder-add-cancel { flex: none; margin-block: calc(0.8rem - var(--alarm-size) / 2); margin-left: auto; color: var(--muted); }
@media (hover: hover) { .reminder-add-cancel:hover { color: var(--text); } }
.reminder-add:not(:focus-within):has(.reminder-text:placeholder-shown) .reminder-add-cancel { display: none; }
/* New Reminder a shade quieter than the other placeholders (the outline, the Markdown marks' colour): an
   empty line waiting, not an item. */
.reminder-add .reminder-text::placeholder { color: var(--marker); }

/* A card's Completed: a pill saying how many, centred, and once open a list's bold red trash beside it,
   in the third column so the pill stays centred (SPEC §5). */
/* The pill (and the card of the items it opens) a shade off the card's own colour, a third of the way to
   its surface: a quiet chip, not the white one that stood out more than the items. */
.completed-group, .completed-card { --completed-bg: color-mix(in srgb, var(--card-bg) 35%, var(--list-card-bg)); }
.completed-group {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
  margin-bottom: 0.25rem;
}
.completed-toggle {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.25rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: var(--completed-bg);
  color: var(--muted); /* quiet beside the items */
  font-size: var(--text-s);
  font-weight: 500;
}
@media (hover: hover) { .completed-toggle:hover { background: color-mix(in srgb, var(--text) 8%, var(--completed-bg)); color: var(--text); } }
.completed-toggle:active { background-image: linear-gradient(var(--pressed), var(--pressed)); color: var(--text); }
.completed-trash { grid-column: 3; justify-self: start; color: var(--danger); border-radius: 999px; }
.completed-trash .icon { width: 1.3rem; height: 1.3rem; }
.completed-trash svg { stroke-width: 2.6; }
@media (hover: hover) { .completed-trash:hover { background: var(--error-container); color: var(--on-error-container); } }
.completed-trash:active { background: var(--error-container); color: var(--on-error-container); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .completed-trash:hover .icon { animation: trash-wiggle 0.45s ease-in-out; }
}
@keyframes trash-wiggle {
  25% { transform: rotate(-12deg) scale(1.1); }
  60% { transform: rotate(9deg) scale(1.1); }
}
/* A long Completed fades: after the first four each row is a tenth paler, down to a quarter, but the one in use. */
/* Under a mouse a hovered row comes back to full strength; a tap (no hover) leaves it faded. */
@media (hover: hover) { .reminder-done > .reminder-row:not(:hover, :focus-within) { opacity: clamp(0.25, 1 - (var(--fade, 0) - 3) * 0.1, 1); } }
@media (hover: none) { .reminder-done > .reminder-row:not(:focus-within) { opacity: clamp(0.25, 1 - (var(--fade, 0) - 3) * 0.1, 1); } }
/* Open, the completed items sit in a card of the pill's colour. */
.completed-card { margin-top: 0.35rem; padding: 0.35rem 0.4rem; border-radius: 14px; background: var(--completed-bg); }
.completed-forgotten { margin: 0.6rem 0.25rem 0.2rem; color: var(--muted); font-size: var(--text-xs); font-style: italic; line-height: 1.4; }

.field input:is([type="datetime-local"], [type="date"]) {
  width: 100%;
  min-height: 2.5rem;
  padding: 0 0.8rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--field-bg-quiet);
  outline: none;
}
.due-extra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.due-picks { display: flex; flex-wrap: wrap; gap: 0.35rem; }
/* The pick that is the field's day, selected as M3's filter chip is: the secondary container. */
.due-pick[aria-pressed="true"], .due-pick[aria-pressed="true"]:hover { background: var(--secondary-container); color: var(--on-secondary-container); }
.due-clear { color: var(--danger); }
@media (hover: hover) { .due-clear:hover { background: var(--error-container); color: var(--on-error-container); } }
.due-clear:active { background: var(--error-container); color: var(--on-error-container); }
/* A button of a dialog's own at the far left of its row (the alarm's Remove), Cancel and the submit on the right. */
.dialog-leading { display: flex; margin-right: auto; }

/* --- menus, dialogs, toasts ----------------------------------------------------------------------- */

.menu {
  position: fixed;
  z-index: 50;
  min-width: 13rem;
  padding: 0.35rem;
  border-radius: 11px;
  background: var(--menu-bg);
  box-shadow: 0 12px 36px var(--shadow), 0 1px 3px var(--shadow-soft);
  max-width: min(20rem, calc(100vw - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 2rem;
  padding: 0 0.65rem 0 calc(0.65rem + var(--depth, 0) * 1.1rem);
  border: 0;
  border-radius: 7px;
  background: var(--transparent);
  text-align: left;
  font-size: var(--text-s);
}
.menu-item .icon { flex: none; width: 1.05rem; height: 1.05rem; color: var(--muted); }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The section open, in the title's menu. */
.menu-item[aria-current="true"] { font-weight: 600; }
.menu-item[aria-current="true"] .icon { color: var(--accent); }
/* Under a mouse or the keys the item in the accent; under a finger, Material's pressed state layer. */
.menu-item:focus-visible { background: var(--accent); color: var(--accent-text); outline: none; }
.menu-item:focus-visible .icon { color: var(--accent-text); }
.menu-item:focus-visible :is(.list-dot, .side-count) { background: var(--accent-text); color: var(--accent); }
@media (hover: hover) {
  .menu-item:hover { background: var(--accent); color: var(--accent-text); outline: none; }
  .menu-item:hover .icon { color: var(--accent-text); }
  .menu-item:hover :is(.list-dot, .side-count) { background: var(--accent-text); color: var(--accent); }
}
@media (hover: none) { .menu-item:active { background: var(--pressed); } }
.menu-danger { color: var(--danger); }
.menu-danger .icon { color: var(--danger); }
.menu-accent .icon { color: var(--accent); }
.menu-gap { height: 0.4rem; }

.dialog {
  width: min(27rem, calc(100% - 2rem));
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 20px 60px var(--shadow);
}
.dialog::backdrop { background: var(--backdrop); }
.dialog-form { display: grid; gap: 0.85rem; padding: 1.4rem 1.5rem 1.25rem; }
.dialog-title { margin: 0; font-size: var(--text-l); color: var(--text-strong); }
.dialog-text { margin: 0; font-size: var(--text-s); line-height: 1.5; color: var(--muted); }
.field { display: grid; gap: 0.35rem; font-size: var(--text-s); font-weight: 500; color: var(--muted); }
.field :is(input, select) { color: var(--text); font-weight: 400; }
.field-check { display: flex; gap: 0.5rem; align-items: center; font-size: var(--text-s); color: var(--text); }
.field-check input { accent-color: var(--accent); margin: 0; }
/* A calendar file's events (SPEC §5 Calendar files): each title over its time, then the calendar. */
.calendar-file { display: grid; gap: 0.85rem; }
.calendar-file-events { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.calendar-file-events li { display: grid; gap: 0.1rem; font-size: var(--text-s); }
.calendar-file-title { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.calendar-file-when, .calendar-file-more { color: var(--muted); font-size: var(--text-s); }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.25rem; }
.dialog-choices { flex-wrap: wrap; } /* three answers and Cancel: on a phone, on two lines */
/* New Reminder's New List (the iOS and Android apps' only one): under the text, at its start. */
.dialog-new-list { justify-self: start; gap: 0.35rem; }
.dialog-new-list .icon { width: 1.1rem; height: 1.1rem; }

/* Go To (Alt-K): near the top, as a field that drops its lines under it. Never past the fold the keyboard
   leaves (--fold, app.js openJump): the lines give way so its Close stays above it. --jump-top is how far
   under the window's top the tray starts, --jump-foot the room it leaves under it. */
.jump { --jump-top: 12vh; --jump-foot: 1rem; width: min(34rem, calc(100% - 2rem)); margin-top: 12vh; padding: 0.6rem; }
html.native-bar .jump { --jump-top: calc(12vh + var(--native-head, 0px)); }
.jump[open] { display: flex; flex-direction: column; max-height: calc(var(--fold, 100dvh) - var(--jump-top) - var(--jump-foot)); }
.jump :is(.jump-box, .jump-cancel) { flex: none; }
.jump-field { width: 100%; }
.jump-box { position: relative; }
@media not (pointer: coarse) { .jump-field:placeholder-shown { padding-right: 4.5rem; } } /* room for the key, where it shows */
.jump-key {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  background: var(--hover);
  font: inherit;
  font-size: var(--text-xs);
  color: var(--muted);
  pointer-events: none;
}
/* Typed into, the clear button takes its place; a touch screen has no keys to show. */
.jump-field:not(:placeholder-shown) + .jump-key { display: none; }
@media (pointer: coarse) { .jump-key { display: none; } }
.jump-results { flex: 0 1 auto; min-height: 0; max-height: min(24rem, 60vh); overflow-y: auto; margin: 0.4rem 0 0; padding: 0; list-style: none; scrollbar-width: thin; }
.jump-item { display: flex; align-items: center; gap: 0.6rem; min-height: 2.1rem; padding: 0 0.65rem; border-radius: 7px; font-size: var(--text-m); cursor: default; } /* rows: the body size, as the note list's */
.jump-item .icon { flex: none; width: 1.05rem; height: 1.05rem; color: var(--muted); }
.jump-item .list-dot { margin: 0 0.25rem; }
.jump-item[aria-current="true"] { font-weight: 600; }
.jump-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jump-where { flex: 0 1 auto; min-width: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); color: var(--muted); }
.jump-item[aria-selected="true"] { background: var(--accent); color: var(--accent-text); }
.jump-item[aria-selected="true"] :is(.icon, .jump-where) { color: var(--accent-text); }
.jump-item[aria-selected="true"] .list-dot { background: var(--accent-text); }
.jump-empty { padding: 0.5rem 0.65rem; font-size: var(--text-s); color: var(--muted); }
.jump-more { padding: 0.15rem 0.65rem 0.4rem 2.3rem; font-size: var(--text-xs); color: var(--muted); }
/* It comes in sliding down a little and fading in, the dimmed page with it (SPEC §5); a phone's tray
   from the screen's top (below). */
.jump[open] { animation: jump-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1); }
.jump[open]::backdrop { animation: jump-backdrop-in 0.22s ease-out; }
@keyframes jump-in { from { opacity: 0; transform: translateY(-0.75rem) scale(0.98); } }
@keyframes jump-backdrop-in { from { opacity: 0; } }
/* On a touch screen its lines are 48 px tall, 4 px apart, easy to hit with a thumb. Their column never
   wider than the tray: an `auto` one would grow to the longest title, past a phone's screen. */
@media (pointer: coarse) {
  .jump-results { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 4px; }
  .jump-item { min-height: 48px; border-radius: 10px; }
  .jump-item .icon { width: 1.2rem; height: 1.2rem; }
}
/* A touch screen's way out under the lines, as wide as the field (app.js openJump). */
.jump-cancel { display: none; }
@media (pointer: coarse) { .jump .jump-cancel { display: block; width: 100%; min-height: 76px; margin-top: 0.75rem; border-radius: 38px; font-size: var(--text-l); font-weight: 600; } }
/* The Android app's Cancel (app.js cookieShape): Material 3 Expressive's 9-sided cookie in the tertiary
   container, its cross alone, floating 24px under the tray rather than at the screen's foot, which
   would start low and jump as the keyboard comes up after it; it spins in, and pressed it turns a
   scallop on and swells nearly round on the expressive spring. The tray stops 24px over the cookie's
   room, the lines giving way, so the cookie never goes past the fold; on a screen too short for it
   and two lines (landscape, or a small phone with the keyboard up) the cookie shrinks, to 56px. */
.shell-android .jump {
  --cookie-size: clamp(56px, calc(var(--fold, 100dvh) - var(--jump-top) - 48px - 8rem), clamp(112px, 20dvh, 160px));
  overflow: visible;
}
.shell-android .jump[open] { max-height: calc(var(--fold, 100dvh) - var(--jump-top) - var(--cookie-size) - 48px); }
/* The cookie is a touch screen's Cancel, as the wide one elsewhere: none under a mouse (DeX, a Chromebook). */
@media not (pointer: coarse) { .shell-android .jump-cancel.jump-cookie { display: none; } }
.shell-android .jump-cancel.jump-cookie {
  --cookie-spring: cubic-bezier(0.42, 1.67, 0.21, 0.9);
  position: absolute;
  top: calc(100% + 24px);
  left: calc(50% - var(--cookie-size) / 2);
  isolation: isolate;
  display: grid;
  place-items: center;
  width: var(--cookie-size);
  height: var(--cookie-size);
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--on-tertiary-container);
  animation: cookie-in 0.5s var(--cookie-spring);
}
.jump-cookie .icon { width: 44px; height: 44px; }
.jump-cookie .icon svg { stroke-width: 2.4; }
.jump-cookie .cookie {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: var(--tertiary-container);
  filter: drop-shadow(0 6px 14px var(--shadow));
  transition: rotate 0.5s var(--cookie-spring), scale 0.35s var(--cookie-spring), fill 0.15s;
}
.jump-cookie .cookie path { d: var(--cookie-rest); transition: d 0.4s var(--cookie-spring); }
.jump-cookie:active .cookie {
  rotate: 40deg; /* a ninth of a turn: a scallop on */
  scale: 1.08;
  fill: color-mix(in srgb, var(--on-tertiary-container) 10%, var(--tertiary-container));
}
.jump-cookie:active .cookie path { d: var(--cookie-pressed); }
.jump-cookie:focus-visible { outline: none; }
.jump-cookie:focus-visible .cookie { outline: 3px solid var(--focus-ring); outline-offset: 4px; border-radius: 50%; }
@keyframes cookie-in { from { opacity: 0; rotate: -80deg; scale: 0.4; } }
/* On a phone the tray is the window's top, over the panes' bar, full width, its lines filling what
   the field and Close leave of the screen's height above the fold (the Android app's leaving its cookie
   room). */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  .jump { --jump-top: 0px; --jump-foot: 0px; }
  /* Under the Android app's own bar (html.native-bar), which already holds the status bar's height. */
  html.native-bar .jump { --jump-top: var(--native-head, 0px); }
  .jump[open] {
    width: 100%;
    max-width: 100%;
    margin: 0 0 auto;
    padding: calc(0.6rem + env(safe-area-inset-top, 0px)) calc(0.6rem + env(safe-area-inset-right, 0px)) 0.6rem calc(0.6rem + env(safe-area-inset-left, 0px));
    border-radius: 0 0 16px 16px;
  }
  .jump .jump-results { max-height: none; }
  html.native-bar .jump[open] { padding-top: 0.6rem; }
  .jump[open] { animation-name: jump-down; animation-duration: 0.26s; }
  @keyframes jump-down { from { opacity: 0.4; transform: translateY(-40%); } }
}
/* A phone's touch screen (app.js openJump): a search bar under the shown pane's title bar (--bar-top;
   under the Android app's own bar where that one is the title bar), what's under the title bar pushed
   down as far as it is tall (.jump-pushed, below) and faded well down, no shadow between them (one
   flickered under the title bar as it went). It slides out from under the title bar and back (--lift: how much of it is still under there,
   its clip keeping that unseen), following the finger as it is swiped away (.jump-dragging). Typed into,
   its lines fill the room under it down to the keyboard (--fold), over the pane. */
:root .jump.jump-bar[open] {
  inset: var(--bar-top, 0px) 0 auto;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: calc(var(--fold, 100dvh) - var(--bar-top, 0px));
  margin: 0;
  padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  overflow: hidden;
  border-radius: 0;
  box-shadow: none;
  animation: none;
  transform: translateY(calc(-1 * var(--lift, 0px)));
  clip-path: inset(var(--lift, 0px) 0 0 0);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1), clip-path 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
:root .jump.jump-bar:not(.jump-blank)[open] { height: calc(var(--fold, 100dvh) - var(--bar-top, 0px)); }
:root .jump.jump-bar.jump-leaving { transition-duration: 0.22s; transition-timing-function: cubic-bezier(0.3, 0, 0.8, 0.15); }
:root .jump.jump-bar.jump-dragging { transition: none; }
.jump.jump-bar[open]::backdrop { background: transparent; animation: none; }
.jump.jump-bar .jump-results { flex: 1 1 0; max-height: none; margin: 0; padding: 0.25rem 0.75rem 0.75rem; }
.jump.jump-bar.jump-blank .jump-results { display: none; }
/* Its lines listed, a round Close floats at their foot's right, 16px over the keyboard (the bar's foot
   is the fold) and from the screen's edge, popping in; the lines leave room under their last so none stays behind it. The Android
   app's is its tray's cookie, small, a scallop on and swelling as it is pressed; elsewhere a round cross
   in the accent's container (app.js openJump). */
.jump-float { display: none; }
.jump.jump-bar:not(.jump-blank) .jump-float {
  position: absolute;
  bottom: 16px;
  right: calc(16px + env(safe-area-inset-right, 0px));
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent-container);
  color: var(--accent-container-text);
  box-shadow: 0 4px 12px var(--shadow);
  animation: float-in 0.3s cubic-bezier(0.34, 1.5, 0.64, 1);
}
/* At the screen's foot, no keyboard over it (app.js fold()): clear of the home indicator too. */
.jump.jump-bar.jump-no-keyboard:not(.jump-blank) .jump-float { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.jump.jump-bar:not(.jump-blank) .jump-float:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.jump-float .icon { width: 24px; height: 24px; }
.jump-float:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.jump.jump-bar:not(.jump-blank) .jump-results { padding-bottom: calc(56px + 32px); }
.shell-android .jump.jump-bar:not(.jump-blank) .jump-float.jump-cookie {
  --cookie-spring: cubic-bezier(0.42, 1.67, 0.21, 0.9);
  isolation: isolate;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--on-tertiary-container);
  animation: cookie-in 0.5s var(--cookie-spring);
}
.jump-float.jump-cookie .icon { width: 26px; height: 26px; }
.jump-float.jump-cookie .cookie { filter: drop-shadow(0 4px 10px var(--shadow)); }
.jump-float.jump-cookie:focus-visible { outline: none; }
@keyframes float-in { from { opacity: 0; scale: 0.5; } }
@media (prefers-reduced-motion: reduce) {
  .jump.jump-bar:not(.jump-blank) .jump-float, .shell-android .jump.jump-bar:not(.jump-blank) .jump-float.jump-cookie { animation: none; }
}
/* Its row, 4 rem tall (app.js pullToSearch's ARM): a 2.75 rem pill with a magnifier at its start, and
   Cancel in words at its right, as iOS's own search bars have it. The pull's bar (.pull-bar) is drawn
   the same, so the one takes the other's place unseen. */
.jump-row, .pull-bar {
  display: flex;
  flex: none;
  box-sizing: border-box;
  align-items: center;
  gap: 0.5rem;
  height: 4rem;
  padding: 0 0.75rem;
}
.jump-row .jump-box { flex: 1; min-width: 0; }
.jump.jump-bar .jump-field, .pull-bar-field {
  box-sizing: border-box;
  height: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.8rem 0 2.4rem;
  border-radius: 1.375rem;
  background: var(--field-bg-quiet);
  font-size: var(--text-m);
}
.jump.jump-bar .jump-field:focus { box-shadow: none; } /* always focused while it is there */
.jump-glass, .pull-bar-field .icon { width: 1.1rem; height: 1.1rem; color: var(--muted); }
.jump-glass { position: absolute; top: 50%; left: 0.8rem; display: flex; transform: translateY(-50%); pointer-events: none; }
:root .jump.jump-bar .jump-cancel.jump-bar-cancel, .pull-bar-cancel {
  display: flex;
  flex: none;
  align-items: center;
  width: auto;
  min-height: 2.75rem;
  margin: 0;
  padding: 0 0.25rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-m);
  font-weight: 500;
}
.jump-bar-cancel:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
/* What a phone's Go To bar pushed down (app.js pushPane): easing there and back, and fading, with the
   finger while the bar is swiped. */
.jump-pushed > :not(.pane-head, .pull-search, .pull-bar) {
  will-change: transform, opacity;
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.jump-pushed.jump-dragging > :not(.pane-head, .pull-search, .pull-bar) { transition: none; }
@media (prefers-reduced-motion: reduce) {
  :root .jump.jump-bar[open], .jump-pushed > :not(.pane-head, .pull-search, .pull-bar) { transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  .jump[open], .jump[open]::backdrop { animation: none; }
  .shell-android .jump-cancel.jump-cookie { animation: none; }
  .jump-cookie .cookie, .jump-cookie .cookie path { transition: none; }
}

/* Swipe actions (app.js swipeRow): the row slides over its action filling the gap it leaves, on its
   right when swiped to the left, on its left when swiped to the right: a red Delete, an accent Unlist. */
.swiping { position: relative; z-index: 1; }
.swipe-release { transition: transform 0.25s ease-out; }
.swipe-release .swipe-action { transition: width 0.25s ease-out; }
.swipe-action {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  overflow: hidden;
  border-radius: 10px;
  font-size: var(--text-s);
  font-weight: 500;
  white-space: nowrap;
}
.swipe-action.swipe-right { left: auto; right: 100%; }
.swipe-delete { background: var(--danger); color: var(--danger-text); }
.swipe-unlist { background: var(--accent); color: var(--accent-text); }
.swipe-action .icon { flex: none; width: 1.1rem; height: 1.1rem; }
.swipe-action.armed { font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  .swipe-release, .swipe-release .swipe-action { transition: none; }
}

/* Pull to search (app.js pullToSearch): what's under the head follows the finger (its transform,
   set there), and the badge in the gap grows in, filled with the accent once letting go opens Go To. */
.sidebar, .list-pane, .reminders-pane, .settings-pane { position: relative; }
:is(.pulling, .pull-release) > :not(.pane-head, .pull-search, .pull-bar) { will-change: transform; }
.pull-release > :not(.pane-head, .pull-search, .pull-bar) { transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); }
/* The Calendar's on a wider screen: the day alone, its contents moving inside it (pullToSearch's `area`). */
.calendar-pane:is(.pulling, .pull-release):not(.pull-bar-mode) > :not(.pull-search) { will-change: auto; transition: none; }
.calendar-pane:is(.pulling, .pull-release):not(.pull-bar-mode) .month-day-list > * { will-change: transform; }
.calendar-pane.pull-release:not(.pull-bar-mode) .month-day-list > * { transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); }
.pull-search {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  display: none;
  align-items: center;
  justify-content: center;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
:is(.pulling, .pull-release):not(.pull-bar-mode) > .pull-search { display: flex; }
.pull-search .icon {
  flex: none;
  box-sizing: content-box;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0.55rem;
  border-radius: 50%;
  background: var(--hover);
  color: var(--muted);
  opacity: var(--pull-progress, 0);
  transform: scale(calc(0.6 + 0.4 * var(--pull-progress, 0)));
  transition: background-color 0.15s, color 0.15s;
}
.pull-search.armed .icon { background: var(--accent); color: var(--accent-text); }
/* A phone's pull: Go To's bar (as .jump-bar draws it) coming out from under the title bar, its foot on
   the contents' top (app.js sets its transform and clip, which keeps what is still under the title bar
   unseen), its magnifier in the accent once far enough; let go earlier it goes back up under it. */
.pull-bar {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 6;
  display: none;
  padding: 0 calc(0.75rem + env(safe-area-inset-right, 0px)) 0 calc(0.75rem + env(safe-area-inset-left, 0px));
  background: var(--card-bg);
  pointer-events: none;
  will-change: transform;
}
:is(.pulling, .pull-release).pull-bar-mode > .pull-bar { display: flex; }
.pull-release > .pull-bar { transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1), clip-path 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); }
.pull-bar-field { position: relative; display: flex; flex: 1; align-items: center; min-width: 0; color: var(--muted); }
.pull-bar-field .icon { position: absolute; top: 50%; left: 0.8rem; transform: translateY(-50%); transition: color 0.15s; }
.pull-bar.armed .pull-bar-field .icon { color: var(--accent); }
.pull-bar-hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .pull-release > :not(.pane-head, .pull-search, .pull-bar), .calendar-pane.pull-release .month-day-list > * { transition: none; }
}

/* Settings (SPEC §5): a page in place of the note list and the editor, its screen a column in the middle. */
/* Settings on the accent's tone, its groups white on it (SPEC §3.5): the page's surfaces mapped to those
   here, so its header, floating bars and groups follow. */
.settings-pane { --editor-bg: var(--theme-page-bg); --list-bg: var(--theme-group-bg); --card-bg: var(--theme-group-bg); }
.settings-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--editor-bg); }
.settings-pane-head { padding-right: 1rem; }
.settings-body { flex: 1; overflow-y: auto; padding: 0.5rem 1.25rem 4rem; scrollbar-width: thin; }
.settings { display: grid; gap: 0.35rem; max-width: 34rem; margin: 0 auto; }
.settings-head { display: flex; align-items: center; justify-content: space-between; }
.settings-title { margin: 0; font-size: var(--text-l); color: var(--text-strong); }
.settings-account { margin: 0 0 0.5rem; font-size: var(--text-s); color: var(--muted); }
.settings-heading { margin: 0.75rem 0 0.25rem; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
/* minmax(0, …) and min-width: 0: a long name (a CalDAV account's) is cut short instead of widening the dialog past the screen */
/* Its rows a segmented list in every app (SPEC §5): each a surface of its own 2 px from the next, the
   group's outer corners large and the inner ones small, the group clipping them. */
.settings-group { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 2px; border-radius: 16px; overflow: hidden; }
.settings-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.9rem;
  padding: 0.3rem 0.9rem;
  border: 0;
  border-radius: 8px;
  background: var(--transparent);
  text-align: left;
  font-size: var(--text-m);
}
.settings-group > * { min-width: 0; border-radius: 4px; background: var(--list-bg); }
/* Material's state layers over the row's surface, hovered (8%) or pressed (10%); hovered only where
   something can hover (a tap leaves :hover on the row tapped). */
@media (hover: hover) {
  .settings-group > :is(button.settings-item:hover, .settings-sort:hover, .calendar-row:hover) {
    background: linear-gradient(var(--hover), var(--hover)) var(--list-bg);
  }
}
.settings-group > :is(button.settings-item:active, .settings-sort:active, .calendar-row:active) {
  background: linear-gradient(var(--pressed), var(--pressed)) var(--list-bg);
}
.settings-group > button.settings-item:disabled { background: var(--list-bg); }
/* Inside the group, which clips them: the ring drawn within the row. */
.settings-group > :focus-visible,
.settings-group > :has(> :is(select, input):focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.settings-group > :has(> :is(select, input):focus-visible) :is(select, input):focus { box-shadow: none; }
.settings-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
/* An on/off choice (Diffa's own calendar, Open Calendar Files with Diffa): Material's switch at the
   row's end, a 52 × 32 track, its thumb 16 px off and 24 px on. */
.settings-item input[role="switch"] {
  order: 1;
  flex: none;
  position: relative;
  box-sizing: border-box;
  width: 52px;
  height: 32px;
  margin: 0 0 0 auto;
  border: 2px solid var(--muted);
  border-radius: 16px;
  background: var(--field-bg-quiet);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.settings-item input[role="switch"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
  transition: left 0.2s cubic-bezier(0.2, 0, 0, 1), width 0.2s, height 0.2s, background-color 0.2s;
}
.settings-item input[role="switch"]:checked { border-color: var(--accent); background: var(--accent); }
.settings-item input[role="switch"]:checked::before { left: 22px; width: 24px; height: 24px; background: var(--accent-text); }
.settings-item input[role="switch"]:disabled { opacity: 0.38; }
.settings-item input[role="switch"]:focus { box-shadow: none; } /* the row draws the ring for the keyboard */
@media (prefers-reduced-motion: reduce) {
  .settings-item input[role="switch"], .settings-item input[role="switch"]::before { transition: none; }
}
.settings-item .icon { width: 1.1rem; height: 1.1rem; color: var(--muted); } /* the muted text: Settings has no theme of its own (SPEC §3.5) */
.settings-sort > span:not(.icon) { flex: 1; }
.settings-value { display: none; } /* the Android app's alone (below) */
/* Check for updates: what it found under the label, in every app. */
html:not(.shell-android) .update-row:has(.settings-status:not(:empty)) { padding-top: 0.35rem; padding-bottom: 0.35rem; }
.update-row .settings-text { display: grid; min-width: 0; gap: 1px; }
.settings-status { font-size: var(--text-xs); color: var(--muted); }
.settings-status:empty { display: none; }
.settings-status.is-error { color: var(--danger); }
/* A choice's value: a round tonal button at the row's end, in the secondary container (SPEC §5). */
.settings-select {
  width: auto;
  min-width: 0;
  min-height: 2rem;
  padding: 0 0.6rem 0 0.95rem;
  border-radius: 999px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-size: var(--text-s);
  font-weight: 500;
  cursor: pointer;
}
@media (hover: hover) { .settings-select:hover { background: linear-gradient(var(--hover), var(--hover)) var(--secondary-container); } }
.settings-select:active { background: linear-gradient(var(--pressed), var(--pressed)) var(--secondary-container); }
/* Settings > Month scrolling (an admin's): each number beside its name and what it does. */
.fling-row { cursor: default; }
.fling-row .settings-text { flex: 1; min-width: 0; }
.fling-input { flex: none; width: 6.5rem; text-align: right; }
/* Alerts: bottom center with a close button, on the accent colour (errors stay on the danger colour). */
.toast {
  position: fixed;
  z-index: 60;
  max-width: min(26rem, calc(100% - 2rem));
  padding: 0.65rem 1.1rem;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: var(--text-s);
  font-weight: 500;
  box-shadow: 0 8px 28px var(--shadow);
}
.toast-error { background: var(--danger); color: var(--danger-text); }
.alert {
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-right: 0.4rem;
}
.alert > span { min-width: 0; overflow-wrap: anywhere; } /* a long address or name wraps, not over the button */
/* Above the storage card while it shows, not over its buttons (its height is set when it opens). A
   class app.js sets, not body:has(): with the .calendar-panel:has(…) > * rules that restyled the whole
   page at each element added anywhere (a redraw, each key typed into Go To). */
body.storage-card-shown .alert { bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px) + var(--storage-card-h, 11rem)); }
/* Settings' last rows scroll up clear of it (the dialog it was came over it). */
body.storage-card-shown .settings-body { padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px) + var(--storage-card-h, 11rem)); }
.toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  opacity: 0.8;
  cursor: pointer;
}
@media (hover: hover) { .toast-close:hover { opacity: 1; background: var(--toast-track); } }
.toast-close:active { opacity: 1; background: var(--toast-track); }
/* The global ring is the accent, the alert's own background: its text colour shows instead. */
.toast-close:focus-visible { opacity: 1; outline: 2px solid var(--accent-text); outline-offset: -2px; }
/* Its action (Undo): a word in bold beside the text, on the alert's own colours. */
.toast-action {
  flex: none;
  min-height: 1.75rem;
  padding: 0 0.6rem;
  border: 0;
  border-radius: 7px;
  background: var(--toast-track);
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.toast-action:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; }
@media (pointer: coarse) { .toast-action { min-height: 44px; } }

/* Calendar and reminder alerts: the machine's own notifications (SPEC §5). Their rows, newest under, are
   drawn only in More on a phone in the apps (below, Tab bar); anywhere else they are kept but not drawn.
   A plain list on More's surface, no card: the row (opaque, as it slides over its swipe's Dismiss) is a
   button that opens it, its × beside, the rows apart by spacing alone. */
.alert-cards { display: none; }
.alert-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  background: var(--tab-bar-bg);
  color: var(--text);
  font-size: var(--text-s);
  line-height: 1.4;
}
.alert-card-open {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.alert-card-open:active { background: var(--pressed); }
.alert-card-open:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.alert-card-open > span { overflow-wrap: anywhere; }
.alert-card-head { display: flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: var(--text-xs); }
.alert-card-dot { flex: none; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--alert); }
.alert-card-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-card-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin: 0 -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.alert-card-close:active { background: var(--pressed); color: var(--text); }
.alert-card-close:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.alert-card .alert-card-title { margin: 0.2rem 0 0.1rem; color: var(--text-strong); font-size: var(--text-m); font-weight: 650; }
.alert-card .alert-card-notes {
  margin-top: 0.2rem;
  color: var(--muted);
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.swipe-dismiss { background: var(--muted); color: var(--tab-bar-bg); }

/* The one-time explanation before the browser's persistent-storage question. */
.storage-card {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 55;
  width: min(23rem, calc(100% - 2rem));
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 10px 34px var(--shadow);
  font-size: var(--text-s);
  line-height: 1.45;
}
/* An app the server no longer answers (app.js showUpgrade): the same card, top right under the
   panes' headers as a long task's panel, clear of the alerts and of the apps' bars at the foot. */
.upgrade-card { top: calc(4rem + env(safe-area-inset-top, 0px)); bottom: auto; right: calc(1rem + env(safe-area-inset-right, 0px)); }
.upgrade-card p:last-child { margin-bottom: 0; }
.storage-card p { margin: 0 0 0.5rem; }
.storage-title { margin: 0 0 0.4rem; font-size: var(--text-m); font-weight: 650; color: var(--text-strong); }
.storage-hint { color: var(--muted); font-size: var(--text-s); }
.storage-buttons { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.75rem; }
.settings-item:disabled { opacity: 1; color: var(--muted); cursor: default; }

/* A long task (an import): top right, under the panes' headers (it lasts minutes: their buttons
   stay in reach), clear of a landscape iPhone's corner. With a Stop button. */
.progress { top: calc(4rem + env(safe-area-inset-top, 0px)); right: calc(1rem + env(safe-area-inset-right, 0px)); width: min(24rem, calc(100% - 2rem)); padding: 0.7rem 0.9rem 0.8rem; }
.progress-row { display: flex; align-items: center; gap: 0.75rem; }
.progress-row span { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.progress-stop {
  flex: none;
  padding: 0.25rem 0.75rem;
  border: 0;
  border-radius: 7px;
  /* Inverted: the panel itself is on the accent colour. */
  background: var(--accent-text);
  color: var(--accent);
  font: inherit;
  font-size: var(--text-s);
  font-weight: 600;
}
.progress-stop:disabled { opacity: 0.6; }
.progress-track { height: 4px; margin-top: 0.55rem; border-radius: 2px; background: var(--toast-track); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 2px; background: var(--accent-text); transition: width 0.2s ease; }
/* How much there is isn't known yet: a segment slides along. */
.progress-bar.is-waiting { width: 30%; transition: none; animation: progress-waiting 1.2s ease-in-out infinite alternate; }
@keyframes progress-waiting { from { transform: translateX(0); } to { transform: translateX(233%); } }
@media (prefers-reduced-motion: reduce) {
  .progress-bar.is-waiting { animation: none; width: 100%; opacity: 0.4; }
}

/* --- narrow screens: one pane at a time ------------------------------------------------------------- */

/* A phone, upright or on its side (a touch screen up to 1000px wide and 500px tall, the width keeping a
   landscape tablet whose keyboard shortens the page out): (max-width: 700px), (max-width: 1000px) and
   (max-height: 500px) and (pointer: coarse). Everything wider is the opposite query, (min-width: 1001px),
   (min-width: 701px) and (min-height: 501px), (min-width: 701px) and (not (pointer: coarse)) — app.js
   PHONE, the iOS and Android shells' narrow. */

/* Apple's sizes on phones: 17px body text (rem-sized type and spacing grow with it),
   44px tall touch targets, list text at 17/15/13px, 16px side margins. */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  html, body { font-size: 17px; }
  :root { --title-size: 2.25rem; --text-xs: 0.765rem; --text-s: 0.885rem; } /* 13 and 15 px */
  .icon-button, .toast-close { width: 44px; height: 44px; }
  /* Completed's trash keeps its 44px target without heightening the pill's row: opening no longer drops the pill. */
  .completed-trash { margin-block: calc((2rem - 44px) / 2); }
  .button, .button.small { min-height: 44px; }
  input[type="text"], input[type="email"], input[type="password"], select { min-height: 44px; }
  .list-actions { padding-left: 1rem; padding-right: 1rem; }
  .menu-item, .settings-item { min-height: 44px; }
  /* A menu's items at the body size, Apple's 17 px, but for the Android app's Material 14 px label. */
  .menu-item { font-size: var(--text-m); }
  html.shell-android .menu-item { font-size: var(--text-s); }
  .settings-select { min-height: 2.25rem; }
  .note-list { padding: 0 0.5rem 1rem; }
  .note-row { padding: 0.8rem 0.5rem 0.75rem; }
  .reminder-row { padding: 0.6rem 0.25rem 0.6rem 0.35rem; }
  /* A 44px-tall tap area, in the Reminders pane's rows only: the calendar's chips stack 2px apart,
     where it would reach the next one's check. */
  .reminder-row .reminder-check { position: relative; }
  .reminder-row .reminder-check::after { content: ""; position: absolute; inset: -11px -6px; }
  .app, .app.hide-sidebar, .app.hide-list { grid-template-columns: minmax(0, 1fr); }
  .app .sidebar, .app .list-pane, .app .editor-pane { display: none; visibility: visible !important; }
  .app[data-view="sidebar"] .sidebar,
  .app[data-view="list"] .list-pane,
  .app[data-view="editor"] .editor-pane { display: flex; }
  .app[data-mode="reminders"], .app.hide-sidebar[data-mode="reminders"], .app.hide-list[data-mode="reminders"] { grid-template-columns: minmax(0, 1fr); }
  .app .reminders-pane { display: none; }
  .app[data-mode="reminders"][data-view="list"] .reminders-pane { display: flex; }
  .reminders-body { --board-pad: 0.75rem; }
  /* As the other panes' title on its own row under the buttons (0.6rem, 44px, a 0.15rem gap), large. */
  .reminders-body > .reminders-title { min-height: 0; padding: calc(0.75rem + 44px) 1rem 0.2rem; line-height: 1.15; }
  .list-body > .notes-title { min-height: 0; padding: calc(0.75rem + 44px) 1rem 0.4rem; line-height: 1.15; }
  /* On the web the buttons' row is the bar, as tall as the titles' room above them, which scroll
     under it; it takes the taps between its buttons, what is under it being out of sight. */
  html:not(.shell-bars) .list-body > .notes-title, html:not(.shell-bars) .reminders-body > .reminders-title { position: static; }
  html:not(.shell-bars) :is(.list-head, .reminders-head) { padding-bottom: 0.15rem; pointer-events: auto; }
  html:not(.shell-bars) .list-head { background: var(--list-bg); }
  html:not(.shell-bars) .reminders-head { background: var(--editor-bg); }
  html:not(.shell-bars) .list-body { scroll-padding-top: calc(0.75rem + 44px); }
  .reminder-row { --alarm-size: 44px; }
  /* 44px wide here: reaching 0.6rem into the card's 0.7rem padding, it leaves the droplet's target
     whole but 3px, still over the alarm. */
  .list-card-head .list-card-actions { margin-right: -0.6rem; margin-left: calc(1.65rem - 44px + 0.6rem); }
  .narrow-only { display: inline-flex; }
  .wide-only { display: none; }
  #editor .cm-content { padding: 0.75rem 1.1rem 0; }
  #editor .cm-note-stats { padding: 2rem 1.1rem 45vh; }
  .side-item { min-height: 44px; }
}

/* Touch screens: iOS zooms into any focused field set below 16px, so no field is smaller. */
@media (pointer: coarse) {
  input, select, textarea, .settings-select, #editor .find-panel input, #editor .cm-content { font-size: max(16px, 1em); }
}

/* --- calendar and settings (SPEC §5): in place of the note list and the editor ---------------------- */

.app:is([data-mode="calendar"], [data-mode="settings"], [data-mode="expenses"]) { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.app:is(.hide-sidebar, .hide-list):is([data-mode="calendar"], [data-mode="settings"], [data-mode="expenses"]) { grid-template-columns: 0 minmax(0, 1fr); }
.app.hide-list:is([data-mode="calendar"], [data-mode="settings"], [data-mode="expenses"]) .sidebar { visibility: hidden; }

/* --- Expenses (SPEC §5): the groups' column, the group open beside it --------------------------- */

.expenses-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--editor-bg); }
.expenses-head { padding-right: 1rem; }
.expenses-head #expenses-search-button { margin-left: auto; }
.expenses-head #new-group { color: var(--accent); }
.expenses-body { display: grid; grid-template-columns: minmax(14rem, 20rem) minmax(0, 1fr); flex: 1 1 0; min-height: 0; }
.expenses-groups { display: grid; align-content: start; gap: 0.15rem; padding: 0.5rem; overflow-y: auto; background: var(--list-bg); }
.group-row {
  display: grid; gap: 0.15rem; width: 100%; padding: 0.6rem 0.75rem; border: 0; border-radius: 0.6rem;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.group-row:hover { background: var(--hover); }
.group-row-open, .group-row-open:hover { background: var(--row-selected); color: var(--accent-container-text); }
.group-row-name { font-weight: 600; overflow-wrap: anywhere; }
.group-row-balance { font-size: var(--text-s); color: var(--muted); }
.group-row-open .group-row-balance { color: inherit; }
.expenses-group { display: grid; align-content: start; gap: 1.75rem; padding: 1rem 1.5rem 4rem; overflow-y: auto; }
.expenses-group > .list-empty { margin-top: 4rem; }
.group-head { display: flex; align-items: center; gap: 0.5rem; }
.group-head .group-back { order: -1; }
.group-name {
  flex: 1 1 auto; min-width: 0; margin: 0; padding: 0.1rem 0.25rem; border: 0; border-radius: 0.4rem;
  background: none; color: var(--text-strong); font: inherit; font-size: var(--title-size); font-weight: 700;
}
.group-name:focus { outline: 2px solid var(--focus-ring); background: var(--field-bg); }
.group-head-buttons { display: flex; gap: 0.25rem; }
.group-part { display: grid; gap: 0.6rem; }
.group-part-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.group-part-title { margin: 0; font-size: var(--text-l); }
.group-sub-title { margin: 0.5rem 0 0; font-size: var(--text-s); font-weight: 600; color: var(--muted); }
.group-totals, .group-note { margin: 0; color: var(--muted); font-size: var(--text-s); }
.group-add { display: inline-flex; align-items: center; gap: 0.35rem; }
.balance-list, .settle-list, .expense-list, .people-list { display: grid; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.balance-row, .settle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; }
.balance-amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.balance-owed .balance-amount { color: var(--accent); }
.balance-owing .balance-amount { color: var(--danger); }
.balance-settled .balance-amount { color: var(--muted); font-weight: 400; }
.settle-text { min-width: 0; overflow-wrap: anywhere; }
.expense-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; padding: 0.55rem 0.6rem;
  border: 0; border-radius: 0.6rem; background: var(--card-bg); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.expense-row:hover { background: var(--hover); }
.expense-main, .expense-amounts { display: grid; gap: 0.1rem; min-width: 0; }
.expense-amounts { justify-items: end; font-variant-numeric: tabular-nums; }
.expense-text { font-weight: 500; overflow-wrap: anywhere; }
.expense-by, .expense-worth { font-size: var(--text-s); color: var(--muted); }
.expense-dialog { max-width: 30rem; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 7rem; gap: 0.75rem; }
.field-hint { font-size: var(--text-s); font-weight: 400; color: var(--muted); }
.expense-worth-line { margin: -0.4rem 0 0; }
.expense-worth-line:empty { display: none; }
.expense-for { display: grid; gap: 0.35rem; margin: 0; padding: 0; border: 0; }
.expense-for legend { padding: 0; margin-bottom: 0.35rem; }
.expense-for-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.expense-weight { width: 4.5rem; }
.expense-more { justify-self: start; }
.person-row { display: flex; align-items: center; gap: 0.5rem; }
.person-row input { flex: 1 1 auto; min-width: 0; }
.person-you { padding: 0 0.75rem; color: var(--accent); font-weight: 600; }
.person-add { display: flex; gap: 0.5rem; }
.person-add input { flex: 1 1 auto; min-width: 0; }
.who-list { display: grid; gap: 0.5rem; }
.group-people { font: inherit; resize: vertical; }
/* On a shared link's page (shared.html): the group under the page's own title, People… at its right. */
.shared-group-view { display: grid; gap: 1.75rem; width: 100%; max-width: 52rem; padding: 0.5rem 1.5rem 2rem; box-sizing: border-box; }
.shared-group-view .group-head { justify-content: flex-end; }

/* In the GNOME app (gnome/) a native sidebar takes the place of the page's. */
@media (min-width: 1001px), (min-width: 701px) and (min-height: 501px), (min-width: 701px) and (not (pointer: coarse)) {
  .app.embedded { grid-template-columns: 0 var(--list-width) minmax(0, 1fr); }
  .app.embedded.hide-list { grid-template-columns: 0 0 minmax(0, 1fr); }
  .app.embedded:is([data-mode="reminders"], [data-mode="calendar"], [data-mode="settings"], [data-mode="expenses"]) { grid-template-columns: 0 minmax(0, 1fr); }
  .app.embedded .sidebar { visibility: hidden; }
}
.app.embedded :is(#toggle-sidebar, #reminders-toggle-sidebar, #calendar-toggle-sidebar, #settings-toggle-sidebar,
  #back-to-sidebar, #reminders-back, #calendar-back, #settings-back) { display: none; }
/* Its header bars lie over the page's top (--embed-top: their height, set by the app, with .embed-bars):
   one across the whole width, or one over the note list beside it (its head's buttons and title) and
   one over the editor. */
.app.embedded { padding-top: var(--embed-top, 0px); box-sizing: border-box; }
@media (min-width: 1001px), (min-width: 701px) and (min-height: 501px), (min-width: 701px) and (not (pointer: coarse)) {
  .embed-bars .app.embedded :is(.list-head, .notes-title, #toggle-list) { display: none; }
  .embed-bars .app.embedded .list-pane { padding-top: 0.5rem; }
}
/* Its header bar names Settings, Reminders and a list, whose name there opens the list's menu, so their
   heads would only repeat it. */
.app.embedded .settings-pane-head, .app.embedded .reminders-head, .app.embedded .reminders-title { display: none; }
.app.embedded .reminders-body { padding-top: 1.5rem; scroll-padding-top: 0; }

.calendar-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--editor-bg); }
/* New Event, only on a phone (narrow-only): floating at the bottom right, under the editor that covers the view. */
.calendar-new {
  position: absolute;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 30;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 4px 14px var(--shadow-soft), 0 1px 3px var(--shadow-soft);
  cursor: pointer;
}
@media (hover: hover) { .calendar-new:hover { background: var(--accent-hover); } }
.calendar-new:active { background-image: linear-gradient(var(--accent-pressed), var(--accent-pressed)); }
.calendar-new .icon { width: 1.5rem; height: 1.5rem; }
/* Material's top bar: bare icons, no fill, frame or shadow, side by side; a round of the hover colour
   only under the pointer. */
.calendar-head { gap: 0; padding-right: 0.5rem; }
.calendar-head .icon-button { width: 2.5rem; height: 2.5rem; border-radius: 50%; }
/* On the web's wide screen its 40 px targets reach into its padding, the header as tall as the other
   panes'; the sidebar button as theirs, so it doesn't move from one pane to the next. (A phone's and
   the apps' have their own sizes, below.) */
@media (min-width: 1001px), (min-width: 701px) and (min-height: 501px), (min-width: 701px) and (not (pointer: coarse)) {
  html:not(.shell-bars) .calendar-head .icon-button { margin-block: -0.25rem; }
  html:not(.shell-bars) .calendar-head #calendar-toggle-sidebar { width: 2rem; height: 2rem; margin-block: 0; }
}
/* The title (the month, in the week too) stays put, its text changing as another month is shown. */
.calendar-titles {
  flex: 1;
  min-width: 0;
  padding: 0 0.4rem;
  overflow: hidden;
}
.calendar-title { margin: 0; }
.calendar-nav { display: inline-flex; align-items: center; gap: 0; }
.calendar-nav :is(#calendar-prev, #calendar-next) .icon { width: 1.1rem; height: 1.1rem; }
/* Today is in the accent colour only while today is out of view (calendar.js). */
#calendar-today.away, #calendar-today.away:hover { color: var(--accent); }

.segmented { display: inline-flex; flex: none; padding: 2px; border-radius: 8px; background: var(--field-bg-quiet); }
.segmented button {
  min-height: 1.75rem;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 6px;
  background: var(--transparent);
  color: var(--text);
  font: inherit;
  font-size: var(--text-s);
}
.segmented button[aria-checked="true"] { background: var(--card-bg); color: var(--text-strong); font-weight: 600; box-shadow: 0 1px 3px var(--shadow-soft); }
/* The Calendar's view: one toggle showing the other view's icon (a week's columns in the month, a
   month's grid in the week); a click shows that view. */
.calendar-view { flex: none; }
.calendar-view[data-view="month"] .icon-month, .calendar-view[data-view="week"] .icon-week { display: none; }

.calendar-body { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
/* The month or the week, one page: each scrolls by itself, the browser's own scrolling. */
.calendar-grid {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}
.calendar-page {
  position: relative; /* the week's pointer (below) */
  flex: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 0.75rem 0.75rem;
}

/* month: every week in one column that scrolls, six of them high (--row, calendar.js); the ones not
   drawn are space (.month-space). No scrollbar, on the web as in the apps: its thumb would be a
   sliver of a column three centuries long. Its weeks are snap points (.snaps, all but WebKitGTK:
   calendar.js MONTH_SNAPS), a phone's too: a fling glides as far as its
   speed takes it, then rests on the one nearest where it would have stopped, the empty weeks of
   .month-stops in the space past those drawn stopping it too; scroll-padding-top puts them, and what gets the focus, under the weekday
   names. Split by the editor it scrolls freely, through the editor too. */
.month {
  position: relative; /* calendar.js measures the editor's place from here */
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  overflow-anchor: none; /* calendar.js draws more weeks in place of their space: nothing moves */
  scrollbar-width: none;
}
.month::-webkit-scrollbar { display: none; }
.month.snaps:not(.split) { scroll-snap-type: y mandatory; }
/* where it comes to rest: every week */
.month-week.stop, .month-stops > .stop { scroll-snap-align: start; }
.month-stops > * { height: var(--row); } /* a week */
.month-head { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--editor-bg); }
.month-weekday { padding: 0.3rem 0.5rem; font-size: var(--text-xs); font-weight: 600; color: var(--muted); text-align: right; }
.month-week {
  box-sizing: border-box;
  height: var(--row);
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  padding-bottom: 1px;
  background: var(--cal-line);
}
/* Nothing in the month scrolls sideways: a finger's sideways swipe there is nobody's (not the browser's Back). */
.calendar-grid .month { touch-action: pan-y pinch-zoom; }
/* The Android app's phone month: a finger's every move is calendar.js's (fling.js), no browser scroll. */
.calendar-grid .month.flings { touch-action: none; }
.month-cell { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 0.2rem 0.25rem 0.25rem; background: var(--editor-bg); }
.month-cell.weekend { background: var(--weekend-bg); }
.month-cell.today { background: var(--cal-today); }
/* the places before 1900's first day and after 2199's last, with no lines beside them (the shadows
   cover the grid's gaps either side) but the one at that first or last day, which marks the end */
.month-gap { background: var(--editor-bg); box-shadow: -1px 0 0 var(--editor-bg), 1px 0 0 var(--editor-bg); }
.month-cell + .month-gap { box-shadow: 1px 0 0 var(--editor-bg); }
.month-gap:has(+ .month-cell) { box-shadow: -1px 0 0 var(--editor-bg); }
.month-cell.drop-target, .week-allday-cell.drop-target { background: var(--accent-tint); }
/* the day under the mouse, and the days dragged over for a new all-day event */
.month-cell.cal-day-hover, .week-allday-cell.cal-day-hover { background-image: linear-gradient(var(--hover), var(--hover)); }
/* Lighter than an all-day chip, and outlined, so the chips already on those days still show. */
.month-cell.cal-day-selected, .week-allday-cell.cal-day-selected { background: var(--accent-tint); box-shadow: inset 0 0 0 1.5px var(--accent); }
.calendar-grid.is-selecting-days, .calendar-grid.is-selecting-days * { cursor: cell; }
.month-day { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 0.15rem; }
/* A month's first day names it in full, at the left, where one month runs into the next. */
.month-name { margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); font-weight: 700; color: var(--muted); }
.month-cell:not(.other-month) .month-name { color: var(--text-strong); }
/* Too narrow for September in full (or septembre): its short name, the ellipsis left for narrower still. */
.month-cell { container-type: inline-size; }
.month-name-short { display: none; }
@container (max-width: 6.5rem) {
  .month-name-long { display: none; }
  .month-name-short { display: inline; }
}
.month-num {
  min-width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: var(--text-s);
  font-variant-numeric: tabular-nums;
}
.month-cell.other-month .month-num { color: var(--other-month); }
.month-cell.today .month-num, .week-day.today .week-num { background: var(--accent); color: var(--accent-text); font-weight: 700; }
/* Cut at the foot ("n more"), not at the sides: a bar's piece reaches over the cell's padding, and its title on. */
.month-items { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; overflow-x: visible; overflow-y: clip; }
.cal-more {
  flex: none;
  align-self: flex-start;
  padding: 0 0.35rem;
  border: 0;
  border-radius: 5px;
  background: var(--transparent);
  color: var(--muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
}
@media (hover: hover) { .cal-more:hover { background: var(--hover); color: var(--text); } }
.cal-more:active { background: var(--pressed); color: var(--text); }
/* A day opened out from its "n more" (calendar.js expandDay(), SPEC §5): its cell grown over the days
   around it, in the cell's own colour, raised over the weeks but under the weekday names (z-index 2);
   every item of the day in it, scrolling inside past the month's height. calendar.js sets its box. */
.month-expand {
  --cell-bg: var(--editor-bg);
  position: absolute;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 0.2rem 0.25rem 0.35rem;
  overflow: hidden;
  border-radius: 8px;
  background: var(--cell-bg);
  /* the grid's line round it too: in the dark the shadow alone hardly parts it from the days under it */
  box-shadow: 0 0 0 1px var(--cal-line), 0 4px 12px var(--shadow-soft), 0 12px 32px var(--shadow);
  outline: none;
}
.month-expand.weekend { --cell-bg: var(--weekend-bg); }
.month-expand.today { --cell-bg: var(--cal-today); }
.month-expand.today .month-num { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.month-expand.other-month .month-num { color: var(--other-month); }
.month-expand:not(.other-month) .month-name { color: var(--text-strong); }
.month-expand .month-name-short { display: none; }
.month-expand .month-name-long { display: inline; }
.month-expand-items { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
/* Growing from the cell (M3's emphasized decelerate), and back into it (accelerate) as it closes. */
.month-expand.moving { transition: left 0.22s cubic-bezier(0.05, 0.7, 0.1, 1), top 0.22s cubic-bezier(0.05, 0.7, 0.1, 1), width 0.22s cubic-bezier(0.05, 0.7, 0.1, 1), height 0.22s cubic-bezier(0.05, 0.7, 0.1, 1); }
/* an item dragged out of it: gone from sight (and from what is under the pointer) until the drag ends */
.month-expand.left { visibility: hidden; pointer-events: none; }
.month-expand.closing { pointer-events: none; transition-duration: 0.16s; transition-timing-function: cubic-bezier(0.3, 0, 0.8, 0.15); }

/* an event or reminder: a chip (month, all-day row) or a block (week) */
.cal-chip { flex: none; display: flex; align-items: center; min-width: 0; border-radius: 5px; font-size: var(--text-xs); line-height: 1.35; color: var(--text); }
.cal-chip[hidden] { display: none; }
@media (hover: hover) { .cal-chip:hover { background: var(--hover); } }
.cal-chip.all-day { background: var(--accent-tint-strong); color: var(--text-strong); }
/* An event of a connected calendar with a colour (SPEC §5); the others keep the accent. */
.cal-event.has-color { --event-tint: color-mix(in srgb, var(--event) var(--event-tint-mix), var(--transparent)); }
.cal-chip.all-day.has-color { background: var(--event-tint); }
.cal-block.has-color { --block-ink: var(--event); }
/* An event shown as free (SPEC §3.7): a timed chip's dot hollow. */
.cal-chip.cal-event.free:not(.all-day):not(.bar):not(.selected) .cal-open::before {
  background: var(--transparent);
  box-shadow: inset 0 0 0 1.5px var(--event, var(--accent));
}
.cal-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.05rem var(--open-pad-x, 0.35rem);
  border: 0;
  border-radius: inherit;
  background: var(--transparent);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cal-open:active { background-image: linear-gradient(var(--pressed), var(--pressed)); } /* pressed, as every button */
.cal-run { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 0.3rem; }
.cal-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; } /* semibold in every chip, bar and block, short or long */
/* A month chip under its row's bars (calendar.js laneChips()): its title on up to two lines, the time
   in the text's flow before it, so the second line starts under the time at the chip's left edge
   rather than in a column beside it; the dot and a reminder's check on the first line. */
.cal-chip.wraps { align-items: flex-start; }
.cal-chip.wraps .cal-run { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.cal-chip.wraps .cal-time { margin-right: 0.3rem; }
.cal-chip.wraps .cal-label { display: inline; white-space: normal; }
.cal-chip.wraps.cal-event:not(.all-day):not(.bar) .cal-open::before { align-self: flex-start; margin-top: calc((1lh - 0.45rem) / 2); }
.cal-chip.wraps .cal-check { margin-top: calc((1lh - 0.95rem) / 2 + 0.05rem); }
/* A free lane's place in a day (calendar.js rowLanes()), as high as a chip. */
.cal-chip.cal-space { visibility: hidden; pointer-events: none; }
/* An event over several days (SPEC §5): a bar, a piece of it in each day's cell, in the same lane in
   each (calendar.js rowLanes()), joined over the cells' padding and the line between them, round only
   where the event starts and ends. The row's first piece draws the title across the row's days (its
   cell's width, 100cqw, times its days), over the pieces after it, which keep theirs out of sight; a
   click there goes through the title to the piece under it, that day's. Each cell is painted over
   the ones after it in its row (z-index; the week's from calendar.js, its days being many), the title on top. */
.month-cell, .week-allday-cell { --cell-pad-x: 0.25rem; }
.week-allday-cell { --cell-pad-x: 2px; container-type: inline-size; }
.month-week, .week-allday { isolation: isolate; }
:is(.month-week, .week-allday) > :nth-child(1) { z-index: 8; }
:is(.month-week, .week-allday) > :nth-child(2) { z-index: 7; }
:is(.month-week, .week-allday) > :nth-child(3) { z-index: 6; }
:is(.month-week, .week-allday) > :nth-child(4) { z-index: 5; }
:is(.month-week, .week-allday) > :nth-child(5) { z-index: 4; }
:is(.month-week, .week-allday) > :nth-child(6) { z-index: 3; }
:is(.month-week, .week-allday) > :nth-child(7) { z-index: 2; }
:is(.month-week, .week-allday) > :nth-child(8) { z-index: 1; }
/* Opaque, as a week's block (its colour's tint over its day's own background): the line between two days
   doesn't show through where a piece reaches over it. */
.month-cell, .week-allday-cell { --cell-bg: var(--editor-bg); }
:is(.month-cell, .week-allday-cell).weekend { --cell-bg: var(--weekend-bg); }
.month-cell.today { --cell-bg: var(--cal-today); }
.cal-chip.bar { --bar-ink: var(--accent); background: color-mix(in srgb, var(--bar-ink) var(--event-tint-mix), var(--cell-bg)); color: var(--text-strong); }
.cal-chip.bar.has-color { --bar-ink: var(--event); }
.cal-chip.bar.pulse { --event-pulse: color-mix(in srgb, var(--bar-ink) var(--event-pulse-mix), var(--cell-bg)); }
.cal-chip.bar.joins-prev { margin-left: calc(-1 * var(--cell-pad-x)); }
.cal-chip.bar.joins-next { margin-right: calc(-1 * var(--cell-pad-x) - 1px); }
.cal-chip.bar:not(.bar-start) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-chip.bar:not(.bar-end) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-chip.bar:not(.bar-head) .cal-run { visibility: hidden; }
/* The week's bar keeps its title in sight as the days scroll sideways: the title starts where the days
   in sight do, up to its last day's start. The week's sideways scroll drives it (a scroll timeline): from
   when the bar's first day (its place, --at) reaches the left edge until its last day does, it moves on
   by as much as the days, in the same frame, the browser's compositor moving both, so it never lags
   behind them. It fades out at the bar's end rather than taking an ellipsis, which would stay behind as
   it moves. Where scroll timelines (and their ranges) are missing, calendar.js sets how far the days have
   scrolled (--scrolled) at each scroll event, and the title is pushed along by that, a frame late; it
   fades out at the bar's end there too. */
.week-allday .cal-chip.bar-head:not(.cal-ghost) .cal-run {
  overflow: clip;
  -webkit-mask-image: linear-gradient(to left, transparent, #000 0.75rem);
  mask-image: linear-gradient(to left, transparent, #000 0.75rem);
}
.week-allday .cal-chip.bar-head:not(.cal-ghost) .cal-label { text-overflow: clip; }
@supports (animation-timeline: scroll()) and (animation-range: 0px 1px) {
  .week { scroll-timeline: --week-x x; }
  .week-allday .cal-chip.bar-head:not(.cal-ghost) .cal-run > * {
    animation: bar-title linear both;
    animation-timeline: --week-x;
    animation-range: calc(var(--at, 0) * var(--day, 0px)) calc((var(--at, 0) + var(--span) - 1) * var(--day, 0px));
  }
}
@keyframes bar-title { to { translate: calc((var(--span) - 1) * var(--day, 0px)) 0; } }
@supports not ((animation-timeline: scroll()) and (animation-range: 0px 1px)) {
  .week-allday .cal-chip.bar-head:not(.cal-ghost) .cal-run {
    padding-left: clamp(0px, var(--scrolled, 0px) - var(--at, 0) * var(--day, 0px), (var(--span) - 1) * var(--day, 0px));
  }
}
.cal-chip.bar-head .cal-run {
  flex: none;
  width: calc(var(--span) * (100cqw + 2 * var(--cell-pad-x) + 1px) - 1px - 2 * var(--cell-pad-x) - 2 * var(--open-pad-x, 0.35rem));
  pointer-events: none;
}
/* Picked up, a piece alone, its title in it. */
.cal-ghost.cal-chip.bar { margin: 0; border-radius: 5px; }
.cal-ghost.cal-chip.bar .cal-run { flex: 1; width: auto; visibility: visible; }
.cal-time { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-chip.cal-event:not(.all-day):not(.bar) .cal-open::before {
  content: "";
  flex: none;
  align-self: center;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--event, var(--accent));
}
.cal-check { width: 0.95rem; height: 0.95rem; margin: 0 0 0 0.25rem; border-width: 1.4px; }
.cal-check .icon { width: 0.7rem; height: 0.7rem; }
.is-done .cal-label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.cal-chip.draft .cal-label, .cal-block.draft .cal-label { font-style: italic; }
/* The selected one in the accent, whatever its calendar's colour: .all-day to outrank .all-day.has-color. */
.cal-chip.selected, .cal-chip.all-day.selected, .cal-chip.bar.selected, .cal-block.selected { background: var(--accent); color: var(--accent-text); }
.cal-chip.selected .cal-time, .cal-block.selected .cal-time, .cal-block.selected .cal-where, .selected.is-done .cal-label { color: inherit; }
.cal-chip.selected.cal-event .cal-open::before { background: var(--accent-text); }
/* A new event not saved yet stays muted, selected too: its "New Event" a placeholder rather than a title.
   Not a calendar file's proposals (drafts too, .proposed): their titles are the file's, the one open in the accent. */
.cal-chip.draft:not(.proposed).selected, .cal-chip.all-day.draft:not(.proposed).selected { background: var(--accent-tint-strong); color: var(--text); }
.cal-chip.all-day.has-color.draft:not(.proposed).selected,
.cal-chip.cal-event.has-color.draft:not(.proposed).selected:not(.all-day):not(.bar) { background: var(--event-tint); }
.cal-chip.bar.draft:not(.proposed).selected { background: color-mix(in srgb, var(--bar-ink) var(--event-tint-mix), var(--cell-bg)); color: var(--text); }
.cal-block.draft:not(.proposed).selected { background: color-mix(in srgb, var(--block-ink) var(--event-tint-mix), var(--col-bg, var(--editor-bg))); color: var(--text); }
.cal-chip.draft:not(.proposed) .cal-label, .cal-block.draft:not(.proposed) .cal-label,
.cal-chip.draft:not(.proposed).selected .cal-time, .cal-block.draft:not(.proposed).selected .cal-time { color: var(--muted); }
.cal-chip.draft:not(.proposed).selected.cal-event .cal-open::before { background: var(--event, var(--accent)); }
.selected .cal-check { border-color: var(--accent-text); }
.cal-chip.dragging, .cal-block.dragging { opacity: 0.6; pointer-events: none; }
.cal-block.dragging { z-index: 4; opacity: 0.85; box-shadow: 0 6px 18px var(--shadow); }
.cal-block.moving-away { visibility: hidden; } /* the dragged event's other pieces, until the drop redraws it */
/* A new event just saved, two beats (calendar.js's PULSE_MS) after the flash of its selection going:
   three in all. A phone's month's dot swells instead. */
.cal-event.pulse {
  --event-pulse: color-mix(in srgb, var(--event, var(--accent)) var(--event-pulse-mix), var(--transparent));
  animation: event-pulse 0.8s ease-in-out 2;
}
/* A timed one over its column's fill, as at rest: the hour lines stay under it as it pulses. */
.cal-block.pulse {
  --event-pulse: color-mix(in srgb, var(--event, var(--accent)) var(--event-pulse-mix), var(--col-bg, var(--editor-bg)));
}
.month-dot.pulse { animation-name: dot-pulse; }
@keyframes event-pulse { 50% { background-color: var(--event-pulse); } }
@keyframes dot-pulse { 50% { transform: scale(1.8); } }
@media (prefers-reduced-motion: reduce) {
  .cal-event.pulse { animation: event-pulse 1.6s ease-in-out 1; }
  .month-dot.pulse { animation: none; }
}
.cal-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: var(--w);
  transform: translate(var(--x), var(--y));
  background: var(--card-bg);
  box-shadow: 0 6px 18px var(--shadow);
  pointer-events: none;
}
.calendar-grid.is-dragging, .calendar-grid.is-dragging * { cursor: grabbing; }

/* week: one scroller both ways (calendar.js renderWeek()), the browser's own scrolling, sideways
   resting on a day's edge (.snaps, below). Its days run side by side, as wide as
   the view shares out (--day), those not drawn being space before them (--from days) and after; the day
   names and the all-day row stay on top, the hours and the all-day row's name on the left (.week-side).
   No scrollbar, as the month has none: its thumb would be a sliver of two years of days. */
.week {
  --gutter: 3.75rem;
  --width: calc(var(--gutter) + var(--total, 0) * var(--day, 0px));
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain; /* not the browser's Back at its ends, nor the page under it */
  overflow-anchor: none; /* calendar.js draws more days in place of their space: nothing moves */
  scrollbar-width: none;
}
.week::-webkit-scrollbar { display: none; }
/* Its days are snap points (.snaps, all but WebKitGTK: calendar.js MONTH_SNAPS), as the month's weeks:
   a fling glides as far as its speed takes it, then rests on the day's edge nearest where it would have
   stopped, beside the hours (scroll-padding-left, calendar.js); .week-stops holds one for every day, the
   ones not drawn too, empty and under the band on top (a browser snaps only to what is in sight up and
   down too). Up and down the hours rest wherever they stop. */
.week.snaps { scroll-snap-type: x mandatory; }
/* The Android app's phone week: a finger's sideways moves are calendar.js's (fling.js), as its month's
   are; up and down the browser's. */
.calendar-grid .week.flings { touch-action: pan-y pinch-zoom; }
/* The day's start (`day_start`, .held, calendar.js): up and down too it snaps, to .week-day-start, an
   area from that hour to the day's end, but only once scrolled above that hour (.above, calendar.js
   weekScrolled()), so the hours above spring back to it and nothing pulls the view back up from
   below it, the day's end in sight too (scroll-padding-top, calendar.js, puts it under the all-day row). */
.week.snaps.held.above { scroll-snap-type: both mandatory; }
.week.flings.held.above { scroll-snap-type: y mandatory; }
.week-day-start { position: absolute; left: 0; right: 0; bottom: 0; pointer-events: none; scroll-snap-align: start none; }
.week-stops { position: absolute; inset: 0 auto 0 var(--gutter); pointer-events: none; }
.week-stops > * {
  position: absolute;
  inset: 0 auto 0 calc(var(--i) * var(--day, 0px));
  width: var(--day, 0px);
  scroll-snap-align: none start;
}
.week-top { position: sticky; top: 0; z-index: 6; width: var(--width); background: var(--editor-bg); }
.week-band, .week-grid { display: flex; width: var(--width); }
.week-days {
  flex: none;
  display: flex;
  box-sizing: border-box;
  width: calc(var(--total, 0) * var(--day, 0px));
  padding-left: calc(var(--from, 0) * var(--day, 0px));
}
.week-days > * { flex: none; width: var(--day, 0px); }
/* Over the days scrolled under it, opaque. */
.week-side { position: sticky; left: 0; z-index: 4; flex: none; width: var(--gutter); background: var(--editor-bg); }
/* A finger's swipe begun on the hours (or the corner over them) scrolls them, never the days sideways. */
.week-side { touch-action: pan-y pinch-zoom; }
.week-day { display: flex; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.3rem 0; font-size: var(--text-xs); color: var(--muted); }
.week-num {
  min-width: 1.9rem;
  height: 1.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: var(--text-l);
  font-weight: 600;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
/* A day's reminders sit here too: the row (in the sticky head) is three lines at most, a fuller day's
   last its "n more" (calendar.js weekCells(), SPEC §5), rather than hide the hours. It never scrolls. */
.week-allday { flex: none; width: calc(var(--total, 0) * var(--day, 0px)); overflow: hidden; }
/* Its cells a line apart (the line before each, as each column's), their row's lines above and below. */
.week-allday > .week-days { width: 100%; padding-top: 1px; padding-bottom: 1px; background: var(--cal-line); isolation: isolate; /* its days' stacking */ }
/* "n more" a chip's line tall, its lanes level with the days beside it. */
.week-allday-cell .cal-more { line-height: 1.35; padding-block: 0.05rem; }
/* The week's day opened out: from its all-day cell, in the head (over the hours, under nothing), headed by its day's name. */
.week-expand { z-index: 10; }
/* Its cut at the hours' edge (calendar.js clipWeekExpand()) moving with it as it opens and closes. */
.week-expand.moving { transition-property: left, top, width, height, clip-path; }
.week-expand > .week-day { justify-content: flex-start; padding: 0 0.15rem 0.2rem; }
.week-allday-cell { min-width: 0; min-height: 1.9rem; display: flex; flex-direction: column; gap: 2px; padding: 2px; background: var(--editor-bg); }
.week-days > .week-allday-cell { width: calc(var(--day, 1px) - 1px); margin-left: 1px; }
.week-allday-cell.weekend { background: var(--weekend-bg); }
.week-grid { position: relative; height: var(--day-height); }
.week-hours { -webkit-user-select: none; user-select: none; }
.week-hour { position: relative; height: 48px; }
/* An hour's name on its line, its top half above it. Once that half goes under the day names and the all-day
   row (their height, --week-top, calendar.js), it moves down with their edge, whole, until it is under its
   line and half its height on, then goes under (its box, from half a line above the line to a line and a
   half below it, is as far as a sticky name goes). */
.week-hour > span { position: absolute; top: -0.5lh; right: 0.45rem; height: 2lh; font-size: var(--text-xs); line-height: 1.25; color: var(--muted); font-variant-numeric: tabular-nums; }
.week-hour > span > span { position: sticky; top: var(--week-top, 0px); display: block; }
.week-col {
  position: relative;
  min-width: 0;
  /* The night's shade before 07:00 and from 22:00, and a line at each hour from 07:00 to 22:00 (none
     in the night, SPEC §5), placed from the part's first minute (--part-top, calendar.js: the hours
     split round the editor). The lines' layer is 15 hours and a pixel tall, so 22:00 has its line.
     Noon's line is harder, a layer of its own over the hours'. */
  background-image:
    linear-gradient(var(--cal-noon), var(--cal-noon)),
    linear-gradient(to bottom, var(--night-shade) calc(7 * 48px - var(--part-top, 0px)), var(--transparent) 0,
      var(--transparent) calc(22 * 48px - var(--part-top, 0px)), var(--night-shade) 0),
    repeating-linear-gradient(to bottom, var(--cal-line) 0, var(--cal-line) 1px, var(--transparent) 1px, var(--transparent) 48px);
  background-size: 100% 1px, 100% 100%, 100% calc(15 * 48px + 1px);
  background-position: 0 calc(12 * 48px - var(--part-top, 0px)), 0 0, 0 calc(7 * 48px - var(--part-top, 0px));
  background-repeat: no-repeat;
  box-shadow: inset 1px 0 0 var(--cal-line);
  --col-bg: var(--editor-bg);
}
.week-col.weekend { background-color: var(--weekend-bg); --col-bg: var(--weekend-bg); }
/* The hours over the editor: the hour it splits at has its line above the editor too (calendar.js part()). */
.line-below > .week-cols > .week-col:not(.today) { box-shadow: inset 1px 0 0 var(--cal-line), inset 0 -1px 0 var(--cal-line); }
.line-below-noon > .week-cols > .week-col:not(.today) { box-shadow: inset 1px 0 0 var(--cal-line), inset 0 -1px 0 var(--cal-noon); }
/* Today's column is in a grey a shade deeper than the weekend's with no hour lines, the night's shade only; its
   events keep the page's own background under their tint, so they stand out from it. */
.week-col.today {
  background-color: var(--cal-today);
  background-image: linear-gradient(to bottom, var(--night-shade) calc(7 * 48px - var(--part-top, 0px)), var(--transparent) 0,
    var(--transparent) calc(22 * 48px - var(--part-top, 0px)), var(--night-shade) 0);
  background-size: 100% 100%;
  background-position: 0 0;
  --col-bg: var(--editor-bg);
}
/* The tint over the column's own fill, not see-through: the hour lines and the night's shade stay under the events. */
.cal-block {
  --block-ink: var(--accent);
  position: absolute;
  top: var(--top);
  left: calc(var(--col) * 100% / var(--cols) + 2px);
  z-index: 1;
  width: calc(100% / var(--cols) - 4px);
  height: calc(var(--height) - 1px);
  /* A short event's (15 minutes: 12 px) still as tall as its title's line, over the next one's top if need be. */
  min-height: calc(1lh + 2px);
  display: flex;
  align-items: flex-start;
  overflow: hidden;
  border-radius: 6px;
  background: color-mix(in srgb, var(--block-ink) var(--event-tint-mix), var(--col-bg, var(--editor-bg)));
  color: var(--text-strong);
  font-size: var(--text-xs);
  line-height: 1.3;
}
.cal-block .cal-open { height: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: 0.15rem 0.35rem; }
/* Forced colours drop the fill: each block outlined in the system's colours (no custom property can
   stand in for them), so two events side by side are still told apart. */
@media (forced-colors: active) {
  .cal-block { outline: 1px solid CanvasText; outline-offset: -1px; }
  .cal-block.selected { outline-color: Highlight; }
}
.cal-block.short .cal-open { padding-top: 0; padding-bottom: 0; }
/* The title, and its start on the right of its first line. */
.cal-line { display: flex; align-items: baseline; gap: 0.3rem; min-width: 0; }
.cal-line .cal-label { flex: 1 1 auto; }
.cal-block .cal-time { order: 1; margin-left: auto; white-space: nowrap; }
/* A block tall enough to wrap its title: the time floated right on the first line (first in the DOM),
   the lines after it the block's whole width rather than a column beside the time. */
.cal-block:not(.short) .cal-line { display: block; }
.cal-block:not(.short) .cal-time { float: right; margin-left: 0.3rem; }
.cal-block:not(.short) .cal-label { display: inline; white-space: normal; overflow-wrap: anywhere; }
.cal-block .cal-where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.cal-resize { position: absolute; right: 0; bottom: 0; left: 0; height: 6px; cursor: ns-resize; }
/* the half hour under the mouse, and the hours dragged over for a new event */
.cal-slot {
  position: absolute;
  top: var(--top);
  right: 2px;
  left: 2px;
  z-index: 2;
  height: calc(var(--height) - 1px);
  overflow: hidden;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  font-size: var(--text-xs);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}
.cal-hover { background: var(--hover); color: var(--muted); }
.cal-selection { background: var(--accent-tint-strong); box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--text-strong); font-weight: 600; }
.calendar-grid.is-selecting, .calendar-grid.is-selecting * { cursor: ns-resize; }
.now-line { position: absolute; top: var(--top); right: 0; left: 0; z-index: 3; height: 2px; background: var(--danger); pointer-events: none; }
.now-line::before { content: ""; position: absolute; top: -3px; left: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* the editor: a band across the view, under the week (month) or the hour (week) of what it edits */
.cal-panel-slot { display: contents; } /* the editor's row and cell in the grid's ARIA, not in its layout */
/* In the week, a band as wide as its days, the editor in it across the view, beside the hours, staying
   there as the days scroll under it (a phone's covers the view instead). */
.week-panel-slot { display: block; width: var(--width); }
/* What the editor has open, scrolled out of sight sideways: a round button at that edge of the days,
   just above the editor, pointing to it (calendar.js pointToOpen()); a phone's editor covers it. */
.week-pointer {
  position: absolute;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
}
.week-pointer[hidden] { display: none; }
.week-pointer .icon { width: 1.4rem; height: 1.4rem; }
.week-pointer[data-side="left"] .icon { transform: rotate(180deg); }
/* Each day's count of items out of sight above the hours in sight and below, by calendar (calendar.js
   markHidden()): small bubbles side by side, each in its calendar's colour and pointing that way, under
   the all-day row and over the bottom of the view, in bands that take no room (one sticking under
   .week-top, one to the view's bottom), moving with their days sideways and kept clear of the
   hours on the left while their day is cut by them. Both under the editor (z-index 5), unlike the head. */
.week-hidden-band { position: absolute; left: 0; height: 1.9rem; pointer-events: none; }
.week-above { position: sticky; top: var(--week-top, 0px); z-index: 4; width: var(--width); height: 0; }
.week-above > .week-hidden-band { top: 0; }
.week-bottom { position: sticky; bottom: 0; z-index: 4; width: var(--width); height: 0; }
.week-bottom > .week-hidden-band { bottom: 0; }
.week-hidden-side { flex: none; width: var(--gutter); }
.week-hidden-cell { display: flex; align-items: center; justify-content: center; min-width: 0; }
.week-hidden-group {
  position: sticky;
  left: calc(var(--gutter) + 6px);
  right: 6px;
  display: flex;
  /* More calendars than fit side by side (a phone's narrow days): on a second row, inside the day. */
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100% - 12px);
  gap: 3px;
}
.week-bottom .week-hidden-group { flex-wrap: wrap-reverse; } /* the bottom's, upwards */
.week-hidden {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.2rem;
  padding: 0 0.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  box-shadow: 0 1px 4px var(--shadow);
  cursor: pointer;
  pointer-events: auto;
}
/* A connected calendar's in its colour (Diffa's own: the accent), its count white on a dark one and
   near black on a light one (calendar.js inkOn()). */
.week-hidden.has-color { background: var(--event); }
.week-hidden.has-color.ink-light { color: var(--ink-on-dark); }
.week-hidden.has-color.ink-dark { color: var(--ink-on-light); }
/* Its point, towards the items it counts. */
.week-hidden::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 0.6rem;
  height: 0.35rem;
  translate: -50% 0;
  background: inherit;
}
.week-hidden.above { margin-top: 0.2rem; }
.week-hidden.above::before { bottom: calc(100% - 1px); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.week-hidden.below { margin-bottom: 0.2rem; }
.week-hidden.below::before { top: calc(100% - 1px); clip-path: polygon(0 0, 100% 0, 50% 100%); }
/* A phone's: clear of New Event floating at the bottom right, moved left within its day when under it. */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  .week-bottom .week-hidden-group { right: calc(1rem + 56px + 6px); }
  /* The iOS app's week runs on under its bottom bar (--shell-bottom): those below kept above it. */
  .shell-bars .week-bottom > .week-hidden-band { bottom: var(--shell-bottom, 0px); }
}
/* Not while dragging or selecting hours: what they count moves. */
.calendar-grid:is(.is-dragging, .is-selecting) .week-hidden-band { visibility: hidden; }
@media (min-width: 1001px), (min-width: 701px) and (min-height: 501px), (min-width: 701px) and (not (pointer: coarse)) {
  /* Over the bubbles stuck under the head and to the view's bottom (.week-above, .week-bottom), under the head it scrolls beneath. */
  .week-panel-slot .calendar-panel {
    position: sticky;
    left: var(--gutter);
    z-index: 5;
    box-sizing: border-box;
    width: calc(var(--sight, 100%) - var(--gutter));
    margin-left: var(--gutter);
  }
}
/* Inside the grid, which can't be selected (a drag over days isn't a text selection): its text can be. */
.calendar-panel { flex: none; margin: 0.5rem 0; padding: 0 1rem 1.1rem; border-radius: var(--radius); background: var(--list-bg); -webkit-user-select: text; user-select: text; }
.cal-panel-head { display: flex; align-items: center; justify-content: space-between; min-height: 2.9rem; }
/* an event's editor: no header and no cross, Cancel and Save at the bottom */
.calendar-panel > .cal-panel-title:first-child { display: flex; align-items: flex-start; gap: 0.5rem; padding-top: 1rem; }
.calendar-panel > .cal-panel-title:first-child > .cal-title-input { flex: 1; min-width: 0; }
/* A read-only event's Close: a phone's alone, in place of its cross (below). */
.cal-panel-foot.cal-close-foot { display: none; }
.cal-panel-kind, .cal-section-title { margin: 0; font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.cal-panel-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); align-items: start; gap: 0.65rem 2rem; }
.cal-panel-col { min-width: 0; display: grid; align-content: start; gap: 0.65rem; }
.cal-panel-col > .cal-section:first-child { margin-top: 0; }
/* An event's title, across the columns above them: outside their grid, whose auto-fit would otherwise
   keep an empty column for it on a wide band. */
.cal-panel-title { min-width: 0; margin-bottom: 0.65rem; }
.calendar-panel .cal-title-input {
  display: block;
  width: 100%;
  padding: 0.15rem 0;
  border: 0;
  background: var(--transparent);
  font: inherit;
  font-size: var(--text-l);
  font-weight: 650;
  color: var(--text-strong);
  outline: none;
}
/* An event's title on as many lines as it takes (its height calendar.js fitTitle()'s). */
.calendar-panel textarea.cal-title-input { min-height: 0; overflow: hidden; resize: none; overflow-wrap: anywhere; }
.cal-title-input:focus { box-shadow: none; }
.cal-title-input::placeholder { color: var(--placeholder); }
.cal-when { margin: -0.45rem 0 0.15rem; font-size: var(--text-s); color: var(--muted); }
.cal-response { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: var(--text-s); }
.cal-response-label { color: var(--muted); }
.cal-switch { display: inline-flex; align-items: center; gap: 0.5rem; justify-self: start; font-size: var(--text-s); }
.cal-switch input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); }
.cal-field { display: grid; grid-template-columns: 5.25rem minmax(0, 1fr); align-items: center; gap: 0.5rem; font-size: var(--text-s); }
.cal-field-label { color: var(--muted); }
/* The event's calendar (SPEC §5): a radio button per calendar, its name highlighted in its colour, wrapping as
   the room runs out; the row's label beside the first line. */
.cal-calendar-field { align-items: start; }
.cal-calendar-field > .cal-field-label { padding-top: 0.35rem; }
.cal-radios { display: flex; flex-wrap: wrap; gap: 0.15rem 0.9rem; min-width: 0; }
.cal-radio { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.1rem; min-width: 0; cursor: pointer; }
.cal-radio input { flex: none; width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); }
.cal-radio-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.1rem 0.45rem;
  border-radius: 5px;
  background: color-mix(in srgb, var(--event, var(--accent)) var(--event-tint-mix), var(--transparent));
  color: var(--text-strong);
}
.calendar-panel .cal-input, .calendar-panel .cal-select, .cal-notes {
  width: 100%;
  min-height: 2.1rem;
  padding: 0 0.6rem;
  border: 0;
  border-radius: 7px;
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-s);
  /* WebKit (the GNOME and iOS apps) draws its own bezel otherwise: every field the same plain white */
  -webkit-appearance: none;
  appearance: none;
}
/* the menu's chevron, the native one gone with its bezel */
.calendar-panel .cal-select {
  padding-right: 1.6rem;
  background-image: linear-gradient(45deg, var(--transparent) 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, var(--transparent) 50%);
  background-position: calc(100% - 0.95rem) 55%, calc(100% - 0.65rem) 55%;
  background-size: 0.3rem 0.3rem;
  background-repeat: no-repeat;
}
/* Starts and Ends of a timed event: its day, then [HH]:[MM] */
.cal-when-row { display: flex; gap: 0.4rem; min-width: 0; }
.cal-when-row :is(.cal-input, .date-input) { flex: 1; min-width: 0; }
.cal-when-row .cal-select { flex: none; width: auto; } /* End Repeat's menu, its day beside it */
.cal-time-input {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 2.1rem;
  padding: 0 0.45rem;
  border-radius: 7px;
  background: var(--field-bg);
  color: var(--text);
  font-size: var(--text-s);
  font-variant-numeric: tabular-nums;
  cursor: text;
}
.cal-time-input:focus-within { box-shadow: 0 0 0 3px var(--focus-ring); }
.cal-time-input .cal-time-part {
  width: 2.1ch;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: center;
  outline: none;
}
.cal-time-input .cal-time-part:focus { box-shadow: none; }
.cal-time-input .cal-time-ampm { width: 2.8ch; margin-left: 0.3ch; } /* AM/PM after the minutes, on a 12-hour clock */
.cal-time-part::selection { background: var(--focus-ring); }
.cal-time-colon { padding: 0 1px; color: var(--muted); }
/* On a touch screen: the system's time picker, unseen over the parts, opened by a tap anywhere on them */
.cal-time-input .cal-time-wheel {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px; /* an iPhone zooms into a smaller field it focuses */
  -webkit-appearance: none;
  appearance: none;
}
/* A day in the date_format chosen (clock.js dateInput): the input's own text hidden, the day written over it */
.date-input { position: relative; display: block; min-width: 0; }
.date-input input, .calendar-panel .date-input .cal-input { color: transparent; } /* the panel's own colour beaten */
.date-input input::-webkit-datetime-edit { opacity: 0; } /* Chrome and Safari: its parts, and the highlight of the one focused */
/* Reached or typed into from the keyboard (clock.js dateInput: not :focus-visible, which a click matches in
   Chromium and Tab never in WebKit): its own parts again, in the system's order, so what is typed shows where it goes. */
.date-input.typing input, .calendar-panel .date-input.typing .cal-input { color: var(--text); }
.date-input.typing input::-webkit-datetime-edit { opacity: 1; }
.date-input.typing .date-input-shown { visibility: hidden; }
.date-input-shown {
  position: absolute;
  inset: 0 2rem 0 0; /* clear of the picker's button */
  display: flex;
  align-items: center;
  padding-left: 0.8rem;
  overflow: hidden;
  color: var(--text);
  font-weight: 400;
  white-space: nowrap;
  pointer-events: none; /* a click is the input's */
}
.calendar-panel .date-input-shown { padding-left: 0.6rem; font-size: var(--text-s); }
.date-input-shown.empty { color: var(--muted); } /* the format's pattern, as a placeholder */
.calendar-panel .cal-status { width: auto; }
.cal-notes { min-height: 4.5rem; padding: 0.5rem 0.6rem; line-height: 1.45; resize: none; overflow: hidden; }
.cal-notes:focus, .cal-select:focus { box-shadow: 0 0 0 3px var(--focus-ring); outline: none; }
/* An event's location and notes, two fields glued into one block: square where they meet, a hairline apart. */
.cal-location-notes { display: grid; gap: 1px; }
.calendar-panel .cal-location-notes .cal-location { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.cal-location-notes .cal-notes { border-top-left-radius: 0; border-top-right-radius: 0; }
.cal-location-notes :focus { position: relative; z-index: 1; } /* its ring over the other field */
/* The location's button at its right end, over it focused too: the video call link's camera
   (`video_link`) while it is empty, Copy Location once it holds anything. */
.cal-location-box { position: relative; }
.calendar-panel .cal-location-box .cal-location { padding-right: 2.6rem; }
/* Outranking .cal-location-notes :focus, so the button focused (Tab) stays where it is. */
.cal-location-box .cal-location-button { position: absolute; top: 50%; right: 0.3rem; z-index: 2; transform: translateY(-50%); }
.cal-section { display: grid; gap: 0.4rem; margin-top: 0.7rem; }
.cal-alerts, .cal-invitees { display: grid; gap: 0.3rem; margin: 0; padding: 0; list-style: none; }
.cal-alert { display: flex; align-items: center; gap: 0.45rem; font-size: var(--text-s); }
.cal-alert > span:not(.icon) { flex: 1; }
.cal-alert > .icon { width: 1rem; height: 1rem; color: var(--accent); }
.cal-invitee { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0.3rem; }
.cal-invitee-add { grid-template-columns: minmax(0, 1fr) auto; }
/* the name a connected calendar gave, above the address */
.cal-invitee-name { grid-column: 1 / -1; margin-bottom: -0.15rem; font-size: var(--text-s); color: var(--muted); overflow-wrap: anywhere; }
.cal-invitee .cal-status[data-status="accepted"] { color: var(--success); }
.cal-invitee .cal-status[data-status="declined"] { color: var(--danger); }
.cal-remove { width: 1.9rem; height: 1.9rem; color: var(--muted); }
.cal-remove .icon { width: 0.95rem; height: 0.95rem; }
.cal-hint { margin: 0; font-size: var(--text-xs); line-height: 1.4; color: var(--muted); }
/* a read-only event (SPEC §3.7): shown, not edited */
.cal-title-text { margin: 0; font-size: var(--text-l); font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; }
.cal-value { font-size: var(--text-s); overflow-wrap: anywhere; }
.cal-value-row { display: flex; align-items: center; gap: 0.25rem; min-width: 0; } /* a read-only location and its copy button */
.cal-value-row > .cal-value { min-width: 0; }
.cal-invitee-text { display: flex; justify-content: space-between; gap: 0.5rem; font-size: var(--text-s); }
.cal-notes-text { margin: 0; font-size: var(--text-s); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
/* A long run without spaces in an event's notes (calendar.js foldedNotes): one line, cut with an ellipsis. */
.cal-long-word { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* The editor's notes, folded while not focused: the text shown, the field unseen over it to take the click. */
.cal-notes-box { position: relative; display: grid; }
.cal-notes-view { display: none; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.cal-notes-box.folded:not(:focus-within) .cal-notes-view { display: block; }
.cal-notes-box.folded:not(:focus-within) .cal-notes:not(.cal-notes-view) { position: absolute; inset: 0; height: 100% !important; opacity: 0; }
/* Internal Notes' #tag (calendar.js internalNotesSection): plain text in its heading's row, and the
   "Tag name" it prompts with, after an unseen copy of the field's text laid over the field. */
.cal-section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.cal-add-tag { padding: 0.1rem 0.3rem; border: 0; border-radius: 6px; background: var(--transparent); color: var(--accent); font-size: var(--text-s); font-weight: 600; cursor: pointer; }
@media (hover: hover) { .cal-add-tag:hover { background: var(--hover); } }
.cal-add-tag:active { background: var(--pressed); }
.cal-tag-box { position: relative; display: grid; }
.cal-notes.cal-tag-prompt { position: absolute; inset: 0; background: var(--transparent); color: var(--transparent); box-shadow: none; white-space: pre-wrap; overflow-wrap: break-word; pointer-events: none; }
.cal-tag-prompt[hidden] { display: none; }
/* Internal Notes' hint, muted under the field. */
.cal-internal-hint { margin-top: 0.35rem; }
/* Internal Notes' field in the current theme like every other field, kept apart by its heading's lock. */
.cal-internal-lock { flex: none; width: 1em; height: 1em; }
.cal-tag-prompt > span { color: var(--muted); }

/* Settings > Calendars (SPEC §5) */
.calendar-account { padding-top: 0.35rem; padding-bottom: 0.35rem; color: var(--text); }
.calendar-account-text { display: grid; flex: 1; min-width: 0; gap: 1px; }
.calendar-account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-account > .icon:last-child { width: 0.9rem; height: 0.9rem; color: var(--muted); }
.calendar-account-status { font-size: var(--text-xs); color: var(--muted); }
.calendar-account-status.is-error { color: var(--danger); }
/* An account's screen slides in over Settings, and Settings back over it. */
.settings-body { overflow-x: clip; }
/* Its column no wider than the pane: a long account name in the head is cut short, not widening it. */
.settings-screen { grid-template-columns: minmax(0, 1fr); }
.settings-screen .settings-head { gap: 0.25rem; }
.settings-screen .settings-title { flex: 1; min-width: 0; }

/* Settings > Colors (js/palette.js): each accent's light and dark tiles side by side, one under the other
   on a phone; a tile's colours are its own (.palette, at the top), drawn as the app's parts draw them. */
#settings-colors { max-width: 66rem; }
.palette-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.palette { display: grid; gap: 0.75rem; min-width: 0; padding: 0.9rem; border-radius: 16px; background: var(--editor-bg); color: var(--text); box-shadow: 0 1px 3px var(--shadow-soft); }
.palette-title { margin: 0; font-size: var(--text-m); font-weight: 600; color: var(--text-strong); }
/* Primary, secondary, tertiary and error, each over its container, what the app draws in them under. */
.palette-roles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.palette-role-column { display: grid; grid-template-rows: auto 2.75rem 2.75rem auto; gap: 0.25rem; min-width: 0; }
.palette-role-column .palette-chip { height: auto; }
.palette-role-column .palette-role { white-space: normal; line-height: 1.25; }
.palette-role-name { overflow: hidden; font-size: var(--text-xs); font-weight: 600; color: var(--text-strong); text-overflow: ellipsis; white-space: nowrap; }
.palette-swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.palette-swatch { display: grid; gap: 0.2rem; min-width: 0; }
.palette-chip { display: grid; place-items: center; overflow: hidden; height: 2.25rem; border-radius: 10px; font-size: var(--text-xs); font-variant-numeric: tabular-nums; font-weight: 600; box-shadow: inset 0 0 0 1px var(--faint); }
.palette-role { overflow: hidden; font-size: var(--text-xs); color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.palette-scene { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); gap: 0.5rem; font-size: var(--text-xs); }
.palette-scene > * { min-width: 0; border-radius: 12px; }
.palette-muted { color: var(--muted); }
.palette-strong { color: var(--text-strong); font-weight: 600; }
.palette-sidebar { display: grid; align-content: start; gap: 2px; padding: 0.35rem; background: var(--sidebar-bg); }
.palette-side-item { display: flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.45rem; border-radius: 999px; color: var(--text); }
.palette-side-item .icon { color: var(--muted); }
.palette-side-item.is-selected { background: var(--side-selected); color: var(--side-selected-text); }
.palette-side-item.is-selected .icon { color: var(--side-selected-text); }
.palette-list { display: grid; align-content: start; gap: 2px; padding: 0.35rem; background: var(--list-bg); }
.palette-note { display: grid; gap: 0.1rem; padding: 0.4rem 0.5rem; border-radius: 10px; }
.palette-note.is-selected { background: var(--row-selected); }
.palette-note-title { display: flex; align-items: center; gap: 0.3rem; color: var(--text-strong); font-weight: 600; }
.palette-badge { padding: 0 0.45rem; border-radius: 999px; background: var(--accent-tint); color: var(--accent); font-size: var(--text-xs); }
.palette-editor { grid-column: 1 / -1; display: grid; gap: 0.35rem; padding: 0.6rem 0.75rem; background: var(--editor-bg); box-shadow: inset 0 0 0 1px var(--faint); }
.palette-h1 { color: var(--text-strong); font-size: var(--text-l); font-weight: 700; }
.palette-tag { padding: 0 0.3rem; border-radius: 4px; background: var(--accent-tint); color: var(--accent); }
.palette-link { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-tint-strong); text-underline-offset: 3px; }
.palette-mark { padding: 0 0.15rem; border-radius: 3px; background: var(--highlight-bg); color: var(--highlight-text); }
.palette-todo-line { display: flex; align-items: center; gap: 0.45rem; }
.palette-todo { flex: none; width: 0.95rem; height: 0.95rem; border: 1.5px solid var(--checkbox); border-radius: 4px; }
.palette-todo.is-done { border-color: var(--accent); background: var(--accent); }
.palette-struck { text-decoration: line-through; }
.palette-card { display: grid; align-content: start; gap: 0.45rem; padding: 0.6rem; background: var(--list-card-bg); box-shadow: 0 1px 3px var(--list-card-shadow); }
.palette-card-head { display: flex; align-items: center; gap: 0.4rem; }
.palette-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent); }
.palette-count { display: grid; place-items: center; min-width: 1.2rem; height: 1.2rem; margin-left: auto; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: var(--text-xs); font-weight: 600; }
.palette-overdue { margin-left: auto; color: var(--overdue); font-size: var(--text-xs); }
.palette-calendar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; background: var(--editor-bg); box-shadow: inset 0 0 0 1px var(--cal-line); }
.palette-day { display: grid; align-content: start; gap: 0.25rem; min-width: 0; min-height: 4.2rem; padding: 0.3rem; box-shadow: inset -1px 0 var(--cal-line); }
.palette-day.is-today { background: var(--cal-today); }
.palette-weekend { background: var(--weekend-bg); }
.palette-event { overflow: hidden; padding: 0.1rem 0.3rem; border-radius: 4px; background: color-mix(in srgb, var(--accent) var(--event-tint-mix), var(--editor-bg)); color: var(--text-strong); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.palette-buttons { grid-column: 1 / -1; display: grid; gap: 0.5rem; padding: 0.6rem; background: var(--event-editor-bg); box-shadow: 0 2px 8px var(--event-editor-shadow); }
.palette-foot { display: flex; gap: 3px; }
.palette-button { display: grid; flex: 1 1 0; place-items: center; min-width: 0; height: 2.5rem; border-radius: 8px; font-weight: 600; }
.palette-button:first-child { flex: 0 0 2.75rem; border-radius: 1.25rem 8px 8px 1.25rem; }
.palette-button:last-child { border-radius: 8px 1.25rem 1.25rem 8px; }
.palette-button.is-delete { background: var(--error-container); color: var(--on-error-container); }
.palette-button.is-email { flex: 0 0 2.75rem; background: var(--tertiary-container); color: var(--on-tertiary-container); }
.palette-button.is-cancel { background: var(--secondary-container); color: var(--on-secondary-container); }
.palette-button.is-save { background: var(--accent); color: var(--accent-text); }
.palette-dialog-buttons { display: flex; justify-content: flex-end; gap: 0.5rem; }
.palette-dialog-buttons .button { pointer-events: none; }
.back-button .icon { transform: rotate(180deg); }
/* Keyboard Shortcuts: what a key does, its keys at the row's end (wrapping under it in a narrow pane). */
.shortcut-row { flex-wrap: wrap; justify-content: space-between; column-gap: 1rem; row-gap: 0.25rem; padding-block: 0.4rem; }
.shortcut-label { min-width: 0; }
.shortcut-keys { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-left: auto; }
.shortcut-keys kbd {
  padding: 0.1rem 0.45rem;
  border-radius: 5px;
  background: var(--hover);
  font: inherit;
  font-size: var(--text-xs);
  color: var(--muted);
  white-space: nowrap;
}
#settings-account .dialog-buttons { justify-content: space-between; margin-top: 0.75rem; }
.slide-in { animation: slide-in 0.2s ease-out; }
.slide-back { animation: slide-back 0.2s ease-out; }
@keyframes slide-in { from { transform: translateX(2.5rem); opacity: 0; } }
@keyframes slide-back { from { transform: translateX(-2.5rem); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .slide-in, .slide-back { animation: none; }
}
.calendar-row { cursor: pointer; }
.calendar-row input { margin: 0; accent-color: var(--accent); }
.calendar-dot { flex: none; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--event, var(--accent)); }
.calendar-row > .calendar-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-note { font-size: var(--text-xs); color: var(--muted); }
.cal-panel-foot { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.cal-panel-foot [data-action="delete"] { margin-right: auto; }
.cal-panel-foot .button { min-width: 5.5rem; }
/* A calendar file's event not added yet (SPEC §5 Calendar files): what Add to My Calendar does, left of it. */
.cal-proposal { flex: 1; margin: 0; font-size: var(--text-s); color: var(--muted); }

/* Dotted (SPEC §5): a calendar file's event not added yet, or one an invitee has declined. */
.cal-event.proposed, .cal-event.unsure { outline: 1.5px dotted var(--event, var(--accent)); outline-offset: -1.5px; }
.cal-event.proposed.selected, .cal-event.unsure.selected { outline-color: var(--accent-text); }
/* A reminder's editor: its check on the title's first line, as big as a list's checkboxes look beside it. */
/* Centred on the title's first line: past the field's top padding, half the line less half the check. */
.calendar-panel > .cal-panel-title:first-child > .reminder-check { --title-lh: 1.2; width: 1.75rem; height: 1.75rem; margin-top: calc(0.15rem + (var(--h1-size) * var(--title-lh) - 1.75rem) / 2); }
.calendar-panel > .cal-panel-title:first-child > .reminder-check .icon { width: 1.15rem; height: 1.15rem; }
.cal-clear { justify-self: start; }
/* Its list: a tonal button that opens it on Reminders, its name cut short where it doesn't fit. */
.cal-list-button { display: inline-flex; align-items: center; gap: 0.4rem; justify-self: start; max-width: 100%; min-width: 0; }
.cal-list-button .icon { flex: none; width: 1rem; height: 1rem; }
.cal-list-button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- the Calendar's editor, Material 3 Expressive ----------------------------------------------
   An extra-large surface; a headline title; filled fields with round corners; the calendars as filter
   chips; All day as Material's switch; Going? as a connected button group; alerts and Email in the
   tertiary container, Cancel in the secondary, Delete in the error one; every button a pill that
   squares off as it is pressed, on a spring. */
.calendar-panel {
  --spring: cubic-bezier(0.34, 1.5, 0.64, 1); /* M3 Expressive's fast spatial spring, as a curve */
  --field-radius: 14px;
  padding: 0 1.5rem 1.25rem;
  border-radius: 28px;
  background: var(--event-editor-bg);
  box-shadow: 0 1px 1px var(--event-editor-shadow), 0 2px 6px var(--event-editor-shadow);
}
.calendar-panel > .cal-panel-title:first-child { padding-top: 1.25rem; }
.cal-panel-head { min-height: 3.5rem; }
.calendar-panel .cal-title-input, .calendar-panel .cal-title-text {
  font-size: var(--h1-size); /* a note's # title's */
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
}
.calendar-panel .cal-panel-title { margin-bottom: 1rem; }
.calendar-panel .cal-panel-kind, .calendar-panel .cal-section-title {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-m);
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--accent);
}
.calendar-panel .cal-panel-body { gap: 1rem 2.25rem; }
.calendar-panel .cal-panel-col { gap: 0.75rem; }
/* More room above each section's heading (Alerts, Invitees, Notes) than between its own fields. */
.calendar-panel .cal-section { margin-top: 1.25rem; }
.calendar-panel .cal-field { font-size: var(--text-s); }
/* The labels halfway from the muted colour to the text's, a touch bolder: muted alone read too faint. */
.calendar-panel .cal-field-label { color: color-mix(in srgb, var(--text) 50%, var(--muted)); font-size: var(--text-s); font-weight: 600; letter-spacing: 0.01em; }

/* Round icon buttons, a rounded square while hovered. */
.calendar-panel .icon-button { border-radius: 50%; transition: border-radius 0.35s var(--spring), background-color 0.2s, transform 0.35s var(--spring); }
/* Hovers only where something hovers: a tap leaves :hover on what was tapped in the apps' web views. */
@media (hover: hover) { .calendar-panel .icon-button:hover { border-radius: 12px; } }
.calendar-panel .icon-button:active { transform: scale(0.92); }
.calendar-panel .cal-panel-head .icon-button { width: 2.5rem; height: 2.5rem; background: var(--field-bg-quiet); color: var(--text); }
@media (hover: hover) { .calendar-panel .cal-panel-head .icon-button:hover { background: linear-gradient(var(--hover), var(--hover)) var(--field-bg-quiet); } }
.calendar-panel .cal-panel-head .icon-button:active { background: linear-gradient(var(--pressed), var(--pressed)) var(--field-bg-quiet); }
.calendar-panel .cal-share { width: 1.75rem; height: 1.75rem; color: var(--accent); }
.calendar-panel .cal-share .icon { width: 1rem; height: 1rem; }

/* Fields: filled, round, the accent ringing the one focused. */
.calendar-panel :is(.cal-input, .cal-select, .cal-notes, .cal-time-input) {
  min-height: 2.5rem;
  border-radius: var(--field-radius);
  transition: box-shadow 0.15s;
}
.calendar-panel :is(.cal-input, .cal-select, .cal-notes):focus, .calendar-panel .cal-time-input:focus-within { box-shadow: inset 0 0 0 2px var(--accent); outline: none; }
.calendar-panel :is(.cal-input, .cal-select) { padding: 0 0.85rem; }
.calendar-panel .cal-select { padding-right: 1.9rem; background-position: calc(100% - 1.15rem) 55%, calc(100% - 0.85rem) 55%; }
.calendar-panel .cal-notes { padding: 0.65rem 0.85rem; }
.calendar-panel .cal-time-input { padding: 0 0.7rem; }
.calendar-panel .date-input-shown { padding-left: 0.85rem; }
/* Location and notes still one block: round outside, square where they meet. */
.calendar-panel .cal-location-notes .cal-location { border-radius: var(--field-radius) var(--field-radius) 0 0; }
.calendar-panel .cal-location-notes .cal-notes { border-radius: 0 0 var(--field-radius) var(--field-radius); }

/* The calendars as M3 filter chips, told apart by colour rather than an outline: each a pill filled
   with its colour, muted, and its dot; the one chosen in its colour at full strength, squarer, its
   text and grown dot black or white as that colour is light or dark. The radio is unseen over its
   chip, still what is clicked and focused. */
/* The calendars across the rest of the panel's width, their label beside the first line: the chips
   grow to fill each line. */
/* The label in the column the other fields' labels take, so the chips start where their fields do;
   each chip as tall as a field, 2.5rem. */
.calendar-panel .cal-calendar-field { row-gap: 0.4rem; }
.calendar-panel .cal-calendar-field > .cal-field-label { display: flex; align-items: center; min-height: 2.5rem; padding-top: 0; }
.calendar-panel .cal-radios { gap: 0.4rem; }
/* Each chip grows with its label to fill the line: the label is the flex item, its name the pill drawn. */
.calendar-panel .cal-radio { position: relative; flex: 1 1 auto; align-items: stretch; gap: 0; min-height: 2.5rem; }
/* A block, its dot and name at its start, not a flex box: a long name keeps its dot and ends in an
   ellipsis inside the chip. */
.calendar-panel .cal-radio .cal-radio-name { flex: 1 1 auto; display: block; align-content: center; text-align: start; box-sizing: border-box; border-radius: 1.25rem; }
.calendar-panel .cal-radio input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.calendar-panel .cal-radio-name {
  display: block;
  padding: 0.25rem 0.9rem 0.25rem 0.85rem;
  border-radius: 1.25rem; /* half its height: from 999px the spring's overshoot squared it off on the way to 12px */
  background-color: color-mix(in srgb, var(--event, var(--accent)) calc(var(--event-tint-mix) / 3), var(--field-bg));
  color: var(--text);
  font-size: var(--text-s);
  font-weight: 500;
  line-height: 1.2;
  transition: border-radius 0.4s var(--spring), background-color 0.2s, color 0.2s;
}
.calendar-panel .cal-radio-name::before {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--event, var(--accent));
  vertical-align: 0.02em;
  transition: transform 0.4s var(--spring);
}
@media (hover: hover) { .calendar-panel .cal-radio:hover .cal-radio-name { background-image: linear-gradient(var(--hover), var(--hover)); } }
/* The chosen one in its events' own tint in the month and week, its dot grown. */
.calendar-panel .cal-radio input:checked + .cal-radio-name {
  border-radius: 12px;
  background-color: color-mix(in srgb, var(--event, var(--accent)) var(--event-tint-mix), var(--field-bg));
  color: var(--text-strong);
  font-weight: 650;
}
.calendar-panel .cal-radio input:checked + .cal-radio-name::before { transform: scale(1.35); }
.calendar-panel .cal-radio input:focus-visible + .cal-radio-name { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* All day: a row under the calendars as wide as the column, on the panel itself, its words in the
   fields' labels' type and a switch at its end as tall as a field (2.5rem × 4rem, Material 3's
   proportions), its thumb half the track's height off, three quarters on, filling it pressed.
   --c is the thumb's centre from the track's inner left edge, --d its size. */
.calendar-panel .cal-switch {
  justify-self: stretch;
  justify-content: space-between;
  min-height: 2.5rem;
  color: color-mix(in srgb, var(--text) 50%, var(--muted));
  font-size: var(--text-s);
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
}
.calendar-panel .cal-switch input {
  --c: calc(1.25rem - 2px);
  --d: 1.25rem;
  order: 1;
  flex: none;
  position: relative;
  width: 4rem;
  height: 2.5rem;
  border-radius: 1.25rem;
  border: 2px solid var(--muted);
  background: var(--field-bg-quiet);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.calendar-panel .cal-switch input::before {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(var(--c) - var(--d) / 2);
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
  transition: left 0.35s var(--spring), width 0.25s, height 0.25s, background-color 0.2s;
}
/* The thumb grows only while the switch itself is pressed: a press on the words makes it :active too. */
.calendar-panel .cal-switch input:active:hover { --d: calc(2.5rem - 4px); }
.calendar-panel .cal-switch input:checked { --c: calc(2.75rem - 2px); --d: 1.875rem; border-color: var(--accent); background: var(--accent); }
.calendar-panel .cal-switch input:checked::before { background: var(--accent-text); }
.calendar-panel .cal-switch input:checked:active:hover { --d: calc(2.5rem - 4px); }
.calendar-panel .cal-switch input:focus { box-shadow: none; }

/* Going?: a connected button group, the answer given a pill in the accent, the others squarer beside it. */
.calendar-panel .cal-response { gap: 0.75rem; }
.calendar-panel .cal-response-label { font-weight: 550; }
.calendar-panel .segmented { gap: 2px; padding: 0; border-radius: 0; background: var(--transparent); }
.calendar-panel .segmented button {
  min-height: 2.5rem;
  padding: 0 1rem;
  border-radius: 6px;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-weight: 500;
  transition: border-radius 0.4s var(--spring), background-color 0.2s;
}
.calendar-panel .segmented button:first-child { border-radius: 1.25rem 6px 6px 1.25rem; }
.calendar-panel .segmented button:last-child { border-radius: 6px 1.25rem 1.25rem 6px; }
@media (hover: hover) { .calendar-panel .segmented button:hover { background-image: linear-gradient(var(--hover), var(--hover)); } }
.calendar-panel .segmented button[aria-checked="true"] { border-radius: 1.25rem; background: var(--accent); color: var(--accent-text); font-weight: 650; box-shadow: none; }
/* Accept green and Decline red, tinted and filled when pressed (here and on the event link's page); Maybe as above. */
.cal-response .segmented button[data-status="accepted"] { background-color: var(--accepted-container); color: var(--text-strong); }
.cal-response .segmented button[data-status="declined"] { background-color: var(--declined-container); color: var(--text-strong); }
.cal-response .segmented button[data-status="accepted"][aria-checked="true"] { background-color: var(--accepted); color: var(--accepted-text); }
.cal-response .segmented button[data-status="declined"][aria-checked="true"] { background-color: var(--danger); color: var(--danger-text); }

/* Alerts: their label, then right of it tonal pills in the tertiary container, Add Alert beneath a borderless
   pill in the secondary one, a button rather than a link and not mistaken for an alert. */
.calendar-panel .cal-alerts-field { align-items: start; }
.calendar-panel .cal-alerts-field > .cal-field-label { display: flex; align-items: center; min-height: 2.5rem; }
.cal-alerts-stack { display: grid; gap: 0.4rem; min-width: 0; }
.calendar-panel .cal-alerts { gap: 0.4rem; }
.calendar-panel .cal-alert {
  min-height: 2.5rem;
  padding: 0 0.25rem 0 0.85rem;
  border-radius: 999px;
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
  font-weight: 500;
}
.calendar-panel .cal-alert:not(:has(.cal-remove)) { padding-right: 0.85rem; } /* a read-only event's: no ✕ closing it */
.calendar-panel .cal-alert > .icon { width: 1.15rem; height: 1.15rem; color: inherit; }
.calendar-panel .cal-alert .cal-remove { width: 2rem; height: 2rem; color: inherit; }
@media (hover: hover) { .calendar-panel .cal-alert .cal-remove:hover { background: color-mix(in srgb, var(--on-tertiary-container) 8%, var(--transparent)); } }
.calendar-panel .cal-alert .cal-remove:active { background: color-mix(in srgb, var(--on-tertiary-container) 10%, var(--transparent)); }
.calendar-panel .cal-select[data-field="add-alert"] {
  border-radius: 999px;
  background-color: var(--secondary-container);
  color: var(--on-secondary-container);
  font-weight: 600;
}
/* Its state layers (as --hover and --pressed) in the fill: its background-image is the chevron. */
@media (hover: hover) {
  .calendar-panel .cal-select[data-field="add-alert"]:hover { background-color: color-mix(in srgb, var(--text) 8%, var(--secondary-container)); }
}
.calendar-panel .cal-select[data-field="add-alert"]:active { background-color: color-mix(in srgb, var(--text) 10%, var(--secondary-container)); }
.calendar-panel .cal-select[data-field="add-alert"]:focus { box-shadow: inset 0 0 0 2px var(--accent); }
/* Forced colours drop the fill and every box-shadow: Add Alert outlined as a button, a focused field
   ringed in the system's highlight (no custom property can stand in for those). */
@media (forced-colors: active) {
  .calendar-panel .cal-select[data-field="add-alert"]:not(:focus) { outline: 1px solid ButtonText; outline-offset: -1px; }
  .calendar-panel :is(.cal-input, .cal-select, .cal-notes):focus,
  .calendar-panel .cal-time-input:focus-within { outline: 2px solid Highlight; outline-offset: -2px; }
  /* All-day's switch, drawn by its backgrounds alone: its thumb in the text's colour, on in the highlight. */
  .calendar-panel .cal-switch input::before { forced-color-adjust: none; background: CanvasText; }
  .calendar-panel .cal-switch input:checked { border-color: Highlight; }
  .calendar-panel .cal-switch input:checked::before { background: Highlight; }
}

/* The Android app's menus (SPEC §5): where the web view draws a select's list itself, Material 3's menu
   under its field, round, its items 44 px, the one chosen in the tertiary container; not the system's
   older list dialog. The field keeps its own chevron. */
@supports (appearance: base-select) {
  .shell-android .calendar-panel select.cal-select, .shell-android .calendar-panel select.cal-select::picker(select) { appearance: base-select; }
  .shell-android .calendar-panel select.cal-select { display: flex; align-items: center; }
  .shell-android .calendar-panel select.cal-select::picker-icon { display: none; }
  .shell-android .calendar-panel select.cal-select::picker(select) {
    min-width: max(anchor-size(width), 10rem);
    max-width: calc(100vw - 32px);
    margin: 4px 0;
    padding: 4px;
    border: 0;
    border-radius: 16px;
    background: var(--menu-bg);
    color: var(--text);
    box-shadow: 0 3px 8px var(--shadow-soft), 0 1px 3px var(--shadow);
    transform-origin: top;
    /* Closing fades out in 0.1 s, held open (display, overlay) just that long. */
    opacity: 0;
    transition: opacity 0.1s linear, overlay 0.1s allow-discrete, display 0.1s allow-discrete;
  }
  /* Opening: a quick fade and a short decelerating unfold, no overshoot to wait out. */
  .shell-android .calendar-panel select.cal-select:open::picker(select) {
    opacity: 1;
    transition: opacity 0.1s linear, transform 0.2s cubic-bezier(0.05, 0.7, 0.1, 1);
  }
  @starting-style {
    .shell-android .calendar-panel select.cal-select:open::picker(select) { opacity: 0; transform: scaleY(0.9); }
  }
  .shell-android .calendar-panel select.cal-select option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 16px 0 12px;
    border-radius: 12px;
    color: var(--text);
    font-size: var(--text-m);
    font-weight: 400;
  }
  .shell-android .calendar-panel select.cal-select option + option { margin-top: 2px; }
  .shell-android .calendar-panel select.cal-select option:is(:hover, :focus-visible) { background: var(--hover); outline: none; }
  .shell-android .calendar-panel select.cal-select option:checked { background: var(--tertiary-container); color: var(--on-tertiary-container); font-weight: 600; }
  .shell-android .calendar-panel select.cal-select option:disabled { color: var(--muted); }
  .shell-android .calendar-panel select.cal-select option::checkmark { width: 1.1rem; text-align: center; }
  /* Add Alert's own words are the field's, not a choice in its menu. */
  .shell-android .calendar-panel select.cal-select[data-field="add-alert"] option[value=""] { display: none; }
}

/* Invitees: each answer a pill in a container of its own; Add in the secondary container, Add Alert's fill. */
.calendar-panel .cal-invitees { gap: 0.4rem; }
.calendar-panel .cal-invitee { gap: 0.4rem; }
.calendar-panel .cal-status { border-radius: 999px; background-color: var(--field-bg-quiet); font-weight: 550; }
.calendar-panel .cal-invitee .cal-status[data-status="accepted"] { background-color: var(--accepted-container); color: var(--text-strong); }
.calendar-panel .cal-invitee .cal-status[data-status="declined"] { background-color: var(--declined-container); color: var(--text-strong); }
/* an answer the invitee gave themselves (§4.9 `answered`): shown, not offered, the line under it says why */
.calendar-panel .cal-invitee .cal-status:disabled { background-image: none; padding-right: 0.85rem; cursor: default; opacity: 1; }
.cal-invitee-answered { grid-column: 1 / -1; margin-top: -0.15rem; }
.calendar-panel .cal-invitee-add .button {
  min-height: 2.5rem;
  padding: 0 1.25rem;
  border-radius: 1.25rem;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-weight: 600;
}

/* The foot: Save a filled pill in the accent, Cancel a tonal one, Delete round in the error container,
   Email round in the tertiary one. Pressed, each squares off and gives a little. A pill's radius is half
   its height, never 999px: the spring overshoots by about 8%, which from 999px went past 10px to a
   square corner before settling. */
.calendar-panel .cal-panel-foot { gap: 0.5rem; margin-top: 1.5rem; }
.calendar-panel :is(.cal-panel-foot, .cal-invitee-add) .button, .calendar-panel .cal-list-button {
  transition: border-radius 0.4s var(--spring), transform 0.4s var(--spring), background-color 0.2s;
}
.calendar-panel .cal-panel-foot .button {
  min-width: 6rem;
  min-height: 2.75rem;
  padding: 0 1.5rem;
  border-radius: 1.375rem;
  font-size: var(--text-m);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.calendar-panel .cal-panel-foot .button:not(.primary) { background: var(--secondary-container); color: var(--on-secondary-container); }
.calendar-panel .cal-panel-foot .button.primary { min-width: 7rem; }
@media (hover: hover) {
  .calendar-panel .cal-panel-foot .button:hover { border-radius: 16px; background-image: linear-gradient(var(--hover), var(--hover)); }
}
.calendar-panel :is(.cal-panel-foot .button, .cal-invitee-add .button, .cal-list-button):active { border-radius: 10px; transform: scale(0.96); }
.calendar-panel .cal-panel-foot .icon-button { width: 2.75rem; height: 2.75rem; }
.calendar-panel .cal-panel-foot [data-action="delete"] { background: var(--error-container); }
.calendar-panel .cal-panel-foot [data-action="delete"], .calendar-panel .cal-panel-foot [data-action="delete"] .icon { color: var(--on-error-container) !important; }
.calendar-panel .cal-panel-foot [data-action="email"] { background: var(--tertiary-container); color: var(--on-tertiary-container); }
@media (hover: hover) { .calendar-panel .cal-panel-foot :is([data-action="delete"], [data-action="email"]):hover { background-image: linear-gradient(var(--hover), var(--hover)); } }
/* Pressed, Material's state layer over each one's container too, as its shape gives. */
.calendar-panel :is(.cal-panel-foot .button:not(.primary), .cal-panel-foot .icon-button, .cal-invitee-add .button, .cal-list-button):active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.calendar-panel .cal-panel-foot .button.primary:active { background-image: linear-gradient(var(--accent-pressed), var(--accent-pressed)); }
.calendar-panel .cal-list-button { min-height: 2.5rem; padding: 0 1.25rem; border-radius: 1.25rem; font-weight: 600; background: var(--secondary-container); color: var(--on-secondary-container); }
/* On a computer the foot stays at the bottom of the view while any of the editor is in sight, the
   fields scrolling under it, and goes with the editor once it is scrolled away. It takes the panel's
   bottom padding and corners, with no background of its own (its buttons floating over the fields, as
   a phone's), so at rest it looks as before. */
@media (min-width: 1001px), (min-width: 701px) and (min-height: 501px), (min-width: 701px) and (not (pointer: coarse)) {
  .calendar-panel .cal-panel-foot {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 0.75rem -1.5rem -1.25rem;
    padding: 0.75rem 1.5rem 1.25rem;
    border-radius: 0 0 28px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calendar-panel *, .calendar-panel *::before { transition: none !important; }
}

@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  .app:is([data-mode="calendar"], [data-mode="settings"], [data-mode="expenses"]), .app:is(.hide-sidebar, .hide-list):is([data-mode="calendar"], [data-mode="settings"], [data-mode="expenses"]) { grid-template-columns: minmax(0, 1fr); }
  .app :is(.calendar-pane, .settings-pane, .expenses-pane) { display: none; }
  .app[data-mode="calendar"][data-view="list"] .calendar-pane, .app[data-mode="settings"][data-view="list"] .settings-pane, .app[data-mode="expenses"][data-view="list"] .expenses-pane { display: flex; }
  /* A phone: the groups' column or the group open, one at a time (SPEC §5 Expenses). */
  .expenses-body { grid-template-columns: minmax(0, 1fr); }
  .expenses-pane[data-open="group"] .expenses-groups, .expenses-pane[data-open="list"] .expenses-group { display: none; }
  .expenses-group { padding: 0.5rem 1rem 4rem; }
  .settings-body { padding: 0.25rem 1rem 3rem; }
  /* A pane's title on a row of its own under its buttons, large, the buttons keeping the row above
     (the sections' button on the left, the others on the right). The editor has no title. */
  .pane-head:is(.list-head, .reminders-head, .calendar-head, .settings-pane-head, .expenses-head) { flex-wrap: wrap; row-gap: 0.15rem; }
  .pane-head:is(.list-head, .reminders-head, .calendar-head, .settings-pane-head, .expenses-head) > .narrow-only:first-child { margin-right: auto; }
  .pane-head > :is(.list-title, .calendar-titles) { order: 1; flex: 1 0 100%; margin: 0; padding: 0 0.25rem 0.2rem; font-size: var(--title-size); line-height: 1.15; }
  .pane-head.calendar-head > .calendar-titles > .list-title { font-size: inherit; line-height: inherit; }
  /* The view, Today and search beside the sections' button (scrolling turns the page: no previous and next). */
  #calendar-prev, #calendar-next { display: none; }
  /* Material's small top bar on a phone: 48 px targets with 24 px icons edge to edge, 4 px from the
     sides, the title between the sidebar's button and the others from the start, in the month and the
     week (nothing jumps as the view scrolls), cut short with an ellipsis where it doesn't fit. */
  .calendar-head { gap: 0; padding: 4px; }
  .calendar-head .icon-button { width: 48px; height: 48px; }
  .calendar-head .icon-button .icon { width: 24px; height: 24px; }
  .pane-head.calendar-head > .calendar-titles { order: 0; flex: 1 1 0; padding: 0 0.25rem; font-size: var(--text-m); line-height: 1.35; } /* "September 2026" whole at 360 px; 1.35, not the big titles' 1.15, which would cut its g and p */
  /* A destructive action in a dense list: a full 44px target. */
  .cal-remove { width: 44px; height: 44px; }
  /* The new address's row as tall as an invitee's, which its ✕ makes 44px: every row evenly spaced. */
  .calendar-panel .cal-invitee-add { min-height: 44px; }
  .calendar-panel { position: fixed; inset: 0; z-index: 40; margin: 0; overflow-y: auto; padding: env(safe-area-inset-top) 1rem 3rem; border-radius: 0; box-shadow: none; }
  .calendar-panel .cal-alert .cal-remove { width: 44px; height: 44px; }
  /* An event's editor over the screen (SPEC §5): a column whose foot is stuck to the screen's bottom,
     the rest scrolling under it. A read-only event's foot holds Close alone, in place of its cross. */
  .calendar-panel .cal-close-foot { display: flex; }
  .calendar-panel:has(> .cal-close-foot) > .cal-panel-head .icon-button { display: none; }
  .calendar-panel:has(> .cal-panel-foot) { display: flex; flex-direction: column; padding-bottom: 0; }
  /* A field focused behind the foot's block (Tab, the keyboard opening) is scrolled out from under it. */
  .calendar-panel:has(> .cal-panel-foot) { scroll-padding-bottom: calc(3.5rem + 20px + 1.5rem + env(safe-area-inset-bottom, 0px)); }
  .calendar-panel:has(> .cal-panel-foot) > * { flex: none; }
  /* An alert while it is open (Save's "Choose a calendar") shows above the foot, not over its buttons. */
  body.cal-panel-footed .alert { /* calendar.js renderPanel's class, not body:has() (.storage-card-shown) */ bottom: calc(3.5rem + 20px + 1.5rem + env(safe-area-inset-bottom, 0px)); }
  .calendar-panel > .cal-panel-title:first-child { padding-top: 1.5rem; }
  .calendar-panel textarea.cal-title-input { line-height: 1.15; }
  .calendar-panel > .cal-panel-title:first-child > .reminder-check { --title-lh: 1.15; }
  /* The foot: Delete, Email, Cancel and Save as Material's connected button group, 2 px apart, round
     at its ends and squarer between (pressed, a button goes round and wider), floating above the
     screen's bottom with no background or shadow of its own, 10 px around the buttons, the rest
     scrolling under it; scrolled to the end, the last field stops 2 rem above it. */
  .calendar-panel .cal-panel-foot {
    --foot-inset: 10px;
    position: sticky;
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    z-index: 2;
    flex-wrap: wrap;
    gap: 2px;
    margin: auto -0.5rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    padding: var(--foot-inset);
    border-radius: calc(1.75rem + var(--foot-inset));
  }
  .calendar-panel:has(> .cal-panel-foot) > :has(+ .cal-panel-foot) { margin-bottom: 2rem; }
  .calendar-panel .cal-panel-foot > .cal-proposal { flex: 1 0 100%; margin: 0 0 0.5rem; padding: 0.25rem 0.5rem 0; }
  .calendar-panel .cal-panel-foot > :is(.button, .icon-button) {
    flex: 1 1 0;
    min-width: 0;
    height: 3.5rem;
    min-height: 3.5rem;
    margin: 0;
    padding: 0 0.75rem;
    transition: flex-grow 0.4s var(--spring), flex-basis 0.4s var(--spring), border-radius 0.4s var(--spring), background-color 0.2s;
  }
  .calendar-panel .cal-panel-foot > .icon-button { flex: 0 0 3.5rem; width: 3.5rem; padding: 0; }
  .calendar-panel .cal-panel-foot > :is(.button, .icon-button),
  .calendar-panel .cal-panel-foot > :is(.button, .icon-button):hover { border-radius: 8px; }
  .calendar-panel .cal-panel-foot > :is([data-action="delete"], .cal-proposal + .button),
  .calendar-panel .cal-panel-foot > :is([data-action="delete"], .cal-proposal + .button):hover { border-radius: 1.75rem 8px 8px 1.75rem; }
  .calendar-panel .cal-panel-foot > .button.primary,
  .calendar-panel .cal-panel-foot > .button.primary:hover { border-radius: 8px 1.75rem 1.75rem 8px; }
  .calendar-panel .cal-close-foot > .button.primary,
  .calendar-panel .cal-close-foot > .button.primary:hover { border-radius: 1.75rem; }
  .calendar-panel .cal-panel-foot > .button:active { flex-grow: 1.35; border-radius: 1.75rem; transform: none; }
  .calendar-panel .cal-panel-foot > .icon-button:active { flex-basis: 4.25rem; border-radius: 1.75rem; transform: none; }
  .calendar-page { padding: 0 0.25rem 0.25rem; }
  .month-weekday { padding: 0.2rem 0; text-align: center; }
  .month-day { justify-content: center; }
  .month-cell { padding: 0.1rem; }
  .cal-chip { font-size: var(--text-xs); }
  .cal-chip .cal-open { --open-pad-x: 0.15rem; padding: 0 var(--open-pad-x); }
  .week-allday-cell .cal-more { padding: 0 0.15rem; } /* level with the chips beside it, as theirs */
  /* A check too small to tap beside the chip's open button: the editor has it. */
  .month-cell .cal-time, .month-cell .cal-check, .week-allday-cell .cal-check, .cal-chip.cal-event:not(.all-day):not(.bar) .cal-open::before { display: none; }
  /* A phone's week has three days in sight (calendar.js weekLength()), its hours narrower. */
  .week { --gutter: 2.4rem; }
  .week-day { flex-direction: column; gap: 0; font-size: var(--text-xs); }
  .week-num { min-width: 1.6rem; height: 1.6rem; font-size: var(--text-m); }
  .week-hour > span { right: 0.2rem; font-size: var(--text-xs); }
  .cal-block { font-size: var(--text-xs); }
  .cal-block .cal-open { padding: 0.1rem 0.2rem; }
  .cal-block .cal-where { display: none; }
  .cal-field { grid-template-columns: 4.5rem minmax(0, 1fr); }
}

/* A landscape phone: a touch screen too short for the month's chips in its days, wider than a phone
   held upright (calendar.js compact). Its month is a phone's, the chosen day's items beside it rather
   than under it; its week the whole week, as wide screens have it. */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  .month.compact .month-weekday { padding: 0.2rem 0; text-align: center; }
  /* The month on a phone: dots in the days, the chosen day's items listed under it. Only the month
     is in the strip, so scrolling it moves its weeks (and its title) while the list stays: the strip
     is as tall as six weeks of 3rem, and the list scrolls by itself in what's left (on a short screen
     the list gives way first, down to its 4rem; then the month's weeks, down to what a day holds,
     calendar.js's MIN_ROW_PX). */
  .calendar-body.with-day { grid-template-rows: minmax(0, 19.75rem) minmax(4rem, 1fr); }
  .month-compact { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .month.compact .month-cell { padding: 0; }
  .month-pick {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0.2rem 0 0;
    border: 0;
    background: var(--transparent);
    color: inherit;
    font: inherit;
    cursor: pointer;
  }
  .month-pick .month-num { min-width: 1.75rem; height: 1.75rem; }
  .month-cell.chosen:not(.today) .month-num { background: var(--text-strong); color: var(--editor-bg); font-weight: 700; }
  .month-dots { display: flex; gap: 3px; height: 6px; }
  .month-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--event, var(--accent)); }
  .month-dot.cal-reminder { background: var(--transparent); box-shadow: inset 0 0 0 1.2px var(--muted); }
  /* Its last item scrolls clear of New Event. */
  .month-day-list { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; padding: 0.9rem 0.5rem 5.5rem; scrollbar-width: thin; }
  .month-day-title { margin: 0 0.5rem 0.35rem; font-size: var(--text-xs); font-weight: 700; text-transform: capitalize; color: var(--muted); }
  .month-day-list .list-empty { margin: 1.5rem 0; padding: 0; }
  .day-items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0; padding: 0; list-style: none; }
  .day-item { display: flex; align-items: center; gap: 0.5rem; padding: 0 0.5rem; border-radius: var(--radius); }
  .day-item.selected, .day-item:has(.day-item-open:active) { background: var(--hover); }
  .day-item-dot { flex: none; width: 0.6rem; height: 0.6rem; margin: 0 0.3rem; border-radius: 50%; background: var(--event, var(--accent)); }
  .day-item .cal-check { flex: none; margin: 0 0.12rem; }
  .day-item-open {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border: 0;
    background: var(--transparent);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  .day-item-when { flex: none; min-width: 3.5rem; display: flex; flex-direction: column; font-size: var(--text-xs); font-variant-numeric: tabular-nums; color: var(--text); }
  .day-item-end { color: var(--muted); }
  .day-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .day-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text-strong); }
  .day-item-where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-s); color: var(--muted); }
  .day-item.is-done .day-item-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
  .day-item.overdue .day-item-title { color: var(--danger); }
  .day-item.draft .day-item-title { font-style: italic; }
}

@media (min-width: 701px) and (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  /* The month on the left, the chosen day's items on the right, each the view's whole height. */
  .calendar-body.with-day { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .calendar-body.with-day .calendar-page { padding-right: 0.25rem; }
  .month-day-list { padding: 0.5rem 0.75rem 5.5rem 0.5rem; }
  /* The event's editor over the month and its day, scrolling by itself, its foot clear of the floating +. */
  .month-compact .calendar-panel { position: absolute; inset: 0; z-index: 31; margin: 0; overflow-y: auto; overscroll-behavior-y: contain; border-radius: 0; box-shadow: none; }
  .shell-bars .month-compact .calendar-panel { padding-bottom: calc(1.25rem + var(--shell-bottom, 0px)); }
  /* Scrolling turns the page, as on a phone: no previous and next around Today. New Event floats at
     the bottom right instead, as on a phone (no day to double-click in the month's dots). */
  #calendar-prev, #calendar-next { display: none; }
  #calendar-new { display: inline-flex; }
}

/* --- print: Export as PDF (js/print.js), always light -------------------------------- */

#print-view { display: none; }
@page { margin: 18mm 16mm; }
@media print {
  body > :not(#print-view) { display: none !important; }
  html, body { height: auto; background: var(--card-bg); }
  #print-view { display: block; color: var(--text); font-family: var(--font); font-size: 11pt; line-height: 1.45; }
  .print-note + .print-note { break-before: page; }
  #print-view h1, #print-view h2, #print-view h3, #print-view h4, #print-view h5, #print-view h6 {
    color: var(--text-strong); margin: 1.1em 0 0.35em; break-after: avoid; line-height: 1.2;
  }
  #print-view h1 { font-size: 20pt; margin-top: 0; }
  #print-view h2 { font-size: 16pt; }
  [data-headings="serif"] #print-view :is(h1, h2) { font-family: var(--serif); }
  #print-view h3 { font-size: 13pt; }
  #print-view h4, #print-view h5, #print-view h6 { font-size: 11pt; }
  #print-view p { margin: 0 0 0.6em; }
  #print-view blockquote { margin: 0 0 0.6em; padding-left: 0.9em; border-left: 3px solid var(--quote-bar); color: var(--muted); font-style: italic; }
  #print-view pre { margin: 0 0 0.6em; padding: 0.6em 0.75em; background: var(--code-bg); color: var(--code-text); font-family: var(--mono); font-size: 9.5pt; white-space: pre-wrap; border-radius: 4px; }
  #print-view code { font-family: var(--mono); font-size: 0.92em; background: var(--code-bg); color: var(--code-text); padding: 0 0.2em; border-radius: 3px; }
  #print-view mark { background: var(--highlight-bg); color: var(--highlight-text); }
  #print-view a, .print-tag, .print-wiki { color: var(--accent); }
  .print-break { height: 1.2em; }
  .print-item { display: flex; gap: 0.5em; margin: 0 0 0.25em calc(var(--level, 0) * 1.4em); }
  .print-marker { flex: 0 0 1.1em; text-align: right; color: var(--muted); }
  .print-item.is-done > span:last-child { text-decoration: line-through; color: var(--muted); }
  #print-view table { border-collapse: collapse; margin: 0 0 0.8em; width: 100%; }
  #print-view th, #print-view td { padding: 0.3em 0.55em; text-align: left; vertical-align: top; box-shadow: inset 0 0 0 0.5px var(--grid-line); }
  #print-view th { font-weight: 600; background: var(--code-bg); }
}

/* --- note history (SPEC §4.8) ------------------------------------------------------- */

/* A page over the whole window, its close button at the top: the versions down the left, the one
   picked's changes on the right (on a phone, one then the other). Only the changes show: the lines
   around each fade into the page and the unchanged ones between fold into a line that unfolds them. */
.history-page {
  position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column;
  /* Below the GNOME app's header bars, which lie over the page (--embed-top), or an iPhone's notch. */
  padding: calc(var(--embed-top, 0px) + env(safe-area-inset-top, 0px)) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  background: var(--editor-bg); color: var(--text);
}
.history-page[hidden] { display: none; }
/* On a wide screen, over the note's pane alone (app.js placePage): the sidebar and the note list stay beside it. */
.history-page.in-pane { left: var(--pane-left, 0px); }
.history { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.history-head { display: flex; flex: none; align-items: center; gap: 0.35rem; min-height: 3.25rem; padding: 0.6rem 1.5rem 0.6rem 0.75rem; }
.history-title {
  flex: 1; min-width: 0; margin: 0 0 0 0.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--text-l); font-weight: 700; color: var(--text-strong);
}
.history-close { background: var(--accent); color: var(--accent-text); }
@media (hover: hover) { .history-close:hover { background: var(--accent-hover); color: var(--accent-text); } }
.history-close:active { background-image: linear-gradient(var(--accent-pressed), var(--accent-pressed)); }
.history-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 19rem minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.history-body > .dialog-text { grid-column: 1 / -1; align-self: start; padding: 0 1.5rem; }
/* The versions on the note list's background, down to the bottom of the window. */
/* Clear History above an iPhone's home indicator too, the list's background still down to the bottom. */
.history-side { display: flex; flex-direction: column; gap: 0.75rem; min-height: 0; padding: 0.75rem 0.75rem calc(1.25rem + env(safe-area-inset-bottom, 0px)) 1rem; background: var(--list-bg); }
.history-list { flex: 0 1 auto; min-height: 0; overflow: auto; list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; align-content: start; }
.history-side .dialog-text { padding: 0 0.7rem; font-size: var(--text-xs); }
.history-row {
  display: flex; gap: 0.75rem; align-items: baseline; justify-content: space-between; width: 100%;
  padding: 0.55rem 0.7rem; border: 0; border-radius: var(--radius); background: var(--transparent);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.history-row:focus-visible { background: var(--hover); }
@media (hover: hover) { .history-row:hover { background: var(--hover); } }
.history-row[aria-current="true"] { background: var(--row-selected); }
.history-row:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.history-when { display: grid; gap: 0.1rem; min-width: 0; }
.history-major { color: var(--accent); font-size: var(--text-xs); }
.history-count { display: flex; flex: none; gap: 0.4rem; font-size: var(--text-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-added { color: var(--success); }
.history-removed { color: var(--danger); }
.history-actions { display: flex; gap: 0.5rem; padding: 0 0.7rem; }
.history-detail { min-height: 0; overflow: auto; padding: 0 1.5rem 3rem; container-type: inline-size; }
/* The layout switch centred over the changes, Restore at the end. */
.history-toolbar {
  position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.75rem;
  padding: 0.3rem 0 1rem; background: var(--editor-bg);
}
.history-toolbar .segmented { grid-column: 2; }
.history-toolbar > .button { grid-column: 3; justify-self: end; white-space: nowrap; }
/* Side by side: a head over each column, halves of the width as the columns below are. */
.history-columns { grid-column: 1 / -1; flex: 1 0 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.history-column { min-width: 0; padding: 0 0.5rem 0 0; }
.history-column .button { max-width: 100%; }
.history-current { padding: 0 0.5rem; font-weight: 600; color: var(--muted); }
/* No room for the switch centred with Restore beside it: centred, Restore wrapping under it when they
   don't fit side by side. */
@container (max-width: 40rem) {
  .history-toolbar { display: flex; flex-wrap: wrap; justify-content: center; }
}

.diff { font-size: var(--text-m); line-height: 1.55; }
.diff-row { display: grid; grid-template-columns: var(--diff-num-col) var(--diff-num-col) minmax(0, 1fr); --diff-num-col: calc(var(--diff-num) + 0.7rem); }
.diff-split .diff-row { grid-template-columns: var(--diff-num-col) minmax(0, 1fr) var(--diff-num-col) minmax(0, 1fr); }
.diff-row[data-fade="1"] { opacity: 0.72; }
.diff-row[data-fade="2"] { opacity: 0.45; }
.diff-row[data-fade="3"] { opacity: 0.22; }
/* 0.8em at 1.55 / 0.8: the same line height as the text beside it, so the two share a baseline. */
.diff-num {
  padding: 0 0.5rem 0 0.2rem; text-align: right; font-size: 0.8em; line-height: 1.9375;
  color: var(--muted); font-variant-numeric: tabular-nums; user-select: none;
}
.diff-text { min-height: 1.55em; padding: 0 0.6rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-num.del, .diff-text.del { background: var(--diff-del-bg); }
.diff-num.add, .diff-text.add { background: var(--diff-add-bg); }
.diff-text.empty, .diff-num.empty { background: var(--hover); }
.diff-word { border-radius: 3px; text-decoration: none; }
del.diff-word { background: var(--diff-del-word); }
ins.diff-word { background: var(--diff-add-word); }
.diff-fold { display: block; }
/* Unchanged lines folded away: a band with zig-zag edges, torn out of the text. */
.diff-gap {
  display: block; width: 100%; margin: 0.5rem 0; padding: 0.55rem 0.4rem; border: 0;
  background: var(--diff-fold); color: var(--muted); font: inherit; font-size: var(--text-xs); text-align: center; cursor: pointer;
  --zig-top: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 4'%3E%3Cpath d='M0 4L5 0L10 4Z'/%3E%3C/svg%3E");
  --zig-bottom: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 4'%3E%3Cpath d='M0 0L5 4L10 0Z'/%3E%3C/svg%3E");
  -webkit-mask: var(--zig-top) top left / 10px 4px repeat-x, linear-gradient(#000, #000) center / 100% calc(100% - 8px) no-repeat, var(--zig-bottom) bottom left / 10px 4px repeat-x;
  mask: var(--zig-top) top left / 10px 4px repeat-x, linear-gradient(#000, #000) center / 100% calc(100% - 8px) no-repeat, var(--zig-bottom) bottom left / 10px 4px repeat-x;
}
.diff-gap:focus-visible, .diff-gap:active { background: var(--diff-fold-hover); color: var(--text); }
@media (hover: hover) { .diff-gap:hover { background: var(--diff-fold-hover); color: var(--text); } }
.diff-gap:focus-visible { outline-offset: -6px; } /* inside the band: the mask cuts away what is outside */

/* Compare (SPEC §5), in History's page: its toolbar, then the note's lines, each clash two columns side
   by side at every width (this device's, the other's: buttons choosing them, Both under them) that
   becomes one across the width once chosen, tinted by where its lines came from. */
.compare-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0 1.5rem calc(3rem + env(safe-area-inset-bottom, 0px)); }
.compare-toolbar {
  position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  max-width: 60rem; margin: 0 auto; padding: 0.3rem 0 1rem; background: var(--editor-bg);
}
.compare-body { display: grid; gap: 0.4rem; max-width: 60rem; margin: 0 auto; font-size: var(--text-m); line-height: 1.55; }
.compare-lines { display: grid; min-width: 0; }
.compare-line { min-height: 1.55em; white-space: pre-wrap; overflow-wrap: anywhere; }
.compare-none { color: var(--muted); font-style: italic; }
.compare-label { margin-bottom: 0.15rem; color: var(--muted); font-size: var(--text-xs); font-weight: 650; letter-spacing: 0.02em; text-transform: uppercase; }
.compare-same { padding: 0 0.7rem; color: var(--muted); }
.compare-clash { display: grid; justify-items: center; gap: 0.4rem; margin: 0.35rem 0; }
.compare-sides { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; width: 100%; }
.compare-side {
  display: block; min-width: 0; padding: 0.5rem 0.7rem; border: 0; border-radius: var(--radius);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.compare-side.compare-from-ours { background: var(--compare-ours-bg); }
@media (hover: hover) { .compare-side.compare-from-ours:hover { background: var(--compare-ours-hover); } }
.compare-side.compare-from-theirs { background: var(--compare-theirs-bg); }
@media (hover: hover) { .compare-side.compare-from-theirs:hover { background: var(--compare-theirs-hover); } }
.compare-side:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.compare-chosen { display: flex; align-items: flex-start; gap: 0.75rem; margin: 0.35rem 0; padding: 0.5rem 0.5rem 0.5rem 0.7rem; border-radius: var(--radius); }
.compare-chosen.compare-from-ours { background: var(--compare-ours-bg); }
.compare-chosen.compare-from-theirs { background: var(--compare-theirs-bg); }
.compare-chosen.compare-from-both { padding: 0; }
.compare-chosen-text { display: grid; flex: 1; gap: 0.35rem; min-width: 0; }
.compare-from-both .compare-lines { padding: 0.5rem 0.7rem; border-radius: var(--radius); }
.compare-from-both .compare-lines:first-child { background: var(--compare-ours-bg); }
.compare-from-both .compare-lines:last-child { background: var(--compare-theirs-bg); }
.compare-from-both .compare-change { margin-top: 0.5rem; }
.compare-change { flex: none; min-height: 1.9rem; padding: 0 0.85rem; background: var(--card-bg); }
.compare-both { min-height: 1.9rem; }

#editor .cm-note-stats-link {
  padding: 0; border: 0; background: var(--transparent); color: inherit; font: inherit; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px;
}
#editor .cm-note-stats-link:focus-visible { color: var(--accent); text-decoration-style: solid; }
@media (hover: hover) { #editor .cm-note-stats-link:hover { color: var(--accent); text-decoration-style: solid; } }

@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  .history-head { padding-right: 0.75rem; }
  .history-body { grid-template-columns: minmax(0, 1fr); }
  .history[data-pane="list"] .history-detail, .history[data-pane="detail"] .history-side { display: none; }
  .history-detail { padding: 0 0.75rem 2rem; }
  .diff-split { font-size: var(--text-xs); }
  .diff-split .diff-text { padding: 0 0.35rem; }
  /* Restore on one line in its half of a phone's width. */
  .history-column { padding-right: 0.35rem; }
  .history-column .button { padding: 0 0.6rem; font-size: var(--text-s); }
  .history-current { padding: 0 0.35rem; font-size: var(--text-s); }
  /* Two columns still: narrower type and padding, the toolbar's buttons sharing its rows. */
  .compare-scroll { padding: 0 0.75rem calc(2rem + env(safe-area-inset-bottom, 0px)); }
  .compare-body { font-size: var(--text-s); }
  .compare-sides { gap: 0.35rem; }
  .compare-side, .compare-from-both .compare-lines { padding: 0.4rem 0.5rem; }
  .compare-toolbar .button { flex: 1 1 auto; }
  .compare-toolbar .spacer { display: none; }
  .conflict-bar { margin: 0 0.75rem 0.5rem; }
}

/* --- the iOS app's floating bars (SPEC §5, Layout (iOS app)) ------------------------------------- */

/* html.shell-bars: the app's bottom bar (search, new) floats over the page's foot
   (--shell-bottom: how far up, set by the app) and the panes' headers float over their tops, as iOS's
   own. The page reaches up under the status bar: each header starts at the screen's top edge, its row
   below the status bar. The lists, the text and the settings scroll under both, their start and end
   clear of them. */
.shell-bars { --float-head: calc(3.5rem + env(safe-area-inset-top, 0px)); }
.shell-bars :is(.list-pane, .reminders-pane, .settings-pane) { position: relative; }
/* Every pane's header is the same row, the Calendar's that stays put included: its sidebar button (the
   editor's back) at the same place, the title right of it, the buttons on the right. */
.shell-bars .pane-head {
  gap: 0.5rem;
  min-height: var(--float-head);
  padding: calc(0.3rem + env(safe-area-inset-top, 0px)) 0.75rem 0.3rem;
}
.shell-bars :is(.list-head, .editor-head, .reminders-head, .settings-pane-head) {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
}
/* The sidebar's row lines up with the panes' beside it on an iPad. */
.shell-bars .sidebar-head {
  min-height: var(--float-head);
  padding-top: calc(0.3rem + env(safe-area-inset-top, 0px));
  padding-bottom: 0.3rem;
}
/* The title in the same type in every pane, at the one title size (--title-size; a phone's Calendar,
   between its buttons, has its own below). The Calendar's slot pulls back its padding (room for its
   fade), so its title starts where the others' do. */
.shell-bars .pane-head .list-title { font-size: var(--title-size); line-height: 1.15; }
.shell-bars .calendar-titles { margin-left: 0.35rem; }
/* Behind its title and buttons, a see-through blur of what scrolls under it, a light veil of the
   pane's background keeping the title readable, fading out a little below the header. Not the note
   list's or Reminders', whose buttons alone float over the notes and cards, the title scrolling with
   them. */
:is(html:not(.shell-bars) .editor-head, .shell-bars :is(.editor-head, .settings-pane-head))::before {
  content: "";
  position: absolute;
  inset: 0 0 -1.2rem;
  z-index: -1;
  background: linear-gradient(color-mix(in srgb, var(--head-bg, var(--editor-bg)) 70%, transparent),
    color-mix(in srgb, var(--head-bg, var(--editor-bg)) 35%, transparent));
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-mask-image: linear-gradient(#000 60%, transparent);
  mask-image: linear-gradient(#000 60%, transparent);
  pointer-events: none;
}
/* The bottom bar has search and new (diffaShellSearch, diffaShellNew): the panes' headers don't. The
   Android app's floating + is new alone: search stays in the headers, as on a phone's browser. New
   List is in the +'s New Reminder dialog (app.js newReminderDialog). */
.shell-bars :is(#new-note, #calendar-new, #new-list) { display: none; }
.shell-bars:not(.shell-android) :is(#search-button, #reminders-search-button, #calendar-search-button) { display: none; }
/* On a phone the iOS app's bar has the Calendar's Today, grouped with its search, and the view's
   toggle floating above them (shell-calendar-bar, set by its script): the header doesn't. */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  .shell-calendar-bar :is(#calendar-view, #calendar-today) { display: none; }
}
/* No grey box flashed over what a tap lands on in Android's web view, which no native control has. */
.shell-android { -webkit-tap-highlight-color: transparent; }
/* Sideways is the app's alone on the Android app's sidebar, list, note, Reminders and Settings (its
   swipes: the sidebar, Back, a row's Delete): left to Android's WebView, a sideways move began a scroll
   of its own, nothing to scroll, and the swipe then got its touches late and few, lagging the finger.
   On every scroller there too, as each takes the panning back for what it holds; and the dimmed strip
   (the app's ::after) while the sidebar is open. Not the Calendar, whose week scrolls sideways, nor a
   booking page's week in Settings (share.css, .booking-grid-scroll). */
.shell-android .app[data-view="sidebar"],
.shell-android :is(.sidebar, .list-pane, .editor-pane, .reminders-pane, .settings-pane),
.shell-android :is(.sidebar, .list-pane, .editor-pane, .reminders-pane, .settings-pane) * { touch-action: pan-y pinch-zoom; }
.shell-bars .list-head { --head-bg: var(--list-bg); }
/* The buttons are round glass over what scrolls under them, all one size (iOS's 44pt). Not the
   Calendar's, whose head stays put: Material's top bar, bare icons (above). */
.shell-bars .pane-head .icon-button { flex: none; width: 44px; height: 44px; border-radius: 22px; }
.shell-bars .pane-head:not(.calendar-head) .icon-button {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  backdrop-filter: blur(14px) saturate(1.6);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), 0 2px 8px var(--shadow-soft);
}
.shell-bars .pane-head:not(.calendar-head) .icon-button:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.shell-bars .pane-head .icon-button .icon { width: 1.3rem; height: 1.3rem; }
/* The Calendar's icons edge to edge, 24 px, its sidebar button and title where the other panes' are
   (the title's margin making up their gap). */
.shell-bars .pane-head.calendar-head { gap: 0; }
.shell-bars .pane-head.calendar-head .icon-button .icon { width: 24px; height: 24px; }
.shell-bars .calendar-nav { gap: 0; }
/* A shared note's "Edited by …" beside them gives way, not the buttons. */
.shell-bars .conflict-bar:not([hidden]) ~ .editor-body #editor .cm-panels-top { padding-top: 0; }
/* The Android app's are Material's 40dp rather than iOS's 44pt: with search among them, the
   Calendar's header has one more. Its Calendar's, bare, are Material's 48dp targets. */
.shell-android .pane-head .icon-button { width: 40px; height: 40px; border-radius: 20px; }
/* A note's actions are one menu there (SPEC §5): its ≡ in place of the header's buttons. */
html:not(.shell-android) #note-menu,
.shell-android .editor-head :is(#favorite-button, #share-button, #export-button, #history-button, #restore-button, #trash-button) { display: none; }
.shell-android .pane-head.calendar-head .icon-button { width: 48px; height: 48px; border-radius: 50%; }
.shell-android .pane-head.calendar-head { padding-left: calc(0.75rem - 4px); padding-right: calc(0.75rem - 4px); }
.shell-android .calendar-titles { margin-left: calc(0.35rem - 4px); }
/* The type scale in the Android app: Material's body large, body medium, label and title large. */
html.shell-android { --text-xs: 12px; --text-s: 14px; --text-m: 16px; --text-l: 22px; }
/* The Android app's sidebar (SPEC §5) is laid out for the thumb, from the bottom up: Trash, Settings
   and the sync status as one row of cards at the foot, the first two sharing its width, the sync status its icon alone (the
   tick, the turning arrows, offline); above them Calendar, Notes and Reminders as a grid of big
   tiles; above those the tags as small chips that wrap, sitting on the tiles and scrolling on their
   own when they don't all fit. */
/* The tags above the tiles: in the page itself (app.js renderSidebar), so it is read as drawn, and by
   order too until the sidebar is next drawn (the class set on a page already shown). */
.shell-android .sidebar > .sidebar-scroll { order: 1; padding: 8px 12px; }
.shell-android .sidebar > #sections { order: 2; }
.shell-android .sidebar > .sidebar-foot { order: 3; }
.shell-android .sidebar-scroll > #tag-tree { flex: none; overflow: visible; }
.shell-android .sidebar-scroll::before { content: ""; flex: 1 1 0; } /* the chips down on the tiles */
.shell-android .sidebar .tag-tree { display: flex; flex-wrap: wrap; gap: 6px; }
.shell-android .sidebar-scroll > .favorite-tags:not(:empty) { margin-bottom: 6px; }
.shell-android .sidebar .tag-row { flex: none; max-width: 100%; }
.shell-android .sidebar .tag-item {
  width: auto;
  min-height: 32px;
  gap: 2px;
  padding: 0 6px 0 12px;
  border-radius: 16px; /* round, a pill, as the app's own drawer's */
  background: var(--sidebar-bg);
  font-size: var(--text-s);
}
.shell-android .sidebar .tag-item:has(> :only-child) { padding-right: 12px; }
.shell-android .sidebar .tag-item[aria-current="true"] { background: var(--side-selected); }
.shell-android .sidebar .tag-item:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.shell-android .sidebar .tag-open { flex: 0 1 auto; gap: 6px; min-height: 32px; color: inherit; }
.shell-android .sidebar .tag-open .icon { display: none; } /* a chip is its name alone, after a # */
.shell-android .sidebar .tag-open .side-label::before { content: "#"; content: "#" / ""; } /* drawn, not said (where alt text is known) */
.shell-android .sidebar .tag-item .side-label { flex: 0 1 auto; }
.shell-android .sidebar .tree-toggle { width: 24px; height: 24px; border-radius: 12px; }
.shell-android .sidebar > #sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px 12px; }
.shell-android #sections .side-item {
  position: relative;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 88px;
  padding: 12px 4px;
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: var(--float-shadow);
  text-align: center;
  font-size: var(--text-xs);
  line-height: 18px;
}
.shell-android #sections .side-item[aria-current="true"] { background: var(--side-selected); }
.shell-android #sections .side-item .icon { width: 28px; height: 28px; }
/* Read whole in a tablet's narrow column too ("Calendrier" in a third of 225 px): smaller, then on two lines. */
.shell-android .sidebar > #sections { container-type: inline-size; }
.shell-android #sections .side-label { flex: none; max-width: 100%; white-space: normal; overflow-wrap: anywhere; font-size: clamp(11px, 3.4cqi, var(--text-xs)); }
.shell-android #sections .side-count { position: absolute; top: 8px; right: 8px; }
/* Trash and Settings share the foot's width as two cards, the sync status a round one at the right. */
.shell-android .sidebar-foot { flex-direction: row; align-items: center; gap: 8px; padding-left: 12px; padding-right: 12px; }
.shell-android .sidebar-foot::before { display: none; } /* the tiles' shadow, under the chips, instead */
.shell-android .sidebar-foot .sections { flex: 1 1 0; min-width: 0; }
.shell-android .sidebar-foot .side-item {
  justify-content: center;
  min-height: 48px;
  gap: 8px;
  padding: 0 12px;
  border-radius: 24px;
  background: var(--card-bg);
  box-shadow: var(--float-shadow);
  font-size: var(--text-s);
}
.shell-android .sidebar-foot .side-item[aria-current="true"] { background: var(--side-selected); }
.shell-android .sidebar-foot .side-item .side-label { flex: 0 1 auto; }
.shell-android .sidebar-foot .side-item .icon { width: 20px; height: 20px; }
/* A tablet's narrow column (225 px leaves each card 68 px): icon over name, as the tiles, both read whole. */
.shell-android .sidebar-foot { container-type: inline-size; }
@container (max-width: 300px) {
  .shell-android .sidebar-foot .side-item { flex-direction: column; gap: 2px; padding: 4px; font-size: var(--text-xs); line-height: 16px; }
  .shell-android .sidebar-foot .side-item .side-label { max-width: 100%; }
}
/* Material's state layers over the tiles' and cards' own surface (the open one's too), which hides the plain hover's. */
@media (hover: hover) {
  .shell-android :is(#sections .side-item, .sidebar-foot .side-item, .sidebar-foot .sync-status):hover { background-image: linear-gradient(var(--hover), var(--hover)); }
}
.shell-android :is(#sections .side-item, .sidebar-foot .side-item, .sidebar-foot .sync-status):active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.shell-android .sidebar-foot .sync-status { flex: none; justify-content: center; width: 48px; height: 48px; margin: 0; padding: 0; border-radius: 24px; background: var(--card-bg); box-shadow: var(--float-shadow); }
.shell-android .sync-status .icon { width: 22px; height: 22px; }
/* Its words said only: edits waiting show as a dot in the accent on the card (a sync problem has its
   own icon, offline's not), so the eye tells them from all synced. */
.shell-android .sidebar-foot .sync-status { position: relative; }
.shell-android .sidebar-foot .sync-status[data-waiting]::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.shell-android .sync-status span:not(.icon) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* its name, said, not shown */
.shell-android .sidebar > #sections::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; pointer-events: none;
  height: calc(6px + 22px * var(--glow));
  background: radial-gradient(farthest-side at 50% 100%, var(--glow-core), var(--glow-mid) 35%, var(--transparent));
  opacity: calc(min(var(--glow) * 4, 1) * (0.12 + 0.33 * var(--glow)) / 0.45);
  transition: --glow 0.3s ease;
}
@media (prefers-reduced-motion: reduce) { .shell-android .sidebar > #sections::before { transition: none; } }
.shell-android .sidebar > #sections { position: relative; z-index: 1; }
/* No panel of its own: the sidebar is transparent, the page (beside the list) or the dimmed list (a
   phone's drawer) showing through, its chips in the panel's tone, and its tiles and foot cards
   (Trash, Settings, the sync status) floating over it as the shell's + does, raised cards with the
   floating New Event's shadow. */
.shell-android .sidebar { background: var(--transparent); --float-shadow: 0 4px 14px var(--shadow-soft), 0 1px 3px var(--shadow-soft); }
/* A phone's drawer, the screen's whole width over the dimmed list, sits on a disc of the page's
   surface centred on its bottom left corner, bigger than the screen, reaching just past the logo's
   top right (--drawer-reach, app.js drawerReach), so its edge arcs over the logo and the chips from
   the screen's left edge to its right, setting them apart from the list beneath; the whole drawer
   once the tags fill it. The logo heads the disc, set down on the chips rather than at the top of
   the see-through part (a tap there closes the drawer, as the dimmed strip's does). */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  html.shell-android .app[data-view="sidebar"] .sidebar {
    width: 100%;
    justify-content: flex-end;
    background: radial-gradient(circle var(--drawer-reach, 200vmax) at 0 100%, var(--editor-bg) calc(100% - 1px), var(--transparent) 100%);
  }
  html.shell-android .sidebar > .sidebar-scroll { flex: 0 1 auto; }
  html.shell-android .sidebar-scroll::before { display: none; }
  html.shell-android .sidebar-head { flex: none; min-height: 0; padding: 16px 16px 4px; }
}
/* Nor a drawer's edge: no shadow around the see-through box. */
html.shell-android .app[data-view="sidebar"] .sidebar { box-shadow: none; }
/* The Android app's Settings (SPEC §5): Material 3's settings list, as Android's own Settings has it.
   A 16 px margin each side; each section's title in the accent (Title Small, 14/20 medium, not in
   capitals), 24 px above it and 8 px under it, 16 px in, as the rows' text is; its rows a segmented
   list, each a surface of its own 2 px from the next, the group's outer corners large (20 px), the
   inner ones small (4 px). A row is 56 px tall at least (72 px with a second line), 16 px in from
   both edges, its 24 px icon in the muted colour (on-surface-variant) 16 px before its text (Body
   Large, 16/24); a choice's value is that second line (Body Medium, 14/20, muted), its select unseen
   over the whole row, so a tap anywhere opens Android's picker; an on/off choice is Material's switch
   at the row's end. Sub-screens (an account's, Keyboard Shortcuts) head with a 48 px Back and a 22 px title. */
.shell-android .settings-body { padding-left: 16px; padding-right: 16px; }
.shell-android .settings { gap: 0; }
.shell-android .settings-account { margin: 0; padding: 0 16px; font-size: var(--text-s); line-height: 20px; }
.shell-android .settings-heading {
  margin: 24px 0 8px;
  padding: 0 16px;
  font-size: var(--text-s);
  line-height: 20px;
  font-weight: 500;
  letter-spacing: 0.1px;
  text-transform: none;
  color: var(--accent);
}
.shell-android .settings-group { border-radius: 20px; } /* the segmented list itself: the rows above */
.shell-android .settings-item { gap: 16px; min-height: 56px; padding: 8px 16px; font-size: var(--text-m); line-height: 24px; }
.shell-android .settings-item .icon { flex: none; width: 24px; height: 24px; color: var(--muted); }
.shell-android .settings-sort { position: relative; min-height: 72px; cursor: pointer; }
.shell-android .settings-text { display: grid; min-width: 0; }
.shell-android .settings-value { display: block; font-size: var(--text-s); line-height: 20px; color: var(--muted); overflow-wrap: anywhere; }
.shell-android .update-row .settings-text { gap: 0; }
.shell-android .settings-status { font-size: var(--text-s); line-height: 20px; overflow-wrap: anywhere; }
.shell-android .update-row:has(.settings-status:not(:empty)) { min-height: 72px; }
.shell-android .settings-sort .settings-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  opacity: 0;
  cursor: pointer;
}
/* A connected account: its name over its last sync, a chevron at the end. */
.shell-android .calendar-account:has(.calendar-account-status) { min-height: 72px; }
.shell-android .calendar-account-text { gap: 0; }
.shell-android .calendar-account-status { font-size: var(--text-s); line-height: 20px; }
.shell-android .calendar-account > .icon:last-child { width: 24px; height: 24px; }
.shell-android .calendar-row input[type="checkbox"]:not([role="switch"]) { flex: none; width: 18px; height: 18px; }
.shell-android .calendar-row .calendar-dot { width: 12px; height: 12px; margin: 0 6px; }
.shell-android .calendar-note { font-size: var(--text-s); }
/* Accent: Material's colour choices, 40 px round, labelled under them (12/16), 16 px within the card. */
.shell-android .settings-head { gap: 4px; margin: 0 0 8px -4px; }
.shell-android .settings-head .icon-button { width: 48px; height: 48px; border-radius: 50%; }
.shell-android .settings-head .icon-button .icon { width: 24px; height: 24px; }
.shell-android .settings-title { font-size: var(--text-l); line-height: 28px; }
.shell-android #settings-account .dialog-buttons { margin-top: 24px; }
.shell-bars .note-list { padding-bottom: calc(1rem + var(--shell-bottom, 0px)); }
.shell-bars #editor .cm-content { padding-top: calc(var(--float-head) + 0.75rem); }
/* The conflict bar under the header, the text under it. */
.shell-bars .conflict-bar:not([hidden]) { margin-top: calc(var(--float-head) + 0.25rem); }
.shell-bars .conflict-bar:not([hidden]) ~ .editor-body #editor .cm-content { padding-top: 0.75rem; }
/* Find and Replace open: its panel is under the header, the text under it. */
.shell-bars #editor .cm-panels-top { padding-top: var(--float-head); }
.shell-bars #editor .cm-editor:has(.cm-panels-top .find-panel) .cm-content { padding-top: 0.75rem; }
/* Reminders' header is its buttons alone, the round ones above, with no veil: the board shows between
   them. Its title, the board's first row, is in the other panes' title's place and type (right of the
   44px sidebar button, centred on the row) until scrolled away. */
.shell-bars .reminders-body { scroll-padding-top: calc(3.5rem + env(safe-area-inset-top, 0px)); }
.shell-bars :is(.reminders-head, .list-head) { pointer-events: auto; } /* a tap between its buttons: back to the top */
.shell-bars :is(.reminders-body > .reminders-title, .list-body > .notes-title) {
  min-height: calc(3.5rem + env(safe-area-inset-top, 0px));
  padding: calc(0.3rem + env(safe-area-inset-top, 0px)) calc(1.5rem + 88px) 0.3rem calc(1.5rem + 44px);
  font-size: var(--title-size);
  line-height: 2.9rem;
}
/* The Android app's buttons are 40px (below): its title as far from the sidebar button. */
.shell-android :is(.reminders-body > .reminders-title, .list-body > .notes-title) { padding-left: calc(1.5rem + 40px); }
/* The note list's title row is under its header, which takes the taps between its buttons: a tag's
   menu and its rename field there still take theirs. */
.shell-bars .list-body > .notes-title :is(.title-menu, .list-rename-input) { position: relative; z-index: 6; }
/* Clear of the note list's buttons on the right alone: none in the iOS app (its bottom bar's), the
   Android app's search. */
@media (min-width: 1001px), (min-width: 701px) and (min-height: 501px), (min-width: 701px) and (not (pointer: coarse)) {
  .shell-bars:not(.shell-android) .list-body > .notes-title { padding-right: 1.5rem; }
  .shell-android .list-body > .notes-title { padding-right: calc(1.5rem + 40px); }
}
.shell-bars .settings-body { padding-top: calc(var(--float-head) + 0.25rem); padding-bottom: calc(3rem + var(--shell-bottom, 0px)); }
/* The week has no such padding on a phone: scrolled to its end, midnight is the bottom of the screen
   (its last hour under the bar), as on a computer; in the Android app, above the floating tab bar and
   the navigation bar under it: --shell-tabs, how far they reach over the page's foot as the app measures
   it (0 when the page ends above them, or while typing), not the WebView's env(safe-area-inset-bottom),
   which came out 0 under the navigation bar and left midnight behind it. A wider screen's
   .calendar-body clears the navigation bar already (below). */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  .shell-android .week { padding-bottom: var(--shell-tabs, env(safe-area-inset-bottom, 0px)); }
  /* An event's editor's foot is a pane along the screen's bottom rather than buttons floating above
     it: the whole width, round at its top corners as Material's bottom sheet, reaching on down under
     the navigation bar (which takes its colour, clear over it: ShellScreen.kt), the buttons above the bar. */
  .shell-android .calendar-panel .cal-panel-foot {
    bottom: 0;
    margin: auto -1rem 0;
    padding: var(--foot-inset) 1rem calc(var(--foot-inset) + env(safe-area-inset-bottom, 0px));
    border-radius: 1.75rem 1.75rem 0 0;
    background: var(--event-foot-bg);
    box-shadow: 0 -1px 4px var(--event-editor-shadow), 0 -4px 16px var(--event-editor-shadow);
  }
  .shell-android .calendar-panel:has(> .cal-panel-foot) { scroll-padding-bottom: calc(3.5rem + 20px + 1rem + env(safe-area-inset-bottom, 0px)); }
  .shell-android body.cal-panel-footed .alert { bottom: calc(3.5rem + 20px + 1rem + env(safe-area-inset-bottom, 0px)); }
}
.shell-bars .alert { bottom: calc(1rem + var(--shell-bottom, env(safe-area-inset-bottom, 0px))); } /* no bar yet (signed out): the home indicator */

@media (min-width: 1001px), (min-width: 701px) and (min-height: 501px), (min-width: 701px) and (not (pointer: coarse)) {
  /* A month fills the view: its last week stays above the bottom bar. */
  .shell-bars .calendar-body { padding-bottom: var(--shell-bottom, 0px); }
  /* An iPad's sidebar can reach under the bottom bar in the middle. */
  .shell-bars .sidebar-foot { padding-bottom: calc(0.5rem + max(env(safe-area-inset-bottom, 0px), var(--shell-bottom, 0px))); }
}
/* A landscape phone's Calendar down to the navigation bar rather than the +'s height above it (a
   fifth of the screen): the day's items scroll clear of the +, the week's midnight is at the bottom of
   the screen; the month is left of it.
   The Android app's + floats at the right, no bar across the foot: the sidebar's foot is clear of the
   navigation bar alone. */
@media (min-width: 701px) and (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  .shell-android .sidebar-foot { padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px)); }
  .shell-android .calendar-body { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .shell-bars .month-day-list { padding-bottom: calc(1rem + var(--shell-bottom, 0px)); }
}

/* On a phone the sidebar slides in over the pane it was opened from, a strip of which stays in sight,
   dimmed, on the right: a tap there closes it (app.js). The bottom bar steps aside meanwhile. */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  .shell-bars .month-day-list { padding-bottom: calc(1rem + var(--shell-bottom, 0px)); }
  /* The title on its own row under the buttons (as above), well above iOS's large title's size; the
     panes whose header floats over what scrolls under it start that much lower. */
  .shell-bars .pane-head > :is(.list-title, .calendar-titles) { font-size: var(--title-size); line-height: 46px; }
  /* The Calendar's between its buttons (as above), Material's small bar's size. */
  .shell-bars .pane-head.calendar-head > .calendar-titles { margin-left: 0; padding: 0 0.25rem; font-size: 22px; line-height: 28px; } /* SPEC §5: 22 px */
  /* The Android app's own top app bar over a phone's Calendar (android/ PaneBar.kt): the page's
     header hidden, the view starting under the bar's height, which the app gives. Not under an older
     app, which has no bar. */
  .native-calendar-bar .calendar-head { display: none; }
  .native-calendar-bar .calendar-body { margin-top: var(--native-head, 0px); }
  .shell-android .pane-head.calendar-head > .calendar-titles { padding: 0 2px; font-size: 20px; line-height: 26px; } /* one more icon beside it: search */
  .shell-bars .pane-head:is(.list-head, .reminders-head, .calendar-head, .settings-pane-head) { row-gap: 0.15rem; }
  /* Not the note list's or Reminders' header, its buttons' row alone (taller, they would sit lower, over
     the title that scrolls under them). */
  .shell-bars .settings-pane { --float-head: calc(3.5rem + 46px + 0.35rem + env(safe-area-inset-top, 0px)); }
  /* The note list's and Reminders' title where the others' row of their own is: under the buttons' row
     (0.3rem, 44px and a 0.15rem gap), at 1rem, scrolling away with the notes and cards. */
  .shell-bars :is(.reminders-body > .reminders-title, .list-body > .notes-title) {
    min-height: 0;
    padding: calc(0.45rem + 44px + env(safe-area-inset-top, 0px)) 1rem 0.2rem;
    font-size: var(--title-size);
    line-height: 46px;
  }
  /* The Android app's own top app bar over a phone's note list, Reminders and Settings (android/
     PaneBar.kt), its title between its buttons: the page's header hidden, its title an empty row as
     tall as the bar, the notes, cards and settings scrolling under it. Not under an older app, which
     has no bar. */
  html.native-list-bars :is(.list-head, .reminders-head, .settings-pane-head) { display: none; }
  html.native-list-bars :is(.reminders-body > .reminders-title, .list-body > .notes-title) {
    visibility: hidden;
    box-sizing: border-box;
    height: var(--native-head, 0px);
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }
  html.native-list-bars .list-body > .notes-title { margin: 0; }
  html.native-list-bars .reminders-body { scroll-padding-top: var(--native-head, 0px); }
  html.native-list-bars .settings-pane { --float-head: var(--native-head, 0px); }
  /* A note's header is that bar too, its text starting under it. */
  /* Not under an app whose bar heads the lists but not a note (a968a1c's to 4fd3590's): no Back then. */
  html.native-note-bar .editor-head { display: none; }
  html.native-note-bar .editor-pane { --float-head: var(--native-head, 0px); }
  /* That bar stays while the page covers the pane (android/ shell.js native-bar, while it is up): the
     sidebar and its dimmed strip and a dialog start under it. An event's editor and a note's history
     hide it (paneBar()), so they are at the top then. */
  html.native-bar .app[data-view="sidebar"] .sidebar,
  html.native-bar .app[data-view="sidebar"]::after,
  html.native-bar .calendar-panel { top: var(--native-head, 0px); }
  html.native-bar dialog { top: var(--native-head, 0px); max-height: calc(100% - var(--native-head, 0px) - 2rem); }
  /* An older app's copy of the bar, which drew it under the sidebar while its own was gone. */
  .native-bar-copy { display: none; }
  .shell-bars .app[data-view="sidebar"] :is(.list-pane, .reminders-pane, .calendar-pane, .settings-pane) { display: flex; }
  /* The dimmed strip's close, for a screen reader alone (the strip is no element it reaches). */
  .shell-bars .app[data-view="sidebar"] .close-sidebar { display: block; }
  .shell-bars .app[data-view="sidebar"] .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 35;
    width: min(calc(100% - 3.5rem), 22rem);
    box-shadow: 0 0 28px var(--shadow);
    animation: drawer-in 0.25s ease-out;
    /* Its own layer, laid out and painted apart from the page, so its scroll moves only itself. */
    contain: strict;
    will-change: transform;
  }
  /* The pane under the dimmed strip keeps still: its blurs are dropped rather than redrawn under
     the sidebar each frame it scrolls. */
  .shell-bars .app[data-view="sidebar"] :is(.editor-head, .settings-pane-head)::before,
  .shell-bars .app[data-view="sidebar"] .pane-head .icon-button {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .shell-bars .app[data-view="sidebar"]::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 34;
    background: var(--backdrop);
    animation: backdrop-in 0.25s ease-out;
  }
  /* The Android app's phone drawer is its own, over its bar and floating + with its own scrim
     (shell.js native-sidebar): the page's, its dimmed strip and the strip's close stay out of sight,
     the pane showing under the app's scrim. */
  html.native-sidebar .app[data-view="sidebar"] :is(.sidebar, .close-sidebar),
  html.native-sidebar .app[data-view="sidebar"]::after { display: none; }
}
/* Swiped to the left (app.js swipeDrawer): the sidebar follows the finger, the strip brightening
   as it goes (an animation of its own, held still); let go, it eases out or back. */
.shell-bars .app.drawer-release .sidebar { transition: transform 0.2s ease-out; }
/* Swiped in from the screen's left edge (app.js swipeDrawer): under the finger, not by the animation. */
.shell-bars .app.drawer-swiped[data-view="sidebar"] .sidebar,
.shell-bars .app.drawer-swiped[data-view="sidebar"]::after { animation: none; }
/* Swiped back from the editor's edge (app.js swipeDrawer): the note follows the finger over the list,
   which shows under it as iOS's swipe back has it; let go, it eases out or back. */
.shell-bars .app.back-swiping .list-pane { display: flex; }
.shell-bars .app.back-swiping .editor-pane {
  position: fixed;
  inset: 0;
  z-index: 30;
  box-shadow: 0 0 28px var(--shadow);
  will-change: transform;
}
.shell-bars .app.back-release .editor-pane { transition: transform 0.2s ease-out; }
/* Sliding out or back, the list under it takes no tap (iOS's doesn't either). */
.shell-bars .app.back-release .list-pane { pointer-events: none; }
@keyframes drawer-in { from { transform: translateX(-100%); } }
@keyframes backdrop-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .shell-bars .app[data-view="sidebar"] .sidebar, .shell-bars .app[data-view="sidebar"]::after { animation: none; }
  .shell-bars .app.back-release .editor-pane { transition: none; }
}

/* --- the iOS and Android apps' tab bar (SPEC §5, Tab bar (apps)) --------------------------------- */

/* html.shell-tabs, set by the app's script: on a phone the app's own bar at the screen's foot has
   Calendar, Notes, Reminders and More (--shell-tabs: how far up over the page's foot it reaches, set by
   the app; --shell-bottom has the floating buttons above it too). No pane has a sidebar button. The
   sidebar view is More, a screen of its own in the tab bar's colour, laid out as the Android app's
   drawer was, from the bottom up: the logo, the sync status and the Theme button at its top under the
   status bar, then, down by the tab bar, the notifications (the alert cards, moved in by app.js
   placeMore, as the sync status is), the tags as chips and the foot: Trash and Settings as two buttons raised by a shadow.
   Calendar, Notes and Reminders are the bar's, so its tiles aren't here. */
.sidebar-alerts { display: none; }
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  html.shell-tabs :is(#back-to-sidebar, #reminders-back, #calendar-back, #settings-back) { display: none; }
  html.shell-tabs .app[data-view="sidebar"] :is(.list-pane, .editor-pane, .reminders-pane, .calendar-pane, .settings-pane) { display: none; }
  html.shell-tabs .app[data-view="sidebar"]::after,
  html.shell-tabs .app[data-view="sidebar"] .close-sidebar { display: none; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar {
    position: relative;
    inset: auto;
    z-index: auto;
    width: auto;
    justify-content: flex-end;
    padding: 0 env(safe-area-inset-right, 0px) var(--shell-tabs, env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px);
    /* On the accent's tone as Settings, its chips, cards and buttons white on it (SPEC §3.5). */
    --editor-bg: var(--theme-page-bg);
    --card-bg: var(--theme-group-bg);
    background: var(--theme-page-bg);
    box-shadow: none;
    animation: none;
    contain: none;
    will-change: auto;
    touch-action: pan-y pinch-zoom;
  }
  /* The head at the top, the rest down by the bar: a 40 px camel, Diffa at 24 px, then at the row's end
     the sync status and the Theme button, 48 px targets. */
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head {
    flex: none;
    justify-content: flex-start;
    gap: 8px;
    min-height: 0;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px 16px;
  }
  html.shell-tabs .app[data-view="sidebar"] .brand { gap: 12px; margin-right: auto; font-size: 24px; } /* SPEC §5: Diffa at 24 px beside the 40 px camel */
  html.shell-tabs .app[data-view="sidebar"] .brand-mark { width: 40px; height: 40px; }
  html.shell-tabs .app[data-view="sidebar"] .brand-eye { fill: var(--theme-page-bg); }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .theme-button { width: 48px; height: 48px; margin-left: 0; border-radius: 24px; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .theme-button .icon { width: 26px; height: 26px; }
  /* The Android app's is its tab bar's FAB on More's screen instead (SPEC §5, Tab bar (apps)). */
  html.shell-tab-theme .app[data-view="sidebar"] .sidebar-head .theme-button { display: none; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar > #sections { display: none; }
  /* The tags as round 32 px chips on the card's tone that wrap 6 px apart, each name after a #, the
     favorites first, the open one in the accent; scrolling on their own once they don't all fit. */
  /* In this order whatever an older drawer's rules order (the Android app's .shell-android ones). */
  html.shell-tabs .app[data-view="sidebar"] .sidebar-alerts { order: 1; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-scroll { order: 2; flex: 0 1 auto; padding: 8px 12px; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-foot { order: 3; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-scroll::before { display: none; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-scroll > #tag-tree { flex: none; overflow: visible; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-scroll > .favorite-tags:not(:empty) { margin-bottom: 6px; }
  html.shell-tabs .app[data-view="sidebar"] .tag-tree { display: flex; flex-wrap: wrap; gap: 6px; }
  html.shell-tabs .app[data-view="sidebar"] .tag-row { flex: none; max-width: 100%; }
  html.shell-tabs .app[data-view="sidebar"] .tag-item {
    width: auto;
    min-height: 32px;
    gap: 2px;
    padding: 0 6px 0 12px;
    border-radius: 16px;
    background: var(--card-bg);
    color: var(--text);
    font-size: var(--text-s);
    font-weight: 400;
  }
  html.shell-tabs .app[data-view="sidebar"] .tag-item:has(> :only-child) { padding-right: 12px; }
  html.shell-tabs .app[data-view="sidebar"] .tag-item[aria-current="true"] { background: var(--accent); color: var(--accent-text); }
  /* Pressed, as every button (their background above takes the generic layer away). */
  html.shell-tabs .app[data-view="sidebar"] .tag-item:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
  html.shell-tabs .app[data-view="sidebar"] .tag-item[aria-current="true"]:active { background-image: linear-gradient(var(--accent-pressed), var(--accent-pressed)); }
  html.shell-tabs .app[data-view="sidebar"] .tag-open { flex: 0 1 auto; gap: 6px; min-height: 32px; color: inherit; }
  html.shell-tabs .app[data-view="sidebar"] .tag-open .icon { display: none; }
  html.shell-tabs .app[data-view="sidebar"] .tag-open .side-label::before { content: "#"; content: "#" / ""; }
  html.shell-tabs .app[data-view="sidebar"] .tag-item .side-label { flex: 0 1 auto; }
  html.shell-tabs .app[data-view="sidebar"] .tree-toggle { width: 24px; height: 24px; border-radius: 12px; color: inherit; }
  /* The notifications over the tags, centred up and down in the room between the head and the tags
     (their auto margins), their heading said, not shown: a plain list of the alerts' rows on More's own
     surface, scrolling on their own past half the screen; a centred line says when there are none. */
  html.shell-tabs .app[data-view="sidebar"] .sidebar-alerts {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    gap: 8px;
    min-height: 0;
    max-height: 50%;
    margin: auto 0;
    padding: 8px 12px;
    overflow-x: hidden; /* a row swiped out slides past its edge */
    overflow-y: auto;
    scrollbar-width: thin;
  }
  html.shell-tabs .sidebar-alerts-title {
    position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  html.shell-tabs .sidebar-alerts-empty { margin: 0 4px; color: var(--muted); font-size: var(--text-s); line-height: 20px; text-align: center; }
  html.shell-tabs .sidebar-alerts:has(.alert-card) .sidebar-alerts-empty { display: none; }
  html.shell-tabs .sidebar-alerts .alert-cards { display: flex; flex-direction: column; gap: 4px; }
  /* The foot: Trash and Settings two large buttons side by side, sharing the row, each its icon and its
     name, 64 px tall on the card's tone, raised by a soft shadow, 24 px above the tab bar, the one open
     in the selected colour. */
  html.shell-tabs .app[data-view="sidebar"] .sidebar-foot { flex-direction: row; align-items: stretch; gap: 8px; padding: 4px 12px 24px; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-foot::before { display: none; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-foot .sections { flex: 1 1 0; min-width: 0; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-foot .side-item {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 64px;
    padding: 0 12px;
    border-radius: 24px;
    background: var(--card-bg);
    color: var(--text);
    box-shadow: 0 1px 3px var(--shadow-soft), 0 4px 14px var(--shadow-soft);
    font-size: var(--text-m);
    font-weight: 400;
  }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-foot .side-item[aria-current="true"] { background: var(--side-selected); color: var(--side-selected-text); font-weight: 600; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-foot .side-item:active { background-image: linear-gradient(var(--pressed), var(--pressed)); }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-foot .side-item .icon { width: 24px; height: 24px; color: var(--muted); }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-foot .side-item[aria-current="true"] .icon { color: var(--side-selected-text); }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-foot .side-item .side-label { flex: 0 1 auto; }
  /* The sync status in the head, beside the Theme button, on the card's tone as the tags and the foot's
     buttons, its icon alone, its words said: round once
     synced with nothing waiting, its icon green; a rounded square while a sync is due, its icon orange
     with a yellow dot; while it syncs its shape morphs from one to the next, 6 s each, turning a sixth
     of a turn at each, the icon upright. */
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .sync-status {
    position: relative;
    isolation: isolate;
    flex: none;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--sync-due);
  }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .sync-status span:not(.icon) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .sync-status::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 30%;
    background: var(--card-bg);
    transition: border-radius 0.35s cubic-bezier(0.2, 0, 0, 1);
  }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .sync-status::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sync-due-dot);
  }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .sync-status[data-state="synced"]:not([data-waiting]) { color: var(--accent); }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .sync-status[data-state="synced"]:not([data-waiting])::before { border-radius: 50%; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .sync-status[data-state="synced"]:not([data-waiting])::after { display: none; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .sync-status[data-state="syncing"]::before { animation: sync-shapes 36s ease-in-out infinite; }
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .sync-status .icon { width: 24px; height: 24px; color: inherit; animation: none; }
}
@keyframes sync-shapes {
  0% { border-radius: 30%; rotate: 0deg; }
  16.67% { border-radius: 42% 58% 42% 58% / 58% 42% 58% 42%; rotate: 60deg; }
  33.33% { border-radius: 50% 30% 50% 30% / 30% 50% 30% 50%; rotate: 120deg; }
  50% { border-radius: 38% 50% 46% 54% / 54% 38% 50% 46%; rotate: 180deg; }
  66.67% { border-radius: 50% 22% 50% 22%; rotate: 240deg; }
  83.33% { border-radius: 26% 50% 34% 50% / 50% 30% 50% 26%; rotate: 300deg; }
  100% { border-radius: 30%; rotate: 360deg; }
}
@media (prefers-reduced-motion: reduce) {
  html.shell-tabs .app[data-view="sidebar"] .sidebar-head .sync-status[data-state]::before { animation: none; transition: none; }
}
/* `headings` "serif" (SPEC §3.5): the title bars and an event's title in the device's serif, last so it
   wins over each one's `font: inherit` (an event's title is a text field). Not the note list's titles,
   a reminder list's name or a reminder's text (the panel's input, not the event's textarea). */
[data-headings="serif"] :is(.list-title, .calendar-title, .notes-title, .reminders-title, .settings-title,
  textarea.cal-title-input, .cal-title-text) { font-family: var(--serif); }
