/*
 * The application frame: one topbar across the full width, and below it the
 * rail beside the canvas.
 *
 * Not Tabler's own page layout, which puts the vertical navbar *beside* the
 * header rather than under it. The topbar carries the brand and the rail
 * toggle, so it has to span everything — the same shape conjunto's
 * server-rendered `app_base.html` has.
 *
 * Only what every host needs is here: the frame, the rail and its modes, the
 * hit targets, the fixes to Tabler that the widgets rely on, and the styles of
 * `sortable`, `dragdrop`, `toast()` and the shortcut zones. A host lays its own
 * sheet over this one for what is its alone — gdaps links libraries in name
 * order, and "conjunto-ui" sorts before a host's.
 */

:root {
  --conjunto-rail-width: 15rem;
  --conjunto-rail-mini-width: 56px;
  /* What the column beside the canvas, the dock's areas and the aside are
     worth before the stores' first write. The stored sizes arrive in the boot
     configuration and `Shell` writes them over these. */
  --conjunto-canvas-left-width: 16rem;
  --conjunto-dock-bottom-height: 20rem;
  --conjunto-dock-right-width: 30rem;
  --conjunto-dock-sidebar-width: 30rem;
  --conjunto-aside-width: 20rem;
}

.conjunto-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* A public route's bare shell: the screen is the whole document, and it
   scrolls on its own like the canvas does inside the frame. */
.conjunto-public {
  height: 100vh;
  overflow-y: auto;
}

.conjunto-topbar {
  flex: none;
  /* The anchor for what floats off the bar (`.conjunto-live-offline`). */
  position: relative;
  z-index: 2;
  /* A pale wash of the brand colour, mixed into the surface so it stays a
     tint in the dark theme too. Matches `#cj-topbar` in `conjunto.css`. */
  background: color-mix(in srgb, var(--tblr-primary) 30%, var(--tblr-bg-surface));
}

/* `navbar-expand-md` stops the bar wrapping from `md` up, and on a tablet the
   account chrome at its end then lies beyond the window, unreachable. From
   `lg` up the bar keeps its single line, the fields in it shrinking instead. */
@media (max-width: 991.98px) {
  .conjunto-topbar > .container-fluid {
    flex-wrap: wrap;
  }
}

/* The outage marker hangs off the bar's right end, over whatever is below.
   Out of the row on purpose: a badge that appears in the flex row pushes the
   account chrome left, and it appears and goes as the connection does. */
.conjunto-live-offline {
  position: absolute;
  top: 100%;
  right: 0.75rem;
  margin-top: 0.25rem;
}

.conjunto-body {
  display: flex;
  flex: 1 1 auto;
  /* Without this the flex children refuse to shrink and the canvas scrolls the
     whole document instead of itself. */
  min-height: 0;
}

.conjunto-rail {
  flex: none;
  width: var(--conjunto-rail-width);
  /* A flex item defaults to min-width: auto, so its content would keep it wide
     no matter what `width` says — collapsing would leave the labels' width
     behind. */
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  /* The separator lives here rather than on a Tabler `border-end` utility:
     those carry !important, so it could not be removed when collapsing, and a
     stray 1px line would be left behind where the rail used to be. */
  border-right: 1px solid var(--tblr-border-color, #dee2e6);
  transition: width 150ms ease;
}

/* No transition while dragging — it would lag a frame behind the pointer. */
.conjunto-layout[data-resizing="true"] .conjunto-rail {
  transition: none;
}

/* The grab area beside the rail. Wider than it looks, because a 1px target
   is a bad target. */
.conjunto-rail-handle {
  flex: none;
  width: 5px;
  margin-left: -2px;
  cursor: col-resize;
  background: transparent;
  transition: background 120ms ease;
  touch-action: none;
}

.conjunto-rail-handle:hover,
.conjunto-layout[data-resizing="true"] .conjunto-rail-handle {
  background: var(--tblr-primary, #066fd1);
}

/* The screen and the command line under it. Everything to the left of this —
   the rail, the chart column — is a sibling of the *column*, not of the canvas,
   so those two run all the way down to the statusbar and the bar only spans the
   part of the window the work happens in. */
.conjunto-canvas-column {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  /* Both needed for the same reason as on `.conjunto-body`: without them the
     canvas refuses to shrink and scrolls the window instead of itself, and long
     content pushes the rail off-screen. */
  min-width: 0;
  min-height: 0;
}

.conjunto-canvas {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

/* A screen's heading row keeps its distance from the card or alert below —
   Tabler gives .page-header none outside its own page wrapper, so a header
   button sat flush on the card underneath. Same space as Frame's mb-3. */
.conjunto-canvas .page-header {
  margin-bottom: 1rem;
}

/* Frame's heading row (Tabler's .page-header is a column). It wraps where
   Bootstrap's row/col squeezed: the heading takes what is left, but never
   less than 16rem — below that the actions move onto a line of their own
   (right-aligned, as they stood) and wrap among themselves, instead of
   squeezing the title to a word per line. */
.conjunto-frame-header {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem 1rem;
}
.conjunto-frame-heading {
  flex: 1 1 16rem;
  min-width: 0;
}
.conjunto-frame-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-inline-start: auto;
}
/* --- modes ------------------------------------------------------------- */

.conjunto-layout[data-rail-mode="mini"] .conjunto-rail {
  width: var(--conjunto-rail-mini-width);
}

/* Icons only. The label keeps its place in the DOM for screen readers. */
.conjunto-layout[data-rail-mode="mini"] .conjunto-rail .nav-link-title {
  display: none;
}

.conjunto-layout[data-rail-mode="mini"] .conjunto-rail .nav-link {
  justify-content: center;
}

.conjunto-layout[data-rail-mode="collapsed"] .conjunto-rail {
  width: 0;
  border-right-width: 0;
}

/* Nothing to grab once it is gone; the topbar toggle brings it back. */
.conjunto-layout[data-rail-mode="collapsed"] .conjunto-rail-handle {
  display: none;
}

/* --- collapsible areas (`Rail collapsible`) ------------------------------ *
 *
 * A heading folds its entries in and out. In mini mode (only beside the
 * canvas, never in a narrow window's overlay) an area is its icon, with only
 * the current entry below it.
 */
.conjunto-rail .rail-heading-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  border: 0;
  background: none;
  text-align: start;
  cursor: pointer;
}

.conjunto-rail .rail-heading-toggle:hover {
  color: var(--tblr-body-color) !important;
}

.conjunto-rail .rail-area-icon .nav-link {
  width: 100%;
  border: 0;
  background: none;
}

.conjunto-rail .rail-area-icon,
.conjunto-rail .rail-folded {
  display: none;
}

@media (min-width: 992px) {
  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .rail-heading,
  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .rail-grouped {
    display: none;
  }

  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .rail-area-icon,
  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .rail-grouped.rail-current {
    display: revert;
  }

  /* The area and its current entry are one tray: the entry sits inside it,
     sunk in and smaller, so it reads as the area's child, not its sibling. */
  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .rail-holds-current,
  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .rail-grouped.rail-current {
    background: rgba(var(--tblr-body-color-rgb), 0.06);
  }

  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .rail-holds-current {
    border-radius: var(--tblr-border-radius) var(--tblr-border-radius) 0 0;
  }

  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .rail-grouped.rail-current {
    /* Close the list's gap: tray and entry are one piece. */
    margin-top: -0.25rem;
    padding: 0 0.25rem 0.25rem;
    border-radius: 0 0 var(--tblr-border-radius) var(--tblr-border-radius);
  }

  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .rail-grouped.rail-current .nav-link {
    min-height: 2rem;
    background: var(--tblr-bg-surface);
    box-shadow: inset 0 0 0 1px var(--tblr-border-color);
  }

  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .rail-grouped.rail-current .nav-link-icon {
    font-size: 1.125rem;
  }
}

/* --- narrow windows ----------------------------------------------------- *
 *
 * Below `lg` a rail beside the canvas would leave the screen a sliver, so it
 * lies over the canvas instead, hidden until the topbar toggle opens it
 * (`railOpen` in `sidebar.js`). The mode is ignored here, as on the
 * server-rendered pages (`conjunto.css`): open, the rail always shows its
 * labels, and it has no width to drag.
 */
@media (max-width: 991.98px) {
  .conjunto-body {
    position: relative;
  }

  .conjunto-layout .conjunto-rail,
  .conjunto-layout[data-rail-mode] .conjunto-rail {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    width: 15rem;
    max-width: 85%;
    border-right-width: 1px;
    background: var(--tblr-bg-surface, #fff);
    transform: translateX(-100%);
    /* Out of the tab order and the accessibility tree while closed. */
    visibility: hidden;
    transition:
      transform 150ms ease,
      visibility 150ms;
  }

  /* A screen's own z-indices (Tabler's input icons wear 5) stay inside the
     canvas instead of showing through the open rail. */
  .conjunto-canvas {
    isolation: isolate;
  }

  .conjunto-layout[data-rail-open="true"] .conjunto-rail {
    transform: none;
    visibility: visible;
    box-shadow: 0 0 1rem rgba(0, 0, 0, 0.15);
  }

  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .nav-link-title {
    display: revert;
  }

  .conjunto-layout[data-rail-mode="mini"] .conjunto-rail .nav-link {
    justify-content: flex-start;
  }

  .conjunto-rail-handle {
    display: none;
  }
}

/* The open overlay's backdrop: a click on it closes the rail. Dimmed, never
   blurred — the screen underneath stays readable. */
.conjunto-rail-backdrop {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgba(0, 0, 0, 0.2);
}

@media (min-width: 992px) {
  .conjunto-rail-backdrop {
    display: none;
  }
}

/* While dragging, the pointer owns the cursor — otherwise it flickers to a
   text caret whenever it crosses a label. */
.conjunto-layout[data-resizing="true"] {
  cursor: col-resize;
  user-select: none;
}

/* --- hit targets ------------------------------------------------------- *
 *
 * Tabler sizes its icon variants from the text scale, which leaves both the
 * rail glyphs and the icon-only buttons noticeably smaller than the same
 * controls on the server-rendered pages. These two blocks bring the SPA back
 * in line with what `conjunto.css` already does there, so somebody moving
 * between the two surfaces aims at the same things.
 */

/* The rail is navigated all day and often at a glance, so the glyph is the
   label as much as the text is. Matches the server-rendered rail rather than
   Tabler's default 1rem. */
.conjunto-rail .nav-link-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.conjunto-rail .nav-link {
  min-height: 2.5rem;
}

/* In mini mode the glyph is the *only* thing left, and the rail is 56px wide
   with room to spare. Same 1.5rem the server-rendered rail uses. */
.conjunto-layout[data-rail-mode="mini"] .conjunto-rail .nav-link-icon {
  margin-right: 0;
  width: auto;
  font-size: 1.5rem;
  justify-content: center;
}

/* A narrow window's overlay always shows the labels (see above), so mini's
   lone-glyph sizing gives way to an icon beside its label. */
@media (max-width: 991.98px) {
  .conjunto-layout[data-rail-mode] .conjunto-rail .nav-link-icon {
    margin-right: 0.5rem;
    width: 1.25rem;
    font-size: 1.25rem;
  }
}

/* Icon-only buttons — a row's pencil and bin, a card header's actions — are
   the entire affordance for editing and removing. Tabler's `btn-sm` drops
   them to a 0.75rem glyph in a ~24px box, which is below what WCAG 2.5.8 asks
   for and awkward to hit with a trackpad. Scoped to the canvas so the
   topbar's own icon buttons, which are already full size, are left alone. */
.conjunto-canvas .btn.btn-icon.btn-sm {
  --tblr-btn-font-size: 1rem;
  --tblr-btn-padding-y: 0.375rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
}

/* A finger is not a pointer: on touch the same buttons get the 44px target
   that stops them from being a lottery. */
@media (pointer: coarse) {
  .conjunto-canvas .btn.btn-icon.btn-sm {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }
}
/* The screen behind a dialog stays readable.
 *
 * A dialog here is nearly always a question *about* what is underneath it —
 * which entry is being corrected, which problem the note files under — and
 * blurring that away asks the practitioner to remember the answer instead of
 * reading it. Tabler ships `.modal-blur` for the opposite taste and around
 * twenty dialogs across the plugins carry the class, so the decision is made
 * once here rather than swept through five repositories: `!important` beats
 * Tabler at equal specificity, which is what that rule is for.
 *
 * Do not reintroduce the blur per dialog: a dialog does not hide the screen
 * it asks about. */
.modal-blur {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* The marked row of a list does not shift its text.
 *
 * Tabler marks `.list-group-item.active` with a 2px start border and pulls it
 * back by a 1px negative margin, so the row's content lands one pixel to the
 * right of every other row's — and jumps as the mark walks a hit list. Every
 * row carries the 2px border from the start, transparent, and the active one
 * only changes its colour — Tabler's own `.active` colour still applies, so
 * only the width is forced. `!important` beats Tabler's `.list-group-item`
 * rules at equal specificity, which is what it is for. */
.list-group-item {
  border-inline-start-width: 2px !important;
  border-inline-start-color: transparent;
}

.list-group-item.active {
  margin-inline-start: 0 !important;
}

/* A `Dropdown` inside an input group joins the group.
 *
 * The component wraps its trigger and menu in a `.dropdown` box; as a child of
 * `.input-group` that box would be the flex item, and the button inside it
 * would keep its own corners — a seam where the group is meant to be one
 * control. `display: contents` dissolves the box, so the button is the flex
 * item; the menu lives in the top layer and hangs off the button then. */
.input-group > .dropdown {
  display: contents;
}

/* Bootstrap joins the group's controls by their DOM position — a middle child
 * loses the corners on both sides and overlaps the border of the one before
 * it. The button inside the dissolved box is not a child, so the same three
 * rules are put on it here, by the box's own position. */
.input-group > .dropdown:not(:first-child) > .btn {
  margin-inline-start: calc(-1 * var(--tblr-border-width));
  border-start-start-radius: 0;
  border-end-start-radius: 0;
}

.input-group > .dropdown:not(:last-child) > .btn {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

/* Tabler sizes the icon addon for a default-size field; beside a -sm or -lg
 * field the icon sits off-centre. Stretch it to the field instead. */
.input-icon:has(> .form-control-sm, > .form-select-sm, > .form-control-lg, > .form-select-lg)
  > .input-icon-addon {
  height: auto;
}

/* Popovers carry the frame the browser gives every `[popover]` element: a 3px
 * solid border in the text colour. Tabler declares no `border` on
 * `.dropdown-menu`, so nothing overrides it and the menus look boxed in. The
 * date popup is no `.dropdown-menu`, so the dropdown variables do not resolve
 * there; it takes the values they stand for. */
.dropdown-menu[popover] {
  border: var(--tblr-dropdown-border-width) solid var(--tblr-dropdown-border-color);
}

.date-input-popup[popover] {
  border: var(--tblr-border-width) solid var(--tblr-border-color-translucent);
}

/* And a click beside it closes it.
 *
 * Every dialog already puts `onclick={close}` on its `.modal-backdrop`, and
 * not one of those handlers had ever fired: `.modal` is a full-screen element
 * lying *over* the backdrop, so the click hit that instead and nothing
 * happened. Bootstrap sets `pointer-events: none` on `.modal-dialog` and
 * `auto` back on `.modal-content` for exactly this reason but stops one level
 * short; this is that level. The empty area now lets the click through to the
 * backdrop underneath, where the handler is.
 *
 * The cost is that a wheel over the *gap* no longer scrolls a tall dialog —
 * over its content it still does, which is where the pointer is when there is
 * anything to scroll. */
.modal {
  pointer-events: none;
}
/* --- reorderable lists (`sortable`) ------------------------------------- *
 *
 * The helper marks the list with `data-sortable` and, while a row is
 * carried, the body with `conjunto-sortable-dragging`; the row's copy under the
 * pointer is `.conjunto-sortable-mirror`, the row it left behind
 * `.conjunto-sortable-placeholder`. Everything visual about a drag is here, so
 * a table in one plugin and a list in another look the same while dragged. */

/* The grip. `touch-action: none` is what lets a finger drag from it instead
   of scrolling the page — the browser would otherwise take the gesture for a
   pan and cancel the pointer. */
[data-sortable] [data-grip],
[data-drag-grip] [data-grip] {
  cursor: grab;
  touch-action: none;
}

/* The pointer owns the cursor for the whole drag, whatever it crosses —
   otherwise it flickers between grab, text and arrow along the way. */
body.conjunto-sortable-dragging,
body.conjunto-sortable-dragging * {
  cursor: grabbing !important;
  user-select: none;
}

/* Rides under the pointer, moved with a transform; never a hit target itself,
   so the rows underneath still answer where the pointer is.

   `!important` on the box: the mirror is a clone of the card and keeps its
   classes, so a component's own scoped rule for the card — `position:
   relative`, an indent — outranks this one class. A card with
   `position: relative` let its clone fall to the end of the body, out of
   sight, instead of riding under the pointer. */
.conjunto-sortable-mirror {
  position: fixed !important;
  z-index: 1090;
  margin: 0 !important;
  pointer-events: none;
  background: var(--tblr-bg-surface, #fff);
  box-shadow: var(--tblr-box-shadow-dropdown, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
  will-change: transform;
}

/* The cells are pinned to the widths they had in the list; a fixed layout is
   what makes the table honour them. */
table.conjunto-sortable-mirror {
  table-layout: fixed;
}

/* The gap the row will drop into, drawn where the row was. */
.conjunto-sortable-placeholder {
  opacity: 0.4;
  outline: 2px dashed var(--tblr-border-color-active, #adb5bd);
  outline-offset: -2px;
}

/* --- carrying cards between containers (`dragdrop`) ---------------------- *
 *
 * Shares the mirror, the placeholder and the dragging cursor with `sortable`
 * above; its own part is the zone the pointer is over. */
[data-dragdrop] [data-drop].conjunto-drop-target {
  outline: 2px solid var(--tblr-primary, #206bc4);
  outline-offset: 2px;
  border-radius: var(--tblr-border-radius, 4px);
}

/* With `slots`: the line between two cards where the carried one would land,
   drawn into the gap above or below its neighbour. */
[data-dragdrop] .conjunto-drop-before {
  box-shadow: 0 -4px 0 -1px var(--tblr-primary, #206bc4);
}
[data-dragdrop] .conjunto-drop-after {
  box-shadow: 0 4px 0 -1px var(--tblr-primary, #206bc4);
}

/* --- toasts (`toast()` / `Toasts`) ------------------------------------- *
 *
 * The lower right corner of the canvas: over the screen, and above a host's
 * command line and statusbar rather than on them. The corner is an empty
 * marker; the stack itself is a `popover` in the top layer, pinned to the
 * marker by `Toasts.svelte` — above an open `Modal` too, whose backdrop would
 * otherwise swallow the click on an Undo raised from inside the dialog. */
.conjunto-toasts-corner {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: 0;
  height: 0;
  pointer-events: none;
}

.conjunto-toasts[popover] {
  /* The UA places a popover in the middle of the window with a border and a
     canvas background; the stack is placed by `right`/`bottom` and draws
     nothing of its own. */
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.conjunto-toasts .toast {
  /* Tabler draws `.toast` and its `bg-*-lt` tints translucent; the message
     must be legible over whatever card it happens to land on. So the level's
     tint is mixed into the surface instead of into transparency — the same
     colour as `bg-*-lt` on a plain page, but opaque. */
  --tblr-toast-bg: color-mix(
    in oklab,
    var(--conjunto-toast-tint, transparent) 10%,
    var(--tblr-bg-surface, #fff)
  );
  opacity: 1;
}

/* The toast is narrow and the message takes the room; the buttons keep
   their size instead of being squeezed under their own label. */
.conjunto-toasts .toast .btn,
.conjunto-toasts .toast .btn-close {
  flex: 0 0 auto;
}

/* ── Shortcut zones ──────────────────────────────────────────────────
   A zone owns `↑ ↓ ↵ Entf` while it is the one being worked in — see
   `shortcuts.js`. Which one that is has to be visible, because the caret is
   usually somewhere else entirely (the command line) and "where would Enter
   land" is otherwise a question only the user's memory answers.

   A thin frame, drawn just outside the box so nothing inside reflows when it
   appears. Not a focus ring: the zone is not focused, and painting it like a
   focused element would say the caret is there. */
[data-shortcut-zone][data-active] {
  outline: 1px solid var(--tblr-border-color-active, #a8aeb7);
  outline-offset: 2px;
  border-radius: var(--tblr-border-radius, 4px);
}

/* A card already has a frame of its own; a second one 2px outside it reads as
   a doubled border. The card's own edge takes the colour instead. */
[data-shortcut-zone][data-active].card {
  outline: none;
  border-color: var(--tblr-border-color-active, #a8aeb7);
  border-radius: var(--tblr-card-border-radius);
}

@media (prefers-reduced-motion: no-preference) {
  [data-shortcut-zone] {
    transition:
      outline-color 120ms ease-out,
      border-color 120ms ease-out;
  }
}

/* A declared shortcut pressed while a dialog is open is not carried out: it
 * means something on the screen behind. The dialog shakes once instead, so
 * the key does not read as dead (`refuse` in `shortcuts.js`). Without motion
 * there is nothing to show — the key simply does nothing. */
@media (prefers-reduced-motion: no-preference) {
  .conjunto-refused {
    animation: conjunto-refused 280ms ease-in-out;
  }
}

@keyframes conjunto-refused {
  0%,
  100% {
    translate: 0;
  }
  20%,
  60% {
    translate: -6px;
  }
  40%,
  80% {
    translate: 6px;
  }
}

/* --- the settings screen ------------------------------------------------- *
 *
 * `SettingsPage`: the rail and the content scroll apart, each within the
 * height the canvas hands down. Below `lg` the columns stack, and the row as
 * a whole scrolls instead. From `lg` up the rail is as wide as
 * `--conjunto-configuration-rail-width` says, dragged by the handle in the
 * gutter (`configurationRail.js`). */
.conjunto-canvas:has(.conjunto-configuration) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Every element between the canvas and the row hands the height down — not
   only `.container-fluid`: a screen mounted into a slot (`SettingsPage`) sits
   inside the slot's element and the component's own root. */
.conjunto-canvas :has(.conjunto-configuration) {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.conjunto-configuration {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.conjunto-configuration > .conjunto-configuration-handle {
  display: none;
}

@media (min-width: 992px) {
  .conjunto-configuration {
    overflow-y: visible;
  }

  .conjunto-configuration > .conjunto-configuration-rail,
  .conjunto-configuration > .conjunto-configuration-content {
    max-height: 100%;
    overflow-y: auto;
  }

  /* overflow-y: auto turns overflow-x to auto as well, and Tabler's
     .list-group-transparent reaches 20px past its column on both sides (so
     its hover fills the gutter) — which then shows as a sideways scrollbar. */
  .conjunto-configuration > .conjunto-configuration-rail {
    overflow-x: hidden;
    flex: 0 0 auto;
    width: var(--conjunto-configuration-rail-width, 20%);
  }

  .conjunto-configuration > .conjunto-configuration-content {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }

  /* In the middle of the gutter, taking none of its width: the negative
     margins give back what the handle occupies. Lifted above the content
     column, whose padding would otherwise swallow the pointer. */
  .conjunto-configuration > .conjunto-configuration-handle {
    position: relative;
    z-index: 1;
    display: block;
    flex: none;
    width: 6px;
    margin-inline: -3px;
    padding: 0;
    cursor: col-resize;
    background: transparent;
    transition: background 120ms ease;
    touch-action: none;
  }

  .conjunto-configuration > .conjunto-configuration-handle:hover,
  .conjunto-configuration[data-resizing="true"] > .conjunto-configuration-handle {
    background: var(--tblr-primary, #066fd1);
  }

  /* While dragging, the pointer owns the cursor — as on the main rail. */
  .conjunto-configuration[data-resizing="true"] {
    cursor: col-resize;
    user-select: none;
  }
}

/* The category list folded into one button on a narrow window
   (`ConfigurationMenu.svelte`): stacked above the content, an unfolded list
   would push the open page out of sight. Beside the content there is no
   button and the list is always shown. */
.conjunto-configuration-menu-toggle::after {
  margin-left: auto;
}

@media (max-width: 991.98px) {
  /* Stacked, the row wraps into two lines; stretched, they would share the
     row's height and leave a gap under the folded list on a short page. */
  .conjunto-configuration {
    align-content: flex-start;
  }

  /* Nothing stands side by side to keep apart, and `g-4`'s negative margins
     reach past the canvas gutter — a few pixels of sideways scroll. */
  .conjunto-configuration.row {
    --tblr-gutter-x: 0;
  }

  .conjunto-configuration-menu:not([data-open="true"]) > .conjunto-configuration-menu-list {
    display: none;
  }

  .conjunto-configuration-menu-list {
    margin-top: 0.5rem;
  }
}

@media (min-width: 992px) {
  .conjunto-configuration-menu-toggle {
    display: none;
  }
}

/* --- the busy indicator -------------------------------------------------- *
 *
 * `busy.js` sets `data-conjunto-busy` on the document root while a request
 * has been running for more than two seconds. Whatever wears
 * `.conjunto-busy-indicator` turns until it is gone — a host's brand, or a
 * spinner of its own. Without motion it pulses instead of turning. */
@keyframes conjunto-busy-turn {
  to {
    transform: rotate(360deg);
  }
}

@keyframes conjunto-busy-pulse {
  50% {
    opacity: 0.3;
  }
}

.conjunto-busy-indicator {
  display: inline-block;
}

[data-conjunto-busy] .conjunto-busy-indicator {
  animation: conjunto-busy-turn 1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  [data-conjunto-busy] .conjunto-busy-indicator {
    animation: conjunto-busy-pulse 1.5s ease-in-out infinite;
  }
}

/* --- the column beside the canvas (`canvasLeft.js`) --------------------- *
 *
 * What `Shell`'s `left` snippet renders puts `.conjunto-canvas-left` on its
 * root. `.conjunto-body` is a bounded flex row, so the column is bounded for
 * free and only its own body scrolls. */
.conjunto-canvas-left {
  flex: 0 0 var(--conjunto-canvas-left-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--tblr-border-color, #dee2e6);
}

/* The grab area beside it — the rail handle's twin. Nothing to grab while
   nothing is there: `:has` on the body rather than an occupancy flag the host
   would have to remember to set. */
.conjunto-canvas-left-handle {
  display: none;
  flex: none;
  width: 5px;
  margin-left: -2px;
  cursor: col-resize;
  background: transparent;
  transition: background 120ms ease;
  touch-action: none;
}

.conjunto-body:has(.conjunto-canvas-left) .conjunto-canvas-left-handle {
  display: block;
}

.conjunto-canvas-left-handle:hover,
.conjunto-layout[data-canvas-left-resizing="true"] .conjunto-canvas-left-handle {
  background: var(--tblr-primary, #066fd1);
}

.conjunto-layout[data-canvas-left-resizing="true"] {
  cursor: col-resize;
  user-select: none;
}

/* No room for a column beside the canvas below `lg`. `!important` because it
   has to beat the `:has` rule above, which matches at the same specificity. */
@media (max-width: 991.98px) {
  .conjunto-canvas-left,
  .conjunto-canvas-left-handle {
    display: none !important;
  }
}

/* --- a screen that runs edge to edge ------------------------------------ *
 *
 * The canvas gives every screen a gutter (`container-fluid py-3` in `Shell`).
 * A screen whose content is the width — a table of its own — puts
 * `.conjunto-edge-to-edge` on its root, and the pixels the gutter took go to
 * the content. The screen then carries whatever inset its own header needs. */
.conjunto-canvas > .container-fluid:has(.conjunto-edge-to-edge) {
  /* `py-3` is a Bootstrap utility and carries `!important` itself. */
  padding: 0 !important;
}

/* --- a screen without the rail, the aside or the bottom dock ------------- *
 *
 * A screen that brings its own navigation puts `.conjunto-without-rail` on
 * its root; `.conjunto-without-aside` and `.conjunto-without-dock` do the same
 * for the column on the right and the dock at the bottom. The region is
 * hidden, not unmounted, and its stored state (mode, width) is never touched:
 * the next screen without the class shows it exactly as it was. The topbar
 * button toggling a hidden region goes with it, since it would toggle
 * something nobody can see. `!important` because the frame's own rules set
 * `display` on these elements at equal or higher specificity. */
.conjunto-layout:has(.conjunto-without-rail)
  :is(.conjunto-rail, .conjunto-rail-handle, .conjunto-rail-backdrop, .conjunto-rail-toggle),
.conjunto-layout:has(.conjunto-without-aside)
  :is(.conjunto-aside, .conjunto-aside-handle, .conjunto-aside-toggle),
.conjunto-layout:has(.conjunto-without-dock) .conjunto-dock[data-area="bottom"] {
  display: none !important;
}

/* --- a screen that fills the canvas -------------------------------------- *
 *
 * A screen whose content scrolls in a box of its own puts
 * `.conjunto-fill-canvas` on its root. The screen is then exactly as tall as
 * the canvas, never taller: the canvas itself does not scroll, so what stands
 * above the box stays on screen however much room the bottom dock takes from
 * below. The screen lays out its own column; the box that scrolls is its
 * business. */
.conjunto-canvas > .container-fluid:has(.conjunto-fill-canvas),
.conjunto-canvas > .container-fluid:has(.conjunto-fill-canvas) > [data-gdaps-slot],
.conjunto-canvas
  > .container-fluid:has(.conjunto-fill-canvas)
  > [data-gdaps-slot]
  > [data-gdaps-plugin] {
  height: 100%;
}

.conjunto-fill-canvas {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* --- the dock (`dock.js`, `Dock.svelte`) --------------------------------- *
 *
 * Forms and documents beside the screen, not over it. Three areas, one frame:
 * `bottom` is a row of the canvas stack under the screen, `right` a column of
 * the body after the canvas column, `sidebar` an offcanvas over the stack's
 * right edge. An area with no tabs is `hidden` and leaves no box behind.
 */

/* The screen with the bottom dock under it and the sidebar over it. Relative
   so the sidebar can anchor to its edges; a bounded flex column for the same
   reason `.conjunto-canvas-column` is one. */
.conjunto-canvas-stack {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* The right dock anchors to the body when it becomes an offcanvas below `lg`
   — without this it would anchor to the window and lie over the topbar. */
.conjunto-body {
  position: relative;
}

.conjunto-dock {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--tblr-bg-surface, #fff);
}

/* `hidden` has to beat `display: flex` above. */
.conjunto-dock[hidden] {
  display: none;
}

.conjunto-dock[data-area="bottom"] {
  flex: none;
  height: var(--conjunto-dock-bottom-height);
  border-top: 1px solid var(--tblr-border-color, #dee2e6);
}

/* A `fit` tab: as tall as its content, the stored height the most it takes. */
.conjunto-dock[data-area="bottom"][data-fit="true"] {
  height: auto;
  max-height: var(--conjunto-dock-bottom-height);
}

.conjunto-dock[data-area="right"] {
  flex: 0 0 var(--conjunto-dock-right-width);
  border-left: 1px solid var(--tblr-border-color, #dee2e6);
}

.conjunto-dock[data-area="sidebar"] {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--conjunto-dock-sidebar-width);
  max-width: 100%;
  z-index: 3;
  border-left: 1px solid var(--tblr-border-color, #dee2e6);
  box-shadow: var(--tblr-shadow-lg, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
  transition: transform 150ms ease;
}

/* Hidden is the sidebar's minimised: off-screen, content alive. The stack's
   parent clips it, so nothing scrolls. */
.conjunto-dock[data-area="sidebar"][data-minimised="true"] {
  transform: translateX(100%);
  box-shadow: none;
}

/* Minimised, the bottom and right docks are their strip and nothing else: a
   row along the bottom, a narrow column on the right. */
.conjunto-dock[data-minimised="true"] .conjunto-dock-body {
  display: none;
}

.conjunto-dock[data-area="bottom"][data-minimised="true"] {
  height: auto;
}

.conjunto-dock[data-area="right"][data-minimised="true"] {
  flex-basis: 2.25rem;
}

.conjunto-dock[data-area="right"][data-minimised="true"] .conjunto-dock-strip {
  flex-direction: column;
  writing-mode: vertical-rl;
}

.conjunto-dock[data-area="right"][data-minimised="true"] .conjunto-dock-tabs {
  flex-direction: column;
  border-bottom: 0;
}

.conjunto-dock[data-area="right"][data-minimised="true"] .conjunto-dock-toggle {
  writing-mode: horizontal-tb;
}

/* The strip: tabs on the left, the minimise button on the right. */
.conjunto-dock-strip {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem 0;
  border-bottom: 1px solid var(--tblr-border-color, #dee2e6);
}

.conjunto-dock-tabs {
  flex: 1 1 auto;
  min-width: 0;
  border-bottom: 0;
  margin-bottom: -1px;
}

.conjunto-dock-tabs .nav-link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.5rem;
}

/* Two buttons inside a `.nav-link`, so neither carries a button's chrome. */
.conjunto-dock-title {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  white-space: nowrap;
}

.conjunto-dock-close {
  font-size: 0.625rem;
}

.conjunto-dock-toggle {
  margin-bottom: 0.25rem;
}

.conjunto-dock-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.conjunto-dock-pane {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.conjunto-dock-pane[hidden] {
  display: none;
}

/* Tabs: selection beats belonging. Which tab is open is what a tab bar has to
   say first, so only the active tab wears a surface — bold, joined to its pane,
   a bar over it in its plugin's colour (`data-accent`, see accents.js) or the
   primary one. An inactive tab of a plugin with a colour keeps nothing but the
   icon's colour (`conjunto-accent-icon`); a tinted inactive tab outshone the
   open one beside it. */
.nav-tabs .nav-link[data-accent]:not(.active) {
  background-color: transparent;
  box-shadow: none;
}

.nav-tabs .nav-link.active {
  font-weight: 600;
  box-shadow: inset 0 3px 0 var(--conjunto-accent, var(--tblr-primary));
}

/* The element the store hands to the content, adopted into the pane. Fills it,
   so an `<iframe>` inside can be told to take the whole tab. */
.conjunto-dock-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

/* The grab edge — top of the bottom dock, left of the other two. Absolute, so
   it takes nothing out of the frame's layout. */
.conjunto-dock-handle {
  position: absolute;
  z-index: 1;
  background: transparent;
  transition: background 120ms ease;
  touch-action: none;
}

.conjunto-dock[data-area="bottom"] .conjunto-dock-handle {
  top: -2px;
  left: 0;
  right: 0;
  height: 5px;
  cursor: row-resize;
}

.conjunto-dock[data-area="right"] .conjunto-dock-handle,
.conjunto-dock[data-area="sidebar"] .conjunto-dock-handle {
  top: 0;
  bottom: 0;
  left: -2px;
  width: 5px;
  cursor: col-resize;
}

.conjunto-dock[data-minimised="true"] .conjunto-dock-handle {
  display: none;
}

.conjunto-dock-handle:hover,
.conjunto-layout[data-dock-resizing="bottom"] .conjunto-dock[data-area="bottom"] .conjunto-dock-handle,
.conjunto-layout[data-dock-resizing="right"] .conjunto-dock[data-area="right"] .conjunto-dock-handle,
.conjunto-layout[data-dock-resizing="sidebar"] .conjunto-dock[data-area="sidebar"] .conjunto-dock-handle {
  background: var(--tblr-primary, #066fd1);
}

.conjunto-layout[data-dock-resizing="bottom"] {
  cursor: row-resize;
  user-select: none;
}

.conjunto-layout[data-dock-resizing="right"],
.conjunto-layout[data-dock-resizing="sidebar"] {
  cursor: col-resize;
  user-select: none;
}

/* Narrow windows: the dock lies over the screen instead of taking room from
   it — below `lg` the right dock becomes an offcanvas like the sidebar, below
   `md` the bottom dock does too, anchored to the bottom. No handles. */
@media (max-width: 991.98px) {
  .conjunto-dock[data-area="right"] {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--conjunto-dock-right-width);
    max-width: 100%;
    z-index: 3;
    box-shadow: var(--tblr-shadow-lg, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
  }

  .conjunto-dock[data-area="right"][data-minimised="true"] {
    width: 2.25rem;
    box-shadow: none;
  }

  .conjunto-dock[data-area="right"] .conjunto-dock-handle,
  .conjunto-dock[data-area="sidebar"] .conjunto-dock-handle {
    display: none;
  }
}

@media (max-width: 767.98px) {
  .conjunto-dock[data-area="bottom"] {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 100%;
    z-index: 3;
    box-shadow: var(--tblr-shadow-lg, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
  }

  .conjunto-dock[data-area="bottom"] .conjunto-dock-handle {
    display: none;
  }
}

/* --- the aside (`aside.js`) ---------------------------------------------- *
 *
 * The right-hand helper column, mirror image of the rail: what `Shell`'s
 * `aside` snippet renders, always on screen in one of two modes. `full` shows
 * it at a draggable width, `mini` is the rail's 56px icon column — and the
 * snippet decides what it renders in each (it gets the mode), nothing here
 * hides content away. `Shell` sets `data-aside-mode` from
 * `effectiveAsideMode`, which is `mini` while the right dock is open.
 */

.conjunto-aside {
  flex: none;
  width: var(--conjunto-aside-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  overflow-x: hidden;
  overflow-y: auto;
  border-left: 1px solid var(--tblr-border-color, #dee2e6);
  transition: width 150ms ease;
}

.conjunto-layout[data-aside-mode="mini"] .conjunto-aside {
  width: var(--conjunto-rail-mini-width);
  padding: 0.5rem 0;
  align-items: center;
}

/* No transition while dragging — it would lag a frame behind the pointer. */
.conjunto-layout[data-aside-resizing="true"] .conjunto-aside {
  transition: none;
}

/* The grab area on the aside's left edge — the rail handle's mirror. It
   precedes the column in the DOM, so unlike the rail's it would be painted
   under its neighbour's overlapped edge; lifted, so the whole 5px are hit. */
.conjunto-aside-handle {
  position: relative;
  z-index: 1;
  flex: none;
  width: 5px;
  margin-right: -2px;
  cursor: col-resize;
  background: transparent;
  transition: background 120ms ease;
  touch-action: none;
}

.conjunto-aside-handle:hover,
.conjunto-layout[data-aside-resizing="true"] .conjunto-aside-handle {
  background: var(--tblr-primary, #066fd1);
}

.conjunto-layout[data-aside-resizing="true"] {
  cursor: col-resize;
  user-select: none;
}

/* Nothing to grab while the column is the fixed icon strip; a drag out of
   mini starts from the topbar toggle. */
.conjunto-layout[data-aside-mode="mini"] .conjunto-aside-handle {
  display: none;
}

/* The shared mini form of a widget: an icon button with a count in its
   corner. `btn btn-ghost-secondary btn-icon` on the element itself; this only
   places the badge. */
.conjunto-aside-mini {
  position: relative;
  flex: none;
}

.conjunto-aside-mini .ti {
  font-size: 1.5rem;
}

.conjunto-aside-mini .badge {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  padding: 0.125rem 0.3rem;
  font-size: 0.625rem;
}

.conjunto-aside-mini--urgent .badge {
  background: var(--tblr-danger) !important; /* over Tabler's bg-* utility */
  color: #fff;
}

/* Below `lg` there is no room for a third column; the content stays mounted
   for when there is. */
@media (max-width: 991.98px) {
  .conjunto-aside,
  .conjunto-aside-handle {
    display: none !important;
  }
}


/* ------------------------------------------------------------------ accents
   A plugin's colour, worn by whatever sits inside its `data-accent` (rules in
   accents.js). Each utility falls back to the plain look where the plugin
   declares no colour, so `data-accent` may be set unconditionally. */

/* An icon (or a short text) in the plugin's colour. */
.conjunto-accent-icon {
  color: var(--conjunto-accent-fg, inherit);
}

/* The left edge of a form or a pane: what it belongs to, at a glance. Inset so
   it takes no room and fights no border. */
.conjunto-accent-stripe {
  box-shadow: inset 4px 0 0 var(--conjunto-accent, transparent);
}

/* A frame around things that belong together — the lines of one document, say.
   The border in the plugin's colour; `--tinted` adds the faint tint behind, for
   a group that is set apart from its kind by one of its marks, never by a
   colour of its own. The frame wears the stripe as its own left edge, so the
   lines inside drop theirs; the rest of the border is faded so it groups the
   lines without outshouting that edge. */
.conjunto-accent-frame {
  border: 1px solid color-mix(in srgb, var(--conjunto-accent, var(--tblr-border-color)) 55%, transparent);
  border-left: 4px solid var(--conjunto-accent, var(--tblr-border-color));
  border-radius: var(--tblr-border-radius, 4px);
}

.conjunto-accent-frame--tinted {
  background-color: var(--conjunto-accent-lt, transparent);
}

/* A header row in the faint tint. */
.conjunto-accent-header {
  background-color: var(--conjunto-accent-lt, transparent);
}

/* A badge: the tint behind, the colour in front. */
.conjunto-accent-badge {
  background-color: var(--conjunto-accent-lt, var(--tblr-secondary-lt));
  color: var(--conjunto-accent-fg, inherit);
}


/* ------------------------------------------------------------------ severity
   The only tinted boxes that say "attention": a banner or an overlay that
   blocks or warns — a screen that cannot work yet, a failed action. Clearly
   coloured (a border in the colour, a strong tint behind), so it is not read
   as one more card. Never on a row of a list: a row says what it is, not how
   alarmed to be about it. The tint is one token, light and dark. */
:root {
  --conjunto-severity-tint: 18%;
}

[data-bs-theme="dark"] {
  --conjunto-severity-tint: 28%;
}

.conjunto-surface-danger { --conjunto-severity: var(--tblr-danger, #d63939); }
.conjunto-surface-warning { --conjunto-severity: var(--tblr-warning, #f76707); }
.conjunto-surface-info { --conjunto-severity: var(--tblr-info, #4299e1); }
.conjunto-surface-success { --conjunto-severity: var(--tblr-success, #2fb344); }

.conjunto-surface-danger,
.conjunto-surface-warning,
.conjunto-surface-info,
.conjunto-surface-success {
  border: 1px solid var(--conjunto-severity);
  color: var(--tblr-body-color);
  background-color: color-mix(
    in srgb, var(--conjunto-severity) var(--conjunto-severity-tint), var(--tblr-bg-surface, #fff)
  );
}

/* The surface's first line; the markup puts the icon in front of it. */
.conjunto-surface-title {
  font-weight: 600;
}

/* ------------------------------------------------------------------ levels
   The level a setting is stored at — conjunto's `Scope`: 1 System (vendor),
   2 Tenant, 3 Group, 4 Device, 5 User (levels.js). THE one place the five
   colours are written: a card header, a level badge and a cog only ever say
   `data-level="<1..5>"` and read them through the utilities below. Pastels
   mixed into the surface, so they follow the theme; `-fg` is the colour for
   an icon or the badge's text. */
:root {
  --conjunto-level-1: var(--tblr-gray-500, #6b7280);
  --conjunto-level-2: var(--tblr-green, #2fb344);
  --conjunto-level-3: var(--tblr-purple, #ae3ec9);
  --conjunto-level-4: var(--tblr-orange, #f76707);
  --conjunto-level-5: var(--tblr-blue, #066fd1);
  --conjunto-level-tint: 16%;
  --conjunto-level-surface: var(--tblr-bg-surface, #fff);
}

[data-bs-theme="dark"] {
  --conjunto-level-tint: 26%;
  --conjunto-level-surface: var(--tblr-bg-surface, #1b2434);
}

[data-level="1"] { --conjunto-level: var(--conjunto-level-1); }
[data-level="2"] { --conjunto-level: var(--conjunto-level-2); }
[data-level="3"] { --conjunto-level: var(--conjunto-level-3); }
[data-level="4"] { --conjunto-level: var(--conjunto-level-4); }
[data-level="5"] { --conjunto-level: var(--conjunto-level-5); }

/* A card holding settings of more than one level wears none of them. */
[data-level="none"] { --conjunto-level: initial; }

[data-level] {
  --conjunto-level-lt: color-mix(
    in srgb, var(--conjunto-level) var(--conjunto-level-tint), var(--conjunto-level-surface)
  );
  --conjunto-level-fg: var(--conjunto-level);
}

[data-bs-theme="dark"] [data-level] {
  --conjunto-level-fg: color-mix(in srgb, var(--conjunto-level) 60%, #fff);
}

/* Every card header on a configuration screen wears its page's level; a card
   that sets its own `data-level` (a device setting on the person's page)
   wins by being nearer. Dialogs portal to <body> and stay plain. */
.conjunto-configuration-content[data-level] .card > .card-header,
.card[data-level] > .card-header {
  background-color: var(--conjunto-level-lt, transparent);
}

/* The level's name beside a card title or a field label — a step stronger
   than the header it sits on, so it reads as a badge there too. */
.conjunto-level-badge {
  background-color: color-mix(
    in srgb, var(--conjunto-level) calc(var(--conjunto-level-tint) * 2.5), var(--conjunto-level-surface)
  );
  color: color-mix(in srgb, var(--conjunto-level) 70%, var(--tblr-body-color, #1d273b));
}

[data-bs-theme="dark"] .conjunto-level-badge {
  color: var(--conjunto-level-fg);
}

/* The same badge on every hand-drawn card header of a configuration screen;
   the name comes from levelNames.js, which only writes it where a level is
   known. A header already naming its level (`Card`, a `LevelBadge`) or
   holding tabs is left alone — the selector matches levelNames.js's. */
.conjunto-configuration-content .card > .card-header:not(:has(.conjunto-level-badge, .card-header-tabs))::after {
  margin-left: auto;
  padding: 0.25em 0.5em;
  border-radius: var(--tblr-border-radius, 4px);
  font-size: 0.75rem;
  font-weight: var(--tblr-font-weight-medium, 500);
  line-height: 1;
  white-space: nowrap;
  background-color: color-mix(
    in srgb, var(--conjunto-level) calc(var(--conjunto-level-tint) * 2.5), var(--conjunto-level-surface)
  );
  color: color-mix(in srgb, var(--conjunto-level) 70%, var(--tblr-body-color, #1d273b));
}

/* Beside the header's own actions, which already took the free space. */
.conjunto-configuration-content .card > .card-header:has(.card-actions, .ms-auto)::after {
  margin-left: 0.5rem;
}

/* Tabler pulls `.card-actions` into the header's end padding with a negative
   margin; with the level badge after them that margin swallows the gap, so
   actions keep their place and the badge takes the edge. */
.conjunto-configuration-content .card:not([data-level="none"]) > .card-header:not(:has(.conjunto-level-badge, .card-header-tabs)) > .card-actions {
  margin-inline-end: 0;
}

/* A header stacking a title row over a description (`d-block`): the badge
   sits at the right end of the title row, which makes room for it. */
.conjunto-configuration-content .card:not([data-level="none"]) > .card-header.d-block:not(:has(.conjunto-level-badge))::after {
  position: absolute;
  top: calc(var(--tblr-card-cap-padding-y, 1rem) + 0.25rem);
  right: var(--tblr-card-cap-padding-x, 1.25rem);
}

.conjunto-configuration-content .card:not([data-level="none"]) > .card-header.d-block:not(:has(.conjunto-level-badge)) {
  position: relative;
}

.conjunto-configuration-content .card:not([data-level="none"]) > .card-header.d-block:not(:has(.conjunto-level-badge)) > :first-child {
  padding-right: 6.5rem;
}

[data-bs-theme="dark"] .conjunto-configuration-content .card > .card-header::after {
  color: var(--conjunto-level-fg);
}
