/*
 * Basic, neutral styling. Proper look & feel comes later.
 *
 * Colours: every colour is a variable (--bg, --text, ...) that picks its light or dark value with light-dark(), so
 * the page follows the system/browser preference; <html data-theme="light|dark"> (set by the theme toggle) overrides
 * that. Each variable has a value per mode, --light-* and --dark-*, which are the Standard themes; another theme
 * (docs/themes-design.md) is a block further down that sets the --light-* or the --dark-* ones, chosen in settings
 * and put on <body data-light-theme / data-dark-theme>. The variables live on <body>, not on :root, because Turbo
 * replaces the body on every visit but keeps the attributes of <html>. test/models/theme_colors_test.rb checks that
 * every theme can be read.
 */

:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

body {
  /* Standard light. */
  --light-bg: #ffffff;
  --light-text: #1f2328;
  --light-muted: #656d76;
  --light-border: #d0d7de;
  --light-surface: #f6f8fa;
  --light-input-bg: #ffffff;
  --light-accent: #0969da;
  --light-accent-text: #ffffff;
  --light-danger: #cf222e;
  --light-danger-bg: #ffebe9;
  --light-success: #1a7f37;
  --light-success-bg: #dafbe1;
  --light-warning: #bf8700;
  --light-warning-text: #8c5e00;
  --light-code-bg: #eaeef2;
  --light-code-text: #953800;
  --light-tag-bg: #ddf4ff;
  --light-tag-text: #0550ae;
  --light-tag-line: #0550ae;
  --light-selected-bg: #ebeff3;
  --light-faint: #8c959f;

  /* Standard dark. */
  --dark-bg: #0d1117;
  --dark-text: #e6edf3;
  --dark-muted: #8d96a0;
  --dark-border: #30363d;
  --dark-surface: #161b22;
  --dark-input-bg: #0d1117;
  --dark-accent: #4493f8;
  --dark-accent-text: #0d1117;
  --dark-danger: #f85149;
  --dark-danger-bg: #25171c;
  --dark-success: #3fb950;
  --dark-success-bg: #12261e;
  --dark-warning: #e3b341;
  --dark-warning-text: #e3b341;
  --dark-code-bg: #262c36;
  --dark-code-text: #ffa657;
  --dark-tag-bg: #172b45;
  --dark-tag-text: #79b8ff;
  --dark-tag-line: #79b8ff;
  --dark-selected-bg: #21262d;
  --dark-faint: #636c76;

  /* The colours the page uses: the light or the dark one. */
  --bg: light-dark(var(--light-bg), var(--dark-bg));
  --text: light-dark(var(--light-text), var(--dark-text));
  --muted: light-dark(var(--light-muted), var(--dark-muted));
  --border: light-dark(var(--light-border), var(--dark-border));
  --surface: light-dark(var(--light-surface), var(--dark-surface));
  --input-bg: light-dark(var(--light-input-bg), var(--dark-input-bg));
  --accent: light-dark(var(--light-accent), var(--dark-accent));
  --accent-text: light-dark(var(--light-accent-text), var(--dark-accent-text));
  --danger: light-dark(var(--light-danger), var(--dark-danger));
  --danger-bg: light-dark(var(--light-danger-bg), var(--dark-danger-bg));
  --success: light-dark(var(--light-success), var(--dark-success));
  --success-bg: light-dark(var(--light-success-bg), var(--dark-success-bg));
  --warning: light-dark(var(--light-warning), var(--dark-warning));
  /* Text in the warning color (a to-do that's due tomorrow or today): darker in light mode, so it can be read. */
  --warning-text: light-dark(var(--light-warning-text), var(--dark-warning-text));
  --code-bg: light-dark(var(--light-code-bg), var(--dark-code-bg));
  --code-text: light-dark(var(--light-code-text), var(--dark-code-text));
  /* Tags: fill, text and the line of the outline in the filter. These are pastel blue, the colour of a new tag;
     the tag-color-* classes further down set them per colour. */
  --tag-bg: light-dark(var(--light-tag-bg), var(--dark-tag-bg));
  --tag-text: light-dark(var(--light-tag-text), var(--dark-tag-text));
  --tag-line: light-dark(var(--light-tag-line), var(--dark-tag-line));
  /* Selected to-dos in Next and Focus: light grey, in dark mode a little lighter than the page. */
  --selected-bg: light-dark(var(--light-selected-bg), var(--dark-selected-bg));
  /* Text that can be read but not used: a tag in the filter that can't be picked on the page. Paler than muted. */
  --faint: light-dark(var(--light-faint), var(--dark-faint));

  color: var(--text);
  /* Radio buttons and checkboxes in the theme's accent, not the browser's own blue. (The open list of a select box is
     drawn by the browser and keeps its own colours.) */
  accent-color: var(--accent);
}

/* Nord, a dark theme: the colours of Omarchy's Nord theme (/usr/share/omarchy/themes/nord/colors.toml, after
   https://www.nordtheme.com). Text colours that were too faint on cards are lighter: the accent is Nord's frost
   (cyan) instead of its blue, the red, the orange of code and the faint text are lightened a little. */
body[data-dark-theme="nord"] {
  --dark-bg: #2e3440;
  --dark-text: #d8dee9;
  --dark-muted: #adb5c4;
  --dark-border: #4c566a;
  --dark-surface: #3b4252;
  --dark-input-bg: #2e3440;
  --dark-accent: #88c0d0;
  --dark-accent-text: #2e3440;
  --dark-danger: #e49ea4;
  --dark-danger-bg: #3f3a45;
  --dark-success: #a3be8c;
  --dark-success-bg: #39424a;
  --dark-warning: #ebcb8b;
  --dark-warning-text: #ebcb8b;
  --dark-code-bg: #3b4252;
  --dark-code-text: #e8ab90;
  --dark-tag-bg: #404c5c;
  --dark-tag-text: #aabfd4;
  --dark-tag-line: #aabfd4;
  --dark-selected-bg: #3b4252;
  --dark-faint: #7b88a1;
}

/* Catppuccin Latte, a light theme: the colours of Omarchy's Catppuccin Latte theme
   (/usr/share/omarchy/themes/catppuccin-latte/colors.toml, after https://catppuccin.com), with Catppuccin's mantle
   for cards and its subtext for muted text (a little darker). Red, green, the orange of code and the yellow of due dates are darker so
   they can be read on the page; faint text and the accent a little darker too. */
body[data-light-theme="catppuccin-latte"] {
  --light-bg: #eff1f5;
  --light-text: #4c4f69;
  --light-muted: #5e6174;
  --light-border: #ccd0da;
  --light-surface: #e6e9ef;
  --light-input-bg: #eff1f5;
  --light-accent: #1c5ee1;
  --light-accent-text: #eff1f5;
  --light-danger: #c20e35;
  --light-danger-bg: #ecdae2;
  --light-success: #2e741f;
  --light-success-bg: #dee9e1;
  --light-warning: #df8e1d;
  --light-warning-text: #885712;
  --light-code-bg: #e6e9ef;
  --light-code-text: #b34124;
  --light-tag-bg: #d0dcf5;
  --light-tag-text: #1956ce;
  --light-tag-line: #1956ce;
  --light-selected-bg: #dce0e8;
  --light-faint: #858896;
}

/* Gruvbox, a dark theme: the colours of Omarchy's Gruvbox theme (/usr/share/omarchy/themes/gruvbox/colors.toml,
   after Gruvbox Material), with a card colour between the page and the selected row. The red is a little lighter so
   it can be read on cards. */
body[data-dark-theme="gruvbox"] {
  --dark-bg: #282828;
  --dark-text: #d4be98;
  --dark-muted: #bdae93;
  --dark-border: #665c54;
  --dark-surface: #32302f;
  --dark-input-bg: #282828;
  --dark-accent: #7daea3;
  --dark-accent-text: #282828;
  --dark-danger: #ee827b;
  --dark-danger-bg: #453231;
  --dark-success: #a9b665;
  --dark-success-bg: #37392f;
  --dark-warning: #d8a657;
  --dark-warning-text: #d8a657;
  --dark-code-bg: #32302f;
  --dark-code-text: #e1875c;
  --dark-tag-bg: #3b4543;
  --dark-tag-text: #91bab1;
  --dark-tag-line: #91bab1;
  --dark-selected-bg: #3c3836;
  --dark-faint: #7d7066;
}

/* Jade Horse, a dark theme: the colours of Omarchy's Jade Horse theme (/usr/share/omarchy/themes/jade-horse/
   colors.toml), with a card colour between the page and the selected row. Nothing needed to change to be read. */
body[data-dark-theme="jade-horse"] {
  --dark-bg: #142620;
  --dark-text: #dfede5;
  --dark-muted: #bed6c9;
  --dark-border: #64887b;
  --dark-surface: #1a3029;
  --dark-input-bg: #142620;
  --dark-accent: #8bcbb1;
  --dark-accent-text: #142620;
  --dark-danger: #d88d91;
  --dark-danger-bg: #313531;
  --dark-success: #8bcbb1;
  --dark-success-bg: #223a31;
  --dark-warning: #c5cc91;
  --dark-warning-text: #c5cc91;
  --dark-code-bg: #1a3029;
  --dark-code-text: #d2ab8d;
  --dark-tag-bg: #314647;
  --dark-tag-text: #96b7d0;
  --dark-tag-line: #96b7d0;
  --dark-selected-bg: #203b31;
  --dark-faint: #91ad9f;
}

/* The page is a column at least as tall as the screen (dvh: the visible height on phones, whose address bar
   comes and goes); main takes the leftover space, so the footer sits at the bottom even with little content. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
}

a { color: var(--accent); }

/* Keyboard focus (Tab): a clear ring in the accent color. Not shown for mouse clicks. */
:where(a, button, input, textarea, select, summary, [contenteditable="true"], [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
:where(input, textarea, [contenteditable="true"]):focus-visible { outline-offset: -1px; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

/* The app's name in Comfortaa (vendor/fonts/README.md), with the tagline hanging under its accent ("do"). */
@font-face {
  font-family: "Comfortaa";
  src: url("/assets/comfortaa/comfortaa-variable-46a9ee6c.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}
.site-header .brand {
  font-family: "Comfortaa", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1;
  padding-bottom: 0.6em; /* room for the tagline */
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.brand .logo-accent { position: relative; color: var(--accent); }
/* "Beta" next to the logo, at the height of the name (config.x.stage_label) */
.brand-group { display: flex; align-items: flex-start; gap: 0.6rem; }
.stage-label {
  margin-top: 0.15rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
}
.brand .logo-tagline {
  position: absolute;
  top: calc(100% + 0.05em);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5em;
  font-weight: 400;
  letter-spacing: 0.02em;
}
.site-header nav { display: flex; align-items: center; gap: 1rem; }
.site-header form { margin: 0; }
.site-header button { white-space: nowrap; }
/* Plain links in the header (Sign in, Sign up). */
.header-link { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); text-decoration: none; }
.header-link:hover { color: var(--text); }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  color: var(--text);
}
.theme-toggle svg { width: 1.2rem; height: 1.2rem; }
/* Show the icon of the mode you'd switch to: a moon in light mode, a sun in dark mode. */
.theme-toggle .icon-sun, .theme-toggle .icon-moon { display: none; }
.theme-toggle[data-current="light"] .icon-moon,
.theme-toggle[data-current="dark"] .icon-sun { display: block; }

/* The account menu (layout): a button with your name opens a popover with Settings, Administration and Sign out.
   The popover sits under the button (CSS anchor positioning), or at the top right where browsers lack that. */
.account-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  white-space: nowrap;
  anchor-name: --account-button;
}
.account-chevron { width: 1em; height: 1em; color: var(--muted); }

/* The home link and the feedback bell (left of the account menu); the bell shows the number of tickets with something
   new in a small badge. */
.home-link, .feedback-bell { position: relative; display: inline-flex; align-items: center; padding: 0.35rem; color: var(--text); border-radius: 6px; }
.home-link:hover, .feedback-bell:hover { background: var(--bg); }
.home-link .icon, .feedback-bell .icon { width: 1.2rem; height: 1.2rem; }
.feedback-bell-count {
  position: absolute;
  top: -0.2rem;
  right: -0.35rem;
  min-width: 1.1rem;
  padding: 0 0.3rem;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.1rem;
  text-align: center;
}
.account-menu {
  position-anchor: --account-button;
  inset: auto;
  top: anchor(bottom);
  right: anchor(right);
  margin: 0.35rem 0 0;
  min-width: 12rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 4px 16px light-dark(rgb(0 0 0 / 0.12), rgb(0 0 0 / 0.5));
}
@supports not (anchor-name: --a) {
  .account-menu { top: 3.5rem; right: 0.75rem; }
}
.account-menu ul { list-style: none; margin: 0; padding: 0; }
.account-menu :is(a, button) {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-sizing: border-box;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}
.account-menu :is(a, button):hover { background: var(--surface); }
.account-menu :is(a, button):focus-visible { outline-offset: -2px; }
.account-menu .icon { color: var(--muted); }
.account-menu-sign-out { margin-top: 0.35rem; padding-top: 0.35rem; border-top: 1px solid var(--border); }

main { flex: 1 0 auto; box-sizing: border-box; width: 100%; max-width: 56rem; margin: 2rem auto; padding: 0 1rem; }

/* Full width, like the header: info on the left, links on the right. */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer p { margin: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-left: auto; } /* stays on the right, also when it wraps */
.site-footer a { color: inherit; }
.site-footer a:hover { color: var(--text); }

/* The maximum of open to-dos (todos/_limit), and whether sign-ups are open (sessions/_signups_notice) */

.limit-notice, .signups-notice {
  margin: 0 0 1rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--warning);
  border-radius: 6px;
  background: var(--surface);
}
.signups-notice { margin-top: 1.5rem; border-left-color: var(--accent); }

/* Administration */

.number-field { max-width: 8rem; }
.table-scroll { max-width: 100%; overflow-x: auto; margin-bottom: 1rem; }
.admin-table { border-collapse: collapse; }
.admin-table :is(th, td) { padding: 0.4rem 0.75rem 0.4rem 0; text-align: left; vertical-align: top; }
.admin-table thead th { border-bottom: 1px solid var(--border); }
.admin-table tbody th { font-weight: 400; }
.admin-table .number-field { width: 6rem; }
.signups-status { margin: 0 0 1rem; }
/* The same width in every box, so the numbers line up from box to box */
.statistics-table { width: 100%; max-width: 22rem; }
.statistics-table td { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }

/* FAQ: questions that open one at a time (<details name="faq">) */

.faq-list { border-top: 1px solid var(--border); }
.faq { border-bottom: 1px solid var(--border); }
.faq summary { padding: 0.75rem 0.25rem; font-weight: 600; cursor: pointer; }
.faq summary:hover { color: var(--accent); }
.faq-answer { padding: 0 0.25rem 0.9rem; }

/* Feedback: your tickets, a new ticket and one ticket with its thread */

.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.back-link { margin: 0 0 0.5rem; }
.back-link a { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); text-decoration: none; }
.back-link a:hover { color: var(--text); }

.tickets { margin: 1rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.ticket-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.ticket-row-link { display: flex; gap: 0.5rem; flex: 1 1 16rem; min-width: 0; color: var(--text); text-decoration: none; }
.tickets-toggle { margin: 1rem 0 0; }
.ticket-row-link:hover .ticket-subject { color: var(--accent); text-decoration: underline; }
.ticket-subject { min-width: 0; overflow-wrap: anywhere; }
/* Unread (something new since you last opened it): a dot in front, and the subject in bold. Every row keeps room for
   the dot, so the numbers line up. */
.ticket-unread .ticket-subject { font-weight: 700; }
.ticket-unread-dot { display: inline-block; flex: none; width: 0.5rem; height: 0.5rem; margin-right: 0.4rem; border-radius: 50%; vertical-align: 0.1em; }
.ticket-row-link .ticket-unread-dot { align-self: center; margin-right: -0.1rem; }
.ticket-unread-dot-on { background: var(--accent); }
.ticket-number { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 400; }
.ticket-meta { font-size: 0.9rem; }
.ticket-status-open { color: var(--success); }

.ticket-title { margin-bottom: 0.25rem; font-size: 1.5rem; overflow-wrap: anywhere; }
.ticket-title .ticket-number { display: block; font-size: 0.9rem; }
.ticket-page-meta { margin-top: 0; }

.ticket-thread { display: flex; flex-direction: column; gap: 0.75rem; margin: 1.5rem 0; padding: 0; list-style: none; }
.ticket-message { padding: 0.6rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; }
.ticket-message-user { background: var(--surface); }
.ticket-message-admin { border-left: 4px solid var(--accent); }
.ticket-message-header { display: flex; flex-wrap: wrap; gap: 0 0.75rem; margin: 0 0 0.25rem; font-size: 0.9rem; }
/* System lines, such as a category change: small, between the messages. */
.ticket-event { padding: 0 0.9rem; font-size: 0.85rem; text-align: center; overflow-wrap: anywhere; }
/* Plain text: line breaks as typed; long words or links wrap instead of widening the page. */
.ticket-message-body { white-space: pre-wrap; overflow-wrap: anywhere; }

.ticket-form { max-width: 40rem; }
/* The bottom of a ticket page (tickets/_actions): OK, "Close the ticket" and Add reply, or the reply box with Send,
   the checkbox and Cancel. The last button sits on the right. */
.ticket-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; max-width: none; margin: 0; }
.ticket-actions-row form { margin: 0; }
.ticket-actions-row .ticket-actions-end { margin-left: auto; }
.ticket-close-checkbox { display: flex; align-items: center; gap: 0.4rem; }
.ticket-reply { max-width: none; }
.button[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
/* Cancel with something typed: Discard or Keep writing (like the to-do dialog's question). */
.ticket-discard {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.ticket-discard[hidden] { display: none; }
.ticket-discard p { flex: 1 1 12rem; margin: 0; font-weight: 600; }

/* Administration: feedback. Filters side by side, wrapping on a phone; the search box takes the free width. */
.ticket-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 0.75rem; max-width: none; margin-bottom: 0.5rem; }
.ticket-filter { display: flex; flex-direction: column; gap: 0.25rem; }
.ticket-filter-search { flex: 1 1 14rem; }
.ticket-filter-actions { display: flex; gap: 0.5rem; }
.ticket-filters-hint { flex-basis: 100%; font-size: 0.85rem; }
.ticket-person { font-size: 0.9rem; }

/* The admin overview: a table, one line per ticket. The subject takes the free width; the other columns stay as
   narrow as their content. */
.tickets-table { width: 100%; margin-top: 1rem; border-collapse: collapse; }
.tickets-table :is(th, td) { padding: 0.5rem 0.75rem 0.5rem 0; text-align: left; vertical-align: baseline; }
.tickets-table :is(th, td):last-child { padding-right: 0; }
.tickets-table thead th { border-bottom: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; font-weight: 400; white-space: nowrap; }
.tickets-table tbody tr { border-bottom: 1px solid var(--border); }
.tickets-table .ticket-subject { width: 100%; overflow-wrap: anywhere; }
.tickets-table .ticket-number { white-space: nowrap; }
.tickets-table .ticket-subject a { color: var(--text); text-decoration: none; }
.tickets-table .ticket-subject a:hover { color: var(--accent); text-decoration: underline; }
.tickets-table :is(.ticket-category, .ticket-status, .ticket-activity) { white-space: nowrap; font-size: 0.9rem; }
.tickets-table :is(.ticket-category, .ticket-activity) { color: var(--muted); }
.tickets-table :is(.ticket-person, .ticket-account-type, .ticket-waiting-for) { white-space: nowrap; font-size: 0.9rem; }
.tickets-table .ticket-waiting-for-label { display: none; }
.tickets-table .ticket-account-type { color: var(--muted); }
.tickets-table .ticket-person-type { display: none; }
.tickets-table .ticket-person-name { display: inline-block; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
/* Narrower screens: each ticket folds into lines: number and subject, then category · status · time, who it waits
   for, then the person. */
@media (max-width: 45rem) {
  .tickets-table, .tickets-table tbody { display: block; }
  .tickets-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tickets-table tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.3rem; padding: 0.5rem 0; }
  .tickets-table tbody tr:first-child { border-top: 1px solid var(--border); }
  .tickets-table tbody td { display: block; padding: 0; }
  /* The subject fills the rest of the first line, so the next cells start a new one. */
  .tickets-table .ticket-subject { flex: 1 1 calc(100% - 3.5rem); width: auto; min-width: 0; }
  .tickets-table :is(.ticket-status, .ticket-activity)::before { content: "· "; color: var(--muted); }
  /* "Waiting for: Admin" on a line of its own, under category, status and time; nothing for a closed ticket. */
  .tickets-table .ticket-waiting-for { order: 1; flex-basis: 100%; }
  .tickets-table .ticket-waiting-for:empty { display: none; }
  .tickets-table .ticket-waiting-for-label { display: inline; }
  /* Last line: the person with their account type. */
  .tickets-table .ticket-person { order: 2; flex-basis: 100%; min-width: 0; white-space: normal; }
  .tickets-table .ticket-person-name { display: inline; max-width: none; overflow-wrap: anywhere; }
  .tickets-table .ticket-person-type { display: inline; }
  .tickets-table .ticket-account-type { display: none; }
}
.ticket-badge {
  display: inline-block;
  padding: 0 0.45em;
  border: 1px solid var(--warning);
  border-radius: 999px;
  color: var(--warning);
  font-size: 0.8rem;
  white-space: nowrap;
}
/* Changing the subject or category on the admin ticket page. */
.ticket-change-form { display: flex; flex-direction: column; gap: 0.25rem; max-width: 40rem; margin: 0.5rem 0 0; }
.ticket-change-form label { color: var(--muted); font-size: 0.9rem; }
.ticket-change-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ticket-change-row input[type=text] { flex: 1 1 12rem; min-width: 0; }
.ticket-form textarea { min-height: 7.5rem; max-height: 60vh; resize: vertical; field-sizing: content; }
.character-counter { margin: 0; font-size: 0.85rem; text-align: right; font-variant-numeric: tabular-nums; }
.character-counter-over { color: var(--danger); font-weight: 600; }

/* Text pages (privacy) */

.text-page h2 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
.text-page li { margin-bottom: 0.4rem; }

/* Credits */

.credits-group h2 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
.credits-list { list-style: none; margin: 0; padding: 0; }
.credits-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.credits-list p { margin: 0; }
.credits-name { font-weight: 600; }
.credits-license {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.4em;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.flash { padding: 0.6rem 0.9rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid; }
.flash-notice { color: var(--success); border-color: currentColor; background: var(--success-bg); }
.flash-alert { color: var(--danger); border-color: currentColor; background: var(--danger-bg); }

.form-errors { color: var(--danger); border: 1px solid currentColor; border-radius: 6px; background: var(--danger-bg); padding: 0 0.9rem; margin-bottom: 1rem; }
/* An error at its field (FieldErrorsHelper): between the label and the field. scroll-margin: some room above
   it when the field-errors controller scrolls it into view. */
.field-error { margin: 0; color: var(--danger); font-size: 0.9rem; font-weight: 600; scroll-margin-top: 0.75rem; }

.auth-form, form { max-width: 24rem; }

/* Sign in, sign up and password reset: one centered column; labels stay left-aligned. */
.auth-page { max-width: 24rem; margin: 0 auto; }
.auth-page .auth-form { max-width: none; }
/* The same column for pages with more to read than a form (two-factor authentication in settings): wider text, the
   fields as wide as everywhere else. */
.auth-page-wide { max-width: 40rem; }
.auth-page-wide .auth-form { max-width: 24rem; }
.field { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 1rem; }
.field_with_errors { display: contents; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* .button: a link that looks like a (secondary) button, e.g. Cancel. */
input[type="submit"], button, .button {
  font: inherit;
  color: var(--text);
  padding: 0.45rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

input[type="submit"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
/* Delete and Discard */
.button-danger { color: var(--danger); }
.button-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
/* Deleting your account: the big red button */
:is(.button, button, input[type="submit"]).button-danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--accent-text);
  font-weight: 600;
}
:is(.button, button, input[type="submit"]).button-danger-solid:hover { filter: brightness(1.1); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.account-deletion-facts { padding-left: 1.2rem; }
.account-deletion-facts li { margin-bottom: 0.5rem; }
/* Muted controls (e.g. at the maximum of open to-dos). */
:is(input, textarea, button):disabled { opacity: 0.45; cursor: not-allowed; }
.icon-button:disabled:hover { background: none; color: var(--muted); }
.button { display: inline-block; text-decoration: none; }
/* A link that looks like the main button of a form (Create free account on the homepage). */
.button.button-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.button-primary:hover { filter: brightness(1.1); }

/* The homepage for visitors (home/show): what Kalondo is, and a way in. */
.home-hero { max-width: 40rem; margin: 1.5rem 0 3.5rem; }
.home-eyebrow { margin: 0 0 0.75rem; color: var(--accent); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.home-title { margin: 0 0 1.25rem; font-size: clamp(2.25rem, 8vw, 3.75rem); line-height: 1.05; letter-spacing: -0.02em; font-weight: 800; }
.home-title span { color: var(--muted); }
.home-lead { margin: 0 0 1.75rem; font-size: 1.2rem; color: var(--muted); }
.home-lead strong, .home-places strong { color: var(--text); }
.home-actions { margin: 0 0 1rem; }
.home-cta { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.4rem; font-weight: 600; }
.home-places { margin: 0; color: var(--muted); }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.25rem; margin-bottom: 1rem; }
.home-card { padding: 1.5rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.home-card-icon { display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 1rem; border-radius: 10px; background: var(--tag-bg); color: var(--tag-text); }
.home-card-icon .icon { width: 1.5rem; height: 1.5rem; }
.home-card h2 { margin: 0 0 0.4rem; font-size: 1.2rem; }
.home-card p { margin: 0; color: var(--muted); }

.card { border: 1px solid var(--border); border-radius: 8px; padding: 0 1rem; }
.muted { color: var(--muted); }

/* Times (time_display) stay on one line: "2026-10-28 7:10 AM" would otherwise break at a hyphen. */
time { white-space: nowrap; }

/* Todos */

.new-todo, .todo form { max-width: none; margin: 0; }
.new-todo { margin-bottom: 1.5rem; }
.new-todo-row { display: flex; gap: 0.5rem; }
.new-todo-row input[type="text"] { flex: 1; min-width: 0; }

.todo-list { display: flex; flex-direction: column; }

.todo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}

/* The title with the notes icon and the tags right after it; together they take the free width of the row. The tags
   go on the next line when there's no room. */
.todo-main { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; flex: 1; min-width: 0; }
/* Small and muted, like time and energy. */
.todo-has-notes { display: inline-flex; flex-shrink: 0; color: var(--muted); }
.todo-has-notes .icon { width: 0.9rem; height: 0.9rem; }
.todo-title {
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 0.2rem 0.25rem;
  color: var(--text);
  text-decoration: none;
}
/* The title opens the to-do dialog: a light background on hover shows it can be clicked. */
a.todo-title { border-radius: 6px; }
a.todo-title:hover { background: var(--surface); }
.todo-done .todo-title { color: var(--muted); text-decoration: line-through; }
/* Time and energy in the row ("5m med"), muted, right-aligned next to the buttons. */
.todo-details { padding: 0 0.25rem; color: var(--muted); font-size: 0.85rem; white-space: nowrap; word-spacing: 0.25em; }
/* When it's due (docs/scheduling-design.md), before time and energy: the warning color the day before ("due soon"),
   the same in bold on the day, the danger color after it. The words say it too ("due tomorrow", "due today",
   "2 days overdue"). */
.todo-due { word-spacing: normal; }
.todo-due + span { margin-left: 0.6em; }
.todo-due-soon { color: var(--warning-text); }
.todo-due-today { color: var(--warning-text); font-weight: 600; }
.todo-due-overdue { color: var(--danger); font-weight: 600; }
/* On a phone the title needs the width: time and energy go on a line of their own under it, lined up with the title. */
@media (max-width: 30rem) {
  .todo-details { order: 1; flex-basis: 100%; margin: -0.3rem 0 0.1rem 2.45rem; padding: 0; }
  .todo-done-facts { order: 2; flex-basis: 100%; margin: -0.3rem 0 0.1rem 2.45rem; padding: 0; }
  .todo[role="row"] .todo-details { margin-left: 4rem; } /* after the drag handle in Next and Focus (1.55rem) */
}

/* Tags (docs/tags-design.md): small pills, the same after the title and as chips in the to-do dialog, in the tag's
   colour (docs/tag-colours-design.md). Each of the 16 colours (Tag::COLORS) is a class that sets the fill, the text
   and the line of the outline in the filter, for light and dark mode (--light-tag-* and --dark-tag-*, the Standard
   themes; a theme with other colours sets its own further down). Solid: a strong fill with white text (dark on
   yellow); pastel: a pale fill with dark text of the colour, in dark mode a dark tint with light text. The line is
   the pastel's text colour for both. A test checks that every one can be read (test/models/theme_colors_test.rb), so
   change a value here and run it. */
.tag-color-red { --light-tag-bg: #cf222e; --light-tag-text: #ffffff; --light-tag-line: #a40e26; --dark-tag-bg: #da3633; --dark-tag-text: #ffffff; --dark-tag-line: #ff9492; }
.tag-color-red-pastel { --light-tag-bg: #ffebe9; --light-tag-text: #a40e26; --light-tag-line: #a40e26; --dark-tag-bg: #3c1618; --dark-tag-text: #ff9492; --dark-tag-line: #ff9492; }
.tag-color-orange { --light-tag-bg: #bc4c00; --light-tag-text: #ffffff; --light-tag-line: #953800; --dark-tag-bg: #bd561d; --dark-tag-text: #ffffff; --dark-tag-line: #ffa657; }
.tag-color-orange-pastel { --light-tag-bg: #fff1e5; --light-tag-text: #953800; --light-tag-line: #953800; --dark-tag-bg: #3d2110; --dark-tag-text: #ffa657; --dark-tag-line: #ffa657; }
.tag-color-yellow { --light-tag-bg: #eac54f; --light-tag-text: #1f2328; --light-tag-line: #7d4e00; --dark-tag-bg: #d29922; --dark-tag-text: #0d1117; --dark-tag-line: #e3b341; }
.tag-color-yellow-pastel { --light-tag-bg: #fff8c5; --light-tag-text: #7d4e00; --light-tag-line: #7d4e00; --dark-tag-bg: #3b2e00; --dark-tag-text: #e3b341; --dark-tag-line: #e3b341; }
.tag-color-green { --light-tag-bg: #1a7f37; --light-tag-text: #ffffff; --light-tag-line: #116329; --dark-tag-bg: #238636; --dark-tag-text: #ffffff; --dark-tag-line: #56d364; }
.tag-color-green-pastel { --light-tag-bg: #dafbe1; --light-tag-text: #116329; --light-tag-line: #116329; --dark-tag-bg: #12261e; --dark-tag-text: #56d364; --dark-tag-line: #56d364; }
.tag-color-teal { --light-tag-bg: #0e7c86; --light-tag-text: #ffffff; --light-tag-line: #0b5a61; --dark-tag-bg: #1b7c83; --dark-tag-text: #ffffff; --dark-tag-line: #56d4dd; }
.tag-color-teal-pastel { --light-tag-bg: #d7f5f3; --light-tag-text: #0b5a61; --light-tag-line: #0b5a61; --dark-tag-bg: #0f2d30; --dark-tag-text: #56d4dd; --dark-tag-line: #56d4dd; }
.tag-color-blue { --light-tag-bg: #0969da; --light-tag-text: #ffffff; --light-tag-line: #0550ae; --dark-tag-bg: #1f6feb; --dark-tag-text: #ffffff; --dark-tag-line: #79b8ff; }
.tag-color-blue-pastel { --light-tag-bg: #ddf4ff; --light-tag-text: #0550ae; --light-tag-line: #0550ae; --dark-tag-bg: #172b45; --dark-tag-text: #79b8ff; --dark-tag-line: #79b8ff; }
.tag-color-purple { --light-tag-bg: #9333ea; --light-tag-text: #ffffff; --light-tag-line: #7e22ce; --dark-tag-bg: #9645e6; --dark-tag-text: #ffffff; --dark-tag-line: #dfa8ff; }
.tag-color-purple-pastel { --light-tag-bg: #f6e8ff; --light-tag-text: #7e22ce; --light-tag-line: #7e22ce; --dark-tag-bg: #33174d; --dark-tag-text: #dfa8ff; --dark-tag-line: #dfa8ff; }
.tag-color-pink { --light-tag-bg: #bf3989; --light-tag-text: #ffffff; --light-tag-line: #99286e; --dark-tag-bg: #bf4b8a; --dark-tag-text: #ffffff; --dark-tag-line: #ff9bce; }
.tag-color-pink-pastel { --light-tag-bg: #ffeff7; --light-tag-text: #99286e; --light-tag-line: #99286e; --dark-tag-bg: #3d1730; --dark-tag-text: #ff9bce; --dark-tag-line: #ff9bce; }
[class*="tag-color-"] {
  --tag-bg: light-dark(var(--light-tag-bg), var(--dark-tag-bg));
  --tag-text: light-dark(var(--light-tag-text), var(--dark-tag-text));
  --tag-line: light-dark(var(--light-tag-line), var(--dark-tag-line));
}
/* Tags in Nord: a solid one is the Nord colour with dark text (Omarchy's orange; red and purple are darkened and get
   light text, as dark text can't be read on them); a pastel one is a tint of the colour on the page with a light
   shade of it as text. Nord has no pink, so that one is made to fit. */
body[data-dark-theme="nord"] .tag-color-red { --dark-tag-bg: #a05159; --dark-tag-text: #eceff4; --dark-tag-line: #d5a5ac; }
body[data-dark-theme="nord"] .tag-color-red-pastel { --dark-tag-bg: #4e3e49; --dark-tag-text: #d5a5ac; --dark-tag-line: #d5a5ac; }
body[data-dark-theme="nord"] .tag-color-orange { --dark-tag-bg: #d5967a; --dark-tag-text: #2e3440; --dark-tag-line: #dbb1a5; }
body[data-dark-theme="nord"] .tag-color-orange-pastel { --dark-tag-bg: #52464b; --dark-tag-text: #dbb1a5; --dark-tag-line: #dbb1a5; }
body[data-dark-theme="nord"] .tag-color-yellow { --dark-tag-bg: #ebcb8b; --dark-tag-text: #2e3440; --dark-tag-line: #ebcb8b; }
body[data-dark-theme="nord"] .tag-color-yellow-pastel { --dark-tag-bg: #585551; --dark-tag-text: #ebcb8b; --dark-tag-line: #ebcb8b; }
body[data-dark-theme="nord"] .tag-color-green { --dark-tag-bg: #a3be8c; --dark-tag-text: #2e3440; --dark-tag-line: #b6cba7; }
body[data-dark-theme="nord"] .tag-color-green-pastel { --dark-tag-bg: #485251; --dark-tag-text: #b6cba7; --dark-tag-line: #b6cba7; }
body[data-dark-theme="nord"] .tag-color-teal { --dark-tag-bg: #8fbcbb; --dark-tag-text: #2e3440; --dark-tag-line: #a9cacb; }
body[data-dark-theme="nord"] .tag-color-teal-pastel { --dark-tag-bg: #43525b; --dark-tag-text: #a9cacb; --dark-tag-line: #a9cacb; }
body[data-dark-theme="nord"] .tag-color-blue { --dark-tag-bg: #81a1c1; --dark-tag-text: #2e3440; --dark-tag-line: #aabfd4; }
body[data-dark-theme="nord"] .tag-color-blue-pastel { --dark-tag-bg: #404c5c; --dark-tag-text: #aabfd4; --dark-tag-line: #aabfd4; }
body[data-dark-theme="nord"] .tag-color-purple { --dark-tag-bg: #7e6379; --dark-tag-text: #eceff4; --dark-tag-line: #cab5c9; }
body[data-dark-theme="nord"] .tag-color-purple-pastel { --dark-tag-bg: #4b4858; --dark-tag-text: #cab5c9; --dark-tag-line: #cab5c9; }
body[data-dark-theme="nord"] .tag-color-pink { --dark-tag-bg: #c88fae; --dark-tag-text: #2e3440; --dark-tag-line: #d6b3c9; }
body[data-dark-theme="nord"] .tag-color-pink-pastel { --dark-tag-bg: #504858; --dark-tag-text: #d6b3c9; --dark-tag-line: #d6b3c9; }
/* Tags in Catppuccin Latte: Catppuccin's colours (mauve for purple). Solid ones get white text, darkened where
   needed; yellow and pink keep their colour with dark text. Pastel ones are a tint of the colour with a dark shade
   of it as text. */
body[data-light-theme="catppuccin-latte"] .tag-color-red { --light-tag-bg: #d20f39; --light-tag-text: #ffffff; --light-tag-line: #b70d32; }
body[data-light-theme="catppuccin-latte"] .tag-color-red-pastel { --light-tag-bg: #ebcfd9; --light-tag-text: #b70d32; --light-tag-line: #b70d32; }
body[data-light-theme="catppuccin-latte"] .tag-color-orange { --light-tag-bg: #cb4928; --light-tag-text: #ffffff; --light-tag-line: #a83d22; }
body[data-light-theme="catppuccin-latte"] .tag-color-orange-pastel { --light-tag-bg: #ecd9d7; --light-tag-text: #a83d22; --light-tag-line: #a83d22; }
body[data-light-theme="catppuccin-latte"] .tag-color-yellow { --light-tag-bg: #df8e1d; --light-tag-text: #303446; --light-tag-line: #8c5912; }
body[data-light-theme="catppuccin-latte"] .tag-color-yellow-pastel { --light-tag-bg: #ede2d5; --light-tag-text: #8c5912; --light-tag-line: #8c5912; }
body[data-light-theme="catppuccin-latte"] .tag-color-green { --light-tag-bg: #358524; --light-tag-text: #ffffff; --light-tag-line: #2d701e; }
body[data-light-theme="catppuccin-latte"] .tag-color-green-pastel { --light-tag-bg: #d5e5d7; --light-tag-text: #2d701e; --light-tag-line: #2d701e; }
body[data-light-theme="catppuccin-latte"] .tag-color-teal { --light-tag-bg: #148087; --light-tag-text: #ffffff; --light-tag-line: #116c71; }
body[data-light-theme="catppuccin-latte"] .tag-color-teal-pastel { --light-tag-bg: #cfe3e7; --light-tag-text: #116c71; --light-tag-line: #116c71; }
body[data-light-theme="catppuccin-latte"] .tag-color-blue { --light-tag-bg: #1e66f5; --light-tag-text: #ffffff; --light-tag-line: #1956ce; }
body[data-light-theme="catppuccin-latte"] .tag-color-blue-pastel { --light-tag-bg: #d0dcf5; --light-tag-text: #1956ce; --light-tag-line: #1956ce; }
body[data-light-theme="catppuccin-latte"] .tag-color-purple { --light-tag-bg: #8839ef; --light-tag-text: #ffffff; --light-tag-line: #7933d5; }
body[data-light-theme="catppuccin-latte"] .tag-color-purple-pastel { --light-tag-bg: #e0d5f4; --light-tag-text: #7933d5; --light-tag-line: #7933d5; }
body[data-light-theme="catppuccin-latte"] .tag-color-pink { --light-tag-bg: #ea76cb; --light-tag-text: #303446; --light-tag-line: #934a80; }
body[data-light-theme="catppuccin-latte"] .tag-color-pink-pastel { --light-tag-bg: #eedfef; --light-tag-text: #934a80; --light-tag-line: #934a80; }
/* Tags in Gruvbox: its colours with dark text; Gruvbox's "purple" is pink, so purple is made to fit. Pastel ones
   are a tint of the colour with a light shade of it. */
body[data-dark-theme="gruvbox"] .tag-color-red { --dark-tag-bg: #ea6962; --dark-tag-text: #282828; --dark-tag-line: #ef8f89; }
body[data-dark-theme="gruvbox"] .tag-color-red-pastel { --dark-tag-bg: #533635; --dark-tag-text: #ef8f89; --dark-tag-line: #ef8f89; }
body[data-dark-theme="gruvbox"] .tag-color-orange { --dark-tag-bg: #e1875c; --dark-tag-text: #282828; --dark-tag-line: #e79e7b; }
body[data-dark-theme="gruvbox"] .tag-color-orange-pastel { --dark-tag-bg: #513d33; --dark-tag-text: #e79e7b; --dark-tag-line: #e79e7b; }
body[data-dark-theme="gruvbox"] .tag-color-yellow { --dark-tag-bg: #d8a657; --dark-tag-text: #282828; --dark-tag-line: #dbad64; }
body[data-dark-theme="gruvbox"] .tag-color-yellow-pastel { --dark-tag-bg: #4f4432; --dark-tag-text: #dbad64; --dark-tag-line: #dbad64; }
body[data-dark-theme="gruvbox"] .tag-color-green { --dark-tag-bg: #a9b665; --dark-tag-text: #282828; --dark-tag-line: #afbb70; }
body[data-dark-theme="gruvbox"] .tag-color-green-pastel { --dark-tag-bg: #444735; --dark-tag-text: #afbb70; --dark-tag-line: #afbb70; }
body[data-dark-theme="gruvbox"] .tag-color-teal { --dark-tag-bg: #89b482; --dark-tag-text: #282828; --dark-tag-line: #97bd91; }
body[data-dark-theme="gruvbox"] .tag-color-teal-pastel { --dark-tag-bg: #3d473c; --dark-tag-text: #97bd91; --dark-tag-line: #97bd91; }
body[data-dark-theme="gruvbox"] .tag-color-blue { --dark-tag-bg: #7daea3; --dark-tag-text: #282828; --dark-tag-line: #91bab1; }
body[data-dark-theme="gruvbox"] .tag-color-blue-pastel { --dark-tag-bg: #3b4543; --dark-tag-text: #91bab1; --dark-tag-line: #91bab1; }
body[data-dark-theme="gruvbox"] .tag-color-purple { --dark-tag-bg: #a98cc9; --dark-tag-text: #282828; --dark-tag-line: #bba4d4; }
body[data-dark-theme="gruvbox"] .tag-color-purple-pastel { --dark-tag-bg: #443e4b; --dark-tag-text: #bba4d4; --dark-tag-line: #bba4d4; }
body[data-dark-theme="gruvbox"] .tag-color-pink { --dark-tag-bg: #d3869b; --dark-tag-text: #282828; --dark-tag-line: #dc9eaf; }
body[data-dark-theme="gruvbox"] .tag-color-pink-pastel { --dark-tag-bg: #4e3d41; --dark-tag-text: #dc9eaf; --dark-tag-line: #dc9eaf; }
/* Tags in Jade Horse: its colours with dark text (magenta as purple; pink is made to fit). Pastel ones are a tint
   of the colour with the colour itself as text. */
body[data-dark-theme="jade-horse"] .tag-color-red { --dark-tag-bg: #d88d91; --dark-tag-text: #142620; --dark-tag-line: #dc979b; }
body[data-dark-theme="jade-horse"] .tag-color-red-pastel { --dark-tag-bg: #3f3d39; --dark-tag-text: #dc979b; --dark-tag-line: #dc979b; }
body[data-dark-theme="jade-horse"] .tag-color-orange { --dark-tag-bg: #d2ab8d; --dark-tag-text: #142620; --dark-tag-line: #d2ab8d; }
body[data-dark-theme="jade-horse"] .tag-color-orange-pastel { --dark-tag-bg: #3e4338; --dark-tag-text: #d2ab8d; --dark-tag-line: #d2ab8d; }
body[data-dark-theme="jade-horse"] .tag-color-yellow { --dark-tag-bg: #c5cc91; --dark-tag-text: #142620; --dark-tag-line: #c5cc91; }
body[data-dark-theme="jade-horse"] .tag-color-yellow-pastel { --dark-tag-bg: #3b4b39; --dark-tag-text: #c5cc91; --dark-tag-line: #c5cc91; }
body[data-dark-theme="jade-horse"] .tag-color-green { --dark-tag-bg: #8bcbb1; --dark-tag-text: #142620; --dark-tag-line: #8bcbb1; }
body[data-dark-theme="jade-horse"] .tag-color-green-pastel { --dark-tag-bg: #2e4a40; --dark-tag-text: #8bcbb1; --dark-tag-line: #8bcbb1; }
body[data-dark-theme="jade-horse"] .tag-color-teal { --dark-tag-bg: #86c7c5; --dark-tag-text: #142620; --dark-tag-line: #86c7c5; }
body[data-dark-theme="jade-horse"] .tag-color-teal-pastel { --dark-tag-bg: #2d4944; --dark-tag-text: #86c7c5; --dark-tag-line: #86c7c5; }
body[data-dark-theme="jade-horse"] .tag-color-blue { --dark-tag-bg: #96b7d0; --dark-tag-text: #142620; --dark-tag-line: #96b7d0; }
body[data-dark-theme="jade-horse"] .tag-color-blue-pastel { --dark-tag-bg: #314647; --dark-tag-text: #96b7d0; --dark-tag-line: #96b7d0; }
body[data-dark-theme="jade-horse"] .tag-color-purple { --dark-tag-bg: #b7a1c8; --dark-tag-text: #142620; --dark-tag-line: #baa5ca; }
body[data-dark-theme="jade-horse"] .tag-color-purple-pastel { --dark-tag-bg: #384145; --dark-tag-text: #baa5ca; --dark-tag-line: #baa5ca; }
body[data-dark-theme="jade-horse"] .tag-color-pink { --dark-tag-bg: #d6a2c3; --dark-tag-text: #142620; --dark-tag-line: #d6a2c3; }
body[data-dark-theme="jade-horse"] .tag-color-pink-pastel { --dark-tag-bg: #3f4144; --dark-tag-text: #d6a2c3; --dark-tag-line: #d6a2c3; }
.todo-tags { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; min-width: 0; }
.todo-tag, .tag-chip {
  padding: 0 0.5em;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* The filter: toggle buttons. A tag that is off is outlined in its colour; on, it is filled as on a to-do, with a
   tick in front (so on and off never depend on colour alone). "All tags" and "No tags" are grey, and solid in the
   accent colour with the same tick when on. On a phone one row that scrolls sideways (padding keeps the focus ring
   visible inside it). */
.tag-filter { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.75rem; }
.tag-filter form { margin: 0; }
.tag-filter-button {
  padding: 0.1rem 0.75rem;
  border-color: var(--tag-line);
  border-radius: 999px;
  background: none;
  color: var(--tag-line);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}
.tag-filter-button:hover { background: var(--tag-bg); border-color: var(--tag-bg); color: var(--tag-text); }
.tag-filter-button .icon { width: 0.9em; height: 0.9em; margin-right: 0.25em; vertical-align: -0.1em; }
/* All tags and No tags: grey pills, so they look like a different kind of button than the tags. */
.tag-filter-all { border-color: var(--selected-bg); background: var(--selected-bg); color: var(--text); font-weight: 400; }
.tag-filter-all:hover { border-color: var(--border); background: var(--border); color: var(--text); }
.tag-filter-button[aria-pressed="true"] { background: var(--tag-bg); border-color: var(--tag-bg); color: var(--tag-text); }
.tag-filter-all[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
/* Can't be picked: nothing on this page has it. No outline, so it doesn't look like a button (everything with an
   outline can be clicked), and paler text that can still be read, so you see which tags exist. No hover. */
.tag-filter-button:disabled,
.tag-filter-button:disabled:hover {
  opacity: 1;
  border-color: transparent;
  background: none;
  color: var(--faint);
  cursor: default;
}
/* Between All tags and No tags and the tags themselves. */
.tag-filter-divider { flex: none; align-self: center; width: 1px; height: 1.25rem; margin: 0 0.2rem; background: var(--border); }
@media (max-width: 30rem) {
  .tag-filter { flex-wrap: nowrap; overflow-x: auto; margin-inline: -3px; padding: 3px; scrollbar-width: thin; }
  .tag-filter form { flex: none; }
}

/* The tags field in the to-do dialog: looks like one input, with the chips (tag_input_controller.js) and the
   typing field inside it. */
.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
}
.tag-input:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -1px; }
.todo-edit .tag-input input[type="text"] { flex: 1 1 6rem; padding: 0.15rem 0.2rem; border: 0; background: none; outline: none; }
.tag-chip { display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.tag-chip span { opacity: 0.75; }
/* Hover says "this removes it" with a red ring around the chip (red on the × can't be read on a red or dark fill). */
.tag-chip:hover { border-color: var(--bg); box-shadow: 0 0 0 2px var(--danger); }
.tag-chip:hover span { opacity: 1; }
.todo-edit-field.todo-edit-tags { flex: none; } /* in the dialog's column, not the Time/Energy row */
.todo-edit-tags small { font-size: 0.8rem; }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-button:hover { background: var(--surface); color: var(--text); }
.icon-button:focus-visible { outline-offset: 0; color: var(--text); }
/* An icon carrying the button's hover text (icon_with_hint) fills the button, so the hover text shows anywhere on it. */
.icon-button:has(> .icon-hint) { padding: 0; }
.icon-hint { display: flex; padding: 0.35rem; }
.todo-check { color: var(--text); }
.todo-done .todo-check { color: var(--success); }

/* Your own order in Next and Focus (docs/ordering-design.md, todo_order_controller.js). Each part of a row is a grid
   cell. The handle starts a drag at once on touch screens too (touch-action), so the page scrolls only elsewhere on
   the row. Selected rows get a grey background and an accent bar on the left, so it doesn't depend on a slight
   color difference alone; dragged ones are lifted a little. */
.todo-cell { display: flex; }
.todo-handle { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.todo-handle .icon-hint { padding-inline: 0.15rem; }
.todo[role="row"] { padding-left: 0.4rem; } /* room for the selection bar, so it doesn't touch the handle */
.todo[role="row"] [data-cell="details"]:focus-visible { border-radius: 6px; }
.todo[aria-selected="true"] { background: var(--selected-bg); box-shadow: inset 3px 0 0 var(--accent); }
.todo-order-dragging, .todo-order-dragging * { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.todo-dragged { position: relative; z-index: 1; box-shadow: inset 3px 0 0 var(--accent), 0 2px 8px rgb(0 0 0 / 0.2); }

.todo-edit { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 0.75rem; }
.todo-edit input[type="text"] { min-width: 0; }
.todo-edit-title { display: flex; flex-direction: column; gap: 0.35rem; }
.todo-edit-title label { color: var(--muted); font-size: 0.9rem; }
/* Time and energy: side by side under the title, one under the other on a phone. */
.todo-edit-details { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.todo-edit-field { display: flex; flex-direction: column; gap: 0.35rem; flex: 1 1 12rem; min-width: 0; }
.todo-edit-field label { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 0.9rem; }
.todo-edit-field label .icon { width: 1rem; height: 1rem; }
/* Planned for and Due on: a text field (YYYY-MM-DD) with a calendar button after it. The button opens the picker of
   a date field that is there but not seen (date_field_controller.js); it sits under the button, so the picker opens
   there. The buttons that fill in a day sit under the field, small. */
.date-field { position: relative; display: flex; align-items: center; gap: 0.25rem; }
.date-field input[type="text"] { flex: 1; }
.date-field-button[hidden] { display: none; }
.date-field-picker { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.date-shortcuts { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.date-shortcuts[hidden] { display: none; }
.date-shortcuts button { padding: 0.1rem 0.6rem; font-size: 0.85rem; }
.todo-edit-dates-hint { margin-top: -0.35rem; font-size: 0.8rem; }
.todo-edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.todo-edit-actions .button-danger { margin-right: auto; }
.todo-edit .form-errors { margin: 0; }
.new-todo .form-errors { margin: 0 0 0.5rem; }
.form-errors p { margin: 0.45rem 0; }
.new-todo .field-error { margin-bottom: 0.25rem; }
/* The field with the error gets a red border, and a red focus ring while you're in it. */
:is(input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"], .notes-editor-invalid .notes-rich-content,
    .tag-input:has([aria-invalid="true"])) {
  border-color: var(--danger);
  outline-color: var(--danger);
}

/* Empty state only while there are no open todos; Done section only once something is done. */
.empty-state { margin: 0.75rem 0; }
.todos-pending:has(.todo) .empty-state { display: none; }
.todos-done:not(:has(.todo)) { display: none; }

/* The Planned tab: a heading per day; a day whose last to-do has left is hidden. */
.planned-day:not(:has(.todo)) { display: none; }
.planned-day + .planned-day { margin-top: 1.25rem; }
.planned-day-heading { margin: 0; padding: 0.25rem 0; border-bottom: 1px solid var(--border); font-size: 1rem; }
.planned-day-date { color: var(--muted); font-weight: 400; }
/* A due to-do's star can't be taken off (it stays in Focus). */
.todo-star[aria-disabled="true"] { cursor: default; }

.todos-done { margin-top: 1.5rem; }
.todos-done summary { cursor: pointer; color: var(--muted); padding: 0.25rem 0; }
.todos-done-all { margin: 0.5rem 0 0; font-size: 0.9rem; }

/* History: every done to-do, with its folder and when it was done at the right (on a phone under the title, like
   time and energy), and Newer and Older under the list. */
.history:has(.todo) .empty-state { display: none; }
.todo-done-facts { padding: 0 0.25rem; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.pages { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1rem; }
.pages [aria-disabled="true"] { opacity: 0.45; cursor: default; }

/* The to-do dialog (editing a to-do, lists/_todo_dialog). The header and the question about unsaved changes
   stay in view; the form in between scrolls. On phones it fills the screen. */

.todo-dialog {
  width: min(40rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.todo-dialog[open] { display: flex; }
.todo-dialog::backdrop { background: rgb(0 0 0 / 0.5); }
/* The page behind doesn't scroll while the dialog is open. */
html:has(.todo-dialog[open]) { overflow: hidden; }

.todo-dialog-content { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.todo-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
}
.todo-dialog-header h2 { margin: 0; font-size: 1.05rem; }
.todo-dialog-body { display: block; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 1rem; }
.todo-dialog form { max-width: none; margin: 0; }

.todo-dialog-discard {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.todo-dialog-discard[hidden] { display: none; }
.todo-dialog-discard p { flex: 1 1 12rem; margin: 0; font-weight: 600; }

@media (max-width: 30rem) {
  .todo-dialog { width: 100%; height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .todo-dialog-discard p { flex-basis: 100%; } /* the buttons together on the next line */
}

/* Settings */

.settings-section { margin-bottom: 1.5rem; padding-bottom: 1rem; }
.settings-section h2 { font-size: 1.15rem; }
/* Tags in Settings: a row per tag with its name to rename, the number of to-dos and Delete; on a phone the number
   and Delete go on a second line. */
.settings-tags { display: flex; flex-direction: column; gap: 0.9rem; margin: 0; padding: 0; list-style: none; }
.settings-tag { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.settings-tag form { margin: 0; }
.settings-tag form.settings-tag-colors { margin: 0.5rem 0 0.25rem; }
.settings-tag-form { flex: 1 1 16rem; max-width: 28rem; }
.settings-tag-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.settings-tag-row input[type="text"] { flex: 1 1 8rem; min-width: 0; }
.settings-tag-count { min-width: 4.5em; font-size: 0.9rem; white-space: nowrap; } /* the rows line up */
/* The tag's colour (docs/tag-colours-design.md): the tag as it looks in the lists opens the 16 colours under it,
   solid in the first row, pastel in the second; each is a button that saves. Open, it takes the whole line and the
   rest of the row goes under it. */
.settings-tag-color { flex: 0 0 9.5rem; } /* room for the longest name, so the fields line up */
.settings-tag-color[open] { flex-basis: 100%; }
.settings-tag-color summary { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.1rem; border-radius: 6px; color: var(--muted); cursor: pointer; list-style: none; }
.settings-tag-color summary::-webkit-details-marker { display: none; }
.settings-tag-color summary .icon { width: 0.9rem; height: 0.9rem; }
.settings-tag-color[open] summary .icon { transform: rotate(180deg); }
.settings-tag-color .todo-tag { font-size: 0.85rem; }
.settings-tag-colors { display: flex; flex-direction: column; gap: 0.5rem; max-width: none; margin: 0.5rem 0 0.25rem; }
.settings-tag-colors-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag-swatch {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  padding: 0.1rem 0.75rem;
  border-color: var(--tag-bg);
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}
.tag-swatch:hover { background: var(--tag-bg); border-color: var(--tag-line); }
.tag-swatch .icon { width: 0.9em; height: 0.9em; }
.tag-swatch[aria-current="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
/* Signed-in devices in Settings: a row per sign-in, Sign out at the right (below the details when it doesn't fit). */
.settings-devices { display: flex; flex-direction: column; gap: 0.9rem; margin: 0; padding: 0; list-style: none; }
.settings-device { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.settings-device form { margin: 0; }
.settings-device-details { flex: 1 1 16rem; min-width: 0; overflow-wrap: anywhere; }
.settings-device-facts { font-size: 0.9rem; }
/* A changed email address waiting for verification. */
/* Two-factor authentication: the QR code (black on white in both modes, as scanners expect), the key as text and
   the recovery codes. */
.qr-code { display: block; width: 100%; max-width: 13rem; height: auto; border: 1px solid var(--border); border-radius: 6px; }
.two-factor-key { font-size: 1.05rem; overflow-wrap: anywhere; }
.two-factor-setup h2 { font-size: 1.15rem; margin-top: 1.5rem; }
.two-factor-warning { color: var(--warning-text); }
.recovery-codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 0.4rem 2rem; padding: 0; list-style: none; font-size: 1.05rem; }
.remember-device { display: flex; align-items: baseline; gap: 0.5rem; }
.settings-device-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.recovery-code-instead { margin-bottom: 1rem; }
.recovery-code-instead summary { cursor: pointer; margin-bottom: 0.5rem; }
.pending-email-address { margin-top: 1.25rem; border-top: 1px solid var(--border); }
.field small { font-size: 0.85rem; }

/* Folders: Inbox, Next and Focus */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.list-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.list-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}
.list-tab:hover { color: var(--text); }
.list-tab-active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.list-tab-count {
  min-width: 1.4em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 400;
  text-align: center;
}

.todo-star:hover { color: var(--warning); }
.todo-starred .todo-star { color: var(--warning); }
.todo-starred .todo-star svg { fill: currentColor; }

.radio-group { border: 0; padding: 0; margin: 0 0 1rem; }
.radio-group legend { padding: 0; margin-bottom: 0.25rem; }
.radio-group label { display: flex; align-items: center; gap: 0.4rem; }

/* Narrow screens (phones): keep the header and folder tabs within the screen width. */
@media (max-width: 30rem) {
  .site-header, .site-footer { padding-inline: 0.75rem; }
  .site-header nav { gap: 0.5rem; }
  .site-header .brand { font-size: 1.5rem; } /* room for the icons, with the tagline still readable */
  /* "Beta" smaller and closer, so the admin header (most icons) fits on a 360 px wide phone */
  .site-header { gap: 0.5rem; }
  .brand-group { gap: 0.35rem; }
  .stage-label { font-size: 0.6rem; padding: 0.05rem 0.3rem; letter-spacing: 0.04em; }
  .admin-table .number-field { width: 4.5rem; } /* the table fits in its card */
  .account-name { /* on a phone only the person icon shows; screen readers still get the name */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  /* Four tabs share the width of a phone: the icon with the number next to it, the name under them. */
  .list-tabs { gap: 0; }
  .list-tab {
    flex: 1;
    display: grid;
    grid-template: "icon count" auto "name name" auto / auto auto;
    justify-content: center;
    justify-items: center;
    gap: 0.15rem 0.3rem;
    padding: 0.4rem 0.1rem;
    font-size: 0.85rem;
  }
  .list-tab > span:not(.list-tab-count) { grid-area: name; }
  /* The two tabs of Settings have no numbers and fit next to each other as they are. */
  .settings-tabs .list-tab { flex: none; display: inline-flex; gap: 0.4rem; padding: 0.5rem 0.75rem; font-size: 1rem; }
}

/* Password fields with a show/hide eye button */

.password-field { position: relative; display: flex; }
.password-field input { flex: 1; min-width: 0; padding-right: 2.5rem; }
.password-toggle[hidden] { display: none; }
.password-toggle { position: absolute; top: 50%; right: 0.25rem; transform: translateY(-50%); }
.password-toggle .password-toggle-hide,
.password-toggle[aria-pressed="true"] .password-toggle-show { display: none; }
.password-toggle[aria-pressed="true"] .password-toggle-hide { display: block; }

/* Notes: edited in the to-do's edit form */

.notes-editor { display: flex; flex-direction: column; gap: 0.35rem; }
.notes-editor-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.notes-editor-header label { color: var(--muted); font-size: 0.9rem; }

.notes-modes { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.notes-modes[hidden] { display: none; }
.notes-mode { border: 0; border-radius: 0; padding: 0.15rem 0.65rem; background: none; color: var(--muted); font-size: 0.85rem; }
.notes-mode + .notes-mode { border-left: 1px solid var(--border); }
.notes-mode[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; }
/* Inside the button: the group's overflow: hidden (for the rounded corners) would cut off a ring outside it. */
.notes-mode:focus-visible { outline-offset: -3px; border-radius: 6px; }

.notes-formatting { display: flex; flex-wrap: wrap; gap: 0.1rem; }
.notes-formatting[hidden] { display: none; }
.notes-formatting .icon-button { padding: 0.3rem; }
.notes-formatting .icon-button[aria-pressed="true"] { background: var(--surface); color: var(--accent); }
.notes-hint { margin: 0; font-size: 0.85rem; overflow-wrap: anywhere; }
.notes-counter { margin: 0; font-size: 0.85rem; text-align: right; font-variant-numeric: tabular-nums; }
.notes-counter-over { color: var(--danger); font-weight: 600; }

.notes-editor textarea, .notes-rich-content { min-height: 7.5rem; max-height: 60vh; }
.notes-editor textarea { resize: vertical; field-sizing: content; }
/* While the rich-text editor loads, hide the Markdown underneath it so it doesn't flash. */
.notes-editor[aria-busy="true"] textarea { visibility: hidden; }

.notes-rich-content {
  overflow-y: auto;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  overflow-wrap: anywhere;
}
.notes-preview {
  max-height: 40vh;
  overflow-y: auto;
  padding: 0.45rem 0.6rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--surface);
  overflow-wrap: anywhere;
}
.notes-preview-label { margin: 0 0 0.25rem; color: var(--muted); font-size: 0.8rem; }

.notes-rich-content p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  color: var(--muted);
  pointer-events: none;
}

/* Formatted notes (.formatted-notes) look the same in the list, the rich-text editor and the preview. */
.formatted-notes > :first-child { margin-top: 0; }
.formatted-notes > :last-child { margin-bottom: 0; }
.formatted-notes :is(p, ul, ol, blockquote, pre, table) { margin: 0.4em 0; }
.formatted-notes :is(h1, h2, h3, h4, h5, h6) { margin: 0.75em 0 0.25em; font-size: 1rem; }
.formatted-notes h1 { font-size: 1.2rem; }
.formatted-notes h2 { font-size: 1.1rem; }
.formatted-notes :is(ul, ol) { padding-left: 1.5em; }
.formatted-notes li > :is(p, ul, ol) { margin: 0; }
.formatted-notes blockquote { margin-left: 0; padding-left: 0.75em; border-left: 3px solid var(--border); color: var(--muted); }
.formatted-notes :is(code, pre) {
  border: 1px solid var(--border);
  background: var(--code-bg);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  font-size: 0.875em;
}
.formatted-notes code { padding: 0.1em 0.35em; border-radius: 4px; color: var(--code-text); }
.formatted-notes pre { padding: 0.5em 0.75em; border-radius: 6px; overflow-x: auto; overflow-wrap: normal; }
.formatted-notes pre code { padding: 0; border: 0; background: none; color: inherit; font-size: 1em; }
.formatted-notes hr { border: 0; border-top: 1px solid var(--border); }
.formatted-notes table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.formatted-notes :is(th, td) { padding: 0.25em 0.5em; border: 1px solid var(--border); }

/* Checklists: commonmarker renders <li><input type="checkbox">, Tiptap <ul data-type="taskList">. */
.formatted-notes li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1.3em; }
.formatted-notes li > input[type="checkbox"] { margin: 0 0.4em 0 0; vertical-align: -0.1em; }
.notes-rich-content ul[data-type="taskList"] { padding-left: 0.2em; list-style: none; }
.notes-rich-content ul[data-type="taskList"] li { display: flex; gap: 0.4em; }
.notes-rich-content ul[data-type="taskList"] li > label { display: flex; align-items: center; height: 1.5em; flex: none; }
.notes-rich-content ul[data-type="taskList"] li > label input { margin: 0; }
.notes-rich-content ul[data-type="taskList"] li > div { flex: 1; min-width: 0; }
.notes-rich-content ul[data-type="taskList"] li > div > :is(p, ul, ol) { margin: 0; }


/* Documentation (docs/documentation-design.md) */

.doc-index, .doc-page { max-width: 44rem; }
.doc-lead { font-size: 1.1rem; color: var(--muted); }
.doc-section h2 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
.doc-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.6rem; }
.doc-card { display: flex; flex-direction: column; gap: 0.15rem; height: 100%; box-sizing: border-box; padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; }
.doc-card:hover { border-color: var(--accent); }
.doc-card .muted { font-size: 0.9rem; }
.doc-section-name { margin: 0 0 -0.5rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.doc-toc { margin: 1rem 0 1.5rem; padding: 0.6rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.doc-toc p { margin: 0; font-size: 0.85rem; color: var(--muted); }
.doc-toc ol { margin: 0.25rem 0 0; padding-left: 1.25rem; }
.doc-body { line-height: 1.65; }
.doc-body h2 { font-size: 1.25rem; margin: 2rem 0 0.5rem; scroll-margin-top: 1rem; }
.doc-body h3 { font-size: 1.05rem; margin: 1.5rem 0 0.25rem; }
.doc-body blockquote { margin-left: 0; padding: 0.1rem 1rem; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 6px 6px 0; }
.doc-figure { margin: 1.25rem 0; }
.doc-shot { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; }
.doc-shot-dark { display: none; }
.doc-figure figcaption { margin-top: 0.4rem; color: var(--muted); font-size: 0.9rem; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .doc-shot-light { display: none; }
  :root:not([data-theme="light"]) .doc-shot-dark { display: block; }
}
:root[data-theme="dark"] .doc-shot-light { display: none; }
:root[data-theme="dark"] .doc-shot-dark { display: block; }
.doc-pager { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.5rem; }
.doc-pager a { flex: 1 1 14rem; display: flex; flex-direction: column; padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; }
.doc-pager a:hover { border-color: var(--accent); }
.doc-pager-next { text-align: right; margin-left: auto; }
.doc-pager .muted { font-size: 0.85rem; }
