/* pgkiln theme: a Universal Theme-inspired layout (dark header, side
   navigation, title bar with breadcrumbs, 12-column region grid). */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eceef2;
  --text: #1b2330;
  --muted: #5e6a7a;
  --border: #dfe3e8;
  --accent: #0b63c5;
  --accent-text: #ffffff;
  --accent-soft: #e7f0fb;
  --danger: #c23028;
  --danger-soft: #fdeceb;
  --success: #17794a;
  --success-soft: #e5f4ec;
  --warning-soft: #fff6e0;
  --header: #13294b;
  --header-text: #eef2f8;
  --nav-bg: #ffffff;
  --nav-active: #e7f0fb;
  --radius: 8px;
  /* Theme Roller style variants may change these (src/runtime/styles.ts) */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-size: 15px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 6%);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-width: 240px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1319;
    --surface: #171c24;
    --surface-2: #1d232d;
    --surface-3: #252c38;
    --text: #e3e7ed;
    --muted: #97a1b0;
    --border: #2b3340;
    --accent: #69a4ff;
    --accent-text: #0b1220;
    --accent-soft: #1b2a44;
    --danger: #ff7a70;
    --danger-soft: #3a1d1b;
    --success: #5ccf8e;
    --success-soft: #15301f;
    --warning-soft: #3a3016;
    --header: #0a0e14;
    --header-text: #e3e7ed;
    --nav-bg: #131820;
    --nav-active: #1b2a44;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1319;
  --surface: #171c24;
  --surface-2: #1d232d;
  --surface-3: #252c38;
  --text: #e3e7ed;
  --muted: #97a1b0;
  --border: #2b3340;
  --accent: #69a4ff;
  --accent-text: #0b1220;
  --accent-soft: #1b2a44;
  --danger: #ff7a70;
  --danger-soft: #3a1d1b;
  --success: #5ccf8e;
  --success-soft: #15301f;
  --warning-soft: #3a3016;
  --header: #0a0e14;
  --header-text: #e3e7ed;
  --nav-bg: #131820;
  --nav-active: #1b2a44;
  color-scheme: dark;
}

/* ---------- base style "Iris" (theme.base = 'iris'; the default for new
   applications, like APEX 26's Iris theme style): (sprint 72) a light body,
   a dark warm-grey header and menu with a thin accent strip, square-ish
   regions with a rule under their header, 4 px corners, a dark primary button
   and a large page title on the body. Selectors are html[data-style="iris"]:
   they beat the Standard values above, and the application's own colours
   (src/runtime/styles.ts, html:root, later in the page) beat them in turn.
   Contrast: text ≥ 15:1, muted ≥ 5.8:1, accent ≥ 5.5:1, menu text ≥ 10:1. */
html[data-style="iris"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f6f5;
  --surface-3: #efedeb;
  --text: #1f1c1a;
  --muted: #645e59;
  --border: #e2dfdc;
  --accent: #2b62c4;
  --accent-text: #ffffff;
  --accent-soft: #e9f0fb;
  --header: #3a3632;
  --header-text: #f7f5f3;
  --nav-bg: #2f2b28;
  --nav-text: #ece8e4;
  --nav-muted: #b9b2ab;
  --nav-hover: #403b37;
  --nav-active: #4a443f;
  --nav-current: #ffffff;
  --hot: #2f2b28;
  --hot-text: #ffffff;
  --radius: 4px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --shadow: none;
}
@media (prefers-color-scheme: dark) {
  html[data-style="iris"]:not([data-theme="light"]) {
    --bg: #1a1817;
    --surface: #232120;
    --surface-2: #2a2826;
    --surface-3: #33302d;
    --text: #ece9e6;
    --muted: #aaa49e;
    --border: #3a3633;
    --accent: #84aef2;
    --accent-text: #10131a;
    --accent-soft: #23324a;
    --header: #121110;
    --header-text: #ece9e6;
    --nav-bg: #1d1b1a;
    --nav-text: #e2ded9;
    --nav-muted: #a39c95;
    --nav-hover: #2c2927;
    --nav-active: #36322f;
    --nav-current: #ffffff;
    --hot: #ece9e6;
    --hot-text: #1a1817;
  }
}
html[data-style="iris"][data-theme="dark"] {
  --bg: #1a1817;
  --surface: #232120;
  --surface-2: #2a2826;
  --surface-3: #33302d;
  --text: #ece9e6;
  --muted: #aaa49e;
  --border: #3a3633;
  --accent: #84aef2;
  --accent-text: #10131a;
  --accent-soft: #23324a;
  --header: #121110;
  --header-text: #ece9e6;
  --nav-bg: #1d1b1a;
  --nav-text: #e2ded9;
  --nav-muted: #a39c95;
  --nav-hover: #2c2927;
  --nav-active: #36322f;
  --nav-current: #ffffff;
  --hot: #ece9e6;
  --hot-text: #1a1817;
}
html[data-style="iris"] .t-header { box-shadow: inset 0 3px 0 var(--strip, var(--accent)); }
html[data-style="iris"] .t-nav { border-inline-end-color: transparent; }
html[data-style="iris"] .t-titlebar { background: transparent; border-bottom: 0; padding: 1.25rem 1.5rem 0.25rem; }
html[data-style="iris"] .t-titlebar h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
html[data-style="iris"] .region-header h2 { font-size: 1.05rem; }
html[data-style="iris"] .btn-hot { background: var(--hot); border-color: var(--hot); color: var(--hot-text); }
html[data-style="iris"] .btn-hot:hover { background: color-mix(in srgb, var(--hot) 82%, var(--bg)); }
html[data-style="iris"] .btn-hot .btn-badge { background: var(--hot-text); color: var(--hot); }

/* ---------- base style "Iris" (theme.base = 'iris'; the default for new
   applications, like APEX 26.1's Iris theme style). Selectors are
   html[data-style="lavender"]: they beat the Standard values above, and the
   application's own colours (src/runtime/styles.ts, html:root, later in the
   page) beat them in turn. Contrast: text ≥ 15:1, muted ≥ 5.8:1, accent ≥ 6.5:1. */
html[data-style="lavender"] {
  --bg: #f6f6fb;
  --surface: #ffffff;
  --surface-2: #f8f8fc;
  --surface-3: #eeeef6;
  --text: #1d1b2e;
  --muted: #5f5d75;
  --border: #e3e2ef;
  --accent: #5146d8;
  --accent-text: #ffffff;
  --accent-soft: #eeedfd;
  --header: #1e1a4d;
  --header-text: #f1f0ff;
  --nav-bg: #ffffff;
  --nav-active: #eeedfd;
  --radius: 12px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --shadow: 0 1px 2px rgb(30 27 75 / 5%), 0 2px 8px rgb(30 27 75 / 6%);
}
@media (prefers-color-scheme: dark) {
  html[data-style="lavender"]:not([data-theme="light"]) {
    --bg: #121120;
    --surface: #1a1930;
    --surface-2: #201f38;
    --surface-3: #292846;
    --text: #e8e7f5;
    --muted: #a3a1bd;
    --border: #302f4d;
    --accent: #a59cff;
    --accent-text: #14122b;
    --accent-soft: #2a2752;
    --header: #0d0c1a;
    --header-text: #e8e7f5;
    --nav-bg: #161528;
    --nav-active: #2a2752;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 2px 8px rgb(0 0 0 / 25%);
  }
}
html[data-style="lavender"][data-theme="dark"] {
  --bg: #121120;
  --surface: #1a1930;
  --surface-2: #201f38;
  --surface-3: #292846;
  --text: #e8e7f5;
  --muted: #a3a1bd;
  --border: #302f4d;
  --accent: #a59cff;
  --accent-text: #14122b;
  --accent-soft: #2a2752;
  --header: #0d0c1a;
  --header-text: #e8e7f5;
  --nav-bg: #161528;
  --nav-active: #2a2752;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 2px 8px rgb(0 0 0 / 25%);
}
/* Lavender: rounded navigation pills instead of an edge bar, quieter region headers, pill-shaped primary buttons */
html[data-style="lavender"] .t-nav a[aria-current="page"] { border-inline-start-color: transparent; border-radius: calc(var(--radius) * 0.75); }
html[data-style="lavender"] .t-nav a, html[data-style="lavender"] .t-nav summary { border-radius: calc(var(--radius) * 0.75); }
html[data-style="lavender"] .region-header { border-bottom-color: transparent; }
html[data-style="lavender"] .region-header h2 { letter-spacing: -0.01em; }
html[data-style="lavender"] .btn-hot { border-radius: 999px; }
html[data-style="lavender"] :focus-visible { outline-color: var(--accent); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: var(--font-size)/1.5 var(--font); background: var(--bg); color: var(--text); }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-3); padding: 0.1em 0.35em; border-radius: 4px; }
h1 { font-size: 1.45rem; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.lead { font-size: 1.05rem; margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: -9999px; top: 0; z-index: 100; background: var(--surface); padding: 0.5rem 1rem; }
.skip-link:focus { inset-inline-start: 0.5rem; top: 0.5rem; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* (0.31) icon modifiers, like Font APEX's: "users lg", "refresh spin", "truck flip-h success" */
.icon.icon-xs { width: 0.75em; height: 0.75em; } .icon.icon-sm { width: 0.875em; height: 0.875em; }
.icon.icon-lg { width: 1.33em; height: 1.33em; } .icon.icon-2x { width: 2em; height: 2em; }
.icon.icon-3x { width: 3em; height: 3em; } .icon.icon-4x { width: 4em; height: 4em; }
.icon-rotate-90 { transform: rotate(90deg); } .icon-rotate-180 { transform: rotate(180deg); } .icon-rotate-270 { transform: rotate(270deg); }
.icon-flip-h { transform: scaleX(-1); } .icon-flip-v { transform: scaleY(-1); }
.icon-success { color: var(--success, #1b7f3b); } .icon-warning { color: var(--warning, #a15c00); } .icon-danger { color: var(--danger, #c0392b); }
.icon-info { color: var(--accent); } .icon-muted { color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .icon-spin { animation: icon-spin 1.6s linear infinite; }
  .icon-pulse { animation: icon-spin 1s steps(8) infinite; }
}
@keyframes icon-spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- header ---------- */
.t-header, .topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 0.75rem;
  height: 52px; padding: 0 0.75rem;
  background: var(--header); color: var(--header-text);
}
.t-header a, .topbar a { color: var(--header-text); text-decoration: none; }
.t-logo, .brand { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-spacer { flex: 1; }
.icon-button {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; font-size: 1.3rem;
}
.icon-button:hover { background: rgb(255 255 255 / 10%); }
.t-user > summary { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; padding: 0.35rem 0.6rem; border-radius: 6px; list-style: none; }
.t-user > summary::-webkit-details-marker { display: none; }
.t-user > summary:hover { background: rgb(255 255 255 / 10%); }

/* (165) the notification bell: the unread count on the icon, the newest notifications in its menu */
.t-bell > summary { position: relative; }
.t-bell-count {
  position: absolute; top: 1px; inset-inline-end: 0; min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem; border-radius: 99px;
  background: #d92d20; color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 1.15rem; text-align: center;
  box-shadow: 0 0 0 2px var(--header, #1d1b31);
}
.t-bell-panel { width: min(380px, calc(100vw - 1rem)); }
.t-bell-head { flex-direction: row; align-items: center; justify-content: space-between; }
.t-bell-read { margin: 0; }
.t-bell-read .link-button { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; }
.t-bell-none { padding: 0.5rem 0.9rem; margin: 0; }
.t-bell-list, .t-notification-list { list-style: none; margin: 0; padding: 0; }
.t-bell-list form, .t-notification-list form { margin: 0; }
.t-notification {
  display: flex; gap: 0.6rem; align-items: flex-start; width: 100%; padding: 0.55rem 0.9rem; border: 0; background: none;
  color: var(--text); font: inherit; text-align: start; cursor: pointer;
}
.t-notification:hover, .t-notification:focus-visible { background: var(--surface-2, rgb(0 0 0 / 4%)); }
.t-notification > .icon { flex: none; margin-top: 0.15rem; color: var(--muted); }
.t-notification-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.t-notification-title { font-weight: 500; }
.t-notification-body { color: var(--muted); font-size: 0.88rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.t-notification-time { color: var(--muted); font-size: 0.78rem; }
.is-unread > form > .t-notification { box-shadow: inset 3px 0 0 var(--accent); }
.is-unread .t-notification-title { font-weight: 700; }
.is-unread > form > .t-notification > .icon { color: var(--accent); }
.t-notification-list > li + li { border-top: 1px solid var(--border); }

/* ---------- menus (details dropdowns) ---------- */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; z-index: 30; top: calc(100% + 6px); inset-inline-start: 0; min-width: 240px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgb(16 24 40 / 16%); padding: 0.4rem 0;
  max-height: min(80vh, 42rem); overflow: auto;
}
.menu-panel.align-right, .actions-menu .menu-panel { inset-inline-start: auto; inset-inline-end: 0; }
.menu-section { padding: 0.5rem 0.9rem; display: flex; flex-direction: column; gap: 0.4rem; }
.menu-section + .menu-section { border-top: 1px solid var(--border); }
.menu-links a, .menu-links button { color: var(--text); text-decoration: none; padding: 0.2rem 0; display: flex; align-items: center; gap: 0.45rem; background: none; border: 0; font: inherit; cursor: pointer; text-align: start; }
.menu-links a:hover, .menu-links button:hover { color: var(--accent); }
.menu-links .icon { width: 1em; height: 1em; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; min-width: 320px; }
.filter-row input, .filter-row .btn { grid-column: span 1; }
.seg { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.seg a { padding: 0.15rem 0.55rem; border: 1px solid var(--border); border-radius: 99px; text-decoration: none; color: var(--text); font-size: 0.85rem; }
.seg a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---------- body + side navigation ---------- */
.t-body { display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); min-height: calc(100vh - 52px); }
@media (min-width: 1024px) {
  body.nav-collapsed .t-body { grid-template-columns: 0 minmax(0, 1fr); }
  body.nav-collapsed .t-nav { visibility: hidden; }
}
.t-nav { background: var(--nav-bg); border-inline-end: 1px solid var(--border); overflow: hidden auto; }
.t-nav ul { list-style: none; margin: 0; padding: 0.5rem; }
/* (sprint 117) a subtree hangs on a guide line; the open trail's line in the accent */
.t-nav ul ul { padding: 0; padding-inline-start: 0.35rem; margin-inline-start: 1.05rem; border-inline-start: 1px solid var(--nav-guide, color-mix(in srgb, var(--nav-text, var(--text)) 16%, transparent)); }
.t-nav details:has(> summary.in-trail) > ul { border-inline-start-color: color-mix(in srgb, var(--nav-current, var(--accent)) 55%, transparent); }
.t-nav a, .t-nav summary {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem 0.65rem; border-radius: 6px;
  /* (sprint 117) the bar at the inline start (left, or right in RTL) marks the current page */
  border-inline-start: 3px solid transparent; padding-inline-start: calc(0.65rem - 3px);
  color: var(--nav-text, var(--text)); text-decoration: none; cursor: pointer; white-space: nowrap; font-size: 0.93rem;
}
.t-nav summary { list-style: none; }
.t-nav summary::-webkit-details-marker { display: none; }
.t-nav summary::after { content: "›"; margin-inline-start: auto; color: var(--nav-muted, var(--muted)); transition: transform 0.15s; }
.t-nav details[open] > summary::after { transform: rotate(90deg); }
/* RTL: the bidi algorithm mirrors "›" to "‹"; opened, it turns the other way to point down */
[dir="rtl"] .t-nav details[open] > summary::after { transform: rotate(-90deg); }
.t-nav a:hover, .t-nav summary:hover { background: var(--nav-hover, var(--surface-3)); }
/* (sprint 117) the selected entry (keyboard focus) gets a ring inside the menu, which scrolls and would clip one outside */
.t-nav a:focus-visible, .t-nav summary:focus-visible { outline: 2px solid var(--nav-current, var(--accent)); outline-offset: -2px; }
/* (sprint 72) --nav-* let a style have a dark menu (Iris); without them the menu takes the page's colours.
   (sprint 117) Current page: filled, the accent bar and text. Its parent entries (the trail): bold, the menu's text
   colour with an accent icon, no fill, so the two are told apart at a glance. */
.t-nav a[aria-current="page"] { background: var(--nav-active); color: var(--nav-current, var(--accent)); font-weight: 600; border-inline-start-color: var(--accent); }
.t-nav .in-trail { color: var(--nav-text, var(--text)); font-weight: 600; }
.t-nav .icon { color: var(--nav-muted, var(--muted)); }
.t-nav a[aria-current="page"] .icon, .t-nav .in-trail .icon { color: var(--nav-current, var(--accent)); }

/* ---------- main ---------- */
.t-main { min-width: 0; }
.t-titlebar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0.9rem 1.5rem 1rem; }
.crumbs { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; margin: 0 0 0.2rem; padding: 0; font-size: 0.83rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 0.35rem; color: var(--border); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.t-content { padding: 1.25rem 1.5rem 3rem; max-width: 1500px; }
.t-regions { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.t-regions > .region { grid-column: span 12; }
.t-regions > .col-1 { grid-column: span 1; } .t-regions > .col-2 { grid-column: span 2; } .t-regions > .col-3 { grid-column: span 3; }
.t-regions > .col-4 { grid-column: span 4; } .t-regions > .col-5 { grid-column: span 5; } .t-regions > .col-6 { grid-column: span 6; }
.t-regions > .col-7 { grid-column: span 7; } .t-regions > .col-8 { grid-column: span 8; } .t-regions > .col-9 { grid-column: span 9; }
.t-regions > .col-10 { grid-column: span 10; } .t-regions > .col-11 { grid-column: span 11; }

/* ---------- regions ---------- */
.region { min-width: 0; }
.region-standard, .region-collapsible, .region-wizard, .region-inline_dialog, .region-inline_drawer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
/* (088) more region templates */
.region-hero { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem 1.5rem; padding: 2rem 1.75rem; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--text); }
.region-hero-icon .icon { width: 3rem; height: 3rem; color: var(--accent); }
/* (097) the generated home page: the icon on a tile in the accent colour */
.region-hero-icon { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; border-radius: calc(var(--radius) + 4px); background: var(--accent); }
.region-hero-icon .icon { width: 2.4rem; height: 2.4rem; color: var(--accent-text, #fff); }
.region-hero-text h2 { font-size: 1.75rem; margin: 0 0 0.35rem; }
.region-hero-buttons, .region-title-buttons, .region-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media (max-width: 640px) { .region-hero { grid-template-columns: 1fr; padding: 1.25rem 1rem; } }
.region-title-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.25rem 0; border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; }
.region-title-bar h2 { margin: 0; font-size: 1.15rem; }
.region-buttons_container .region-buttons { justify-content: flex-end; }
.region-wizard { max-width: 640px; width: 100%; margin-left: auto; margin-right: auto; }
dialog[data-inline-region] { padding: 0; max-width: min(640px, calc(100vw - 2rem)); width: 100%; color: var(--text); }
dialog[data-inline-region]::backdrop { background: rgb(0 0 0 / 45%); }
dialog[data-inline-region] .region-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
dialog.region-inline_drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; max-width: min(480px, 100vw); border-radius: 0; }
/* without JavaScript: a link to #R<id> shows it */
dialog[data-inline-region]:target { display: block; position: fixed; inset: 2rem 0 auto; margin: 0 auto; z-index: 1000; }
dialog.region-inline_drawer:target { inset: 0 0 0 auto; }
/* (sprint 219) open: the header and the footer stay, the body scrolls between them */
dialog[data-inline-region][open], dialog[data-inline-region]:target { display: flex; flex-direction: column; max-height: calc(100vh - 4rem); }
dialog.region-inline_drawer[open], dialog.region-inline_drawer:target { max-height: 100vh; }
dialog[data-inline-region] > .region-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
dialog[data-inline-region] > .region-footer { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; border-top: 1px solid var(--border); }
dialog[data-inline-region] > .region-footer > .region-footer-regions { flex: 1 1 12rem; min-width: 0; }
dialog[data-inline-region] > .region-footer > .region-footer-regions .t-regions { margin: 0; }
dialog[data-inline-region] > .region-footer > .region-footer-buttons { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; }
/* (088) carousel (display selector style) and wizard progress (list template) */
.rds-carousel { display: flex; align-items: center; justify-content: center; gap: 0.75rem; }
.rds-carousel .rds-list { gap: 0.4rem; }
.rds-carousel .rds-tab { font-size: 0; width: 0.75rem; height: 0.75rem; padding: 0; border-radius: 50%; background: var(--border); min-height: 0; }
.rds-carousel .rds-tab.is-current { background: var(--accent); }
.rds-carousel .rds-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wizard-progress ol { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 0; counter-reset: none; }
.wizard-step { flex: 1 1 0; min-width: 6rem; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.3rem; position: relative; color: var(--muted); font-size: 0.85rem; }
.wizard-step::before { content: ""; position: absolute; top: 0.95rem; left: -50%; right: 50%; border-top: 2px solid var(--border); z-index: 0; }
.wizard-step:first-child::before { display: none; }
.wizard-step a { color: inherit; text-decoration: none; display: contents; }
.wizard-step-no { position: relative; z-index: 1; display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); font-weight: 600; }
.wizard-step-no .icon { width: 1rem; height: 1rem; }
.wizard-step.is-done, .wizard-step.is-current { color: var(--text); }
.wizard-step.is-done .wizard-step-no { border-color: var(--accent); color: var(--accent); }
.wizard-step.is-done::before, .wizard-step.is-current::before { border-top-color: var(--accent); }
.wizard-step.is-current .wizard-step-no { background: var(--accent); border-color: var(--accent); color: var(--accent-text, #fff); }
.wizard-step.is-current .wizard-step-label { font-weight: 600; }
/* (172) sub regions: a grid under the region's own content, side by side (flex_container), or tabs (tabs_container) */
.region-tabs_container { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.region-children:not(:first-child), .region-tabs:not(:first-child) { margin-top: 1rem; }
.region-flex { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.region-flex > .region { flex: 1 1 16rem; min-width: 0; }
.region-tablist { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid var(--border); }
.region-tab { display: inline-block; padding: 0.5rem 0.9rem; text-decoration: none; color: var(--text); border-bottom: 3px solid transparent; margin-bottom: -1px; border-radius: var(--radius) var(--radius) 0 0; }
.region-tab:hover { background: var(--surface-2); }
.region-tab.is-current { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.region-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.region-tabpanel + .region-tabpanel { margin-top: 1rem; }
.region-tabs.is-tabs > .region-tabpanel { margin-top: 0; }
.region-tabpanel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.region-tabpanel[hidden] { display: none; }
.region-tabpanel-title { margin: 0 0 0.5rem; font-size: 1rem; }
.region-tabs.is-tabs .region-tabpanel-title { display: none; }
@media (max-width: 640px) {
  .region-tablist { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .region-tab { white-space: nowrap; padding: 0.5rem 0.7rem; }
}
.region-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 50px; padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); }
.region-collapsible summary.region-header { cursor: pointer; list-style: none; }
.region-collapsible summary.region-header::-webkit-details-marker { display: none; }
.region-collapsible details:not([open]) summary.region-header { border-bottom: 0; }
/* (166) header buttons of a collapsible region: over the header row, outside the summary (the toggle) */
.region-collapsible.has-header-buttons { position: relative; }
.region-collapsible > .region-header-buttons { position: absolute; top: 0; right: 1rem; z-index: 1; max-width: calc(min(50%, 22rem) - 1rem); min-height: 50px; display: flex; align-items: center; justify-content: flex-end; }
.region-collapsible > .region-header-buttons .buttons { margin: 0; flex-wrap: wrap; justify-content: flex-end; }
.region-collapsible.has-header-buttons > details > summary.region-header { padding-right: min(50%, 22rem); }
.region.to-compact > .region-header-buttons { min-height: 0; top: 0.35rem; }
.region-body { padding: 1rem; }
.region-footer { display: flex; padding: 0.75rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.region-plain > .region-footer { background: none; padding: 1rem 0 0; }
.region-toolbar { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }
.region-static p:first-child { margin-top: 0; }
.region-static p:last-child { margin-bottom: 0; }
/* (078) URL region: the framed page fills the region's width; its height is a class per region (PageCss) */
.url-frame { display: block; width: 100%; border: 1px solid var(--border, #d0d7de); border-radius: 6px; background: var(--surface, #fff); }
.url-open { margin: 0.5rem 0 0; font-size: 0.875rem; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1rem; margin-top: 1rem; }
.columns .region { margin: 0; }

/* ---------- alerts ---------- */
.messages:empty { display: none; }
.alert { position: relative; padding: 0.7rem 2.2rem 0.7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--text); border-color: color-mix(in srgb, var(--text) 20%, transparent); }
.alert-close { position: absolute; right: 0.5rem; top: 0.4rem; border: 0; background: none; color: inherit; font-size: 1.2rem; cursor: pointer; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 1rem 1.25rem; }
/* (167) the items of a region type that shows content of its own (a tree, chart, map …): under that content */
.form-grid.region-items { margin-top: 1rem; }
.page-items { margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.field[data-wide] { grid-column: 1 / -1; }
.label { font-size: 0.84rem; font-weight: 600; color: var(--muted); padding: 0; }
.req { color: var(--danger); margin-left: 0.2em; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--field-border, var(--border)); border-radius: calc(var(--radius) * 0.75); padding: 0.45rem 0.6rem; width: 100%; min-width: 0;
}
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; }
textarea.code { font-family: var(--mono); font-size: 0.84rem; line-height: 1.45; tab-size: 2; }
.sql-editor { min-height: 14rem; }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); margin: 0; }
.radio-group { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; padding: 0.35rem 0; }
.switch input[role=switch] {
  appearance: none; width: 2.4rem; height: 1.35rem; border-radius: 99px; background: var(--surface-3);
  border: 1px solid var(--border); position: relative; cursor: pointer; transition: background 0.15s;
}
.switch input[role=switch]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.35rem - 6px); height: calc(1.35rem - 6px);
  border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / 30%); transition: transform 0.15s;
}
.switch input[role=switch]:checked { background: var(--accent); border-color: var(--accent); }
.switch input[role=switch]:checked::after { transform: translateX(1.05rem); }
.display-value { padding: 0.45rem 0; min-height: 2.2rem; white-space: pre-wrap; }
.field.readonly .display-value { border-bottom: 1px dashed var(--border); }
.help { color: var(--muted); font-size: 0.8rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.error { color: var(--danger); font-size: 0.82rem; font-weight: 500; }
.default-submit { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
/* (sprint 117) a lighter processing indicator: a slight dim after 150 ms (no flicker on quick answers), a bar on regions (below) */
[aria-busy="true"] { opacity: 0.8; cursor: progress; transition: opacity 0.2s ease 0.15s; }

/* ---------- buttons ---------- */
.buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.region-footer .buttons { width: 100%; justify-content: flex-end; }
.region-footer .buttons > :first-child:not(.btn-hot) { margin-right: auto; }
.page-form > .buttons, form > .buttons { margin-top: 1rem; }
.region-header .buttons { margin: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  font: inherit; font-size: 0.9rem; font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap;
  padding: 0.42rem 0.9rem; border-radius: calc(var(--radius) * 0.75); border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-3); }
.btn-hot { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-hot:hover { background: color-mix(in srgb, var(--accent) 86%, black); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-badge { display: inline-block; min-width: 1.4em; padding: 0.05rem 0.4rem; border-radius: 99px; font-size: 0.72rem; font-weight: 650; line-height: 1.3; text-align: center; background: var(--accent); color: var(--accent-text); }
.btn-hot .btn-badge { background: var(--accent-text); color: var(--accent); }
/* menu buttons: a details dropdown whose summary looks like a button */
details.btn-menu { display: inline-block; }
details.btn-menu > summary .btn-caret { width: 0.9em; height: 0.9em; transform: rotate(90deg); transition: transform 0.15s; }
details.btn-menu[open] > summary .btn-caret { transform: rotate(-90deg); }
.region-footer details.btn-menu .menu-panel, .page-form > .buttons details.btn-menu .menu-panel { left: auto; right: 0; }
/* classes for dynamic actions (add_class / remove_class) */
.is-highlight { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }
.is-muted { opacity: 0.55; }
.is-success { border-color: var(--success) !important; }
.is-danger { border-color: var(--danger) !important; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-size: 0.85rem; color: var(--danger); cursor: pointer; text-decoration: underline; }
.link-button.plain { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 0.5rem; font-size: 0.93rem; }
.danger-zone { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); }

/* ---------- interactive report ---------- */
.report-toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; margin-bottom: 0.75rem; }
.report-toolbar .field { flex: 0 1 240px; }
.search { display: flex; gap: 0.4rem; flex: 1 1 320px; max-width: 560px; margin-left: auto; }
/* (sprint 78) a report whose search is the facets': the Actions menu at the start of the toolbar */
.report-toolbar .search:not(:has(input[type=search])) { flex: 0 1 auto; min-width: 0; margin-left: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.83rem; padding: 0.15rem 0.3rem 0.15rem 0.7rem; background: var(--accent-soft); border-radius: 99px; }
.chip a { text-decoration: none; font-size: 1rem; line-height: 1; padding: 0 0.3rem; border-radius: 99px; }
.chip a:hover { background: var(--surface); }
.chip-error { background: var(--danger-soft); outline: 1px solid var(--danger); }
.view-switch { margin: 0 0 0.6rem; }
.view-note { margin: 0.4rem 0; font-size: 0.85rem; }
.report th.row-select, .report td.row-select { width: 2.25rem; text-align: center; }
.report-pivot tbody th { text-align: left; font-weight: 600; }
.row-select-label { display: none; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
.region-plain .table-wrap, .region-standard .table-wrap { border-radius: 6px; }
table.report { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.report th, .report td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.report tbody tr:last-child td { border-bottom: 0; }
.report th { font-size: 0.85rem; color: var(--muted); background: var(--surface-2); font-weight: 650; }
/* (097) the edit link of a row: a pencil in a narrow first column */
.report th.row-edit, .report td.row-edit { width: 2.25rem; text-align: center; padding-left: 0.4rem; padding-right: 0.4rem; }
.report td.row-edit a { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 6px; color: var(--accent); }
.report td.row-edit a:hover, .report td.row-edit a:focus-visible { background: var(--accent-soft); }
.report th a { color: inherit; text-decoration: none; display: inline-flex; gap: 0.3rem; }
.report th a:hover { color: var(--accent); }
.sort-ind { font-size: 0.7em; }
.report tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.report .num { text-align: right; font-variant-numeric: tabular-nums; }
.report .pre { white-space: pre; font-family: var(--mono); font-size: 0.85rem; }
.report td { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.report td.empty, p.empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.null { color: var(--muted); font-style: italic; }
.pager { display: flex; gap: 0.5rem; align-items: center; justify-content: flex-end; margin-top: 0.75rem; font-size: 0.85rem; color: var(--muted); }
.pager span { margin-right: auto; }
/* a region cut off at its row limit; a lazy region before it arrives */
.region-limit { margin: 0.5rem 0 0; font-size: 0.85rem; color: var(--muted); }
.region-lazy { display: flex; align-items: center; justify-content: center; min-height: 5rem; max-width: 100%; color: var(--muted); font-size: 0.9rem; }
.region-lazy-link { overflow-wrap: anywhere; }

/* ---------- charts ----------
   Categorical palette (validated for colour-vision deficiency against both
   surfaces; slots are assigned in this fixed order, never cycled). */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  --chart-grid: #e6e8ec; --chart-axis: #c3c7ce;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --chart-grid: #262d39; --chart-axis: #3a4352;
  }
}
:root[data-theme="dark"] {
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --chart-grid: #262d39; --chart-axis: #3a4352;
}
.s1 { --c: var(--series-1); } .s2 { --c: var(--series-2); } .s3 { --c: var(--series-3); } .s4 { --c: var(--series-4); }
.s5 { --c: var(--series-5); } .s6 { --c: var(--series-6); } .s7 { --c: var(--series-7); } .s8 { --c: var(--series-8); }
.chart { margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; list-style: none; margin: 0; padding: 0; font-size: 0.85rem; color: var(--muted); }
.chart-legend li { display: flex; align-items: center; gap: 0.4rem; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }

/* horizontal bars */
.chart-bar { display: flex; flex-direction: column; gap: 0; }
.chart-bar > .bar-row { padding: 0.22rem 0; }
/* (097) gridlines behind the bars and a value axis under them */
.bar-stack { position: relative; }
.bar-grid { position: absolute; inset: -0.22rem 0; pointer-events: none; }
.bar-gridline { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--chart-grid); }
.bar-gridline.baseline { border-left-color: var(--chart-axis); }
.bar-stack > .bar-track { position: relative; }
.bar-axis { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; gap: 0.75rem; font-size: 0.72rem; color: var(--muted); }
.bar-axis > :last-child { min-width: 3rem; }
.bar-ticks { position: relative; height: 1.1rem; }
.bar-ticks > span { position: absolute; top: 0.15rem; transform: translateX(-50%); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-ticks > span:first-child { transform: none; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; gap: 0.75rem; align-items: center; font-size: 0.88rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.bar-stack { display: flex; flex-direction: column; gap: 2px; }
.bar-track { height: 1rem; border-radius: 0 4px 4px 0; overflow: hidden; }
.chart-bar.multi .bar-track { height: 0.6rem; }
.bar { display: block; height: 100%; background: var(--c); border-radius: 0 4px 4px 0; min-width: 2px; max-height: 24px; }
.bar-value { font-variant-numeric: tabular-nums; min-width: 3rem; text-align: right; }
.bar-row:hover .bar-label { color: var(--text); }

/* plots with a y axis (column, line, area) */
.chart-plot { position: relative; height: 240px; margin-left: 2.6rem; }
.chart-grid { position: absolute; inset: 0; }
.gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--chart-grid); }
.gridline.baseline { border-top-color: var(--chart-axis); }
.gridline span { position: absolute; right: calc(100% + 0.4rem); top: -0.6em; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-x { display: flex; margin-left: 2.6rem; font-size: 0.75rem; color: var(--muted); }
.chart-x span { flex: 1 1 0; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.3rem 1px 0; }
.chart-x span.skip { visibility: hidden; }
.chart-x.sparse span:not(.skip) { overflow: visible; display: flex; justify-content: center; }
/* a narrow chart (a region of a few columns, a phone): every other label of a sparse axis */
.chart:has(> .chart-plot) { container-type: inline-size; }
@container (max-width: 480px) { .chart-x.sparse span.odd { visibility: hidden; } }
.chart-line .chart-x, .chart-area .chart-x { margin-right: 0; }
.chart-cols { position: absolute; inset: 0; display: flex; }
.col-group { position: relative; flex: 1 1 0; display: flex; justify-content: center; gap: 2px; outline-offset: -2px; }
.col-group:hover, .col-group:focus-visible { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.col-slot { position: relative; height: 100%; flex: 0 1 24px; }
.col { position: absolute; left: 0; right: 0; background: var(--c); border-radius: 4px 4px 0 0; }
.col-value { position: absolute; left: 0; right: 0; text-align: center; font-size: 0.72rem; color: var(--muted); transform: translateY(-1.3em); font-variant-numeric: tabular-nums; pointer-events: none; }
.col-value[data-value]::after { content: attr(data-value); }
.col.neg { border-radius: 0 0 4px 4px; }
/* range: a floating column from low to high */
.col.range-col { border-radius: 4px; }
/* box plot: whisker from minimum to maximum with caps, the box between the quartiles, the median across it */
.box-slot { flex-basis: 32px; }
.box-whisker { position: absolute; left: 50%; width: 0; border-left: 1.5px solid var(--muted); }
.box-cap { position: absolute; left: 25%; right: 25%; border-top: 1.5px solid var(--muted); }
.box-iqr { position: absolute; left: 0; right: 0; box-sizing: border-box; background: color-mix(in srgb, var(--c) 35%, var(--surface)); border: 1.5px solid var(--c); border-radius: 3px; }
.box-median { position: absolute; left: 0; right: 0; border-top: 2.5px solid var(--text); }
/* stock: a candle per row, the wick from low to high, the body from open to close */
.stock-slot { flex-basis: 14px; }
.stock-wick { position: absolute; left: 50%; width: 0; border-left: 1.5px solid var(--muted); }
.stock-body { position: absolute; left: 0; right: 0; border-radius: 1px; }
.stock-body.up { background: var(--success); }
.stock-body.down { background: var(--danger); }
.stock-thin .col-group { gap: 0; }
.stock-thin .stock-slot { flex-basis: 6px; }
.line-plot { overflow: visible; }
.chart-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-lines .line { fill: none; stroke: var(--c); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
.chart-lines .area { fill: var(--c); opacity: 0.12; stroke: none; }
.dot { position: absolute; width: 10px; height: 10px; margin: 0 0 -5px -5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.chart-hits { position: absolute; inset: 0; overflow: hidden; }
.hit { position: absolute; top: 0; bottom: 0; }
.hit .guide { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid var(--chart-axis); display: none; }
.hit:hover .guide { display: block; }
/* stacked columns: one wider slot per label, segments divided by a hairline */
.col-slot.stack { flex-basis: 32px; }
.col.seg { border-radius: 0; box-shadow: inset 0 1px 0 var(--surface); }
.col.seg.top { border-radius: 4px 4px 0 0; } .col.seg.neg { border-radius: 0 0 4px 4px; }
/* combo: the lines sit over the columns but leave the hover to them */
.chart-combo .chart-lines { pointer-events: none; }
/* scatter: dots, and an x axis with its own ticks */
.pt { position: absolute; width: 9px; height: 9px; margin: 0 0 -4.5px -4.5px; border-radius: 50%; background: var(--c); opacity: 0.85; box-shadow: 0 0 0 1px var(--surface); outline-offset: 2px; }
.pt:hover, .pt:focus-visible { opacity: 1; transform: scale(1.4); }
.chart-xs { position: relative; height: 1.5rem; margin: 0 0 0 2.6rem; font-size: 0.75rem; color: var(--muted); }
.chart-xs span { position: absolute; top: 0.3rem; transform: translateX(-50%); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* donut */
.chart-donut { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.donut-figure { position: relative; width: min(200px, 60vw); aspect-ratio: 1; flex: none; }
.donut-figure svg { width: 100%; height: 100%; transform: none; }
.slice { fill: none; stroke: var(--c); stroke-width: 6; }
.chart-pie .slice { stroke-width: 15.9155; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 1.4rem; line-height: 1.1; }
.donut-center span { font-size: 0.78rem; color: var(--muted); }
.donut-legend { flex-direction: column; flex: 1 1 180px; gap: 0.45rem; font-size: 0.88rem; }
.donut-legend li { gap: 0.5rem; }
.lg-label { color: var(--text); }
.lg-value { margin-left: auto; font-variant-numeric: tabular-nums; }

/* drill-down: marks that link to a page (the data table holds the same links for the keyboard) */
.chart a.drill { color: inherit; text-decoration: none; cursor: pointer; }
.chart a.drill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a.bar-row.drill:hover .bar-label, .donut-legend a.drill:hover .lg-label { color: var(--accent); text-decoration: underline; }
.donut-legend a.drill { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
a.drill > .slice:hover, a.col-slot.drill:hover .col, a.col.drill:hover, a.bar-track.drill:hover .bar { filter: brightness(1.12); }

/* bubble: a scatter whose area encodes a third value */
.bubble { position: absolute; border-radius: 50%; background: color-mix(in srgb, var(--c) 45%, transparent); border: 1.5px solid var(--c); box-shadow: 0 0 0 1px var(--surface); }
.bubble:hover, .bubble:focus-visible { background: color-mix(in srgb, var(--c) 70%, transparent); }
.bubble-plot { margin-right: 1rem; margin-top: 0.75rem; }
.chart-axes { margin: 0 0 0 2.6rem; font-size: 0.75rem; color: var(--muted); }

/* gauge: status colours are reserved (never a series) and always come with an icon and a label */
:root { --status-good: #0ca30c; --status-warning: #fab219; --status-critical: #d03b3b; }
.status-good { --sc: var(--status-good); } .status-warning { --sc: var(--status-warning); } .status-critical { --sc: var(--status-critical); }
.chart-gauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 1rem; }
.gauge { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.5rem; border-radius: var(--radius); text-align: center; outline-offset: -2px; }
.gauge:hover { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.gauge-figure { position: relative; width: 100%; max-width: 200px; }
.gauge-figure svg { display: block; width: 100%; height: auto; }
.gauge-track { fill: none; stroke: var(--chart-grid); stroke-width: 10; }
.gauge-value { fill: none; stroke: var(--c); stroke-width: 10; }
.gauge-value[class*="status-"] { stroke: var(--sc); }
.gauge-band { fill: none; stroke: var(--sc); stroke-width: 2.5; }
.gauge-number { position: absolute; left: 0; right: 0; bottom: 0; font-size: 1.35rem; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }
.gauge-scale { display: flex; justify-content: space-between; width: 100%; max-width: 200px; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.gauge-label { font-size: 0.88rem; font-weight: 600; }
.gauge-status { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--muted); }
.status-icon { display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--sc); color: #fff; font-size: 0.7rem; font-weight: 700; }
.status-warning .status-icon { color: #1b2330; }
/* (sprint 226) gauge shapes: a full ring, a status light, horizontal status meters */
.gauge-ring { transform: rotate(-90deg); transform-origin: 50% 50%; }
.gauge-circle .gauge-number, .gauge-led .gauge-number { top: 50%; bottom: auto; transform: translateY(-50%); }
.gauge-circle, .gauge-led { max-width: 140px; }
.gauge-led { max-width: 96px; }
.gauge-light { fill: var(--sc, var(--c)); stroke: var(--surface); stroke-width: 3; }
.gauge-led .gauge-number { color: #fff; }
/* amber needs dark text (as the status icon) */
.gauge-led:has(.status-warning) .gauge-number { color: #1b2330; }
.chart-meters { display: grid; gap: 0.45rem; }
/* every row and the scale share one set of columns: the tracks line up */
.meter-scale, .meter-row { display: grid; grid-template-columns: minmax(3.5rem, var(--bar-label, 9rem)) minmax(3rem, 1fr) 3.5rem minmax(0, 7rem); align-items: center; gap: 0.5rem; }
.meter-row .bar-label, .meter-row .gauge-status { min-width: 0; overflow-wrap: anywhere; }
.meter-scale { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.meter-scale-range { grid-column: 2; display: flex; justify-content: space-between; }
.meter-row { border-radius: var(--radius); outline-offset: 2px; }
.meter-row .bar-value { text-align: right; }
.meter-row:hover { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.meter-track { position: relative; height: 0.9rem; border-radius: 999px; background: var(--chart-grid); overflow: hidden; }
.meter-value { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--c); }
.meter-value[class*="status-"] { background: var(--sc); }
.meter-tick { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--sc); }
@media (max-width: 560px) {
  .meter-row { grid-template-columns: minmax(0, 1fr) auto; }
  .meter-row .meter-track { grid-column: 1 / -1; grid-row: 2; }
  .meter-row .gauge-status { grid-column: 1 / -1; }
  .meter-scale { display: none; }
}

/* (sprint 220) sankey: nodes in columns, ribbons between them (SVG, stretched to the box), labels beside the nodes */
.sankey { position: relative; height: 22rem; margin: 0 0.25rem; }
.sankey-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sankey-link { fill: var(--c); opacity: 0.32; stroke: none; }
.sankey-link:hover { opacity: 0.6; }
.sankey-node { position: absolute; background: var(--c); border-radius: 2px; min-height: 2px; outline-offset: 2px; }
.sankey-node:hover, .sankey-node:focus-visible { filter: brightness(1.15); }
.sankey-label { position: absolute; transform: translateY(-50%); padding: 0 0.4rem; font-size: 0.8rem; white-space: nowrap; pointer-events: none; }
.sankey-label.is-end { text-align: right; }
.sankey-label small { color: var(--muted); }
/* (sprint 220) nbox: a grid of cells shaded from low to high, items as chips */
.nbox { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 0.35rem 0.5rem; }
.nbox-axis { font-size: 0.78rem; color: var(--muted); }
.nbox-axis-y { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; }
.nbox-axis-x { grid-column: 2; text-align: center; }
.nbox-grid { display: grid; gap: 3px; }
.nbox-cell { position: relative; padding: 0.4rem 0.5rem 0.5rem; border-radius: 4px; background: color-mix(in srgb, var(--series-1) var(--nbox-mix, 8%), var(--surface)); border: 1px solid var(--border); min-width: 0; }
.nbox-l0 { --nbox-mix: 4%; } .nbox-l1 { --nbox-mix: 10%; } .nbox-l2 { --nbox-mix: 17%; } .nbox-l3 { --nbox-mix: 25%; } .nbox-l4 { --nbox-mix: 34%; }
.nbox-count { position: absolute; top: 0.25rem; right: 0.45rem; font-size: 0.75rem; color: var(--muted); }
.nbox-items { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.nbox-item { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 0.78rem; outline-offset: 2px; }
/* (sprint 220) picto: a row of icons per label */
.chart-picto { display: flex; flex-direction: column; gap: 0.35rem; }
.picto-row { display: grid; grid-template-columns: minmax(70px, 25%) 1fr auto; gap: 0.75rem; align-items: center; font-size: 0.88rem; border-radius: 4px; outline-offset: 2px; }
.picto-icons { display: flex; flex-wrap: wrap; gap: 3px; }
.picto-icon { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 50%; background: var(--c); flex: none; }
.picto-part { position: relative; overflow: hidden; background: color-mix(in srgb, var(--c) 18%, transparent); }
.picto-fill { position: absolute; inset: 0 auto 0 0; background: var(--c); }
.picto-key { margin: 0; font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 0.35rem; }
/* funnel: stages in the query's order, centred bars of one hue */
.chart-funnel { display: flex; flex-direction: column; gap: 0.35rem; }
.funnel-row { display: grid; grid-template-columns: minmax(70px, 25%) 1fr auto; gap: 0.75rem; align-items: center; font-size: 0.88rem; border-radius: 4px; outline-offset: 2px; }
.funnel-track { display: flex; justify-content: center; height: 1.7rem; }
.funnel-bar { display: block; height: 100%; background: var(--c); border-radius: 4px; min-width: 2px; }
.funnel-row:hover .funnel-bar { filter: brightness(1.12); }
.funnel-row .bar-value small { color: var(--muted); font-size: 0.75rem; }

/* radar: one axis per row, one polygon per series */
.chart-radar { display: flex; justify-content: center; }
.radar-figure { position: relative; width: min(380px, 100%); aspect-ratio: 1; }
.radar-figure svg { display: block; width: 100%; height: 100%; }
.radar-ring, .radar-spoke { fill: none; stroke: var(--chart-grid); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.radar-area { fill: var(--c); fill-opacity: 0.14; stroke: var(--c); stroke-width: 2px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.radar-dot { fill: var(--c); stroke: var(--surface); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.radar-label { position: absolute; max-width: 28%; font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform: translate(-50%, -50%); border-radius: 3px; outline-offset: 1px; }
.radar-label.left { transform: translate(-100%, -50%); text-align: right; }
.radar-label.right { transform: translate(0, -50%); }
a.radar-label:hover { color: var(--accent); text-decoration: underline; }
.radar-tick { position: absolute; left: 50%; font-size: 0.65rem; color: var(--muted); transform: translate(3px, -50%); font-variant-numeric: tabular-nums; pointer-events: none; }

/* pyramid: one series as a triangle of segments (area = value), two series back to back */
.pyramid-figure { width: min(240px, 60vw); aspect-ratio: 10 / 9; flex: none; }
.pyramid-figure svg { display: block; width: 100%; height: 100%; }
.pyramid-seg { fill: var(--c); stroke: var(--surface); stroke-width: 1.5px; }
a.drill > .pyramid-seg:hover { filter: brightness(1.12); }
.chart-population { display: flex; flex-direction: column; gap: 3px; }
.pop-row { display: grid; grid-template-columns: 1fr minmax(0, max-content) 1fr; gap: 0.5rem; align-items: center; font-size: 0.85rem; }
.pop-track { display: flex; height: 1.1rem; border-radius: 3px; outline-offset: 1px; }
.pop-track.left { justify-content: flex-end; }
.pop-bar { display: block; height: 100%; background: var(--c); min-width: 1px; }
.pop-track.left .pop-bar { border-radius: 3px 0 0 3px; } .pop-track.right .pop-bar { border-radius: 0 3px 3px 0; }
.pop-track:hover .pop-bar, .pop-track:focus-visible .pop-bar { filter: brightness(1.12); }
.pop-label { max-width: 10rem; text-align: center; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-scale .pop-track { justify-content: space-between; height: auto; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* polar: equal sectors per row on the radar's rings, the radius is the value */
.polar-sector { fill: var(--c); fill-opacity: 0.8; stroke: var(--surface); stroke-width: 1px; vector-effect: non-scaling-stroke; }
a.drill > .polar-sector:hover { fill-opacity: 1; }

/* gantt: a label column and a time plot; rows share one height so the dependency lines line up */
.gantt { --gantt-row: 1.9rem; display: grid; grid-template-columns: minmax(72px, 26%) 1fr; column-gap: 0.75rem; font-size: 0.85rem; }
.gantt-corner { font-size: 0.75rem; color: var(--muted); align-self: end; padding-bottom: 0.3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-axis { position: relative; height: 1.5rem; border-bottom: 1px solid var(--chart-axis); font-size: 0.72rem; color: var(--muted); }
.gantt-axis span { position: absolute; bottom: 0.3rem; padding-left: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gantt-axis span.skip { visibility: hidden; }
@media (max-width: 640px) { .gantt-axis span.odd { visibility: hidden; } }
.gantt-labels { list-style: none; margin: 0; padding: 0; min-width: 0; }
.gantt-labels li { height: var(--gantt-row); line-height: var(--gantt-row); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.gantt-plot { position: relative; min-width: 0; }
.gantt-grid { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--chart-grid); }
.gantt-today { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--accent); z-index: 1; }
.gantt-lane { position: relative; height: var(--gantt-row); }
.gantt-bar { position: absolute; top: 0.4rem; bottom: 0.4rem; min-width: 3px; border-radius: 4px; background: var(--c); overflow: hidden; z-index: 2; outline-offset: 2px; }
.gantt-bar.partial { background: color-mix(in srgb, var(--c) 35%, var(--surface)); box-shadow: inset 0 0 0 1px var(--c); }
.gantt-progress { display: block; height: 100%; background: var(--c); }
.gantt-milestone { position: absolute; top: 50%; width: 0.8rem; height: 0.8rem; margin: -0.4rem 0 0 -0.4rem; background: var(--c); transform: rotate(45deg); border-radius: 2px; z-index: 2; outline-offset: 2px; }
.gantt-bar:hover, .gantt-bar:focus-visible, .gantt-milestone:hover, .gantt-milestone:focus-visible { filter: brightness(1.12); }
.gantt-deps { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 1; }
.gantt-dep { fill: none; stroke: var(--muted); stroke-width: 1.25px; }
/* (sprint 70) treemap, sunburst and timeline */
.treemap { position: relative; aspect-ratio: 16 / 10; max-height: 26rem; width: 100%; font-size: 0.78rem; }
.tm-group, .tm-cell { position: absolute; box-sizing: border-box; overflow: hidden; }
.tm-group { border: 1px solid var(--surface); }
.tm-title { position: absolute; top: 0; left: 0; right: 0; padding: 0.1rem 0.35rem; font-weight: 650; color: var(--text); background: color-mix(in srgb, var(--c) 42%, var(--surface)); box-shadow: inset 0 -2px 0 var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 1; }
/* tinted, with the page's text colour: contrast holds in light and dark */
.tm-cell { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.2rem 0.35rem 0.2rem 0.5rem; border: 1px solid var(--surface); background: color-mix(in srgb, var(--c) 24%, var(--surface)); box-shadow: inset 3px 0 0 var(--c); color: var(--text); text-decoration: none; }
.tm-leaf { background: color-mix(in srgb, var(--c) 32%, var(--surface)); }
.tm-cell:hover, .tm-cell:focus-visible { filter: brightness(1.12); }
.tm-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-value { opacity: 0.9; font-variant-numeric: tabular-nums; }
.sb { fill: var(--c); stroke: var(--surface); stroke-width: 0.25; }
.sb.d2 { fill-opacity: 0.78; } .sb.d3 { fill-opacity: 0.58; } .sb.d4 { fill-opacity: 0.4; }
a.drill > .sb:hover { filter: brightness(1.12); }
.timeline { font-size: 0.8rem; }
.timeline-axis { position: relative; height: 1.5rem; border-bottom: 1px solid var(--chart-axis); font-size: 0.72rem; color: var(--muted); }
.timeline-axis span { position: absolute; bottom: 0.3rem; padding-left: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline-axis span.skip { visibility: hidden; }
@media (max-width: 640px) { .timeline-axis span.odd { visibility: hidden; } }
.timeline-lane { border-bottom: 1px solid var(--chart-grid); padding-top: 0.25rem; }
.timeline-name { display: block; font-size: 0.75rem; font-weight: 650; color: var(--muted); }
.timeline-plot { position: relative; overflow: hidden; }
.tl-item, .tl-point { position: absolute; display: flex; align-items: center; height: 1.4rem; color: inherit; text-decoration: none; z-index: 2; outline-offset: 2px; }
.tl-item { min-width: 3px; border-radius: 4px; background: color-mix(in srgb, var(--c) 30%, var(--surface)); box-shadow: inset 3px 0 0 var(--c); }
.tl-item .tl-label { padding: 0 0.35rem 0 0.5rem; white-space: nowrap; }
.tl-point { gap: 0.3rem; margin-left: -0.35rem; white-space: nowrap; }
.tl-dot { width: 0.7rem; height: 0.7rem; flex: none; border-radius: 50%; background: var(--c); }
.tl-item:hover, .tl-item:focus-visible, .tl-point:hover .tl-dot, .tl-point:focus-visible .tl-dot { filter: brightness(1.12); }
.gantt-editable [data-task] { cursor: grab; touch-action: none; }
.gantt-editable .gantt-dragging { cursor: grabbing; z-index: 3; }
.gantt-editable .gantt-moving { box-shadow: 0 0 0 2px var(--accent); }
.gantt-handle { position: absolute; top: 0; right: 0; bottom: 0; width: 8px; cursor: ew-resize; background: color-mix(in srgb, var(--surface) 45%, transparent); }
.gantt-editable [aria-busy="true"], .gantt-editable[aria-busy="true"] { opacity: 0.7; }
.gantt-status { min-height: 1.3em; margin: 0.4rem 0 0; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.gantt-hint { margin: 0.2rem 0 0; font-size: 0.8rem; }
.gantt-arrow { position: absolute; width: 0; height: 0; margin: -4px 0 0 -6px; border: 4px solid transparent; border-left: 6px solid var(--muted); border-right-width: 0; pointer-events: none; z-index: 1; }

/* data table + tooltip */
.chart-data > summary { cursor: pointer; font-size: 0.82rem; color: var(--muted); width: fit-content; }
.chart-data[open] > summary { margin-bottom: 0.5rem; }
.chart-tip {
  position: fixed; z-index: 60; pointer-events: none; max-width: min(320px, 90vw);
  background: var(--text); color: var(--surface); font-size: 0.8rem; padding: 0.35rem 0.6rem; border-radius: 6px;
  box-shadow: 0 4px 14px rgb(0 0 0 / 20%);
}

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
a.card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgb(16 24 40 / 10%); }
.card-head { display: flex; gap: 0.75rem; align-items: flex-start; }
.card-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.card-icon .icon { width: 22px; height: 22px; }
.card-titles { flex: 1; min-width: 0; }
.card h3 { font-size: 1rem; margin: 0; }
.card-subtitle { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.85rem; }
.card-body { margin: 0; font-size: 0.9rem; color: var(--muted); }
.badge-pill { font-size: 0.78rem; font-weight: 600; padding: 0.1rem 0.55rem; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.cards-metric { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.card.metric { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 0.9rem; align-items: center; }
.metric-icon { grid-row: span 2; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.metric-icon .icon { width: 24px; height: 24px; }
.metric-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-label { color: var(--muted); font-size: 0.85rem; }

/* ---------- dialogs ---------- */
dialog.t-dialog {
  width: min(760px, calc(100vw - 2rem)); height: min(720px, calc(100vh - 2rem)); padding: 0;
  border: 0; border-radius: 12px; background: var(--surface); color: var(--text);
  box-shadow: 0 24px 60px rgb(0 0 0 / 30%); display: none; flex-direction: column;
}
dialog.t-dialog[open] { display: flex; }
dialog.t-dialog::backdrop { background: rgb(15 20 30 / 45%); }
/* (065) dialog sizes and drawers (Page Designer: Dialog position / size) */
dialog.t-dialog-small { width: min(480px, calc(100vw - 2rem)); height: min(560px, calc(100vh - 2rem)); }
dialog.t-dialog-large { width: min(1100px, calc(100vw - 2rem)); height: min(860px, calc(100vh - 2rem)); }
dialog.t-drawer { margin: 0; max-width: 100vw; max-height: 100dvh; border-radius: 0; }
dialog.t-dialog-left, dialog.t-dialog-right { top: 0; bottom: 0; height: 100dvh; width: min(560px, 100vw); }
dialog.t-dialog-left.t-dialog-small, dialog.t-dialog-right.t-dialog-small { width: min(400px, 100vw); }
dialog.t-dialog-left.t-dialog-large, dialog.t-dialog-right.t-dialog-large { width: min(860px, 100vw); }
dialog.t-dialog-right { left: auto; right: 0; border-radius: var(--radius) 0 0 var(--radius); }
dialog.t-dialog-left { right: auto; left: 0; border-radius: 0 var(--radius) var(--radius) 0; }
dialog.t-dialog-top, dialog.t-dialog-bottom { left: 0; right: 0; width: 100vw; height: min(50dvh, 520px); }
dialog.t-dialog-top.t-dialog-small, dialog.t-dialog-bottom.t-dialog-small { height: min(34dvh, 360px); }
dialog.t-dialog-top.t-dialog-large, dialog.t-dialog-bottom.t-dialog-large { height: min(80dvh, 820px); }
dialog.t-dialog-top { bottom: auto; top: 0; border-radius: 0 0 var(--radius) var(--radius); }
dialog.t-dialog-bottom { top: auto; bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
@media (prefers-reduced-motion: no-preference) {
  dialog.t-drawer[open] { animation: t-drawer-in 0.18s ease-out; }
  dialog.t-dialog-left[open] { --from: translateX(-100%); }
  dialog.t-dialog-right[open] { --from: translateX(100%); }
  dialog.t-dialog-top[open] { --from: translateY(-100%); }
  dialog.t-dialog-bottom[open] { --from: translateY(100%); }
}
@keyframes t-drawer-in { from { transform: var(--from); } to { transform: none; } }
.t-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0.6rem 0.6rem 1.25rem; border-bottom: 1px solid var(--border); }
.t-dialog-head .icon-button:hover { background: var(--surface-3); }
dialog.t-dialog iframe { flex: 1; width: 100%; border: 0; background: var(--surface); }
body.t-dialog-page { background: var(--surface); }
.t-dialog-main { padding: 1.25rem 1.25rem 0; }
.t-dialog-page .region-footer { position: sticky; bottom: 0; margin: 1rem -1.25rem 0; padding: 0.8rem 1.25rem; background: var(--surface-2); border-top: 1px solid var(--border); }
.t-dialog-page .t-content { padding: 0; }

/* ---------- login / error pages ---------- */
.login-body { display: grid; min-height: 100vh; place-items: center; background: linear-gradient(160deg, var(--header) 0 38%, var(--bg) 38%); }
.login, .t-error { width: 100%; padding: 1rem; }
.card.login-card, .t-error .card { max-width: 380px; margin: 0 auto; padding: 2rem; gap: 1rem; border-radius: 12px; }
.login-card h1, .t-error h1 { text-align: center; margin-bottom: 0.25rem; }
.login-card .btn { padding: 0.6rem; }

/* ---------- builder ---------- */
.builder-body .page { max-width: 1500px; margin: 0 auto; padding: 1.25rem 1.25rem 4rem; }
.topbar .nav { display: flex; gap: 0.25rem; flex: 1; }
.topbar .nav a { padding: 0.85rem 0.75rem; opacity: 0.85; display: flex; gap: 0.45rem; align-items: center; border-bottom: 2px solid transparent; }
.topbar .nav a:hover, .topbar .nav a[aria-current] { opacity: 1; border-bottom-color: var(--accent); }
.topbar .user { display: flex; gap: 0.75rem; align-items: center; font-size: 0.9rem; }
.badge { font-size: 0.7rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: 99px; background: var(--accent); color: var(--accent-text); vertical-align: middle; }
.crumbs-bar { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.4rem; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.tile { display: flex; gap: 0.9rem; align-items: center; padding: 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); }
.tile .tile-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.tile .tile-icon .icon { width: 26px; height: 26px; }
.tile strong { display: block; }
.tile small { color: var(--muted); }
.app-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 1rem; }
.app-card { display: flex; flex-direction: column; gap: 0.6rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.app-card .app-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.1rem; }
.app-card h3 { margin: 0; font-size: 1rem; }
.app-card h3 a { color: var(--text); text-decoration: none; }
.app-card h3 a:hover { color: var(--accent); }
.app-card .meta { color: var(--muted); font-size: 0.83rem; }
.app-card .buttons { margin-top: auto; }
.designer { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 1rem; align-items: start; }
.designer > aside { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
.tree { list-style: none; margin: 0; padding: 0.4rem; font-size: 0.9rem; }
.tree ul { list-style: none; margin: 0; padding-left: 1rem; border-left: 1px dotted var(--border); margin-left: 0.6rem; }
.tree li { margin: 1px 0; }
.tree a { display: flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.5rem; border-radius: 5px; color: var(--text); text-decoration: none; overflow: hidden; }
.tree a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree a:hover { background: var(--surface-3); }
.tree a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tree .icon { width: 16px; height: 16px; color: var(--muted); }
.tree .group { display: flex; align-items: center; justify-content: space-between; padding: 0.55rem 0.5rem 0.2rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.tree .group a { padding: 0 0.3rem; font-size: 0.8rem; text-transform: none; letter-spacing: 0; color: var(--accent); display: inline; }
.tree .kind { margin-left: auto; font-size: 0.72rem; color: var(--muted); font-weight: 400; }
.tree .tag { font-size: 0.68rem; padding: 0 0.35rem; border-radius: 4px; background: var(--warning-soft); color: var(--muted); }
.count { font-size: 0.75rem; color: var(--muted); background: var(--surface-3); padding: 0.05rem 0.5rem; border-radius: 99px; margin-left: 0.3rem; }
.prop-title { display: flex; align-items: center; gap: 0.6rem; }
.cheat p { font-size: 0.85rem; margin: 0 0 0.6rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 0.85rem; }
.ev { font-size: 0.78rem; font-weight: 600; padding: 0.05rem 0.45rem; border-radius: 4px; background: var(--surface-3); }
.ev-login_failed, .ev-login_locked, .ev-forbidden, .ev-error { background: var(--danger-soft); color: var(--danger); }
.ev-login { background: var(--success-soft); color: var(--success); }
.split { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1rem; align-items: start; }
pre.source { font-family: var(--mono); font-size: 0.82rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0.8rem; overflow: auto; max-height: 460px; margin: 0; }

/* ---------- responsive ----------
   desktop  >= 1024px : side navigation docked, 12-column grid
   tablet   641-1023px: navigation becomes a drawer, regions pair up (<= 6 columns)
   phone    <= 640px  : single column, reports reflow into cards, full-screen dialogs */
.designer > *, .split > *, .columns > *, .t-regions > * { min-width: 0; }
.t-nav-backdrop { display: none; }

@media (max-width: 1023px) {
  .t-body { grid-template-columns: minmax(0, 1fr); }
  /* Drawer: opened by JS (body.nav-open) or, without JS, by the #t-nav link (:target). */
  .t-nav {
    position: fixed; z-index: 25; top: 52px; bottom: 0; inset-inline-start: 0; width: min(300px, 85vw);
    box-shadow: 8px 0 24px rgb(0 0 0 / 20%); transition: transform 0.2s ease, visibility 0.2s;
    transform: translateX(-100%); visibility: hidden;
  }
  [dir="rtl"] .t-nav { transform: translateX(100%); box-shadow: -8px 0 24px rgb(0 0 0 / 20%); }
  body.nav-open .t-nav, .t-nav:target { transform: none; visibility: visible; }
  body.nav-open .t-nav-backdrop { display: block; position: fixed; inset: 52px 0 0 0; z-index: 24; background: rgb(15 20 30 / 40%); }
  .t-regions > .region { grid-column: span 12 !important; }
  .t-regions > :is(.col-1, .col-2, .col-3, .col-4, .col-5, .col-6) { grid-column: span 6 !important; }
  .designer, .split { grid-template-columns: minmax(0, 1fr); }
  .designer > aside { position: static; max-height: 45vh; }
  .t-user > summary span { display: none; }
}

@media (max-width: 640px) {
  .t-regions > .region { grid-column: span 12 !important; }
  .t-titlebar { padding: 0.75rem 1rem; }
  h1 { font-size: 1.25rem; }
  .t-content { padding: 1rem 0.75rem 3rem; }
  .region-body { padding: 0.85rem; }
  .region-header { padding: 0.5rem 0.85rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .search { margin-left: 0; max-width: none; flex-basis: 100%; }
  .report-toolbar .field { flex: 1 1 100%; }
  .filter-row { min-width: 0; grid-template-columns: 1fr; }
  .topbar .nav a span, .topbar .brand .badge { display: none; }
  .topbar { gap: 0.25rem; }
  .cards-metric { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card.metric { grid-template-columns: 1fr; row-gap: 0.25rem; }
  .metric-icon { grid-row: auto; width: 36px; height: 36px; }
  .metric-value { font-size: 1.35rem; }
  .bar-row, .bar-axis { grid-template-columns: minmax(60px, 35%) 1fr auto; gap: 0.5rem; }
  .title-row .buttons { width: 100%; }
  .title-row .buttons .btn { flex: 1 1 auto; }

  /* Menus open as a bottom sheet. */
  details.menu[open] > .menu-panel {
    position: fixed; left: 0.5rem; right: 0.5rem; top: auto; bottom: 0.5rem; min-width: 0;
    max-height: 75vh; overflow: auto; border-radius: 12px;
  }

  /* Report reflow: every row becomes a card with labelled values. */
  .report-reflow thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .report-reflow, .report-reflow tbody, .report-reflow tr, .report-reflow td { display: block; width: 100%; }
  .table-wrap:has(.report-reflow) { border: 0; overflow: visible; }
  .report-reflow tr { border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem 0; margin-bottom: 0.6rem; background: var(--surface); }
  .report-reflow tbody tr:hover { background: var(--surface); }
  .report-reflow td {
    display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr); gap: 0.75rem;
    border: 0; padding: 0.3rem 0.8rem; white-space: normal; max-width: none; text-align: start !important; overflow-wrap: anywhere;
  }
  .report-reflow td::before { content: attr(data-label); font-size: 0.8rem; font-weight: 650; color: var(--muted); }
  .report-reflow td.row-edit { width: auto; text-align: left; }
  .report-reflow td.row-edit::before { content: none; }
  .report-reflow td.empty { display: block; }
  .report-reflow td.empty::before { content: none; }
  .report-reflow td.pre { white-space: pre-wrap; }

  /* Dialogs use the whole screen. */
  dialog.t-dialog:not(.t-dialog-top):not(.t-dialog-bottom) { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; inset: 0; }
  .t-dialog-main { padding: 1rem 1rem 0; }
  .t-dialog-page .region-footer { margin: 1rem -1rem 0; padding: 0.75rem 1rem; }
}

/* Touch screens: comfortable targets, and no zoom-on-focus in iOS. */
@media (pointer: coarse) {
  .btn, .icon-button { min-height: 44px; }
  .icon-button { min-width: 44px; }
  input:not([type=checkbox]):not([type=radio]), select, textarea { min-height: 44px; font-size: 16px; }
  .t-nav a, .t-nav summary, .tree a { min-height: 44px; }
  .seg a { padding: 0.45rem 0.8rem; }
  .chip a { padding: 0.25rem 0.5rem; }
}

/* property editor groups (builder) */
fieldset.prop-group { min-width: 0; border: 0; border-top: 1px solid var(--border); margin: 0 0 0.5rem; padding: 0.9rem 0 0.4rem; }
fieldset.prop-group:first-of-type { border-top: 0; padding-top: 0; }
fieldset.prop-group > legend { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--muted); padding: 0 0.4rem 0 0; }
.checklist { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; }
/* (sprint 186) a checklist line that blocks the application, and its text elsewhere */
.checklist .ck-error, .text-danger { color: var(--danger); }

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

/* ---------- top navigation (theme nav = "top"), desktop only ---------- */
@media (min-width: 1024px) {
  body.nav-top .t-body, body.nav-top.nav-collapsed .t-body { grid-template-columns: minmax(0, 1fr); }
  body.nav-top .t-nav-toggle { display: none; }
  body.nav-top .t-body { display: block; }
  body.nav-top .t-nav {
    position: sticky; top: 52px; z-index: 18; visibility: visible; overflow: visible;
    border-inline-end: 0; border-bottom: 1px solid var(--border);
  }
  body.nav-top .t-nav > ul { display: flex; gap: 0.25rem; padding: 0.3rem 0.75rem; }
  body.nav-top .t-nav li { position: relative; }
  body.nav-top .t-nav > ul > li > a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); border-inline-start-color: transparent; }
  body.nav-top .t-nav details > ul {
    position: absolute; top: calc(100% + 4px); inset-inline-start: 0; margin: 0; min-width: 220px; padding: 0.4rem;
    background: var(--nav-bg, var(--surface)); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(16 24 40 / 16%);
  }
  body.nav-top .t-nav details > summary::after { transform: rotate(90deg); }
}

/* ---------- interactive grid ---------- */
.grid-toolbar { justify-content: space-between; }
.grid-toolbar .search { margin-left: 0; max-width: 420px; }
.grid-table td { padding: 0.25rem 0.4rem; vertical-align: middle; }
.grid-table td input:not([type=checkbox]), .grid-table td select { min-width: 7rem; padding: 0.3rem 0.45rem; }
.grid-table th.grid-sel, .grid-table td.grid-sel { width: 2.5rem; text-align: center; }
.grid-table tr.deleted td { opacity: 0.5; text-decoration: line-through; }
.grid-table tr.grid-new { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.grid-table tr.dirty td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* the single row view: one row as a form */
.grid-record { padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius, 8px); display: grid; gap: 0.9rem; }
.grid-record .grid-field { display: grid; gap: 0.3rem; align-content: start; }
.grid-record .grid-value { min-height: 1.5rem; overflow-wrap: anywhere; }
.grid-record.grid-new { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.grid-record.dirty { box-shadow: inset 3px 0 0 var(--accent); }
.grid-record.deleted .form-grid { opacity: 0.5; text-decoration: line-through; }
.grid-record-nav { justify-content: center; }
.js .grid-template { display: none; }
.grid-table .icon { width: 14px; height: 14px; }
/* columns a user hid stay in the form (their values still post) */
.grid-table [hidden] { display: none !important; }
/* leading columns: master selection, delete, row actions */
.grid-table .grid-lead { width: 44px; min-width: 44px; max-width: 44px; padding: 0.25rem; text-align: center; }
.grid-table .grid-sized { overflow: hidden; text-overflow: ellipsis; }
.grid-table .grid-sized input:not([type=checkbox]), .grid-table .grid-sized select { min-width: 0; width: 100%; }
/* frozen columns stay in view while the grid scrolls sideways (left offsets are per-page classes) */
.grid-table .grid-frozen { position: sticky; z-index: 2; background: var(--surface); }
.grid-table thead .grid-frozen, .grid-table tfoot .grid-frozen { background: var(--surface-2); z-index: 3; }
.grid-table .grid-frozen-last { box-shadow: inset -1px 0 0 var(--border), 4px 0 6px -4px rgb(16 24 40 / 18%); }
.grid-table tr.grid-new .grid-frozen { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.grid-table tr.is-selected td { background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); }
.grid-pick-link { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; }
.grid-pick-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid-radio { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.grid-pick-link[aria-current] .grid-radio { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 3px, transparent 4px); }
/* the row actions menu: a small button with a menu panel */
.row-menu > summary.btn-small { padding: 0.15rem 0.5rem; min-height: 0; line-height: 1.2; }
.row-menu .menu-panel { left: 0; right: auto; min-width: 200px; padding: 0.4rem 0.8rem; z-index: 20; text-align: left; }
.row-menu .menu-links label { color: var(--text); padding: 0.2rem 0; display: flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.row-menu .menu-links label:hover { color: var(--accent); }
.grid-table td:has(> .row-menu[open]) { z-index: 5; }
/* resizing and moving columns (app.js) */
.grid-resize { display: none; }
.js .grid-table thead th[data-col] { position: relative; }
.js .grid-table thead th.grid-frozen[data-col] { position: sticky; }
.js .grid-resize { display: block; position: absolute; top: 0; right: 0; bottom: 0; width: 7px; cursor: col-resize; touch-action: none; }
.js .grid-resize:hover, .grid-resizing .grid-resize { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.js .grid-table thead th[draggable="true"] { cursor: grab; }
.grid-table th.grid-drop-before { box-shadow: inset 3px 0 0 var(--accent); }
.grid-table th.grid-drop-after { box-shadow: inset -3px 0 0 var(--accent); }
/* copy and paste: a range of selected cells */
.grid-table td.grid-cell-selected { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
/* cell navigation mode (APEX): with JavaScript an editable cell reads as text (its formatted value, .grid-text)
   until it is clicked or Enter / F2 edits it; arrow keys move between cells (app.js) */
.grid-text { display: none; }
.js .grid-table td[data-col]:not(.grid-frozen) { position: relative; }
.js .grid-table tbody td[data-col]:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.js .grid-table tbody td[data-col] :is(input:not([type=checkbox]), select) { border-color: transparent; background: transparent; box-shadow: none; }
.js .grid-table tbody td[data-col] select { appearance: none; }
.js .grid-table tbody td[data-col]:focus-within :is(input:not([type=checkbox]), select) { border-color: var(--border); background: var(--surface); appearance: auto; }
.js .grid-table td[data-col] > .grid-text { display: flex; align-items: center; position: absolute; inset: 0; padding: 0 calc(0.85rem + 1px);
  overflow: hidden; white-space: nowrap; pointer-events: none; }
.js .grid-table td[data-col] > .grid-text.num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.js .grid-table td[data-col]:has(> .grid-text) :is(input, select) { color: transparent; }
.js .grid-table td[data-col]:focus-within > .grid-text { display: none; }
/* (sprint 174, CD-1) a cell a failed save refused: its control stays visible, outlined, with the message under it */
.grid-cell-error { display: block; margin-top: 2px; white-space: normal; }
.grid-table td[data-col] :is(input, select)[aria-invalid="true"], .grid-record :is(input, select)[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.js .grid-table td[data-col]:focus-within :is(input, select) { color: inherit; }
.grid-columns-form { border-collapse: collapse; font-size: 0.85rem; }
.grid-columns-form th, .grid-columns-form td { padding: 0.2rem 0.35rem; text-align: left; white-space: nowrap; }
.grid-columns-form input[type=number] { width: 5.5rem; }
.grid-actions-menu .menu-panel { max-height: 70vh; overflow-y: auto; }
.grid-freeze-label { align-self: center; font-size: 0.85rem; }
.grid-detail-hint { margin: 0; }

/* ---------- calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.cal-title { margin: 0; font-size: 1.1rem; }
.cal-month { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.85rem; }
.cal-month th { font-size: 0.75rem; text-transform: uppercase; color: var(--muted); padding: 0.4rem; font-weight: 650; }
.cal-month td { border: 1px solid var(--border); vertical-align: top; height: 6.5rem; padding: 0.3rem; overflow: hidden; }
.cal-month td.outside { background: var(--surface-2); color: var(--muted); }
.cal-month td.today .cal-day { background: var(--accent); color: var(--accent-text); border-radius: 99px; padding: 0 0.45rem; }
.cal-day { display: inline-block; font-weight: 600; font-size: 0.8rem; margin-bottom: 0.2rem; }
.cal-event {
  display: block; margin-top: 2px; padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.78rem;
  background: var(--accent-soft); color: var(--text); border-left: 3px solid var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none;
}
a.cal-event:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.cal-more { font-size: 0.72rem; color: var(--muted); }
.cal-agenda { display: none; list-style: none; margin: 0; padding: 0; }
.cal-agenda h3 { font-size: 0.85rem; margin: 0.75rem 0 0.3rem; color: var(--muted); }
.cal-agenda-events { display: flex; flex-direction: column; gap: 0.3rem; }
.cal-agenda .cal-event { padding: 0.45rem 0.6rem; font-size: 0.9rem; white-space: normal; }
/* views: switcher, week and day by hour, list */
.cal-views { margin-left: auto; }
.cal-views .btn.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.cal-hint { display: none; margin: 0 0 0.5rem; font-size: 0.8rem; color: var(--muted); }
.js .cal-hint { display: block; }
.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.85rem; }
.cal-grid th { font-size: 0.75rem; color: var(--muted); padding: 0.35rem; font-weight: 650; text-align: center; }
.cal-grid thead th:first-child, .cal-grid tbody th { width: 4.2rem; }
.cal-grid thead a { color: inherit; text-decoration: none; }
.cal-grid thead a:hover { text-decoration: underline; }
.cal-grid thead th.today a, .cal-grid thead th.today { color: var(--accent); }
.cal-grid tbody th { text-align: right; vertical-align: top; font-variant-numeric: tabular-nums; font-weight: 500; }
.cal-grid td { border: 1px solid var(--border); vertical-align: top; height: 2.6rem; padding: 0.2rem 0.3rem; overflow: hidden; }
.cal-grid tr.cal-allday td { background: var(--surface-2); height: auto; min-height: 2rem; }
.cal-slot-event { display: flex; flex-direction: column; margin-top: 2px; }
.cal-slot-event .cal-when, .cal-agenda-events .cal-when { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.cal-event.timed { background: var(--surface); border-left-style: solid; }
.cal-list { list-style: none; margin: 0; padding: 0; }
.cal-list > li { border-bottom: 1px solid var(--border); padding: 0.4rem 0 0.6rem; }
.cal-list h3 { font-size: 0.9rem; margin: 0.5rem 0 0.4rem; }
.cal-agenda-events { list-style: none; margin: 0; padding: 0; }
.cal-agenda-events li { display: flex; gap: 0.6rem; align-items: baseline; }
.cal-agenda-events li .cal-event { flex: 1; min-width: 0; }
.cal-agenda-events .cal-when { flex: none; min-width: 5.5rem; }
/* create on click: a "+" link per day and hour slot; with JS the whole empty slot is clickable */
td[data-add] { position: relative; }
.cal-add { position: absolute; top: 2px; right: 2px; z-index: 1; width: 1.4rem; height: 1.4rem; display: grid; place-items: center; border-radius: 4px; background: var(--surface); color: var(--muted); text-decoration: none; font-weight: 600; line-height: 1; opacity: 0; }
td[data-add]:hover > .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover, .cal-add:focus-visible { background: var(--accent-soft); color: var(--accent); }
/* touch screens have no hover: the "+" stays visible and keeps its own room */
@media (hover: none) {
  .cal-add { opacity: 1; }
  td[data-add] { padding-right: 1.7rem; }
}
.js td[data-add] { cursor: pointer; }
.js td[data-add]:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
/* drag and drop */
.calendar [draggable="true"] { cursor: grab; }
.calendar .dragging { opacity: 0.5; }
.calendar td.drop-over { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-soft); }
.calendar[aria-busy="true"] { opacity: 0.7; }
@media (max-width: 640px) {
  .cal-month { display: none; }
  .cal-view-week .cal-scroll { display: none; }
  .cal-agenda { display: block; }
  .cal-views { margin-left: 0; }
  .js .cal-hint { display: none; }
}

/* ---------- faceted search ---------- */
.facets { display: flex; flex-direction: column; gap: 1rem; }
.facet { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.facet legend { font-weight: 650; font-size: 0.85rem; margin-bottom: 0.3rem; padding: 0; display: flex; gap: 0.5rem; }
.facet-clear { font-weight: 400; font-size: 0.8rem; }
.facet:has(> .facet-menu) { position: relative; }
.facet:has(> .facet-menu) > legend { padding-right: 1.6rem; }
.facet-menu { position: absolute; top: 0; right: 0; }
.facet-menu > summary { cursor: pointer; padding: 0 0.35rem; border-radius: 4px; color: var(--muted); }
.facet-menu > summary:hover, .facet-menu[open] > summary { background: var(--surface-3); color: inherit; }
.facet-menu .menu-panel { left: auto; right: 0; min-width: 11rem; }
.facet-menu .menu-links a[aria-current] { font-weight: 650; }
.facet-value { font-weight: 400; font-size: 0.9rem; }
/* (sprint 65) a facet's chart of its counts, collapsed under the legend */
.facet-chart { margin: 0.1rem 0 0.4rem; }
.facet-chart > summary { cursor: pointer; font-size: 0.8rem; color: var(--muted); }
.facet-chart .chart { margin-top: 0.4rem; font-size: 0.85rem; }
.facet-chart .donut-figure { max-width: 9rem; margin: 0 auto; }
.facet-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.facet-count { font-size: 0.75rem; color: var(--muted); background: var(--surface-3); border-radius: 99px; padding: 0 0.5rem; font-variant-numeric: tabular-nums; }
/* (sprint 78) values after the seventh, and the rows the filters leave */
.facet-more > summary { cursor: pointer; font-size: 0.85rem; color: var(--accent, var(--link)); padding: 0.15rem 0; }
.facet-more[open] > summary { margin-bottom: 0.2rem; }
.facet-total { margin: 0 0 0.6rem; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.js .facet-actions .btn-hot { display: none; }
.facet-exclude { font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }
.facet-excluded .facet-value .facet-label { text-decoration: line-through; }
.facet-search { display: flex; flex-direction: column; gap: 0.3rem; }
.facet-search-label { font-weight: 650; font-size: 0.85rem; }
.facet-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding-left: 1.6rem; }
.facet-custom input { flex: 1 1 6rem; min-width: 0; width: 6rem; }
.facet-custom .btn { padding: 0.3rem 0.6rem; }
.facet-stars { color: var(--warning, #b7791f); letter-spacing: 0.05em; }
.facet-stars-off { opacity: 0.25; }

/* ---------- smart filters ---------- */
.smart-filters { display: flex; flex-direction: column; gap: 0.6rem; }
.sf-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; padding: 0.3rem 0.4rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sf-bar:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.sf-icon { color: var(--muted); display: inline-flex; padding-left: 0.2rem; }
.sf-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sf-chip-not { background: var(--danger-soft); }
.sf-input { flex: 1 1 10rem; min-width: 0; border: 0; background: transparent; box-shadow: none; }
.sf-input:focus { outline: none; }
.sf-clear { font-size: 0.85rem; padding: 0 0.3rem; }
.sf-suggestions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.sf-suggest-title { font-size: 0.8rem; color: var(--muted); }
.chip-suggest { background: var(--surface-2); border: 1px dashed var(--border); text-decoration: none; color: inherit; padding-right: 0.5rem; }
.chip-suggest:hover, .chip-suggest:focus-visible { background: var(--accent-soft); }
.sf-none { margin: 0; font-size: 0.85rem; }

/* ---------- region display selector ---------- */
.rds-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid var(--border); }
.rds-tab { display: inline-block; padding: 0.5rem 0.9rem; text-decoration: none; color: var(--text); border-bottom: 3px solid transparent; margin-bottom: -1px; border-radius: var(--radius) var(--radius) 0 0; }
.rds-tab:hover { background: var(--surface-2); }
.rds-tab.is-current { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.rds-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rds-select-label { display: block; }
.rds-select { width: 100%; max-width: 24rem; }
.rds-hidden { display: none !important; }
@media (max-width: 640px) {
  .rds-tabs .rds-list { flex-wrap: nowrap; overflow-x: auto; }
  .rds-tab { white-space: nowrap; }
}

/* ---------- more item types ---------- */
select[multiple] { padding: 0.25rem; }
input[type=color] { width: 4rem; min-height: 2.4rem; padding: 0.15rem; }
/* popup LOV: a read-only field, a search button and a dialog with a paged result table */
.popup-lov { display: flex; gap: 0.4rem; min-width: 0; }
.popup-lov-display { flex: 1; min-width: 0; cursor: pointer; }
.popup-lov-open { flex: none; }
.popup-lov-body { flex: 1; overflow: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.popup-lov-results { overflow-x: auto; }
.popup-lov-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.popup-lov-table th, .popup-lov-table td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); }
.popup-lov-table tr.is-current { background: var(--surface-3); }
.popup-lov-pick { background: none; border: 0; padding: 0; font: inherit; color: var(--accent, inherit); cursor: pointer; text-align: left; text-decoration: underline; }
.popup-lov-pages { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.5rem; }
.out-list { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.chart-column .chart-plot { margin-top: 1.4rem; } /* room for the value on the tallest column */
@media (max-width: 640px) {
  .grid-table th.grid-sel, .grid-table td.grid-sel { width: 100%; text-align: left; }
  .grid-table td input:not([type=checkbox]), .grid-table td select { min-width: 0; width: 100%; }
  /* cards on phones: nothing to freeze, widths and the leading columns follow the card */
  .grid-table .grid-frozen { position: static; box-shadow: none; }
  .grid-table .grid-lead, .grid-table .grid-sized { width: 100%; min-width: 0; max-width: none; text-align: left; }
  .report-reflow.grid-table .agg-row td.grid-lead { display: none; }
  .report-reflow.grid-table td.grid-lead:empty { display: none; }
  .grid-resize { display: none !important; }
  /* a card shows its fields as fields: no navigation mode */
  .js .report-reflow.grid-table td[data-col] > .grid-text { display: none; }
  .js .report-reflow.grid-table tbody td[data-col] :is(input, select) { color: inherit; border-color: var(--border); background: var(--surface); appearance: auto; }
}

/* two-thirds / one-third columns on desktops (builder Users page) */
@media (min-width: 1024px) {
  .columns.wide-left { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

/* single sign-on buttons on the login page */
.sso-buttons { display: flex; flex-direction: column; gap: 0.5rem; }
.sso-buttons .btn { padding: 0.6rem; }
.login-card .or, .login-region .or { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.85rem; }
.login-card .or::before, .login-card .or::after, .login-region .or::before, .login-region .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-forgot { align-self: center; font-size: 0.9rem; }
/* (087) minimal pages (no header and navigation) and an application's own login page */
.t-minimal-main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; }
.login-body .t-minimal-main { max-width: 420px; padding: 1rem; }
.login-region { display: flex; flex-direction: column; gap: 1rem; }
.login-region .btn { padding: 0.6rem; }
.t-minimal .t-titlebar { background: none; border: 0; padding: 0 0 1rem; }
.t-minimal .t-content { padding: 0; max-width: none; }
/* on the sign-in backdrop the title sits on the header colour, like the built-in page's card title */
.login-body .t-titlebar h1 { color: var(--header-text); text-align: center; }

/* ---------- preferences: theme switch, language picker ---------- */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin-top: 0.35rem; }
.segmented button { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 0.85rem; padding: 0.4rem 0.8rem; min-height: 36px; cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.theme-switch { display: flex; flex-direction: column; align-items: flex-start; }
.lang-picker { margin-top: 1.25rem; font-size: 0.88rem; color: var(--muted); text-align: center; }
.lang-picker [aria-current] { font-weight: 600; color: var(--text); }
.login-extra { margin: 0.5rem 0 0; font-size: 0.9rem; text-align: center; }
.pref-options { display: flex; flex-direction: column; gap: 0.4rem; }
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; overflow-wrap: anywhere; }
.translate-table td { vertical-align: top; }
.translate-table input, .translate-table textarea { width: 100%; }
.translate-table .source-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.t-header .menu-panel a { color: var(--accent); display: inline-flex; align-items: center; gap: 0.4rem; }

/* builder: role suggestions under roles fields */
.roles-form { flex-wrap: wrap; }
.roles-form input[name="roles"] { flex: 1 1 10rem; width: auto; min-width: 0; }
.roles-form .role-hints { flex-basis: 100%; }
.role-hints { display: block; line-height: 2; }
.role-chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; font-size: 0.78rem; padding: 0.05rem 0.55rem; }
.role-chip:hover { border-color: var(--accent); color: var(--accent); }

/* file upload items */
.file-current { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin-bottom: 0.5rem; }
.file-current a { word-break: break-all; }
.file-preview { max-width: 160px; max-height: 110px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.field-file input[type="file"] { max-width: 100%; }
.display-value .file-current { margin: 0; }
.file-list { list-style: none; margin: 0 0 0.5rem; padding: 0; display: grid; gap: 0.4rem; }
.file-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.file-list li > span { flex: 1 1 12rem; min-width: 0; }
.file-list a { word-break: break-all; }
.file-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.display-value .file-list { margin: 0; }
.file-drop { display: grid; gap: 0.3rem; padding: 0.6rem; border: 1.5px dashed var(--border); border-radius: 8px; transition: border-color 0.15s, background-color 0.15s; }
.file-drop input[type=file] { min-width: 0; max-width: 100%; }
.file-drop-hint { color: var(--muted); font-size: 0.85rem; }
.file-drop.dragover { border-color: var(--accent); background: var(--accent-soft); }
@media (prefers-reduced-motion: reduce) { .file-drop { transition: none; } }

/* ------------------------------------------------------------------ printing
   Every page prints without the navigation, toolbars and buttons; reports
   print the rows on screen (Actions → Download PDF prints all rows). */
@media print {
  :root { color-scheme: light; }
  body, .t-app { background: #fff !important; color: #000 !important; }
  .t-header, .t-nav, .t-nav-backdrop, .skip-link, .report-toolbar, .view-switch, .pager, .buttons, .actions-menu,
  .alert-close, .default-submit, .facets, .region-facets, .smart-filters, .rds, .chart-data summary, .crumbs, dialog { display: none !important; }
  .t-body { display: block; min-height: 0; }
  .t-content { padding: 0; max-width: none; }
  .t-titlebar { padding: 0 0 0.5rem; background: none; border: 0; }
  .region { break-inside: avoid-page; box-shadow: none !important; border-color: #bbb !important; }
  .table-wrap { overflow: visible !important; }
  table.report { font-size: 9pt; }
  table.report thead { display: table-header-group; }
  table.report tr { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  input, select, textarea { border: 0 !important; background: none !important; padding: 0 !important; appearance: none; }
  .file-preview { max-height: 3cm; }
}

/* builder: small forms inside table cells (OAuth clients) */
.inline-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0 0.3rem 0.3rem 0; }
.inline-form select { width: auto; }
.report td.actions { min-width: 15rem; max-width: none; white-space: normal; overflow: visible; }

/* builder: report layout logo */
.layout-logo { max-width: 12rem; max-height: 5rem; border: 1px solid var(--border, #d0d5dd); border-radius: 4px; padding: 0.25rem; background: #fff; }

/* interactive reports: control break, aggregates, highlights, saved reports */
.report .break-row th { background: var(--surface-3); text-align: left; font-weight: 600; padding-top: 0.55rem; }
.report .agg-row td { font-weight: 600; background: var(--surface-2); }
.report tfoot .agg-row td { border-top: 2px solid var(--border); }
.hl-yellow { --hl: rgb(250 204 21 / 28%); }
.hl-green { --hl: rgb(34 197 94 / 22%); }
.hl-red { --hl: rgb(239 68 68 / 22%); }
.hl-blue { --hl: rgb(59 130 246 / 22%); }
.hl-gray { --hl: rgb(148 163 184 / 30%); }
.report tr[class^="hl-"] td, .report tr[class^="hl-"]:hover td { background: var(--hl); }
.chip .swatch { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 3px; background: var(--hl); border: 1px solid var(--border); }
.saved-reports { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.saved-reports li { display: flex; align-items: center; gap: 0.35rem; }
.saved-reports a[aria-current="true"] { font-weight: 600; }
@media (max-width: 640px) {
  .report-reflow .break-row th { display: block; border-radius: 8px; margin-bottom: 0.4rem; }
  .report-reflow tr.break-row { border: 0; padding: 0; background: none; }
  .report-reflow tfoot { display: block; }
  .report-reflow tr[class^="hl-"], .report-reflow tbody tr[class^="hl-"]:hover { background: var(--hl); }
  .report-reflow tr[class^="hl-"] td, .report-reflow tr[class^="hl-"]:hover td { background: transparent; }
  .report-reflow .agg-row td[data-label=""], .report-reflow .agg-row td.row-select { display: none; }
  .report-reflow td.row-select { width: 100%; }
  /* the header is collapsed on phones: keep its "select all" box, with a label */
  .report-reflow thead:has(th.row-select) { position: static; width: auto; height: auto; overflow: visible; clip: auto; display: block; }
  .report-reflow thead:has(th.row-select) tr { display: block; border: 0; padding: 0; margin: 0 0 0.5rem; background: none; }
  .report-reflow thead:has(th.row-select) th:not(.row-select) { display: none; }
  .report-reflow th.row-select { display: block; width: auto; text-align: left; border: 0; padding: 0 0.2rem; }
  .report-reflow th.row-select label { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 500; }
  .report-reflow .row-select-label { display: inline; }
  .report-reflow td.row-select input { justify-self: start; }
}
@media print {
  .report tr[class^="hl-"] td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* small status tags (saved reports, automation runs) */
.tag { display: inline-block; font-size: 0.72rem; padding: 0.05rem 0.4rem; border-radius: 4px; background: var(--surface-3); color: var(--muted); }
.tag-error { background: var(--danger-soft); color: var(--danger); }
.tag-warning { background: var(--warning-soft); color: var(--text); }
.tag-info { background: var(--accent-soft); color: var(--text); }

/* help texts may hold long JSON examples: never wider than their field */
.field .help, small.help { overflow-wrap: anywhere; }

/* Task list (approvals) */
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.task { border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 0.9rem; background: var(--surface); }
.task.overdue { border-left: 4px solid var(--danger); }
.task-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-weight: 600; }
.task-subject { overflow-wrap: anywhere; }
.task-meta { font-size: 0.85rem; margin-top: 0.15rem; }
.task-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.6rem; }
/* (094) the vacation rule: label above each field, in a row that wraps */
.task-vacation { margin-bottom: 1rem; }
.task-vacation > summary { cursor: pointer; }
.vacation-fields { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: flex-end; }
.vacation-fields label { display: flex; flex-direction: column; gap: 0.2rem; flex: 1 1 10rem; max-width: 16rem; }
.task-actions input[name="comment"] { flex: 1 1 14rem; min-width: 0; }
.task-delegate { display: inline-flex; gap: 0.3rem; }
.task-delegate input { width: 9rem; }
.task-history { margin-top: 0.5rem; font-size: 0.85rem; }
.task-history ol { margin: 0.4rem 0; padding-left: 1.2rem; }
.task-history q { color: var(--muted); }

/* Progressive Web App and field work */
.offline-banner { position: sticky; top: 0; z-index: 60; padding: 0.45rem 1rem; background: var(--warning-soft); color: var(--text); border-bottom: 1px solid var(--border); font-size: 0.88rem; text-align: center; }
.offline-queue { position: fixed; left: max(1rem, env(safe-area-inset-left)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 70; max-width: min(28rem, calc(100vw - 2rem)); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.8rem; box-shadow: 0 4px 18px rgb(0 0 0 / 18%); font-size: 0.88rem; }
.offline-queue summary { cursor: pointer; font-weight: 600; }
.offline-queue ul { margin: 0.5rem 0; padding-left: 1rem; }
.offline-pages { padding-left: 1.2rem; }
.input-with-button { display: flex; gap: 0.4rem; align-items: center; }
.input-with-button input { flex: 1; min-width: 0; }
.scan-dialog { border: 0; border-radius: 12px; padding: 0.8rem; width: min(30rem, 94vw); background: var(--surface); }
.scan-dialog video { width: 100%; border-radius: 8px; background: #000; }
.scan-dialog .btn { margin-top: 0.6rem; width: 100%; }
@media (display-mode: standalone) {
  .t-header { padding-top: env(safe-area-inset-top); }
  .t-main { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
}

/* Map and tree regions */
.map { width: 100%; border-radius: 8px; border: 1px solid var(--border); z-index: 0; }
.map-small { height: 240px; }
.map-medium { height: 380px; }
.map-large { height: 560px; }
@media (max-width: 600px) { .map-medium, .map-large { height: 300px; } }
.map-list { margin-top: 0.5rem; font-size: 0.88rem; }
.map-heat { pointer-events: none; }
/* on the map's own (light) tiles in both themes, so fixed colours: the heat ramp of app.js */
.map-legend { display: flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.5rem; border-radius: 6px; background: rgba(255, 255, 255, 0.92); color: #1f2733; font-size: 0.78rem; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.map-note { padding: 0.25rem 0.5rem; border-radius: 6px; background: rgba(255, 255, 255, 0.92); color: #1f2733; font-size: 0.78rem; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); max-width: 60vw; }
.map-legend-ramp { width: 72px; height: 10px; border-radius: 3px; background: linear-gradient(to right, rgba(109, 167, 236, 0.2), rgba(109, 167, 236, 0.45) 25%, rgba(57, 135, 229, 0.65) 50%, rgba(28, 92, 171, 0.8) 75%, rgba(13, 54, 107, 0.9)); }
.map-filter { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; max-width: calc(100vw - 6rem); }
.map-filter .btn { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); text-decoration: none; }
.map-filter .btn:not(.btn-hot) { background: var(--surface); }
.map-list ul { margin: 0.4rem 0; padding-left: 1.2rem; }
/* several layers: each layer's places, lines and areas in its own colour (the light series colours: the tiles are light in both themes) */
.map-c1 { --mc: #2a78d6; } .map-c2 { --mc: #eb6834; } .map-c3 { --mc: #1baf7a; } .map-c4 { --mc: #eda100; }
.map-c5 { --mc: #e87ba4; } .map-c6 { --mc: #008300; } .map-c7 { --mc: #4a3aa7; } .map-c8 { --mc: #e34948; }
/* (sprint 184) a colour the shape's style sets wins (map-keep-*: Leaflet's own attribute; a line has no fill) */
path.leaflet-interactive[class*="map-c"]:not(.map-keep-stroke) { stroke: var(--mc); }
path.leaflet-interactive[class*="map-c"]:not(.map-keep-fill) { fill: var(--mc); }
path.map-dot { stroke: #fff; fill: var(--mc); }
path.map-near { stroke: #1f2733; stroke-dasharray: 6 4; fill: #1f2733; fill-opacity: 0.06; }
/* a cluster: a round marker with the number of places in it */
.map-cluster { display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--mc, #2a78d6); color: #fff; font-weight: 700; font-size: 0.82rem; border: 3px solid rgba(255, 255, 255, 0.85); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.map-cluster:focus-visible { outline: 3px solid #1f2733; outline-offset: 2px; }
.map-layers { margin: 0; padding: 0.3rem 0.6rem 0.4rem; border: 0; border-radius: 6px; background: rgba(255, 255, 255, 0.95); color: #1f2733; font-size: 0.8rem; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); max-width: 60vw; }
.map-layers legend { float: left; width: 100%; padding: 0; font-weight: 700; }
.map-layers label { display: flex; align-items: center; gap: 0.35rem; min-height: 24px; cursor: pointer; }
.map-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--mc); flex: none; }
.map-swatch-heat { border-radius: 3px; background: linear-gradient(to right, rgba(109, 167, 236, 0.45), rgba(13, 54, 107, 0.9)); }
.tree-view, .tree-view ul { list-style: none; margin: 0; padding-left: 1.1rem; }
.tree-view { padding-left: 0; }
.tree-view li { margin: 0.15rem 0; }
.tree-view summary { cursor: pointer; }
.tree-view a, .tree-view summary > span, .tree-leaf > span { display: inline-flex; align-items: center; gap: 0.35rem; }
.tree-leaf { padding-left: 1rem; }
.tree-count { font-size: 0.75rem; color: var(--muted); }
/* (161) the node a tree_selection_change dynamic action chose */
.tree-view li.tree-selected > :is(a, span:not(.tree-count), .tree-row), .tree-view li.tree-selected > details > summary > span { background: var(--accent-soft); border-radius: 3px; outline: 1px solid var(--accent); outline-offset: 1px; }
/* a linked branch: the disclosure triangle sits in front of the link's row */
.tree-branch { position: relative; }
.tree-branch > .tree-row { display: inline-flex; align-items: center; gap: 0.35rem; }
.tree-branch > details > summary { position: absolute; top: 0; left: -1.1rem; width: 1.1rem; height: 1.5em; cursor: pointer; list-style: none; color: var(--muted); }
.tree-branch > details > summary::-webkit-details-marker { display: none; }
.tree-branch > details > summary::before { content: "▸"; display: block; text-align: center; }
.tree-branch > details[open] > summary::before { content: "▾"; }
.tree-branch > details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 3px; }
.cell-break { overflow-wrap: anywhere; word-break: break-word; }

/* Workflow diagram (inline SVG; no style attributes) */
.wf-wrap { overflow-x: auto; padding: 0.5rem 0; }
.wf-diagram { display: block; width: 100%; min-width: 320px; max-width: 900px; height: auto; margin: 0 auto; }
.wf-node rect { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.wf-task rect { stroke: var(--accent); }
.wf-switch rect { stroke: #b86e00; stroke-dasharray: 5 3; }
.wf-end rect { fill: var(--surface-3, var(--surface)); }
.wf-name { fill: var(--text); font-size: 12px; font-weight: 600; text-anchor: middle; }
.wf-type { fill: var(--muted); font-size: 10px; text-anchor: middle; }
.wf-edge { fill: none; stroke: var(--muted); stroke-width: 1.3; }
.wf-arrowhead { fill: var(--muted); }
.wf-label { fill: var(--muted); font-size: 10px; }

/* ---- sprint 23: workflow parallel branches and versions ---- */
.wf-parallel rect, .wf-join rect { stroke: #7b52c7; stroke-width: 2; }
.wf-edge-branch { stroke-dasharray: 6 3; }
.wf-invoke_api rect { stroke: #1f7a8c; stroke-width: 2; stroke-dasharray: 2 2; }
.wf-active rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 3; }
.wf-active .wf-name { fill: var(--text); }
.wf-done rect { fill: var(--success-soft, #e7f5ed); stroke: var(--success, #17794a); }
.wf-failed rect { fill: var(--danger-soft, #fde7e4); stroke: var(--danger, #b42318); stroke-width: 3; }
.wf-warnings { background: var(--warning-soft); color: var(--text); border-color: var(--border); }
.wf-version-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; }
.wf-version-diagram summary { cursor: pointer; }
.wf-version-diagram[open] { min-width: min(320px, 80vw); }
/* ---- end sprint 23 workflow ---- */

/* Builder: search results and "Used in" */
.hits { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.hits li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.25rem 0.75rem; align-items: center; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.hits li > a { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.hits .hit-snippet { grid-column: 1 / -1; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.82rem; color: var(--muted); background: none; padding: 0; }
.hits mark { background: #fde68a; color: #1b2330; border-radius: 2px; }
.used-in { margin-top: 1.5rem; }
.sql-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.8rem; display: block; max-height: 12rem; overflow: auto; }
.small { font-size: 0.82rem; }
@media (max-width: 600px) { .hits li { grid-template-columns: minmax(0, 1fr); } }

/* Utilities for the builder (no inline style attributes: see the Content-Security-Policy).
   !important keeps the precedence the style attributes had. */
.u-mt0 { margin-top: 0 !important; }
.u-mt075 { margin-top: 0.75rem !important; }
.u-mt1 { margin-top: 1rem !important; }
.u-mt125 { margin-top: 1.25rem !important; }
.u-mt15 { margin-top: 1.5rem !important; }
.u-mb075 { margin-bottom: 0.75rem !important; }
.u-mb1 { margin-bottom: 1rem !important; }
.u-m0 { margin: 0 !important; }
.u-mwnone { max-width: none !important; }
.u-mw6 { max-width: 6rem !important; }
.u-mw10 { max-width: 10rem !important; }
.u-inline { display: inline !important; }
.u-selfend { align-self: end !important; }
.u-inherit { color: inherit !important; }
.u-spacer { height: 1rem !important; }
.wrap-anywhere, .wrap-anywhere code { overflow-wrap: anywhere; word-break: break-word; }
.u-row { display: flex !important; gap: 0.75rem !important; align-items: center !important; }
.app-color-0 { background: #0b63c5; }
.app-color-1 { background: #17794a; }
.app-color-2 { background: #b3261e; }
.app-color-3 { background: #7a4cc2; }
.app-color-4 { background: #b86e00; }
.app-color-5 { background: #00796b; }
.app-color-6 { background: #5c6bc0; }
.app-color-7 { background: #8d6e63; }

/* ===================================================================
   Template components (src/runtime/template-components.ts, sprint 23)
   Templates can't carry style attributes or <style> (CSP), so their look
   comes from these classes. Layout of the instances in a region:
   tc-list, tc-grid, tc-inline, tc-divided, tc-compact. Building blocks
   for templates: tc-badge(-success|-warning|-danger|-info|-neutral),
   tc-card, tc-card-head, tc-avatar, tc-title, tc-meta, tc-body,
   tc-actions, tc-timeline, tc-timeline-item (+ tc-state-success|-warning|-danger|-neutral),
   tc-stack, tc-row, tc-muted.
   =================================================================== */
.tc-region { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.tc-region > * { min-width: 0; }
.tc-region.tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.tc-region.tc-inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.tc-region.tc-divided { gap: 0; }
.tc-region.tc-divided > * + * { border-top: 1px solid var(--border); }
.tc-region.tc-divided > * { padding: 0.6rem 0; }
.tc-region.tc-compact { gap: 0.35rem; }
.tc-region.tc-compact.tc-divided > * { padding: 0.3rem 0; }

.tc-badge { display: inline-flex; align-items: center; gap: 0.3rem; max-width: 100%; font-size: 0.78rem; font-weight: 600; line-height: 1.4;
  padding: 0.1rem 0.6rem; border-radius: 99px; background: var(--surface-3); color: var(--text); overflow-wrap: anywhere; }
.tc-badge-neutral { background: var(--surface-3); color: var(--muted); }
.tc-badge-success { background: var(--success-soft); color: var(--success); }
.tc-badge-danger { background: var(--danger-soft); color: var(--danger); }
.tc-badge-warning { background: var(--warning-soft); color: var(--text); }
.tc-badge-info { background: var(--accent-soft); color: var(--accent); }
a.tc-badge { text-decoration: none; }

.tc-card { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; overflow-wrap: anywhere; }
a.tc-card { text-decoration: none; }
a.tc-card:hover, a.tc-card:focus-visible { border-color: var(--accent); }
.tc-card-head { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.tc-card-head > :last-child { min-width: 0; }
.tc-avatar { flex: none; display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-weight: 700; font-size: 0.95rem; text-transform: uppercase; overflow: hidden; }
img.tc-avatar { object-fit: cover; }
.tc-title { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.3; }
.tc-meta, .tc-muted { margin: 0; color: var(--muted); font-size: 0.85rem; }
.tc-body { margin: 0; }
.tc-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tc-stack { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.tc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-width: 0; }

/* built-in components (src/runtime/builtin-components.ts): avatar sizes and groups, comments, media list, metric cards */
.tc-avatar-sm { width: 2rem; height: 2rem; font-size: 0.8rem; }
.tc-avatar-md { width: 2.5rem; height: 2.5rem; }
.tc-avatar-lg { width: 3.5rem; height: 3.5rem; font-size: 1.2rem; }
.tc-avatar-square { border-radius: calc(var(--radius) * 0.75); }
.tc-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-avatar-group { display: flex; flex-wrap: wrap; align-items: center; row-gap: 0.3rem; padding-left: 0.3rem; }
.tc-avatar-group > .tc-avatar { margin-left: -0.3rem; box-shadow: 0 0 0 2px var(--surface); }
.tc-comments, .tc-media-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tc-comment { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.6rem 0; min-width: 0; }
.tc-comment + .tc-comment, .tc-media + .tc-media { border-top: 1px solid var(--border); }
.tc-comment-text { overflow-wrap: anywhere; white-space: pre-line; }
.tc-media { display: flex; gap: 0.8rem; align-items: center; padding: 0.6rem 0; min-width: 0; overflow-wrap: anywhere; }
.tc-media > .tc-stack { flex: 1; }
.tc-media-badge { flex: none; }
/* (137) ut_content_row: avatar, title and description, secondary text and badge on the right */
.tc-content-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tc-content-row { display: flex; gap: 0.8rem; align-items: center; padding: 0.6rem 0; min-width: 0; overflow-wrap: anywhere; }
.tc-content-row + .tc-content-row { border-top: 1px solid var(--border); }
.tc-content-row > .tc-stack { flex: 1; }
.tc-content-row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex: none; max-width: 40%; text-align: end; }
@media (max-width: 480px) { .tc-content-row { flex-wrap: wrap; } .tc-content-row-end { flex-direction: row; align-items: center; max-width: none; margin-inline-start: auto; } }
/* (137) a checkbox group shown as switches ({"switches": true}): one per line */
.radio-group.switch-group { flex-direction: column; align-items: flex-start; }
.tc-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: 0.75rem; }
.tc-metric { gap: 0.25rem; }
.tc-metric-label { margin: 0; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
a.tc-metric-label { text-decoration: none; }
a.tc-metric-label:hover { color: var(--accent); }
.tc-metric-value { margin: 0; font-size: 1.75rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tc-metric-unit { font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.tc-metric-change { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.tc-trend-up { color: var(--success); }
.tc-trend-down { color: var(--danger); }
.tc-trend-up.tc-good-down { color: var(--danger); }
.tc-trend-down.tc-good-down { color: var(--success); }
.tc-trend-mark { font-size: 0.7rem; }

.tc-timeline { list-style: none; margin: 0; padding: 0; }
.tc-timeline-item { position: relative; margin: 0; padding: 0 0 1rem 1.6rem; border-left: 2px solid var(--border); margin-left: 0.45rem; overflow-wrap: anywhere; }
.tc-timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tc-timeline-item::before { content: ""; position: absolute; left: -0.5rem; top: 0.15rem; width: 0.8rem; height: 0.8rem; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); }
.tc-timeline-item.tc-state-success::before { border-color: var(--success); background: var(--success); }
.tc-timeline-item.tc-state-danger::before { border-color: var(--danger); background: var(--danger); }
.tc-timeline-item.tc-state-warning::before { border-color: var(--muted); background: var(--warning-soft); }
.tc-timeline-item.tc-state-neutral::before { border-color: var(--muted); }

/* report cells rendered through a component, and the builder */
td.tc-cell { overflow-wrap: anywhere; }
.tc-preview { margin-top: 0.75rem; padding: 1rem; background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius); overflow-x: auto; }
.tc-preview-form .check { display: inline-flex; margin: 0.25rem 0; }
.tc-columns textarea { width: 100%; min-width: 10rem; }
@media (max-width: 640px) {
  .tc-card { padding: 0.75rem; }
  .tc-preview { padding: 0.6rem; }
  .tc-columns textarea { min-width: 0; }
}

/* ------------------------------------------------------------------ rich text, Markdown, rating, tags, date range, QR code items */
.rte { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 0.2rem; }
.rte-btn { min-width: 2.1rem; padding: 0.2rem 0.5rem; font-size: 0.85rem; justify-content: center; }
.rte-btn[data-cmd=bold] { font-weight: 700; }
.rte-btn[data-cmd=italic] { font-style: italic; }
.rte-btn[data-cmd=underline] { text-decoration: underline; }
.rte-btn[data-cmd=strike] { text-decoration: line-through; }
.rte-area {
  min-height: 9rem; max-height: 32rem; overflow: auto; padding: 0.5rem 0.65rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); overflow-wrap: anywhere;
}
.rte-area:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.has-error .rte-area { border-color: var(--danger); }
.js .rte[data-richtext] .rte-hint { display: none; }
.rich-text { white-space: normal; overflow-wrap: anywhere; }
.rich-text > :first-child, .rte-area > :first-child { margin-top: 0; }
.rich-text > :last-child, .rte-area > :last-child { margin-bottom: 0; }
.rich-text pre, .rte-area pre { white-space: pre-wrap; background: var(--surface-2); padding: 0.5rem; border-radius: 6px; }
.rich-text blockquote, .rte-area blockquote { margin: 0.5rem 0; padding-left: 0.8rem; border-left: 3px solid var(--border); color: var(--muted); }

.rating { position: relative; display: flex; align-items: center; gap: 0.1rem; padding: 0.2rem 0; flex-wrap: wrap; }
.rating input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.rating .star { font-size: 1.6rem; line-height: 1; padding: 0.15rem; cursor: pointer; color: var(--accent); border-radius: 4px; }
/* stars up to the checked one are filled; the ones after it (and all, with "no rating") are dimmed */
.rating input:checked + label ~ .star, .rating:not(:has(input:checked)) .star { color: var(--muted); opacity: 0.4; }
.rating:hover input + label.star { color: var(--accent); opacity: 1; }
.rating:hover .star:hover ~ input + label.star { color: var(--muted); opacity: 0.4; }
.rating input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }
.rating-clear { order: 99; margin-left: 0.6rem; font-size: 0.82rem; color: var(--muted); cursor: pointer; text-decoration: underline; }
.rating input:checked + .rating-clear { text-decoration: none; font-weight: 600; }
.rating-value { font-size: 1.2rem; color: var(--accent); letter-spacing: 0.05rem; }
.rating-off { color: var(--muted); opacity: 0.4; }

.combobox { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0; padding: 0; list-style: none; }
.tag-list:empty { display: none; }
.tag {
  display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.1rem 0.25rem 0.1rem 0.55rem; border-radius: 99px;
  background: var(--accent-soft); font-size: 0.85rem; max-width: 100%; overflow-wrap: anywhere;
}
.display-value .tag { padding-right: 0.55rem; margin: 0.1rem 0; }
.tag-remove {
  border: 0; background: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0.1rem 0.3rem; border-radius: 99px;
}
.tag-remove:hover, .tag-remove:focus-visible { background: var(--surface-3); }

/* (140) shuttle: two lists, the move buttons between them and the order buttons after them (stacked on phones) */
.shuttle-ui { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 0.5rem; align-items: stretch; }
.shuttle-col { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.shuttle-col .shuttle-list { flex: 1; min-height: 9rem; }
.shuttle-moves, .shuttle-order { display: flex; flex-direction: column; justify-content: center; gap: 0.3rem; }
.shuttle-btn { min-width: 2.4rem; justify-content: center; font-size: 1rem; line-height: 1; }
[dir=rtl] .shuttle-moves .shuttle-btn span { display: inline-block; transform: scaleX(-1); }
@media (max-width: 640px) {
  .shuttle-ui { grid-template-columns: minmax(0, 1fr) auto; }
  .shuttle-col:first-child { grid-column: 1 / -1; }
  .shuttle-moves { grid-column: 1 / -1; flex-direction: row; justify-content: center; }
  .shuttle-moves .shuttle-btn span { display: inline-block; transform: rotate(90deg); }
}
/* (140) select one / select many: a search field with a list box under it; chips above it */
.select-pick-ui { position: relative; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.select-pick-list {
  position: absolute; z-index: 30; top: 100%; inset-inline: 0; margin: 0.15rem 0 0; padding: 0.25rem 0; list-style: none; max-height: 16rem; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) * 0.75); box-shadow: var(--shadow);
}
.select-pick-list[hidden] { display: none; }
.select-pick-list li { padding: 0.4rem 0.7rem; cursor: pointer; overflow-wrap: anywhere; }
.select-pick-list li[aria-selected=true] { font-weight: 600; }
.select-pick-list li[aria-selected=true]::before { content: "✓ "; }
.select-pick-list li.is-active, .select-pick-list li:hover { background: var(--surface-3); }
.select-pick-list li.select-pick-none { cursor: default; color: var(--muted); }
/* (140) a breadcrumb region and a help text region */
.region-crumbs .crumbs { font-size: 0.9rem; margin: 0; }
.region-crumbs .crumbs [aria-current] { color: var(--text); font-weight: 600; }
.help-text { overflow-wrap: anywhere; }
.help-text > :first-child { margin-top: 0; }
.help-text > :last-child { margin-bottom: 0; }
/* (140) classic report templates */
.cr-pairs { display: flex; flex-direction: column; gap: 0.75rem; }
.cr-pairs dl { display: grid; grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr); gap: 0.25rem 1rem; margin: 0; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.cr-pairs dl:last-child { border-bottom: 0; padding-bottom: 0; }
.cr-pairs dt { font-weight: 600; color: var(--muted); overflow-wrap: anywhere; }
.cr-pairs dd { margin: 0; overflow-wrap: anywhere; }
.cr-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); gap: 0.6rem; list-style: none; margin: 0; padding: 0; }
.cr-badges li { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.7rem; border: 1px solid var(--border); border-radius: var(--radius); text-align: center; overflow-wrap: anywhere; }
.cr-badges .cr-badge-value { font-size: 1.4rem; font-weight: 700; }
.cr-badges .cr-badge-label { font-size: 0.85rem; color: var(--muted); }
.cr-media { list-style: none; margin: 0; padding: 0; }
.cr-media li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.cr-media li:last-child { border-bottom: 0; }
.cr-media .cr-media-title { font-weight: 600; }
.cr-media .cr-media-text { margin: 0.15rem 0 0; color: var(--muted); }
@media (max-width: 640px) { .cr-pairs dl { grid-template-columns: minmax(0, 1fr); } }

.date-range { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; }
.range-part { display: flex; align-items: center; gap: 0.4rem; flex: 1 1 12rem; min-width: 0; }
.range-part .sub { font-size: 0.85rem; color: var(--muted); min-width: 2.2rem; }
.range-part input { flex: 1; min-width: 0; }

.qr { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; padding: 0.3rem 0; }
.qr-code { max-width: 100%; height: auto; border-radius: 4px; }
/* (086) display image and address items */
.display-image { padding: 0.3rem 0; }
.display-image img { max-width: 100%; height: auto; border-radius: 4px; }
.geocode-places { list-style: none; margin: 0.3rem 0 0; padding: 0.3rem 0; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.geocode-places li { padding: 0.15rem 0.6rem; }
.geocode-places .link-button { text-align: start; }

/* ---------- lists (list regions, navigation bar) ---------- */
.list-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.list-links .list-links { padding-left: 1.4rem; margin-top: 0.1rem; }
.list-links a, .list-heading { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.5rem; border-radius: 6px; color: var(--text); text-decoration: none; min-width: 0; }
.list-links a > span:not(.badge), .list-heading > span:not(.badge) { overflow-wrap: anywhere; }
.list-heading { font-weight: 600; color: var(--muted); }
.list-links a:hover { background: var(--surface-2); }
.list-links a[aria-current="page"] { background: var(--accent-soft); font-weight: 600; }
.list-badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 0.75rem; }
.list-badge { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 0.9rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; text-align: center; }
.list-badge:hover { border-color: var(--accent); }
.list-badge-value { display: grid; place-items: center; min-width: 3rem; height: 3rem; padding: 0 0.6rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 1.3rem; font-weight: 700; }
.list-badge-label { overflow-wrap: anywhere; }
.list-cards { list-style: none; margin: 0; padding: 0; }
.list-card:hover { border-color: var(--accent); }
.list-card-head { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.list-card-head h3 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list-card p { margin: 0; }
.list-tabs .rds-tab { display: inline-flex; align-items: center; gap: 0.4rem; }
.t-navbar { min-width: 0; }
.t-navbar ul { list-style: none; margin: 0; padding: 0; }
.t-navbar > ul { display: flex; align-items: center; gap: 0.25rem; }
.t-navbar > ul > li > a, .t-navbar > ul > li > details > summary { display: flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.6rem; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.t-navbar > ul > li > a:hover, .t-navbar > ul > li > details > summary:hover { background: rgb(255 255 255 / 10%); }
.t-navbar a[aria-current="page"] { background: rgb(255 255 255 / 16%); }
.t-navbar-menu a { display: flex; align-items: center; gap: 0.45rem; padding: 0.4rem 0.9rem; }
@media (max-width: 1024px) {
  /* (166) visually hidden, still the link's name: an aria-label would leave out the badge (label-content-name-mismatch) */
  .t-navbar .nb-icon > span:not(.badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 640px) {
  .list-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-tabs .rds-list { flex-wrap: nowrap; overflow-x: auto; }
}

/* ---------------------------------------------------------------- template options
   (src/runtime/template-options.ts: a fixed list per region / button) */
.region.to-accent { border-top: 3px solid var(--accent); }
.region.to-flat { box-shadow: none; }
.region.to-borderless { background: transparent; border-color: transparent; box-shadow: none; }
.region.to-compact > .region-header, .region.to-compact > details > .region-header { min-height: 0; padding: 0.35rem 0.7rem; }
.region.to-compact > .region-body, .region.to-compact > details > .region-body { padding: 0.5rem 0.7rem; }
.region.to-no-padding > .region-body, .region.to-no-padding > details > .region-body { padding: 0; }
.region.to-scroll > .region-body, .region.to-scroll > details > .region-body { max-height: 24rem; overflow: auto; }
.t-regions > .region.to-stretch { align-self: stretch; }
.region.to-center > .region-body, .region.to-center > details > .region-body { text-align: center; }
.region.to-hide-header > .region-header {
  position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* items (066) */
.field.to-large input:not([type="checkbox"]):not([type="radio"]), .field.to-large select, .field.to-large textarea { font-size: 1.1rem; padding: 0.6rem 0.75rem; }
.field.to-quiet input:not([type="checkbox"]):not([type="radio"]), .field.to-quiet select, .field.to-quiet textarea { border-color: transparent; background: transparent; }
.field.to-quiet input:not([type="checkbox"]):not([type="radio"]):focus, .field.to-quiet select:focus, .field.to-quiet textarea:focus { border-color: var(--accent); background: var(--surface); }
.field.to-bold input, .field.to-bold .display-value, .field.to-bold output { font-weight: 700; }
.field.to-hide-label > .label, .field.to-hide-label > legend { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* report columns (region config column_options) */
td.to-col-bold { font-weight: 700; }
td.to-col-muted { color: var(--muted); }
td.to-col-nowrap, th.to-col-nowrap { white-space: nowrap; }
td.to-col-mono { font-family: var(--mono); font-size: 0.9em; }
td.to-col-right, th.to-col-right { text-align: right; }
td.to-col-center, th.to-col-center { text-align: center; }
.btn.to-small { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn.to-large { padding: 0.6rem 1.2rem; font-size: 1rem; }
.btn.to-block { display: flex; width: 100%; }
.btn.to-pill { border-radius: 99px; }
.btn.to-outline { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn.to-outline:hover { background: var(--accent-soft); }
.btn.to-link { background: none; border-color: transparent; color: var(--accent); text-decoration: underline; padding-left: 0.3rem; padding-right: 0.3rem; }
.btn.to-link:hover { background: none; text-decoration: none; }
.btn.to-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.to-success:hover { background: color-mix(in srgb, var(--success) 86%, black); }
.btn.to-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.to-danger:hover { background: color-mix(in srgb, var(--danger) 86%, black); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.to-success, :root:not([data-theme="light"]) .btn.to-danger { color: #10141a; }
}
:root[data-theme="dark"] .btn.to-success, :root[data-theme="dark"] .btn.to-danger { color: #10141a; }

/* Data Reporter (src/runtime/data-reporter.ts) */
.reporter { overflow-wrap: anywhere; min-width: 0; }
.reporter-head { margin-bottom: 0.75rem; }
.reporter-title { margin: 0.3rem 0 0.1rem; font-size: 1.1rem; }
.reporter-h { font-size: 1rem; margin: 1rem 0 0.4rem; }
.reporter-desc { margin: 0.15rem 0 0; }
.reporter-new { display: flex; flex-direction: column; gap: 0.3rem; }
.reporter-sources { margin: 0.3rem 0 0; font-size: 0.85rem; }
.reporter-sources dt { font-weight: 600; }
.reporter-sources dd { margin: 0 0 0.3rem; color: var(--muted); }
.reporter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.reporter-editor { margin-bottom: 1rem; }
.reporter-editor > summary { cursor: pointer; font-weight: 600; margin-bottom: 0.6rem; }
.reporter-set { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem 0.6rem; margin: 0 0 0.75rem; min-width: 0; }
.reporter-set legend { font-weight: 600; font-size: 0.9rem; padding: 0 0.3rem; }
.reporter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.4rem; }
.reporter-row > select, .reporter-row > input { flex: 1 1 9rem; min-width: 0; }
.reporter-row > .label { flex: 0 0 7rem; }
.reporter-checks { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.reporter-chart { margin-bottom: 0.75rem; }
.reporter-save { margin-top: 1rem; }
.reporter-hello { margin-bottom: 0.5rem; }
.reporter-hello p { margin: 0.2rem 0 0; }
.reporter-cards { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 0.6rem; }
.reporter-card { display: flex; flex-direction: column; gap: 0.25rem; height: 100%; padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: inherit; text-decoration: none; }
.reporter-card:hover, .reporter-card:focus-visible { border-color: var(--accent); }
.reporter-card strong { color: var(--accent); }
.reporter-card .muted { font-size: 0.85rem; }
.reporter-card-meta { margin-top: auto; font-size: 0.78rem; color: var(--muted); }
.reporter-search { max-width: 30rem; margin: 0.25rem 0 0; }
@media (max-width: 600px) {
  .reporter-row > .label { flex-basis: 100%; }
}

/* AI assistant region and report questions (src/runtime/assistant.ts, ai-filter.ts) */
.assistant { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; overflow-wrap: anywhere; }
.assistant-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; max-height: 32rem; overflow-y: auto; }
.assistant-msg { padding: 0.5rem 0.75rem; border-radius: 0.6rem; max-width: 90%; border: 1px solid var(--border, #d0d5dd); }
.assistant-msg-user { align-self: flex-end; background: var(--accent-soft, #eef4ff); }
.assistant-msg-assistant { align-self: flex-start; background: var(--surface, #fff); }
.assistant-who { display: block; font-size: 0.75rem; font-weight: 600; opacity: 0.75; margin-bottom: 0.15rem; }
.assistant-text p, .assistant-text ul, .assistant-text ol { margin: 0 0 0.4rem; }
.assistant-text > :last-child { margin-bottom: 0; }
.assistant-text ul, .assistant-text ol { padding-left: 1.25rem; }
/* (sprint 148) an answer while it streams: plain text, its line breaks kept, until the page shows it formatted */
.assistant-text .assistant-streaming { white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-tools { display: block; margin-top: 0.25rem; }
.assistant-input textarea { width: 100%; box-sizing: border-box; }
.assistant-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0; }
.ai-filter { margin-bottom: 0.75rem; }
.ai-filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ai-filter-row input { flex: 1 1 14rem; min-width: 0; }
button.is-busy { opacity: 0.7; cursor: progress; }

/* crop dialog for file items with "crop" (app.js cropPicture) */
dialog.crop-dialog { border: 0; border-radius: var(--radius); padding: 1rem 1.25rem; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgb(0 0 0 / 30%); max-width: calc(100vw - 1rem); }
dialog.crop-dialog::backdrop { background: rgb(15 20 30 / 55%); }
.crop-dialog h2 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.crop-help { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.85rem; max-width: 36rem; }
.crop-stage { position: relative; margin: 0 auto 0.75rem; touch-action: none; user-select: none; }
.crop-stage canvas { display: block; width: 100%; height: 100%; }
.crop-frame { position: absolute; box-sizing: border-box; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgb(0 0 0 / 50%); cursor: move; outline: none; }
.crop-frame:focus-visible { border-color: var(--accent); }
.crop-handle { position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: nwse-resize; }
.crop-stage { overflow: hidden; }
.crop-dialog .buttons { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* (079) Developer toolbar: shown to developers with a builder session in the same browser.
   (sprint 72) A compact bar of icons centred at the bottom (APEX's runtime developer toolbar);
   app.js docks it at the top, left or right and shrinks it to a slim tab when it is not used.
   The page keeps room for it, so it never covers the menu's last entry or a report's pager. */
.devbar { --devbar-size: 2.75rem; position: fixed; z-index: 900; left: 50%; bottom: 0.5rem; transform: translateX(-50%);
  background: #1b2330; color: #fff; border-radius: 10px; box-shadow: 0 4px 16px rgb(0 0 0 / 25%); font-size: 0.8125rem;
  transition: transform 0.2s ease, opacity 0.2s ease; }
.devbar-tools { display: flex; align-items: center; gap: 0.15rem; list-style: none; margin: 0; padding: 0.25rem; }
.devbar .devbar-tool { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 7px; color: #dbe7ff;
  background: none; border: 0; cursor: pointer; list-style: none; padding: 0; }
.devbar-tool::-webkit-details-marker { display: none; }
.devbar .devbar-tool:hover, .devbar-menu[open] > .devbar-tool, .devbar-quick[aria-pressed="true"] { background: #2f3b4f; color: #fff; }
.devbar-debug-menu.is-on > .devbar-tool { color: #ffd166; }
/* (sprint 79, UI-4) a text next to each icon (App 12, Page 3, Debug off); icons only when chosen or docked at a side */
.devbar .devbar-tool:has(.devbar-text) { width: auto; min-width: 2.25rem; padding: 0 0.55rem; grid-auto-flow: column; gap: 0.35rem; white-space: nowrap; }
.devbar[data-compact] .devbar-text, .devbar[data-dock="left"] .devbar-text, .devbar[data-dock="right"] .devbar-text { display: none; }
.devbar[data-compact] .devbar-tool:has(.devbar-text), .devbar[data-dock="left"] .devbar-tool:has(.devbar-text), .devbar[data-dock="right"] .devbar-tool:has(.devbar-text) { width: 2.25rem; padding: 0; }
@media (max-width: 900px) {
  .devbar .devbar-text { display: none; }
  .devbar .devbar-tool:has(.devbar-text) { width: 2.25rem; padding: 0; }
}
.devbar a, .devbar-pop a { color: #9cc8ff; }
.devbar a:focus-visible, .devbar button:focus-visible, .devbar select:focus-visible, .devbar summary:focus-visible, .devbar input:focus-visible { outline: 2px solid #9cc8ff; outline-offset: 2px; }
.devbar-menu { position: relative; }
.devbar-pop { position: absolute; bottom: calc(100% + 0.6rem); left: 50%; transform: translateX(-50%); min-width: 14rem; max-width: min(22rem, calc(100vw - 2rem));
  background: #1b2330; border-radius: 8px; box-shadow: 0 4px 16px rgb(0 0 0 / 30%); padding: 0.6rem 0.75rem; display: grid; gap: 0.5rem; }
.devbar-debug { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0; }
.devbar-debug label { flex-basis: 100%; }
.devbar-debug select, .devbar-debug button { font: inherit; font-size: 0.8125rem; padding: 0.1rem 0.3rem; border-radius: 4px; border: 1px solid #5e6a7a; background: #2b3340; color: #fff; }
.devbar-debug button { cursor: pointer; }
.devbar-dock { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem 0.75rem; }
.devbar-dock legend { padding: 0; margin-bottom: 0.25rem; font-weight: 600; }
.devbar-pop .devbar-facts { color: #fff; }
/* docked at the top, or on the left or right edge (a column of icons) */
.devbar[data-dock="top"] { bottom: auto; top: 0.5rem; }
.devbar[data-dock="top"] .devbar-pop { bottom: auto; top: calc(100% + 0.6rem); }
.devbar[data-dock="left"], .devbar[data-dock="right"] { left: 0.5rem; bottom: auto; top: 50%; transform: translateY(-50%); }
.devbar[data-dock="right"] { left: auto; right: 0.5rem; }
.devbar[data-dock="left"] .devbar-tools, .devbar[data-dock="right"] .devbar-tools { flex-direction: column; }
.devbar[data-dock="left"] .devbar-pop { bottom: auto; top: 0; left: calc(100% + 0.6rem); transform: none; }
.devbar[data-dock="right"] .devbar-pop { bottom: auto; top: 0; left: auto; right: calc(100% + 0.6rem); transform: none; }
/* not used for a while: a slim tab at the edge; pointing at it or focusing it brings it back */
.devbar.is-idle { opacity: 0.85; }
.devbar.is-idle[data-dock="bottom"] { transform: translate(-50%, calc(100% - 6px)); }
.devbar.is-idle[data-dock="top"] { transform: translate(-50%, calc(-100% + 6px)); }
.devbar.is-idle[data-dock="left"] { transform: translate(calc(-100% + 6px), -50%); }
.devbar.is-idle[data-dock="right"] { transform: translate(calc(100% - 6px), -50%); }
.devbar.is-idle .devbar-tools { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .devbar { transition: none; } }
/* room for the bar: the menu and the page end above it */
body:has(.devbar[data-dock="bottom"]) .t-main, body:has(.devbar[data-dock="bottom"]) .t-nav > ul { padding-bottom: 3.75rem; }
body:has(.devbar[data-dock="top"]) .t-body { padding-top: 3.25rem; }
body:has(.devbar[data-dock="left"]) .t-body { padding-left: 3.25rem; }
body:has(.devbar[data-dock="right"]) .t-main { padding-right: 3.5rem; }
.devbar-page .t-main { max-width: 72rem; margin: 0 auto; padding: 1rem; }
.devbar-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; }
.devbar-facts dd { margin: 0; overflow-wrap: anywhere; }
.devbar-session code { overflow-wrap: anywhere; }
@media print { .devbar { display: none; } }

/* (080) Search region: one field, results grouped per search configuration */
.search-form { margin-bottom: 1rem; }
.search-group + .search-group { margin-top: 1rem; }
.search-group h3 { font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 0.4rem; }
.search-hits { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.search-hits li + li { border-top: 1px solid var(--border); }
.search-hit { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.6rem 0.8rem; color: inherit; text-decoration: none; }
a.search-hit:hover, a.search-hit:focus-visible { background: var(--accent-soft); }
.search-icon { flex: none; color: var(--accent); }
.search-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.search-title { font-weight: 600; }
.search-subtitle, .search-description { color: var(--muted); font-size: 0.875rem; }
.search-hit mark { background: #fff3a3; color: inherit; border-radius: 2px; padding: 0 1px; }
:root[data-theme="dark"] .search-hit mark { background: #6b5a00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .search-hit mark { background: #6b5a00; } }
.search-hit .badge-pill { flex: none; }
.search-more, .search-empty { margin: 0.4rem 0 0; }

/* (084) Feedback: the users' page and the builder's list */
.feedback-form .choices { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.feedback-list, .feedback-admin { list-style: none; margin: 0; padding: 0; }
.feedback-list > li, .feedback-admin > li { border-top: 1px solid var(--border); padding: 0.75rem 0; }
.feedback-list > li:first-child, .feedback-admin > li:first-child { border-top: 0; }
.feedback-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; overflow-wrap: anywhere; }
.feedback-page > .region + .region { margin-top: 1rem; }
.feedback-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.4rem 0; }
.feedback-response { background: var(--surface-2); border-radius: var(--radius); padding: 0.5rem 0.75rem; }
.feedback-response p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.25rem 0 0; }

/* (085) Session timeout warning */
.session-dialog { max-width: min(28rem, calc(100vw - 2rem)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.25rem; }
.session-dialog::backdrop { background: rgb(0 0 0 / 40%); }
.session-dialog p { margin: 0 0 1rem; }
/* (sprint 59) Quick edit from the developer toolbar */
.quick-edit .qe-target { outline: 2px dashed var(--accent); outline-offset: 2px; cursor: pointer; }
.devbar-quick[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

/* (sprint 76) the pager: rows per page; a Go button only without JavaScript */
.pager .pager-size { margin-right: 0; display: inline-flex; align-items: center; gap: 0.4rem; margin-left: auto; font-size: 0.85rem; }
.pager-size select { min-height: 0; padding: 0.15rem 0.4rem; }
.pager-size label { white-space: nowrap; }
.js .no-js-only { display: none; }

/* (sprint 76) the interactive report's Actions menu: one line per entry, submenus, forms in dialogs */
.actions-menu .menu-panel { min-width: 15rem; padding: 0.3rem 0; }
.ir-menu { list-style: none; margin: 0; padding: 0; }
.ir-item > summary, .ir-link { display: flex; align-items: center; gap: 0.55rem; width: 100%; padding: 0.45rem 0.9rem; cursor: pointer; list-style: none; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; text-align: left; }
.ir-item > summary::-webkit-details-marker { display: none; }
.ir-item > summary:hover, .ir-link:hover, .ir-item[open] > summary { background: var(--surface-3); }
.ir-item > summary .icon, .ir-link .icon { color: var(--muted); }
.ir-more { margin-left: auto; color: var(--muted); }
.ir-sub > .ir-menu { padding-left: 1.25rem; }
.ir-body { padding: 0.5rem 0.9rem 0.75rem; display: grid; gap: 0.5rem; }
.ir-body .menu-section { padding: 0; border: 0; }
.ir-columns { border: 0; margin: 0; padding: 0; display: grid; gap: 0.2rem; max-height: 50vh; overflow: auto; }
.ir-columns legend { font-weight: 600; margin-bottom: 0.3rem; }
.ir-dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; width: min(34rem, calc(100vw - 2rem)); box-shadow: 0 12px 32px rgb(0 0 0 / 25%); }
.ir-dialog::backdrop { background: rgb(0 0 0 / 35%); }
.ir-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.ir-dialog-head h2 { margin: 0; font-size: 1.05rem; }
.ir-dialog .ir-body { padding: 1rem; }
.ir-dialog .filter-row { min-width: 0; }
.filter-dialog .date-field { display: flex; min-width: 0; }
.filter-dialog .date-field input { flex: 1; min-width: 0; }
.filter-dialog .filter-values, .filter-dialog .help { grid-column: 1 / -1; }
.filter-values { display: grid; gap: 0.3rem; }
.filter-values-list { list-style: none; margin: 0; padding: 0.25rem 0.4rem; max-height: 14rem; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.filter-values-list .check { display: flex; gap: 0.4rem; align-items: center; padding: 0.15rem 0; }
.filter-values-list .muted { margin-left: auto; font-variant-numeric: tabular-nums; }
/* (143) Actions → Columns: a row per column, dragged by its handle or moved with its arrows */
.ir-col-order { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.ir-col-order > li { display: flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0.3rem; border: 1px solid transparent; border-radius: var(--radius); background: var(--surface); }
.ir-col-order > li:hover { border-color: var(--border); }
.ir-col-order > li.dragging { opacity: 0.55; border-style: dashed; border-color: var(--accent); }
.ir-col-order .check { flex: 1; min-width: 0; }
.ir-col-order .drag-handle { color: var(--muted); cursor: grab; display: inline-flex; }
.no-js .ir-col-order .drag-handle, html:not(.js) .ir-col-order .drag-handle { display: none; }
.ir-col-move { display: inline-flex; gap: 0.15rem; }
.ir-col-move .btn { min-width: 2rem; padding: 0.1rem 0.4rem; line-height: 1.2; }
.ir-col-move .btn:disabled { opacity: 0.35; }
/* the search field with its column list (APEX: the magnifier's column menu) */
.search-field { display: flex; flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.search-field:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-field .search-scope { border: 0; border-right: 1px solid var(--border); border-radius: var(--radius) 0 0 var(--radius); max-width: 9rem; background: var(--surface-2); }
/* (sprint 79, IR-3; APEX: the column scope in the magnifier of the search field) all columns: only the magnifier;
   a column: the magnifier and its name */
.search-scope-wrap { position: relative; display: flex; flex: none; }
.search-scope-wrap > .icon { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); }
.search-field .search-scope-wrap .search-scope { padding-left: 2rem; }
.search-field .search-scope-wrap .search-scope:has(option[value=""]:checked) { width: 2.75rem; padding-right: 0.5rem; color: transparent; }
.search-field .search-scope option { color: var(--text); }
.search-field input[type=search] { border: 0; flex: 1; min-width: 0; background: transparent; }
.search-field input[type=search]:focus { outline: none; }
/* a column heading's menu */
.th-menu { z-index: 60; width: 17rem; padding: 0.4rem 0; display: grid; gap: 0.3rem; max-height: 70vh; overflow: auto; }
.th-menu-actions { display: grid; }
.th-menu-actions a, .th-menu-values a { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.35rem 0.9rem; color: var(--text); text-decoration: none; }
.th-menu-actions a:hover, .th-menu-values a:hover, .th-menu a:focus-visible { background: var(--surface-3); }
.th-menu input[type=search] { margin: 0.2rem 0.75rem; width: calc(100% - 1.5rem); }
.th-menu-values { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.th-menu-values li.muted { padding: 0.35rem 0.9rem; }
.js th[data-col] > a { cursor: pointer; }

/* (sprint 76) a date item in the application's date format */
.date-field { position: relative; }
/* (sprint 84; APEX: the date picker) a month of days under a date field (app.js) */
.date-picker { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgb(16 24 40 / 18%); padding: 0.5rem; min-width: 17rem; }
.date-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.35rem; }
.date-picker-title { font-weight: 650; text-transform: capitalize; }
.date-picker-grid { border-collapse: collapse; width: 100%; }
.date-picker-grid th { font-size: 0.75rem; font-weight: 600; color: var(--muted); padding: 0.2rem 0; text-align: center; }
.date-picker-grid td { padding: 1px; text-align: center; }
.date-picker-grid button { width: 2.2rem; height: 2.1rem; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; cursor: pointer; }
.date-picker-grid button:hover { background: var(--surface-3); }
.date-picker-grid button.date-other { color: var(--muted); }
.date-picker-grid button.date-today { box-shadow: inset 0 0 0 1px var(--accent); }
.date-picker-grid button.date-selected { background: var(--accent); color: var(--accent-text); }
.date-picker-grid button:disabled { opacity: 0.35; cursor: not-allowed; }
.date-picker-grid button:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.date-picker-foot { display: flex; justify-content: space-between; margin-top: 0.4rem; }
.js .grid-table tbody td[data-col]:not(:focus-within) .date-field > .btn { visibility: hidden; }

/* (sprint 77) display positions: banner, breadcrumb bar, a side column, footer; button positions in a region */
.t-pos-banner, .t-pos-breadcrumb { margin-bottom: 1rem; }
.t-pos-breadcrumb { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.t-pos-footer { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.t-columns { display: grid; gap: 1.25rem; align-items: start; }
.t-columns-left { grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr); }
.t-columns-right { grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem); }
.t-columns-right > .t-side { order: 2; }
.t-side .t-regions, .t-side { min-width: 0; }
.t-side .region { grid-column: 1 / -1; }
@media (max-width: 900px) { .t-columns-left, .t-columns-right { grid-template-columns: 1fr; } .t-columns-right > .t-side { order: 0; } }
.region-footer-split { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.region-footer-split > div { display: flex; gap: 0.5rem; }

/* (sprint 85) the Form Designer region (form-designer.ts): forms as cards with a Design link, the designer's field table, a row's form */
.fd-cards > li { display: flex; flex-direction: column; gap: 0.25rem; }
.fd-design-link { font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.3rem; }
.fd-fields input.fd-seq { width: 4.5rem; }
.fd-fields td select { min-width: 8rem; }
.fd-fields td input:not([type=checkbox]):not(.fd-seq) { min-width: 6rem; width: 100%; }
.fd-form { margin: 0.75rem 0; }
.fd-radios { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.fd-new { margin-top: 1rem; }

/* (sprint 88, GEN-4; APEX: the Cards list template and the hero region) a list's cards each get a colour band
   and their icon in a round badge, in the chart palette's order; the hero sits on the page background */
.list-cards > li { --card-color: var(--series-1); }
.list-cards > li:nth-child(8n+2) { --card-color: var(--series-2); }
.list-cards > li:nth-child(8n+3) { --card-color: var(--series-3); }
.list-cards > li:nth-child(8n+4) { --card-color: var(--series-4); }
.list-cards > li:nth-child(8n+5) { --card-color: var(--series-5); }
.list-cards > li:nth-child(8n+6) { --card-color: var(--series-6); }
.list-cards > li:nth-child(8n+7) { --card-color: var(--series-7); }
.list-cards > li:nth-child(8n+8) { --card-color: var(--series-8); }
.list-card { border-top: 4px solid var(--card-color); }
.list-card-icon { flex: none; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: color-mix(in srgb, var(--card-color) 16%, transparent); color: var(--card-color); }
.list-card-icon .icon { width: 1.3rem; height: 1.3rem; }
.list-card-head { gap: 0.75rem; }
.region-hero { background: transparent; padding-left: 0; padding-right: 0; }

/* (sprint 88, GEN-4; APEX: the page footer) the application's version and Back to top, under the content */
.t-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1rem;
  margin: 0 1.5rem 1rem; max-width: calc(1500px - 3rem); padding: 0.75rem 0 0.25rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
@media (max-width: 640px) { .t-footer { margin: 0 0.75rem 1rem; } }
.t-footer .t-top { margin-left: auto; display: inline-flex; align-items: center; gap: 0.3rem; color: inherit; }
.t-footer .t-top:hover, .t-footer .t-top:focus-visible { color: var(--accent); }
.t-footer .icon { width: 1rem; height: 1rem; }
@media print { .t-footer { display: none; } }
.list-card:hover { border-top-color: var(--card-color); }

/* (sprint 110) Data Reporter: a saved report's link and actions, column descriptions */
.reporter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; margin: 0 0 0.75rem; min-width: 0; }
.reporter-actions .buttons { margin: 0; }
.reporter-link { flex: 1 1 14rem; min-width: 0; font-family: var(--mono, monospace); font-size: 0.85rem; }
.reporter-coldesc { display: block; font-size: 0.78rem; }

/* (121) AI agents: links a navigate tool built under an answer; tool arguments in the AI usage log */
.assistant-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
.assistant-links .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.ai-args { overflow-wrap: anywhere; word-break: break-word; }

/* (sprint 112) the report's settings as chips under "Ask in your own words" (src/runtime/ai-filter.ts): Edit unfolds a small form */
.ask-chips { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.ask-chip { flex-wrap: wrap; max-width: 100%; min-width: 0; overflow-wrap: anywhere; padding-right: 0.2rem; }
.ask-chip-text { min-width: 0; }
.ask-edit > summary { cursor: pointer; font-size: 0.78rem; text-decoration: underline; list-style: none; padding: 0 0.2rem; }
.ask-edit > summary::-webkit-details-marker { display: none; }
.ask-edit[open] { flex-basis: 100%; }
.ask-edit-body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.4rem; padding: 0.4rem 0.2rem 0.3rem; }
.ask-field { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1 1 8rem; max-width: 100%; }
.ask-field label { font-size: 0.75rem; }
.ask-field select, .ask-field input { min-width: 0; width: 100%; box-sizing: border-box; }
.ask-chip-x { background: none; border: 0; color: inherit; font-size: 1rem; line-height: 1; padding: 0.15rem 0.4rem; border-radius: 99px; cursor: pointer; }
.ask-chip-x:hover, .ask-chip-x:focus-visible { background: var(--surface); }
/* (123) workflows: draft and send e-mail steps; custom task outcomes */
.wf-send_mail rect { stroke: var(--success); stroke-width: 2; }
.wf-draft rect { fill: var(--surface-2, var(--surface)); stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 6 4; }
.wf-draft .wf-name, .wf-draft .wf-type { font-style: italic; }
.btn.to-warning { background: var(--warning-soft); border-color: color-mix(in srgb, #b86e00 45%, var(--border)); color: var(--text); }
.btn.to-warning:hover { background: color-mix(in srgb, var(--warning-soft) 80%, #b86e00); }
.wf-export { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0; }
.wf-migrate-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: 0.5rem 1rem; }
.wf-migrate-map label { display: flex; flex-direction: column; gap: 0.2rem; overflow-wrap: anywhere; }
.wf-migrate-map select { max-width: 100%; }
.wf-problem { color: var(--danger); overflow-wrap: anywhere; }

/* (sprint 115) the popup LOV's end of list while the next page loads, and the wait popup (dynamic action wait_popup) */
.popup-lov-sentinel { margin: 0.5rem 0 0; text-align: center; font-size: 0.875rem; }
dialog.wait-popup { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); padding: 1.25rem 1.5rem; max-width: min(360px, calc(100vw - 2rem)); display: none; }
dialog.wait-popup[open] { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
dialog.wait-popup:focus { outline: none; }
dialog.wait-popup::backdrop { background: rgb(15 20 30 / 35%); cursor: wait; }
.wait-popup-spinner { width: 1.75rem; height: 1.75rem; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--accent) 18%, transparent); border-top-color: var(--accent); }
.wait-popup-text { margin: 0; text-align: center; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: no-preference) { .wait-popup-spinner { animation: icon-spin 0.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite; } }

/* ---------- (sprint 117, APEX 26.2) Pillar Light / Pillar Dark navigation appearances ----------
   body.nav-pillar + nav-pillar-light / nav-pillar-dark (theme.appearance or a Theme Roller style's,
   src/runtime/styles.ts). Header and menu read as one column ("pillar"); a header pillar strip in
   --strip (Theme Roller), else the accent; the current page is a filled pill in the accent, its
   parents bold with an accent guide line. Light: the page's own surfaces (dark ones in dark mode).
   Dark: header and menu in the header colour. Contrast: menu text ≥ 7:1, the pill's text ≥ 4.5:1. */
body.nav-pillar .t-header { box-shadow: inset 0 4px 0 var(--strip, var(--accent)); }
body.nav-pillar .t-nav a, body.nav-pillar .t-nav summary { border-radius: 999px; }
body.nav-pillar .t-nav a[aria-current="page"] { background: var(--accent); color: var(--accent-text); border-inline-start-color: transparent; }
body.nav-pillar .t-nav a[aria-current="page"] .icon { color: var(--accent-text); }
body.nav-pillar .t-nav a:focus-visible, body.nav-pillar .t-nav summary:focus-visible { outline-color: var(--nav-text); }
body.nav-pillar-light {
  --header: var(--surface-2); --header-text: var(--text);
  --nav-bg: var(--surface-2); --nav-text: var(--text); --nav-muted: var(--muted);
  --nav-hover: var(--surface-3); --nav-active: var(--accent-soft); --nav-current: var(--accent);
}
body.nav-pillar-light .t-header { border-bottom: 1px solid var(--border); }
body.nav-pillar-light .t-nav { border-inline-end-color: var(--border); }
body.nav-pillar-light .icon-button:hover, body.nav-pillar-light .t-user > summary:hover,
body.nav-pillar-light .t-navbar > ul > li > a:hover, body.nav-pillar-light .t-navbar > ul > li > details > summary:hover { background: var(--surface-3); }
body.nav-pillar-light .t-navbar a[aria-current="page"] { background: var(--accent-soft); }
body.nav-pillar-dark {
  --nav-bg: var(--header); --nav-text: var(--header-text);
  --nav-muted: color-mix(in srgb, var(--header-text) 72%, var(--header));
  --nav-hover: color-mix(in srgb, var(--header) 86%, #ffffff); --nav-active: color-mix(in srgb, var(--header) 76%, #ffffff);
  --nav-current: var(--header-text);
  --nav-guide: color-mix(in srgb, var(--header-text) 22%, transparent);
}
body.nav-pillar-dark .t-nav { border-inline-end-color: transparent; }
body.nav-pillar-dark .t-nav .in-trail .icon, body.nav-pillar-dark .t-nav a[aria-current="page"] .icon { color: inherit; }
body.nav-pillar-dark .t-nav details:has(> summary.in-trail) > ul { border-inline-start-color: color-mix(in srgb, var(--strip, var(--accent)) 70%, var(--header-text)); }
@media (min-width: 1024px) {
  body.nav-pillar.nav-top .t-nav > ul > li > a[aria-current="page"] { box-shadow: none; }
  body.nav-pillar-dark.nav-top .t-nav { border-bottom-color: transparent; }
}

/* ---------- (sprint 117, APEX 26.2) subtle colour utilities: a tinted background with readable text,
   in light and dark mode (text mostly the page's text colour, so contrast holds for every hue).
   u-color-1-subtle … u-color-15-subtle and u-color-{success,danger,warning,info,neutral}-subtle. */
[class*="-subtle"][class*="u-color-"] {
  background: color-mix(in srgb, var(--u-hue) 14%, var(--surface)); color: color-mix(in srgb, var(--u-hue) 38%, var(--text));
  border-color: color-mix(in srgb, var(--u-hue) 32%, var(--surface));
}
.u-color-1-subtle { --u-hue: #309fdb; } .u-color-2-subtle { --u-hue: #13b6cf; } .u-color-3-subtle { --u-hue: #2ebfbc; }
.u-color-4-subtle { --u-hue: #3caf85; } .u-color-5-subtle { --u-hue: #81bb5f; } .u-color-6-subtle { --u-hue: #c9cf1f; }
.u-color-7-subtle { --u-hue: #f2bf2c; } .u-color-8-subtle { --u-hue: #f18b48; } .u-color-9-subtle { --u-hue: #e95b54; }
.u-color-10-subtle { --u-hue: #e85d88; } .u-color-11-subtle { --u-hue: #ca589d; } .u-color-12-subtle { --u-hue: #8f5ea8; }
.u-color-13-subtle { --u-hue: #5a68ad; } .u-color-14-subtle { --u-hue: #627c94; } .u-color-15-subtle { --u-hue: #8a7a6b; }
.u-color-success-subtle { --u-hue: var(--success); } .u-color-danger-subtle { --u-hue: var(--danger); }
.u-color-warning-subtle { --u-hue: #d18b00; } .u-color-info-subtle { --u-hue: var(--accent); } .u-color-neutral-subtle { --u-hue: var(--muted); }

/* ---------- (sprint 117) the processing bar on a busy region (dynamic actions, refreshes) */
.region[aria-busy="true"] { position: relative; }
.region[aria-busy="true"]::after {
  content: ""; position: absolute; z-index: 2; top: 0; inset-inline: 0; height: 3px; border-radius: var(--radius) var(--radius) 0 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 40% 100% no-repeat, color-mix(in srgb, var(--accent) 15%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .region[aria-busy="true"]::after { animation: busy-slide 1.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite; }
}
@keyframes busy-slide { from { background-position: -60% 0, 0 0; } to { background-position: 160% 0, 0 0; } }

/* (sprint 130) two-step sign-in: the QR code for an authenticator app, its key and the recovery codes */
.mfa-qr { margin: .5rem 0 1rem; }
.mfa-qr svg { width: 200px; max-width: 100%; height: auto; background: #fff; padding: 8px; border-radius: 6px; }
.mfa-secret { word-break: break-all; letter-spacing: .05em; }
.mfa-steps { padding-left: 1.25rem; margin: 0; }
.mfa-codes { columns: 2; column-gap: 2rem; padding-left: 1.5rem; }
.mfa-factors { list-style: none; padding: 0; margin: 0 0 .75rem; }
.mfa-factors li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
@media (max-width: 480px) { .mfa-codes { columns: 1; } }

/* (sprint 158) Percent Graph and Display Map items */
.percent-graph { display: flex; align-items: center; gap: .5rem; }
.percent-graph progress { flex: 1; max-width: 16rem; height: .75rem; accent-color: var(--t-accent, #2563eb); }
.percent-graph-value { font-variant-numeric: tabular-nums; min-width: 3.5ch; text-align: right; }
.display-map { margin: 0; display: inline-block; max-width: 100%; }
.display-map-tile { position: relative; width: 256px; max-width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 6px; border: 1px solid var(--t-border, #d0d5dd); }
.display-map-tile img { display: block; width: 100%; height: 100%; }
.display-map-pin { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #d92d20; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.display-map figcaption { font-size: .8rem; margin-top: .25rem; }

/* ---------- (sprint 199, NX-U6) the sign-in card: the application's mark, "Sign in with a passkey" ---------- */
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.login-brand h1 { margin: 0; overflow-wrap: anywhere; }
.login-mark { display: block; width: 56px; height: 56px; border-radius: 14px; object-fit: cover; }
.login-mark-letter { display: grid; place-items: center; background: var(--accent); color: var(--accent-text); font-size: 1.6rem; font-weight: 650; line-height: 1; }
.login-passkey { display: flex; flex-direction: column; gap: 0.75rem; }
.login-passkey .login-passkey-button { width: 100%; white-space: normal; text-align: center; }
.login-passkey-status { margin: 0; color: var(--danger, #b42318); }
.login-passkey-status:empty { display: none; }

/* (sprint 231, AX-13) the sign-in form's "Remember username" and "Keep me signed in" */
.login-checks { display: flex; flex-direction: column; gap: 0.5rem; }

/* ---------- (sprint 230, AX-9..11) a region's Layout, Appearance, Header and Footer, Customization ---------- */
/* Column (col-start-N) with the span (col-N sets --span); Start New Row is col-start-1. Narrow screens stack as before. */
.region { --span: 12; }
.region.col-1 { --span: 1; } .region.col-2 { --span: 2; } .region.col-3 { --span: 3; } .region.col-4 { --span: 4; }
.region.col-5 { --span: 5; } .region.col-6 { --span: 6; } .region.col-7 { --span: 7; } .region.col-8 { --span: 8; }
.region.col-9 { --span: 9; } .region.col-10 { --span: 10; } .region.col-11 { --span: 11; }
/* (a region in a row of its own takes its span; a Column below wins) */
.t-row > .region { grid-column: span var(--span); min-width: 0; }
:is(.t-regions, .t-row) > .col-start-1 { grid-column: 1 / span var(--span); } :is(.t-regions, .t-row) > .col-start-2 { grid-column: 2 / span var(--span); }
:is(.t-regions, .t-row) > .col-start-3 { grid-column: 3 / span var(--span); } :is(.t-regions, .t-row) > .col-start-4 { grid-column: 4 / span var(--span); }
:is(.t-regions, .t-row) > .col-start-5 { grid-column: 5 / span var(--span); } :is(.t-regions, .t-row) > .col-start-6 { grid-column: 6 / span var(--span); }
:is(.t-regions, .t-row) > .col-start-7 { grid-column: 7 / span var(--span); } :is(.t-regions, .t-row) > .col-start-8 { grid-column: 8 / span var(--span); }
:is(.t-regions, .t-row) > .col-start-9 { grid-column: 9 / span var(--span); } :is(.t-regions, .t-row) > .col-start-10 { grid-column: 10 / span var(--span); }
:is(.t-regions, .t-row) > .col-start-11 { grid-column: 11 / span var(--span); } :is(.t-regions, .t-row) > .col-start-12 { grid-column: 12 / span var(--span); }
/* Row CSS Classes: the row is a 12-column grid of its own across the whole width */
.t-regions > .t-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; align-items: start; min-width: 0; }
@media (max-width: 1023px) {
  .t-row > .region { grid-column: span 12 !important; }
  .t-row > :is(.col-1, .col-2, .col-3, .col-4, .col-5, .col-6) { grid-column: span 6 !important; }
}
@media (max-width: 640px) { .t-row > .region { grid-column: span 12 !important; } }
/* Icon (Appearance) beside the title */
.region-icon { display: inline-flex; vertical-align: -0.15em; margin-inline-end: 0.4rem; color: var(--accent); }
.region-icon .icon { width: 1.1em; height: 1.1em; }
/* Header Text and Footer Text */
.region-header-text { margin-bottom: 0.75rem; }
.region-footer-text { margin-top: 0.75rem; color: var(--muted); }
.region-header-text > :first-child, .region-footer-text > :first-child { margin-top: 0; }
.region-header-text > :last-child, .region-footer-text > :last-child { margin-bottom: 0; }
/* Customization: the page's Customize link */
.t-customize { margin-top: 1.5rem; max-width: 32rem; }
.t-customize > summary { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; color: var(--accent); }
.t-customize-form { margin-top: 0.5rem; padding: 0.75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.t-customize-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.t-customize-form legend { font-weight: 600; margin-bottom: 0.35rem; }
.t-customize-form .check { overflow-wrap: anywhere; }
