/* Republika components that are not part of the comment layer. */
/* Select (select.js): one native select, hidden, keeps the value; it shows as a dropdown,
   a cycle or tabs, and every view of the same select follows it.
   Dropdown: a word with a chevron, no border, that opens a list in an overlay. */
.rk-dropdown {
  display: inline-flex; align-items: center; gap: 0.4em; font: inherit; font-weight: 600; color: var(--muted);
  border: 0; border-radius: 99rem; background: transparent; cursor: pointer; white-space: nowrap;
  padding: var(--space-3xs) var(--space-2xs); transition: color 120ms, background-color 120ms;
}
.rk-dropdown:hover, .rk-dropdown[aria-expanded="true"] { color: var(--fg); background-color: color-mix(in oklch, var(--line) 60%, transparent); }
.rk-dropdown:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rk-dropdown:disabled { opacity: 0.5; cursor: default; }
.rk-dropdown svg { width: 0.7em; height: 0.7em; color: var(--faint); transition: rotate 150ms; }
.rk-dropdown[aria-expanded="true"] svg { rotate: 180deg; }
.rk-menu {
  inset: auto; margin: 0; border: 0; box-sizing: border-box; outline: 0; overflow-y: auto;
  max-height: min(20rem, 50vh); max-width: calc(100vw - 1rem); padding: var(--space-3xs);
  border-radius: 1.25rem; background: var(--overlay); color: var(--fg);
  box-shadow: 0 0.5rem 2rem oklch(0 0 0 / 0.08), 0 0 0 1px color-mix(in oklch, var(--line) 70%, transparent);
  font-size: var(--step--1);
  opacity: 0; scale: 0.97; transform-origin: top left;
  transition: opacity 120ms, scale 120ms, display 120ms allow-discrete, overlay 120ms allow-discrete;
}
.rk-menu:popover-open { opacity: 1; scale: 1; }
@starting-style { .rk-menu:popover-open { opacity: 0; scale: 0.97; } }
.rk-option {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-s);
  padding: var(--space-3xs) var(--space-xs); border-radius: 0.9rem; cursor: pointer; white-space: nowrap;
}
.rk-option.rk-active { background: var(--line); }
.rk-option[aria-selected="true"] { font-weight: 600; }
.rk-option svg { width: 1em; height: 1em; color: var(--accent); visibility: hidden; }
.rk-option[aria-selected="true"] svg { visibility: visible; }
.rk-option[aria-disabled="true"] { color: var(--faint); cursor: default; }

/* Cycle: one word that shows the current value; a click moves to the next one.
   Looks like the dropdown's word without the chevron. */
.rk-cycle {
  font: inherit; font-weight: 600; color: var(--muted); border: 0; border-radius: 99rem; cursor: pointer;
  padding: var(--space-3xs) var(--space-2xs); background: transparent; white-space: nowrap;
}
.rk-cycle:hover { color: var(--fg); background: color-mix(in oklch, var(--line) 60%, transparent); }
.rk-cycle:disabled { opacity: 0.5; cursor: default; }

/* Tabs: every value as a word in a row, gray until chosen, like the page's tabs (4.1).
   Sizes: s at --step--1, m (default) at --step-0 semibold like subtabs, l at --step-2 bold
   like main tabs. One line that scrolls sideways and snaps to a tab; data-wrap wraps it instead. */
.rk-tabs {
  display: inline-flex; max-width: 100%; gap: var(--space-s); overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain; white-space: nowrap; font-size: var(--step-0); font-weight: 600;
}
.rk-tabs[data-size="s"] { gap: var(--space-xs); font-size: var(--step--1); }
.rk-tabs[data-size="l"] { gap: var(--space-m); font-size: var(--step-2); font-weight: 700; letter-spacing: -0.025em; }
.rk-tab { scroll-snap-align: start; font: inherit; border: 0; padding: 0; background: transparent; color: var(--faint); transition: color 120ms; }
.rk-tab:not(:disabled):hover { color: var(--muted); }
.rk-tab[aria-checked="true"] { color: var(--fg); }
.rk-tab:disabled { opacity: 0.5; cursor: default; }
.rk-cycle:focus-visible, .rk-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rk-tab:focus-visible { border-radius: 0.4rem; }
/* Page tabs (4.1): the same row of links, nav.rk-tabs; the current one carries aria-selected or
   aria-current. A count sits beside its label in --muted (an option's data-count in the select). */
.rk-tabs > a { flex: none; color: var(--faint); text-decoration: none; transition: color 120ms; scroll-snap-align: start; }
.rk-tabs > a:hover { color: var(--muted); }
.rk-tabs > a:is([aria-selected="true"], [aria-current]) { color: var(--fg); }
nav.rk-tabs { display: flex; }
.rk-tabs small { margin-left: 0.25em; font-size: inherit; font-weight: inherit; color: var(--muted); }
.rk-tab:not([aria-checked="true"]) small { color: inherit; }
/* data-wrap: the row wraps onto more lines instead of scrolling (a long filter row, the preview's subtabs). */
.rk-tabs[data-wrap] { flex-wrap: wrap; row-gap: var(--space-3xs); white-space: normal; overflow: visible; scroll-snap-type: none; }
.rk-tabs[data-wrap] > * { white-space: nowrap; }

/* Search (search.js): a pill on the row fill (4.3), no border, a magnifier on the left.
   The icon is a mid gray that reads in both modes (a data URI cannot take a token). */
.rk-search {
  box-sizing: border-box; display: block; width: 100%; max-width: 24rem; margin: 0;
  font: inherit; color: var(--fg); border: 0; border-radius: 99rem; outline: 0;
  padding: var(--space-3xs) var(--space-s) var(--space-3xs) calc(var(--space-s) + 1.1em);
  background: color-mix(in oklch, var(--line) 60%, transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8c8c' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5L20 20'/%3E%3C/svg%3E") no-repeat left var(--space-xs) center / 1em;
  transition: background-color 120ms;
}
.rk-search::placeholder { color: var(--muted); }
.rk-search:hover { background-color: var(--line); }
/* Focus inverts, like the person's chat bubble: --fg fill, --bg text, no ring. */
.rk-search:focus { background-color: var(--fg); color: var(--bg); }
.rk-search:focus::placeholder { color: color-mix(in oklch, var(--bg) 60%, transparent); }
.rk-search::-webkit-search-decoration { -webkit-appearance: none; }
[data-search-empty] { color: var(--muted); }
/* Hidden means hidden, whatever display a class gives the item. */
:is([data-searching] [hidden], [data-search-empty][hidden]) { display: none !important; }

/* Bottom-up scroller: column-reverse around one child in reading order, so the scroll starts
   at the bottom and stays there; content that grows pushes the old part out at the top.
   The conversation's messages use it; a toast stack with data-up takes the same direction. */
:is(.rk-bottom-up, .rk-toasts[data-up]) { display: flex; flex-direction: column-reverse; }
.rk-bottom-up { overflow-y: auto; overscroll-behavior: contain; }

/* Toasts (toast.js): top right, newest on top. toast.js sets each one's --y, --s (scale),
   --h (height) and --o (opacity); folded, the older ones shrink and peek out below. */
.rk-toasts {
  position: fixed; z-index: 40; top: var(--space-s); right: var(--space-s);
  width: min(22rem, calc(100vw - 2 * var(--space-s))); transition: height 250ms ease;
  max-height: calc(100dvh - 2 * var(--space-s));
}
.rk-toasts[data-open] { overflow-y: auto; overscroll-behavior: contain; }
.rk-toast {
  position: absolute; inset: 0 0 auto; height: var(--h); overflow: hidden;
  border-radius: 1.25rem; background: var(--overlay); box-shadow: 0 0.5rem 2rem oklch(0 0 0 / 0.08);
  transform: translateY(var(--y)) scale(var(--s)); transform-origin: top center; opacity: var(--o);
  transition: transform 250ms ease, height 250ms ease, opacity 250ms ease;
}
.rk-toast[data-in] { transform: translateY(calc(var(--y) - 1rem)) scale(var(--s)); opacity: 0; transition: none; }
.rk-toast[data-out] { transform: translateX(110%) scale(var(--s)); opacity: 0; }
/* data-up (a stack in a bottom corner): anchored at the bottom, --y counts upwards; older ones
   shrink towards the top, new ones rise in. :where keeps [data-out] above it. */
:where(.rk-toasts[data-up]) .rk-toast { inset: auto 0 0; transform: translateY(calc(-1 * var(--y))) scale(var(--s)); transform-origin: bottom center; }
:where(.rk-toasts[data-up]) .rk-toast[data-in] { transform: translateY(calc(1rem - var(--y))) scale(var(--s)); }
/* The toasts are absolute, so their overflow at the top does not scroll: an in-flow spacer as
   tall as the list (--t, from toast.js) gives the open stack its scroll range. */
.rk-toasts[data-up]::before { content: ""; flex: none; height: var(--t, 0); }
.rk-toast-in { display: flex; align-items: flex-start; gap: var(--space-2xs); padding: var(--space-xs) var(--space-s); font-size: var(--step--1); transition: opacity 250ms ease; }
.rk-toast[data-behind] .rk-toast-in { opacity: 0; }
.rk-toast-text { flex: 1; min-width: 0; }
.rk-toast-text b { display: block; }
.rk-toast-text b + p { color: var(--muted); }
.rk-toast-x { flex: none; width: 1.6rem; height: 1.6rem; margin: -0.2rem -0.5rem 0 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 150ms; }
.rk-toast:hover .rk-toast-x, .rk-toast-x:focus-visible { opacity: 1; }
.rk-toast-x:hover { background: var(--line); color: var(--fg); }
@media (hover: none) { .rk-toast-x { opacity: 1; } }
/* Static toasts in the page (preview): same look, no positioning by toast.js. */
.rk-toast-list { display: flex; flex-direction: column; gap: 8px; width: min(22rem, 100%); }
.rk-toast-list .rk-toast { position: static; height: auto; transform: none; opacity: 1; }
@media (max-width: 700px) { .rk-toasts { left: var(--space-s); width: auto; } }
@media (prefers-reduced-motion: reduce) { .rk-toasts, .rk-toast, .rk-toast-in { transition-duration: 1ms; } }

/* Embed (embed.js): an iframe rendered at one size and scaled into its box. embed.js sets the
   iframe's size, offset and scale; the box clips it. Faint fill while the page loads. */
.rk-embed {
  position: relative; overflow: hidden; aspect-ratio: 16 / 10; border-radius: var(--radius);
  background: color-mix(in oklch, var(--line) 50%, transparent);
}
.rk-embed > iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: var(--bg); }
/* data-resizable: drag the corner; the frame ignores the pointer while dragged, so it stays here. */
.rk-embed[data-resizable] { resize: both; max-width: 100%; min-width: 4rem; min-height: 4rem; }
.rk-embed[data-resizable]:active > iframe { pointer-events: none; }

/* Overlay styles under consideration (preview only; B is .rk-float):
   solid or frosted, each plain or inverted. Inverted flips color-scheme on the overlay,
   so every token inside (fill, text, field, button, accent) takes the other mode. */
.rk-ov-gray { background: var(--overlay); box-shadow: 0 0.5rem 2rem oklch(0 0 0 / 0.08); }
.rk-ov-glass { background: color-mix(in oklch, light-dark(oklch(0.995 0 0), oklch(0.26 0 0)) 55%, transparent); backdrop-filter: blur(1rem) saturate(1.4); -webkit-backdrop-filter: blur(1rem) saturate(1.4); box-shadow: 0 0.5rem 2rem oklch(0 0 0 / 0.06); }
/* Accent: a shine in the top-left corner, strong at the very corner and gone a quarter of the way in,
   over either fill. Declared after both, so their background shorthand does not reset it. */
.rk-ov-accent { background-image: linear-gradient(135deg, color-mix(in oklch, var(--accent) 55%, transparent), color-mix(in oklch, var(--accent) 18%, transparent) 8%, transparent 25%); }
/* .rk-ov-inv shares its color-scheme flip with .rk-float, in comments.css. */

/* Accent sliders: native ranges whose track (--track, one of the --hue-track,
   --lightness-track, --chroma-track that accent.js sets) shows each one's whole range for
   the current mode; --mark (--hue-mark, …) lies on top, fading what falls short of the level
   with a line at the threshold. A small round thumb in the accent, compact: a thin track, 1.25rem tall in all. No border, no ticks, no value box. */
.rk-range { appearance: none; -webkit-appearance: none; width: 100%; height: 1.25rem; margin: 0; background: transparent; cursor: pointer; }
.rk-range::-webkit-slider-runnable-track { height: 0.375rem; border-radius: 99rem; background: var(--mark, none), var(--track); }
.rk-range::-moz-range-track { height: 0.375rem; border-radius: 99rem; background: var(--mark, none), var(--track); }
.rk-range::-webkit-slider-thumb { -webkit-appearance: none; width: 1rem; height: 1rem; margin-top: -0.3125rem; border: 0; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0.15rem var(--bg); transition: transform 150ms; }
.rk-range::-moz-range-thumb { width: 1rem; height: 1rem; border: 0; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0.15rem var(--bg); transition: transform 150ms; }
.rk-range:active::-webkit-slider-thumb { transform: scale(1.2); }
.rk-range:active::-moz-range-thumb { transform: scale(1.2); }

/* Rows (4.3): label left, value right, on --line at 50%. The value is semibold. */
.rk-items { display: flex; flex-direction: column; gap: var(--space-3xs); margin: 0; padding: 0; list-style: none; }
.rk-item { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-s); border-radius: var(--radius); padding: var(--space-xs) var(--space-s); background: color-mix(in oklch, var(--line) 50%, transparent); }
.rk-item > :last-child:not(:first-child) { flex: none; font-weight: 600; text-align: right; white-space: nowrap; }

/* Buttons (4.4): a pill, secondary on --line; data-kind="primary" (--fg) or "accent". Plain: text
   only. A tag: a small --line pill that never looks clickable. */
.rk-button { display: inline-flex; align-items: center; gap: var(--space-3xs); font: inherit; font-weight: 600; line-height: 1.5; border: 0; border-radius: 99rem; padding: var(--space-2xs) var(--space-m); background: var(--line); color: var(--fg); transition: opacity 150ms; }
.rk-button[data-kind="primary"] { background: var(--fg); color: var(--bg); }
.rk-button[data-kind="accent"] { background: var(--accent); color: var(--on-accent); }
.rk-button:not(:disabled):hover { opacity: 0.85; }
.rk-button:disabled { opacity: 0.5; }
.rk-plain { font: inherit; font-weight: 600; border: 0; background: none; color: var(--muted); opacity: 0.7; cursor: pointer; padding: 0; }
.rk-plain:hover { opacity: 1; }
.rk-tag + .rk-tag { margin-left: var(--space-3xs); }
.rk-tag:empty { display: none; }
/* Status chips: a faint fill and a dark (light in dark mode) text of the same hue. */
.rk-tag[data-status] { --h: 0; --c: 0; font-weight: 700; background: light-dark(oklch(0.94 calc(var(--c) * 0.3) var(--h)), oklch(0.3 calc(var(--c) * 0.4) var(--h))); color: light-dark(oklch(0.36 var(--c) var(--h)), oklch(0.9 calc(var(--c) * 0.6) var(--h))); }
.rk-tag[data-status="review"] { --h: var(--accent-h); --c: 0.15; }
.rk-tag[data-status="ready"] { --h: 150; --c: 0.12; }
.rk-tag[data-status="working"] { --h: 75; --c: 0.12; }
.rk-tag { display: inline-block; border-radius: 99rem; padding: 0 var(--space-2xs); background: var(--line); font-size: var(--step--1); font-weight: 400; color: var(--fg); }

/* Buttons: Tailwind's preflight leaves the arrow cursor on <button>; every enabled button
   gets the pointer. Filled pills (primary, accent, secondary) fade to 85% on hover, which
   reads in both modes: a dark pill lightens on a light page, a light pill darkens on a dark one. */
button:not(:disabled) { cursor: pointer; }
button.rounded-full, .rk-send { transition: opacity 150ms; }
button.rounded-full:not(:disabled):hover, .rk-send:hover { opacity: 0.85; }

/* Message box (message-box.js, 4.5): the field, the files under it, then one row: the clip and
   the mic on the left, Send on the right. */
.rk-box { display: flex; flex-direction: column; gap: var(--space-2xs); }
/* What a box's message is about (context): a tag pill above the text; × sends without it. */
.rk-ctx { display: inline-flex; align-self: flex-start; align-items: center; gap: var(--space-3xs); border-radius: 99rem; background: var(--line); padding: 0 var(--space-2xs); font-size: var(--step--1); }
.rk-ctx button { display: grid; border: 0; background: none; padding: 0; color: var(--muted); }
.rk-box textarea {
  font: inherit; font-size: var(--step--1); color: inherit; resize: none; border: 0; outline: 0;
  border-radius: 1.25rem; padding: var(--space-2xs) var(--space-s); background: var(--bg);
  /* Empty, exactly one line; the script grows it from here. */
  line-height: 1.5; height: calc(1lh + 2 * var(--space-2xs));
  max-height: 40vh; overflow-x: hidden; overflow-y: auto; box-sizing: border-box;
}
/* Touch screens: at least 16px, or iOS zooms in on focus. */
@media (pointer: coarse) { .rk-box textarea { font-size: max(var(--step--1), 16px); } }
/* Attached files: tiles under the text (in the box, each with a round ×) and under a sent
   message. A 2.25rem square (the image, or the extension on --line), then the name and a
   faint line: kind and size, line count, or in red why it is not sent. */
.rk-chips { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.rk-chips:empty { display: none; }
.rk-file { display: inline-flex; align-items: center; gap: var(--space-2xs); max-width: 16rem; padding: var(--space-3xs); padding-right: var(--space-xs); border-radius: 0.75rem; background: var(--bg); font-size: var(--step--1); font-weight: 400; white-space: normal; }
.rk-file > img, .rk-file-ext { flex: none; width: 2.25rem; height: 2.25rem; border-radius: 0.5rem; }
.rk-file > img { object-fit: cover; }
.rk-file-ext { display: grid; place-items: center; background: var(--line); color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em; }
.rk-file-words { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rk-file-words b { font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-file-words small { font-size: inherit; color: var(--faint); }
.rk-file[data-bad] small { color: var(--red); }
.rk-file-flip { display: inline-flex; align-items: center; gap: var(--space-2xs); min-width: 0; padding: 0; border: 0; border-radius: 0.5rem; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.rk-file[data-plain] { background: color-mix(in oklch, var(--red) 12%, var(--bg)); }
.rk-file[data-plain] small { color: var(--red); }
.rk-file-x { flex: none; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-left: auto; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.rk-file-x:hover { background: var(--line); color: var(--fg); }
.rk-file-x svg { width: 0.9rem; height: 0.9rem; }
/* Images in a message: thumbnails under its text, at most 6rem tall. */
.rk-thumbs { display: flex; flex-wrap: wrap; gap: var(--space-2xs); margin-top: var(--space-2xs); }
.rk-thumb { max-height: 6rem; max-width: 100%; border-radius: 0.75rem; }
/* Drop state: files dragged over a box or a conversation tint it in the accent, the tint
   reaching past its edge, with a hairline accent ring around that. */
.rk-box[data-drag] {
  --rk-drop: color-mix(in oklch, var(--accent) 12%, transparent);
  border-radius: 1rem; background-color: var(--rk-drop);
  box-shadow: 0 0 0 var(--space-xs) var(--rk-drop), 0 0 0 calc(var(--space-xs) + 0.5px) var(--accent);
}
.rk-row { display: flex; align-items: center; gap: var(--space-2xs); }
.rk-row .rk-send { margin-left: auto; }
.rk-row .rk-dropdown, .rk-row > .rk-plain { font-size: var(--step--1); }
/* A dropdown in the row (the dictation language) goes right, beside Send. */
.rk-row .rk-dropdown { margin-left: auto; }
.rk-row .rk-dropdown ~ .rk-dropdown { margin-left: 0; }
.rk-row .rk-dropdown + .rk-send { margin-left: 0; }
/* Narrow: a dropdown's word gives way with an ellipsis, so Send never leaves the box. */
.rk-row .rk-dropdown { min-width: 0; }
.rk-row .rk-dropdown > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rk-send { display: inline-flex; align-items: center; gap: var(--space-3xs); font: inherit; font-size: var(--step--1); font-weight: 600; line-height: 1.5; border: 0; border-radius: 99rem; padding: var(--space-3xs) var(--space-s); background: var(--fg); color: var(--bg); white-space: nowrap; cursor: pointer; }
.rk-send svg { flex: none; }
/* A box's Send with nothing to send: the same grey as a choices form's. */
.rk-box .rk-send:disabled { background: var(--line); color: var(--fg); opacity: 0.5; cursor: default; }
/* Enter's ↵ (Send in a box): grey, full only where Enter acts now, the box whose textarea has
   focus. At most one of all those shown. */
.rk-enter { flex: none; opacity: 0.4; transition: opacity 150ms; }
.rk-box:has(> textarea:focus) .rk-enter { opacity: 1; }
.rk-mic { flex: none; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border: 0; border-radius: 50%; background: var(--bg); color: var(--muted); cursor: pointer; }
.rk-mic[data-on] { color: var(--red); }
/* Files dragged over the page: the whole viewport takes the drop tint, ringed in the accent,
   with "Attach to chat" in the middle. A manual popover, so it sits above an open panel too;
   it lets the drag through, so a box under the pointer still lights up its own zone. The open
   box sits in a hole of it (message-box.js sets its clip-path), out of the blur. */
.rk-dropall {
  inset: 0; width: auto; height: auto; margin: 0; padding: var(--space-l); border: 0; color: var(--fg);
  place-items: center; pointer-events: none;
  background: color-mix(in oklch, var(--bg) 60%, transparent); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.rk-dropall:popover-open { position: fixed; display: grid; }
/* The design page's variants, drawn in a frame instead of the viewport. */
.rk-dropall[data-demo] { position: absolute; display: grid; border-radius: inherit; }
.rk-drop-card {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3xs); text-align: center;
  padding: var(--space-m) var(--space-l); border-radius: 1.25rem; background: var(--bg);
  border: 2px dashed var(--accent); box-shadow: 0 1rem 3rem oklch(0 0 0 / 0.12);
}
.rk-drop-card svg { width: 1.5rem; height: 1.5rem; color: var(--accent); }
.rk-drop-card small { color: var(--muted); font-size: var(--step--1); }
/* Variant bar: a pill low in the middle, the page only softened. */
.rk-dropall[data-look="bar"] { place-items: end center; background: color-mix(in oklch, var(--bg) 30%, transparent); }
.rk-dropall[data-look="bar"] .rk-drop-card { flex-direction: row; border-style: solid; border-radius: 99rem; padding: var(--space-2xs) var(--space-m); }
.rk-dropall[data-look="bar"] .rk-drop-card small { display: none; }
/* Variant edge: the page blurred, not tinted, an accent ring and a small accent pill at the top. */
.rk-dropall[data-look="edge"] { place-items: start center; background: none; box-shadow: inset 0 0 0 3px var(--accent); }
.rk-dropall[data-look="edge"] .rk-drop-card { flex-direction: row; padding: var(--space-3xs) var(--space-s); border: 0; border-radius: 99rem; background: var(--accent); color: var(--on-accent); }
.rk-dropall[data-look="edge"] .rk-drop-card :is(svg, small) { color: inherit; }
.rk-dropall[data-look="edge"] .rk-drop-card small { display: none; }

/* Conversation (chat.js, 4.24): the messages over the box; head and box fixed, the messages
   between them scroll. */
.rk-thread { flex: 1 1 auto; min-height: 0; --rk-surface: var(--overlay); }
.rk-thread > .rk-row, .rk-thread > .rk-box { flex: none; }
/* Its follow-up box one --bg pill: the field and its buttons on the same fill, the round
   buttons on --line at 50%. */
.rk-thread > .rk-box { padding: var(--space-3xs); border-radius: 1.4rem; background: var(--bg); }
.rk-thread > .rk-box textarea { background: none; }
.rk-thread > .rk-box .rk-mic { background: color-mix(in oklch, var(--line) 50%, transparent); }
.rk-msgs { flex: 1 1 auto; min-height: 0; }
/* Integrated (ask/show with into): in the host's content, no chrome; it grows in place up to
   85dvh or what the host gives it, then the messages scroll, never the host (Jan, 2026-11-01). */
.rk-thread.rk-inline { flex: 0 1 auto; max-height: 85dvh; width: 100%; max-width: 38rem; font-size: var(--step--1); --rk-surface: var(--bg); }
.rk-inline:not([data-running]) > .rk-msgs:has(> .rk-msgs-list:empty) { display: none; }
/* Its scrollbar is thin and shows only while the pointer is over the messages; touch shows its own. */
.rk-msgs { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.rk-msgs:hover { scrollbar-color: var(--line) transparent; }
/* Overlay scrollbars take no room, so the bubbles keep clear of the bar by padding; the negative
   margin keeps them in line with the head and the follow-up box, the bar in the host's edge. */
.rk-msgs { padding-right: var(--space-xs); margin-right: calc(-1 * var(--space-xs)); }
.rk-msg .rk-chips { margin-top: var(--space-2xs); }
/* Message bubbles, compact and refined (Jan, 2026-10-28): --step--1, Jan's on the right solid
   in --fg (inverted), the agent's on the left on --line at 50%. A run of one speaker's
   bubbles sits 2px apart with its inner corners pinched, like one block; a change of
   speaker gets 3xs more. Fills only, never an outline. */
.rk-msgs-list { display: flex; flex-direction: column; gap: 0.125rem; font-size: var(--step--1); }
.rk-msg { margin: 0; max-width: min(88%, 46rem); box-sizing: border-box; padding: var(--space-3xs) var(--space-xs); border-radius: 0.85rem; line-height: 1.3; overflow-wrap: anywhere; }
.rk-msg[data-who="you"] { align-self: flex-end; white-space: pre-wrap; background: var(--fg); color: var(--bg); border-bottom-right-radius: 0.25rem; }
.rk-msg[data-who="reply"] { align-self: flex-start; background: color-mix(in oklch, var(--line) 50%, transparent); border-bottom-left-radius: 0.25rem; }
.rk-msg[data-who="you"] + .rk-msg[data-who="you"] { border-top-right-radius: 0.25rem; }
.rk-msg[data-who="reply"] + .rk-msg[data-who="reply"] { border-top-left-radius: 0.25rem; }
.rk-msg[data-who="you"] + .rk-msg[data-who="reply"], .rk-msg[data-who="reply"] + .rk-msg[data-who="you"] { margin-top: var(--space-3xs); }
.rk-msg > * { margin: 0 0 var(--space-3xs); }
.rk-msg > :last-child { margin-bottom: 0; }
.rk-msg ul, .rk-msg ol { padding-left: 1.2em; }
.rk-msg :is(code, pre) { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.rk-msg code { font-size: 0.9em; padding: 0.05em 0.3em; border-radius: 0.3em; background: color-mix(in oklch, var(--line) 60%, transparent); }
.rk-msg pre { overflow-x: auto; padding: var(--space-2xs) var(--space-xs); border-radius: 0.75rem; background: color-mix(in oklch, var(--line) 60%, transparent); }
.rk-msg pre code { padding: 0; background: none; }
.rk-msg[data-who="reply"] :is(code, pre) { background: var(--bg); }
.rk-msg pre { border-radius: 0.5rem; }
.rk-msg :is(h1, h2, h3, h4, h5, h6) { font-size: inherit; font-weight: 700; }
.rk-msg table { display: block; overflow-x: auto; }
/* Not the message's overflow-wrap: anywhere, which shrinks a table's min-content and breaks its
   cells mid-word; a table too wide scrolls. */
.rk-msg :is(th, td) { overflow-wrap: normal; }
.rk-msg table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rk-msg :is(th, td) { padding: var(--space-3xs) var(--space-xs); border-bottom: 1px solid color-mix(in oklch, var(--line) 80%, transparent); text-align: left; vertical-align: top; }
.rk-msg th { font-weight: 600; border-bottom-color: var(--muted); }
.rk-msg [align="right"] { text-align: right; }
.rk-msg [align="center"] { text-align: center; }
.rk-msg tr:last-child td { border-bottom: 0; }
.rk-msg :is(th, td):first-child { padding-left: 0; }
/* Copy: a small icon after each message, faint until the message is hovered (always on touch). */
.rk-msg > .rk-copy { display: inline-grid; place-items: center; vertical-align: middle; width: 1.3rem; height: 1.3rem; margin: 0 0 0 var(--space-3xs); border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity 150ms ease; }
.rk-msg:hover > .rk-copy, .rk-copy:focus-visible { opacity: 0.7; }
.rk-msg > .rk-copy:hover { opacity: 1; background: var(--bg); }
/* On the person's bubble, Edit and Copy sit outside it, to its left at its foot, Copy nearest. */
.rk-msg[data-who="you"] { position: relative; }
.rk-msg[data-who="you"] > .rk-copy { position: absolute; bottom: 0; right: calc(100% + var(--space-3xs)); margin: 0; }
.rk-msg[data-who="you"] > .rk-copy ~ .rk-copy { right: calc(100% + 2 * var(--space-3xs) + 1.3rem); }
@media (hover: none) { .rk-msg > .rk-copy { opacity: 0.7; } }
/* The full date over a time (time.js), floated by float.js; it never takes the pointer. */
.rk-tip { z-index: 1000; padding: var(--space-3xs) var(--space-2xs); border-radius: var(--space-2xs); background: var(--overlay); box-shadow: 0 0.25rem 1rem oklch(0 0 0 / 0.1), 0 0 0 1px color-mix(in oklch, var(--line) 70%, transparent); font-size: var(--step--1); white-space: nowrap; pointer-events: none; }
/* Its time: how long ago, small and faint, at the right end of the last line (the next line when
   that one is full); the full date and time on hover. A reply's last paragraph runs inline so the
   time can sit beside it, and the bubble holds the float. */
.rk-msg { display: flow-root; }
.rk-msg > p:has(+ .rk-when) { display: inline; }
.rk-msg > .rk-when { float: right; margin-left: var(--space-2xs); padding-top: 0.15em; font-size: var(--step--2); white-space: nowrap; opacity: 0.55; cursor: default; }
/* While a reply is written: a reply bubble with the dots and the seconds so far. */
.rk-typing { padding-block: var(--space-3xs); display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: var(--space-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.rk-typing > * { margin: 0; }
.rk-typing-label { white-space: nowrap; }
/* The reply being written, as it streams in (chat.js live); none until its first words. */
.rk-streaming[hidden] { display: none; }
/* The spinner (Jan, 2026-10-28): a short line, --muted at 25%, with a little light in it
   bouncing left and right (a solid --fg segment, no gradient; swift easing, 0.75s a way); under reduced motion it rests
   in the middle. Drawn from its one <i>. */
.rk-dots { position: relative; display: inline-block; width: 1.75rem; height: 2px; border-radius: 1px; background: color-mix(in oklch, currentColor 25%, transparent); overflow: hidden; }
:where(.rk-dots i:first-child) { display: block; position: absolute; inset: 0 auto 0 0; width: 40%; border-radius: inherit; background: var(--fg); animation: rk-glint 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate; }
@keyframes rk-glint { from { translate: 0; } to { translate: 150%; } }
/* Spinners side by side, or one per board row, in a series of 5 spread evenly over the 1.5s round trip. Negative, so none waits at the start. */
:is(.rk-dots:nth-child(5n+2 of .rk-dots), .rk-job:nth-child(5n+2 of :has(> .rk-row > .rk-dots)) > .rk-row > .rk-dots) > i:first-child { animation-delay: -1.2s; }
:is(.rk-dots:nth-child(5n+3 of .rk-dots), .rk-job:nth-child(5n+3 of :has(> .rk-row > .rk-dots)) > .rk-row > .rk-dots) > i:first-child { animation-delay: -0.9s; }
:is(.rk-dots:nth-child(5n+4 of .rk-dots), .rk-job:nth-child(5n+4 of :has(> .rk-row > .rk-dots)) > .rk-row > .rk-dots) > i:first-child { animation-delay: -0.6s; }
:is(.rk-dots:nth-child(5n of .rk-dots), .rk-job:nth-child(5n of :has(> .rk-row > .rk-dots)) > .rk-row > .rk-dots) > i:first-child { animation-delay: -0.3s; }
@media (prefers-reduced-motion: reduce) { :where(.rk-dots i:first-child) { animation: none; translate: 75%; } }
/* Who wrote a message, where several do (a feedback backend's threads). */
.rk-author { display: block; color: var(--muted); font-size: 0.8em; margin-bottom: 0.2em; }
/* Eisenhower matrix (matrix.js): dots on time (x) against importance (y). The plot has no fill
   and no border; the importance split (golden ratio) and the horizon starts are --line rules. Dots take the item's --dot colour (default --fg), fade with
   importance (--fade), and keep a --bg ring so they stand apart. Narrow boxes (.rk-mx-narrow,
   under 600px) show three horizons and swipe on the date strip. */
.rk-matrix { display: grid; grid-template-columns: 2rem 1fr; gap: var(--space-3xs) var(--space-2xs); font-size: var(--step--2); container-type: inline-size; }
.rk-mx-ticks { position: relative; height: 2.5rem; color: var(--muted); }
.rk-mx-ticks span { position: absolute; white-space: nowrap; line-height: 1.3; }
.rk-mx-side { display: flex; flex-direction: column; align-items: center; gap: var(--space-3xs); padding-top: var(--space-2xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.rk-mx-side b { writing-mode: vertical-rl; rotate: 180deg; font-weight: 600; }
.rk-mx-plot {
  /* 16:10 of the plot column (100cqw less the 2rem side and the gap), capped at --rk-mx-max
     (a host sets it, the plan 70vh) without getting narrower than the ticks. */
  position: relative; height: min(var(--rk-mx-max, 100vh), (100cqw - 2rem - var(--space-2xs)) * 10 / 16); display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1.618fr 1fr;
  touch-action: none;
}
.rk-mx-q { padding: var(--space-2xs) var(--space-xs); font-weight: 600; color: var(--muted); transition: opacity 150ms; }
.rk-mx-mid { position: absolute; left: 0; right: 0; top: 61.8%; border-top: 1px solid var(--line); pointer-events: none; }
.rk-mx-line { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--faint); pointer-events: none; transition: opacity 150ms; }
.rk-mx-focus .rk-mx-q, .rk-mx-focus .rk-mx-line { opacity: 0.4; }
.rk-mx-dot {
  --dot: var(--fg); position: absolute; transform: translate(-50%, -50%); width: 14px; height: 14px; padding: 0;
  border: 2px solid var(--bg); border-radius: 50%; background: var(--dot); color: var(--fg); font: inherit; cursor: grab;
  opacity: var(--fade, 1); touch-action: none; user-select: none;
}
.rk-mx-dot::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; } /* a 2rem hit target */
.rk-mx-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rk-mx-dot span {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: margin-top 0.3s ease;
  padding: 0 4px; border-radius: 0.375rem; /* frosted: a blurred --bg pane, so labels over lines and dots stay readable */
  background: color-mix(in oklch, var(--bg) 65%, transparent); backdrop-filter: blur(4px) saturate(1.4); -webkit-backdrop-filter: blur(4px) saturate(1.4);
}
.rk-mx-dot:is([data-place="br"], [data-place="tr"]) span { left: -6px; transform: none; }
.rk-mx-dot[data-place="br"] span { top: 14px; }
.rk-mx-dot[data-place="tr"] span { top: auto; bottom: 14px; }
/* The leader: an L from the dot to a label moved a row up or down. */
.rk-mx-leader { position: absolute; left: 5px; top: 5px; width: 12px; height: 0; border: solid var(--muted); border-width: 0 0 1px 1px; pointer-events: none; opacity: 0; transition: height 0.3s ease, opacity 0.3s ease; }
.rk-mx-leader.rk-mx-on { opacity: 1; }
.rk-mx-leader.rk-mx-up { top: auto; bottom: 5px; border-width: 1px 0 0 1px; }
.rk-mx-dot:hover, .rk-mx-dot.rk-mx-dragging { z-index: 10; opacity: 1 !important; }
.rk-mx-dot:hover span, .rk-mx-dot.rk-mx-dragging span { max-width: none; }
.rk-mx-dot.rk-mx-dragging { cursor: grabbing; }
.rk-mx-dot.rk-mx-faded { opacity: calc(var(--fade, 1) * 0.4); }
.rk-mx-dot.rk-mx-faded span { color: var(--muted); }
.rk-mx-dot.rk-mx-locked { cursor: ns-resize; box-shadow: 0 0 0 1px var(--bg), 0 0 0 2px var(--muted); }
.rk-mx-flip .rk-mx-dot.rk-mx-locked { cursor: ew-resize; }
/* The rail a locked dot slides on while dragged: its date's line, full height, under the dots. */
.rk-mx-rail { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--muted); pointer-events: none; }
.rk-mx-flip .rk-mx-rail { left: 0; right: 0; bottom: auto; border-left: 0; border-top: 1px dashed var(--muted); }
/* Waiting: a clock in the dot's colour instead of the dot. */
.rk-mx-dot.rk-mx-waiting { background: none; border-color: transparent; border-radius: 0; }
.rk-mx-dot.rk-mx-waiting::after {
  content: ""; position: absolute; inset: -2px; background: var(--dot); pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6.5'/%3E%3Cpath d='M8 4.5V8l2.5 1.5'/%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' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6.5'/%3E%3Cpath d='M8 4.5V8l2.5 1.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* The horizon beside a hovered or dragged dot: left of it, right when the label is left, under
   it when that side has no room. */
.rk-mx-peek { position: absolute; z-index: 11; transform: translate(calc(-100% - 16px), -50%); font-weight: 600; color: var(--muted); white-space: nowrap; pointer-events: none; }
.rk-mx-peek.rk-mx-under { transform: translate(-50%, 12px); }
.rk-mx-peek[hidden], .rk-mx-out { visibility: hidden; }
/* Lanes: rows under the plot on its time axis (a cash balance). The label in the first column
   like Important; the line as in .rk-line (accent, dashed grid at lo/mid/hi, the last value
   marked and named, the value under the pointer), the horizon lines carried on through. */
.rk-mx-lane-name { display: flex; justify-content: center; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.rk-mx-lane-name b { writing-mode: vertical-rl; rotate: 180deg; font-weight: 600; }
.rk-mx-lane { position: relative; height: 8rem; margin-top: var(--space-2xs); }
.rk-mx-lane svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.rk-mx-lane path { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rk-mx-lane svg path.rk-mx-lane-alert { stroke: var(--red); }
.rk-mx-lane-mark.rk-mx-lane-below { background: var(--red); }
.rk-mx-lane-end.rk-mx-lane-below { color: var(--red); }
.rk-mx-lane-vmark { position: absolute; width: 6px; height: 6px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
.rk-mx-lane-val { position: absolute; transform: translate(-50%, calc(-100% - 6px)); font-size: var(--step--2); color: var(--muted); white-space: nowrap; pointer-events: none; }
.rk-mx-lane-val.rk-mx-lane-below { color: var(--red); }
.rk-mx-lane-val.rk-mx-lane-near { visibility: hidden; }
.rk-mx-lane-grid { position: absolute; left: 0; right: 0; font-style: normal; border-top: 1px dashed var(--line); pointer-events: none; }
.rk-mx-lane-grid span { position: absolute; left: 0.25rem; bottom: 0; color: var(--muted); line-height: 1.3; }
.rk-mx-lane-mark { position: absolute; width: 10px; height: 10px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
.rk-mx-lane-end, .rk-mx-lane-peek { position: absolute; font-weight: 600; white-space: nowrap; pointer-events: none; }
.rk-mx-lane-end { transform: translate(10px, -50%); }
.rk-mx-lane-end.rk-mx-lane-left { transform: translate(calc(-100% - 10px), -50%); }
.rk-mx-lane-peek { z-index: 1; transform: translate(-50%, calc(-100% - 8px)); padding: 0 4px; border-radius: 0.375rem; background: color-mix(in oklch, var(--bg) 65%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
/* Lane placements (at): over sits between the date strip and the plot, shorter; behind spans the
   plot under the dots, the line paler and the plot's own lines doing the grid's job; floor fills
   below the importance split. Milestones (kind: marks): the timeline's hexagons on rows 0-2, in
   the plot hanging from the top on a dashed rule. */
.rk-mx-lane-over { height: 5rem; margin: 0 0 var(--space-2xs); }
.rk-mx-lane-behind, .rk-mx-lane-floor { position: absolute; inset: 0; height: auto; margin: 0; overflow: clip; pointer-events: none; }
.rk-mx-lane-floor { top: 61.8%; }
.rk-mx-lane-behind path:not(.rk-mx-lane-area) { stroke: color-mix(in oklch, var(--accent) 45%, transparent); }
.rk-mx-lane-behind .rk-mx-lane-grid { border-top-color: transparent; }
.rk-mx-lane-behind :is(.rk-mx-lane-grid span, .rk-mx-lane-end) { color: var(--faint); }
.rk-mx-lane path.rk-mx-lane-area { stroke: none; fill: none; }
.rk-mx-lane-floor path.rk-mx-lane-area { fill: color-mix(in oklch, var(--accent) 12%, transparent); }
.rk-mx-lane-floor path:not(.rk-mx-lane-area) { stroke-width: 2; }
.rk-mx-lane-marks { height: 4.5rem; }
.rk-mx-lane-ms { position: absolute; bottom: calc(0.5rem + var(--row, 0) * 1.4rem); display: flex; align-items: center; gap: var(--space-3xs); translate: -6px 0; white-space: nowrap; color: var(--fg); pointer-events: none; }
.rk-mx-lane-ms b { flex: none; width: 12px; height: 12px; background: var(--fg); clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%); }
.rk-mx-lane-behind .rk-mx-lane-ms { top: calc(0.25rem + var(--row, 0) * 1.4rem); bottom: auto; color: var(--muted); }
.rk-mx-lane-behind .rk-mx-lane-ms b { background: var(--muted); }
.rk-mx-lane-behind .rk-mx-lane-ms::before { content: ""; position: absolute; left: 5px; top: 6px; height: 200vh; border-left: 1px dashed var(--faint); }
.rk-mx-narrow .rk-mx-lane { overflow-x: clip; }
.rk-mx-narrow .rk-mx-lane-name { justify-content: flex-start; margin-top: var(--space-2xs); }
.rk-mx-narrow .rk-mx-lane-name b { writing-mode: horizontal-tb; rotate: none; }
.rk-mx-narrow .rk-mx-lane-name + .rk-mx-lane { margin-top: 0; }
.rk-mx-narrow { grid-template-columns: 1fr; }
.rk-mx-narrow > span:empty, .rk-mx-narrow .rk-mx-side { display: none; }
.rk-mx-narrow .rk-mx-plot { aspect-ratio: auto; height: min(60vh, 28rem); overflow-x: clip; touch-action: pan-y; }
.rk-mx-narrow .rk-mx-dot span { max-width: 6.5rem; }
.rk-mx-narrow .rk-mx-ticks {
  overflow-x: clip; height: calc(2 * 1.3em + 2 * var(--space-2xs)); padding-top: var(--space-2xs); box-sizing: border-box; touch-action: pan-y; cursor: grab;
  --bleed: var(--space-2xs); --strip: color-mix(in oklch, var(--line) 50%, transparent);
  border-radius: var(--radius); background: var(--strip);
  /* Two tick lines with --space-2xs above and below. The fill bleeds out sideways so Today sits
     as far from the edge as from the top; the box itself stays put, so the ticks keep lining up
     with their lines. */
  box-shadow: calc(-1 * var(--bleed)) 0 var(--strip), var(--bleed) 0 var(--strip);
}
/* Flipped (.rk-mx-flip): the axes transposed. Importance across the top (left is important), the
   horizons down the left, every one of them, so nothing swipes; the plot stands tall. */
.rk-mx-flip, .rk-mx-flip.rk-mx-narrow { grid-template-columns: 4.5rem 1fr; }
.rk-mx-flip.rk-mx-narrow > span:empty { display: block; }
.rk-mx-flip .rk-mx-side, .rk-mx-flip.rk-mx-narrow .rk-mx-side { display: flex; flex-direction: row; padding-top: 0; }
.rk-mx-flip .rk-mx-side b { writing-mode: horizontal-tb; rotate: none; }
.rk-mx-flip .rk-mx-ticks, .rk-mx-flip.rk-mx-narrow .rk-mx-ticks { height: auto; padding: 0; background: none; box-shadow: none; cursor: auto; }
.rk-mx-flip .rk-mx-ticks span { padding: 0.125rem 0 0; }
.rk-mx-flip .rk-mx-plot, .rk-mx-flip.rk-mx-narrow .rk-mx-plot { aspect-ratio: 10 / 16; height: auto; max-height: 80vh; grid-template-columns: 1.618fr 1fr; grid-template-rows: 1fr 1fr; grid-auto-flow: column; }
.rk-mx-flip .rk-mx-mid { top: 0; bottom: 0; left: 61.8%; right: auto; border-top: 0; border-left: 1px solid var(--line); }
.rk-mx-flip .rk-mx-line { left: 0; right: 0; bottom: auto; border-left: 0; border-top: 1px solid var(--faint); }
@media (prefers-reduced-motion: reduce) { .rk-mx-dot span, .rk-mx-leader { transition-duration: 1ms; } }

/* Dialog (dialog.js): a centred modal over a 30% dim; a click outside closes it. While any
   modal dialog is open (this one, the comment panel), the page behind does not scroll. At 700px and narrower a sheet from the bottom, at most 85% of the
   screen, scrolling inside, with a grab handle on .rk-pull. With a .rk-dialog-body the header and
   footer.rk-dialog-foot stay put and only the body scrolls; both are at least --rk-dialog-radius
   tall, so the body's scrollbar runs along the straight edge, never into the rounded corners. */
html:has(dialog:modal) { overflow: hidden; }
.rk-dialog { --rk-dialog-radius: 1.5rem; box-sizing: border-box; width: min(40rem, calc(100vw - 2 * var(--space-s))); max-height: 85dvh; margin: auto; padding: var(--space-m); border: 0; border-radius: var(--rk-dialog-radius); background: var(--bg); color: var(--fg); overflow-y: auto; overscroll-behavior: contain; }
.rk-dialog[open] { display: flex; flex-direction: column; gap: var(--space-xs); }
.rk-dialog::backdrop { background: oklch(0 0 0 / 0.3); }
.rk-dialog:has(> .rk-dialog-body) { padding: 0; overflow: hidden; gap: 0; }
.rk-dialog:has(> .rk-dialog-body) > :is(header, .rk-pull) { flex: none; padding: max(var(--space-m), var(--rk-dialog-radius)) var(--space-m) var(--space-xs); }
.rk-dialog-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-xs); padding: 0 var(--space-m); overflow-y: auto; overscroll-behavior: contain; }
.rk-dialog-foot { flex: none; max-height: 42.5dvh; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: var(--space-xs); padding: var(--space-xs) var(--space-m) max(var(--space-m), var(--rk-dialog-radius)); }
.rk-dialog h3 { margin: 0; }
.rk-handle { display: none; }
@media (max-width: 700px) {
  .rk-dialog { width: 100%; max-width: 100%; margin: auto 0 0; padding: var(--space-s) var(--space-s) var(--space-m); border-radius: var(--rk-dialog-radius) var(--rk-dialog-radius) 0 0; transition: translate 200ms ease; }
  .rk-dialog:has(> .rk-dialog-body) > :is(header, .rk-pull) { padding: max(var(--space-s), var(--rk-dialog-radius)) var(--space-s) var(--space-xs); }
  .rk-dialog-body { padding: 0 var(--space-s); }
  .rk-dialog-foot { padding: var(--space-xs) var(--space-s) calc(max(var(--space-m), var(--rk-dialog-radius)) + env(safe-area-inset-bottom)); }
  .rk-pull { touch-action: none; cursor: grab; }
  .rk-handle { display: block; width: 2.5rem; height: 0.3rem; margin: 0 auto var(--space-2xs); border-radius: 99rem; background: var(--faint); }
}
/* Split dialog (.rk-dialog-split): content left, chat right; from 60rem two columns of equal width,
   85% of the screen tall, below that stacked with the aside under the footer. aside.rk-dialog-side
   holds optional rows and, as its last child, the slot of a messageBox or an inline thread, which
   takes the aside's height with its messages scrolling and its box in view. Without an aside it stays a plain dialog.
   One regular size, one small and the headline (the host's title). */
.rk-dialog-split { font-size: var(--step--1); }
.rk-dialog-split .rk-dialog-body :is(h1, h2, h3, h4, h5, h6) { font-size: inherit; }
.rk-dialog-split small { font-size: var(--step--2); }
.rk-dialog-side { flex: none; max-height: 42.5dvh; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: var(--space-xs); padding: var(--space-xs) var(--space-m) max(var(--space-m), var(--rk-dialog-radius)); }
.rk-dialog-side > :last-child { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.rk-dialog-side .rk-thread.rk-inline { flex: 1; min-height: 0; max-height: none; max-width: none; }
.rk-dialog-split:has(> .rk-dialog-side) > .rk-dialog-foot { padding-bottom: var(--space-xs); }
@media (max-width: 700px) {
  .rk-dialog-side { padding: var(--space-xs) var(--space-s) calc(max(var(--space-m), var(--rk-dialog-radius)) + env(safe-area-inset-bottom)); }
}
@media (min-width: 60rem) {
  .rk-dialog-split:has(> .rk-dialog-side) { width: min(72rem, calc(100vw - 2 * var(--space-s))); }
  .rk-dialog-split:has(> .rk-dialog-side)[open] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto minmax(0, 1fr) auto; height: 85dvh; }
  .rk-dialog-split > :is(header, .rk-pull) { grid-area: 1 / 1; }
  .rk-dialog-split > .rk-dialog-body { grid-area: 2 / 1; }
  .rk-dialog-split:has(> .rk-dialog-side) > .rk-dialog-foot { grid-area: 3 / 1; max-height: none; padding-bottom: max(var(--space-m), var(--rk-dialog-radius)); }
  .rk-dialog-side { grid-area: 1 / 2 / -1; max-height: none; min-height: 0; overflow: hidden; padding-top: var(--space-m); }
}

/* Tile: the page's card. A faint fill like a row, a wider radius; a bold title, a muted detail.
   A dot before any element: .rk-dot with --c (an area colour, say). */
.rk-tile { display: flex; flex-direction: column; gap: 0.1rem; padding: var(--space-2xs) var(--space-xs); border-radius: 1rem; background: color-mix(in oklch, var(--line) 50%, transparent); font-size: var(--step--1); }
.rk-tile > b { font-weight: 600; }
.rk-tile small { color: var(--muted); }
.rk-dot::before { content: "●"; color: var(--c, var(--fg)); margin-right: 0.4em; font-size: 0.8em; vertical-align: 0.1em; }

/* Columns (board.js): tiles in columns with counts, dragged by their title (mouse or touch).
   The column under the pointer takes a 10% accent tint; data-limit shows the first three. */
.rk-columns { display: flex; gap: var(--space-s); overflow-x: auto; align-items: flex-start; padding-bottom: var(--space-2xs); }
.rk-column { flex: 0 0 13rem; display: flex; flex-direction: column; gap: var(--space-3xs); min-height: 10rem; padding: var(--space-2xs); border-radius: var(--radius); transition: background-color 120ms; }
.rk-column[data-over] { background: color-mix(in oklch, var(--accent) 10%, transparent); }
.rk-column > h3 { margin: 0 0 var(--space-3xs); font-weight: 600; font-size: var(--step--1); color: var(--muted); display: flex; align-items: baseline; gap: var(--space-3xs); }
.rk-column > h3 [data-count] { color: var(--faint); }
.rk-column > h3 .rk-plain { margin-left: auto; font-size: var(--step--2); }
.rk-column[data-limit]:not([data-all]) > .rk-tile:nth-of-type(n+4) { display: none; }
.rk-column > .rk-tile > b { cursor: grab; touch-action: none; user-select: none; }
.rk-column[data-col="done"] > .rk-tile > b { color: var(--muted); }
.rk-tile[data-dragging] { position: relative; z-index: 5; box-shadow: 0 0.5rem 2rem oklch(0 0 0 / 0.12); background: var(--overlay); }
.rk-tile[data-dragging] > b { cursor: grabbing; }

/* Dependency graph (deps.js): the board's cards in columns by depth, lines behind them. */
.rk-deps { display: flex; flex-direction: column; gap: var(--space-l); overflow-x: auto; padding-bottom: var(--space-2xs); }
/* Graphs that share no line stack apart; items with no line at all wrap in a row under them. */
.rk-deps-loose { display: flex; flex-wrap: wrap; gap: var(--space-3xs); }
.rk-deps-grid + .rk-deps-loose { border-top: 1px solid var(--line); padding-top: var(--space-m); }
.rk-deps-loose > .rk-tile { width: 11rem; }
.rk-deps-grid { position: relative; display: flex; gap: var(--space-l); width: max-content; }
.rk-deps-grid > svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: none; stroke: var(--faint); stroke-width: 1; }
.rk-deps-grid path { transition: opacity 0.15s, stroke 0.15s; }
.rk-deps-grid path.rk-deps-on { stroke: var(--accent); stroke-width: 1.5; }
.rk-deps-grid[data-hover] path:not(.rk-deps-on) { opacity: 0.25; }
.rk-deps-grid[data-hover] .rk-tile:not(.rk-deps-on) { opacity: 0.45; }
.rk-deps-col { position: relative; display: flex; flex-direction: column; justify-content: center; gap: var(--space-3xs); width: 11rem; }
.rk-deps .rk-tile { color: var(--fg); text-decoration: none; background: color-mix(in oklch, var(--line) 50%, var(--bg)); transition: opacity 0.15s, box-shadow 0.15s; }
.rk-deps .rk-tile.rk-deps-on { box-shadow: inset 0 0 0 1px var(--accent); }
.rk-deps .rk-tag { align-self: flex-start; }
.rk-rings { display: block; width: 100%; max-width: 28rem; margin: 0 auto; }
.rk-rings circle { fill: var(--fg); stroke: none; }
.rk-rings text { font-weight: 600; text-anchor: middle; fill: var(--bg); pointer-events: none; }
.rk-rings .rk-rings-me { fill: var(--line); stroke: currentColor; stroke-width: 2; }
.rk-rings .rk-rings-me + text { fill: var(--fg); }
.rk-rings text.rk-rings-group { fill: var(--muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.rk-rings-person { cursor: pointer; transform-box: fill-box; transform-origin: center; transition: transform .15s ease; }
.rk-rings-person:hover { transform: scale(1.12); }
@media (prefers-reduced-motion: reduce) { .rk-rings-person { transition: none; } }

/* Deck (deck.js): a snapping row of tiles, one per screen, three when the deck is 40rem or wider. */
.rk-deck { container-type: inline-size; display: flex; flex-direction: column; gap: var(--space-2xs); }
.rk-deck-row { display: flex; gap: var(--space-s); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; outline: 0; }
.rk-deck-row::-webkit-scrollbar { display: none; }
.rk-deck-row > * { flex: 0 0 100%; box-sizing: border-box; scroll-snap-align: start; }
@container (min-width: 40rem) { .rk-deck-row > * { flex-basis: calc((100% - 2 * var(--space-s)) / 3); } }
.rk-deck-row > .rk-tile { min-height: 16rem; gap: var(--space-2xs); padding: var(--space-s); border-radius: var(--radius); font-size: var(--step-0); }
.rk-deck-row > .rk-tile small { font-weight: 600; }
.rk-deck-row > .rk-tile h3 { margin: 0; font-size: var(--step-2); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.rk-deck-row > .rk-tile p { margin: 0; color: var(--muted); }
.rk-deck-row > .rk-tile .rk-plain { margin-top: auto; align-self: flex-start; }
.rk-deck-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); }
.rk-deck-nav { display: flex; align-items: center; gap: var(--space-s); margin: 0; font-size: var(--step--1); color: var(--muted); }

/* Gallery (gallery.js): slides full size, one per view, snapping. Round arrows in the stage's
   gutters (fading out at the ends), dots under it, "3 of 8" between a pair of arrows by the
   title, × to close. Built on the dialog's header, body and footer. A slide
   (.rk-slide) puts its image beside its caption when the row is 40rem or wider, above it when
   narrower. In a dialog it is 64rem wide; on phones (a sheet) no gutters: swipe or the dots. */
.rk-gallery { display: flex; flex-direction: column; gap: var(--space-xs); }
dialog.rk-gallery:not([open]) { display: none; }
.rk-dialog.rk-gallery { width: min(64rem, calc(100vw - 2 * var(--space-s))); }
.rk-gallery > header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2xs) var(--space-s); }
.rk-gallery > header .rk-handle { flex-basis: 100%; }
.rk-gallery > header h3 { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-gallery [data-gallery-pos] { color: var(--muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rk-gallery-nav { display: flex; align-items: center; gap: var(--space-2xs); flex: none; }
.rk-gallery-nav button:disabled { opacity: 0.4; cursor: default; }
/* One slide: nothing to step to, so only the position stays. */
.rk-gallery-nav:has(button:first-child:disabled):has(button:last-child:disabled) button { display: none; }
.rk-gallery-close, .rk-gallery-nav button { display: grid; place-items: center; width: 2rem; height: 2rem; flex: none; padding: 0; border: 0; border-radius: 50%; background: var(--line); color: var(--fg); font: inherit; font-size: var(--step-1); line-height: 1; cursor: pointer; transition: opacity 150ms; }
.rk-gallery-close:hover, .rk-gallery-nav button:not(:disabled):hover { opacity: 0.85; }
.rk-gallery-stage { position: relative; flex: none; padding-inline: 3.5rem; }
.rk-gallery-row { container-type: inline-size; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; outline: 0; border-radius: var(--radius); }
.rk-gallery-row::-webkit-scrollbar { display: none; }
.rk-gallery-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.rk-gallery-row > * { flex: 0 0 100%; box-sizing: border-box; scroll-snap-align: start; scroll-snap-stop: always; }
.rk-slide { display: grid; gap: var(--space-s); margin: 0; align-content: start; max-height: 62dvh; overflow-y: auto; overscroll-behavior: contain; }
.rk-slide > img, .rk-slide > video { display: block; width: 100%; max-height: 44dvh; object-fit: contain; border-radius: var(--radius); background: color-mix(in oklch, var(--line) 50%, transparent); }
.rk-slide > figcaption { display: flex; flex-direction: column; gap: var(--space-2xs); }
.rk-slide h4 { margin: 0; font-size: var(--step-1); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
.rk-slide p { margin: 0; white-space: pre-line; }
.rk-slide small { color: var(--muted); font-size: var(--step--1); }
@container (min-width: 40rem) {
  .rk-slide:has(> figcaption) { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-m); }
  .rk-slide > img, .rk-slide > video { max-height: 62dvh; position: sticky; top: 0; }
}
.rk-gallery-step { position: absolute; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0; border: 0; border-radius: 50%; background: var(--line); color: var(--fg); cursor: pointer; transition: opacity 150ms; }
.rk-gallery-step[data-gallery="-1"] { left: 0; }
.rk-gallery-step[data-gallery="1"] { right: 0; }
.rk-gallery-step:not(:disabled):hover { opacity: 0.85; }
.rk-gallery-step:disabled { opacity: 0; pointer-events: none; }
.rk-gallery-dots { display: flex; justify-content: center; gap: 0; margin: 0; }
.rk-gallery-dots:empty { display: none; }
.rk-gallery-dots button { padding: 0.4rem 0.25rem; border: 0; background: none; cursor: pointer; }
.rk-gallery-dots button::before { content: ""; display: block; width: 0.45rem; height: 0.45rem; border-radius: 99rem; background: var(--faint); transition: width 150ms, background-color 150ms; }
.rk-gallery-dots button:hover::before { background: var(--muted); }
.rk-gallery-dots button[aria-current]::before { width: 1.25rem; background: var(--fg); }
@media (max-width: 700px) {
  .rk-gallery-stage { padding-inline: 0; }
  .rk-gallery-step { display: none; }
}
@media (prefers-reduced-motion: reduce) { .rk-gallery-dots button::before { transition: none; } }

/* Charts (chart.js): a line chart, a week strip and a timeline, all on tokens. */
.rk-line { display: block; width: 100%; height: auto; overflow: visible; }
.rk-line text { font-size: 12px; fill: var(--muted); }
.rk-line .rk-line-end { fill: var(--fg); font-weight: 600; }
.rk-line .rk-line-grid { stroke: var(--line); stroke-dasharray: 2 4; }
.rk-line .rk-line-path { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.rk-line .rk-line-dot { fill: var(--accent); }
.rk-line .rk-line-mark { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.rk-line .rk-line-peek { fill: var(--fg); font-weight: 600; text-anchor: middle; }
.rk-week { display: grid; grid-template-columns: repeat(7, minmax(7rem, 1fr)); gap: var(--space-xs); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.rk-week > section { scroll-snap-align: start; display: flex; flex-direction: column; gap: var(--space-3xs); font-size: var(--step--1); }
.rk-week h4 { margin: 0; font-weight: 600; color: var(--muted); }
.rk-week [data-today] h4 { color: var(--accent); }
.rk-week p { margin: 0; }
.rk-week [data-done] { color: var(--muted); text-decoration: line-through; }
.rk-week [data-free] { color: var(--faint); }
.rk-activity { display: grid; grid-template-rows: repeat(7, auto); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; max-width: 60rem; }
.rk-activity > i { aspect-ratio: 1; border-radius: 2px; background: color-mix(in oklch, var(--line) 60%, transparent); }
.rk-activity > i[data-level="1"] { background: color-mix(in oklch, var(--accent) 25%, var(--bg)); }
.rk-activity > i[data-level="2"] { background: color-mix(in oklch, var(--accent) 50%, var(--bg)); }
.rk-activity > i[data-level="3"] { background: color-mix(in oklch, var(--accent) 75%, var(--bg)); }
.rk-activity > i[data-level="4"] { background: var(--accent); }
.rk-timeline { position: relative; height: 7rem; margin-top: var(--space-s); font-size: var(--step--2); color: var(--muted); }
.rk-tl-axis { position: absolute; left: 0; right: 0; bottom: 1.5rem; border-top: 2px dotted var(--line); }
.rk-tl-tick { position: absolute; bottom: 0; translate: -50% 0; }
.rk-tl-rhythm { position: absolute; top: 0; bottom: 1.5rem; border-left: 1px dashed var(--faint); }
.rk-tl-now { position: absolute; top: 0; bottom: 1.5rem; border-left: 2px solid var(--accent); }
.rk-tl-now span { position: absolute; top: -1.2rem; translate: -50% 0; color: var(--accent); font-weight: 600; white-space: nowrap; }
.rk-tl-ms { position: absolute; display: flex; align-items: center; gap: var(--space-3xs); translate: -6px 50%; white-space: nowrap; color: var(--fg); }
.rk-tl-ms b { flex: none; width: 12px; height: 12px; background: var(--fg); clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%); }
.rk-tl-ms[data-past] { color: var(--muted); }
.rk-tl-ms[data-past] b { background: var(--faint); }

/* Files (files.js): the tree or a flat list on the left, a file open on the right, each scrolling.
   Narrow, an open file takes the whole view. */
.rk-fv { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-xs); font-size: var(--step--1); }
.rk-fv-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-s); }
.rk-fv-total { color: var(--faint); }
.rk-fv-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-m); }
.rk-fv[data-file] .rk-fv-main { grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); }
.rk-fv-main > * { min-height: 0; overflow: auto; }
/* The tree stays as wide as a name and its numbers need, not the whole view. */
.rk-fv-main > .rk-fv-tree { max-width: 36rem; }
.rk-fv-tree { display: flex; flex-direction: column; gap: var(--space-3xs); margin: 0; padding: 0; list-style: none; }
.rk-fv-tree .rk-fv-tree { padding: var(--space-3xs) 0 0 var(--space-m); }
.rk-fv-tree summary { cursor: pointer; list-style: none; }
.rk-fv-tree summary::-webkit-details-marker { display: none; }
.rk-fv-row { position: relative; display: flex; align-items: center; gap: var(--space-s); padding: var(--space-3xs) var(--space-s); border-radius: 0.5rem; }
.rk-fv-row:hover { background: color-mix(in oklch, var(--line) 30%, transparent); }
/* files.js sets --c, the type colour, on each row: the file's ending (.css, .md) shows it. */
.rk-fv-ext { color: var(--c); }
/* The size dots, gray for every row: one per power of ten (data-n, 1 to 5), packed like a flower:
   one in the middle, two side by side, a triangle, a square, then four petals round a centre.
   Dots, lines and bytes each keep a fixed width, so they line up down the tree at every depth. */
.rk-fv-dots { --c: var(--muted); --d: transparent 0.1rem; flex: none; width: 0.8rem; height: 0.8rem; }
.rk-fv-dots[data-n="1"] { background: radial-gradient(circle at 50% 50%, var(--c) 0.09rem, var(--d)); }
.rk-fv-dots[data-n="2"] { background: radial-gradient(circle at 25% 50%, var(--c) 0.09rem, var(--d)),
  radial-gradient(circle at 75% 50%, var(--c) 0.09rem, var(--d)); }
.rk-fv-dots[data-n="3"] { background: radial-gradient(circle at 50% 22%, var(--c) 0.09rem, var(--d)),
  radial-gradient(circle at 25% 72%, var(--c) 0.09rem, var(--d)), radial-gradient(circle at 75% 72%, var(--c) 0.09rem, var(--d)); }
.rk-fv-dots[data-n="4"] { background: radial-gradient(circle at 27% 27%, var(--c) 0.09rem, var(--d)),
  radial-gradient(circle at 73% 27%, var(--c) 0.09rem, var(--d)), radial-gradient(circle at 27% 73%, var(--c) 0.09rem, var(--d)),
  radial-gradient(circle at 73% 73%, var(--c) 0.09rem, var(--d)); }
.rk-fv-dots[data-n="5"] { background: radial-gradient(circle at 50% 50%, var(--c) 0.09rem, var(--d)),
  radial-gradient(circle at 50% 14%, var(--c) 0.09rem, var(--d)), radial-gradient(circle at 86% 50%, var(--c) 0.09rem, var(--d)),
  radial-gradient(circle at 50% 86%, var(--c) 0.09rem, var(--d)), radial-gradient(circle at 14% 50%, var(--c) 0.09rem, var(--d)); }
.rk-fv-dir { font-weight: 600; }
.rk-fv-open { cursor: pointer; }
.rk-fv-open[data-open] { outline: 1px solid var(--accent); }
.rk-fv-path { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: ui-monospace, monospace; }
.rk-fv-lines { flex: none; width: 3rem; text-align: right; font-variant-numeric: tabular-nums; }
.rk-fv-bytes { flex: none; width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--faint); }
.rk-fv-file { display: flex; flex-direction: column; gap: var(--space-2xs); padding: var(--space-s); border: 1px solid var(--line); border-radius: var(--radius); }
.rk-fv-file[hidden] { display: none; }
.rk-fv-file-head { flex: none; display: flex; align-items: baseline; gap: var(--space-s); }
.rk-fv-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: ui-monospace, monospace; font-weight: 600; }
.rk-fv-size { font-variant-numeric: tabular-nums; color: var(--faint); }
.rk-fv-code { flex: 1; min-height: 0; overflow: auto; }
/* CodeMirror stacks its gutters (200), cursor (150) and tooltips (100) by z-index; isolated, they
   stay inside the editor instead of covering the selection box (45) in the panel (3.5). */
.rk-fv-code .cm-editor { isolation: isolate; }
@media (max-width: 48rem) {
  .rk-fv[data-file] .rk-fv-main { grid-template-columns: minmax(0, 1fr); }
  .rk-fv[data-file] .rk-fv-main > .rk-fv-tree { display: none; }
}

/* Canvas (canvas.js): frames on a board that pans and zooms, the grid as dots on --line, their
   step set by the zoom (25 or 100 screen px apart or more), every 5th strong, the rest dimmed;
   the zoom controls at its top left. A frame
   sits where its left, top and width say (canvas px); a shield covers an embedded page until a
   double-click makes the frame active. Overflow clip, not hidden: a hidden board can still be
   scrolled (a hash link, a focus), which moved its controls off screen and its zoom off the pointer. */
.rk-canvas { position: relative; overflow: clip; cursor: default; touch-action: none;
  background: radial-gradient(circle, var(--faint) 1.5px, transparent 1.5px) 0 0 / 500px 500px,
    radial-gradient(circle, color-mix(in srgb, var(--faint) 40%, transparent) 1.5px, transparent 1.5px) 0 0 / 100px 100px; }
/* Hybrid: the strong dots and every 5th line in one faint colour, the 4 lines between fainter. */
.rk-canvas[data-look="hybrid"] {
  --rk-grid-line: color-mix(in srgb, var(--faint) 18%, transparent);
  --rk-grid-minor: color-mix(in srgb, var(--faint) 7%, transparent);
  background-image: radial-gradient(circle, var(--rk-grid-line) 1.5px, transparent 1.5px),
    linear-gradient(to right, var(--rk-grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--rk-grid-line) 1px, transparent 1px),
    linear-gradient(to right, var(--rk-grid-minor) 1px, transparent 1px),
    linear-gradient(to bottom, var(--rk-grid-minor) 1px, transparent 1px); }
.rk-canvas.rk-panning { cursor: grabbing; }
.rk-canvas > .rk-snap { position: absolute; z-index: 1; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); pointer-events: none; }
.rk-canvas > .rk-canvas-controls { position: absolute; z-index: 2; left: var(--space-s); top: var(--space-s); display: flex; align-items: center; gap: var(--space-3xs); padding: var(--space-3xs); border-radius: var(--radius); background: var(--bg); box-shadow: 0 0 0 1px var(--line); font-size: var(--step--1); }
.rk-canvas-controls .rk-button { padding: 0 var(--space-xs); }
.rk-canvas-controls output { min-width: 3.5em; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.rk-fps { position: relative; display: inline-block; }
.rk-fps-meter { display: block; padding: 2px; border: 0; border-radius: var(--radius); background: rgb(0 0 0 / 0.75); line-height: 0; cursor: pointer; }
.rk-fps-meter > canvas { display: block; }
.rk-fps-report { position: absolute; left: 0; bottom: calc(100% + var(--space-3xs)); width: min(48rem, 90vw); max-height: 50vh; overflow: auto; margin: 0; padding: var(--space-xs); border-radius: var(--radius); background: rgb(0 0 0 / 0.85); color: white; font-size: var(--step--1); white-space: pre; }
.rk-canvas-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.rk-frame { position: absolute; cursor: default; }
.rk-frame.rk-moving { z-index: 1; }
.rk-frame.rk-moving, .rk-frame.rk-moving .rk-grip { cursor: grabbing; }
.rk-frame .rk-grip { all: unset; cursor: grab; color: var(--muted); padding: 0 var(--space-3xs); border-radius: calc(var(--radius) / 2); touch-action: none; }
.rk-frame .rk-grip:hover { color: var(--fg); background: var(--line); }
.rk-shield { position: absolute; inset: 0; }
.rk-frame.rk-active .rk-shield { display: none; }

/* Checklist: rows with a box. Ticked, a row strikes through and sinks to the end (CSS order,
   so unticking puts it back where it was). */
.rk-checklist { display: flex; flex-direction: column; gap: var(--space-3xs); margin: 0; padding: 0; list-style: none; }
.rk-checklist > :has(:checked) { order: 1; }
.rk-check { display: flex; align-items: baseline; gap: var(--space-2xs); border-radius: var(--radius); background: color-mix(in oklch, var(--line) 50%, transparent); padding: var(--space-xs) var(--space-s); cursor: pointer; }
.rk-check input { flex: none; width: 1.1rem; height: 1.1rem; margin: 0; translate: 0 0.15em; accent-color: var(--accent); }
.rk-check input:disabled { opacity: 1; }
.rk-check:has(input:disabled) { cursor: default; }
.rk-check:has(:checked) { color: var(--muted); text-decoration: line-through; }
/* Markdown from a file (md.js), inside a page whose reset takes lists and spacing away. */
.rk-md { display: flex; flex-direction: column; gap: var(--space-2xs); overflow-wrap: anywhere; }
.rk-md-text { display: contents; }
.rk-md-view { align-self: flex-end; font-size: var(--step--2); }
/* Shown only while the boxes read as Republika, not Raw: a spec's drafted screens beside its file. */
.rk-md-page { display: none; }
body:has(#rk-md-view option[value="page"]:checked) .rk-md-page { display: flex; }
.rk-md-raw { margin: 0; font-family: var(--font-mono); font-size: var(--step--2); line-height: 1.4; white-space: pre-wrap; }
.rk-md-raw .tok-tag { color: var(--accent); font-weight: 600; }
.rk-md-raw .tok-keyword { color: var(--accent); }
.rk-md-raw .tok-string { color: var(--green); }
.rk-md-raw .tok-name { font-weight: 700; }
.rk-md-raw .tok-punct { color: var(--muted); }
.rk-md-raw .tok-link { text-decoration: underline; }
.rk-md ul, .rk-md ol { display: flex; flex-direction: column; gap: var(--space-3xs); margin: 0; padding-left: 1.2em; }
.rk-md ul { list-style: disc; }
.rk-md ol { list-style: decimal; }
.rk-md li:has(> input) { list-style: none; margin-left: -1.2em; padding-left: 1.5em; text-indent: -1.5em; }
.rk-md li > input { width: 1em; height: 1em; margin: 0 0.5em 0 0; accent-color: var(--accent); }
.rk-md :is(h1, h2, h3, h4, h5, h6) { margin: var(--space-2xs) 0 0; font-size: inherit; font-weight: 700; color: var(--fg); }
.rk-md a { text-decoration: underline; }
.rk-check small { color: var(--muted); }
.rk-check:has(:checked) small { text-decoration: none; }

/* Fold: a section whose heading carries a count and a Hidden / Shown cycle (a select with
   data-param, 4.8), so the choice lives in the URL. The body shows only while "show" is picked. */
.rk-fold-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-xs); }
.rk-fold-head small { color: var(--muted); font-weight: 400; }
.rk-fold:not(:has(> .rk-fold-head option[value="show"]:checked)) > .rk-fold-body { display: none; }

/* Reading column: long text in a calm column (guides, Markdown). */
.rk-prose { max-width: 38rem; font-size: var(--step-0); line-height: 1.7; }
.rk-prose h4 { margin: 0 0 var(--space-3xs); font-size: var(--step--2); font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); }
.rk-prose h2 { margin: 0 0 var(--space-xs); font-size: var(--step-3); font-weight: 740; letter-spacing: -0.03em; line-height: 1.1; }
.rk-prose h3 { margin: var(--space-s) 0 var(--space-3xs); font-size: var(--step-1); font-weight: 700; }
.rk-prose p { margin: 0 0 var(--space-xs); }
.rk-prose blockquote { margin: var(--space-s) 0; padding: var(--space-xs) var(--space-s); border-radius: var(--radius); background: color-mix(in oklch, var(--accent) 8%, transparent); color: var(--muted); font-style: italic; }
.rk-prose ul { list-style: disc; padding-left: var(--space-s); }
.rk-prose ol { list-style: decimal; padding-left: var(--space-s); }

/* Legend: what a colour means, with a count. */
.rk-legend { display: flex; flex-wrap: wrap; gap: var(--space-s); margin: 0; font-size: var(--step--1); color: var(--muted); }
.rk-legend > span::before { content: "●"; color: var(--c, var(--fg)); margin-right: 0.35em; font-size: 0.8em; }
.rk-legend small { color: var(--faint); }

/* Notification dot: something waits for you (a thread whose last reply asks you a question).
   Red, 0.5rem, inline beside a label; on a comment bubble it sits on the top right with a
   --bg ring (comments.css). Carries a title saying what waits. */
.rk-notify { display: inline-block; flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--red); }

/* Inline edit (edit.js): [data-edit] text edited in place, in its own type style. No outline;
   hover and focus take a faint fill, its padding offset by a negative margin so nothing shifts.
   data-multiline keeps the newlines; data-placeholder shows while it is empty. user-select: text
   because iOS Safari will not edit a contenteditable that inherits a host's user-select: none. */
[data-edit] { -webkit-user-select: text; user-select: text; cursor: text; caret-color: var(--fg); outline: 0; border-radius: 0.375rem; margin-inline: -0.25em; padding-inline: 0.25em; transition: background-color 120ms; -webkit-tap-highlight-color: transparent; }
[data-edit]:hover, [data-edit]:focus { background: color-mix(in oklch, var(--line) 70%, transparent); }
[data-edit]:focus { background: var(--line); }
[data-edit][data-multiline] { white-space: pre-wrap; }
[data-edit]:empty::before { content: attr(data-placeholder); color: var(--muted); }
[data-edit]:empty:not([data-placeholder])::before { content: "\200b"; } /* an empty one keeps a line to click */

/* Marks (annotate.js highlight): a quote found on the page, an accent tint behind its text. SVG
   text has no background: its mark is a tspan with a wide stroke painted under its glyphs, opaque
   (mixed with --bg) so the strokes of neighbouring glyphs do not add up. comments.css repeats it
   unlayered, for the comment layer on another app's page. */
.rk-mark { background: color-mix(in oklch, var(--rk-accent, var(--accent)) 18%, transparent); color: inherit; border-radius: 0.2em; }
tspan.rk-mark {
  paint-order: stroke; stroke: color-mix(in oklch, var(--rk-accent, var(--accent)) 18%, var(--bg));
  stroke-width: 0.55em; stroke-linejoin: round; stroke-linecap: round;
}
