/* Radilux Reports design system — "Clinical light", minimal.
   Flat surfaces, hairline borders, generous whitespace, one accent colour,
   no shadows or gradients except on floating layers (menus, dialogs).
   One hand-written stylesheet: tokens, layout, components. No build step, no
   framework. Every colour is a token; dark mode only redefines tokens.
   Class prefix: rl-. Interaction states are pure CSS (no JavaScript). */

:root {
  /* Dark is the default theme. The <html data-theme> attribute is rendered by
     the server from the rl_theme cookie: "dark" (default), "light" or
     "system" (follow the device). Only tokens change between themes. */
  --rl-bg: #0c1318; --rl-surface: #111b22; --rl-surface-2: #15212a; --rl-sunken: #0f181e;
  --rl-ink: #e7eef2; --rl-ink-2: #c3d0d7; --rl-muted: #8a9ca6; --rl-line: #1f2e37; --rl-line-strong: #2d404b;
  --rl-accent: #46bcd0; --rl-accent-hover: #6bcfe0; --rl-accent-ink: #05212a; --rl-accent-soft: #11303a; --rl-accent-line: #1f505c; --rl-focus: #6bcfe0;
  --rl-ok: #5bcf93; --rl-ok-soft: #12301f; --rl-warn: #edb65a; --rl-warn-soft: #33270d;
  --rl-danger: #f08a83; --rl-danger-soft: #381a18; --rl-info: #7fb6ea; --rl-info-soft: #14293c;
  --rl-shadow-lg: 0 12px 36px rgba(0, 0, 0, .6);
  color-scheme: dark;
  /* type */
  --rl-font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --rl-font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --rl-font-report: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  /* shape */
  --rl-radius: 8px;
  --rl-radius-sm: 5px;
  --rl-shadow: none;
  --rl-nav-h: 56px;
}
:root[data-theme="light"] {
  --rl-bg: #ffffff; --rl-surface: #ffffff; --rl-surface-2: #f7f9fa; --rl-sunken: #f2f5f6;
  --rl-ink: #14232b; --rl-ink-2: #3b4c56; --rl-muted: #62737d; --rl-line: #e4e9ec; --rl-line-strong: #c3ced4;
  --rl-accent: #0a6c7e; --rl-accent-hover: #085a69; --rl-accent-ink: #ffffff; --rl-accent-soft: #e2f1f4; --rl-accent-line: #a9d3db; --rl-focus: #1b8fa5;
  --rl-ok: #1c7c4f; --rl-ok-soft: #e3f3ea; --rl-warn: #96600a; --rl-warn-soft: #fbf0d9;
  --rl-danger: #b3312b; --rl-danger-soft: #fbe6e4; --rl-info: #1f5f99; --rl-info-soft: #e4eef8;
  --rl-shadow-lg: 0 8px 28px rgba(20, 35, 43, .16);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
  --rl-bg: #ffffff; --rl-surface: #ffffff; --rl-surface-2: #f7f9fa; --rl-sunken: #f2f5f6;
    --rl-ink: #14232b; --rl-ink-2: #3b4c56; --rl-muted: #62737d; --rl-line: #e4e9ec; --rl-line-strong: #c3ced4;
    --rl-accent: #0a6c7e; --rl-accent-hover: #085a69; --rl-accent-ink: #ffffff; --rl-accent-soft: #e2f1f4; --rl-accent-line: #a9d3db; --rl-focus: #1b8fa5;
    --rl-ok: #1c7c4f; --rl-ok-soft: #e3f3ea; --rl-warn: #96600a; --rl-warn-soft: #fbf0d9;
    --rl-danger: #b3312b; --rl-danger-soft: #fbe6e4; --rl-info: #1f5f99; --rl-info-soft: #e4eef8;
    --rl-shadow-lg: 0 8px 28px rgba(20, 35, 43, .16);
    color-scheme: light;
  }
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.rl {
  margin: 0; background: var(--rl-bg); color: var(--rl-ink);
  font: 15px/1.55 var(--rl-font); -webkit-font-smoothing: antialiased;
}
.rl h1, .rl h2, .rl h3, .rl h4 { font-family: var(--rl-font-display); color: var(--rl-ink); margin: 0; line-height: 1.25; text-wrap: balance; }
.rl h1 { font-size: 1.75rem; font-weight: 650; letter-spacing: -.01em; }
.rl h2 { font-size: 1.25rem; font-weight: 650; }
.rl h3 { font-size: 1.02rem; font-weight: 650; }
.rl p { margin: 0; }
.rl a { color: var(--rl-accent); text-decoration: none; }
.rl a:hover { text-decoration: underline; }
.rl :focus-visible { outline: 2px solid var(--rl-focus); outline-offset: 2px; border-radius: 3px; }
.rl-muted { color: var(--rl-muted); }
.rl-small { font-size: .86rem; }
.rl-eyebrow { font-size: .72rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--rl-muted); }
.rl-num { font-variant-numeric: tabular-nums; }
.rl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.rl-page { max-width: 1180px; margin: 0 auto; padding-block: 36px 72px; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.rl-page--narrow { max-width: 860px; }
.rl-stack { display: flex; flex-direction: column; gap: 16px; }
.rl-stack--lg { gap: 40px; }
.rl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rl-row--between { justify-content: space-between; }
.rl-grow { flex: 1 1 0; min-width: 0; }
.rl-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.rl-split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 900px) { .rl-split { grid-template-columns: minmax(0, 1fr); } }

/* ── Top navigation ───────────────────────────────────────────────────── */
.rl-nav {
  position: sticky; top: 0; z-index: 30; height: var(--rl-nav-h);
  background: var(--rl-surface); border-bottom: 1px solid var(--rl-line);
  display: flex; align-items: center; gap: 20px;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
}
.rl-brand { display: flex; align-items: center; gap: 9px; font-family: var(--rl-font-display); font-weight: 700; font-size: 1.05rem; color: var(--rl-ink) !important; text-decoration: none !important; white-space: nowrap; }
.rl-brand-mark { width: 9px; height: 9px; border-radius: 50%; background: var(--rl-accent); }
.rl-nav-links { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.rl-nav-link { padding: 7px 11px; border-radius: var(--rl-radius-sm); color: var(--rl-ink-2) !important; font-weight: 500; white-space: nowrap; text-decoration: none !important; }
.rl-nav-link:hover { background: var(--rl-sunken); color: var(--rl-ink) !important; }
.rl-nav-link[aria-current="page"] { background: var(--rl-accent-soft); color: var(--rl-accent) !important; }
.rl-nav-end { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.rl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 14px; border-radius: var(--rl-radius-sm);
  border: 1px solid var(--rl-line-strong); background: var(--rl-surface); color: var(--rl-ink) !important;
  font: 600 .9rem/1 var(--rl-font); cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background-color .12s, border-color .12s;
}
.rl-btn:hover { background: var(--rl-sunken); }
.rl-btn--primary { background: var(--rl-accent); border-color: var(--rl-accent); color: var(--rl-accent-ink) !important; }
.rl-btn--primary:hover { background: var(--rl-accent-hover); border-color: var(--rl-accent-hover); }
.rl-btn--quiet { border-color: transparent; background: transparent; color: var(--rl-ink-2) !important; }
.rl-btn--quiet:hover { background: var(--rl-sunken); }
.rl-btn--danger { color: var(--rl-danger) !important; border-color: var(--rl-line-strong); }
.rl-btn--danger:hover { background: var(--rl-danger-soft); border-color: var(--rl-danger); }
.rl-btn--lg { min-height: 44px; padding: 0 20px; font-size: 1rem; }
.rl-btn--sm { min-height: 30px; padding: 0 10px; font-size: .82rem; }
.rl-btn--block { width: 100%; }
.rl-btn[disabled], .rl-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
/* busy state while an htmx request is in flight */
.rl-busy { display: none; }
.htmx-request .rl-busy, .htmx-request.rl-busy { display: inline-flex; }
.htmx-request .rl-idle { display: none; }
.rl-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: rl-spin .7s linear infinite; }
@keyframes rl-spin { to { transform: rotate(360deg); } }

/* ── Forms ────────────────────────────────────────────────────────────── */
.rl-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rl-label { font-weight: 600; font-size: .86rem; color: var(--rl-ink-2); }
.rl-hint { font-size: .8rem; color: var(--rl-muted); }
.rl-input, .rl-select, .rl-textarea {
  width: 100%; min-height: 38px; padding: 7px 11px; border-radius: var(--rl-radius-sm);
  border: 1px solid var(--rl-line-strong); background: var(--rl-surface); color: var(--rl-ink);
  font: inherit;
}
.rl-textarea { min-height: 120px; resize: vertical; line-height: 1.5; field-sizing: content; }
.rl-textarea--report { font-family: var(--rl-font-report); font-size: .9rem; min-height: 220px; }
.rl-input::placeholder, .rl-textarea::placeholder { color: var(--rl-muted); }
.rl-input:focus, .rl-select:focus, .rl-textarea:focus { outline: 2px solid var(--rl-focus); outline-offset: 0; border-color: var(--rl-focus); }
.rl-input:user-invalid, .rl-textarea:user-invalid { border-color: var(--rl-danger); }
.rl-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.rl-check input { width: 16px; height: 16px; accent-color: var(--rl-accent); }

/* ── Surfaces ─────────────────────────────────────────────────────────── */
.rl-card { background: var(--rl-surface); border: 1px solid var(--rl-line); border-radius: var(--rl-radius); }
.rl-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.rl-card-body { padding: 20px; }
.rl-card-foot { padding: 12px 18px; border-top: 1px solid var(--rl-line); background: var(--rl-surface-2); border-radius: 0 0 var(--rl-radius) var(--rl-radius); }
.rl-panel { background: var(--rl-sunken); border: 1px solid var(--rl-line); border-radius: var(--rl-radius); padding: 14px 16px; }
.rl-divider { border: 0; border-top: 1px solid var(--rl-line); margin: 0; }

/* Report text: the thing the product exists to produce. */
.rl-report {
  font-family: var(--rl-font-report); font-size: .9rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--rl-surface); border: 1px solid var(--rl-line); border-left: 3px solid var(--rl-accent);
  border-radius: var(--rl-radius-sm); padding: 16px 18px; user-select: all;
}
.rl-report-heading { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

/* ── Badges, chips ────────────────────────────────────────────────────── */
.rl-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 650; background: var(--rl-sunken); color: var(--rl-ink-2); border: 1px solid var(--rl-line); white-space: nowrap; }
.rl-badge--accent { background: var(--rl-accent-soft); color: var(--rl-accent); border-color: var(--rl-accent-line); }
.rl-badge--ok { background: var(--rl-ok-soft); color: var(--rl-ok); border-color: transparent; }
.rl-badge--warn { background: var(--rl-warn-soft); color: var(--rl-warn); border-color: transparent; }
.rl-badge--danger { background: var(--rl-danger-soft); color: var(--rl-danger); border-color: transparent; }

/* ── Alerts and toasts ────────────────────────────────────────────────── */
.rl-alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--rl-radius-sm); border: 1px solid var(--rl-line); background: var(--rl-surface-2); }
.rl-alert--ok { background: var(--rl-ok-soft); border-color: transparent; color: var(--rl-ok); }
.rl-alert--warn { background: var(--rl-warn-soft); border-color: transparent; color: var(--rl-warn); }
.rl-alert--danger { background: var(--rl-danger-soft); border-color: transparent; color: var(--rl-danger); }
.rl-alert--info { background: var(--rl-info-soft); border-color: transparent; color: var(--rl-info); }
.rl-alert:has(.rl-dismiss:checked) { display: none; }
#toastHost { position: fixed; z-index: 60; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.rl-toast { pointer-events: auto; max-width: 360px; padding: 11px 14px; border-radius: var(--rl-radius-sm); background: var(--rl-ink); color: var(--rl-bg); box-shadow: var(--rl-shadow-lg); animation: rl-toast 4.5s forwards; }
.rl-toast--danger { background: var(--rl-danger); color: #fff; }
@keyframes rl-toast { 0% { opacity: 0; transform: translateY(8px); } 6%, 88% { opacity: 1; transform: none; } 100% { opacity: 0; visibility: hidden; } }

/* ── Lists and tables ─────────────────────────────────────────────────── */
.rl-list { list-style: none; margin: 0; padding: 0; }
.rl-list-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--rl-line); min-width: 0; }
.rl-list-item:last-child { border-bottom: 0; }
a.rl-list-item, button.rl-list-item { width: 100%; background: none; border-inline: 0; border-top: 0; color: var(--rl-ink) !important; text-align: left; font: inherit; cursor: pointer; text-decoration: none !important; }
a.rl-list-item:hover, button.rl-list-item:hover { background: var(--rl-accent-soft); }
.rl-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rl-table-wrap { overflow-x: auto; border: 1px solid var(--rl-line); border-radius: var(--rl-radius); background: var(--rl-surface); }
.rl-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.rl-table th { text-align: left; font-size: .74rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--rl-muted); background: var(--rl-surface-2); padding: 9px 14px; border-bottom: 1px solid var(--rl-line); white-space: nowrap; }
.rl-table td { padding: 10px 14px; border-bottom: 1px solid var(--rl-line); vertical-align: middle; }
.rl-table tr:last-child td { border-bottom: 0; }
.rl-table tbody tr:hover { background: var(--rl-surface-2); }

/* ── Template cards (library) ─────────────────────────────────────────── */
.rl-tcard { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--rl-surface); border: 1px solid var(--rl-line); border-radius: var(--rl-radius); color: var(--rl-ink) !important; text-decoration: none !important; transition: border-color .12s, box-shadow .12s; }
.rl-tcard:hover { border-color: var(--rl-accent); }
.rl-tcard-title { font-family: var(--rl-font-display); font-weight: 650; font-size: 1rem; }
.rl-tcard-desc { color: var(--rl-muted); font-size: .86rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Disclosure, menus, dialogs (no JavaScript) ───────────────────────── */
.rl-details { border: 1px solid var(--rl-line); border-radius: var(--rl-radius); background: var(--rl-surface); }
.rl-details > summary { list-style: none; cursor: pointer; padding: 12px 16px; font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rl-details > summary::-webkit-details-marker { display: none; }
.rl-details > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--rl-muted); border-bottom: 2px solid var(--rl-muted); transform: rotate(45deg); transition: transform .15s; }
.rl-details[open] > summary::after { transform: rotate(-135deg); }
.rl-details-body { padding: 0 16px 16px; }
.rl-menu[popover] { margin: 0; inset: auto; position: fixed; top: calc(var(--rl-nav-h) - 4px); right: max(12px, env(safe-area-inset-right, 0px)); min-width: 210px; padding: 6px; border: 1px solid var(--rl-line); border-radius: var(--rl-radius); background: var(--rl-surface); color: var(--rl-ink); box-shadow: var(--rl-shadow-lg); }
.rl-menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--rl-radius-sm); background: none; color: var(--rl-ink) !important; font: inherit; text-align: left; cursor: pointer; text-decoration: none !important; }
.rl-menu-item:hover { background: var(--rl-sunken); }
dialog.rl-dialog { border: 1px solid var(--rl-line); border-radius: var(--rl-radius); padding: 0; background: var(--rl-surface); color: var(--rl-ink); box-shadow: var(--rl-shadow-lg); width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; z-index: 50; position: fixed; inset: 0; margin: auto; }
dialog.rl-dialog--side { inset: 0 0 0 auto; margin: 0; height: 100dvh; max-height: none; width: min(440px, 100vw); border-radius: 0; border-block: 0; border-right: 0; }
dialog.rl-dialog--wide { width: min(920px, calc(100vw - 32px)); }
.rl-backdrop { position: fixed; inset: 0; z-index: 49; border: 0; background: rgba(0, 0, 0, .5); cursor: default; }
body:has(dialog.rl-dialog[open]) { overflow: hidden; }

/* ── Tabs (radio-driven) ──────────────────────────────────────────────── */
.rl-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rl-line); overflow-x: auto; }
.rl-tab { padding: 9px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--rl-muted) !important; font: 600 .9rem var(--rl-font); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.rl-tab:hover { color: var(--rl-ink) !important; }
.rl-tab[aria-selected="true"], .rl-tab[aria-current="page"] { color: var(--rl-accent) !important; border-bottom-color: var(--rl-accent); }

/* ── Empty state, stat ────────────────────────────────────────────────── */
.rl-empty { text-align: center; padding: 36px 20px; color: var(--rl-muted); border: 1px dashed var(--rl-line-strong); border-radius: var(--rl-radius); }
.rl-stat { display: flex; flex-direction: column; gap: 2px; }
.rl-stat-value { font: 650 1.7rem/1.1 var(--rl-font-display); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) { .rl *, .rl *::before, .rl *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 640px) {
  .rl h1 { font-size: 1.4rem; }
  .rl-nav { gap: 10px; }
  .rl-card-body { padding: 14px; }
}

/* ── Theme section (three radio-style buttons in a form) ──────────────── */
.rl-theme { display: inline-flex; border: 1px solid var(--rl-line-strong); border-radius: var(--rl-radius-sm); overflow: hidden; }
.rl-theme button { border: 0; background: none; color: var(--rl-ink-2); font: 600 .82rem var(--rl-font); padding: 7px 12px; cursor: pointer; }
.rl-theme button + button { border-left: 1px solid var(--rl-line-strong); }
.rl-theme button:hover { background: var(--rl-sunken); }
.rl-theme button[aria-pressed="true"] { background: var(--rl-accent-soft); color: var(--rl-accent); }

/* ── Shell: navigation menu (popover) and narrow screens ──────────────── */
.rl-nav-user { max-width: 190px; }
.rl-nav-icon { display: inline-flex; align-items: center; }
.rl-nav-icon:empty { display: none; }
.rl-row--center { justify-content: center; }
.rl-menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--rl-line); font-weight: 600; min-width: 0; }
.rl-menu-section { display: flex; flex-direction: column; gap: 6px; padding: 10px; margin-top: 6px; border-top: 1px solid var(--rl-line); }
.rl-menu-section + .rl-menu-item { border-top: 1px solid var(--rl-line); border-radius: 0 0 var(--rl-radius-sm) var(--rl-radius-sm); }
.rl-menu-item[aria-current="page"] { background: var(--rl-accent-soft); color: var(--rl-accent) !important; }
.rl-menu[popover] { max-width: calc(100vw - 24px); max-height: calc(100dvh - var(--rl-nav-h) - 8px); overflow: auto; }
/* The section links move from the bar into the menu when the bar is too narrow for them. */
.rl-menu-nav { display: none; }
@media (max-width: 640px) {
  .rl-nav-links, .rl-nav-wide { display: none; }
  .rl-menu-nav { display: block; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--rl-line); }
  .rl-nav-user { max-width: 120px; }
}

/* ── COMPATIBILITY LAYER (temporary) ──────────────────────────────────────
   Pages that still host legacy fragments (the protected report generator and
   every area not redesigned yet) load Bootstrap 5, the Tailwind CDN build
   and the old shell styles; see dashboard/shell.go. On those pages <body>
   keeps its old classes instead of "rl", so nothing above restyles legacy
   content. The new look lives only inside elements marked "rl rl-scope"
   (navigation, overlay and toast hosts). The rules below (1) give such an
   element what "body.rl" would have given it and (2) cancel the global rules
   of the legacy frameworks that leak into it. Delete this section when the
   last area has left the compatibility layer. */
.rl-scope { font: 15px/1.55 var(--rl-font); color: var(--rl-ink); text-align: left; -webkit-font-smoothing: antialiased; color-scheme: dark; }
:root[data-theme="light"] .rl-scope { color-scheme: light; }
@media (prefers-color-scheme: light) { :root[data-theme="system"] .rl-scope { color-scheme: light; } }
/* Legacy content was written for a page without a colour scheme: native
   controls and scrollbars inside it stay as they were. */
body.rl-compat { margin: 0; color-scheme: normal; }
/* The old bar was 53px high; the generator sizes itself from the viewport height. */
body.rl-compat { --rl-nav-h: 53px; }
/* Bootstrap reboot: underlined links, squared buttons, heading and paragraph margins, label display. */
.rl-scope a { text-decoration: none; }
.rl-scope button { border-radius: 0; text-transform: none; letter-spacing: normal; }
.rl-scope .rl-btn, .rl-scope .rl-menu-item, .rl-scope .rl-nav-link { border-radius: var(--rl-radius-sm); }
/* Legacy unread-messages icon swapped into the bar by /messages/unread. */
.rl-nav-icon a { display: inline-flex; padding: 6px 8px; color: var(--rl-ink-2); }

/* Signed-in indicator in the navigation */
.rl-nav-user { gap: 8px; }
.rl-nav-user-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rl-ok); flex: none; }
.rl-menu-head .rl-eyebrow { margin-bottom: 2px; }

/* ── Sponsored window (ui/sponsor.go, js/sponsor-drag.js) ────────────────
   Bottom-right floating card in the site's own look. Closing is a CSS
   checkbox, expanding a <details>; the script only adds dragging. */
.rl-sponsor-close { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.rl-sponsor-close:checked + .rl-sponsor { display: none; }
.rl-sponsor {
  position: fixed; right: 16px; bottom: 16px; z-index: 900;
  width: 280px; max-width: calc(100vw - 32px);
  background: var(--rl-surface); color: var(--rl-ink);
  border: 1px solid var(--rl-line-strong); border-radius: var(--rl-radius);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--rl-bg) 55%, transparent), 0 2px 6px color-mix(in srgb, var(--rl-ink) 10%, transparent);
  font-size: .9rem; overflow: hidden;
}
.rl-sponsor--dragging { user-select: none; }
.rl-sponsor-bar {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px;
  background: var(--rl-surface-2); border-bottom: 1px solid var(--rl-line);
  cursor: grab; touch-action: none;
}
.rl-sponsor--dragging .rl-sponsor-bar { cursor: grabbing; }
.rl-sponsor-bar:focus-visible { outline: 2px solid var(--rl-focus); outline-offset: -2px; }
.rl-sponsor-grip {
  width: 14px; height: 10px; flex: none; opacity: .7;
  background-image: radial-gradient(circle, var(--rl-muted) 1.2px, transparent 1.4px);
  background-size: 5px 5px;
}
.rl-sponsor-label { flex: 1; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--rl-muted); }
.rl-sponsor-x {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--rl-radius-sm);
  color: var(--rl-muted); cursor: pointer;
}
.rl-sponsor-x:hover { background: var(--rl-sunken); color: var(--rl-ink); }
.rl-sponsor-close:focus-visible + .rl-sponsor .rl-sponsor-x { outline: 2px solid var(--rl-focus); }
.rl-sponsor svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rl-sponsor-x svg { width: 15px; height: 15px; }
.rl-sponsor-body > summary {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none;
}
.rl-sponsor-body > summary::-webkit-details-marker { display: none; }
.rl-sponsor-body > summary:hover { background: var(--rl-surface-2); }
.rl-sponsor-body > summary:focus-visible { outline: 2px solid var(--rl-focus); outline-offset: -2px; }
.rl-sponsor-mark {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: var(--rl-radius);
  background: var(--rl-accent-soft); color: var(--rl-accent); border: 1px solid var(--rl-accent-line); font-size: 18px;
}
.rl-sponsor-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.rl-sponsor-text b { font-weight: 650; }
.rl-sponsor-text span { color: var(--rl-muted); font-size: .82rem; }
.rl-sponsor-chev { color: var(--rl-muted); transition: transform .15s ease; }
.rl-sponsor-body[open] .rl-sponsor-chev { transform: rotate(180deg); }
.rl-sponsor-more { display: flex; flex-direction: column; gap: 10px; padding: 2px 12px 12px; }
.rl-sponsor-pitch { margin: 0; color: var(--rl-ink-2); line-height: 1.45; }
.rl-sponsor-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; color: var(--rl-ink-2); }
.rl-sponsor-list li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.35; }
.rl-sponsor-tick { color: var(--rl-accent); flex: none; margin-top: .15em; }
@media (max-width: 480px) { .rl-sponsor { right: 8px; bottom: 8px; max-width: calc(100vw - 16px); } }
@media print { .rl-sponsor, .rl-sponsor-close { display: none; } }
.rl-sponsor-pitch em { font-style: normal; color: var(--rl-accent); font-weight: 600; }
.rl-sponsor-fine { text-align: center; font-size: .72rem; color: var(--rl-muted); margin-top: -4px; }
/* A single soft pulse of the icon when the page opens draws the eye once;
   nothing loops, and it is off for people who prefer reduced motion. */
@keyframes rl-sponsor-nudge { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.12); } 70% { transform: scale(.97); } }
.rl-sponsor-body:not([open]) .rl-sponsor-mark { animation: rl-sponsor-nudge .9s ease 1.2s 1 both; }
@media (prefers-reduced-motion: reduce) { .rl-sponsor-body .rl-sponsor-mark { animation: none; } }
/* App icon and App Store screenshot (Coursely's own artwork, public/ads). */
.rl-sponsor-icon { flex: none; line-height: 0; }
.rl-sponsor-icon img { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 0 0 1px var(--rl-line); }
.rl-sponsor-body:not([open]) .rl-sponsor-icon { animation: rl-sponsor-nudge .9s ease 1.2s 1 both; }
@media (prefers-reduced-motion: reduce) { .rl-sponsor-body .rl-sponsor-icon { animation: none; } }
.rl-sponsor-shot { display: block; line-height: 0; margin: 0 -12px; background: #000; }
.rl-sponsor-shot img { display: block; width: 100%; height: 250px; object-fit: cover; object-position: center top; }
.rl-sponsor-shot:focus-visible { outline: 2px solid var(--rl-focus); outline-offset: -2px; }
.rl-sponsor-more { max-height: calc(100vh - 140px); overflow-y: auto; }
/* Compact sizing (owner request: smaller, never in the way of the content). */
.rl-sponsor { width: 236px; font-size: .82rem; right: 12px; bottom: 12px; }
.rl-sponsor-bar { padding: 2px 4px 2px 8px; }
.rl-sponsor-x { width: 22px; height: 22px; }
.rl-sponsor-body > summary { gap: 8px; padding: 7px 9px; }
.rl-sponsor-icon img { width: 30px; height: 30px; border-radius: 8px; }
.rl-sponsor-text b { font-size: .8rem; }
.rl-sponsor-text span { font-size: .7rem; }
.rl-sponsor-more { gap: 7px; padding: 0 9px 9px; }
.rl-sponsor-shot { margin: 0 -9px; }
.rl-sponsor-shot img { height: 190px; object-position: center 38%; }
.rl-sponsor-list { gap: 3px; font-size: .78rem; }
.rl-sponsor-fine { font-size: .66rem; }
@media (max-height: 640px) { .rl-sponsor-shot { display: none; } }
@media (max-width: 480px) { .rl-sponsor { width: 210px; right: 8px; bottom: 8px; } .rl-sponsor-shot img { height: 150px; } }
/* Template text card and hand-off stop state (public/js/site.js). */
.rl-pub-copy .rl-report { max-height: 420px; overflow: auto; }
.rl-pub-handoff--stopped .rl-pub-handoff-bar, .rl-pub-handoff--stopped::after { animation: none !important; display: none; }
.rl-btn--ok { background: var(--rl-ok-soft, var(--rl-accent-soft)); color: var(--rl-ok, var(--rl-accent)); border-color: transparent; }
/* Full-view picture, header-only text, arrow direction (owner request). */
.rl-sponsor-shot { margin: 0; border-top: 1px solid var(--rl-line); }
.rl-sponsor-shot img { width: 100%; height: auto; max-height: calc(100vh - 150px); object-fit: cover; object-position: center top; }
@media (max-height: 640px) { .rl-sponsor-shot { display: block; } }
@media (max-width: 480px) { .rl-sponsor-shot img { height: auto; max-height: 55vh; } }
.rl-sponsor-text span strong { color: var(--rl-accent); font-weight: 650; }
/* The arrow shows what a click does: up (expand) when collapsed, down
   (minimise) when open. */
.rl-sponsor-chev { transform: rotate(180deg); }
.rl-sponsor-body[open] .rl-sponsor-chev { transform: none; }
