/* =====================================================
   EntityShift ESTools - Dark Theme
   ===================================================== */

.wizard-journey {
  padding: 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.wizard-line {
  position: relative;
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-x: auto;
  /* One stop's width, which every stop shares (flex: 1 0 150px): the rail
     is measured in stops, so it lands on a stop's centre whether the line
     fits the card or scrolls inside it. */
  --wizard-stop: max(150px, 100% / var(--wizard-stops, 1));
}
/* The rail: how far the train has got, from the first stop's centre to
   --wizard-at stops along (wizardProgress). It is one element over the grey
   track, so a swap that moves --wizard-at is seen to travel, at an even
   pace, through every stop on the way - one passed without stopping too. */
.wizard-rail {
  position: absolute;
  z-index: 1;
  top: 25px;
  left: calc(var(--wizard-stop) / 2);
  width: calc(var(--wizard-stop) * var(--wizard-at, 0));
  height: 4px;
  background: var(--accent);
  pointer-events: none;
  transition: width 0.9s cubic-bezier(0.45, 0, 0.55, 1);
}
/* A page opened afresh draws the last leg of the way in, from the stop
   before, so arriving anywhere reads as having travelled there. */
@starting-style {
  .wizard-rail { width: calc(var(--wizard-stop) * max(0, var(--wizard-at, 0) - 1)); }
}
.wizard-stop {
  position: relative;
  flex: 1 0 150px;
  min-width: 0;
  color: var(--text-muted);
}
.wizard-stop::before {
  content: "";
  position: absolute;
  top: 25px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border);
}
.wizard-rail + .wizard-stop::before { left: 50%; }
.wizard-stop:last-child::before { right: 50%; }
.wizard-station, .btn.wizard-station {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: inherit;
  text-align: center;
  white-space: normal;
  font-size: 13px;
}
.btn.wizard-station:hover { background: var(--surface-hover); border-color: var(--border-hover); }
.wizard-dot {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 3px solid var(--border-hover);
  border-radius: 50%;
  background: var(--surface);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.wizard-stop.is-current { color: var(--text); }
.wizard-stop.is-current .wizard-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
  outline: 4px solid var(--accent-dim);
}
.wizard-stop[data-state="ok"] .wizard-dot { border-color: var(--accent); color: var(--accent); }
/* A page answered and behind the reader: a solid stop with a tick where its
   number was. */
.wizard-stop[data-state="ok"]:not(.is-current) .wizard-dot { background: var(--accent); color: var(--bg); }
.wizard-dot-tick { width: 20px; height: 20px; }
.wizard-stop[data-state="error"] .wizard-dot { border-color: var(--danger); color: var(--danger); }
/* A stop the train went through without stopping: greyed and dashed, with
   the rail running on behind it. */
.wizard-stop[data-state="skipped"] .wizard-dot { border-style: dashed; }
.wizard-stop.is-passed[data-state="skipped"] .wizard-dot { border-color: var(--accent-dim); }
.wizard-station-title { font-weight: 600; overflow-wrap: anywhere; }
.wizard-station-state { font-size: 12px; font-weight: 400; }
@media (max-width: 600px) {
  .wizard-line { flex-direction: column; }
  .wizard-stop { flex-basis: auto; }
  .wizard-station, .btn.wizard-station {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 12px;
    text-align: left;
    align-items: start;
  }
  .wizard-dot { grid-row: span 2; }
  /* Stacked, the stops are not one width, so the rail is drawn a stop at a
     time on the track itself instead. */
  .wizard-rail { display: none; }
  .wizard-stop::before,
  .wizard-rail + .wizard-stop::before,
  .wizard-stop:last-child::before { left: 27px; right: auto; width: 4px; top: 0; bottom: 0; height: auto; min-height: 4px; }
  .wizard-rail + .wizard-stop::before { top: 27px; }
  .wizard-stop:last-child::before { bottom: calc(100% - 27px); }
  .wizard-stop.is-passed::before { background: var(--accent); }
  .wizard-stop.is-current::before { background: linear-gradient(to bottom, var(--accent) 27px, var(--border) 27px); }
  .wizard-rail + .wizard-stop.is-current::before { background: var(--border); }
  .wizard-stop.is-current:last-child::before { background: var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .wizard-rail, .wizard-dot { transition: none; }
}
.wizard-instructions, .wizard-readonly { white-space: pre-wrap; overflow-wrap: anywhere; }
.wizard-readonly { display: block; padding: 10px 0; }
.wizard-detail { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 50vh; overflow: auto; }
/* A finish page's files to download, and the page kept as it was once Finish
   has been pressed: its values read-only and the state beside View results. */
.wizard-offered-files { margin: 16px 0; }
.wizard-offered-files h3 { margin: 0 0 8px; font-size: 15px; }
.wizard-file-icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.wizard-done-values { border: 0; padding: 0; margin: 0; min-width: 0; }
.wizard-done-actions { align-items: center; gap: 12px; }
.wizard-selection { margin: 20px 0; }
.wizard-selection h3 { margin-bottom: 4px; }
.wizard-selection input[type="checkbox"],
.wizard-selection input[type="radio"] { width: auto; }
.wizard-selection-control { width: 72px; text-align: center; }
/* A cell the person fills in: the box is the cell, and wide enough to read a
   company's name in. */
.wizard-cell-edit { min-width: 180px; }
.wizard-cell-edit .wizard-cell-box { width: 100%; min-width: 160px; margin: 0; }
.wizard-cell-edit .run-lookup { min-width: 240px; }
/* A Choice page's cards: each a button answering the page, its icon in a
   tinted square, its title and description, and a chevron saying it goes on.
   Two to a row where there is room, one under another on a phone. */
.wizard-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 20px 0 8px; }
.wizard-card {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; text-align: left;
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s;
}
.wizard-card:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-hover); }
.wizard-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wizard-card.is-chosen { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.wizard-card:disabled { cursor: default; opacity: .7; }
.wizard-card-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--accent-dim); color: var(--accent);
}
.wizard-card-glyph { width: 24px; height: 24px; }
.wizard-card-words { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.wizard-card-title { font-size: 15px; overflow-wrap: anywhere; }
.wizard-card-description { color: var(--text-muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.wizard-card-go { width: 20px; height: 20px; flex: none; color: var(--text-muted); }

/* A field chosen from a lookup (wizard_lookup.go): a search box with its
   matches under it, each chosen by its button, and once chosen the choice by
   its words with its code beside it and Change at the end of the line. */
/* The values a run or a wizard page asks for are one width, a field's and
   not the form's: a box the width of a wide card reads as a box for a
   paragraph, and boxes of different widths read as a form that is ragged.
   A value chosen from a lookup is drawn in a box of that width with Change
   at its right edge, so the Change buttons of every chosen value stand one
   above another whatever the words chosen. JSON keeps the whole width, since
   it is a document. */
.run-field { --run-field-width: 460px; }
.run-field > .form-input:not(textarea),
.run-field > .form-select,
.run-field > .form-label-check,
.run-lookup-search,
.run-lookup-chosen { max-width: var(--run-field-width); }
.run-lookup { display: grid; gap: 8px; }
.run-lookup-results:empty { display: none; }
.run-lookup-results .table-wrapper { max-height: 320px; overflow: auto; }
.data-table.run-lookup-table td { vertical-align: middle; }
.run-lookup-pick { white-space: nowrap; }
/* A chosen value and its Change button are one height, set by the row and
   not by what either holds, so the two read as one control: the box sized
   by its own padding and icon stood half again as tall as a small button. */
.run-lookup-chosen { display: flex; align-items: stretch; gap: 8px; width: 100%; height: 32px; box-sizing: border-box; }
.run-lookup-value {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.run-lookup-chosen-icon { width: 16px; height: 16px; color: var(--sev-ok-text); flex: none; }
.run-lookup-label { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-lookup-key { font-size: 12px; flex: none; }
.run-lookup-chosen > .btn { flex: none; padding-top: 0; padding-bottom: 0; }
.automate-wizard-page fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.automate-wizard-page .form-card { margin-bottom: 0; }
/* The wizard fills the window, whatever the page holds: the card under the
   line runs to the foot of the screen and its buttons sit at the card's
   foot, so going from one page to the next - or to Processing and back -
   moves nothing but what the pages say. Sized to its content, the card's
   height changed with every page and made each swap a visible jump. */
.tool-page.automate-wizard-page { min-height: 100%; display: flex; flex-direction: column; }
#wizard-body { flex: 1 0 auto; display: flex; flex-direction: column; }
#wizard-body > .form-card { flex: 1 0 auto; display: flex; flex-direction: column; }
#wizard-body > .form-card > .wizard-form { flex: 1 0 auto; display: flex; flex-direction: column; }
#wizard-body > .form-card > .form-actions,
#wizard-body > .form-card > .wizard-form > .form-actions { margin-top: auto; padding-top: 16px; }
/* The process working between two pages: a sweep that says something is
   happening, centred in the room the page will take. */
.wizard-processing {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  min-height: 160px;
}
.wizard-processing h2, .wizard-processing p { margin: 0; }
.wizard-processing-bar {
  display: block;
  width: 160px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 8px;
}
.wizard-processing-bar > span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: htmx-sweep 1.15s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .wizard-processing-bar > span { animation: none; width: 100%; }
}
/* A lookup reads in the background: a spinner beside the box while it does,
   and nothing over the page. */
.run-lookup-box { display: flex; align-items: center; gap: 8px; max-width: calc(var(--run-field-width) + 24px); }
.run-lookup-box > .run-lookup-search { flex: 1; min-width: 0; }
.run-lookup-busy { visibility: hidden; }
.run-lookup-busy.htmx-request { visibility: visible; }
.run-lookup-chosen > .run-lookup-busy { align-self: center; }
/* Configure page sits at the top of the settings panel, the width of the
   fields under it and on their edges: the panel's own padding is the only
   inset, where a padding of its own put the button 16px in from both and
   16px further down, matching nothing below it. The bottom room is the
   gap to the step's heading, whose negative top margin (it is sticky to
   the panel's edges) would otherwise pull it up against the button. */
.automate-wizard-launch { padding: 0 0 calc(var(--space-4) + var(--space-3)); }
.automate-wizard-launch > .btn { width: 100%; justify-content: center; }
.automate-wizard-launch .automate-unsaved { margin-top: 12px; }
dialog.modal.automate-wizard-editor { width: min(1200px, calc(100vw - 32px)); }
.automate-wizard-editor[open] .modal-body { max-height: calc(100dvh - 180px); min-height: 0; }
.wizard-editor-preview { padding: 16px; background: var(--surface-alt); border: 1px solid var(--border-hover); border-radius: var(--radius); }
.wizard-editor-preview h3, .wizard-editor-settings > h3 { margin: 0 0 8px; }
#wizard-preview { max-height: 28vh; overflow: auto; margin-top: 16px; }
.wizard-editor-settings { margin-top: 24px; padding-top: 20px; border-top: 2px solid var(--border); }
.automate-wizard-editor[open] .automate-inspector-form { max-height: none; overflow: visible; }
.automate-wizard-editor[open] .automate-inspector-head { top: 0; margin: 16px 0 12px; }
.automate-wizard-editor[open] .automate-inspector-actions { position: static; margin: 16px 0 0; }
/* One settings form, in the panel until showModal puts it in the top layer. */
dialog.modal.automate-wizard-editor:not([open]) {
  display: block;
  position: static;
  width: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: inherit;
}
.automate-wizard-editor:not([open]) > .modal-head,
.automate-wizard-editor:not([open]) > .modal-foot,
.automate-wizard-editor:not([open]) .wizard-editor-preview,
.automate-wizard-editor:not([open]) .wizard-editor-settings > h3,
.automate-wizard-editor:not([open]) .wizard-editor-settings > .form-hint { display: none; }
.automate-wizard-editor:not([open]) > .modal-body { padding: 0; overflow: visible; }
.automate-wizard-editor:not([open]) .wizard-editor-settings { margin: 0; padding: 0; border: 0; }
.data-table.wizard-items-table .wizard-item-shown,
.data-table.wizard-items-table .wizard-item-fact {
  min-width: 12ch;
  max-width: 36ch;
  overflow-wrap: anywhere;
}
.data-table.wizard-items-table td.wizard-item-fact { font-variant-numeric: tabular-nums; }
.wizard-items-summary { font-weight: 600; margin: 0 0 8px; }
/* Next and, where the page is about to go on by itself, the line saying so
   with its Stay button, on one row at the foot of the form. */
#wizard-next-slot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; }
.wizard-auto-next { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text-muted); }
.data-table.wizard-items-table td.wizard-item-state { white-space: nowrap; }
.wizard-item-state .refresh-spinner { display: inline-block; vertical-align: middle; margin-right: 6px; }
.wizard-item-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (prefers-reduced-motion: reduce) {
  .wizard-item-state .refresh-spinner { animation: none; }
}
.workbench-record-full { flex: none; }

/* --- Variables ---
   Two sources define the custom properties this sheet consumes, and a bare
   var(--x) must be defined by one of them - an undefined name makes the
   declaration invalid at computed-value time and the property silently resolves
   to unset. cmd/website's TestStyleSheetVariablesAreDefined enforces that.

   The colours below are dark-mode baselines; internal/theme's StyleBlock
   overrides them per mode from the active theme, so a themeable colour needs a
   field on theme.Palette as well as a line here. Geometry, spacing and the
   severity palette are owned by this sheet alone. See cmd/website/README.md's
   "Custom properties (CSS variables)". */
:root {
  --bg:              #0c0e14;
  --surface:         #13161f;
  --surface-hover:   #1a1e2a;
  --surface-elevated:#1e2230;
  --surface-alt:     #171b24;
  --border:          #252a36;
  --border-hover:    #333a4d;
  --accent:          #00c9a7;
  --accent-dim:      rgba(0, 201, 167, 0.12);
  --accent-hover:    #00b396;
  --danger:          #d96060;
  --font-body:       system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --text:            #e8eaf0;
  --text-muted:      #8892a4;
  --text-faint:      #4e5566;
  --sidebar-w:       258px;
  --sidebar-w-icon:  52px;
  --topbar-h:        52px;

  /* Corner radius scale, smallest first */
  --radius-sm:       5px;
  --radius:          8px;
  --radius-md:       10px;
  --radius-lg:       14px;

  /* Monospace stack for code, IDs, and editors */
  --font-mono: "Cascadia Code", "Fira Code", "Consolas", monospace;

  /* Severity colours */
  --sev-ok-bg:      rgba(100, 200, 80, 0.10);
  --sev-ok-text:    #7ecb5f;
  --sev-ok-border:  rgba(100, 200, 80, 0.25);
  --sev-info-bg:    rgba(80, 150, 220, 0.10);
  --sev-info-text:  #70aadf;
  --sev-info-border: rgba(80, 150, 220, 0.28);
  --sev-warn-bg:    rgba(240, 180, 0, 0.10);
  --sev-warn-text:  #e8a820;
  --sev-warn-border: rgba(240, 180, 0, 0.30);
  /* A field mandatory under a condition (svg.attr-conditional): a lighter,
     yellower amber than a requirement's own, since it is still mandatory,
     only not always. */
  --req-conditional-text: #f0cc4a;
  --sev-prob-bg:    rgba(220, 70, 70, 0.12);
  --sev-prob-text:  #d96060;
  --sev-prob-border: rgba(220, 70, 70, 0.30);
  --sev-neut-text:  #505868;
  /* One cell of a result grid carrying its own result. Passing is a hue
     rather than a colour, since nearly every cell passes and a grid washed
     in green would hide the few that do not; the rest are stronger than the
     tiles' backgrounds because they are one cell wide. */
  --cell-ok-bg:     rgba(100, 200, 80, 0.05);
  --cell-info-bg:   rgba(80, 150, 220, 0.14);
  --cell-warn-bg:   rgba(240, 180, 0, 0.16);
  --cell-prob-bg:   rgba(220, 70, 70, 0.18);

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  /* 20 completes the 4px scale upwards. It was already in use as a literal -
     1.5rem and 18px - it just had no name, so a template author reaching for "the
     largest section gap" had nothing to reach for and wrote the number (issue
     #164). Stops here deliberately: nothing in the templates lands on 24px, and an
     unused step is vocabulary nobody can be expected to know. */
  --space-5: 20px;

  /* Surface raised (alias for elevated) */
  --surface-raised: #1e2230;
  --accent-subtle:  rgba(0, 201, 167, 0.10);
}

/* --- Utilities --- */
.hidden { display: none !important; }

/* Read aloud, never drawn. A table whose first column is a tick box needs a
   heading for that column that a screen reader announces and a screen does not
   show, and three of Comply's review tables asked for one by this name before
   anything defined it - so "Select" was drawn over every one of those columns
   like any other heading. Not display: none, which takes the text out of the
   accessibility tree along with the pixels; the clip is what leaves it there.
   TestTextHiddenOnlyForSightIsActuallyHidden fails on a name with no rule. */
.visually-hidden {
  position: absolute;
  /* Pinned rather than left at its static position, which is what stops a
     hidden word from widening the page. Absolutely positioned with no
     positioned ancestor, its containing block is the page itself, so it is
     NOT clipped by a scrolling ancestor and its static x still counts towards
     the document's width: one such heading inside a wide table in a
     horizontally scrolling wrapper put the whole run page 250px past the
     viewport on a phone, while the table it was in scrolled correctly. A box
     clipped to nothing has nowhere it would rather be. */
  left: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The `hidden` attribute must always win: without this, any author rule that
   sets display (e.g. display:grid on a panel class) overrides the UA
   stylesheet's [hidden]{display:none} and the element stays visible. */
[hidden] { display: none !important; }

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-elevated);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent);
}

/* --- App Shell --- */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.nav-toggle {
  display: none;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  transition: width 0.22s ease, min-width 0.22s ease, border-color 0.22s ease;
}

.nav-toggle:not(:checked) ~ .sidebar {
  width: var(--sidebar-w-icon);
}

/* nav.js picks the starting width (remembered choice, or the rail on a narrow
   window), which without this would play the 220ms width transition above as a
   collapse animation on every page load. The class lands one frame after the
   default is applied, so the correct width is painted before anything can
   animate. See initNav in nav.js. */
html:not(.nav-ready) .sidebar {
  transition: none;
}

/* Hamburger is removed - sidebar collapse is handled by the bottom chevron. */
.hamburger {
  display: none;
}

/* --- Sidebar collapse chevron (bottom of sidebar) --- */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-faint);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.sidebar-collapse-btn:hover {
  background: var(--surface-hover);
  color: var(--text-muted);
}

.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Expanded: show left chevron (collapse action) */
.sidebar-collapse-btn .chevron-collapse { display: block; }
.sidebar-collapse-btn .chevron-expand   { display: none;  }

/* Collapsed (icon-only): show right chevron (expand action) */
.nav-toggle:not(:checked) ~ .sidebar .sidebar-collapse-btn .chevron-collapse { display: none;  }
.nav-toggle:not(:checked) ~ .sidebar .sidebar-collapse-btn .chevron-expand   { display: block; }

/* --- Icon-only mode (sidebar narrow) --- */
.nav-toggle:not(:checked) ~ .sidebar .sidebar-header {
  justify-content: center;
  padding: 0 8px;
}

/* The fallback branding is two FILES - a wordmark and a mark-only icon - so the
   collapsed rail swaps one img for the other. */
.nav-toggle:not(:checked) ~ .sidebar .brand-logo {
  display: none;
}

.nav-toggle:not(:checked) ~ .sidebar .brand-logo-icon {
  display: block;
}

/* A theme carries ONE inline SVG, so the rail resizes that copy instead of
   revealing a second one (see layout.html's brand block, issue #269). */
.nav-toggle:not(:checked) ~ .sidebar .brand-logo-theme {
  width: 32px;
  height: 32px;
}

.nav-toggle:not(:checked) ~ .sidebar .brand-logo-theme svg {
  width: 32px;
  height: 32px;
}

.nav-toggle:not(:checked) ~ .sidebar .sidebar-nav {
  padding: 12px 4px;
}

.nav-toggle:not(:checked) ~ .sidebar .nav-section-toggle {
  justify-content: center;
  padding: 9px;
}

.nav-toggle:not(:checked) ~ .sidebar .nav-section-label-text,
.nav-toggle:not(:checked) ~ .sidebar .nav-section-chevron {
  display: none;
}

/* On the rail a group heading is its icon alone, centred over the icons of
   the links under it, so the collapse button beside it is not drawn at all.
   Its chevron was hidden and the button kept its 34px, which centred every
   heading's icon in a box that much narrower than a link's and left it sitting
   to the left of the column; pressed, it only widened the sidebar, which the
   chevron at the foot already does. And with no control on the rail that
   could open a group again, a group collapsed while the sidebar was wide shows
   its links here, and is still collapsed when the sidebar is widened. */
.nav-toggle:not(:checked) ~ .sidebar .nav-section-collapse {
  display: none;
}

.nav-toggle:not(:checked) ~ .sidebar .nav-section.collapsed .nav-section-items {
  display: block;
}

.nav-toggle:not(:checked) ~ .sidebar .nav-link {
  justify-content: center;
  padding: 9px;
}

.nav-toggle:not(:checked) ~ .sidebar .nav-link-text {
  display: none;
}

/* Tooltip on icon-only nav links */
.nav-toggle:not(:checked) ~ .sidebar .nav-link {
  position: relative;
}

.nav-toggle:not(:checked) ~ .sidebar .nav-link:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
}

/* The corner: the waffle and the brand mark. Its padding and gap are matched by
   body.app-nosidebar .topbar, which owns the same corner on a page with no
   sidebar - see the rule beside .topbar-brand. Change one and change the other,
   or the two controls shift sideways as the reader moves between an app and the
   launcher. */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  overflow: hidden;
  transition: color 0.15s;
}

.brand:hover { color: var(--accent); }

.brand-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--accent);
}

.brand-logo {
  width: 120px;
  max-height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

/* The active theme's inline SVG. One element, one copy: the light/dark fill comes
   from the --logo-fill custom property inside the SVG (theme.LogoMarkupVar), so
   nothing here needs a per-mode variant to show and hide. */
.brand-logo-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.theme-font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.theme-font-field select.form-select {
  font-family: inherit;
}

.theme-font-field select.form-select option {
  font-family: inherit;
}

.brand-logo-theme svg {
  width: 120px;
  height: 28px;
  display: block;
}

.brand-logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: none;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

h1, h2, h3, h4, h5, h6,
.tool-header-title,
.brand-name {
  font-family: var(--font-heading);
}

/* --- Hamburger --- */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background 0.15s;
}

.hamburger:hover { background: var(--surface-hover); }

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: background 0.15s;
}

.hamburger:hover span { background: var(--text); }

/* --- Sidebar Nav --- */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-header {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

/* --- Nav section toggle (module header) --- */
.nav-section-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: none;
  border: none;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

/* Currently unrendered. A sidebar group heading is a LABEL now, not a link -
   .nav-section-label below - because an app's groups are not destinations. The
   rule stays because the shape is still supported by nav.js, and a group that
   ever does become a link wants exactly this. */
.nav-section-home {
  flex: 1;
  min-width: 0;
}

/* A group heading inside an app's sidebar. It borrows .nav-section-toggle's box
   so the collapse chevron beside it lines up, and gives back the pointer and the
   hover, because it is a label rather than a destination: it is a <span> with no
   href precisely so nav.js's longest-prefix match cannot select it. */
.nav-section-label {
  flex: 1;
  min-width: 0;
  cursor: default;
}

.nav-section-label:hover {
  background: none;
}

/* A heading carrying a count of its own (navGroup.BadgeKeys): on the rail the
   count is a dot on the heading's corner, as it is on a link's, and the dot is
   placed against the heading rather than against the sidebar. */
.nav-toggle:not(:checked) ~ .sidebar .nav-section-label {
  position: relative;
}

.nav-section-collapse {
  flex: none;
  justify-content: center;
  width: 34px;
  padding-left: 0;
  padding-right: 0;
}

.nav-section-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-section-toggle .nav-section-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-section-toggle .nav-section-chevron {
  margin-left: auto;
  transition: transform 0.18s ease;
  display: flex;
  align-items: center;
}

.nav-section-toggle .nav-section-chevron svg {
  width: 12px;
  height: 12px;
  display: block;
}

.nav-section-collapse .nav-section-chevron {
  margin-left: 0;
}

.nav-section.collapsed .nav-section-toggle .nav-section-chevron {
  transform: rotate(-90deg);
}

.nav-section.collapsed .nav-section-items {
  display: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.nav-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Count of background runs in flight, on the nav link that leads to them. Pushed
   to the trailing edge so it reads as a status on the link rather than part of its
   label. */
.nav-link-badge {
  margin-left: auto;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--sev-info-bg);
  color: var(--sev-info-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  flex-shrink: 0;
}

/* Collapsed (icon-only) sidebar: the count cannot fit, but the fact that
   something is running still has to be visible - that is the whole point of the
   badge - so it becomes a dot on the icon's corner. */
.nav-toggle:not(:checked) ~ .sidebar .nav-link-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  color: transparent;
  overflow: hidden;
  background: var(--sev-info-text);
}

/* The slot the poll swaps a count into lays out as its contents: a flex row
   takes a gap for every item in it, so two empty slots on Runs put 20px of
   nothing beside its icon, which on the icon rail centred the icon 10px to the
   left of every other one. As its contents an empty slot is no item at all and
   a full one is just its badge, pushed to the end of the row or, on the rail,
   a dot on the icon's corner. */
.activity-badge-slot {
  display: contents;
}

/* A count of work waiting on a person, rather than work in flight. Kept distinct
   for the same reason the topbar indicator's pill is - see .topbar-activity-count.
   Both collapsed-sidebar dots need the distinction too, or the one count worth
   noticing becomes the same speck as the routine one. */
.nav-link-badge-waiting {
  background: var(--sev-warn-bg);
  color: var(--sev-warn-text);
}

.nav-toggle:not(:checked) ~ .sidebar .nav-link-badge-waiting {
  background: var(--sev-warn-text);
}

/* .nav-link-sub and .nav-subsection-label are deliberately unused. They look
   exactly like the vocabulary an app's sidebar groups want, and they are not it:
   a group is a .nav-section with a .nav-section-label heading, which is what
   keeps the markup inside the selectors static/js/nav.js already binds - so the
   collapse chevrons and the drawer auto-close needed no change. Reaching for
   these two instead would mean teaching nav.js a second shape. */
.nav-link-sub {
  padding-left: 22px;
}

.nav-subsection-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 10px 10px 2px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.15s;
}

.nav-toggle:not(:checked) ~ .sidebar .nav-subsection-label {
  opacity: 0;
}

/* --- Main Wrapper --- */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  transition: none;
}

/* --- Topbar --- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* The dev identity banner (auth_actas_dev.go). Amber and always the full width
   of the main column, above the topbar in both shells, and never dismissable:
   the point of it is that nobody mistakes a made-up person for a real one.
   Uses the shared warning tokens so it reads as a warning in both themes. */
.actas-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 6px 20px;
  background: var(--sev-warn-bg);
  border-bottom: 1px solid var(--sev-warn-border);
  color: var(--text);
  font-size: 12.5px;
  flex-shrink: 0;
}

.actas-banner-icon {
  width: 18px;
  height: 18px;
  color: var(--sev-warn-text);
  flex-shrink: 0;
}

.actas-banner-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  flex: 1 1 240px;
  min-width: 0;
}

.actas-banner-lead strong {
  font-weight: 600;
}

.actas-banner-roles {
  color: var(--sev-warn-text);
  font-weight: 500;
}

.actas-banner-why {
  color: var(--text-muted);
}

.actas-switcher {
  position: relative;
}

.actas-switcher > summary {
  list-style: none;
  cursor: pointer;
}

.actas-switcher > summary::-webkit-details-marker {
  display: none;
}

.actas-people {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 340px;
  max-width: min(480px, calc(100vw - 32px));
  padding: 6px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.actas-person-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.actas-person-btn:hover,
.actas-person-btn:focus-visible {
  background: var(--surface-hover);
}

.actas-person-btn[aria-current="true"] {
  background: var(--accent-dim);
}

.actas-person-name {
  font-weight: 600;
}

.actas-person-email {
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

.actas-person-why {
  font-size: 12px;
  color: var(--text-muted);
}

/* Once the banner has wrapped, its buttons sit at the left, so a panel hung
   from the button's right edge would open off the screen: hang it from the
   left instead and let it take the width. */
@media (max-width: 760px) {
  .actas-people {
    left: 0;
    right: auto;
    min-width: 0;
    width: calc(100vw - 32px);
  }
}

.topbar-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* The current application: icon, name and a one-line slogan on one baseline.
   Everything here is sized to leave --topbar-h at 52px, because .sidebar-header
   reads the same variable to line its own bottom border up with the topbar's,
   and the phone activity panel derives its top edge from it. */
.topbar-app {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.topbar-app:hover .topbar-app-name {
  color: var(--accent);
}

.topbar-app-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--module, var(--accent));
}

.topbar-app-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

/* Ellipsised like the slogan below it. The name used to rely on never being
   long enough to matter; "Automate" at the phone width painted over the theme
   toggle, because .topbar-app shrinks (min-width: 0) while nowrap text does not. */
.topbar-app-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* An app in beta says so on its tile's icon and beside its name in the
   topbar, in the warning tint, since beta is a caution rather than a state. */
.beta-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--sev-warn-bg);
  color: var(--sev-warn-text);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Beside the name it sits on the name's line, which is a baseline row. */
.beta-tag-topbar {
  align-self: center;
}

/* On a tile it is pinned to the icon's corner, over its edge, so the icon
   keeps its size and the tag reads as part of it. */
.beta-tag-icon {
  position: absolute;
  right: -10px;
  bottom: -7px;
  font-size: 9px;
  padding: 0 5px;
  border: 1px solid var(--surface);
}

/* Ellipsised rather than wrapped: a second line would push --topbar-h out and
   take the sidebar header's alignment with it. */
.topbar-app-slogan {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The vault switcher sits beside the app name on Vault's pages: a pill naming
   the vault in use, opening a menu of the others. One line tall, because
   .topbar is --topbar-h and a second line would move the sidebar header. */
.vault-switch {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 6px;
  min-width: 0;
  flex-shrink: 1;
}

.vault-switch-summary,
.vault-switch-static {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-elevated);
  white-space: nowrap;
  min-width: 0;
}

.vault-switch-summary {
  list-style: none;
  cursor: pointer;
}

.vault-switch-summary::-webkit-details-marker {
  display: none;
}

.vault-switch-summary:hover,
.vault-switch-summary:focus-visible {
  border-color: var(--accent);
}

.vault-switch-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--accent);
}

.vault-switch-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.vault-switch-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.vault-switch-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 6px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.vault-switch-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.vault-switch-item:hover,
.vault-switch-item:focus-visible {
  background: var(--surface-hover);
}

.vault-switch-item-name {
  font-weight: 600;
}

.vault-switch-where {
  font-size: 12px;
  color: var(--text-muted);
}

.vault-switch-all {
  border-top: 1px solid var(--border);
  border-radius: 0;
  margin-top: 4px;
  padding-top: 10px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .vault-switch-name {
    max-width: 110px;
  }

  .vault-switch-where {
    display: none;
  }
}

.vault-section {
  margin-bottom: 20px;
}

/* The vault's connection fields draw only the credential its way in names:
   the deployment's own identity needs neither box, an app registration needs
   its credential and a SQL Server login its own. Read off the way in's
   checked option, so the choice needs no script and no request; the selector
   names the choice's own select because a credential's slug is an option
   value too. A local vault has no server at all, so the record's form draws
   no server card while the kind chosen is local. */
.vault-auth-row:not(:has(.vault-auth-choice option[value="entra-app"]:checked)) .vault-auth-entra,
.vault-auth-row:not(:has(.vault-auth-choice option[value="sql-login"]:checked)) .vault-auth-sql,
#vault-new-form:has(.vault-kind-choice option[value="local"]:checked) .vault-server-card {
  display: none;
}

.vault-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.vault-inline-form .form-group {
  margin: 0;
  min-width: 160px;
}

/* A placeholder key is one token: broken at its hyphen it reads as two. */
.vault-placeholder-example {
  white-space: nowrap;
}

/* A tick in an inline form of fields is centred on the boxes beside it:
   the form stands everything on its foot, and a tick is shorter than a box,
   so it is given a box's height to be centred in. */
.vault-inline-form > .form-label-check {
  min-height: 34px;
  margin: 0;
}

/* Adding a legal entity: its id, name and profile on one row, then the
   templates it is seeded from, then the button, in the order it is read. */
.vault-le-add {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.vault-le-add-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
}

.vault-le-add .form-select {
  min-width: 180px;
}

.vault-le-seed {
  margin: 12px 0 0;
}

.vault-le-seed .form-hint {
  margin-top: 6px;
}

/* The Templates section of a vault's page: a template the vault inherits is
   marked, its workstreams are ticks in the row's own form, a newer version
   is a note under the number, and a legal entity's profile is a chooser in
   its row. */
.vault-inherited .vault-inherit-template {
  border-left: 3px solid var(--accent);
}

.vault-ticks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.vault-ticks .form-label-check {
  margin: 0;
  white-space: nowrap;
}

.vault-newer {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.vault-profile {
  min-width: 180px;
}

/* Vault > Workstreams: a band per workstream with its areas under it; one
   the vault's inherit leaves out is drawn faded, still listed so a reader
   can see what the template has. */
.vault-workstream {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.vault-workstream.is-left-out {
  opacity: 0.6;
}

.vault-workstream-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.vault-workstream-name {
  margin: 0;
  font-size: 15px;
}

/* What a runbook's workflow will not do as generated, under the workflow's
   own words. */
.vault-notes {
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

/* An area's rows on a template version: the row that adds one is the last
   row of the table, its boxes in the columns they fill. */
.vault-rows td {
  white-space: nowrap;
}

.vault-row-add td {
  background: var(--surface-elevated);
}

.vault-row-add .form-input {
  min-width: 120px;
}

/* Vault > Areas: the list's table, and an area's page: the facts row under
   the header, the legal entity strip, the sign-offs, the pending table, the
   row actions and the Gold table with a History and a Change per row. */
.data-table.vault-areas td {
  vertical-align: top;
}

.vault-area-facts {
  padding-bottom: 12px;
}

.vault-fact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 13px;
}

/* Vault pages that stack a band per workstream or per area, each with the
   same table, share one set of column widths: a band is a table of its own,
   so the browser would size each one to its content, the same headings would
   sit at a different x in every band, and scrolling from one area to the
   next would move every column sideways. A fixed layout and a width per
   heading hold them still, named by class and never by position (the
   runbook's stage tables keep the same rule), with the column whose content
   has no shape taking what is left. Each table has a floor below which the
   wrapper scrolls rather than crushing the columns, and every band reaches
   the floor at the same width, so they stay in step there too. */
.data-table.vault-routes-table,
.data-table.vault-areas,
.data-table.vault-workstream-areas,
.data-table.vault-update-lines,
.data-table.vault-mapping-rows {
  table-layout: fixed;
}

.data-table.vault-routes-table td,
.data-table.vault-workstream-areas td,
.data-table.vault-update-lines td {
  overflow-wrap: anywhere;
}

/* Each share is at least its own heading at the 960px floor, the form
   control's remainder included (TestTheFieldIdentityTableFitsItsHeadings):
   Build writes it by at 12% ran into Last verified, which at 11% ran into
   the wrapper's edge. */
.data-table.vault-routes-table { min-width: 960px; }
.vault-routes-table .vault-routes-col-column   { width: 15%; }
.vault-routes-table .vault-routes-col-class    { width: 7%; }
.vault-routes-table .vault-routes-col-dmf      { width: 21%; }
.vault-routes-table .vault-routes-col-odata    { width: 14%; }
.vault-routes-table .vault-routes-col-build    { width: 17%; }
.vault-routes-table .vault-routes-col-verified { width: 13%; }

.data-table.vault-areas { min-width: 760px; }
.vault-areas .vault-areas-col-kind    { width: 13%; }
.vault-areas .vault-areas-col-scope   { width: 13%; }
.vault-areas .vault-areas-col-rows    { width: 8%; }
.vault-areas .vault-areas-col-pending { width: 13%; }
.vault-areas .vault-areas-col-signoff { width: 22%; }

.data-table.vault-workstream-areas { min-width: 980px; }
.vault-workstream-areas .vault-ws-col-kind     { width: 10%; }
.vault-workstream-areas .vault-ws-col-scope    { width: 10%; }
.vault-workstream-areas .vault-ws-col-entity   { width: 17%; }
.vault-workstream-areas .vault-ws-col-owner    { width: 11%; }
.vault-workstream-areas .vault-ws-col-approver { width: 11%; }
.vault-workstream-areas .vault-ws-col-readers  { width: 10%; }
/* Columns and Rows hold a count of three digits at most, so they are as
   wide as their headings and no wider, in pixels so every workstream's table
   keeps them alike whatever its width; the width they gave up goes to the
   area's words. */
.vault-workstream-areas .vault-ws-col-columns  { width: 76px; }
.vault-workstream-areas .vault-ws-col-rows     { width: 56px; }
.data-table.is-roomy.vault-workstream-areas .vault-ws-col-columns,
.data-table.is-roomy.vault-workstream-areas .vault-ws-col-rows {
  padding-left: 8px;
  padding-right: 8px;
}

.data-table.vault-update-lines { min-width: 900px; }
.vault-update-lines .vault-update-col-row     { width: 14%; }
.vault-update-lines .vault-update-col-company { width: 9%; }
.vault-update-lines .vault-update-col-kind    { width: 12%; }
.vault-update-lines .vault-update-col-fate    { width: 21%; }

.data-table.vault-mapping-rows { min-width: 820px; }
.vault-mapping-rows .vault-mapping-col-target  { width: 22%; }
.vault-mapping-rows .vault-mapping-col-source  { width: 24%; }
.vault-mapping-rows .vault-mapping-col-convert { width: 19%; }

/* The columns that take what is left, said rather than left out so every
   heading carries its class: under a fixed layout an auto column shares the
   remainder, and the same remainder in every band. */
.vault-routes-table .vault-routes-col-mcp,
.vault-areas .vault-areas-col-area,
.vault-workstream-areas .vault-ws-col-area,
.vault-update-lines .vault-update-col-template,
.vault-update-lines .vault-update-col-vault,
.vault-mapping-rows .vault-mapping-col-detail {
  width: auto;
}

.vault-access,
.vault-checks {
  margin-top: 10px;
}

/* What each column of an area is checked against: the column, the field
   the metadata environment matched it to, the checks and what they replaced
   of the template's. Named by class, so a column added later cannot move a
   width onto another one. */
.data-table.vault-checks-table {
  table-layout: fixed;
}

.data-table.vault-checks-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

.vault-checks-table .vault-checks-column {
  width: 22%;
}

.vault-checks-table .vault-checks-field {
  width: 26%;
}

.vault-checks-table .vault-checks-note {
  width: 24%;
}

/* The checks themselves take what is left, and wrap. */
.vault-checks-table .vault-checks-for {
  white-space: normal;
}

.vault-access-form {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.vault-le-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.vault-le-pill {
  min-width: 56px;
  justify-content: center;
}

.vault-signoffs {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.vault-signoff {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
}

.vault-signoff-icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--sev-ok-text);
}

.vault-signoff.is-changed .vault-signoff-icon {
  color: var(--sev-warn-text);
}

.data-table.vault-pending td {
  vertical-align: top;
}

.vault-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
}

.vault-import {
  min-width: 200px;
}

.vault-import-form {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 280px;
}

.vault-recent {
  margin-top: 12px;
}

.vault-recent .table-wrapper {
  margin-top: 8px;
}

/* A Gold row is one line, so its values sit on the middle of the 28px
   buttons at its end rather than along their top edge. */
.data-table.vault-gold td {
  white-space: nowrap;
  vertical-align: middle;
}

/* A Gold row's History, Change and Remove: three small squares on one line,
   each its icon alone with what it does in its tooltip. As words the three
   wrapped onto a second line and every row was two lines tall. The form
   holding Change and Remove takes no box of its own, so all three are items
   of one row. The Templates list's Open and Export and the magnifier at the
   end of a version's areas are the same squares. Before the touch rule
   further down, which gives every icon-only button its 44px on a coarse
   pointer and so has to win there. */
.vault-cell-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}

.vault-cell-actions form {
  display: contents;
}

.vault-cell-actions .btn-icon-only {
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
}

/* A Gold table is as wide as its area has columns and scrolls sideways in its
   wrapper, so the actions stay at its right edge as it does, the way a row's
   result stays at the left edge of the Row Detail: on one line they no longer
   wrap to make the table fit, and a row of thirty columns had its actions off
   the end of the card. A sticky cell is see-through over the cells it covers,
   so it is painted the row's own colour, the hover's included, and ruled off
   from the columns sliding under it. */
.data-table.vault-gold th.col-actions,
.data-table.vault-gold td.col-actions {
  position: sticky;
  right: 0;
  z-index: 1;
  box-shadow: inset 1px 0 0 var(--border);
}

.data-table.vault-gold td.col-actions {
  background: var(--surface);
}

.data-table.vault-gold tr:hover td.col-actions {
  background: var(--surface-hover);
}

/* Gold with its pending change sets laid over it (?pending=1): a row a set
   adds is tinted green, a row it takes away red and struck through, and on a
   row it changes only the values it changes are marked, since those are what
   the reviewer is there to read. The tint is the severity palette's, the
   same green, amber and red every check result is in. */
.vault-row-added td {
  background: var(--sev-ok-bg);
}

.vault-row-removed td:not(.col-actions):not(.vault-gold-pending) {
  background: var(--sev-prob-bg);
  color: var(--text-muted);
  text-decoration: line-through;
}

.data-table.vault-gold td.vault-cell-changed {
  background: var(--cell-warn-bg);
  box-shadow: inset 0 0 0 1px var(--sev-warn-border);
}

.data-table.vault-gold .vault-gold-pending {
  white-space: nowrap;
}

/* A template's versions on the Templates list: each a link worded as what
   it is ("1.1 Draft"), wrapping as a template gathers versions. The number
   alone read as a badge, and nothing said it was the way into the version. */
.vault-version-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.vault-version-link {
  text-decoration: none;
}

.vault-version-state {
  font-weight: 400;
}

/* An area's entity code, on a line of its own under the area's name, with
   the description under that: the code sat beside a short name and under a
   long one, so the list read as two layouts. */
.vault-area-code {
  display: block;
  margin-top: 2px;
}

/* A change set's rows: a box per value on a draft, with what it was under
   a changed one; before and after side by side once it is sent; the
   checks' sentences in their own column. */
.data-table.vault-change-rows td {
  vertical-align: top;
}

.data-table.vault-change-rows .form-input {
  min-width: 110px;
}

.vault-change-cell.is-changed {
  background: var(--sev-warn-bg);
}

.vault-cell-before {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: line-through;
}

.vault-cell-after {
  font-weight: 600;
}

.data-table .vault-change-row.is-remove td {
  opacity: 0.75;
}

.vault-problems {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--sev-prob-text);
}

.vault-change-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.vault-decision .form-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.vault-history {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.vault-history-when {
  color: var(--text-muted);
  margin-right: 6px;
}

.data-table.vault-history-table td {
  vertical-align: top;
}

/* Vault > Pipeline: the sources table and the form that adds one, with a
   fieldset per kind; an area's mapping, a row per area column with the
   source column, the conversion and what it needs in one cell; the loads
   and a batch's first rows. */
.data-table.vault-sources td,
.data-table.vault-pipeline-areas td,
.data-table.vault-batches td {
  vertical-align: top;
}

.vault-source-add {
  margin-top: 12px;
}

.vault-source-form {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.vault-source-kind-fields {
  margin: 10px 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.vault-mapping .form-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.vault-load-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.vault-load-form .form-input {
  max-width: 320px;
}

.vault-mapping-form {
  margin-top: 4px;
}

.data-table.vault-mapping-rows td {
  vertical-align: top;
}

.data-table.vault-mapping-rows .form-input,
.data-table.vault-mapping-rows .form-select {
  min-width: 140px;
}

.vault-mapping-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
}

.vault-mapping-rules {
  margin-top: 12px;
}

.data-table.vault-bronze td {
  white-space: nowrap;
}

/* The pipeline's second half: the generated procedures with their state,
   a refused regeneration's conflicts as the two texts side by side (each
   a scroll box of its own, since a procedure is a page of SQL), the hooks,
   the runs each a disclosure over its steps, the latest run's checks and
   the held-back rows, whose problems wrap. */
.vault-pipeline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.vault-generated .form-card-title,
.vault-held .form-card-title,
.vault-checks .form-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.vault-conflict {
  margin: 8px 0;
}

.vault-conflict > summary {
  cursor: pointer;
}

.vault-conflict-texts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.vault-conflict-texts pre {
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}

.vault-hook-form {
  margin-top: 12px;
}

.vault-run {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.vault-run > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.vault-run-message,
.vault-held-problems {
  white-space: normal;
  min-width: 240px;
}

.vault-trace-form .form-input {
  max-width: 520px;
}

.vault-trace-row {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.vault-trace-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.vault-trace-values {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px 12px;
  margin: 0;
}

.vault-trace-values dt {
  font-size: 11px;
  color: var(--text-muted);
}

.vault-trace-values dd {
  margin: 0;
}

@media (max-width: 760px) {
  .vault-conflict-texts {
    grid-template-columns: 1fr;
  }
}

/* Discover's Routes page: the field identity of one entity with a person's
   curation over it. A row the refresh moved under its curation is tinted,
   since "to review" is the one state that asks somebody to look; the
   curation form sits in the row's last cell, its override behind a
   disclosure because six controls a row is a form and not a table. */
.explorer-route-tiles {
  margin-bottom: 16px;
}

.explorer-route-review td {
  background: var(--sev-warn-bg);
}

/* The Routes table is the width of the page and no wider: at 1280px with the
   sidebar open that is 964px, and the table scrolled sideways across seven
   thousand. Two things did it. The actions cell carried the shared
   .col-actions' width of 1%, and the Fields table's layout this table borrows
   (.explorer-detail-table: fixed, at least as wide as its max-content) asks
   the browser for the width at which 1% holds the cell's buttons, which is a
   hundred times the buttons: every column without a width of its own was
   drawn a thousand pixels wide. And eleven columns, seven of them codes, came
   to more than a laptop has whatever they were given, so four share a cell
   now (see the template) and the actions sit under the standing, in a column
   with a width in pixels.

   Type / class, Key, Req and Standing have widths of their own; Field and the
   three routes share what they leave, about 150px each at 1280 and 190 at
   1440. A fixed layout gives those four nothing when the others take it all
   and ignores a min-width on a cell, so each heading carries the Fields
   table's zero-height spacer (88px, the roomy cell's 28px of padding on top):
   below 116px a column the table scrolls in its frame rather than drawing a
   code a letter to a line. Long codes break after their dots and slashes
   (codeText), anything longer anywhere (.explorer-detail-table td). */
.data-table.explorer-route-table .explorer-route-col-type {
  width: 120px;
}

/* 48px: KEY and REQ with the sort arrow in the 12px after them, which at the
   Fields table's 40px ran into the next heading. Qualified past
   .data-table.explorer-detail-table th.icon-col, which comes later. */
.data-table.explorer-detail-table.explorer-route-table th.icon-col,
.data-table.explorer-detail-table.explorer-route-table td.icon-col {
  width: 48px;
  padding-left: 8px;
  padding-right: 12px;
}

/* The pill, who curated the row, and Confirm, Clear and Override under them,
   two to a line. */
.data-table.explorer-route-table .explorer-route-col-standing {
  width: 150px;
}

/* An override's six controls need more than that, so while one is open its
   column is given 260px and the four shared columns give up the difference
   (see the floor below the spacer rule). */
.data-table.explorer-route-table:has(.explorer-route-override[open]) .explorer-route-col-standing {
  width: 260px;
}

.data-table.explorer-route-table th.explorer-route-col-field::before,
.data-table.explorer-route-table th.explorer-route-col-dmf::before,
.data-table.explorer-route-table th.explorer-route-col-odata::before,
.data-table.explorer-route-table th.explorer-route-col-form::before {
  content: '';
  display: block;
  width: 88px;
  height: 0;
}

/* While an override is open the four shared columns' floor comes down to
   60px (88px with the cell's padding, which is on top of a width): at the
   116px they keep otherwise, the table came to 994px against the 964 a
   laptop leaves it with the sidebar open. */
.data-table.explorer-route-table:has(.explorer-route-override[open]) th.explorer-route-col-field::before,
.data-table.explorer-route-table:has(.explorer-route-override[open]) th.explorer-route-col-dmf::before,
.data-table.explorer-route-table:has(.explorer-route-override[open]) th.explorer-route-col-odata::before,
.data-table.explorer-route-table:has(.explorer-route-override[open]) th.explorer-route-col-form::before {
  width: 60px;
}

/* An enum's name is cut to the column with the whole of it in its tooltip,
   rather than wrapped onto four lines that make the row four lines tall. */
.data-table.explorer-route-table .explorer-route-col-type .type-badge {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
}

/* The class under the type, and the entity a value must exist in under the
   field: a line each, the second cut at two lines with the whole relation in
   its tooltip, since its field pairs can run to a paragraph. */
.explorer-route-class {
  margin-top: 4px;
}

.explorer-route-relation {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 4px;
  cursor: help;
}

/* A route's countries are a line of words with the whole list and where the
   restriction was read behind them, so the pointer says there is more. */
.explorer-route-countries {
  cursor: help;
}

/* The standing is the one pill a row always has; the "preferred" pill beside
   a route is not it, which is why it carries a class of its own. */
.explorer-route-standing {
  white-space: nowrap;
}

.explorer-route-form {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: flex-start;
  margin-top: 8px;
}

.explorer-route-override summary {
  list-style: none;
  cursor: pointer;
}

.explorer-route-override summary::-webkit-details-marker {
  display: none;
}

/* Open, the override takes a line of its own under Confirm and Clear, and
   its form the column's whole width. */
.explorer-route-override[open] {
  flex: 1 1 100%;
  min-width: 0;
}

.explorer-route-override-body {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

/* The control chooser: the capture and the search side by side above the
   list, the likely control tinted, and a field id that is a path of its own
   under the control's name rather than a cell that widens the table. */
.explorer-route-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}

.explorer-route-pick .form-group {
  flex: 1 1 220px;
  margin: 0;
}

/* The button that opens the chooser sits on its own row of the override's
   grid, under the field id it fills in. */
.explorer-route-choose {
  justify-self: start;
}

dialog.modal.explorer-route-chooser .modal-body {
  min-height: 0;
}

.data-table.explorer-route-controls-table td {
  vertical-align: top;
}

.explorer-route-suggested td {
  background: var(--sev-ok-bg);
}

.explorer-route-fieldid {
  word-break: break-all;
}

/* A workstream's coverage: the Routes tab's tiles at a third of the size,
   since seven of them sit under every workstream's name. */
.vault-coverage {
  margin: 4px 0 8px;
  gap: 8px;
}

.vault-coverage .summary-stat-metric {
  min-height: 0;
  min-width: 0;
  flex: 0 1 136px;
  padding: 6px 10px;
}

.vault-coverage .summary-stat-metric .summary-copy .stat-value {
  font-size: 15px;
}

/* On the Field identity page the tiles are the page's own summary, so they
   keep the full size. */
.vault-coverage.vault-coverage-page .summary-stat-metric {
  min-height: 60px;
  padding: 12px 14px;
  flex: 0 1 160px;
}

.vault-coverage.vault-coverage-page .summary-stat-metric .summary-copy .stat-value {
  font-size: 18px;
}

.data-table.vault-routes-table td,
.data-table.vault-route-problems td,
.data-table.vault-route-candidates td,
.data-table.vault-captures td,
.data-table.vault-parameters td {
  vertical-align: top;
}

/* A field whose vault value is not the template's is tinted: that is the
   row a reviewer reads first. */
.vault-parameter-differs td {
  background: var(--sev-warn-bg);
}

/* A template update's preview: a line the approver has to decide is
   tinted the same way, since it is the line the reader is there for. */
.data-table.vault-update-lines td {
  vertical-align: top;
}

.vault-update-asked td {
  background: var(--sev-warn-bg);
}

.vault-update-values,
.vault-update-identity {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
}

.vault-update-identity {
  font-size: 13px;
}

.vault-update-summary {
  margin: 4px 0 12px;
}

.vault-update-tiles {
  margin-bottom: 4px;
}

/* Settings > Excel add-in: the deployment's facts as a definition list,
   and the installation steps. */
.settings-addin-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 8px 0 0;
  font-size: 13px;
}

.settings-addin-facts dt {
  color: var(--text-muted);
}

.settings-addin-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.settings-addin-steps {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 13px;
}

.settings-addin-steps li {
  margin-bottom: 6px;
}

/* Settings > Excel add-in: the state line over the steps, a value with its
   copy button beside it, the step's sub-headings, and the Cloud Shell script,
   which keeps its lines and scrolls since a line of a script means something. */
.settings-addin-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* The portal links and the manifest are the things to press on this page, so
   they look like links rather than inheriting the text's colour. */
.settings-addin-panel a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.settings-addin-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}

.settings-addin-step > summary {
  cursor: pointer;
}

.settings-addin-value {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  min-width: 0;
}

.settings-addin-value code {
  overflow-wrap: anywhere;
  min-width: 0;
}

/* The browser extension's banner fields (ext-banner-fields): its colours are
   radio swatches, each drawn in the colour it stands for. The palette is
   Go's (browserext.Palette), set on each swatch as custom properties by
   bannerSwatchStyle; dark first, since dark is the site's default theme. */
.ext-banner-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* A line of a banner's fields: a tick and the boxes it governs side by side,
   each box as wide as what it holds rather than the card's width, wrapping
   on a narrow screen. */
.ext-banner-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.ext-banner-line .option-flag {
  flex: none;
}

/* What the banner says is forty characters at most. Qualified by
   .form-input, whose own width (the whole line) comes later in the sheet. */
.form-input.ext-banner-words {
  flex: 0 1 18rem;
  width: auto;
  min-width: 10rem;
}

.ext-strip-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.form-select.ext-strip-size,
.form-select.ext-strip-at {
  width: auto;
}

/* What a bar across the page says is eighty characters at most. */
.form-input.ext-strip-words {
  flex: 0 1 20rem;
  width: auto;
  min-width: 10rem;
}

/* The strip's settings only once the strip is ticked, and its words only for
   a bar, the one size tall enough to carry them. */
.ext-strip-line:not(:has(input[name$="_strip"]:checked)) .ext-strip-fields,
.ext-strip-fields:not(:has(option[value="bar"]:checked)) .ext-strip-words {
  display: none;
}

.ext-banner-colours {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.ext-banner-swatch {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--ext-banner-dark-bg, #4a3410);
  color: var(--ext-banner-dark-fg, #fbd48a);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

html[data-theme="light"] .ext-banner-swatch {
  background: var(--ext-banner-light-bg, #fbeed6);
  color: var(--ext-banner-light-fg, #6b4000);
}

.ext-banner-swatch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.ext-banner-swatch:has(input:checked) {
  border-color: currentColor;
}

.ext-banner-swatch:has(input:focus-visible) {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* A banner as the extension draws it, on Try a host: the bar across the top
   of its panel. */
.ext-banner-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--ext-banner-dark-bg, #4a3410);
  color: var(--ext-banner-dark-fg, #fbd48a);
  border-left: 4px solid var(--ext-banner-strip, #e8a33a);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html[data-theme="light"] .ext-banner-preview {
  background: var(--ext-banner-light-bg, #fbeed6);
  color: var(--ext-banner-light-fg, #6b4000);
}

.ext-banner-preview-note {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* The browser extension's page answers (templates/extension/page.html),
   drawn in its side panel with this stylesheet linked: a column a few hundred
   pixels wide, so everything stacks and nothing is laid out side by side
   beyond a label and its value. */
.ext-answer {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.ext-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.ext-note.is-warning {
  color: var(--sev-warn-text);
}

.ext-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* A module's band wears the module's colour where the theme gives it one
   (--module, set on the band from --module-<id>), and the accent where it
   does not, the variable then being undefined. */
.ext-band {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--module-dim, var(--accent-subtle));
}

.ext-band-icon {
  width: 20px;
  height: 20px;
  color: var(--module, var(--accent));
}

.ext-band-title {
  flex: 1;
  font-weight: 600;
}

.ext-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.ext-card.is-picked {
  border-color: var(--accent);
}

.ext-card-title {
  margin: 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.ext-card-sub {
  margin: 0;
  color: var(--text-muted);
}

.ext-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 12px;
  margin: 0;
}

.ext-facts dt {
  color: var(--text-muted);
}

.ext-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* A list of a record's fields and their values: the field's name takes the
   left and wraps between its words, and the value keeps its room at the
   right, as wide as it is up to about half the row before it wraps. With the
   name given all the width it asked for, a long one (Maximum penny-rounding
   in the reporting currency) left the value a character a line. */
.ext-facts.is-values {
  grid-template-columns: minmax(0, 1fr) fit-content(55%);
}

.ext-facts.is-values dt {
  overflow-wrap: break-word;
}

.ext-facts.is-values dd {
  text-align: right;
}

.ext-heading,
.ext-subheading {
  margin: var(--space-2) 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ext-report {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.ext-card > .ext-subheading:first-child {
  margin-top: 0;
}

.ext-module {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.ext-module:hover,
.ext-module:focus-visible {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.ext-module-icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--module, var(--accent));
}

.ext-module-words {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ext-module-title {
  font-weight: 600;
}

.ext-module-line {
  color: var(--text-muted);
  font-size: 13px;
}

.ext-list {
  margin: 0;
  padding-left: 18px;
  overflow-wrap: anywhere;
}

.ext-entity-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.ext-access {
  font-size: 12px;
  color: var(--text-muted);
}

/* A button standing on its own at the foot of a card or a view sits at its
   bottom right, where the eye ends after reading what is above it, as a
   card's actions do (.ext-card-actions). */
.ext-open {
  align-self: flex-end;
}

/* The browser extension's popup lists (extension-activity): the bell's
   groups and rows, in a column the popup's width. */
.extension-activity {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* A policy to paste, with its Copy beside it: a JSON document keeps its
   lines and scrolls inside its own box. */
.extension-copy-block {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  min-width: 0;
}

.extension-policy {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt);
}

/* The managed configuration as JSON is for the few tools that take it so,
   and is a disclosure under the scripts most people want. */
.extension-managed-json {
  margin: 0 0 12px;
}

.extension-managed-json > summary {
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 8px;
}

/* A conflict is a sentence or two, so its rows are set apart more than a
   list of names is. */
.ext-conflicts li + li {
  margin-top: 6px;
}

/* A control a privilege grants on is a name, the privileges granting on it
   and who holds them, so its rows are set apart as a conflict's are. */
.ext-controls > li + li {
  margin-top: 6px;
}

/* The recording in the extension's panel (extension-record): the script it
   would save keeps its lines, since each is a form's steps, and scrolls in a
   box of its own; the name and Save sit under it. */
.ext-record-view {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ext-record-script {
  margin: 0;
  max-height: 220px;
  padding: 8px 10px;
  overflow: auto;
  white-space: pre;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt);
}

.ext-record-save {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ext-record-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* A card's buttons side by side at its bottom right, the main one last,
   wrapping only where the panel is too narrow for them: the recording's,
   Migrate's Open in Excel and Open in Migrate (icons, their words in the
   tooltip), Automate's Run beside its run screen, and every card ending in
   more than one, which a card's column otherwise stacks a row each. */
.ext-record-actions,
.ext-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.ext-action-icon {
  width: 16px;
  height: 16px;
}

/* Report a problem in the extension's panel (extension-support): what went
   wrong, the screenshot the panel took drawn at the panel's width, the
   page's messages, and Send at the foot's right, where a card's action
   goes. */
.ext-support {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ext-support-label {
  font-size: 12px;
  color: var(--text-muted);
}

.ext-support-shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.ext-support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ext-support-actions.is-end {
  justify-content: flex-end;
}

/* Compare's choice of the capture a page's own is held to. */
.ext-capture-choice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 10px;
  min-width: 0;
}

.ext-capture-choice-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* The extension's Comply answer: Share beside a control a sharing rule
   allows, with what it is for and the slot its answer is drawn in. */
.ext-share-offer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: 0 0 10px;
  min-width: 0;
}

.ext-share-offer > div {
  align-self: stretch;
}

/* The person a shared user id names, drawn under its Share. */
/* A value a change set on its way to Gold would change, in Vault's answer
   on a page: what Gold holds struck through, beside what it would hold. The
   two are the change's own elements, so a screen reader says them as a
   deletion and an insertion. */
.ext-vault-was {
  color: var(--text-muted);
}

.ext-vault-pending {
  text-decoration: none;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  background: var(--sev-warn-bg);
  box-shadow: inset 0 0 0 1px var(--sev-warn-border);
}

/* Automate's answer on a page: a workflow the page fills in, its values
   read from the page beside the controls they come from, the boxes the
   panel asks for the rest in, and a value pointed at a field here. */
.ext-run-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

/* A value a line each: its name, what the page holds, and where it is read
   from, stacked so each has the card's width. */
.ext-run-values {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ext-run-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ext-run-name {
  color: var(--text-muted);
  font-size: 12px;
}

.ext-run-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.ext-run-value {
  overflow-wrap: anywhere;
}

.ext-run-value.is-problem {
  color: var(--sev-warn-text);
}

.ext-run-from {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: break-word;
}

.ext-run-answer:empty {
  display: none;
}

/* A page's own checks laid over the page from the list of modules: a line
   under Validate's module saying how the record stands, the values checked
   a press away. */
.ext-validate-overlay {
  gap: var(--space-1);
  padding: 0 var(--space-3) var(--space-1);
}

.ext-validate-brief {
  min-width: 0;
}

.ext-validate-brief-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--sev-ok-text);
}

.ext-validate-brief-line.is-breached {
  color: var(--sev-prob-text);
}

.ext-validate-brief-icon {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

/* Validate's checks for a page: the rules kept for the page a line each with
   the cross that takes one off, and the builder below them, a field picked
   on the page and what it must be, one control to a line since the panel is
   narrow. */
.ext-page-checks {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ext-page-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  border-top: 1px solid var(--border);
}

.ext-page-check-words {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ext-page-check-remove {
  width: 14px;
  height: 14px;
}

.ext-validate-builder {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.ext-builder-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.ext-builder-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

.ext-builder-label {
  color: var(--text-muted);
  font-size: 12px;
}

.ext-builder-row > .ext-builder-label {
  flex: 0 0 72px;
}

.ext-builder-pick {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ext-builder-pick-icon {
  width: 14px;
  height: 14px;
  margin-right: 4px;
}

/* Compare's answer on a page: what the page is held to, another environment
   as a Compare run held them or the vault's Gold, a press apart. */
.ext-source-switch {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Compare's differences on a page: Previous and Next above the list, and
   the difference the panel has stepped to marked in the list. */
.ext-diff-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Previous and Next stay at the top of the panel while the list scrolls
   under them: stepping scrolls the row stepped to into view, and with the
   buttons left where they were drawn, every step down a long list pushed
   them further up and out of sight. */
.ext-diff-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--space-1) 0;
  background: var(--ext-bg, var(--surface));
}

.ext-diff-where {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Compare's fields in the panel (extension-compare-rows): a row a field,
   what the page holds and what the other side holds side by side, so a
   difference takes a row rather than three. On the shared table base, made
   to a side panel's width: tighter cells, no heading band, and the widths
   fixed, since a column sized to the longest name left the values a sliver
   to wrap a few letters a line in, which is what made the matches mostly
   blank lines. Every cell wraps, the field's name a heading cell included:
   the base's headings neither wrap nor keep their case, and at a fixed
   width a name that does not wrap runs straight over the values beside it. */
.data-table.ext-compare-table {
  table-layout: fixed;
}

.data-table.ext-compare-table th,
.data-table.ext-compare-table td {
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  background: none;
  font-size: 13px;
  letter-spacing: normal;
  border-bottom: 1px solid var(--border);
}

/* The base takes the rule off the last row's values, where the wrapper's
   border closes the table; the field's name is a heading cell, so it is
   taken off that too. */
.data-table.ext-compare-table tbody tr:last-child > th {
  border-bottom: none;
}

.data-table.ext-compare-table thead th {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.data-table.ext-compare-table th.ext-compare-field {
  width: 40%;
}

.data-table.ext-compare-table.is-matches th.ext-compare-field {
  width: 60%;
}

.data-table.ext-compare-table tbody th {
  color: var(--text);
  font-weight: 600;
  text-transform: none;
}

/* The base tints a row's cells as the pointer crosses it; the field's name
   is a heading cell here, so it is tinted with them. */
.data-table.ext-compare-table tbody tr:hover > th {
  background: var(--surface-hover);
}

.ext-compare-tab {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

/* A difference is pressed to go to its field on the page, so it reads as
   something to press, and is brought into view below Previous and Next
   rather than under them. */
.data-table.ext-compare-table tr[data-diff-control] {
  cursor: pointer;
  scroll-margin-top: 48px;
}

.data-table.ext-compare-table tr[data-diff-control]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.data-table.ext-compare-table tbody tr.is-current > th,
.data-table.ext-compare-table tbody tr.is-current > td {
  background: var(--accent-dim);
}

.data-table.ext-compare-table tbody tr.is-current > th {
  box-shadow: inset 3px 0 0 var(--accent);
}

.ext-map-more > summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
}

.ext-map {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: var(--space-2) 0 0;
  min-width: 0;
}

.ext-map-what {
  margin: 0;
}

.ext-map-choose {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.ext-map-choose .form-select {
  flex: 1 1 12rem;
  min-width: 0;
}

/* Vault's answer for a shared key, drawn under the Share button. */
.ext-shared-record {
  margin-top: 8px;
}

/* Send to Vault sits under the record it sends. Inside the card Show this
   record drew it in, it is a part of that card set off by a rule, rather
   than a card drawn inside a card; on a parameters page it is a card of its
   own beside the record's. */
.ext-shared-record .ext-vault-send {
  padding: var(--space-3) 0 0;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: none;
}

/* The send's answer: the sentence, what the set changes and the set a link
   away, spaced as a card's parts are. */
.ext-vault-sent {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.ext-vault-sent .table-wrapper {
  align-self: stretch;
}

.ext-shared-user {
  margin-top: 6px;
}

/* Settings > Browser extension's host rules and alert rules: a block of
   fields each. */
.extension-host-rule,
.extension-alert-rule,
.extension-share-rule {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
}

.extension-host-legend,
.extension-alert-legend,
.extension-share-legend {
  padding: 0 6px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.extension-match {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.extension-match p {
  margin: 0;
  overflow-wrap: anywhere;
}

/* The host a Try answered for, set apart from the sentence about it. */
.extension-match-host {
  font-size: 12px;
}

/* A host rule's first line: the host, the environment answering for it and
   Remove at its right, each box as wide as what it holds, wrapping on a
   narrow screen. */
.extension-host-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 16px;
  min-width: 0;
}

.extension-host-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.extension-host-field .form-label {
  margin: 0;
}

/* A host name is a few dozen characters; its field takes that much of the
   line and the box fills its field. */
.extension-host-field.is-host {
  flex: 0 1 24rem;
}

.form-select.extension-host-environment {
  width: auto;
  max-width: 100%;
}

/* Remove is the line's last word, at its right and apart from the boxes,
   since it takes the whole rule away. */
.extension-host-remove {
  margin-left: auto;
  align-self: center;
}

/* Remove sits apart from the ticks above it, since it is the one that takes
   the whole rule away. */
.extension-alert-remove,
.extension-share-remove {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.settings-addin-alt {
  margin-top: 16px;
}

.settings-addin-alt > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.settings-addin-script {
  margin: 8px 0;
  padding: 12px;
  overflow-x: auto;
  font-size: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Settings > Alerts: the state line over the form, and the ticks, one a
   line since each carries a sentence saying what the card holds. */
.settings-alerts-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-alerts-panel a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.settings-alerts-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}

.settings-alerts-ticks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Where a draft's rows came from, under the table they landed in. */
.vault-taken {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

/* The brand mark on a page that belongs to no app - the launcher, and the auth
   pages. It is what keeps EXACTLY ONE copy of the theme logo in a document that
   has no sidebar to hold one; see the {{else}} in layout.html's topbar and
   TestLayoutEmitsTheThemeLogoAtMostTwice. */
.topbar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* No width or height here on purpose. The mark inside is the same .brand-logo
   img or .brand-logo-theme span the sidebar renders, and those already size it to
   120x28. Declaring a second set of numbers here is exactly what made the logo
   grow and shrink as the reader moved between an app and the launcher. */

/* The launcher sits in the very top-left corner of the page, in the sidebar's own
   header: .sidebar-header and .topbar are the same height and form one band across
   the top, so the corner is the sidebar's to own.

   The topbar carries a second copy for the states where that corner is not showing
   a full sidebar column, and these rules are what keep EXACTLY ONE of the two
   visible at any width. The alternative was a flag threaded through both shells to
   render one or the other, which would have had to be read by every block between
   here and the two call sites. */
.sidebar-waffle {
  flex-shrink: 0;
}

/* Qualified with .btn for the reason .btn.topbar-icon-btn is, a few rules below:
   .btn declares display: inline-flex and is a single class declared LATER in this
   file, so an unqualified .topbar-waffle silently lost the hide it was asking for
   and both copies rendered at once. Every rule that reveals it again outranks
   this one. */
.btn.topbar-waffle {
  display: none;
}

/* No sidebar at all: the launcher page and the auth pages. The topbar starts at
   the left edge there, so its copy IS the corner. */
body.app-nosidebar .topbar-waffle {
  display: inline-flex;
}

/* And when it is the corner it has to be laid out like one. .sidebar-header's
   padding, so the waffle does not move as the reader flicks between an app and
   the launcher; the gap is already the 12px both share. */
body.app-nosidebar .topbar {
  padding-left: 16px;
}

/* The collapsed icon rail has 52px of header and gives them to the customer's
   brand mark, which is per customer and the one piece of chrome that says whose
   product this is. The waffle moves to the topbar rather than displacing it. */
.nav-toggle:not(:checked) ~ .sidebar .sidebar-waffle {
  display: none;
}

.nav-toggle:not(:checked) ~ .main-wrapper .topbar-waffle {
  display: inline-flex;
}

/* The bare shell is a shared form link: its viewer is there to fill in one form
   and may hold no modules at all, so they are offered no launcher. Same reasoning
   as body.app-bare .topbar-nav-toggle in the responsive block below. It outranks
   the two rules above on specificity, so neither can reveal it. */
body.app-bare .topbar-waffle {
  display: none;
}

.topbar-spacer {
  flex: 1;
}

/* The topbar's icon controls are btn btn-icon-only btn-icon-ghost like every
   other borderless icon button; this class is now only the topbar's own sizing.
   It used to be a full parallel implementation - one of the five the review found
   (issue #163) - which is why the theme toggle and Settings cog looked slightly
   different from the identical controls in a Comply or Validate row.

   The topbar is a taller, sparser band than a dense table row, so its icon
   buttons get a little more room than the shared 28px square. That is the only
   difference left.

   Qualified past the shared .btn.btn-icon-only square, which is declared later
   in the file and would otherwise win on source order - an unqualified
   .topbar-icon-btn silently lost the size it was asking for. */
.btn.btn-icon-only.topbar-icon-btn {
  width: 30px;
  height: 30px;
  padding: 7px;
  flex-shrink: 0;
}

/* The light/dark toggle carries BOTH icons and shows whichever matches the
   current theme, so which one is visible is a stylesheet question rather than a
   JavaScript one. That is what lets both come from real assets through the
   mdi-icon helper; theme.js previously held their MDI paths as string constants
   and rewrote a `d` attribute (issue #178).

   Dark is the default, so the sun (click = go light) shows unless
   data-theme="light" is set, which is the same signal the palette itself flips
   on. Named to say which theme they belong to, not which action they perform,
   because the selector below reads better that way. */
.theme-toggle-icon-light {
  display: none;
}

html[data-theme="light"] .theme-toggle-icon-dark {
  display: none;
}

html[data-theme="light"] .theme-toggle-icon-light {
  display: block;
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  margin-left: 2px;
}

.topbar-profile-avatar {
  width: 28px;
  height: 28px;
  background: var(--accent-dim);
  border: 1px solid rgba(0, 201, 167, 0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  overflow: hidden;
}

.topbar-profile-avatar svg {
  width: 15px;
  height: 15px;
}

/* The Graph profile photo. Square renditions are what Graph returns, but an
   original can be any aspect ratio, so cover + centre rather than stretch. */
.topbar-profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Shown in the photo's place when the user has none - see TemplateData.Initials. */
.topbar-profile-initials {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--accent);
  user-select: none;
}

/* The words under a code (the code-over-words partial): a line of their own
   in a hint's size and colour, wrapping even inside a table that keeps its
   cells to one line. */
.code-words {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: normal;
}

/* --- People chips ---
   Somebody a record names - its owner, who made it - drawn as the topbar draws
   the signed-in person: a circle holding their directory photo or their
   initials, served by /people/avatar (cmd/website/person.go), with the name
   beside it where the chip has room. The avatar is sized here rather than by
   the <img>'s own width attribute alone, because a row's chip and a modal's
   chip want different sizes of the same picture. */
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  vertical-align: middle;
}

.person-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  background: var(--accent-dim);
  border: 1px solid var(--border);
}

.person-chip-name {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-chip-sm .person-avatar {
  width: 20px;
  height: 20px;
}

.person-chip-lg .person-avatar {
  width: 36px;
  height: 36px;
}

/* A group of people (the people-stack partial): a face each, every face
   after the first drawn over the one before it, with a ring in the card's own
   colour keeping the circles apart, and the names on the line beside them.
   The same 24px picture person-chip draws, so one person reads the same in a
   stack as alone. A face covers a quarter of the one before it, which is as
   far as two initials can be covered and still be read (a third turned "BO"
   into "B("), and the face under the pointer comes forward whole. */
.people-stack {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  max-width: 100%;
  min-width: 0;
  vertical-align: middle;
}

.people-stack-faces {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.people-stack-face,
.people-stack-more {
  box-shadow: 0 0 0 2px var(--surface);
}

.people-stack-face + .people-stack-face,
.people-stack-face + .people-stack-more {
  margin-left: -6px;
}

.people-stack-face:hover {
  z-index: 1;
}

.people-stack-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
}

.people-stack-names {
  font-size: 13px;
  color: var(--text);
}

.people-stack-other {
  font-size: 12px;
  color: var(--text-muted);
}

/* A record's history (the provenance-history partial): who made it and who
   last changed it under the Owner box of every editor that has one, and on
   its own under a script or a journey template's card - one chip each,
   wrapping on a narrow dialog. */
.provenance-history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 8px;
  font-size: 12px;
}

.provenance-history-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* The address and the moment beside a history chip, in the muted text the
   label before it uses, so the chip's name is what reads first. */
.provenance-history-when {
  font-size: 11px;
}

/* A chip with its words on a card or a list row that is prose rather than a
   table cell: a journey template's "Added by". */
.provenance-added-by {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-top: 6px;
}

/* --- Preferences dialog ---
   Where each value in force came from is said in two words beside it, and
   the directory's own reading sits under the three fields it has a word on.
   The environment a person works in is under a heading of its own below
   them, since no directory says it. */
.prefs-source {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.prefs-source-chosen {
  color: var(--accent);
  border-color: rgba(0, 201, 167, 0.35);
}

.prefs-source-directory {
  color: var(--text);
}

.prefs-source-default {
  font-style: italic;
}

/* The dialog holds four selects and a sentence each: narrower than the
   designer's, since nothing in it is a table. */
.prefs-modal {
  width: min(560px, calc(100vw - 32px));
}

/* The two things the dialog holds, named: how a person is addressed and
   where they work. The second heading carries a rule above it, so the
   directory's sentence reads as the end of the first part. */
.prefs-heading {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.prefs-heading ~ .prefs-heading {
  margin: var(--space-3) 0 10px;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.prefs-lead {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* The model a person prefers: the provider and its model side by side, one
   question, on a phone one under the other. */
.prefs-model {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
  margin-top: 4px;
}

@media (max-width: 560px) {
  .prefs-model { grid-template-columns: 1fr; }
}

.prefs-directory {
  margin: 4px 0 12px;
  font-size: 12px;
  line-height: 1.5;
}

/* A chip in a table cell is the picture alone (Words off), so the column stays
   narrow and the name is the tooltip and the alt text. */
.person-col {
  width: 44px;
  text-align: center;
}

.topbar-profile-name {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Topbar profile menu ---
   A <details>/<summary> disclosure, so the open/close state, keyboard operation
   and Escape-to-close are the browser's job rather than ours. */
.topbar-profile-menu {
  position: relative;
  margin-left: 2px;
}

/* The default triangle marker would sit alongside our own caret. */
.topbar-profile-menu > summary {
  cursor: pointer;
  list-style: none;
  border: 1px solid transparent;
}

.topbar-profile-menu > summary::-webkit-details-marker {
  display: none;
}

.topbar-profile-menu > summary:hover,
.topbar-profile-menu[open] > summary {
  background: var(--surface-hover);
  border-color: var(--border);
}

.topbar-profile-menu > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.topbar-profile-caret {
  width: 13px;
  height: 13px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.topbar-profile-menu[open] .topbar-profile-caret {
  transform: rotate(180deg);
}

.topbar-profile-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 210px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

/* The full identity, spelled out where there is room for it - the summary
   truncates to fit the topbar. */
.topbar-profile-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.topbar-profile-identity-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.topbar-profile-identity-email {
  font-size: 11px;
  color: var(--text-faint);
  word-break: break-all;
}

/* The access summary: one row per module, ticked or crossed. */
.topbar-profile-access {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.topbar-profile-access-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 3px;
}

.topbar-profile-access-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}

/* A granted row is legible, an ungranted one is visibly off. The tick and cross
   glyphs differ too - this is not colour-only - but at 13px they are similar enough
   that the row itself should carry the answer at a glance. */
.topbar-profile-access-row:has(.topbar-profile-access-no),
.topbar-profile-access-row:has(.topbar-profile-access-unlicensed) {
  color: var(--text-faint);
}

/* Administrator grants everything, so it reads as a heading for the rest rather
   than one more item in the list. */
.topbar-profile-access-admin {
  font-weight: 600;
  padding-bottom: 3px;
}

.topbar-profile-access-yes,
.topbar-profile-access-no,
.topbar-profile-access-unlicensed {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.topbar-profile-access-yes {
  color: var(--accent);
}

.topbar-profile-access-no {
  color: var(--text-faint);
}

.topbar-profile-access-unlicensed {
  color: var(--text-faint);
}

/* "Not licensed" is the answer to a different question than a missing role, so it is
   spelled out rather than left to a glyph: no administrator can grant it, and the
   reader needs to know that before they raise a ticket with the wrong person. */
.topbar-profile-access-note {
  font-size: 10px;
  font-style: italic;
  color: var(--text-faint);
}

/* The build identifier. Deliberately quiet - it is reference information someone
   reads out when asked, not something to draw the eye every time the menu opens. */
.topbar-profile-version {
  display: block;
  padding: 6px 10px 2px;
  font-size: 10px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  cursor: default;
  user-select: all;
}

.topbar-profile-action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.topbar-profile-action:hover {
  background: var(--surface-hover);
}

.topbar-profile-action-svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* --- Scratch pad ---
   Every control that acts on the pad is the shared .btn.btn-icon-only square
   (28px, 44px on a coarse pointer), its icon from MDI's clipboard family drawn
   through mdi-icon in currentColor, so it is the theme's text colour: white on
   the dark theme, dark on the light one. A record already on the pad draws the
   minus; the square is a toggle. See cmd/website/scratchpad.go. */
.scratchpad-square {
  position: relative;
  flex-shrink: 0;
}

.scratchpad-square-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.scratchpad-add.is-on,
.scratchpad-add-shown.is-on {
  border-color: var(--accent);
}

.scratchpad-add.is-refused,
.scratchpad-add-shown.is-refused {
  border-color: var(--sev-warn-border);
  color: var(--sev-warn-text);
}

/* A square between its press and its answer: disabled by the request itself
   (hx-disable), and drawn at work, its icon pulsing, so a press says it was
   taken before anything comes back. Nothing said so, and a press that took a
   while read as a square that did not answer. Full strength, row or not, so
   the row's faint square at rest cannot hide it; and qualified past the
   shared button's own disabled rule, whose cursor says the control may not be
   used, where this one is being used. */
.btn.scratchpad-square:disabled {
  opacity: 1;
  cursor: progress;
  border-color: var(--accent);
}

.btn.scratchpad-square:disabled .scratchpad-square-icon {
  animation: scratchpad-working 0.9s ease-in-out infinite alternate;
}

@keyframes scratchpad-working {
  from { opacity: 1; }
  to { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .btn.scratchpad-square:disabled .scratchpad-square-icon {
    animation: none;
    opacity: 0.5;
  }
}

/* Why a press over a table was refused, beside its square. */
.scratchpad-shown.is-refused {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.scratchpad-refusal {
  color: var(--sev-warn-text);
  font-size: 12px;
  line-height: 1.3;
}

/* In a table's row the square is faint at rest and lit on hover or focus,
   never hidden: a finger has no hover. */
.scratchpad-add-row {
  opacity: 0.55;
  transition: opacity 0.15s;
}

.scratchpad-add-row:hover,
.scratchpad-add-row:focus-visible,
.scratchpad-add-row.is-on,
tr:hover .scratchpad-add-row {
  opacity: 1;
}

/* In an explorer's list, a Fields table and the menu tree the square follows
   the record's name in its own cell, a size down so the row keeps its height. Qualified past .btn.btn-icon-only, declared later. */
.explorer-table .btn.scratchpad-add-row,
.explorer-detail-table .btn.scratchpad-add-row,
.menu-tree-leaf .btn.scratchpad-add-row,
.compare-results-table .btn.scratchpad-add-row,
.row-detail-table .btn.scratchpad-add-row,
td > .scratchpad-shown .btn.scratchpad-add-row {
  width: 22px;
  height: 22px;
  margin-left: 6px;
  vertical-align: middle;
}

.explorer-table .scratchpad-add-row .scratchpad-square-icon,
.explorer-detail-table .scratchpad-add-row .scratchpad-square-icon,
.menu-tree-leaf .scratchpad-add-row .scratchpad-square-icon,
.compare-results-table .scratchpad-add-row .scratchpad-square-icon,
.row-detail-table .scratchpad-add-row .scratchpad-square-icon,
td > .scratchpad-shown .scratchpad-add-row .scratchpad-square-icon {
  width: 14px;
  height: 14px;
}

/* Beside a record's code chip, or its title where it has none. */
.page-title-code .scratchpad-add,
.page-title .scratchpad-add {
  margin-left: 8px;
  vertical-align: middle;
}

/* How many records a square stands for, small in its corner. */
.scratchpad-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--sev-info-bg);
  border: 1px solid var(--sev-info-border);
  color: var(--sev-info-text);
  font-size: 10px;
  font-weight: 600;
  line-height: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.scratchpad-shown {
  display: inline-flex;
  margin: 0;
  vertical-align: middle;
}

/* A results row's square (a compared row's differences, a validated row's
   finding) has a slot of its own after the status pill, drawn on every row
   while any row on the page has one, so a pill with no square beside it sits
   where the pills with one do rather than centring a square's width away. */
.scratchpad-row-slot {
  display: inline-block;
  width: 28px;
  text-align: left;
  vertical-align: middle;
}

.scratchpad-row-slot > .scratchpad-shown {
  vertical-align: top;
}

/* A row's square beside the row's own status pill or field name. */
td > .scratchpad-shown {
  margin-left: 6px;
}

.known-item-take {
  display: inline-flex;
  align-items: center;
}

.known-item-take:not(:has(button)) {
  display: none;
}

.scratchpad-copy .table-tool-done {
  display: none;
}

.scratchpad-copy.is-copied .table-tool-copy {
  display: none;
}

.scratchpad-copy.is-copied .table-tool-done {
  display: block;
  color: var(--sev-ok-text);
}

/* The topbar's control, the anatomy of the activity indicator's. */
.topbar-scratchpad {
  position: relative;
}

.topbar-scratchpad-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  transition: background 0.15s, color 0.15s;
}

.topbar-scratchpad-summary::-webkit-details-marker {
  display: none;
}

.topbar-scratchpad-summary:hover,
.topbar-scratchpad[open] > .topbar-scratchpad-summary {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text);
}

.topbar-scratchpad-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.topbar-scratchpad-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.topbar-scratchpad-count {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--sev-info-bg);
  color: var(--sev-info-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.topbar-scratchpad-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: 384px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.topbar-scratchpad-body .empty-inline,
.scratchpad-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-faint);
}

.scratchpad-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border);
}

.scratchpad-panel-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.scratchpad-panel-sub {
  font-size: 11px;
  color: var(--text-faint);
}

.scratchpad-alert {
  margin: 6px;
  padding: 6px 10px;
  font-size: 12px;
}

.scratchpad-group + .scratchpad-group {
  border-top: 1px solid var(--border);
}

.scratchpad-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px 4px;
}

.scratchpad-group-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.scratchpad-group-count {
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

.scratchpad-group-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* One line an item: its icon, its words, its code, where it was seen and the
   minus that takes it off. Everything else is in the line's tooltip. */
.scratchpad-row {
  display: grid;
  grid-template-columns: 16px minmax(96px, 1fr) minmax(0, max-content) minmax(0, max-content) auto;
  align-items: center;
  gap: 8px;
  padding: 3px 6px 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.scratchpad-row:hover {
  background: var(--surface-hover);
}

.scratchpad-row-icon {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.scratchpad-row-where {
  display: inline-flex;
  min-width: 0;
}

.scratchpad-row-words,
.scratchpad-row-code {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.scratchpad-row-words {
  color: var(--text);
}

.scratchpad-row-code {
  max-width: 120px;
  font-size: 11px;
}

.scratchpad-row-code code {
  font-size: 11px;
}

.scratchpad-env {
  max-width: 72px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  line-height: 16px;
}

/* The popover's squares are a size down, so a line stays a line. */
.scratchpad-panel .btn.scratchpad-square {
  width: 24px;
  height: 24px;
}

/* The items a refusal is about, a press away under its sentence. */
.scratchpad-problem-list {
  margin-top: 6px;
}

.scratchpad-problem-list summary {
  cursor: pointer;
  font-weight: 600;
}

.scratchpad-problem-list ul {
  margin: 6px 0 0;
  padding-left: 18px;
  max-height: 200px;
  overflow-y: auto;
}

.scratchpad-gone {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

.scratchpad-panel-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 6px 4px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.scratchpad-spacer {
  flex: 1;
}

/* The whole pad, a wide modal. */
.scratchpad-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  align-items: start;
  gap: 8px;
}

.scratchpad-add-fields {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
}

.scratchpad-add-fields .form-select:last-child {
  grid-column: 2;
}

.scratchpad-add-names {
  min-height: 64px;
  resize: vertical;
}

.scratchpad-add-hint {
  margin: 4px 0 12px;
}

.scratchpad-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.scratchpad-filter .form-input {
  max-width: 320px;
}

.scratchpad-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.scratchpad-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.scratchpad-card-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.scratchpad-card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.scratchpad-card-table {
  margin: 0;
  border: 0;
  border-radius: 0;
}

/* A card's facts are a line each, the card scrolling sideways in its wrapper:
   a difference carries a dozen facts, and wrapped into the modal's width each
   row stood five lines tall. The tooltip carries a value a line cuts. Named
   on the table with .data-table, or the shared density rules outrank it. */
.data-table.scratchpad-facts-table td {
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scratchpad-tick-col {
  width: 32px;
}

/* From scratch pad on the Collections page: the take square opening a short
   menu of the types the pad holds. */
.scratchpad-take-menu {
  position: relative;
}

.scratchpad-take-menu > summary {
  list-style: none;
}

.scratchpad-take-menu > summary::-webkit-details-marker {
  display: none;
}

.scratchpad-take-menu-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 200px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.scratchpad-take-menu-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
}

.scratchpad-take-menu-item:hover {
  background: var(--surface-hover);
}

/* --- Topbar activity indicator ---
   Work in flight and approvals waiting, across every module the reader can open.
   A native <details> for the same reasons the profile menu is one, and positioned
   the same way. See cmd/website/activity_status.go for what it reports. */
.topbar-activity {
  position: relative;
}

.topbar-activity-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  transition: background 0.15s, color 0.15s;
}

/* The default disclosure triangle would sit alongside the bell. */
.topbar-activity-summary::-webkit-details-marker {
  display: none;
}

.topbar-activity-summary:hover,
.topbar-activity[open] > .topbar-activity-summary {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text);
}

.topbar-activity-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.topbar-activity-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Informational by default. An approval is asking for something, so it is not the
   same colour as a count of work that is merely busy - ten running jobs must not
   visually bury one thing waiting on a person. */
.topbar-activity-count {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--sev-info-bg);
  color: var(--sev-info-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.topbar-activity-count-waiting {
  background: var(--sev-warn-bg);
  color: var(--sev-warn-text);
}

.topbar-activity-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: 328px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

/* What the panel leaves out of a long group, said under the rows it lists. */
.activity-more {
  margin: 0;
  padding: var(--space-1) var(--space-3) var(--space-2);
  color: var(--text-muted);
  font-size: 12px;
}

.activity-group + .activity-group {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
}

.activity-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  /* Muted rather than faint, as every word the activity list draws is:
     faint is a ground for decoration, under 4.5:1 against either theme's
     background, and these are words somebody reads. */
  color: var(--text-muted);
}

.activity-group-title-waiting {
  color: var(--sev-warn-text);
}

.activity-group-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.activity-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: start;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.activity-row:hover {
  background: var(--surface-hover);
}

/* The activity dropdown is a compact popover - its rows are 12px - so its empty
   line keeps that size and its fainter colour rather than taking the page-level
   .empty-inline treatment, which would make the "nothing here" line larger than
   the items it stands in for. */
#activity-list .empty-inline {
  padding-inline: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.activity-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.activity-row-icon {
  padding-top: 2px;
  color: var(--sev-info-text);
}

.activity-row-icon-waiting {
  color: var(--sev-warn-text);
}

.activity-row-icon-svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* Grid children, so they need to stack rather than sit inline. */
.activity-row-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.activity-row-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.activity-row-group {
  color: var(--text-muted);
  font-weight: 500;
}

/* A stage line can be long - "Comparing CustParameters" plus a lane label - and
   the panel is a fixed width, so it truncates rather than wrapping the row. */
/* Two lines and then an ellipsis, whole in the tooltip: a long job's detail
   names the part it is on and how far through it ("Web metadata (1 of 3):
   Labels in en-us (2 of 2): 300 of 1,200 labels"), and one line cut that to
   the part's name. */
.activity-row-detail {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* How far a running item has got, under its words. */
.activity-row-track {
  display: block;
  height: 4px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--surface-raised);
  overflow: hidden;
}

.activity-row-fill {
  display: block;
  height: 100%;
  width: var(--activity-row-percent, 0%);
  border-radius: 999px;
  background: var(--accent);
  transition: width 200ms ease-out;
}

.activity-row-percent {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.activity-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 1px;
}

.activity-row-elapsed {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.activity-row-chevron {
  width: 13px;
  height: 13px;
  color: var(--text-faint);
  flex-shrink: 0;
}

/* The panel answers the question rather than showing an empty box: unlike the nav
   badges, the indicator does not disappear when there is nothing to report. */
/* --- Main Content --- */
/* overflow-x is `clip`, not `hidden`, and the difference matters (issue #207).
   `hidden` makes this a SCROLL CONTAINER on the x axis: content past the right
   edge is not clipped away, it is parked at scrollLeft 0 where script can reach
   it but no user gesture can. That is invisible to the reader AND invisible to
   a scrollWidth-based check - measuring 20 pages at 390px reported a zero
   overflow delta on every one of them while the site was badly broken. `clip`
   creates no scroll container, so overflow is genuinely clipped and a layout
   assertion can see it.

   The pairing is deliberate and is not coerced: the spec only rewrites overflow
   combinations involving `visible`, and neither value here is. Anything that is
   legitimately wider than this box (tables, code blocks, the runbook step grid)
   owns its own overflow-x: auto wrapper rather than relying on an ancestor. */
/* position: relative makes this box the containing block of everything
   absolutely positioned inside it that has no nearer one, so it scrolls with
   the content and is clipped by it. Without it such an element measured from
   the document instead: the hidden tab radios (.tab-radio) sit at their place
   in the flow, so a strip far down a long page put a radio thousands of pixels
   below the window, outside this box's scroll, and the document grew to reach
   it. Pressing a tab's label focuses its radio and the browser scrolls it into
   view, and html and body being overflow: hidden does not stop a scroll the
   browser makes itself - so the whole shell, sidebar and topbar and all, was
   scrolled up the page and the window below it left grey. A Compare check
   listing 84 column gaps above its Results tab was the page that showed it.
   A walk of every page the sidebar reaches found nothing else measuring from
   outside this box but a heading hidden for sight, clipped to a pixel, and a
   dialog opened with showModal, which is drawn in the top layer whatever its
   containing block - which is why nothing else moves for it. */
.main-content {
  position: relative;
  flex: 1;
  overflow-y: auto;
  overflow-x: clip;
  min-width: 0;
}

/* --- Bare shell (layout-bare) ---
   A page with no sidebar and no topbar, used by a shared form-entry link. The
   content keeps #main-content and .main-content so every hx-target and every
   existing content style still applies; only the surrounding chrome is gone.

   .bare-shell replaces both .app-shell (the sidebar row) and .main-wrapper (the
   topbar column) with one full-height column, so .main-content's flex:1 and its
   own scrolling behave exactly as they do inside the full shell. Without the
   height here the content would size to itself and the page would scroll on
   <body> instead, which breaks the sticky footers the entry wizard uses. */
.bare-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* No overflow-x guard here on purpose. .main-content already provides one clip
   boundary for the shell; a second one nested inside it is what made overflow
   undiagnosable, because a failure could no longer name the element at fault -
   only whichever container happened to swallow it (issue #207). min-width: 0 is
   the declaration this actually needs, to size correctly inside its flex parent. */
.page-content {
  width: 100%;
  padding: 32px 28px 48px;
  min-width: 0;
  box-sizing: border-box;
}

/* --- Reusable full-width tool-page layout ---
   Opt-in wide wrapper for tool pages (file/SQL/DMF validation, registries).
   Fills the available content width so the 3-column layouts and tables use the
   whole screen. */
/* No overflow-x guard - see .page-content above for why. */
.tool-page {
  width: 100%;
  padding: 32px 28px 48px;
  min-width: 0;
  box-sizing: border-box;
}

/* Full-width tab bar for tool pages. */
.tool-tabs {
  width: 100%;
}

/* THE tab strip rule. One base, every call site.

   There was no base rule at all: ten tab strips each declared their own, seven
   of them declaring exactly these three properties, and the other three
   diverging. Two omitted flex-wrap (.compare-exec-tabs, .comply-util-tabs) and
   one was never styled anywhere (.migrate-push-target-tabs), so their tabs laid
   out in a single unwrapped row - 692px of tabs inside a 132px column on
   /compare/run - and were clipped past the fold with no way to reach them. You
   could not change tab on those pages at all on a narrow screen (issue #208).

   Wrapping rather than scrolling: a tab strip is a small, fixed set of
   destinations, and a wrapped second row is discoverable where a horizontal
   scroller with no visible affordance is not.

   Per-page classes now carry only what is genuinely different about them (a
   margin, an active-state colour). If you find yourself restating these three
   properties, the answer is almost always that you do not need to -
   TestTabBarHasSingleBaseRule in tool_tabs_css_test.go enforces it. */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Three-column responsive body; collapses to a single stacked column on
   narrow widths (straight 3 -> 1, no intermediate state). Columns stretch to
   share a uniform height so empty panes match their tallest sibling. */
.tool-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: stretch;
}

/* Two-column variant for tool pages without a third pane (e.g. SQL). */
.tool-columns.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 960px) {
  .tool-columns,
  .tool-columns.cols-2 {
    grid-template-columns: 1fr;
  }
}

.tool-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
  min-height: 200px;
  box-sizing: border-box;
}

.tool-column-title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Secondary heading for a sub-section WITHIN a .tool-column card (e.g. "Defaults",
   "Filters") -- same title+underline treatment as .tool-column-title, one step down
   in the hierarchy. Standard for any new sub-section heading inside a tool-column;
   see cmd/website/README.md "Page Layout & Styling Conventions". */
.tool-column-subheading {
  margin: 20px 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* The quiet sub-heading: the same words without the rule under them and with
   less room above, for a heading that labels a short run of content inside a
   card (Comply's process map: What it needs, What gives it, Duty pairs) where a
   rule under each would cut the card into strips. */
.tool-column-subheading-quiet {
  margin: 14px 0 6px;
  font-size: 13px;
  padding-bottom: 0;
  border-bottom: none;
}

/* Full-width action row beneath the column grid (e.g. the Run button). */
.tool-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Tab header row used by tabbed tool pages: tab bar on the left, action
   button(s) on the right. Action buttons are hidden by default and revealed
   per active tab via each page's :checked toggles. */
/* flex-wrap here for the same reason as .tab-bar: this row holds a tab strip
   AND a group of action buttons, and without it the actions are pushed off the
   right edge on a narrow screen and clipped - 95px of the primary button on
   /compare/run. Two templates had already discovered this and patched it
   locally (migrate push and pull); the base is where it belongs. */
.tool-tabs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 10px;
  gap: 16px;
  margin-bottom: 16px;
}
.tool-tabs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Groups a page's Templates controls (Load/Save/Delete) with its
   .tool-tabs-actions on the right side of .tool-tabs-header, so both sit on
   the same row as the tab bar - Templates first, action buttons after. */
.tool-tabs-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tool-tabs-actions button {
  display: none;
}

/* Shared pill skin for tabbed pages: the radio/label/panel styling that every
   tab group had been copying into its own ~35-line block. Opt in by writing
   class="tool-tabs tool-tabs-pills <page>-tabs" on the container.

   It is a modifier rather than part of bare .tool-tabs because a global
   .tool-tabs .tab-panel { display: none } would hide the panels of the older
   groups whose reveal selectors are written differently (.explorer-filter-tabs
   reveals through a .form-card intermediary, .results-tabs has its own
   variant). Opting in leaves those untouched; moving them across is a separate
   mechanical change.

   What this cannot cover is the :checked enumeration - CSS has no parent
   selector, so panel-reveal and active-label rules must name each radio id and
   stay with their page. TestToolTabsHaveTheirCSS asserts every tab declared in
   a template has both. */
/* Every CSS-radio tab strip hides its radios; the class is what makes one a tab
   radio in the first place, so the rule belongs to the class rather than to each
   strip. Fourteen page-level <style> blocks had redeclared it and
   compare/results.html inlined style="display:none" on each input instead (issue
   #164) - which is how a rule ends up stated fifteen times and still missing
   wherever somebody forgets it.

   Hidden but still FOCUSABLE, which is the whole point (issue #194). display:none
   and visibility:hidden take an element out of the accessibility tree and out of
   the tab order; opacity:0 does not. With display:none these strips could not be
   reached by Tab at all, arrow keys did nothing, and a screen reader was never told
   a tab set existed - invisible to anyone testing with a mouse, since clicking a
   <label> still worked.

   position:absolute with no offsets leaves the radio at its static position, so
   the browser's scroll-into-view on focus lands on the strip itself rather than
   somewhere unrelated. pointer-events:none only affects the mouse; keyboard focus
   is unaffected.

   Nothing else is needed to make the strips keyboard-operable, because these are
   real radio groups: arrow keys move focus AND the checked state together, so the
   existing per-id ":checked ~ ... label" rules already highlight the tab you are
   on as you arrow through it, and the panel switches with it. Tab enters the group
   at the checked radio and the next Tab leaves it - one tab stop for the strip,
   which is what the WAI-ARIA tab pattern expects. */
.tab-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}

/* A radio that decides which of the rows already on the page are shown rather
   than which panel is. Hidden the same way - position + opacity, so it keeps
   its place in the tab order - and deliberately not a .tab-radio: the tab
   guards require a panel-reveal rule per radio, and this reveals no panel. */
.filter-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}

/* ...and a ring so the reader can see the strip has keyboard focus at all, as
   distinct from merely showing which tab is selected.

   Scoped with a CHILD combinator on purpose: the tab panels are also inside
   .tool-tabs, so :focus-within - or :has() without the ">" - would light the ring
   whenever focus was in a form field inside a panel. Only a radio that is a direct
   child of the strip counts. Matches .fm .tile:has(input:focus-visible) below. */
.tool-tabs:has(> .tab-radio:focus-visible) .tab-bar {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.tool-tabs-pills .tab-label,
.record-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tool-tabs-pills .tab-label:hover,
.record-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.tool-tabs-pills .tab-label svg,
.record-tab svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.tool-tabs-pills .tab-panel {
  display: none;
}

/* A field still to be filled in, as against one filled in wrongly. Save keeps
   the first and refuses the second, so the two must not look the same: this is
   the colour of a notice, not of an error. */
.form-group.is-unfilled .form-input,
.form-group.is-unfilled .form-select,
.form-group.is-unfilled .form-textarea {
  border-color: var(--sev-warn-text);
}

.automate-field-unfilled {
  color: var(--sev-warn-text);
}

/* Settings > Utilisation: Usage and Storage. Two questions that take different
   periods - everything about people and services is counted over the window
   picked on the page, and what is on disk is what is on disk now - so a single
   column with one picker at the top was answering a question of the disk
   section that nobody had asked. */
#settings-utilisation-tab-usage:checked ~ .tab-panel[data-tab="usage"],
#settings-utilisation-tab-storage:checked ~ .tab-panel[data-tab="storage"] {
  display: block;
}

#settings-utilisation-tab-usage:checked ~ .tool-tabs-header .tab-bar label[for="settings-utilisation-tab-usage"],
#settings-utilisation-tab-storage:checked ~ .tool-tabs-header .tab-bar label[for="settings-utilisation-tab-storage"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Centred empty state inside a tab panel (no rows yet). */
.tab-panel-empty {
  padding: 40px;
  text-align: center;
}

/* The global .tool-tabs-actions button rule above hides *buttons* only, so a
   group whose per-tab action is an anchor needs it hidden too - otherwise the
   action shows on every tab rather than the one it belongs to.

   This is its own opt-in class rather than part of .tool-tabs-pills, which is
   where it used to live, because the two things are unrelated: .tool-tabs-pills
   is a look, and this is a behaviour that only the index pages want. The tab
   row on an editor page holds controls that belong to the whole form - Cancel,
   Back to Packages, an Export link, the inline link inside a save popover's
   hint text - and every one of those must show on every tab. Six such groups
   could not take the shared pill skin at all while the two were fused: opting
   in to the look silently hid a Back link or an Export button, and no test
   would have said so. Buttons already work this way (hidden globally, revealed
   per tab by the page), so this makes anchors match rather than inventing a
   third rule. */
.tool-tabs-actions-per-tab .tool-tabs-actions a {
  display: none;
}

/* One selector per tab, in both this list and the active-label list below. A tab
   added to environment_editor.html without an entry in BOTH renders a radio and a
   panel that nothing ever reveals - the tab button then looks live and shows an
   empty page. TestEnvironmentEditorTabsHaveTheirCSS guards that pairing. */
.environment-editor-tabs #environment-editor-tab-environment:checked ~ #environment-editor-panel-environment,
.environment-editor-tabs #environment-editor-tab-sql:checked ~ #environment-editor-panel-sql,
.environment-editor-tabs #environment-editor-tab-web:checked ~ #environment-editor-panel-web,
.environment-editor-tabs #environment-editor-tab-mcp:checked ~ #environment-editor-panel-mcp,
.environment-editor-tabs #environment-editor-tab-aot:checked ~ #environment-editor-panel-aot,
.environment-editor-tabs #environment-editor-tab-datacache:checked ~ #environment-editor-panel-datacache,
.environment-editor-tabs #environment-editor-tab-unified:checked ~ #environment-editor-panel-unified {
  display: block;
}

.environment-editor-tabs .tool-tabs-actions button {
  display: inline-flex;
}

.environment-editor-tabs #environment-editor-tab-environment:checked ~ .tool-tabs-header label[for="environment-editor-tab-environment"],
.environment-editor-tabs #environment-editor-tab-sql:checked ~ .tool-tabs-header label[for="environment-editor-tab-sql"],
.environment-editor-tabs #environment-editor-tab-web:checked ~ .tool-tabs-header label[for="environment-editor-tab-web"],
.environment-editor-tabs #environment-editor-tab-mcp:checked ~ .tool-tabs-header label[for="environment-editor-tab-mcp"],
.environment-editor-tabs #environment-editor-tab-aot:checked ~ .tool-tabs-header label[for="environment-editor-tab-aot"],
.environment-editor-tabs #environment-editor-tab-datacache:checked ~ .tool-tabs-header label[for="environment-editor-tab-datacache"],
.environment-editor-tabs #environment-editor-tab-unified:checked ~ .tool-tabs-header label[for="environment-editor-tab-unified"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Metadata Import/Export: its own section between the environment form and the
   danger zone, spanning the page like they do rather than taking .form-card's
   780px cap. Two equal halves so import and export read as one pair of opposites
   rather than a control and an afterthought. */
.environment-editor-tabs .env-metadata-io {
  margin-top: 20px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 12px 24px;
}

.env-metadata-io-title {
  margin: 0 0 4px;
}

.env-metadata-io-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .env-metadata-io-grid {
    grid-template-columns: 1fr;
  }
}

/* Fixed height on the hint so the two halves' controls start on the same line even
   when one sentence wraps and the other does not. */
.env-metadata-io-hint {
  margin: 0 0 8px;
}

.env-metadata-io-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
}

/* Fixed rather than flexible, for the same reason as the list page's import form:
   growing to fit a long filename would push the button out of line. */
.env-metadata-io-form input[type="file"] {
  flex: 0 1 16rem;
  min-width: 0;
}

/* The sentence a metadata bundle's form shows while its upload is in flight
   (its hx-indicator, on the environment page and on the list): hidden until
   htmx marks it, then a line of its own under the controls, spinner first.
   It is the whole of what the page says during an upload, which used to be
   nothing at all - and nothing at all is how Import came to be pressed twice. */
.env-metadata-io-uploading {
  display: none;
  flex-basis: 100%;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.env-metadata-io-uploading.htmx-request {
  display: flex;
}

/* A refused bundle's strip, inside the form it refuses, takes a row of its own
   above the controls rather than squeezing in beside them. */
.env-metadata-io-form > .alert,
.settings-footer-actions > .alert {
  flex-basis: 100%;
  margin: 0;
}

/* An import under way: what it is importing, a bar counting the files
   unpacked, and the step it is on with Cancel beside it. */
.env-metadata-import-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  min-width: 0;
}

.env-metadata-import-head,
.env-metadata-import-step {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.env-metadata-import-what {
  font-size: 12.5px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.env-metadata-import-step {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* A running refresh's progress on its card: the part it is on, and a bar once
   it can count. Below the form, across the card. */
.refresh-card-progress {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.refresh-card-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-raised);
  overflow: hidden;
}

.refresh-card-fill {
  display: block;
  height: 100%;
  width: var(--refresh-card-percent, 0%);
  border-radius: 999px;
  background: var(--accent);
  transition: width 200ms ease-out;
}

.refresh-card-progress-line {
  margin: 0;
  overflow-wrap: anywhere;
}

.refresh-card-percent {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.env-metadata-import-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-raised);
  overflow: hidden;
}

.env-metadata-import-fill {
  display: block;
  height: 100%;
  width: var(--env-metadata-import-percent, 0%);
  border-radius: 999px;
  background: var(--accent);
  transition: width 200ms ease-out;
}

.env-metadata-import-outcome {
  margin: 10px 0 0;
  overflow-wrap: anywhere;
}

/* What a refresh card or a copy row is waiting for while another metadata job
   of the environment runs that it may not run beside - the unified rebuild
   while a source is written, a source while the rebuild runs. Its button is
   disabled beside it, and the card polls until it can start. */
.refresh-card-blocked,
.seed-row-blocked {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

/* A row of its own across the copy row's grid, as its error line is. */
.seed-row-blocked {
  grid-column: 1 / -1;
}

/* Only the spacing above the box: the box itself is the shared .danger-zone. */
.environment-editor-tabs .environment-danger-zone {
  margin-top: 20px;
}

/* Tucked closer to the table it sits under, being a footnote to the list rather
   than the sole content of its tab. Everything else it shares with every other
   danger zone. */
.environment-editor-tabs .datacache-danger-zone {
  margin-top: 12px;
}

/* Second line of the Data Cache table's "Entity / Object" cell: what the rows
   are of, subordinate to the monospaced cache key above it. */
.datacache-table .datacache-object-line {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* The first line of the Data Cache table's "Entity / Object" cell: the name,
   and the reference data mark beside it where the item is some. A row of two,
   so the mark stays beside the name rather than alone on a line when the name
   wraps. */
.datacache-table .datacache-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* Reference data: what the product reads to decide things, marked on its rows,
   on the legend that says what the mark means, and on the Web tab's card that
   reads it again. The class lands on the svg itself (mdiIcon). */
.datacache-reference-mark {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--accent);
  cursor: help;
}

.datacache-reference-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--accent);
}

.datacache-reference-legend {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 4px 0 10px;
}

.datacache-reference-legend .datacache-reference-icon {
  margin-top: 2px;
}

/* An older build's file: listed so it can be deleted or pulled again, with the
   reason it cannot be read as one item said under its name, and the row's own
   facts stood back from so the reason is what reads first. */
.datacache-table tr.is-legacy td {
  color: var(--text-muted);
}

.datacache-table .datacache-legacy-line {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--sev-warn-text);
}

/* The Data Cache tab's older-files strip: the explanation takes the room and the
   one button that deletes them all sits beside it, under it on a narrow screen. */
.datacache-legacy-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.datacache-legacy-alert > span {
  flex: 1 1 320px;
}

/* The Data Cache tab's filters: the search box takes what room there is and the
   selects keep to their content beside it, wrapping under it on a narrow screen.
   Two classes, because .explorer-toolbar is declared further down and would
   otherwise spread the selects across the width with space-between. */
.explorer-toolbar.datacache-filters {
  justify-content: flex-start;
}

.datacache-filters input[type="search"] {
  flex: 1 1 260px;
  max-width: 420px;
}

.datacache-filters .form-select {
  width: auto;
  max-width: 100%;
}

/* Reading the files again is about the list as a whole, so it stands apart
   from the filters at the toolbar's right. */
.datacache-filters .datacache-rebuild {
  margin-left: auto;
}

/* Package Registry edit screen (Validate): Overview / Sources / Targets / Checks tabs. */
.pkg-edit-tabs #pkg-edit-tab-overview:checked ~ #pkg-edit-panel-overview,
.pkg-edit-tabs #pkg-edit-tab-sources:checked ~ #pkg-edit-panel-sources,
.pkg-edit-tabs #pkg-edit-tab-targets:checked ~ #pkg-edit-panel-targets,
.pkg-edit-tabs #pkg-edit-tab-checks:checked ~ #pkg-edit-panel-checks {
  display: block;
}

.pkg-edit-tabs .tool-tabs-actions button {
  display: inline-flex;
}

.pkg-edit-tabs #pkg-edit-tab-overview:checked ~ .tool-tabs-header label[for="pkg-edit-tab-overview"],
.pkg-edit-tabs #pkg-edit-tab-sources:checked ~ .tool-tabs-header label[for="pkg-edit-tab-sources"],
.pkg-edit-tabs #pkg-edit-tab-targets:checked ~ .tool-tabs-header label[for="pkg-edit-tab-targets"],
.pkg-edit-tabs #pkg-edit-tab-checks:checked ~ .tool-tabs-header label[for="pkg-edit-tab-checks"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Package Registry edit screen (Compare): Overview / Sources / Checks tabs. */
.cmp-pkg-edit-tabs #cmp-pkg-edit-tab-overview:checked ~ #cmp-pkg-edit-panel-overview,
.cmp-pkg-edit-tabs #cmp-pkg-edit-tab-sources:checked ~ #cmp-pkg-edit-panel-sources,
.cmp-pkg-edit-tabs #cmp-pkg-edit-tab-checks:checked ~ #cmp-pkg-edit-panel-checks {
  display: block;
}

.cmp-pkg-edit-tabs .tool-tabs-actions button {
  display: inline-flex;
}

.cmp-pkg-edit-tabs #cmp-pkg-edit-tab-overview:checked ~ .tool-tabs-header label[for="cmp-pkg-edit-tab-overview"],
.cmp-pkg-edit-tabs #cmp-pkg-edit-tab-sources:checked ~ .tool-tabs-header label[for="cmp-pkg-edit-tab-sources"],
.cmp-pkg-edit-tabs #cmp-pkg-edit-tab-checks:checked ~ .tool-tabs-header label[for="cmp-pkg-edit-tab-checks"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Shared list toolbar and pager, used by every paginated list in the app: the
   four Discover explorers, the Comply directory and run-log result, the cached
   entity row view, and the environment editor's Data Cache tab. These five class
   names shipped in those templates with no rules at all, so the count and the
   pager stacked as plain block text and .pager-btn was a bare link. */
.explorer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}

.explorer-count {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* A list whose Attributes legend leads the toolbar's line (the Data Entity
   Explorer's, "explorer-list-toolbar" with a Legend): the legend sits where
   the count was and the count goes right, beside the controls, so the legend
   costs the table no line of its own. */
.explorer-toolbar > .explorer-attr-legend {
  margin: 0;
}
.explorer-toolbar > .explorer-attr-legend + .explorer-count {
  margin-left: auto;
}

/* The line under a Discover explorer's table naming the metadata source each
   column comes from. It was the same inline style copied into all seven
   explorer pages. */
.explorer-source-note {
  font-size: 0.78em;
  margin-top: 0.4rem;
}

.explorer-pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* The second pager, under the rows rather than over them: it needs the gap the
   one above the table gets from the heading it follows. */
.explorer-pager-bottom {
  margin-top: var(--space-3);
}

/* A Discover metadata explorer's list (explorer_window.go): the toolbar, the
   table and the line naming each column's source, in a frame of their own
   under the filters. The table scrolls inside its own box, and its heading
   sticks to that box's top, so a page of 100 or 200 rows keeps its headings,
   the filters and the toolbar with its pager in sight while the rows scroll;
   the heading sticks to the box rather than to the page because the box is
   the nearest thing that scrolls, which is the Row Detail's rule (see
   .row-detail > .table-wrapper). The thead sticks rather than each th, and
   the rule under it is a shadow, for the reasons given there. */
.explorer-rows > .table-wrapper {
  overflow: auto;
}

.explorer-rows .explorer-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.explorer-rows .explorer-table thead th {
  box-shadow: inset 0 -1px 0 var(--border);
}

/* Every row of a list is one line - a name beside its badges, a caption
   whole - so every row is the same height and a page fitted to the window
   holds exactly the rows it was fitted for, whichever page it is. Rows that
   wrapped were taller than the rows the page was measured by, and the last
   of them went under the foot of the box. A value too long for the width the
   table has makes the table wider instead, and the box scrolls sideways. */
.explorer-rows .explorer-table td {
  white-space: nowrap;
}

/* On a wide screen the list page fills the window rather than flowing down
   it - the results pages' and the Automate designer's shape. The page is a
   flex column with a definite height (.main-content has one, from
   .main-wrapper's 100vh), the frame takes what the header and the filters
   leave, and the table's box takes what the frame's toolbar and note leave
   and no more, so the foot of the table is the foot of the window and the
   page itself never scrolls. Fit to screen (table-fit.js) then pages the list
   to exactly the rows that room holds; a larger page size scrolls inside the
   box. A short list keeps its own height (flex: 0 1 auto), so its note sits
   under its last row rather than at the foot of an empty frame. The floor
   on the frame is what a reader can still use, and a window shorter than it
   scrolls as before. Below 961px the page flows, as the results pages do,
   since four stacked bands of filters leave a phone no room to fit. */
@media (min-width: 961px) {
  .explorer-list-page:has(> .explorer-rows) {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: 12px;
  }

  .explorer-list-page > :not(.explorer-rows) {
    flex: none;
  }

  .explorer-list-page > .explorer-rows {
    flex: 1 1 auto;
    min-height: 180px;
    display: flex;
    flex-direction: column;
  }

  .explorer-rows > :not(.table-wrapper) {
    flex: none;
  }

  .explorer-rows > .table-wrapper {
    flex: 0 1 auto;
    min-height: 0;
  }
}

/* Sized off .btn-sm so a pager sitting near row action buttons lines up with
   them, but neutral-coloured: this is navigation, not an action. */
.pager-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pager-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface-hover);
}

/* Tabular figures so the page number does not shift the Next button sideways as
   the digit count changes. */
.pager-info {
  padding: 0 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.explorer-filter-tabs .explorer-filter-card {
  max-width: none;
  width: 100%;
}

/* A filter card laid out as a row of labelled fields, label above control as
   Compare's and Validate's forms are, ends with the card rather than with the
   row's own margin. */
.explorer-filter-card > .form-row:last-child {
  margin-bottom: 0;
}

.explorer-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: end;
}

/* The advanced-search grid on the Discover explorers takes the card's full
   width. It used to be capped at 820px, which fits only three fields at
   .explorer-filter-field's 240px basis - so the Data Entity explorer's fourth
   (Sources) wrapped onto a row of its own while the card around it sat twice as
   wide as the cap, and the three above it held inputs too narrow to show their
   own placeholder. Nothing here needs a cap: .explorer-filter-field carries the
   flex-basis that keeps a field readable, and flex-wrap handles a viewport too
   narrow for the row. */
.explorer-filter-grid-2 {
  width: 100%;
}

.explorer-filter-field {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  flex: 1 1 240px;
  min-width: 240px;
}

.explorer-filter-field .form-label {
  margin-bottom: 0;
  white-space: nowrap;
}

.explorer-filter-field .form-select,
.explorer-filter-field .form-input {
  width: 100%;
  min-width: 0;
}

.explorer-filter-grid .form-group {
  margin-bottom: 0;
}

/* A row of tick boxes standing as one filter's control (Sources, OData). */
.explorer-filter-checks {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  min-height: 2.2em;
}

/* A filter field that takes its own full-width row: a small control with a
   hint beneath it that runs the field's full width (rather than being
   squeezed into the narrow label column). The label column sizes to its own
   text so a longer label ("Max removals per suggestion") isn't clipped by
   the fixed 120px width the paired env/currency fields use. */
.explorer-filter-field.explorer-filter-field-full {
  flex-basis: 100%;
  align-items: start;
  grid-template-columns: max-content minmax(0, 1fr);
}

.explorer-filter-field .filter-field-control {
  min-width: 0;
}

.explorer-filter-field .form-input.filter-field-narrow {
  width: 110px;
}

.explorer-filter-field .filter-field-control .form-hint {
  margin: 6px 0 0;
  white-space: normal;
}

@media (max-width: 940px) {
  .explorer-filter-field {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .explorer-filter-field .form-label {
    white-space: normal;
  }
}

/* Generic - every metadata explorer's tab bar follows the "{page}-tab-search"
   / "{page}-tab-advanced" (and matching "{page}-panel-search" /
   "{page}-panel-advanced") ID convention, so one rule pair covers all of
   them instead of enumerating each page's IDs (a hardcoded per-page list
   here previously meant new explorer pages silently got no active-tab
   styling or panel visibility until this file was updated too). */
.explorer-filter-tabs input.tab-radio[id$="-tab-search"]:checked ~ .tool-tabs-header .tab-bar label[for$="-tab-search"],
.explorer-filter-tabs input.tab-radio[id$="-tab-advanced"]:checked ~ .tool-tabs-header .tab-bar label[for$="-tab-advanced"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.explorer-filter-tabs input.tab-radio[id$="-tab-search"]:checked ~ .form-card [id$="-panel-search"],
.explorer-filter-tabs input.tab-radio[id$="-tab-advanced"]:checked ~ .form-card [id$="-panel-advanced"] {
  display: block;
}

/* --- Page Header --- */
.page-header {
  margin-bottom: 28px;
}

.back-link {
  display: inline-block;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

.page-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--accent-dim);
  border-radius: var(--radius);
  margin-bottom: 14px;
  color: var(--accent);
}

.page-header-icon svg {
  width: 24px;
  height: 24px;
}

/* Tool-page header (shared "tool-header" partial): back-link on its own row,
   then a single full-width row with the icon, the title/subtitle text block,
   and an optional right-aligned action button. The full-width row lets long
   titles use the available width instead of wrapping. The header sits in its
   own full-width surface card to match the column panels below it. */
.tool-header {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.tool-header .back-link {
  display: inline-block;
  margin-bottom: 12px;
}
.tool-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tool-header .page-header-icon {
  margin-bottom: 0;
  flex-shrink: 0;
}
.tool-header-text {
  flex: 1;
  min-width: 0;
}
/* A title can be one unbroken word longer than a phone is wide - a validation
   target is headed by its path inside the upload, which has slashes and no
   spaces - and without a break it runs straight past the card's edge. break-word
   breaks such a word only where it cannot fit, so an ordinary title never
   changes. */
.tool-header-text .page-title {
  margin: 0;
  overflow-wrap: break-word;
}
.tool-header-text .page-subtitle {
  margin: 4px 0 0;
  max-width: none;
}
/* A header's status (tool-header's Status, a headerStatus) is a pill in a
   slot of its own, drawn even while it holds nothing so that an answer can
   swap it out of band; an empty slot takes no line and no gap. */
.tool-header-status {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
}
.tool-header-status:empty {
  display: none;
}
.tool-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tool-header-action-form { margin: 0; }

/* A page's few figures as compact tiles inside its header (tool-header's
   Stats), on the title's right: nearly square for a number, and a little
   wider for the one whose words need it (is-wide, a status pill). As a band
   of tiles 170px wide under the header they spent a band of the page's height
   on four figures, and the tiles were as wide as a sentence for a number of
   one digit. */
.summary-bar.tool-header-stats {
  flex: none;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 0 0 auto;
}
.summary-bar.tool-header-stats:empty {
  display: none;
}
.tool-header-stats .summary-stat-metric.tool-header-stat {
  flex: 0 0 auto;
  width: 80px;
  min-width: 0;
  max-width: none;
  min-height: 64px;
  padding: 8px 6px;
}
.tool-header-stats .summary-stat-metric.tool-header-stat.is-wide {
  width: auto;
  min-width: 112px;
  max-width: 220px;
  padding-inline: 10px;
}
.tool-header-stats .summary-stat-metric .summary-copy .summary-label {
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/* A stat that is people rather than a figure (headerStat.People): who an
   instance is assigned to, as their faces and names where the figure would
   be. Wider than a pill's tile, since a name is, and cut where it ends with
   the whole of it in the faces' tooltips. */
.tool-header-stats .summary-stat-metric.tool-header-stat.is-people {
  width: auto;
  min-width: 112px;
  max-width: 280px;
  padding-inline: 12px;
}
.tool-header-stat.is-people .summary-value {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
  font-weight: 600;
}
.tool-header-stat.is-people .people-stack {
  min-width: 0;
  max-width: 100%;
}
.tool-header-stat.is-people .people-stack-names {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A header whose actions are several (opt-in per page via the tool-header
   dict's ActionsWrap) keeps a readable width for its title and subtitle and
   puts the actions on a line of their own, still on the right, once the two
   would not share one: four buttons beside the Process map's title otherwise
   squeezed it into a column two words wide. */
.tool-header-wrap .tool-header-main {
  flex-wrap: wrap;
}
.tool-header-wrap .tool-header-text {
  flex: 1 1 420px;
}
/* Pins a header's actions to the bottom-right of the box (opt-in per page via
   the tool-header dict's ActionsBottom), for headers whose actions read as the
   page's toolbar rather than as a single headline action. */
.tool-header-actions-bottom {
  align-self: flex-end;
}
.tool-header-action {
  flex-shrink: 0;
}

/* On a phone the action row drops under the title instead of sharing its line:
   three buttons beside a long title otherwise squeeze the title into a column a
   word wide, with the buttons drawn over the subtitle. After the base rule
   above, or its margin-left: auto wins on source order and the row sits at the
   right of its own line. */
@media (max-width: 760px) {
  .tool-header-main {
    flex-wrap: wrap;
  }
  .tool-header-actions,
  .summary-bar.tool-header-stats {
    flex-basis: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
  .summary-bar.tool-header-stats {
    overflow-x: auto;
  }
}

.tool-header-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  line-height: 1;
  padding-top: 0;
  padding-bottom: 0;
}

.page-title {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.page-title-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
}
.page-title-link:hover {
  color: var(--accent);
}

.page-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  max-width: 640px;
}

/* A record's technical name under its friendly title (tool-header's Code):
   smaller and in the code face, linked out to Dynamics 365 where it can be. */
.page-title-code code {
  font-size: 13px;
  color: var(--text-muted);
}

.page-title-code-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}

.page-title-code-link:hover,
.page-title-code-link:hover code {
  color: var(--accent);
}

.page-title-code-icon {
  width: 13px;
  height: 13px;
}

/* --- Home Card Grid --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.env-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1040px) {
  .env-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .env-card-grid {
    grid-template-columns: 1fr;
  }
}

.tool-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
}

.env-card-grid .tool-card:not(.tool-card-add) {
  min-height: 152px;
}

.tool-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

/* A card whose body ends in an action row - the credentials list. Its buttons pin
   to the bottom-right corner instead of trailing the last line of description, so
   a row of cards carrying different amounts of detail still lines its buttons up.
   .card-grid already stretches the cards themselves to a common height. */
.tool-card-with-actions {
  /* The base card top-aligns its children, which leaves the body only as tall as
     its own text - nothing for the action row to be pushed to the bottom of. */
  align-items: stretch;
  /* Unlike every other tool card, this one is not itself a link: only the buttons
     inside it do anything, so a pointer cursor would promise a click target that
     is not there. */
  cursor: default;
}

.tool-card-with-actions .tool-card-body > .conn-slot-actions {
  margin-top: auto;
  /* On top of the body's 6px gap, so the buttons are not crowded against the last
     line when a card happens to be exactly full. */
  padding-top: 6px;
}

/* Settings > Services: a card's tool count and whether it is on sit at its
   foot, pinned there so a row of cards lines them up whatever each
   description runs to. .card-grid stretches the cards to one height; the
   body has to stretch with them for the foot to be pushed down. */
.tool-card.svc-card {
  align-items: stretch;
}

.svc-card-foot {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.svc-card-tools {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.svc-card-tools-icon {
  width: 14px;
  height: 14px;
}

.tool-card-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--module-dim, var(--accent-dim));
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  color: var(--module, var(--accent));
}

.tool-card-icon svg {
  width: 22px;
  height: 22px;
}

.tool-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-card-body h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.tool-card-body p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.env-card-line {
  margin: 0;
}

.env-card-client {
  color: var(--text-muted);
}

.tool-card-arrow {
  color: var(--text-faint);
  font-size: 18px;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.15s;
}

.tool-card:hover .tool-card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.guidance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.guidance-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.guidance-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  color: var(--accent);
}

.guidance-card-icon svg {
  width: 17px;
  height: 17px;
}

.guidance-card-body h4 {
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: 600;
}

.guidance-card-body p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.theme-card {
  align-items: center;
  min-height: 150px;
}

.theme-card-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim) inset;
}

.theme-card-icon {
  background: var(--surface-elevated);
  padding: 10px;
  width: 74px;
  height: 74px;
}

.theme-card-logo svg {
  width: 48px;
  height: 48px;
  display: block;
}

.theme-card-logo-dark {
  display: flex;
}

.theme-card-logo-light {
  display: none;
}

html[data-theme="light"] .theme-card-logo-dark {
  display: none;
}

html[data-theme="light"] .theme-card-logo-light {
  display: flex;
}

.theme-swatch-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08) inset;
}

.theme-active-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid transparent;
}

/* A theme that ships with the product, and the credential the deployment
   supplies: named as such on its card, where the theme's Active badge beside it
   is the other fact a card carries. Outlined rather than filled so the two read
   as different facts. */
/* A name with the padlock beside it, for something that cannot be changed or
   deleted here (the locked-name partial): a vault's environment, the
   deployment's own credential, the theme the product ships. A row, so the
   name wraps inside its own box and the padlock stays beside its first line;
   written inline after the name, a long one left the padlock alone on a line
   of its own. Muted, because it is a fact about the card rather than
   something to press. */
.locked-name {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
}

.locked-name-text {
  min-width: 0;
}

.locked-mark {
  display: inline-flex;
  flex: none;
  margin-top: 0.2em;
  color: var(--text-muted);
}

/* On the <svg> the mdi-icon helper renders, never on a wrapper. */
.locked-mark-icon {
  width: 15px;
  height: 15px;
}

.theme-builtin-badge,
.credential-builtin-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
}

/* --- Module card count pill --- */
/* Every app tile ends with its tool count on the same line, whatever length its
   description ran to, so the counts read as a column rather than as eight
   different heights. .card-grid already stretches the tiles to a common height;
   these three make the body fill that height so the count has a bottom to sit at,
   and keep the arrow at the top where it points at the heading. Exactly the shape
   .tool-card-with-actions uses for its action row. */
.app-card-grid .tool-card {
  align-items: stretch;
}

.app-card-grid .tool-card-arrow {
  align-self: flex-start;
}

/* margin-top only: the count is a padded pill, and a padding-top here would
   deform it rather than space it. auto already claims every spare pixel, so a
   short description leaves a gap and a full one still clears the last line by the
   body's own 6px. */
.app-card-grid .tool-card-count {
  margin-top: auto;
}

.tool-card-count {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
}

/* --- Module home page header --- */
.page-header-module {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.page-header-icon-lg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--accent-dim);
  border-radius: var(--radius);
  flex-shrink: 0;
  color: var(--accent);
}

.page-header-icon-lg svg {
  width: 36px;
  height: 36px;
}

.page-header-text {
  min-width: 0;
}

.page-header-text .page-title {
  margin-bottom: 4px;
}

/* --- Sidebar section toggle active state (module home) --- */
.nav-section-toggle.active {
  background: var(--accent-dim);
  color: var(--accent);
}

/* --- Forms --- */
/* `clip` rather than `hidden` (issue #203). The intent here has always been to
   keep a child from painting over the card's rounded corners, which `clip` does
   just as well - but `hidden` also made this a scroll container, so a table
   wider than the card was not clipped, it was parked at scrollLeft 0 where no
   gesture could reach it. On Forms > My submissions that silently swallowed the
   rightmost column, which is the one holding View and Open. The tables inside
   now carry their own .table-wrapper, and this no longer traps them if one is
   ever added without it. */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 780px;
  min-width: 0;
  box-sizing: border-box;
  overflow: clip;
}
/* Except while a box in the card is suggesting: an autocomplete's list is
   drawn below its box and often runs past the card's foot (the process map's
   Add an entry sits at the foot of its card), and a clipping card cut the
   list off at its edge, under the card below. Unclipped only while the list
   can be open, so the corners are kept the rest of the time. */
.form-card:has(.autocomplete:focus-within) {
  overflow: visible;
}

/* A card's own heading. It sits beside .form-card because it is that component's
   heading and not one module's: a card with a heading is a shape the product
   already had, drawn with a bare <h3> whose size came from nothing in
   particular. */
.form-card-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.form-card-title + .form-hint {
  margin-top: 0;
  margin-bottom: 16px;
}

/* Package preview cards fill their tool column instead of the default form-card cap. */
.sql-package-preview,
.fv-package-preview,
.cmp-package-preview {
  width: 100%;
}

.sql-package-preview .form-card,
.fv-package-preview .form-card,
.cmp-package-preview .form-card {
  max-width: none;
  width: 100%;
}

/* Run Compare's two-environment tabs: a chosen package decides how it compares
   and what, so the controls a comparison defined on the page fills in are put
   away while one is chosen (.cmp-defined-only) and the package's own are shown
   in their place (.cmp-package-only). Put away rather than redrawn, so clearing
   the package gives back what was typed; the server ignores them for a
   package's run. */
form:has(.cmp-run-package option:checked:not([value=""])) .cmp-defined-only,
form:not(:has(.cmp-run-package option:checked:not([value=""]))) .cmp-package-only {
  display: none;
}

/* The comparison method's three cards side by side, a third of the column
   each, rather than the card's fixed width, which put the third on a row of
   its own in a half-width column; one above another on a phone. */
.pkgd-kindrow.cmp-method-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 6px;
}

.cmp-method-cards .pkgd-kindcard {
  width: auto;
}

@media (max-width: 600px) {
  .pkgd-kindrow.cmp-method-cards {
    grid-template-columns: 1fr;
  }
}

/* What the chosen method asks for, under the cards. */
.cmp-method-detail {
  margin-top: var(--space-3);
}

/* A control group's groups: each golden record and the members held to it. */
.cmp-method-groups {
  margin: 6px 0;
  padding-left: 18px;
  font-size: 12.5px;
}

.cmp-method-groups li {
  margin: 2px 0;
}

/* What a chosen package decides, where the method cards would be. */
.cmp-run-package-fixed {
  margin-bottom: var(--space-4);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.cmp-run-package-line {
  margin: 2px 0 6px;
  font-size: 13px;
}

/* The two Submissions lists (My submissions, All Submissions) carry a Form,
   When, Stage, Pending with, Status, Submitted by and an actions column - the
   780px .form-card default left it compressed onto a handful of characters
   per column. Same override as the package-preview cards above, for the same
   reason: a table wants the width a form does not. */
.fm-submissions-page .form-card {
  max-width: none;
  width: 100%;
}
/* Settings > Services: every card on the list, a service's page and its
   instances takes the page's width. The cards there are mostly tables - what a
   service can do, the permissions it needs, the step settings, the harness's
   answer - and at the 780px default they stopped two-thirds of the way across
   a desktop with the rest of the page empty beside them. */
.svc-page .form-card {
  max-width: none;
  width: 100%;
}
/* The actions column shrink-wraps to its buttons (rather than sharing the
   1fr split every other column gets) and never wraps them onto separate
   lines - Open and View stacking on top of each other is exactly the
   compressed-column look this page is meant to fix. table-wrapper's own
   overflow-x:auto is the fallback if a viewport is too narrow even for that. */
.fm-submissions-page .data-table th.fm-sub-actions,
.fm-submissions-page .data-table td.fm-sub-actions {
  width: 1%;
  white-space: nowrap;
}
.fm-submissions-page .data-table td.fm-sub-actions .btn + .btn { margin-left: 6px; }

.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

/* Three fields that belong together read as a row of three, not as two and a
   stray. The modifier follows .tool-columns.cols-2's precedent rather than
   inventing a second way to say it. */
.form-row.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-row.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .form-row,
  .form-row.cols-3,
  .form-row.cols-4 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.form-label-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.required {
  color: var(--sev-prob-text);
}

.form-input,
.form-select {
  display: block;
  width: 100%;
  padding: 8px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s;
  outline: none;
  box-sizing: border-box;
}

.form-input[type="file"] {
  padding: 6px 11px;
  cursor: pointer;
}

/* An explanatory bulleted or numbered list inside a form card - the markers sit
   in the card's padding rather than outside it, and the block carries no top
   margin because the heading above already spaces it. Named here rather than
   written inline per page for the reason at the top of this file's README
   section: an inline style wins the cascade, so a later fix here would not
   reach a page that had its own copy. */
.hint-list {
  margin: 0 0 1rem 1.1em;
  padding: 0;
}

.hint-list:last-child {
  margin-bottom: 0;
}

/* A number or short-code field that would look absurd stretched to the full
   width of its form row - a spinner, a count, a currency amount. Named here
   rather than written inline per page, so the width is one value rather than
   thirty near-identical ones (see README, "A shared rule belongs in
   style.css"). */
.form-input-narrow,
.form-select-narrow {
  max-width: 160px;
}

/* A disabled control must read as inert, not merely refuse clicks: muted
   text on the muted surface, no focus affordance, and the cursor says so. */
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled,
.pkgd-listbox:disabled {
  background: var(--surface-alt);
  color: var(--text-muted);
  opacity: 0.65;
  cursor: not-allowed;
}

/* A read-only control reads the same way. Every auto-derived "Unique ID" field
   in the app is one - the slug is generated from the name and cannot change after
   creation - and each of the nine carried its own
   style="opacity:0.6;cursor:not-allowed" instead (issue #164). The element already
   states the semantic in its readonly attribute, so this is the stylesheet
   answering that rather than a second mechanism to keep in sync.

   Keyed on [readonly] rather than :read-only on purpose: :read-only also matches
   input types that are never user-alterable at all (checkbox, radio, button), so
   it would style controls that are not read-only in any sense the reader cares
   about. */
.form-input[readonly],
.form-textarea[readonly] {
  background: var(--surface-alt);
  color: var(--text-muted);
  opacity: 0.65;
  cursor: not-allowed;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
}

.form-select option {
  background: var(--surface-elevated);
}

.form-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  /* A textarea's default font-family is monospace, and nothing here overrode
     it, so every prose field in the product was set in code type while the text
     input beside it was not. A code box asks for mono with a class of its
     own; this is the general case. */
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.form-textarea:focus {
  border-color: var(--accent);
}

.theme-editor-layout {
  display: grid;
  gap: 20px;
}

/* The fieldset a built-in theme's page disables. It carries no box of its own,
   so the sections inside it stay the grid's children whether or not it is
   disabled. */
.theme-editor-fieldset {
  display: contents;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.theme-builtin-note {
  margin-bottom: 16px;
}

.theme-editor-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}

.theme-header-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr) minmax(280px, 1.2fr);
  gap: 18px;
  align-items: start;
}

.theme-header-column {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.theme-header-column-logo {
  justify-items: center;
  padding: 4px 0 0;
}

.theme-description-field {
  grid-column: auto;
}

.theme-logo-upload {
  display: grid;
  gap: 8px;
}

.theme-logo-upload-inline {
  justify-items: center;
  width: 100%;
  gap: 10px;
}

.theme-logo-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.theme-logo-preview {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.theme-logo-preview svg,
.theme-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.theme-logo-preview svg {
  width: 54px;
  height: 54px;
}

.theme-logo-preview-large {
  width: 88px;
  height: 88px;
}

.theme-logo-preview-hero {
  width: 100%;
  min-height: 220px;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  background: linear-gradient(180deg, var(--surface-elevated), var(--surface));
  border-radius: var(--radius-lg);
}

.theme-logo-preview-mode {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

/* The pair previews one mark against the two grounds it will actually be drawn
   on, side by side and whichever theme the editor itself is in - so these are
   literal colours rather than tokens, which would both follow the page. With
   only .theme-logo-preview-mode's shared faint-white ground, the light-fill
   mark was previewed on a dark panel: the one combination the product never
   renders, on the control whose whole job is to show what it will look like. */
.theme-logo-preview-mode-dark {
  background: #0c0e14;
}

.theme-logo-preview-mode-light {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
}

/* The label rides on the pane, so it takes the pane's ground with it. */
.theme-logo-preview-mode-light .theme-logo-preview-mode-label {
  color: #5b6172;
}

.theme-logo-preview-mode-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.theme-logo-preview-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 144px;
}

.theme-logo-preview-mark svg {
  width: min(100%, 220px);
  height: auto;
  max-height: 144px;
}

.theme-logo-preview-hero img {
  width: min(100%, 240px);
  height: auto;
  justify-self: center;
  align-self: center;
}

.theme-logo-preview-large svg {
  width: 64px;
  height: 64px;
}

.theme-logo-preview-dark {
  display: flex;
}

.theme-logo-preview-light {
  display: none;
}

html[data-theme="light"] .theme-logo-preview-dark {
  display: none;
}

html[data-theme="light"] .theme-logo-preview-light {
  display: flex;
}

.theme-logo-file-stack {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.theme-logo-input {
  padding-top: 7px;
  padding-bottom: 7px;
}

.theme-logo-filename {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-palette-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.theme-palette-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.theme-palette-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.theme-logo-fill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.theme-logo-fill-row.is-disabled {
  opacity: 0.78;
}

.theme-logo-fill-toggle {
  margin-bottom: 0;
}

.theme-logo-fill-input {
  width: 68px;
  height: 42px;
  padding: 4px;
}

.theme-logo-fill-input:disabled {
  cursor: not-allowed;
}

.theme-sample-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.theme-sample-button {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.theme-sample-button-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.theme-sample-button-secondary {
  background: var(--surface);
  color: var(--text);
}

.theme-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.theme-color-field {
  display: grid;
  gap: 6px;
}

.theme-color-input {
  width: 100%;
  height: 42px;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

/* Each module's colour for one mode (theme-module-colours): a row per
   module, the tick and its name on the left and the colour on the right, the
   icon drawn in the colour chosen. A row whose tick is off wears the accent
   and reads as set aside. */
.theme-module-colours {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.theme-module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.theme-module-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.theme-module-row .form-label-check {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-bottom: 0;
}

.theme-module-row .theme-color-input {
  flex: none;
  width: 52px;
  height: 32px;
}

.theme-module-row.is-disabled .theme-color-input {
  opacity: 0.55;
}

.theme-module-icon {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--module, var(--accent));
}

.theme-module-row.is-disabled .theme-module-icon {
  color: var(--accent);
}

@media (max-width: 640px) {
  .theme-module-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.theme-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.theme-color-input::-webkit-color-swatch {
  border: none;
  border-radius: calc(var(--radius-sm) - 1px);
}

.theme-color-input::-moz-color-swatch {
  border: none;
  border-radius: calc(var(--radius-sm) - 1px);
}

.theme-preview-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  opacity: 0.72;
}

.theme-preview-name {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .theme-header-grid,
  .theme-palette-grid {
    grid-template-columns: 1fr;
  }

  .theme-header-column-logo {
    justify-items: stretch;
  }
}

@media (max-width: 760px) {
  .theme-color-grid {
    grid-template-columns: 1fr;
  }

  .theme-palette-head {
    flex-direction: column;
  }

  .theme-sample-actions {
    justify-content: flex-start;
  }
}

.code-textarea {
  font-family: var(--font-mono);
  font-size: 12.5px;
  tab-size: 2;
  resize: vertical;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.form-hint {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

/* The same quiet note, on the line it annotates rather than under it: the note
   beside an <h3> title, the pass count beside a status pill, "always" beside a
   step's kind. With no rule it inherited whatever it sat in, so 141 elements
   written to read as an aside were drawn at the heading's own size and weight -
   the markup said "hint" and the page said "heading". Fixed 12px rather than an
   em, to match .form-hint: these sit in headings and in 13px table cells both,
   and 0.8em of a cell is too small to read. */
.form-hint-inline {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

/* A hint reporting a failure rather than explaining a field. .seed-row-error
   beside it places the line in the form grid and says nothing about colour. */
.form-hint-error {
  color: var(--sev-prob-text);
}

.form-actions {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* The action that runs what a card is for sits at its bottom right, where the
   eye ends after reading the fields and where a modal's foot already puts its
   primary button. A new screen uses this rather than the row's left-packed
   default (see the coding instructions on new screens). */
.form-actions.is-end {
  justify-content: flex-end;
}

/* --- Card utility --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  outline: none;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}

/* A <button class="btn"> and an <a class="btn"> must render at an
   identical height for the same class combination (e.g. a "View" link
   next to a "Delete" button). font-family/line-height above already
   normalize most of the drift; Firefox additionally gives every
   <button> a few pixels of invisible inner padding via
   ::-moz-focus-inner that an <a> never gets - remove it so height
   depends only on the padding/border every .btn already shares. */
.btn::-moz-focus-inner {
  border: 0;
  padding: 0;
}

.btn-primary {
  background: var(--accent);
  color: #0c0e14;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text);
  border-color: var(--border-hover);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* btn-selected marks the button whose view the reader is already looking at - a
   segmented pair like Comply's Details/Dashboard toggle, where one of the two is
   always the current page. Combine with a variant, normally btn-secondary.

   It is a state the vocabulary was missing, which is why Comply had grown a
   module-local toggle class with its own accent treatment (issue #163). The look
   matches a :checked .tab-label, since both answer the same question: this one is
   the one you are on.

   Not the same thing as :disabled. The element is usually a <span> rather than a
   link precisely because there is nowhere to go, so there is no interaction to
   disable - and a disabled button reads as "unavailable", not "current". */
.btn-selected,
.btn-selected:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  cursor: default;
}

.known-item-mode-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.known-item-mode-button {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  gap: 7px;
}

.known-item-mode-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.known-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.known-item-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.known-item-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 5px 3px 8px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--text);
  font-size: 12px;
}

.known-item-chip-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* What a list holds that is not the reader's to change - a standard field's
   aliases on a document type's property - drawn in the same control, locked:
   a grey border, muted words and no way to remove it. */
.known-item-chip.is-locked {
  padding-right: 8px;
  border-color: var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
}

/* A checked chip: green where the environment's metadata knows the value,
   red where it does not. The outline and not the fill, so a list of thirty
   reads as a list with a few marked rather than as a warning strip; the
   tooltip on a red one says what the mark means. */
.known-item-chip.is-known {
  border-color: var(--sev-ok-text);
}

.known-item-chip.is-unknown {
  border-color: var(--danger);
  background: var(--sev-prob-bg);
}

.known-item-chip.is-unknown .known-item-chip-icon {
  color: var(--danger);
}

.known-item-list-output {
  display: none;
}

.known-item-entry {
  min-width: 0;
}

.known-item-preview-slot {
  display: contents;
}

.known-item-chip-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: var(--accent);
}

.known-item-chip-remove {
  width: 18px;
  height: 18px;
  padding: 2px;
  flex: 0 0 18px;
}

.known-item-chip-remove-icon,
.known-item-add-icon {
  width: 14px;
  height: 14px;
}

.known-item-entry-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.known-item-entry-row > .form-input,
.known-item-entry-row > .autocomplete {
  flex: 1;
  min-width: 0;
}

.known-item-add {
  width: 32px;
  height: 32px;
  padding: 0;
  flex: 0 0 32px;
}

/* align-content: start, because a grid's default stretches its rows to fill
   the box, and the box is often stretched itself: on Form Capture two of these
   sit side by side in one row, so the shorter one's label and mode buttons were
   pushed down by whatever the taller one held, and moved again with every
   chip added and every mode chosen on either side. */
.known-item-selection {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.known-item-selection-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.known-item-selection-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.known-item-selection-actions .known-item-mode-button {
  padding: 0 6px;
}

.known-item-collection-control {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.known-item-collection-control[hidden] {
  display: none !important;
}

.known-item-collection-control .form-select {
  min-width: 0;
  flex: 1;
}

.known-item-collection-hint {
  margin-top: 0;
}

.known-item-browse {
  flex: 0 0 auto;
  height: 36px;
}

.known-item-browse-icon {
  width: 15px;
  height: 15px;
}

.known-item-preview-modal {
  width: min(760px, calc(100vw - 32px));
}

.known-item-preview-body {
  max-height: min(68vh, 620px);
  overflow: auto;
}

.known-item-preview-group + .known-item-preview-group {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.known-item-preview-group h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 14px;
}

.known-item-preview-group h3 span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

.known-item-preview-values {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 4px 12px;
  max-height: 42vh;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.known-item-preview-values li {
  min-width: 0;
  overflow-wrap: anywhere;
}

.known-item-list-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Shared row-action buttons used by repeatable Migrate input rows. */
.migrate-row-action {
  min-height: 36px;
  padding: 0 12px;
}

.autocomplete {
  position: relative;
  min-width: 0;
}

.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
  margin-top: 8px;
}

/* Zero-JS open/close: hide the results whenever they're empty (no matches / not
   queried yet) or whenever focus leaves the wrapper entirely (click elsewhere, tab
   away, or the input becomes readonly after a selection is committed). */
.autocomplete-results:empty {
  display: none;
}

.autocomplete:not(:focus-within) .autocomplete-results {
  display: none;
}

.autocomplete-item {
  appearance: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.autocomplete-item:last-child {
  border-bottom: 0;
}

.autocomplete-item:hover {
  background: var(--surface-hover);
}

.autocomplete-item-label {
  font-size: 13px;
  font-weight: 600;
}

.autocomplete-item-secondary {
  font-size: 12px;
  color: var(--text-muted);
}

.autocomplete-input[readonly] {
  cursor: default;
  background: var(--surface);
  color: var(--text);
}

.autocomplete-results, .autocomplete-results * {
  box-sizing: border-box;
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

/* A verdict a button records, drawn in the status-pill palette so the button
   is the colour of the pill it produces: Comply's review answers "Can remove"
   (green) and "Must keep" (amber). Tinted rather than solid, since an answer
   is not a destructive action and only btn-danger is meant to be loud; and the
   tint reads in both themes, where white on the dark theme's light amber and
   green does not. */
.btn-success {
  background: var(--sev-ok-bg);
  color: var(--sev-ok-text);
  border-color: transparent;
}

.btn-success:hover:not(:disabled) {
  border-color: var(--sev-ok-text);
}

.btn-warning {
  background: var(--sev-warn-bg);
  color: var(--sev-warn-text);
  border-color: transparent;
}

.btn-warning:hover:not(:disabled) {
  border-color: var(--sev-warn-text);
}

.btn-delete-outline {
  background: transparent;
  color: var(--sev-prob-text);
  border-color: var(--sev-prob-text);
}

.btn-delete-outline:hover:not(:disabled) {
  background: var(--sev-prob-text);
  color: #fff;
  border-color: var(--sev-prob-text);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-disabled-link {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

/* A square button whose whole label is its icon: the 28px square the README
   describes. It had no base rule, only the vault's rows and the coarse-pointer
   section sizing it, so everywhere else an icon-only button was as wide as
   its padding made it. Two classes so it beats .btn-sm and .btn-xs, whose
   padding would otherwise squeeze the icon off centre; the topbar's own size
   qualifies past it, and the touch rule at the foot of the file wins there. */
.btn.btn-icon-only {
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* --- Alerts --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-success {
  background: rgba(100, 200, 80, 0.1);
  border-color: rgba(100, 200, 80, 0.3);
  color: var(--sev-ok-text);
}

.alert-error {
  background: rgba(220, 70, 70, 0.1);
  border-color: rgba(220, 70, 70, 0.3);
  color: var(--sev-prob-text);
}

.alert-warning {
  background: rgba(240, 180, 0, 0.08);
  border-color: rgba(240, 180, 0, 0.25);
  color: var(--sev-warn-text);
}

/* The one .alert variant that had no rule of its own, on roughly two dozen
   templates - including the compare job page's live progress box. Without it the
   div inherited .alert's transparent border and no background at all, so an
   "info" alert rendered as bare body text with padding: the reader saw no box
   where every sibling variant draws one. */
.alert-info {
  background: var(--sev-info-bg);
  border-color: var(--sev-info-border);
  color: var(--sev-info-text);
}

.alert ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

/* --- Example Block --- */
.example-block {
  margin: 10px 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.example-block summary {
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  background: var(--surface-elevated);
}

.example-block summary:hover { color: var(--text); }

.code-block {
  margin: 0;
  padding: 14px 16px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: pre;
}

/* --- Check Registry Table --- */
/* =====================================================
   Tables - one base, two densities (issue #165)
   =====================================================

   There were five near-duplicate base declarations - .registry-table,
   .sum-table, .results-table, .runlog-table and a .conn-table nothing used -
   differing by half a pixel of type and a couple of pixels of cell padding, so
   which listing you were looking at decided how a table was drawn rather than
   anything about the table. They are now one .data-table plus two density
   modifiers. .data-table is the name five Form Management templates had already
   reached for before any rule existed to match it, which is the other half of
   this issue.

   Base    a summary or detail table: 13px, 8/12 cells, middle-aligned.
   .is-roomy   a registry listing, read a row at a time: 10/14 cells, top-aligned.
   .is-dense   a result grid, many columns: 12.5px, sticky header, 7/12 cells,
               values clipped at 300px. No row-hover tint - these rows carry
               their own severity tints (.row-problem etc.) and a hover
               background would flatten them. */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}

.data-table th {
  background: var(--surface-elevated);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 8px 12px;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

/* The row hover tint, everywhere except a dense grid: see the note above - those
   rows carry their severity as the ROW's background, and a td background painted
   over it on hover would hide the one thing the grid is for. Expressed as an
   exclusion rather than as an override, so there is no "background: none" rule
   able to flatten a module's own hover treatment. */
.data-table:not(.is-dense) tr:hover td { background: var(--surface-hover); }

/* When table-fit is on the <table> itself (not a wrapper), override width:100% so
   the inline-block can shrink-wrap to content rather than filling the parent. */
.data-table.table-fit { width: auto; }

/* Right-justify numeric columns (check summaries etc.). */
.data-table th.num-col,
.data-table td.num-col { text-align: right; }
/* Comply's older spelling of the same column, kept where a test pins it. */
.data-table th.num,
.data-table td.num { text-align: right; }

/* Two spellings of one idea. num-col is what two hundred-odd cells use; col-num
   is what the Assess and Workbench lists were written with, and having no rule
   it left counts drawn like text in the column beside them. Both are honoured
   rather than one renamed, because a browser journey pins td.col-num by name;
   consolidating onto num-col needs that check changed with it. */
.data-table th.col-num,
.data-table td.col-num { text-align: right; }

/* The actions column shrinks to its buttons (width:1% is the auto-table
   "shrink to fit" trick) and never wraps them, so the width it does not need
   goes to the columns carrying words instead. */
.data-table th.col-actions,
.data-table td.col-actions {
  width: 1%;
  white-space: nowrap;
}

/* The buttons in it line up on their middles. They are inline-flex boxes, and
   an inline box sits on its baseline: a button of words has its text's, and an
   icon-only one the bottom of its icon, so the two landed at different heights
   side by side - the Workbenches list's cog sat higher than the Open beside it,
   in every row. */
.data-table td.col-actions > .btn {
  vertical-align: middle;
}

.data-table.is-roomy th {
  font-size: 11.5px;
  padding: 10px 14px;
}

.data-table.is-roomy td {
  padding: 10px 14px;
  vertical-align: top;
}

.data-table.is-dense {
  font-size: 12.5px;
  min-width: 400px;
}

.data-table.is-dense th {
  position: sticky;
  top: 0;
}

.data-table.is-dense td {
  padding: 7px 12px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Per-page :checked enumerations for the tab groups that carry a Templates tab.
   These cannot be shared - CSS has no parent selector, so each rule must name
   its own radio ids. TestToolTabsHaveTheirCSS asserts the three lists below
   (panel reveal, active label, action reveal) stay in step with the templates. */

/* MCP Scripts: My Scripts | Templates */
#mcp-scripts-tab-scripts:checked ~ #mcp-scripts-panel-scripts,
#mcp-scripts-tab-templates:checked ~ #mcp-scripts-panel-templates {
  display: block;
}

#mcp-scripts-tab-scripts:checked ~ .tool-tabs-header .tab-bar label[for="mcp-scripts-tab-scripts"],
#mcp-scripts-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="mcp-scripts-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#mcp-scripts-tab-scripts:checked ~ .tool-tabs-header .mcp-scripts-new {
  display: inline-flex;
}

/* Validate Package Registry: My Packages | Templates */
#validate-packages-tab-packages:checked ~ #validate-packages-panel-packages,
#validate-packages-tab-templates:checked ~ #validate-packages-panel-templates {
  display: block;
}

#validate-packages-tab-packages:checked ~ .tool-tabs-header .tab-bar label[for="validate-packages-tab-packages"],
#validate-packages-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="validate-packages-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#validate-packages-tab-packages:checked ~ .tool-tabs-header .validate-packages-new,
#validate-packages-tab-packages:checked ~ .tool-tabs-header .validate-packages-design {
  display: inline-flex;
}

/* Automate Processes: My Processes | Templates */
#automate-processes-tab-processes:checked ~ #automate-processes-panel-processes,
#automate-processes-tab-templates:checked ~ #automate-processes-panel-templates {
  display: block;
}

#automate-processes-tab-processes:checked ~ .tool-tabs-header .tab-bar label[for="automate-processes-tab-processes"],
#automate-processes-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="automate-processes-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#automate-processes-tab-processes:checked ~ .tool-tabs-header .automate-processes-new {
  display: inline-flex;
}

/* Test Tests: My Tests | Templates. Import and New test show on the first
   tab only, so the Templates tab shows only its own Clone controls. */
#test-scripts-tab-tests:checked ~ #test-scripts-panel-tests,
#test-scripts-tab-templates:checked ~ #test-scripts-panel-templates {
  display: block;
}

#test-scripts-tab-tests:checked ~ .tool-tabs-header .tab-bar label[for="test-scripts-tab-tests"],
#test-scripts-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="test-scripts-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#test-scripts-tab-tests:checked ~ .tool-tabs-header .test-scripts-new {
  display: inline-flex;
}

/* Test Scenario tests: My scenario tests | Templates, the Process tests list's
   shape: Import and New scenario test show on the first tab only. */
#test-scenarios-tab-scenarios:checked ~ #test-scenarios-panel-scenarios,
#test-scenarios-tab-templates:checked ~ #test-scenarios-panel-templates {
  display: block;
}

#test-scenarios-tab-scenarios:checked ~ .tool-tabs-header .tab-bar label[for="test-scenarios-tab-scenarios"],
#test-scenarios-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="test-scenarios-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#test-scenarios-tab-scenarios:checked ~ .tool-tabs-header .test-scenarios-new {
  display: inline-flex;
}

/* Automate AI prompts: System prompts | Prompts | Response schemas, each tab
   revealing its own New button on the tab row. */
#automate-prompts-tab-system:checked ~ #automate-prompts-panel-system,
#automate-prompts-tab-prompt:checked ~ #automate-prompts-panel-prompt,
#automate-prompts-tab-schema:checked ~ #automate-prompts-panel-schema,
#automate-prompts-tab-templates:checked ~ #automate-prompts-panel-templates {
  display: block;
}

#automate-prompts-tab-system:checked ~ .tool-tabs-header .tab-bar label[for="automate-prompts-tab-system"],
#automate-prompts-tab-prompt:checked ~ .tool-tabs-header .tab-bar label[for="automate-prompts-tab-prompt"],
#automate-prompts-tab-schema:checked ~ .tool-tabs-header .tab-bar label[for="automate-prompts-tab-schema"],
#automate-prompts-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="automate-prompts-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#automate-prompts-tab-system:checked ~ .tool-tabs-header .automate-prompts-new-system,
#automate-prompts-tab-prompt:checked ~ .tool-tabs-header .automate-prompts-new-prompt,
#automate-prompts-tab-schema:checked ~ .tool-tabs-header .automate-prompts-new-schema {
  display: inline-flex;
}

.data-table.automate-prompts-table .automate-col-prompt {
  min-width: 200px;
  max-width: 360px;
}

/* The Templates tab's search box and type dropdown, on one line. */
.builtin-templates-search.automate-prompt-templates-filters {
  display: flex;
  gap: var(--space-2);
  max-width: 640px;
}

.automate-prompt-templates-filters .form-select {
  flex: 0 0 200px;
}

.data-table.automate-prompts-table .automate-col-description {
  min-width: 260px;
  max-width: 640px;
}

.data-table.automate-prompts-table .automate-col-tags,
.data-table.automate-prompts-table .automate-col-updated {
  width: 1%;
  white-space: nowrap;
}

/* Automate Document types: My document types | Templates, with New document
   type revealed on the first tab as New process is on its page. */
#automate-doctypes-tab-types:checked ~ #automate-doctypes-panel-types,
#automate-doctypes-tab-templates:checked ~ #automate-doctypes-panel-templates {
  display: block;
}

#automate-doctypes-tab-types:checked ~ .tool-tabs-header .tab-bar label[for="automate-doctypes-tab-types"],
#automate-doctypes-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="automate-doctypes-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#automate-doctypes-tab-types:checked ~ .tool-tabs-header .automate-doctypes-new {
  display: inline-flex;
}

.data-table.automate-doctypes-table .automate-col-doctype {
  min-width: 240px;
  max-width: 560px;
}

.data-table.automate-doctypes-table .automate-col-doctype-props,
.data-table.automate-doctypes-table .automate-col-doctype-used,
.data-table.automate-doctypes-table .automate-col-updated {
  width: 1%;
  white-space: nowrap;
}

/* A document type's editor: Fields | Checks | For a model | PDF output |
   About. No per-tab action: each tab's card carries its own. */
#automate-doctype-tab-fields:checked ~ #automate-doctype-panel-fields,
#automate-doctype-tab-checks:checked ~ #automate-doctype-panel-checks,
#automate-doctype-tab-model:checked ~ #automate-doctype-panel-model,
#automate-doctype-tab-pdf:checked ~ #automate-doctype-panel-pdf,
#automate-doctype-tab-about:checked ~ #automate-doctype-panel-about {
  display: block;
}

#automate-doctype-tab-fields:checked ~ .tool-tabs-header .tab-bar label[for="automate-doctype-tab-fields"],
#automate-doctype-tab-checks:checked ~ .tool-tabs-header .tab-bar label[for="automate-doctype-tab-checks"],
#automate-doctype-tab-model:checked ~ .tool-tabs-header .tab-bar label[for="automate-doctype-tab-model"],
#automate-doctype-tab-pdf:checked ~ .tool-tabs-header .tab-bar label[for="automate-doctype-tab-pdf"],
#automate-doctype-tab-about:checked ~ .tool-tabs-header .tab-bar label[for="automate-doctype-tab-about"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.automate-doctype-section + .automate-doctype-section {
  margin-top: var(--space-4);
}

/* A part sits under its property, indented by how deep it is. */
.automate-doctype-props-table .automate-doctype-prop-row .automate-col-doctype-prop {
  min-width: 180px;
  padding-left: calc(12px + var(--depth, 0) * 22px);
}

/* The name as a code chip as wide as its text, its words under it: a flex
   column stretches what it holds to the cell's width, which drew every name
   as a bar across the column. */
.automate-doctype-prop-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

/* The property's name with the mark of the company property beside it. */
.automate-doctype-prop-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.automate-doctype-company {
  display: inline-flex;
  color: var(--accent);
}

.automate-doctype-company-icon {
  width: 16px;
  height: 16px;
}

/* Required may wrap: "if kind = credit-note" kept to one line was what
   pushed the row's buttons past the table's edge on a laptop. It keeps room
   for a value of a few words on a line, so a condition wraps at its "="
   rather than a word to a line. */
.automate-doctype-props-table .automate-col-doctype-type,
.automate-doctype-props-table .automate-col-doctype-from,
.automate-doctype-props-table .automate-col-doctype-standard {
  white-space: nowrap;
}

/* A sum of money says so under its type, on a line of its own: "number ·
   amount" on one line widened the column by 57px and pushed the row's
   buttons past the table's edge at 1500px. */
.automate-doctype-type-amount {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.automate-doctype-props-table .automate-col-doctype-required {
  min-width: 96px;
}

.automate-doctype-props-table .automate-col-doctype-actions {
  width: 1%;
  white-space: nowrap;
}

/* The aliases are one line: as many as fit are shown and the rest counted
   (docTypeAliasesFit), the whole list on the cell's tooltip, so every row is
   as tall as its name and its words and no taller, and the column is as
   wide as its widest line. */
.automate-doctype-props-table .automate-col-doctype-aliases {
  white-space: nowrap;
}

.automate-doctype-props-table .automate-col-doctype-aliases .automate-doctype-alias {
  margin-bottom: 0;
}

/* What suppliers call a property, as small pills; one inherited from its
   standard field is drawn dashed and muted, since it is the vocabulary's to
   change rather than the type's. */
.automate-doctype-alias {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  color: var(--text);
}

.automate-doctype-alias.is-inherited {
  border-style: dashed;
  color: var(--text-muted);
}

.automate-doctype-property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 var(--space-4);
}

/* A document type's property dialog is one property sheet: a bordered box of
   rows, each row's words in a label column on the alt surface and its
   controls beside them, a thin rule under every row and no row taller than
   its control needs, in bands across both columns. 960px, since a sheet does
   not need the width a table does. The label column is named by its class,
   never by its position in a row. */
dialog.modal.modal-wide.automate-doctype-property-modal {
  width: min(960px, calc(100vw - 48px));
}

.automate-doctype-sheet {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.automate-doctype-sheet-band {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
}

.automate-doctype-sheet-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  border-bottom: 1px solid var(--border);
}

.automate-doctype-sheet > .automate-doctype-sheet-row:last-child,
.automate-doctype-sheet > .automate-doctype-sheet-group:last-child > .automate-doctype-sheet-row:last-child {
  border-bottom: 0;
}

.automate-doctype-sheet-label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  padding: 4px 12px;
  border-right: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 28px;
}

/* A row's words are level with its first line of controls whatever else the
   row holds: every control is 28px, the words' line box is the same 28px at
   the same offset, and a control cell's lines start at its top rather than
   spreading over a row a wrapped list of chips has made taller. */
.automate-doctype-sheet-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 6px 8px;
  min-width: 0;
  padding: 4px 10px;
}

/* A control in the sheet is as tall as its row needs rather than the form's
   default, and as wide as what it holds. */
.automate-doctype-sheet .form-input,
.automate-doctype-sheet .form-select {
  width: auto;
  height: 28px;
  padding: 0 9px;
  font-size: 13px;
}

.automate-doctype-sheet .form-textarea {
  width: auto;
  min-height: 28px;
  padding: 5px 9px;
  font-size: 13px;
  line-height: 16px;
}

.automate-doctype-sheet-control > .form-input {
  flex: 0 1 280px;
}

/* A chooser is as wide as its longest option up to a point, so a row of
   two or three of them (Required when Kind holds Invoice) stays one line. */
.automate-doctype-sheet .form-select {
  max-width: 280px;
  text-overflow: ellipsis;
}

/* A box the standard field may fill: what it inherits is the placeholder,
   with the lock inside the box until something of the property's own is
   typed over it. */
.automate-doctype-sheet-inherit {
  position: relative;
  display: inline-flex;
  flex: 0 1 280px;
  min-width: 0;
}

.automate-doctype-sheet-inherit.is-grow {
  flex: 1 1 100%;
}

.automate-doctype-sheet .automate-doctype-sheet-inherit > .form-input,
.automate-doctype-sheet .automate-doctype-sheet-inherit > .form-textarea {
  width: 100%;
}

.automate-doctype-sheet .automate-doctype-sheet-inherit.has-inherited > :placeholder-shown {
  padding-left: 28px;
}

.automate-doctype-sheet-lock {
  position: absolute;
  top: 7px;
  left: 9px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.automate-doctype-sheet-inherit > :not(:placeholder-shown) ~ .automate-doctype-sheet-lock {
  display: none;
}

/* What it is: one line the column's width, growing to as many as its text
   wraps to. */
.automate-doctype-sheet .automate-doctype-sheet-grow {
  min-height: 28px;
  field-sizing: content;
  resize: none;
}

.automate-doctype-sheet-parts {
  flex: 0 1 260px;
}

/* The Amount tick sits on the Holds row beside a number's type, its words
   kept on one line so the row wraps the tick whole rather than a word at a
   time. */
.automate-doctype-sheet-amount {
  white-space: nowrap;
}

.automate-doctype-sheet-short {
  max-width: 160px;
}

.automate-doctype-sheet-word {
  color: var(--text-muted);
  font-size: 13px;
}

/* A property named in the name pattern's hint, as {{supplier-name}}: one chip
   never broken across two lines. */
.automate-doctype-placeholder {
  white-space: nowrap;
}

/* A hint is a short phrase beside its control, and the ? carries the whole
   sentence where it says more. */
.automate-doctype-sheet-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.automate-doctype-sheet-tip {
  display: inline-flex;
  color: var(--text-muted);
  cursor: help;
}

.automate-doctype-sheet-tip-icon,
.automate-doctype-sheet-hint-lock,
.automate-doctype-sheet-label-lock {
  flex: none;
  width: 14px;
  height: 14px;
}

.automate-doctype-sheet-label-lock {
  margin-top: 7px;
}

/* The way from a property's Standard chooser to its field's entry: drawn as a
   link, since inheriting the hint's grey left it reading as more hint. */
.automate-doctype-sheet-browse {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* A list of chips in the sheet reads on one line: what the standard field
   gives, locked, then the type's own, then the box that adds one. */
.automate-doctype-sheet .known-item-list {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  flex: 1 1 100%;
  gap: 6px;
}

.automate-doctype-sheet .known-item-chip-list {
  display: contents;
}

.automate-doctype-sheet .known-item-entry-row {
  flex: 1 1 220px;
  min-width: 160px;
}

.automate-doctype-sheet .known-item-add {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
}

/* The checks: the standard field's said and locked, then the type's own with
   their settings on their own row, then the chooser that adds one. What a
   check holds the value to is said whole, wrapping onto as many lines as it
   takes, since it is the one sentence that says what the check does. */
.automate-doctype-sheet-row.is-inherited .automate-doctype-sheet-label {
  color: var(--text-muted);
}

.automate-doctype-sheet-said {
  flex: 1 1 0;
  min-width: 0;
  padding: 5px 0;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 18px;
  overflow-wrap: anywhere;
}

.automate-doctype-sheet-param {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.automate-doctype-sheet-control > .automate-doctype-sheet-param-box {
  flex: 0 1 160px;
}

.automate-doctype-sheet-control > .automate-doctype-sheet-say {
  flex: 1 1 180px;
}

.automate-doctype-sheet-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: auto;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.automate-doctype-sheet-remove-icon {
  width: 16px;
  height: 16px;
}

.automate-doctype-sheet-error {
  flex-basis: 100%;
  margin: 0;
}

/* On a phone a row's words go over its controls. */
@media (max-width: 640px) {
  .automate-doctype-sheet-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .automate-doctype-sheet-label {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

.automate-doctype-tab-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.automate-doctype-model-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
}

.automate-doctype-model-for {
  margin-bottom: 0;
  min-width: 240px;
}

.automate-doctype-model-include {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  padding: 0;
  border: 0;
}

/* What a model provider read from its prompt cache, under the tokens in it is
   part of: one line, since three short lines read as three numbers. */
.usage-cached {
  white-space: nowrap;
  font-size: 12px;
}

/* The properties a step may name, a tick each under a disclosure of their
   own, so a type of thirty properties does not push the text off the page. */
.automate-doctype-model-only {
  flex-basis: 100%;
}

.automate-doctype-model-only > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.automate-doctype-model-only > summary::-webkit-details-marker {
  display: none;
}

.automate-doctype-model-only-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.15s ease;
}

.automate-doctype-model-only[open] .automate-doctype-model-only-chevron {
  transform: rotate(90deg);
}

.automate-doctype-model-props {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-1) var(--space-4);
  margin: var(--space-2) 0 0;
  padding: 0;
  border: 0;
}

.automate-doctype-model-props > legend {
  grid-column: 1 / -1;
  padding: 0;
}

.automate-doctype-model-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

/* The instructions keep their lines - a Markdown table is read line by line -
   and scroll in a box of their own. */
.automate-doctype-markdown {
  max-height: 60vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.automate-doctype-schema {
  margin-top: var(--space-3);
}

/* Each part a model call takes is its heading with its own Copy at the right,
   over its text: the two are linked into two ports, so each is copied alone. */
.automate-doctype-part + .automate-doctype-part {
  margin-top: var(--space-3);
}

.automate-doctype-part-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.automate-doctype-part-head .form-card-title {
  margin: 0;
}

/* The prompt is prose, a sentence and what Also adds, so it wraps in its box.
   The system prompt is the rules, which are sentences, and the type's tables,
   which are not, so it is drawn a line at a time: a table's row keeps its
   line and the box scrolls for it, and every other line wraps at the box's
   width, as a span that wraps inside a block that does not still does. */
.automate-doctype-markdown.is-prose,
.automate-doctype-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.automate-doctype-line.is-table {
  white-space: pre;
  overflow-wrap: normal;
}

/* =====================================================
   Automate designer and run canvas
   -----------------------------------------------------
   Every rule is prefixed .automate- and none styles ".cls svg": the mdi-icon
   helper puts its class on the <svg> itself (see TestMdiIconClassesAreStyledOnTheSvg).
   The canvas is an inline <svg> the server renders whole; the script
   (static/js/automate-canvas.js) only moves the viewBox, drags a node and draws
   the link preview, so everything visual lives here and nothing in the script
   knows a colour.

   The variables derive from the theme tokens, so a customer palette flows into
   the canvas without any of these being customer-editable themselves. Light
   mode redefines the few that need a different weight against a pale surface.
   ===================================================== */
:root {
  --automate-grid:            rgba(255, 255, 255, 0.07);
  --automate-node-bg:         var(--surface-elevated);
  --automate-node-border:     var(--border-hover);
  --automate-edge:            #5c6480;
  /* A document's link: the spine a workflow enriches one document along,
     drawn heavier and in a colour of its own so it reads apart from the
     values that feed it. */
  --automate-doc:             #6fa8dc;
  --automate-port:            #8892a4;
  --automate-port-ok:         var(--sev-ok-text);
  --automate-port-bad:        var(--sev-prob-text);
  /* The third drag state: a port that would take this link with a conversion
     step in between. The warning token rather than a colour of its own, so it
     reads as "yes, but" in both themes alongside the ok and problem ones. */
  --automate-port-via:        var(--sev-warn-text);
  /* A run's states, in five colours the theme owns (internal/theme's
     Palette carries them, so a customer may change them). They are
     Automate's own rather than the product-wide --sev-* palette, which also
     colours every status pill, alert and badge elsewhere: a calmer green on
     a workflow drawing is not a request to restyle Validate and Compare.
     The values here are the dark-mode baseline, as everywhere in this file. */
  --automate-ok:       #7ecb5f;
  --automate-problem:  #d96060;
  --automate-warning:  #e8a820;
  --automate-running:  #70aadf;
  --automate-neutral:  #7a8394;

  --automate-state-pending:   var(--automate-neutral);
  --automate-state-running:   var(--automate-running);
  --automate-state-ok:        var(--automate-ok);
  --automate-state-error:     var(--automate-problem);
  --automate-state-skipped:   var(--automate-neutral);
  --automate-state-idle:      var(--automate-warning);
  --automate-state-waiting:   var(--automate-warning);
  --automate-state-cancelled: var(--automate-problem);
  /* A target that finished holding its record back (render.StateHeld): not
     one of the engine's states, but the one a reader of the run is looking
     for, so it is drawn in the colour of something waiting on a person. */
  --automate-state-held:      var(--automate-warning);
  --automate-app-automate:    var(--accent);
  --automate-app-validate:    #70aadf;
  --automate-app-compare:     #a58be6;
  --automate-app-migrate:     #e8a820;
  --automate-app-build:       #e0906b;
  --automate-app-discover:    #5fc2b0;
  --automate-app-forms:       #e27aa8;
  --automate-app-test:        #9ccc65;
  --automate-app-vault:       #c9a227;
  /* The colours an author may draw a visual group in
     (automate.VisualGroupColours). Green is not among them: it is the
     repeated region's, and a group drawn in it reads as a loop. */
  --automate-group-blue:      #70aadf;
  --automate-group-purple:    #a58be6;
  --automate-group-amber:     #e8a820;
  --automate-group-rose:      #e07a93;
  --automate-group-teal:      #5fc2c9;
  --automate-group-slate:     #8a94a8;
  /* A wizard's own steps (render.NodeView.Wizard): the canvas's purple, so
     the journey a person walks through reads apart from the work between
     its pages. */
  --automate-wizard:          #a58be6;
  /* The steps that ask a model, a light red, and the steps that work on a
     document, the colour of paper: each a family a reader looks for on a
     canvas, told apart from the rest of its app wherever a step is drawn
     (automate_tone.go). */
  --automate-ai:              #f0938b;
  --automate-documents:       #d3ab7c;
}

html[data-theme="light"] {
  --automate-grid:            rgba(20, 30, 60, 0.10);
  --automate-node-bg:         var(--surface);
  --automate-node-border:     var(--border-hover);
  --automate-edge:            #8a92a8;
  --automate-doc:             #2f6aa3;
  --automate-port:            #5a6278;
  --automate-ok:       #2e7a14;
  --automate-problem:  #b01818;
  --automate-warning:  #8c6000;
  --automate-running:  #2258a8;
  --automate-neutral:  #6b7280;
  --automate-app-validate:    #2258a8;
  --automate-app-compare:     #6f52c9;
  --automate-app-migrate:     #8c6000;
  --automate-app-build:       #b8603f;
  --automate-app-discover:    #16776a;
  --automate-app-forms:       #a8336a;
  --automate-app-test:        #558b2f;
  --automate-app-vault:       #8a6d12;
  --automate-group-blue:      #2258a8;
  --automate-group-purple:    #6f52c9;
  --automate-group-amber:     #8c6000;
  --automate-group-rose:      #b03a5b;
  --automate-group-teal:      #177a82;
  --automate-group-slate:     #5a6278;
  --automate-wizard:          #6f52c9;
  --automate-ai:              #c2453c;
  --automate-documents:       #8a6238;
}

/* An element tinted for an app - a node, a palette chip, the inspector head -
   carries one of these classes and reads --automate-app.

   A module's colour is the theme's where the theme gives it one (Settings >
   Themes, --module-<id>, declared as initial for a module the theme leaves
   alone, which is no value at all and so falls through) and the colour this
   sheet has always drawn it in otherwise, so an untouched theme draws exactly
   as it did and a company that colours Validate sees its steps in that colour
   here too. */
.automate-app-automate { --automate-app: var(--module-automate, var(--automate-app-automate)); }
.automate-app-validate { --automate-app: var(--module-validate, var(--automate-app-validate)); }
.automate-app-compare  { --automate-app: var(--module-compare, var(--automate-app-compare)); }
.automate-app-migrate  { --automate-app: var(--module-migrate, var(--automate-app-migrate)); }
.automate-app-build    { --automate-app: var(--module-build, var(--automate-app-build)); }
.automate-app-discover { --automate-app: var(--module-discover, var(--automate-app-discover)); }
.automate-app-forms    { --automate-app: var(--module-forms, var(--automate-app-forms)); }
.automate-app-test     { --automate-app: var(--module-test, var(--automate-app-test)); }
.automate-app-vault    { --automate-app: var(--module-vault, var(--automate-app-vault)); }
/* A family of steps told apart from the rest of its app: a wizard's own
   steps, the steps that ask a model, and the steps that work on a document.
   Written after the app classes and beside one on the same element, so it is
   the one that holds, on a chip in the palette, the settings panel and the
   library exactly as on the box on the canvas. */
.automate-tone-wizard    { --automate-app: var(--automate-wizard); }
.automate-tone-ai        { --automate-app: var(--automate-ai); }
.automate-tone-documents { --automate-app: var(--automate-documents); }
/* A wizard's start, pages and finish take the wizard's colour over their
   app's, for the header, the icon and the outline alike, and wear its mark on
   their top-left corner (see .automate-wizard-mark). Two classes, so it beats
   the app class whichever is declared later. */
.automate-node.is-wizard { --automate-app: var(--automate-wizard); }

/* --- Layout: one panel | the divider | the canvas ---
   The designer fills the window rather than flowing down it. The page is a
   flex column inside .main-content, which is the shell's scroll box and has a
   definite height from .main-wrapper's 100vh; the header takes what it needs
   and the grid takes the rest, so the canvas is as tall as the window allows
   and there is no dead band under anything.

   The panel to the left holds Nodes or the selected step's settings, one at a
   time, at full height. It used to be a palette column and an inspector
   column either side of the canvas, and then a band beneath it; both spent
   room on a form whether or not one was being filled in, and the band moved
   the canvas every time a step was chosen. */
.automate-designer-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

/* .page-header's own bottom margin is right on a page that reads downwards and
   wrong on one whose next element is the canvas: with the page a flex column
   the gap is the only spacing that should apply. Leaving it there, either side
   of an empty modal slot, is what made the band above the canvas read as a
   placeholder waiting for something to arrive. */
.automate-designer-page > .tool-header,
.slim-header-page > .tool-header {
  margin-bottom: 0;
}

.automate-designer-page > #automate-modal-slot:empty {
  display: none;
}

.automate-designer {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: 0;
  align-items: stretch;
  grid-template-columns: var(--automate-panel-w, 264px) 9px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

.automate-designer-palette,
.automate-designer-inspector {
  min-width: 0;
  min-height: 0;
  grid-column: 1;
  grid-row: 2;
  overflow: auto;
  /* Both panels are replaced whole by a swap, and scroll anchoring reads that
     as content vanishing from above where the reader is looking: an outerHTML
     swap inserts the new palette beside the old and then removes the old, so
     the browser shifts scrollTop by the height it took away and the node list
     lands at its bottom. Pressing a step in the palette did exactly that -
     the list jumped to the end, and the group the reader was picking from was
     gone. There is nothing here for anchoring to keep in place, because what
     it would anchor to is itself being replaced. */
  overflow-anchor: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}

.automate-designer-inspector {
  padding: var(--space-4);
}

/* The palette's sticky head (the search and the two pickers) covers the top
   of the cell, so a step brought into view by the keyboard would otherwise be
   scrolled to the very top and land under it. The head is about 150px tall at
   every panel width, since none of its labels wrap. */
.automate-designer-palette {
  scroll-padding-top: 10rem;
}

.automate-designer-canvas {
  min-width: 0;
  min-height: 0;
  grid-column: 3;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* --- The header, on one row ---
   The card was a third of the page before the canvas started: a 48px plate, a
   26px title, and the description and the slug on lines of their own. Here it
   is one row - plate, title, slug, description, actions - and the description
   gives up its tail to an ellipsis rather than wrapping the row taller. Half
   the height, and the canvas has it instead.

   Scoped to this page rather than changed for every tool: a page that is read
   downwards wants the roomier header, and the canvas is the only thing that
   competes with it for the window. A page whose workspace competes for the
   window the same way opts in with slim-header-page (the Live Form
   Explorer's tree). */
.automate-designer-page > .tool-header,
.slim-header-page > .tool-header {
  padding: 10px 16px;
}

.automate-designer-page .tool-header-main,
.slim-header-page .tool-header-main {
  gap: 12px;
}

.automate-designer-page .page-header-icon,
.slim-header-page .page-header-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
}

.automate-designer-page .page-header-icon-svg,
.slim-header-page .page-header-icon-svg {
  width: 18px;
  height: 18px;
}

.automate-designer-page .tool-header-text,
.slim-header-page .tool-header-text {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

/* The name gives way before the actions do, cut with an ellipsis and whole in
   its tooltip: it was flex: none beside actions that may not wrap, so a long
   workflow name ran straight under Run and Arrange. The description beside it
   gives way first (a basis of nothing, so it has only what the name leaves),
   since the name is what says which workflow this is. */
.automate-designer-page .page-title,
.slim-header-page .page-title {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.automate-designer-page .page-subtitle,
.slim-header-page .page-subtitle {
  flex: 1 1 0;
  margin: 0;
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The designer's row cannot hold the name, the slug, the description and the
   pill at a desktop's 1500px, and the description gave way first only as far
   as a few letters ("Read...", "exp...") while the name was cut as well. It is
   a sentence nobody reads in a header, so the designer leaves it out and the
   slug has what the name and the pill leave; it is on the Workflows and
   Processes lists, where there is room to read it. */
.automate-designer-page .page-subtitle:not(:has(code)) {
  display: none;
}

/* The slug is drawn whole or not at all. Cut, it was a letter or two and an
   ellipsis ("d...", "exp...") beside a name it says nothing more about, and a
   code cut short is not a shorter code. So it may wrap to a second line, which
   its one-line box clips: a break opportunity before it (the zero-width space)
   is where the line breaks once the badge no longer fits beside the name, and
   the badge itself never breaks. The first line keeps the box's baseline
   whether the badge is on it or not, so nothing beside it moves, and the box
   is never wider than the badge, so where the row has room to spare the pill
   still sits after the slug rather than at the far end of the row. */
.automate-designer-page .page-subtitle:has(> code.type-badge) {
  height: 1lh;
  max-width: max-content;
  white-space: normal;
}

.automate-designer-page .page-subtitle:has(> code.type-badge)::before {
  content: "\200B";
}

/* In the one-row header the status never gives way: the description and the
   slug beside it can be cut, and a mark saying the workflow is not ready to
   run cannot. */
.automate-designer-page .tool-header-status,
.slim-header-page .tool-header-status {
  flex: none;
  margin-top: 0;
}

.automate-designer-page .tool-header-actions,
.slim-header-page .tool-header-actions {
  flex: none;
  flex-wrap: nowrap;
}

/* A window too narrow for the actions beside the name and the pill puts the
   actions on a line of their own under them, and their buttons wrap there if
   that line is still too narrow: at a tablet's 1024px the nine labelled
   buttons were wider than the row, so Run lay over the pill, the name had no
   width at all and Delete ran off the side of the screen. Condensed (below)
   they fit beside the name down to about 750px, so this is what holds the
   header together below that, and wherever a header has more actions than
   that. What decides it is the text's basis, room for the pill and the first
   ten letters or so of a name, and never the name's own length: a long name
   does not move the actions, which would double the card for height the
   canvas wants. */
.automate-designer-page .tool-header-main {
  flex-wrap: wrap;
}

.automate-designer-page .tool-header-text {
  flex: 1 1 17rem;
}

.automate-designer-page .tool-header-actions {
  flex: 0 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.automate-designer-page .tool-header-actions .btn,
.slim-header-page .tool-header-actions .btn {
  padding: 6px 11px;
  font-size: 13px;
  white-space: nowrap;
}

/* A header that condenses (tool-header's Condense: the Automate designer's)
   draws each action as an icon-only square and its status pill as its mark
   alone wherever the labelled row would cut the name. The designer's nine
   labelled buttons are 907px, so at a desktop's 1500px they left a name 230px
   and cut "Expense receipt reimbursement" to "Expense receipt reimb...", and
   at 1024px they did not fit at all. Condensed they are about 300px. The width
   is the header's own (a container query), since the rail or the sidebar
   beside it decides how much of the window it has; at 1600px of it the
   labelled row still leaves a name of forty-odd letters whole. The words stay
   in the markup, clipped as .visually-hidden clips, so each control's name is
   unchanged, and each action carries them as its tooltip, as does the pill
   (NeedsStatus). */
.tool-header-condensable {
  container: condensable-header / inline-size;
}

@container condensable-header (max-width: 1600px) {
  /* A 32px square: a header's buttons are 40px tall (.tool-header-actions
     .btn), which as squares round a 16px icon read as blocks, and the
     product's 28px icon square sat small beside a 19px name. */
  .tool-header-condensable .tool-header-actions .tool-header-action {
    position: relative;
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    justify-content: center;
  }
  .tool-header-condensable .tool-header-action-text,
  .tool-header-condensable .tool-header-status .status-pill-words {
    position: absolute;
    left: 0;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  /* The pill keeps its yellow round the pencil, as wide as it is tall. */
  .tool-header-condensable .tool-header-status .status-pill {
    position: relative;
    padding: 4px 7px;
  }
}

/* Below 1100px of header a slug seldom fits beside a name, and one that does
   not fit leaves its box empty between the name and the pill: the slug's
   wrap hides the badge, not the room its box was given. At a tablet's 1024px
   that put "Expense receipt reimbursement" a hand's width from its pencil. So
   narrower than that the slug is left out and the pill follows the name. */
@container condensable-header (max-width: 1100px) {
  .tool-header-condensable .page-subtitle:has(> code.type-badge) {
    display: none;
  }
}

/* On a phone the row cannot hold all of it: at 390px the description and the
   slug truncate to two or three characters each, which is worse than not
   showing them, so they go and the actions take their own line. */
@media (max-width: 700px) {
  .automate-designer-page .tool-header-text,
  .slim-header-page .tool-header-text {
    display: block;
  }
  .automate-designer-page .page-subtitle,
  .slim-header-page .page-subtitle {
    display: none;
  }
  .automate-designer-page .tool-header-actions,
  .slim-header-page .tool-header-actions {
    margin-left: 0;
    /* nowrap is a desktop rule: it stops a long name pushing Delete onto a
       second row and doubling the card, which is height the canvas wants. Four
       buttons do not fit 390px, and nowrap there put Delete off the side of the
       scroll box - reachable only by dragging the whole page sideways, which no
       page-level overflow check can see because .main-content is what scrolls.
       A phone card can afford the second row: the page flows there.

       flex-wrap alone does nothing here: the desktop rule is flex: none, so the
       container stays as wide as one row of buttons needs and never reaches a
       width to wrap at. It has to be allowed to shrink as well. */
    flex: 0 1 auto;
    min-width: 0;
    flex-wrap: wrap;
  }
  /* And the row itself wraps, so the actions can drop below the title rather
     than squeezing it to nothing. */
  .automate-designer-page .tool-header-main,
  .slim-header-page .tool-header-main {
    flex-wrap: wrap;
  }
}

/* --- The panel switch --- */
.automate-panel-switch {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* The pills are the shared skin (.tool-tabs-pills on the container); only how
   they divide the switch is this one's own. */
.automate-panel-switch .tab-label {
  flex: 1;
  justify-content: center;
}

/* Neither panel shows until a radio names it, which is the shape every strip in
   the product uses: hide both, then reveal the one asked for. */
.automate-designer-palette,
.automate-designer-inspector {
  display: none;
}

/* Reaching forward with ~ is why both radios are the grid's first children.
   The shared hidden-radio rule positions them out of flow, so neither takes a
   cell of its own. */
#automate-panel-nodes:checked ~ .automate-designer-palette,
#automate-panel-settings:checked ~ .automate-designer-inspector {
  display: block;
}

#automate-panel-nodes:checked ~ .automate-panel-switch .tab-label[for="automate-panel-nodes"],
#automate-panel-settings:checked ~ .automate-panel-switch .tab-label[for="automate-panel-settings"] {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--accent);
}

.automate-designer:has(> input[name="automate-panel"]:focus-visible) .automate-panel-switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* The dot only means anything while there is an edit to lose, and the guard
   marks the switch when there is. */
/* The shared skin sizes an icon inside a pill; the colour is what this one adds,
   because the dot means "there is an edit to lose". */
.automate-panel-unsaved {
  color: var(--sev-warn-text);
}

.automate-panel-switch:not([data-unsaved]) .automate-panel-unsaved {
  display: none;
}

/* --- The divider --- */
.automate-panel-split {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: col-resize;
  touch-action: none;
}

.automate-panel-grip {
  width: 5px;
  height: 64px;
  border-radius: 3px;
  background: var(--text-muted);
  opacity: 0.55;
}

.automate-panel-split:hover .automate-panel-grip,
.automate-panel-split.is-dragging .automate-panel-grip {
  opacity: 1;
}

/* Below 960px there is no room for a column beside the canvas, so the canvas
   keeps the top as a band and the panel stacks under the switch. The page
   flows again there: four stacked bands do not fit a phone, and filling the
   window is a desktop idea. */
@media (max-width: 960px) {
  .automate-designer-page {
    height: auto;
  }
  .automate-designer {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: clamp(300px, 42vh, 460px) auto auto;
  }
  .automate-designer-canvas {
    grid-column: 1;
    grid-row: 1;
  }
  .automate-panel-switch {
    grid-column: 1;
    grid-row: 2;
    margin-top: var(--space-3);
  }
  .automate-designer-palette,
  .automate-designer-inspector {
    grid-column: 1;
    grid-row: 3;
  }
  .automate-panel-split {
    display: none;
  }
}

/* The panel cell is the scroller, and this is not a second one. It used to
   carry its own max-height and overflow, from before the panel became a grid
   cell that sizes itself: two nested scroll boxes meant which one a finger
   moved depended on where it landed and which still had room, and the inner
   one's height was measured from the viewport rather than from its cell, so it
   disagreed with the cell it sat in. */
.automate-palette {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.automate-palette-search {
  margin: 0;
}

/* The search and the pickers stand still while the node list scrolls under
   them. Sticky inside the panel cell rather than a second scroll box: the cell
   stays the one scroller a finger or a wheel moves (see .automate-palette),
   and the head simply stops at its top edge. The negative margins take it out
   to the palette's edges past the padding, so no strip of the list shows
   above or beside it as it scrolls by - the shape .automate-inspector-head
   has on the other side of the switch. */
.automate-palette-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: calc(var(--space-3) * -1) calc(var(--space-3) * -1) 0;
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

/* Takes and Gives, side by side under the search: two narrow pickers rather
   than one wide one, because the pair is read as a question about the step
   between them. */
.automate-palette-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.automate-palette-filter .form-group {
  margin: 0;
}

/* Collapse all and Expand all, two small squares at the head's right edge
   under the pickers, where a reader about to scan the list below finds them. */
.automate-palette-fold {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
}

/* The recommendations read as the answer rather than as another category. */
/* The recommendations' slot draws no box of its own, so an empty one adds no
   gap to the palette's column and a full one lays out as the group always
   did. */
.automate-palette-recommended {
  display: contents;
}

.automate-palette-suggested > summary {
  color: var(--accent);
}

/* Which output port the recommendations under it are from, on a step with
   more than one. */
.automate-palette-port {
  margin: var(--space-2) 0 var(--space-1);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.automate-palette-narrowed,
.automate-library-narrowed {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
}

/* Automate > Reference. A reading page, so it is capped at a comfortable
   measure rather than filling a 1500px screen, and its section titles are
   sentence case at the compare Status Reference's size. The tables underneath
   are the shared data-table and are not capped, because "a link may feed it"
   needs the width. */
.automate-reference {
  --automate-reference-measure: 900px;
}

.automate-reference-band {
  margin-bottom: 32px;
}

.automate-reference-lead {
  max-width: var(--automate-reference-measure);
  margin: 0 0 var(--space-3);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
}

.automate-reference-heading {
  margin: 0 0 var(--space-2);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.automate-reference-band > .form-hint {
  max-width: var(--automate-reference-measure);
  margin: 0 0 var(--space-3);
}

/* Reference > Smart recommendations: a group per port they are offered on,
   and each recommendation drawn as the chain it places, a card per step with
   what is linked into it, one under the other.

   The groups take the page's width, unlike the prose above them: capped at
   the reading measure they left a third of a wide screen empty beside a
   single column of cards, on the page most likely to grow. Their
   recommendations are a grid of cards, the cards of a row one height, and a
   chain reads down its card rather than across the page: across, a chain of
   two took a row of its own and left half of it empty, and most chains are
   two. */
.automate-recommend-group {
  margin: 0 0 var(--space-4);
}

/* How the recommendations work, a press away between the filter and the list:
   three paragraphs above the filter put the list a screen down, and on a
   phone two. */
.automate-reference-about {
  margin: 0 0 var(--space-4);
}

.automate-reference-about > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}

.automate-reference-about[open] > summary {
  margin-bottom: var(--space-3);
}

/* The filter: a search box that takes the room and the two drop-downs at
   their own width, all on the left. The shared toolbar spreads its children
   to either end, which suits a count and a pager and not three controls that
   are read together. */
.automate-recommend-filters {
  justify-content: flex-start;
}

.automate-recommend-filters input[type="search"] {
  flex: 1 1 260px;
  max-width: 420px;
}

.automate-recommend-filters .form-select {
  width: auto;
  max-width: 100%;
}

.automate-recommend-count {
  margin: 0 0 var(--space-3);
}

.automate-recommend-from {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.automate-recommend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: var(--space-2);
}

.automate-recommend {
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.automate-recommend-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px var(--space-2);
  font-size: 13px;
}

/* The recommendation's id, for finding it in the file, at the end of its
   heading rather than beside the words it would otherwise read as part of. */
.automate-recommend-id {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}

/* A recommendation of one step: the input the port goes into, in a line. */
.automate-recommend-single {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.automate-recommend-single strong {
  color: var(--text);
}

.automate-recommend-into {
  font-size: 11.5px;
}

.automate-recommend-help,
.automate-recommend-only {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

.automate-recommend-only {
  font-style: italic;
}

.automate-recommend-chain {
  list-style: none;
  margin: var(--space-2) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.automate-recommend-step {
  position: relative;
  min-width: 0;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.automate-recommend-step.is-main {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
}

.automate-recommend-step.is-missing {
  border-color: var(--danger, #e05252);
}

/* The arrow from one step of a chain to the next, in the gap between them,
   under the step's icon. */
.automate-recommend-step + .automate-recommend-step::before {
  content: "\2193";
  position: absolute;
  left: 18px;
  top: -19px;
  line-height: 18px;
  color: var(--text-muted);
  font-size: 13px;
}

.automate-recommend-step-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px var(--space-2);
}

.automate-recommend-step-label {
  font-size: 12.5px;
  font-weight: 600;
}

.automate-recommend-role {
  font-size: 11px;
  color: var(--text-muted);
}

.automate-recommend-links {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* The note beside a port's type badge, naming what a setting could change it
   to. Deliberately not a badge: a second pill would read as a second type the
   port carries at the same time, which is the thing it is there to deny. */
.automate-port-also {
  margin-left: var(--space-1);
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
}

/* A cell of badges, each one nowrap in itself: the fourteen reference kinds
   would otherwise be one unbreakable line that pushes the two columns beside
   it off the page, which is how the settings table first shipped. */
.automate-reference-kinds {
  line-height: 2;
}

/* An example value, shown as it would arrive: a record stream's is two lines,
   so it wraps rather than scrolling the row. */
.automate-reference-example {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

/* The Node Library's search and its two pickers: one line, each label to the
   left of its box and no hint under any of them, so the bar costs one row of
   height and the cards have the rest. The search takes what the pickers leave,
   up to a measure; on a phone the three stack with their boxes in one column
   (below), so the labels' different lengths do not stagger them. */
.automate-library-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  margin-bottom: var(--space-3);
}

.automate-library-search .form-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.automate-library-search .form-label {
  margin: 0;
  white-space: nowrap;
}

.automate-library-search-q {
  flex: 1 1 260px;
  max-width: 560px;
}

.automate-library-search-q .form-input {
  flex: 1 1 auto;
  min-width: 0;
}

.automate-library-search .form-select {
  width: 160px;
}

.automate-palette-group > summary {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-1);
  cursor: pointer;
}

/* A section of a large heading (contract.Descriptor.Subcategory), a
   disclosure inside the group: the Power Platform API's two hundred steps
   are one heading with a line per namespace. Sentence case, the text's own
   colour and its regular weight, so it reads as part of the heading above it
   rather than as a heading of its own (at 500 it read as bold beside the
   step labels), with the count beside it because a closed section
   otherwise says nothing about how much is in it. */
.automate-palette-section > summary {
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-2);
  margin-bottom: var(--space-1);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
}

.automate-palette-section > summary:hover {
  background: var(--surface-hover);
}

.automate-palette-section-count {
  margin-left: var(--space-1);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.automate-palette-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: var(--space-2);
  align-items: center;
  width: 100%;
  padding: var(--space-2);
  margin-bottom: var(--space-1);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: grab;
  /* manipulation, not none: none tells the browser never to treat a touch
     starting here as a pan, so a finger landing on a step could not scroll the
     list at all - only the group headings could, because they carry no such
     rule. It was here for the drag, which is now a mouse gesture only (see the
     pointerType gate in automate-canvas.js). manipulation keeps the scroll and
     the pinch and drops the double-tap zoom delay, so a tap answers at once. */
  touch-action: manipulation;
}

.automate-palette-item:hover,
.automate-palette-item:focus-visible {
  border-color: var(--accent);
  background: var(--surface-hover);
  outline: none;
}

.automate-palette-item.is-dragging {
  opacity: 0.5;
}

/* A step the administrator has not switched on is shown rather than hidden,
   because an absent step is indistinguishable from one the product does not
   have. It carries no data-palette-kind, so it cannot be dragged, tapped or
   clicked onto the canvas, and the cursor says so rather than promising a
   drag that will not start. */
.automate-palette-item.is-unavailable {
  cursor: default;
  background: transparent;
  border-style: dashed;
  color: var(--text-muted);
}

.automate-palette-item.is-unavailable:hover {
  border-color: var(--border);
  background: transparent;
}

/* A switched-off step's icon is greyed with its words. */
.automate-palette-item.is-unavailable .automate-palette-chip {
  opacity: 0.55;
}

/* What a new workflow starts from: one card per trigger, each with its icon
   and what it does, and exactly one of them chosen.

   The radio is drawn rather than hidden behind the card. It is the control
   that says only one of these can be chosen, and a card that merely looks
   pressed says that less clearly than the thing everybody already knows; the
   card is the hit area around it. */
.automate-trigger-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.automate-trigger-choices .form-label {
  margin-bottom: 2px;
}

/* The cards are the part of the New workflow dialog that scrolls, and the body
   lays the dialog out so that they have the room to: the fields somebody
   types into on the left and what starts the workflow on the right, each half
   the dialog wide. The list is then as tall as the dialog is, where under the
   fields it was left whatever the fields did not take, which on a 768px
   laptop was 135px for nine triggers.

   The two sides are stretched to the body's height (a flex row's default), so
   the list's own height is the body's and it scrolls inside it; the body
   itself scrolls only where the fields alone are taller than the window,
   which keeps the buttons in the foot in sight either way.

   The padding and the matching negative margin give a card's focus outline
   (2px, offset 1px) room inside the scroll box, which would otherwise clip it
   on every side. */
.automate-new-workflow .modal-body:has(> .automate-trigger-choices) {
  display: flex;
  gap: var(--space-4);
}

.automate-new-fields,
.modal-body > .automate-trigger-choices {
  flex: 1 1 0;
  min-width: 0;
}

.modal-body > .automate-trigger-choices {
  min-height: 0;
  margin-bottom: 0;
}

.automate-trigger-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 3px;
  margin: -3px;
}

.automate-trigger-list > .automate-trigger-choice,
.automate-trigger-choices > .form-label,
.automate-trigger-choices > .form-hint {
  flex: none;
}

/* Too narrow for two columns: the fields, then the list under them. Only the
   list gives up height, down to about two and a half cards, past which the
   body scrolls, since a list one card tall is not a choice anybody can read. */
@media (max-width: 760px) {
  .automate-new-workflow .modal-body:has(> .automate-trigger-choices) {
    flex-direction: column;
    gap: 0;
  }

  .automate-new-fields {
    flex: none;
  }

  .modal-body > .automate-trigger-choices {
    flex: 0 1 auto;
    min-height: 200px;
  }
}

.automate-trigger-choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.automate-trigger-choice:hover {
  border-color: var(--accent);
}

.automate-trigger-choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--surface-alt);
}

.automate-trigger-choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.automate-trigger-choice input {
  margin-top: 9px;
}

.automate-trigger-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.automate-trigger-label {
  font-weight: 600;
  font-size: 13px;
}

.automate-trigger-summary {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}

/* Settings > Services: what a service can do, one row per capability.
   Each group is a disclosure so a service with twenty capabilities is a page
   somebody can scan rather than a wall. */
/* Settings > Services > a service: the service itself and the settings its
   steps are held to. */
#service-detail-tab-service:checked ~ .tab-panel[data-tab="service"],
#service-detail-tab-steps:checked ~ .tab-panel[data-tab="step-settings"] {
  display: block;
}

#service-detail-tab-service:checked ~ .tool-tabs-header .tab-bar label[for="service-detail-tab-service"],
#service-detail-tab-steps:checked ~ .tool-tabs-header .tab-bar label[for="service-detail-tab-steps"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* How many step settings stand, beside the tab's name. */
.service-detail-tabs .tab-count {
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-elevated);
  font-size: 11px;
  font-weight: 600;
}

/* The row whose rule the form below is changing. */
.data-table.svc-overrides-table tr.is-editing td {
  background: var(--accent-dim);
}

.svc-override-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* Settings > Services > Step settings: the three choices of the add form
   share a row where there is room for them and stack where there is not. */
.svc-override-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 var(--space-3);
}

.svc-override-form {
  margin-top: var(--space-3);
}

.data-table.svc-overrides-table th.svc-override-for {
  width: 22%;
}

.data-table.svc-overrides-table th.svc-override-setting {
  width: 22%;
}

.data-table.svc-overrides-table th.svc-override-mode {
  width: 14%;
}

.data-table.svc-overrides-table th.svc-override-value {
  width: auto;
}

.data-table.svc-overrides-table th.svc-override-actions {
  width: 1%;
}

.svc-capability-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.svc-capability-group > summary {
  padding: var(--space-2);
  cursor: pointer;
  font-weight: 600;
}

.svc-capability-count {
  margin-left: var(--space-2);
  font-weight: 400;
  color: var(--text-muted);
}

.svc-capability {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: start;
  padding: var(--space-2);
  border-top: 1px solid var(--border);
}

/* A switched-off row stands back without disappearing: the point of listing
   it is that an author can see the capability exists and ask for it. */
.svc-capability.is-off .svc-capability-icon,
.svc-capability.is-off .svc-capability-label {
  opacity: 0.7;
}

.svc-capability-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
}

.svc-capability-glyph {
  width: 20px;
  height: 20px;
}

.svc-capability-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.svc-capability-label {
  font-weight: 600;
}

.svc-capability-summary,
.svc-capability-step,
.svc-capability-perms,
.svc-capability-why,
.svc-capability-grant {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.svc-capability-why {
  color: var(--text);
}

/* The services pages' small status pill: what a capability does, and whether
   the tenant has granted a permission.

   Its own family rather than the .status-pill one, for one reason: that rule
   sets text-transform: capitalize, which suits the single words it was
   written for ("ok", "failed") and turns "Waiting for consent" into title
   case. These labels are sentences of the product's own copy.

   It is defined at all because the first version of this card was written
   with class="pill pill-warn" and nothing in the stylesheet answered to
   either name, so every one of them rendered as bare text with no shape and
   no colour - a class that draws nothing looks exactly like a class nobody
   thought to add. TestEveryPillUsedInATemplateHasARule is the guard. */
.svc-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-elevated);
  color: var(--text-muted);
}

.svc-pill-ok {
  background: var(--sev-ok-bg);
  color: var(--sev-ok-text);
}

.svc-pill-warn {
  background: var(--sev-warn-bg);
  color: var(--sev-warn-text);
}

/* The Check and portal buttons sit on one row above the permissions table,
   wrapping rather than squeezing on a narrow panel. */
.svc-granted-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.svc-granted-app code {
  word-break: break-all;
}

/* The button keeps its own column so every row's control sits at the same x,
   whatever the label above it happens to be. */
.svc-capability-toggle {
  white-space: nowrap;
}

/* Below the phone breakpoint the three columns stack, or the button is
   squeezed into a strip too narrow to read. */
@media (max-width: 640px) {
  .svc-capability {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .svc-capability-toggle {
    grid-column: 2;
    justify-self: start;
    margin-top: var(--space-1);
  }
}

/* A library row whose step is switched off. The card still opens, so it
   keeps its affordances and only the words change. */
.library-card.is-unavailable .automate-palette-chip {
  opacity: 0.55;
}

.library-card-unavailable {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}

.automate-palette-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--automate-app) 18%, transparent);
  color: var(--automate-app);
  flex: none;
}

/* A step's own icon, and under it the icon of the module it comes from: the
   same picture as that module's home card, launcher tile and sidebar crest.
   The header band's colour already says which app a step belongs to, and a
   colour is a thing you have to have been told; the icon is not.

   Automate's own steps carry none - every step in the library is reachable
   from Automate, so a badge on all of them would say nothing at all. */
.library-card-chips {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: none;
}

/* The palette entry's icon stack: the step's own icon, and under it the badge
   saying where the step comes from. Column rather than row for the same reason
   the card's is: the badge is a mark on the icon, and beside it it reads as a
   second icon of equal weight. A tighter gap because a palette row is two
   lines of text high and the card is a paragraph. */
.automate-palette-chips {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: none;
}

.automate-module-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--automate-app) 28%, transparent);
  color: var(--automate-app);
  flex: none;
}

/* On the <svg> the mdi-icon helper renders, never on a wrapper: an mdi-icon
   Class lands on the svg itself. */
.automate-module-badge-icon {
  width: 12px;
  height: 12px;
}

/* On the <svg> the mdi-icon helper renders, never on a wrapper. */
.automate-palette-icon {
  width: 16px;
  height: 16px;
}

.automate-palette-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* A step's name wraps rather than truncating, because it is the one thing in
   the list a reader has to be able to read. The panel is 248px by default and
   the label box inside it 182px, which ellipsised the longest names to
   nonsense: "When another workflow calls this one" read as "When another
   workflow calls thi...". The divider can widen the panel, but a name should
   not need it. The ports line below still truncates: that is a hint, and its
   words repeat down the whole list. */
.automate-palette-label {
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: break-word;
}

.automate-palette-ports {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The ghost that follows the pointer while a palette item is dragged. */
.automate-palette-ghost {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

/* --- Canvas --- */
.automate-canvas-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* The canvas and its caption. The frame is the positioned ancestor so the
   caption can sit on the canvas floor while staying a sibling of the wrap:
   every canvas mutation swaps the wrap's innerHTML, so a child of it would be
   thrown away on the first edit. */
.automate-canvas-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.automate-canvas-frame > .automate-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.automate-canvas-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  margin: 0;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The caption is one line on the canvas floor, which suits a wide canvas and
   truncates most of a sentence on a phone - and a phone reader is the one who
   needs telling that a step can be pressed. It wraps where the page flows
   anyway.
   Here rather than in the layout media block further up, because that block
   sits earlier in the sheet and at equal specificity the later rule wins: an
   override has to follow what it overrides. */
@media (max-width: 960px) {
  .automate-canvas-hint {
    white-space: normal;
  }
  /* And the clauses about a port drag and the arrow keys go: they name a mouse
     and a keyboard, and wrapping them was four lines standing over a third of a
     phone's canvas. What is left is the gesture a finger has. */
  .automate-canvas-hint-pointer {
    display: none;
  }
}

.automate-canvas-alert:empty {
  display: none;
}

/* The form a workflow serves, above the canvas: the icon beside the sentences,
   and no margin of its own, since the frame spaces the bands above the canvas. */
.automate-form-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
}

.automate-form-note p {
  margin: 0;
}

.automate-form-note p + p {
  margin-top: 4px;
}

.automate-form-note-icon {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
}

/* A link inherits the alert's own colour, so it is marked as one by weight and
   an underline instead. */
.automate-form-note a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* The lock a step the form keeps wears in its band, in the band's own muted
   ink: a fact about the step rather than a warning, so never a state colour. */
.automate-kept-mark use {
  fill: var(--text-muted);
}

/* A step the form keeps, at the head of its settings: the lock beside the
   sentences, as the canvas's form note has its icon. */
.automate-kept-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.automate-kept-note p {
  margin: 0;
}

.automate-kept-note p + p {
  margin-top: 4px;
}

.automate-kept-note-icon {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
}

.automate-kept-note a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* The fieldset that makes a kept step's settings read-only draws nothing of
   its own: min-width undoes a fieldset's min-content, which would otherwise
   let a long value push the panel wider than its column. */
.automate-kept-fields {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.automate-canvas-alert .alert {
  margin: 0;
}

/* The notice's lines sit a little apart: each is a sentence about a different
   part of the canvas. */
.automate-canvas-notices li + li {
  margin-top: 3px;
}

/* A single notice is a line of its own, with no heading above it. */
.automate-canvas-notices.is-single {
  padding-top: 8px;
  padding-bottom: 8px;
}

.automate-canvas-notices.is-single p {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The steps still to finish, over the canvas's top-left corner rather than in
   a strip above it: this is showing most of the time a canvas is being drawn,
   and a strip takes its height from the canvas, which on a phone was a third
   of it. Closed it is a pill with a count; open, a short list. */
.automate-canvas-unfinished {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  max-width: min(460px, calc(100% - 16px));
}

.automate-canvas-unfinished:empty {
  display: none;
}

.automate-unfinished {
  border: 1px solid var(--sev-warn-border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.18));
  overflow: hidden;
}

.automate-unfinished-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sev-warn-text);
  background: var(--sev-warn-bg);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.automate-unfinished-summary::-webkit-details-marker {
  display: none;
}

.automate-unfinished-icon {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.automate-unfinished-list {
  margin: 0;
  padding: 8px 12px 10px 26px;
  max-height: 40vh;
  overflow: auto;
  font-size: 12px;
  color: var(--text);
}

.automate-unfinished-list li + li {
  margin-top: 4px;
}

/* On the text's baseline, so the step's name reads as the first word of its
   sentence rather than a control floating above it. */
.automate-notice-step {
  vertical-align: baseline;
}

/* The same, in the step's own settings panel: a line per step still to
   finish behind it, each a link opening the canvas that step is on. */
.automate-inside-unfinished p {
  margin: 0;
}

.automate-inside-unfinished ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.automate-inside-unfinished li + li {
  margin-top: 2px;
}

/* What is still to finish behind a step that places a process or runs a
   workflow, named the way down from it: a line each, under the step's name,
   since one process can hold several and run together they read as one
   sentence that does not parse. */
.automate-unfinished-way {
  display: block;
  margin-top: 2px;
  padding-left: 10px;
  overflow-wrap: anywhere;
}

/* The still-to-finish mark in a step's corner answers a hover with what the
   step is waiting for, which the cursor says there is to read. */
.automate-needs-mark {
  cursor: help;
}

.automate-canvas-wrap {
  position: relative;
  height: clamp(420px, calc(100vh - var(--topbar-h) - 250px), 860px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image: radial-gradient(circle, var(--automate-grid) 1px, transparent 1.4px);
  background-size: 22px 22px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.automate-canvas-wrap.is-panning {
  cursor: grabbing;
}

.automate-canvas-wrap.is-drop-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.automate-canvas-wrap.is-readonly {
  height: auto;
  max-height: 460px;
  display: flex;
  justify-content: center;
}

.automate-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.automate-canvas.is-readonly {
  height: auto;
  max-height: 460px;
}

/* --- Nodes --- */
.automate-node {
  cursor: grab;
  outline: none;
}

.automate-node.is-dragging {
  cursor: grabbing;
}

.automate-canvas.is-readonly .automate-node {
  cursor: default;
}

.automate-node-box {
  fill: var(--automate-node-bg);
  stroke: var(--automate-node-border);
  stroke-width: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
}

.automate-node:hover .automate-node-box {
  stroke: var(--accent);
}

.automate-node.is-selected .automate-node-box,
.automate-node:focus-visible .automate-node-box {
  stroke: var(--accent);
  stroke-width: 2;
}

.automate-node:focus-visible .automate-node-box {
  stroke-dasharray: 5 3;
}

/* A step still to finish: a setting not given yet, or a mandatory input
   nothing is linked to. The notice colour the inspector's unfilled boxes use,
   because it is the same fact - the step is waiting for somebody - and not the
   red a value filled in wrongly gets. Not on a step that is also wrong, which
   keeps the red; and not while selected, where the accent says which step the
   settings are open for. */
.automate-node.needs-info:not(.is-selected):not(.has-problem) .automate-node-box {
  stroke: var(--sev-warn-text);
  stroke-width: 1.5;
}

.automate-needs-mark-dot {
  fill: var(--sev-warn-text);
}

.automate-needs-mark-glyph {
  fill: #ffffff;
  pointer-events: none;
}

/* The shield on a target's corner (NodeView.Shield). Ringed in the canvas's
   own ground so it reads as a badge standing on the corner rather than as a
   blot on the box's border; muted until a run has checked the record, then
   the notice colours say how it went. */
.automate-shield {
  cursor: help;
}

.automate-shield-disc {
  fill: var(--automate-node-bg);
  stroke: var(--surface);
  stroke-width: 2;
}

/* The wizard's mark: the shield's mirror on the top-left corner, filled in
   the wizard's colour with the glyph knocked out of it, so it reads as a mark
   whatever colours somebody can tell apart. */
.automate-wizard-mark {
  pointer-events: none;
}
.automate-wizard-disc {
  fill: var(--automate-wizard);
  stroke: var(--surface);
  stroke-width: 2;
}
.automate-wizard-glyph {
  fill: var(--automate-node-bg);
}

.automate-shield-glyph {
  fill: var(--text-muted);
  pointer-events: none;
}

.automate-shield.is-ready .automate-shield-disc {
  fill: var(--sev-ok-text);
}

.automate-shield.is-ready .automate-shield-glyph,
.automate-shield.is-problems .automate-shield-glyph {
  fill: #ffffff;
}

.automate-shield.is-own .automate-shield-glyph {
  fill: var(--sev-ok-text);
}

.automate-shield.is-problems .automate-shield-disc {
  fill: var(--sev-prob-text);
}

.automate-node.has-problem .automate-node-box {
  stroke: var(--sev-prob-text);
}

.automate-node.is-missing .automate-node-box {
  stroke: var(--sev-prob-text);
  stroke-dasharray: 6 4;
}

/* A step that is turned off, and a step below one.

   Both are dimmed, because both are facts about the next run rather than
   about the drawing: neither is going to do anything. Only the one that is
   off is marked - with the word in its corner and a dashed box - because the
   mark says which switch to press to get the rest back, and a mark on every
   step below it would send a reader hunting for a switch that is not there.

   Opacity on the group rather than a fill per shape: a node is a dozen
   elements with their own colours, and dimming it is one statement about the
   whole box. The ports keep their hit area, so a link can still be drawn to a
   step that is off - turning one off is not the same as taking it out of the
   workflow, and it would not be worth having if it were. */
.automate-node.is-off,
.automate-node.is-off-above {
  opacity: 0.42;
}

.automate-node.is-off .automate-node-box {
  stroke-dasharray: 6 4;
}

.automate-node.is-off:hover,
.automate-node.is-off-above:hover,
.automate-node.is-off.is-selected,
.automate-node.is-off-above.is-selected,
.automate-node.is-off:focus-within,
.automate-node.is-off-above:focus-within {
  opacity: 0.78;
}

.automate-node-header {
  fill: color-mix(in srgb, var(--automate-app) 24%, var(--automate-node-bg));
  pointer-events: none;
}

/* A process step stands for a canvas of its own: a second, dashed rule under
   the header says there is more behind the box, and a double-click opens it.
   A rule rather than a badge, because the header already holds the icon, the
   title and the lamp, and a fourth thing in it would crowd the one that names
   the step. */
.automate-node-composite {
  stroke: var(--automate-app);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

/* A rule between two groups of a step's ports: thin and solid, in the box's
   own border colour, so it divides the box rather than marking it as the
   process step's dashed rule does. */
.automate-node-rule {
  stroke: var(--automate-node-border);
  stroke-width: 1;
  pointer-events: none;
}

.automate-node-glyph {
  fill: var(--automate-app);
  pointer-events: none;
}

.automate-node-title {
  fill: var(--text);
  font: 600 13px var(--font-body);
  pointer-events: none;
}

/* The step's id, at the end of the band on the editing canvas. The tag is
   the node's own ground showing through the band's tint, so it reads as a
   plate set into the band in either theme rather than as a second colour laid
   on it, and the id is in the code face at the text colour: it is the thing
   being read. Neither takes the pointer, so a press on the tag is a press on
   the step, as a press on its name is. */
.automate-node-id-tag {
  fill: var(--automate-node-bg);
  fill-opacity: 0.72;
  pointer-events: none;
}

.automate-node-id-text {
  fill: var(--text);
  font: 600 10px var(--font-mono);
  pointer-events: none;
}

.automate-node-replay {
  cursor: pointer;
}

.automate-node-replay rect {
  fill: var(--surface-hover);
  stroke: var(--automate-node-border);
  stroke-width: 1;
}

.automate-node-replay use {
  fill: var(--text-muted);
  pointer-events: none;
}

.automate-node-replay:hover rect,
.automate-node-replay:focus-visible rect {
  fill: var(--surface-elevated);
  stroke: var(--accent);
}

.automate-node-replay:hover use,
.automate-node-replay:focus-visible use {
  fill: var(--text);
}

.automate-node-note {
  fill: var(--text-muted);
  font: italic 11px var(--font-body);
  pointer-events: none;
}

/* "+n more" on a step keeping ports back, and "show fewer" on one that has
   been opened. A pill rather than bare words, from the same reasoning as the
   inspector's own label-row buttons: a run of text with nothing around it does
   not say it can be pressed, and this one has to, because the ports it stands
   for are otherwise unreachable. The pill is also the hit target, since
   eleven-pixel text is a two-pixel-tall thing to aim at. */
.automate-node-more {
  cursor: pointer;
}

.automate-node-more-hit {
  fill: var(--surface-hover);
  stroke: var(--automate-node-border);
  stroke-width: 1;
}

.automate-node-more:hover .automate-node-more-hit,
.automate-node-more:focus-visible .automate-node-more-hit {
  fill: var(--surface-elevated);
  stroke: var(--accent);
}

.automate-node-more-text {
  fill: var(--text-muted);
  font: 600 11px var(--font-body);
  /* The pill under it is what takes the press, so the words must not sit in
     front of it and swallow the hover. */
  pointer-events: none;
}

.automate-node-more:hover .automate-node-more-text,
.automate-node-more:focus-visible .automate-node-more-text {
  fill: var(--text);
}

/* What a held value holds, drawn where its input ports would be. Monospace,
   because most of these are data rather than prose - a number, a date, a
   JSON fragment - and a proportional face makes a column of them hard to
   compare at a glance. */
.automate-node-held {
  fill: var(--text-muted);
  font: 10.5px var(--font-mono);
  pointer-events: none;
}

/* The right-click menu. Positioned inside the canvas frame by the script,
   which sets --menu-x and --menu-y; the copy is in the template. */
/* display on the class would beat the browser's own [hidden] rule, so the
   menu would be open from the first render and never close. */
.automate-menu[hidden] {
  display: none;
}

.automate-menu {
  position: absolute;
  left: var(--menu-x, 0);
  top: var(--menu-y, 0);
  z-index: 6;
  min-width: 160px;
  padding: var(--space-1);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.25));
}

.automate-run-menu {
  position: fixed;
}

/* The smart recommendations menu, opened around the point a link dragged out
   of an output port was let go on empty canvas. The slot is a point: the
   script puts it where the pointer was, and everything in the menu is placed
   from its centre. Each chip's offset arrives from the server as --dx and
   --dy (automateRadialLayout) and its words run away from the centre on the
   side the chip is on, so the ring reads outwards and no label crosses it. */
.automate-radial-slot {
  position: absolute;
  left: var(--radial-x, 50%);
  top: var(--radial-y, 50%);
  width: 0;
  height: 0;
  z-index: 8;
}

.automate-radial-slot[hidden] {
  display: none;
}

.automate-radial-slot.is-placing {
  opacity: 0.35;
  pointer-events: none;
}

.automate-radial {
  --radial-chip: 36px;
  position: absolute;
  left: 0;
  top: 0;
  animation: automate-radial-open 0.14s ease-out;
}

@keyframes automate-radial-open {
  from {
    opacity: 0;
    transform: scale(0.7);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .automate-radial {
    animation: none;
  }
}

.automate-radial-ring {
  position: absolute;
  left: calc(var(--radial-r, 84px) * -1);
  top: calc(var(--radial-r, 84px) * -1);
  width: calc(var(--radial-r, 84px) * 2);
  height: calc(var(--radial-r, 84px) * 2);
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--surface) 88%, transparent) 30%, color-mix(in srgb, var(--surface) 55%, transparent) 72%);
  pointer-events: none;
}

.automate-radial-item {
  position: absolute;
  left: 0;
  top: 0;
  /* Its own width, not the slot's: the slot is a point, and an absolutely
     placed box sized against a containing block of no width shrinks to its
     narrowest, which broke every label at every space. */
  width: max-content;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transform: translate(calc(var(--dx, 0px) - var(--radial-chip) / 2), calc(var(--dy, 0px) - var(--radial-chip) / 2));
}

.automate-radial-item.is-left {
  flex-direction: row-reverse;
  text-align: right;
  transform: translate(calc(var(--dx, 0px) + var(--radial-chip) / 2 - 100%), calc(var(--dy, 0px) - var(--radial-chip) / 2));
}

.automate-radial-item.is-top {
  flex-direction: column-reverse;
  text-align: center;
  transform: translate(calc(var(--dx, 0px) - 50%), calc(var(--dy, 0px) + var(--radial-chip) / 2 - 100%));
}

.automate-radial-item.is-bottom {
  flex-direction: column;
  text-align: center;
  transform: translate(calc(var(--dx, 0px) - 50%), calc(var(--dy, 0px) - var(--radial-chip) / 2));
}

.automate-radial-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--radial-chip);
  height: var(--radial-chip);
  flex: none;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--automate-app) 55%, var(--border));
  color: var(--automate-app);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.25));
  transition: transform 0.12s ease, background 0.12s ease;
}

.automate-radial-icon {
  width: 18px;
  height: 18px;
}

.automate-radial-words {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-width: 190px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.25));
}

.automate-radial-label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.automate-radial-chain {
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-muted);
}

.automate-radial-item:hover .automate-radial-chip,
.automate-radial-item:focus-visible .automate-radial-chip {
  transform: scale(1.12);
  background: color-mix(in srgb, var(--automate-app) 16%, var(--surface));
}

.automate-radial-item:hover .automate-radial-words,
.automate-radial-item:focus-visible .automate-radial-words {
  border-color: var(--accent);
}

.automate-radial-item:focus-visible {
  outline: none;
}

.automate-radial-centre {
  position: absolute;
  left: -15px;
  top: -15px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.automate-radial-centre:hover,
.automate-radial-centre:focus-visible {
  color: var(--text);
  border-color: var(--accent);
}

.automate-radial-more {
  position: absolute;
  left: 0;
  top: calc(var(--radial-r, 84px) + var(--radial-chip));
  margin: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.automate-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

/* display on the class beats the browser's own [hidden], the same trap the
   menu itself carries a rule for: the two switch items are one item and one
   hidden twin, and without this both would be drawn. */
.automate-menu-item[hidden] {
  display: none;
}

.automate-menu-item:hover:not(:disabled) {
  background: var(--surface-alt);
}

.automate-menu-item:disabled {
  color: var(--text-faint);
  cursor: default;
}

.automate-menu-item.is-danger {
  color: var(--sev-prob-text);
}

/* The panel for a selection of several steps: what they are, then what they
   have in common. */
.automate-selection-list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.automate-selection-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
}

.automate-selection-step-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Each selected step's id, hard against the right so the ids read down one
   column whatever the names beside them run to. */
.automate-selection-step-id {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  color: var(--text-muted);
}

/* Change is the tick that tells "set this to nothing" from "leave this
   alone", so it reads above the control it governs rather than beside it. */
/* One row per property: its own label on the left, Change hard against the
   right. They shared a column before, which cost a row per property and read
   as a heading for the field rather than as a switch on it. */
.automate-shared-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 6px;
}

.automate-shared-head > .form-label {
  margin-bottom: 0;
}

.automate-shared-change {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.automate-node-problem {
  fill: var(--sev-prob-text);
}

.automate-node-problem-mark {
  fill: #ffffff;
  font: 700 11px var(--font-body);
  pointer-events: none;
}

/* The offer of a conversion step beside a refused link: the sentence and the
   button on one row, wrapping to two on a narrow panel. */
.automate-convert-offer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

/* --- Ports --- */
.automate-port-hit {
  fill: transparent;
  cursor: crosshair;
}

.automate-canvas.is-readonly .automate-port-hit {
  cursor: default;
}

.automate-port-dot {
  fill: var(--automate-port);
  stroke: var(--automate-node-bg);
  stroke-width: 1.5;
  transition: transform 0.12s ease, fill 0.12s ease;
}

/* A record inside the port: a second, smaller dot on the same centre, saying
   there is something in here to take apart. It takes the node's own background
   so it reads as a hole in the dot rather than as a dot of another colour, and
   so a drag - which recolours the dot green or red - carries it along rather
   than washing it out. It is drawn over the dot and must never take the press:
   the dot is what a link starts from. */
.automate-port-inner {
  fill: var(--automate-node-bg);
  pointer-events: none;
}

/* Smart recommendations from this port, and nothing linked out of it yet: a
   small triangle just past the dot, pointing the way a drag out goes. Muted
   until the port is pointed at, so a canvas of steps is not a canvas of
   arrows, and never the press - the dot is what a link starts from. See
   render.PortView.Invites. */
.automate-port-recommend {
  fill: var(--text-muted);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.12s ease, fill 0.12s ease;
}

.automate-port:hover .automate-port-recommend {
  fill: var(--accent);
  opacity: 1;
}

/* The glyph that says what a port carries, inside the node beside the dot. It
   takes the muted text colour rather than the port colour, so it reads as a
   label of the port and not as part of the thing a link attaches to - and so a
   drag, which recolours the dot green or red, leaves it legible. */
.automate-port-glyph {
  fill: var(--text-muted);
  pointer-events: none;
}

/* The same glyph on its own, in the reference page's port-type table: the one
   place in the product that says what each one means. */
.automate-glyph-swatch {
  width: 14px;
  height: 14px;
  flex: none;
}

.automate-reference-type {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.automate-port.is-sequence .automate-port-dot {
  fill: var(--automate-node-bg);
  stroke: var(--automate-port);
  stroke-dasharray: 2 2;
}

.automate-port:hover .automate-port-dot,
.automate-port.is-active .automate-port-dot {
  fill: var(--accent);
  stroke: var(--accent);
  transform: scale(1.3);
}

.automate-port.is-compatible .automate-port-dot {
  fill: var(--automate-port-ok);
  stroke: var(--automate-port-ok);
  transform: scale(1.4);
}

/* A port this link can reach only through a conversion. Hollow rather than
   filled, because the link is not there yet: the fill is what green and red
   both use to say "this is a decided answer", and this one is an offer.
   Dropping here refuses the link and answers with the step on a button. */
.automate-port.is-convertible .automate-port-dot {
  fill: var(--automate-node-bg);
  stroke: var(--automate-port-via);
  stroke-width: 2.5;
  transform: scale(1.4);
}

.automate-port.is-convertible .automate-port-label {
  fill: var(--automate-port-via);
}

.automate-port.is-incompatible .automate-port-dot {
  fill: var(--automate-port-bad);
  stroke: var(--automate-port-bad);
  opacity: 0.4;
}

.automate-port-label {
  fill: var(--text-muted);
  font: 11px var(--font-body);
  pointer-events: none;
}

/* The mark on a mandatory input, the same asterisk every mandatory field in
   the product carries. Coloured apart from the label because at 11px a grey
   asterisk beside grey text is not a mark at all. */
.automate-port-required {
  fill: var(--sev-prob-text);
  font-weight: 700;
}

/* A mandatory input nothing is linked to. The node already carries the
   still-to-finish mark in its header (see NodeView.NeedsInfo); this says which
   port, on a step with four of them. A ring rather than a fill, so it reads as
   an outline waiting to be filled rather than as a port of some other type -
   and so it survives the drag colours, which recolour every dot green or red
   the moment a link is started. In the notice colour the mark and the
   inspector's unfilled boxes use: a link still to draw is a step being built,
   not a fault. */
.automate-port.is-unfed .automate-port-dot {
  fill: var(--automate-node-bg);
  stroke: var(--sev-warn-text);
  stroke-width: 2;
}

.automate-port.is-unfed .automate-port-label {
  fill: var(--sev-warn-text);
}

/* --- Edges --- */
.automate-edge {
  fill: none;
  stroke: var(--automate-edge);
  stroke-width: 2;
  stroke-linecap: round;
  cursor: pointer;
}

/* The visible line takes no pointer events: its wide invisible twin does, so
   a two pixel curve is clickable, and hovering the twin lights the line. */
.automate-edge {
  pointer-events: none;
}

.automate-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  cursor: pointer;
}

.automate-canvas.is-readonly .automate-edge-hit {
  cursor: default;
}

.automate-edge-group:hover .automate-edge,
.automate-edge.is-selected {
  stroke: var(--accent);
  stroke-width: 3;
}

/* The remove control of a selected link: a cross in a circle at its midpoint. */
.automate-edge-remove {
  cursor: pointer;
}

.automate-edge-remove circle {
  fill: var(--sev-prob-text);
  stroke: var(--surface);
  stroke-width: 2;
}

.automate-edge-remove line {
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
}

.automate-edge-remove:hover circle,
.automate-edge-remove:focus-visible circle {
  fill: var(--accent);
}

.automate-edge-remove:focus-visible {
  outline: none;
}

.automate-edge-signal {
  stroke-dasharray: 5 4;
}

/* A document travelling from step to step. One class, as the signal's rule
   is, so selecting, hovering, a dangling end and a run's flow colours (all
   later or more specific) still say what they say about it. */
.automate-edge-document {
  stroke: var(--automate-doc);
  stroke-width: 3.5;
}

.automate-edge.is-dangling {
  stroke: var(--sev-prob-text);
  stroke-dasharray: 3 3;
}

/* A link with a step that will not run at either end. Dimmed to the same
   degree as the steps themselves, or a link at full strength between two
   faint boxes reads as the one part of that stretch of canvas that is still
   live. */
.automate-edge.is-dim {
  opacity: 0.42;
}

.automate-linkpreview {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

/* --- Repeated regions: the box behind the steps a loop repeats ---
   Drawn first, under the links and the nodes, so it reads as ground rather
   than as a container: nothing on the canvas nests, and a step joins a region
   by being linked between its two ends, never by being dragged into a box. */
.automate-region-box {
  fill: color-mix(in srgb, var(--accent) 8%, transparent);
  stroke: color-mix(in srgb, var(--accent) 45%, transparent);
  stroke-width: 1.5;
  stroke-dasharray: 8 5;
  pointer-events: none;
}

.automate-region-label {
  fill: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

/* --- Visual groups: a box the author drew around part of the canvas ---
   The region's vocabulary in a colour the author chose: a tint, an edge and
   a caption at the top-left corner. The edge is solid where a region's is
   dashed, so a
   group and a loop drawn round the same steps are told apart by more than
   their colour. The box takes no pointer, like a region's, so pressing
   inside it still pans the canvas; only the remove control does. */
.automate-group { --automate-group: var(--automate-group-blue); }
.automate-group-blue   { --automate-group: var(--automate-group-blue); }
.automate-group-purple { --automate-group: var(--automate-group-purple); }
.automate-group-amber  { --automate-group: var(--automate-group-amber); }
.automate-group-rose   { --automate-group: var(--automate-group-rose); }
.automate-group-teal   { --automate-group: var(--automate-group-teal); }
.automate-group-slate  { --automate-group: var(--automate-group-slate); }

.automate-group-box {
  fill: color-mix(in srgb, var(--automate-group) 9%, transparent);
  stroke: color-mix(in srgb, var(--automate-group) 55%, transparent);
  stroke-width: 1.5;
  pointer-events: none;
}

.automate-group-label {
  fill: var(--automate-group);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.automate-group-remove circle {
  fill: var(--automate-group);
}

/* A target bundle: several targets read as one thing. Dashed and untinted,
   where a group is a tinted box, because a bundle is a claim about what is
   being made rather than a part of the canvas, and the two must not read as
   the same mark. The accent colour, which the remove control borrows through
   the group's own custom property. */
.automate-bundle {
  --automate-group: var(--accent);
}

.automate-bundle-box {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

.automate-bundle-label {
  fill: var(--accent);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

/* The bundle's own chooser in the several-steps panel: a radio per way a
   workbench may show it, each with the sentence saying what that looks like. */
.automate-bundle-shows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.automate-bundle-show {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 12px;
  cursor: pointer;
}

.automate-bundle-show input {
  margin-top: 2px;
}

.automate-bundle-item-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: var(--accent);
}

/* The chooser in the several-steps panel: a swatch per colour, the radio
   itself carrying the choice so nothing but the form has to know it. */
.automate-group-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.automate-group-swatch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 12px;
  cursor: pointer;
}

.automate-group-swatch-chip {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--automate-group) 35%, transparent);
  border: 1.5px solid var(--automate-group);
}

.automate-group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.automate-group-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.automate-group-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A repeated section behind the tube map and the swimlanes, and the folded
   item ledger on the runbook table. */
.automate-band-box {
  fill: color-mix(in srgb, var(--accent) 8%, transparent);
  stroke: color-mix(in srgb, var(--accent) 40%, transparent);
  stroke-width: 1.5;
  stroke-dasharray: 8 5;
}

.automate-band-label {
  fill: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

/* The plate behind a label a line would otherwise be drawn through. The
   drawing's own ground at three-quarters, so the line is still there and is
   dimmer where the words are - which is the only place it needs to be. */
.automate-text-plate {
  fill: var(--surface);
  opacity: 0.76;
}

/* The item list sits across the whole row rather than in the narrowest cell
   of it, because it is a table of its own and a nested one clipped where the
   message column ended. */
.automate-ledger-row > td {
  padding-top: 0;
  background: var(--surface-alt);
}

.automate-ledger {
  margin-top: 2px;
}

.automate-ledger > summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.automate-ledger-items {
  margin-top: 6px;
}

/* The steps behind a process step, folded under its row exactly as an item
   ledger is. */
.automate-inner-steps-table,
.workbench-inner-steps .workbench-steps {
  margin-top: 6px;
}

/* The way into a process step (Look inside) or a test's own run is always on
   a line of its own under the step's words, flush with their left edge. It
   sat beside the words where they left room and wrapped under them where
   they did not, so it was in a different place on every row, and wrapped it
   kept the margin and the space that had parted it from the words, a
   character to the right of the text above it. */
.automate-look-inside,
.automate-open-child {
  display: flex;
  width: max-content;
  margin: 4px 0 0;
}

.automate-run-scope-line a {
  font-weight: 600;
}

/* --- State lamps (the word sits beside the colour in every table) --- */
.automate-lamp {
  stroke: var(--automate-node-bg);
  stroke-width: 1.5;
}

/* A state class names one colour and nothing else. What a surface does with
   it is the surface's own business: the canvas lamp fills with it, a station
   rings with it, a tracker bar tints with it and the departure board writes
   with it. Before this the class set `fill` directly, which is why every
   surface that wanted the colour some other way had to name all eight states
   again. */
.automate-lamp-pending   { --automate-state: var(--automate-state-pending); }
.automate-lamp-running   { --automate-state: var(--automate-state-running); }
.automate-lamp-ok        { --automate-state: var(--automate-state-ok); }
.automate-lamp-error     { --automate-state: var(--automate-state-error); }
.automate-lamp-skipped   { --automate-state: var(--automate-state-skipped); }
.automate-lamp-idle      { --automate-state: var(--automate-state-idle); }
.automate-lamp-waiting   { --automate-state: var(--automate-state-waiting); }
.automate-lamp-cancelled { --automate-state: var(--automate-state-cancelled); }
.automate-lamp-held      { --automate-state: var(--automate-state-held); }
/* A check-all batch's target that passed and keeps its record until the
   batch is sent (render.StateValidated): the success colour, since nothing is
   wrong with it, and the canvas note says what it is waiting for. */
.automate-lamp-validated { --automate-state: var(--automate-state-ok); }

/* The canvas lamp is a filled dot, and running and waiting breathe. */
.automate-lamp { fill: var(--automate-state, var(--automate-state-pending)); }
.automate-lamp-running { animation: automate-pulse 1.2s ease-in-out infinite; }
.automate-lamp-waiting { animation: automate-pulse 2.4s ease-in-out infinite; }

@keyframes automate-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* =====================================================
   A RUN ON THE CANVAS
   -----------------------------------------------------
   The canvas draws the workflow; these paint a run onto it. Every rule here
   needs [data-state] on the node or [data-flow] on the link, and both are
   written only on a run page, so the editing canvas is untouched by all of it.

   What a person reviewing a run is doing is looking for the shape of what
   happened: which step is going now, which steps worked, and where it stopped.
   Before this the whole of that was one five-pixel lamp per node, which on a
   canvas of thirty boxes is not something the eye finds.
   ===================================================== */

/* Every node on a run canvas carries its state's colour, so one rule paints
   the box, the ring and the bar rather than eight rules naming eight states
   three times over. The same shape .automate-lamp-* uses. */
.automate-node[data-state="pending"]   { --automate-state: var(--automate-state-pending); }
.automate-node[data-state="running"]   { --automate-state: var(--automate-state-running); }
.automate-node[data-state="ok"]        { --automate-state: var(--automate-state-ok); }
.automate-node[data-state="error"]     { --automate-state: var(--automate-state-error); }
.automate-node[data-state="skipped"]   { --automate-state: var(--automate-state-skipped); }
.automate-node[data-state="idle"]      { --automate-state: var(--automate-state-idle); }
.automate-node[data-state="waiting"]   { --automate-state: var(--automate-state-waiting); }
.automate-node[data-state="cancelled"] { --automate-state: var(--automate-state-cancelled); }
.automate-node[data-state="held"]      { --automate-state: var(--automate-state-held); }
.automate-node[data-state="validated"] { --automate-state: var(--automate-state-ok); }

/* The box takes its state's colour as a border and the faintest wash of it as
   a fill. A wash rather than a fill: the node's own ground is what the icon,
   the title and the port labels were contrasted against, and a box filled with
   a state colour makes every one of them harder to read for the sake of a fact
   the border already carries. */
.automate-node[data-state] .automate-node-box {
  stroke: var(--automate-state);
  stroke-width: 1.5;
  fill: color-mix(in srgb, var(--automate-state) 7%, var(--automate-node-bg));
}

/* A step that never ran stands back. It is the half of the picture that says
   where the run stopped: the failure is one red box, and everything that
   never happened because of it is this. Not hidden - a reader looking at a
   failed run wants to see what did not happen, and where. */
.automate-node[data-state="skipped"],
.automate-node[data-state="pending"] {
  opacity: 0.42;
}

/* The step that is going now. The ring is a box of its own outside the node's,
   pulsing, in the running colour; the header band is tinted with it too, so
   the whole box reads as lit rather than as a box with a mark on it. */
.automate-node-ring {
  fill: none;
  stroke: none;
}

.automate-node[data-state="running"] .automate-node-ring,
.automate-node[data-state="waiting"] .automate-node-ring {
  stroke: var(--automate-state);
  stroke-width: 2;
  fill: color-mix(in srgb, var(--automate-state) 12%, transparent);
  animation: automate-ring 1.6s ease-in-out infinite;
}

.automate-node[data-state="waiting"] .automate-node-ring {
  /* Slower, like the lamp: a step stopped on a person is not working, it is
     standing still, and a ring breathing at the speed of one that is running
     says the opposite. */
  animation-duration: 3.2s;
}

.automate-node[data-state="running"] .automate-node-header,
.automate-node[data-state="waiting"] .automate-node-header {
  fill: color-mix(in srgb, var(--automate-state) 32%, var(--automate-node-bg));
}

.automate-node[data-state="running"] .automate-node-box,
.automate-node[data-state="waiting"] .automate-node-box {
  stroke-width: 2;
}

/* A target that held its record back is lit like a step waiting on a person,
   and for the same reason - it is where the run needs somebody - but still,
   since nothing is going on in it: its header takes the colour and its
   border thickens, and the corner of the box says "held back" in words. */
.automate-node[data-state="held"] .automate-node-header {
  fill: color-mix(in srgb, var(--automate-state) 32%, var(--automate-node-bg));
}

.automate-node[data-state="held"] .automate-node-box {
  stroke-width: 2.5;
}

.automate-node[data-state="held"] .automate-node-note {
  fill: var(--automate-state);
  font-weight: 700;
}

/* A step that failed is the one box a reader of the run is looking for, so it
   is lit in the failure colour the way a held-back target is lit in its own:
   the header band and a thicker border, not a 1.5px line round a header still
   in its module's colour. A Test step's header band is green, and a check
   that did not hold read as a step that had passed. A step that failed
   softly is drawn the same, and its corner says so (NodeView.CornerNote). */
.automate-node[data-state="error"] .automate-node-header {
  fill: color-mix(in srgb, var(--automate-state) 32%, var(--automate-node-bg));
}

.automate-node[data-state="error"] .automate-node-box {
  stroke-width: 2.5;
}

.automate-node[data-soft] .automate-node-note {
  fill: var(--automate-state);
  font-weight: 700;
}

@keyframes automate-ring {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* How far a running step has got, along the foot of its box.

   The fill is a tint rather than the state colour solid, because the label is
   drawn across the whole bar and has to stay readable on both sides of the
   join. A solid fill would need two labels clipped against each other, which
   is a lot of machinery for a line of text nine pixels high. */
.automate-progress-track {
  fill: color-mix(in srgb, var(--automate-state, var(--automate-neutral)) 14%, var(--automate-node-bg));
  stroke: color-mix(in srgb, var(--automate-state, var(--automate-neutral)) 45%, transparent);
  stroke-width: 1;
}

.automate-progress-fill {
  fill: color-mix(in srgb, var(--automate-state, var(--automate-neutral)) 42%, var(--automate-node-bg));
}

.automate-progress-label {
  fill: var(--text);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.01em;
  pointer-events: none;
}

/* --- What happened to a link ---
   Four states, because "nothing went down here" has three meanings and they
   send somebody to three different places. Each is a colour and a dash
   pattern together: green and amber are close under protanopia, and the
   tooltip carries the word for the same reason. */
.automate-flow-carried {
  stroke: var(--automate-state-ok);
  stroke-width: 2.5;
}

.automate-flow-blocked {
  stroke: var(--automate-state-error);
  stroke-width: 2;
  stroke-dasharray: 2 4;
}

.automate-flow-untaken {
  stroke: var(--automate-state-skipped);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
  opacity: 0.5;
}

.automate-flow-pending {
  stroke: var(--automate-edge);
  opacity: 0.35;
}

/* A link carrying a value right now: the running colour, with the dashes
   travelling along it towards the step that is reading them. This is the one
   piece of motion on the canvas that says something is happening rather than
   that something is selected, which is why it is on the link and not on the
   node - the node's ring says which step, and this says where the value came
   from. Live is false on every link of a finished run, so a run page opened a
   week later is still. */
.automate-edge.is-live {
  stroke: var(--automate-state-running);
  stroke-width: 2.5;
  stroke-dasharray: 7 5;
  animation: automate-flow 0.9s linear infinite;
}

@keyframes automate-flow {
  to { stroke-dashoffset: -24; }
}

/* Somebody who has asked for less motion gets none of it: the colours and the
   dash patterns carry every one of these states on their own, and the
   animation only ever said "now" about something the ring already says. */
@media (prefers-reduced-motion: reduce) {
  .automate-lamp-running,
  .automate-lamp-waiting,
  .automate-node[data-state="running"] .automate-node-ring,
  .automate-node[data-state="waiting"] .automate-node-ring,
  .automate-edge.is-live {
    animation: none;
  }
}

/* The strip above a run's canvas: the reader's own view of it (Zoom in, Zoom
   out, Fit) at its right-hand end, and on a run still going the tick that
   follows the running step at its left. Controls rather than a heading, so
   they keep to the ends and the canvas below is the thing being read. */
.automate-run-canvas-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}

.automate-run-view {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.automate-run-view-hint {
  margin: 0 var(--space-1) 0 0;
}

/* A run's canvas under a pointer and a finger. At rest it is the whole
   workflow and has nowhere to go, so a touch on it is the browser's and the
   page scrolls from it: it carried the designer's touch-action: none, with no
   script moving anything, so a finger that landed on a run's canvas could
   scroll nothing at all. Zoomed, the script moves the drawing, so the canvas
   takes the touch and shows it can be dragged. */
.automate-canvas-wrap.is-readonly {
  touch-action: manipulation;
}

.automate-canvas-wrap.is-readonly.is-zoomed {
  cursor: grab;
  touch-action: none;
}

.automate-canvas-wrap.is-readonly.is-zoomed.is-panning {
  cursor: grabbing;
}

.automate-canvas-wrap.is-readonly:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.automate-follow {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
}

.automate-follow input {
  cursor: pointer;
}

/* The legend under a run canvas: the one place that says what the four link
   colours mean. */
.automate-run-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: center;
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.automate-run-legend-item {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
}

/* The swatch is a line rather than a dot, because what it stands for is a
   line: a dot beside "not taken" would read as a state a step can be in. */
.automate-run-legend-swatch {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top-width: 2px;
  border-top-style: solid;
  border-top-color: var(--automate-edge);
}

.automate-run-legend-item[data-flow="carried"] .automate-run-legend-swatch {
  border-top-color: var(--automate-state-ok);
}

.automate-run-legend-item[data-flow="blocked"] .automate-run-legend-swatch {
  border-top-style: dashed;
  border-top-color: var(--automate-state-error);
}

.automate-run-legend-item[data-flow="untaken"] .automate-run-legend-swatch {
  border-top-style: dashed;
  border-top-color: var(--automate-state-skipped);
}

.automate-run-legend-item[data-flow="pending"] .automate-run-legend-swatch {
  opacity: 0.45;
}

/* --- Choosing one step of a run ---
   A press on a step of a run canvas narrows the three lists under it to that
   step. The step itself is marked with the accent, which is what "chosen"
   means everywhere else in the product, and the state colours are left alone:
   the choice is about what is being read, not about what happened. */
.automate-canvas.is-readonly .automate-node {
  cursor: pointer;
}

.automate-node.is-focus .automate-node-box {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.automate-node.is-focus {
  /* A step that never ran stands back, and a step that never ran and has been
     chosen is being looked at: the dimming is what is undone, not the choice. */
  opacity: 1;
}

/* The strip that says one step is being shown, and carries the way out. It
   sits outside the block the live stream morphs, with the modal host, so an
   event cannot take it away. */
.automate-run-focus {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.automate-run-focus[hidden] {
  display: none !important;
}

/* The magnifier column: one icon button per row, so the column is only as
   wide as the button. */
.automate-run-io-cell {
  width: 1%;
  white-space: nowrap;
}

/* The same control on a log line sits in a column of its own, between the
   severity and the step. The log line is a grid, so a control at the end of
   the line was a fifth item in a four-column grid: it wrapped onto a second
   row, and a log of six hundred one-line entries had a two-line one wherever
   a step happened to settle. The column is as wide as the button and no
   wider, and the span is always drawn - an empty one holds the column open so
   the step names below it still line up. */
.automate-log-io {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sized down from the shared icon button, which is built for a toolbar: at
   its own size it would set the height of every line in the log. */
.automate-log-io .btn {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
}

.automate-log-io .btn-icon {
  width: 13px;
  height: 13px;
}

/* --- The Inputs and outputs panel --- */
.automate-io-passes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.automate-io-port {
  margin-bottom: var(--space-4);
}

/* A port's or a setting's name, its words and its Copy on one line, centred
   on it rather than set on one baseline: Copy is a square whose whole label
   is its icon, and a flex item with no words takes its baseline from the foot
   of its icon, so on a shared baseline the square stood four pixels above the
   name beside it. */
.automate-io-port-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-1);
}

/* Copy on the Inputs and outputs panel: hard against the right of the head
   it sits in, a port's, a setting's or a side's, so every one is found in one
   place whatever the name beside it, and the hidden box it copies out of is
   never drawn. */
.automate-io-copy {
  margin-left: auto;
}

/* It says it worked as a table's Copy does (copy-sql.js's tellCopied sets
   is-copied): the tick takes the icon's place for a moment, in the colour
   every passed check is drawn in, and a refusal draws the icon in the problem
   colour. */
.automate-io-copy .table-tool-done {
  display: none;
}

.automate-io-copy.is-copied .table-tool-copy {
  display: none;
}

.automate-io-copy.is-copied .table-tool-done {
  display: block;
  color: var(--sev-ok-text);
}

.automate-io-copy.is-copy-failed .table-tool-copy {
  color: var(--sev-prob-text);
}

.automate-io-copy-text {
  display: none;
}

/* A side's heading and its Copy on one row, the heading's rule drawn under
   the row rather than under the heading alone, so it runs under the button
   as well. */
.automate-io-side-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.automate-io-side-head .tool-column-subheading {
  margin: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* The Checks and Document tabs' Copy, at the right above what it copies. */
.automate-io-tab-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-2);
}

/* Where a held value filled an input: said on the input, since the held value
   is not listed as a step of its own on the run. */
.automate-io-held {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.automate-io-held-icon {
  width: 14px;
  height: 14px;
  flex: none;
  align-self: center;
}

/* The value itself. It scrolls inside its own box rather than stretching the
   modal: a prompt is a page of text and a JSON document is a page of braces,
   and either one would otherwise decide how wide and how tall this panel is.
   pre-wrap, because a prompt is written in lines and a single long line of
   JSON has to break somewhere. */
.automate-io-value {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.automate-io-note {
  margin: 0 0 var(--space-1);
}

/* A target's Info panel: what it read and produced, and every check it made.
   The strip sits at the head of the modal's body, above whichever panel is
   shown, and the checks are a table of three columns - which column, which
   check and what it asked, and how it came out - with the failures tinted so
   they are found without reading every line. */
.automate-io-tabs .tool-tabs-header {
  margin-bottom: var(--space-3);
}
#automate-io-tab-ports:checked ~ .tab-panel[data-tab="ports"],
#automate-io-tab-checks:checked ~ .tab-panel[data-tab="checks"],
#automate-io-tab-document:checked ~ .tab-panel[data-tab="document"] {
  display: block;
}
#automate-io-tab-ports:checked ~ .tool-tabs-header .tab-bar label[for="automate-io-tab-ports"],
#automate-io-tab-checks:checked ~ .tool-tabs-header .tab-bar label[for="automate-io-tab-checks"],
#automate-io-tab-document:checked ~ .tool-tabs-header .tab-bar label[for="automate-io-tab-document"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.automate-io-tab-count {
  font-size: 12px;
  color: var(--sev-ok-text);
}
.automate-io-tab-count.is-failed {
  color: var(--sev-prob-text);
}
.automate-io-checks {
  width: 100%;
  table-layout: fixed;
}
.automate-io-checks th.automate-io-check-column { width: 30%; }
.automate-io-checks th.automate-io-check-what { width: 32%; }
.automate-io-checks .automate-io-check-result .status-pill {
  white-space: normal;
}

/* A pill of several words keeps its own case: capitalize suits the single
   state words the pills were made for and mangles \"Not narrowed\". */
.status-pill.is-sentence { text-transform: none; }
.automate-io-checks td {
  vertical-align: top;
  overflow-wrap: anywhere;
}
.automate-io-checks tr.is-failed td {
  background: var(--sev-prob-bg);
}
.automate-io-check-column code {
  font-size: 11px;
  color: var(--text-muted);
}
.automate-io-check-rule,
.automate-io-check-problem {
  display: block;
  margin-top: 2px;
}
.automate-io-check-icon {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
}

.automate-linked-field {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-alt));
  color: var(--text);
  overflow-wrap: anywhere;
}

/* A value an administrator fixed under Settings > Services, drawn where the
   box was: the linked field's shape, in the muted tone of something the step's
   author cannot change. */
.automate-linked-field.automate-policy-fixed {
  color: var(--text-muted);
}

.automate-linked-field-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--accent);
}

/* A setting taken from a port nobody has linked yet: the linked field's
   shape, dashed and muted, since the link it describes is still to draw. */
.automate-linked-field.is-unlinked {
  border-style: dashed;
  border-color: var(--border);
  background: transparent;
  color: var(--text-muted);
}

.automate-linked-field.is-unlinked .automate-linked-field-icon {
  color: var(--text-muted);
}

.automate-linked-cell {
  min-width: 0;
  font-size: 0.78rem;
}

.automate-io-rows {
  max-height: 260px;
}

.automate-io-html-toggle {
  margin-bottom: var(--space-2);
}

.automate-io-html-preview {
  display: block;
  width: 100%;
  height: min(460px, 55vh);
  margin-bottom: var(--space-2);
  border: 1px solid var(--border);
  background: #fff;
}

.automate-io-html-preview[hidden] {
  display: none;
}

.automate-io-dropped {
  margin-top: var(--space-3);
}

/* --- Inspector --- */
/* The head stands still while the form scrolls under it: it names the step
   being edited and carries Save, and both are wanted from any field of a form
   that can run to a dozen of them. The negative margins take it to the
   column's edges, past the padding it scrolls inside, so nothing shows above
   it - the same shape the actions bar at the foot uses, mirrored. */
.automate-inspector-head {
  position: sticky;
  top: calc(var(--space-4) * -1);
  z-index: 2;
  /* Three columns and two rows: the step's icon, its words, and on the right
     Save over the step's id. A grid rather than the row it was, because the
     id belongs under Save and beside the summary, not on a line of its own
     under both: the icon and the words span both rows, so the id costs the
     head no height wherever the summary already runs to a second line. */
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: var(--space-3);
  align-items: start;
  margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.automate-inspector-head > .automate-palette-chip {
  grid-column: 1;
  grid-row: 1 / span 2;
}

/* Save and the unsaved mark, at the head's right end. */
.automate-inspector-head-actions {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 0;
}

.automate-inspector-head-text {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 0;
}

/* The tick under a who-may-act box, for the run's assigned owner: close under
   the box it adds to, since the two together are one list of who may act. */
.automate-assigned-tick {
  margin-top: var(--space-2);
}

/* A step's id, in the head of its settings: in the corner under Save, at the
   head's foot so it is level with the end of the summary however many lines
   that takes. A tag in the code face rather than a control, since it is read
   and nothing is pressed: the outline says it is one thing, and a click
   selects the whole of it. */
.automate-inspector-head > .automate-step-id {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  align-self: end;
  margin-top: var(--space-2);
}

.automate-step-id {
  padding: 2px 8px;
  border: 1px solid var(--border-hover);
  border-radius: 4px;
  background: var(--surface-elevated);
  color: var(--text);
  font-weight: 600;
  user-select: all;
}

.automate-inspector-kind {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.automate-inspector-head .form-hint {
  margin: var(--space-1) 0 0;
}

.automate-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3) var(--space-1);
  margin: 0 0 var(--space-3);
  min-width: 0;
}

.automate-fieldset > legend {
  padding: 0 var(--space-1);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* A section that belongs to another module - a target's checks are
   Validate's - says so in that module's own mark, in the accent, so the
   reader sees whose rules the step is relying on before reading a word. */
.automate-fieldset[data-group] > legend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text);
}

.automate-fieldset-icon {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--accent);
}

.automate-field-error {
  color: var(--sev-prob-text);
}

.automate-inspector-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: space-between;
}

.automate-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
}

.automate-row {
  position: relative;
  width: 100%;
  padding: var(--space-2) 40px var(--space-1) var(--space-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.automate-row .form-group {
  margin-bottom: var(--space-2);
}

.automate-row-remove {
  position: absolute;
  top: var(--space-1);
  right: var(--space-1);
}

/* --- A repeating group drawn as a table ---
   The headings once at the top and bare controls under them, for a group where
   every row says the same few short things about a different subject. The
   panel is 390px by default and the reader can narrow it, so the shared
   table-wrapper around this is what keeps the right-hand columns reachable:
   they scroll rather than being crushed into a column of single characters or
   clipped away with nothing to say they are there. */
.automate-rows-table-wrap {
  margin-bottom: var(--space-2);
}

.data-table.automate-rows-table th,
.data-table.automate-rows-table td {
  padding: 4px 6px;
  vertical-align: middle;
}

/* Wide enough for a column name and no wider: the cells that follow it are a
   chooser, two ticks and a box, and none of them reads better stretched. */
.data-table.automate-rows-table td .form-input,
.data-table.automate-rows-table td .form-select {
  min-width: 5.5rem;
  padding: 3px 6px;
  font-size: 12px;
}

/* A readonly cell is a fact rather than a box to type in: no border, so the
   column name reads as the row's subject and the controls beside it as the
   things that can be changed. */
.data-table.automate-rows-table td .form-input[readonly] {
  border-color: transparent;
  background: transparent;
  font-family: var(--font-mono);
}

/* The box and its fx button on one line, the button hard against the right
   where every other field in this form puts it. */
.automate-cell-text {
  display: flex;
  align-items: center;
  gap: 4px;
}

.automate-cell-text .form-input {
  flex: 1 1 auto;
  min-width: 0;
}

/* A column drawn as the entity's words over the code it stores: the words in
   the body face, since they are prose, and the code small under them. */
.automate-cell-text.is-display {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.data-table.automate-rows-table td .automate-cell-text.is-display .form-input[readonly] {
  font-family: var(--font-body);
  padding-bottom: 0;
}

.automate-cell-code {
  padding: 0 6px 2px;
  font-size: 11px;
  color: var(--text-faint);
  background: none;
}

/* The first cell of a row: the fixed mark on the line of the words it marks. */
.automate-rows-lead {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.automate-rows-lead > .automate-cell-text,
.automate-rows-lead > .automate-linked-field {
  flex: 1 1 auto;
  min-width: 0;
}

/* The mark on a row the step was given rather than told. */
.automate-rows-mark {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  vertical-align: -2px;
  margin-right: 2px;
}

/* A table-shaped group as the settings panel sums it up: a line per row
   saying what it is, where its value comes from and what type it is, with the
   table itself in a modal. One grid for the whole list, which every line takes
   its columns from (subgrid), so the names, the values and the types each
   start at one x down the list whatever any of them says: a grid per line
   gave the one line whose type was "Date and time" a value column of its own,
   starting further left than every other. The name and the value are cut to
   the room, and the whole of each is on the line's tooltip. The lines carry
   no side padding of their own, since a subgrid's padding comes out of its
   edge tracks and the mark's track would be left narrower than the mark: the
   first and last cells carry it instead. */
.automate-rows-summary {
  display: grid;
  grid-template-columns: 22px minmax(0, 1.1fr) minmax(0, 1fr) auto;
  column-gap: 6px;
  list-style: none;
  margin: 0 0 var(--space-2);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.automate-rows-summary-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  column-gap: 6px;
  align-items: center;
  padding: 5px 0;
  font-size: 12px;
  line-height: 1.35;
}

.automate-rows-summary-row + .automate-rows-summary-row {
  border-top: 1px solid var(--border);
}

.automate-rows-summary-row.has-error {
  background: var(--sev-prob-bg);
}

.automate-rows-summary-mark {
  display: flex;
  align-items: center;
  padding-left: 8px;
}

.automate-rows-summary-name,
.automate-rows-summary-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automate-rows-summary-name .required {
  margin-left: 2px;
}

.automate-rows-summary-value {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--text-muted);
}

.automate-rows-summary-value.is-value .automate-rows-summary-text {
  font-family: var(--font-mono);
  color: var(--text);
}

.automate-rows-summary-value.is-linked,
.automate-rows-summary-value.is-from {
  color: var(--accent);
}

.automate-rows-summary-value.is-wanted {
  color: var(--sev-warn-text);
}

.automate-rows-summary-value.is-same,
.automate-rows-summary-value.is-port,
.automate-rows-summary-value.is-none {
  color: var(--text-faint);
}

.automate-rows-summary-type {
  padding-right: 8px;
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.automate-rows-summary-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

/* A group none of whose rows is ever fixed has no column of marks, so its
   names start where a column list's do; and one whose rows hold several
   names says how many in a pill at the right-hand end. */
.automate-rows-summary.is-flush {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.3fr) auto;
}

.automate-rows-summary.is-flush.has-count {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.3fr) auto auto;
}

.automate-rows-summary.has-count:not(.is-flush) {
  grid-template-columns: 22px minmax(0, 1.1fr) minmax(0, 1fr) auto auto;
}

.automate-rows-summary.is-flush .automate-rows-summary-name {
  padding-left: 8px;
}

.automate-rows-summary.has-count .automate-rows-summary-type {
  padding-right: 0;
}

.automate-rows-summary-count {
  display: flex;
  justify-content: flex-end;
  padding-right: 8px;
}

.automate-count-pill {
  padding: 1px 7px;
  border: 1px solid color-mix(in srgb, var(--sev-warn-text) 45%, transparent);
  border-radius: 999px;
  color: var(--sev-warn-text);
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
}

/* What a button says, in the look the button is drawn in: the words in an
   ordinary face, since they are words and not a code, and the look's own
   name in its colour. */
.automate-rows-summary-value.is-words .automate-rows-summary-text {
  font-family: inherit;
}

.automate-rows-summary-row[data-tone="primary"] .automate-rows-summary-value.is-words .automate-rows-summary-text,
.automate-rows-summary-row[data-tone="primary"] .automate-rows-summary-type {
  color: var(--accent);
}

.automate-rows-summary-row[data-tone="danger"] .automate-rows-summary-value.is-words .automate-rows-summary-text,
.automate-rows-summary-row[data-tone="danger"] .automate-rows-summary-type {
  color: var(--sev-prob-text);
}

.automate-rows-summary-row[data-tone="plain"] .automate-rows-summary-type {
  color: var(--text-muted);
}

/* A cell holding several names chosen from a list: the chosen ones as pills,
   and the list to tick them in under a small button. */
.automate-cell-picks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 220px;
}

.automate-cell-picked {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.automate-pick-pill {
  padding: 1px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}

.automate-pick-pill.is-unknown {
  border-color: color-mix(in srgb, var(--sev-prob-text) 55%, transparent);
  background: var(--sev-prob-bg);
  color: var(--sev-prob-text);
}

.automate-cell-picks-more {
  flex: 1 1 100%;
}

.automate-cell-picks-more > summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}

.automate-cell-picks-more > summary::-webkit-details-marker {
  display: none;
}

.automate-cell-picks-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 2px 12px;
  max-height: 220px;
  margin-top: 6px;
  padding: 6px 8px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.automate-pick-option {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
}

.automate-pick-option > span:first-of-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automate-pick-option.is-unknown,
.automate-pick-note {
  color: var(--sev-prob-text);
}

.automate-pick-note {
  font-size: 11px;
  white-space: nowrap;
}

/* A column list summed up: the same bordered list as the tables' summary, a
   line per name in the source's own words with its type at the right, and
   the box behind it in a disclosure underneath. */
.automate-list-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.automate-list-summary-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.automate-list-summary-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.35;
}

.automate-list-summary-row + .automate-list-summary-row {
  border-top: 1px solid var(--border);
}

.automate-list-summary-row.is-unknown {
  background: var(--sev-prob-bg);
}

.automate-list-summary-words {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automate-list-summary-type {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.automate-list-summary-empty {
  margin: 0;
  padding: 6px 8px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
}

.automate-list-type > summary {
  width: max-content;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.automate-list-type[open] > summary {
  margin-bottom: var(--space-1);
}

/* The table's own modal. The body is the part that scrolls, as every modal's
   is, and it is given a ceiling of its own: a dialog sized to its content is
   clamped by max-height without the flex layout running again, so a body
   without one kept the height its rows asked for and spilled out of the card. */
.automate-rows-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 70vh;
  overflow: auto;
  overscroll-behavior: contain;
}

.automate-rows-modal-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

/* The chooser's button and the dialog it fills, together, because the button
   finds its dialog by looking beside itself. */
.automate-rows-modal-choose {
  display: flex;
  align-items: center;
}

/* With the width of the window to work in, every box in the table gets
   enough of it to show what it holds - the column's words, the arriving
   column it reads, the Default typed into it - and a link into a column's
   port reads as one line rather than four. By the kind of cell rather than by
   where it sits, since which cells a table draws follows the step's shape. */
.automate-rows-modal .data-table.automate-rows-table td .automate-cell-text {
  min-width: 11rem;
}

.automate-rows-modal .automate-linked-cell {
  min-width: 14rem;
}

/* The listener that re-renders the form when an entity is committed. It draws
   nothing: it is an htmx trigger that could not live on the input, which
   already carries the autocomplete's own request. */
.automate-entity-follow {
  display: none;
}

.automate-inspector-ports {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.automate-port-row {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.automate-port-row:last-child {
  border-bottom: 0;
}

.automate-port-row-head {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-1);
}

.automate-port-name {
  font-weight: 600;
  font-size: 13px;
}

.automate-port-edge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 13px;
  padding: var(--space-1) var(--space-2);
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-1);
}

.automate-port-edge-from {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automate-port-row .form-label {
  margin-top: var(--space-1);
}

/* --- Schedule facts (workflows list, designer) and the Enabled toggle --- */
.automate-schedule-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin-top: var(--space-1);
  font-size: 12px;
  color: var(--text-muted);
}

/* The trigger line sits on the canvas toolbar, after the zoom buttons, rather
   than in a band of its own between the header and the canvas. It takes the
   room that is left and gives up its tail to an ellipsis rather than wrapping
   the row taller. */
.automate-schedule-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: 0;
  font-size: 13px;
}

.automate-canvas-toolbar .automate-schedule-line {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
}

.automate-canvas-toolbar .automate-schedule-line > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* On the <svg> the mdi-icon helper renders. */
.automate-schedule-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.automate-toggle {
  margin: 0;
  white-space: nowrap;
}

/* The name column keeps room to read; on a phone the table scrolls inside its
   wrapper rather than squeezing a name to a word per line. It holds the name
   and its tags alone, the description having a row of its own, so it is set
   only as wide as the list at the harness's desktop width can afford.

   Named columns rather than nth-child, which is what these four were: this is
   the module's index page and under active change, so an Owner or a Problem
   column inserted in front of Schedule would have moved the min-width onto it
   and the centring onto Last run, silently and with nothing to read as wrong.
   See TestATableColumnRuleNamesItsColumn. */
.data-table.automate-workflows-table .automate-col-workflow {
  min-width: 200px;
}

/* A workflow is a <tbody> of two rows: the name, version, status, steps,
   trigger and last run, then the description under the first four of those and
   the scheduler's facts under the last two, with the cells after them spanning
   both rows. The shared rule takes the border off a body's last row, which here
   is every workflow's, so the line between workflows is put back and taken off
   only the table's last; the lead row's cells over the second row lose theirs
   so it reads as part of the row above it. The hover tint is the workflow's,
   both rows together. */
.data-table.automate-workflows-table tbody.automate-workflow tr:last-child td {
  border-bottom: 1px solid var(--border);
}

.data-table.automate-workflows-table tbody.automate-workflow:last-child tr td {
  border-bottom: none;
}

.data-table.automate-workflows-table tbody.has-description .automate-workflow-lead td:not([rowspan]) {
  border-bottom: none;
  padding-bottom: 4px;
}

.data-table.automate-workflows-table .automate-workflow-desc-row td {
  padding-top: 0;
}

.data-table.automate-workflows-table tbody.automate-workflow:hover td {
  background: var(--surface-hover);
}

/* The description is cut at three lines and is whole in its tooltip. Its box
   is as wide as the four columns it spans and adds nothing to how wide they
   are (width 0, then all of the cell): under an auto layout a paragraph asks
   for its whole length on one line, and the columns it spans then took the
   table's width from the ones to the right of them. The clamp is on this inner
   box, since -webkit-box on the <td> would replace its table-cell display. */
.automate-workflow-desc {
  width: 0;
  min-width: 100%;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* A workflow's tags lead its second row, on one line across the four columns
   it spans, above the description. */
.automate-workflow-tags .tag-pill-list {
  margin: 0 0 4px;
}

/* A date and time never breaks between the two, so Last run is the pill and at
   most one line under it. */
.automate-stamp {
  white-space: nowrap;
}

.data-table.automate-workflows-table .automate-col-lastrun .automate-stamp {
  color: var(--text-muted);
}

/* Below this width the list's dates give up their time, which stays in the
   tooltip, and Run and Open give up their words to their icons: measured with
   the sidebar open, a list narrower than about 1330px could no longer hold
   every column with the times and the words in it and scrolled sideways. A
   container query rather than a media query, because it is the list's width
   that runs out, and the sidebar and the icon rail move that without moving
   the window's. */
.automate-workflows-frame {
  container: automate-workflows / inline-size;
}

@container automate-workflows (max-width: 1360px) {
  .automate-stamp-time,
  .automate-action-words {
    display: none;
  }
}

/* Each of the scheduler's facts is one line in the list, across Schedule and
   Last run beside the description, cut where Last run ends and whole in its
   tooltip: under the trigger, a folder watch's "the folder ... does not exist
   yet" wrapped to four lines and pushed the row down with it. The designer
   draws the same facts whole. Like the description, they take the columns'
   width rather than setting it (width 0, then all of the cell), or a fact on
   one line would widen the two columns to its own length. */
.data-table.automate-workflows-table .automate-col-facts .automate-schedule-facts {
  display: block;
  width: 0;
  min-width: 100%;
  margin-top: 0;
}

.data-table.automate-workflows-table .automate-col-facts .automate-schedule-facts > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A form's mark before the name of a workflow or process that serves a form
   or is started by one (decision 69). The icon is the form's own, drawn by
   formIcon: an MDI svg carrying the class, or a flag, which carries none, so
   the flag is sized through the wrapper. */
.automate-form-mark {
  display: inline-flex;
  align-items: center;
  vertical-align: -3px;
  margin-right: 6px;
  color: var(--accent);
}

.automate-form-mark-icon {
  width: 16px;
  height: 16px;
}

.automate-form-mark .flag {
  width: 18px;
  height: 13px;
  border-radius: 2px;
}

.data-table.automate-workflows-table .automate-col-schedule {
  min-width: 150px;
}

/* Nodes is a small count and Updated is a date, so both shrink to their own
   content (width:1% is the auto-table "shrink to fit" trick) and hand the
   width they were taking to the actions column. That column then keeps its
   buttons on one line rather than wrapping them onto two. */
.data-table.automate-workflows-table .automate-col-nodes,
.data-table.automate-workflows-table .automate-col-updated,
.data-table.automate-workflows-table .automate-col-version,
.data-table.automate-workflows-table .automate-col-status {
  width: 1%;
  white-space: nowrap;
}

/* The version reads as a code, small, beside the name it belongs to. */
.data-table.automate-workflows-table .automate-col-version .mono {
  font-size: 12px;
}

/* An archived workflow is kept for its history: shown, it stands back. */
.data-table.automate-workflows-table tbody[data-workflow-status="archived"] td {
  opacity: 0.65;
}

/* The versions a workflow has been on: a table of short codes and dates, so the
   modal is wide enough to keep each row on one line. */
.modal.automate-versions {
  width: min(760px, calc(100vw - 32px));
}
.data-table.automate-versions-table td,
.data-table.automate-versions-table th {
  white-space: nowrap;
}

/* The link that shows or hides a tab's archived workflows, under the tag
   filter and above the table. */
.automate-archived-toggle {
  margin: 4px 0 10px;
  font-size: 13px;
}

.automate-archived-toggle a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* The actions cell of any index table keeps its buttons on one line. Scoped to
   the workflows table before the Processes page grew the same cell, which then
   wrapped its three buttons onto two rows and made every row of that table a
   row and a half tall. The class already names what the cell is, so the table
   it happens to sit in was never part of the rule. */
.data-table .automate-row-actions {
  white-space: nowrap;
}

/* --- Processes table --- */

/* The same shape as the workflows table above, for the same reason, and with
   one column more to place.

   The name and description column is where all the slack goes under an auto
   layout: a process's description is a sentence or two, and with nothing to
   stop it the column took two thirds of the table on one line and left the
   actions cell too narrow to hold its own buttons. Capping it wraps the
   description instead, which is what the rest of the row needs and what a
   description reads better as anyway. */
.data-table.automate-processes-table .automate-col-process {
  min-width: 260px;
  max-width: 560px;
}

.data-table.automate-processes-table .automate-col-signature {
  min-width: 180px;
  max-width: 360px;
}

/* Placed on holds one workflow name per line, so it needs room to keep each of
   them on its own line rather than a word per line; it is not nailed down like
   the two beside it, because a process placed on five canvases genuinely has
   five lines to draw. */
.data-table.automate-processes-table .automate-col-placed {
  min-width: 150px;
}

/* Steps is a count of at most a few hundred and Updated is a fixed-width
   timestamp, so both shrink to their own content (width:1% is the auto-table
   "shrink to fit" trick) and hand what they were taking to the columns that
   have something to say. Neither may wrap: a date broken over two lines is the
   whole reason to nail these two down. */
.data-table.automate-processes-table .automate-col-steps,
.data-table.automate-processes-table .automate-col-updated {
  width: 1%;
  white-space: nowrap;
}

/* --- Test node --- */
.automate-test-result:empty {
  display: none;
}

.automate-test-result {
  margin-top: var(--space-3);
}

.automate-test-errors {
  margin: var(--space-1) 0 0;
  padding-left: var(--space-4);
}

/* What a test step produced, and what it said while producing it. Both are
   <pre>, so both need the wrapping spelled out: a <pre> is `white-space: pre`
   by default, and a test output is very often one long line nobody chose the
   length of - an HTML email body, a JSON document, a row of a mailbox
   listing. Without pre-wrap that line does not wrap, and with nothing to
   scroll inside it takes the table, the panel and the page sideways with it.
   The ceiling is the other half and lives in Go (internal/automate.previewValue):
   wrapping a hundred kilobytes is still a hundred kilobytes on the page.

   The preview carries its own scroll box rather than growing to whatever a
   step produced, the same way the log does: five rows of a mailbox listing is
   a taller cell than the rest of the table put together. */
.automate-test-preview,
.automate-test-log {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* The instructions dialogs on a test's canvas. The box is monospace so a
   line is a line, the refused lines are a list under the strip, and the
   grammar is a <pre> that wraps inside a ceiling. */
.test-write,
.test-as-text,
.test-record {
  width: min(720px, calc(100vw - 32px));
}

.test-write-text {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  overflow: auto;
}

.test-write-errors {
  margin: 8px 0 0;
  padding-left: 20px;
}

.test-write-grammar {
  margin: 0 0 12px;
}

.test-write-grammar > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}

.test-write-reference {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}

/* Test > Reference > Typed instructions: a verb a row, in a card the page's
   width, every form and example breaking after its bars, dots and slashes
   (codeText). In the 780px form card the table had 728px at any window, and
   expect's visible|hidden|enabled|disabled|checked beside go's address held
   every column to its narrowest: What it does was its own heading's width, a
   word or two a line. What it does keeps the phone rule's 20rem reading width
   as a floor, so a code too long for its column scrolls the frame rather than
   squeezing the prose; with the sidebar open that is below a window of about
   1030px, where the frame scrolls by a few pixels. Above a phone's width it
   is held to a 48rem share while the forms and examples still want room, so a
   wide screen's room goes to them first. A max-width on a cell caps only what
   the cell asks for, so once every column is at its widest (a window past
   about 2200px) a table that fills its frame shares the rest among them all,
   this one included. The measure stays out of the phone rule's reach on
   purpose: this selector outranks that rule's and would draw the column 48rem
   wide in a phone's frame. A verb of two words is one verb, so it does not
   wrap. The example's hint above the table is prose in a card the page's
   width, so it keeps a measure of its own. */
.data-table.test-verbs td.test-verbs-verb {
  white-space: nowrap;
}

.data-table.test-verbs td.test-verbs-does {
  min-width: 20rem;
}

@media (min-width: 641px) {
  .data-table.test-verbs td.test-verbs-does {
    max-width: 48rem;
  }
}

.test-reference-hint {
  max-width: 48rem;
}

/* A test's page (docs/plan/test-like-forms.md): the Script tab's three
   cards, the steps the script becomes as a numbered list with a refused line
   picked out, the Browser tab's field groups and the Parameters tab's rows.
   The page and tab classes are hooks for the browser suite and the tests. */
.test-page {
  display: block;
}

.test-page-tabs {
  margin-top: var(--space-3);
}

.test-script-card {
  display: grid;
  gap: var(--space-3);
}

/* The Script tab's first row: the box, and beside it the Playwright each line
   runs as, the two the same size. Below 1200px the two stack, since code
   squeezed into half a laptop's width is a column of wrapped calls. From
   1200px the row is two equal columns, and each card lays its four parts -
   the title, what it says above the window, the window, and its foot - on
   the row's own tracks (subgrid), so the box and the code's frame share one
   track and are one height as well as one width: the box's natural height
   or the code's, whichever is taller, the code held to the height a screen
   can show and scrolling inside it. Laid out apart, the code card ran half
   a screen past the box beside it. Each code block keeps its lines and
   scrolls them sideways rather than wrapping a call over two. */
.test-script-row {
  display: grid;
  gap: var(--space-3);
  align-items: start;
}

.test-script-row > .form-card {
  margin: 0;
  min-width: 0;
  max-width: none;
}

.test-script-head,
.test-script-foot {
  display: grid;
  gap: var(--space-2);
  align-content: start;
  min-width: 0;
}

.test-script-head {
  margin-bottom: 6px;
}

.test-script-head > .form-label {
  margin-bottom: 0;
}

.test-script-foot {
  margin-top: var(--space-3);
}

.test-script-foot > .form-actions {
  margin-top: 0;
}

@media (min-width: 1200px) {
  .test-script-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    row-gap: var(--space-2);
    align-items: stretch;
  }

  .test-script-row > .form-card {
    display: grid;
    grid-row: span 4;
    grid-template-rows: subgrid;
  }

  .test-script-row .form-card-title {
    margin: 0;
  }

  .test-script-head,
  .test-script-foot {
    margin: 0;
  }

  /* The row is as tall as the taller card's words, so the box's label is
     put down against the box rather than left under the hint. */
  .test-script-head {
    align-content: space-between;
  }

  /* The box cannot be dragged taller on its own here: it is as tall as the
     code beside it, and the code as tall as it. */
  .test-script-window {
    align-self: stretch;
    height: auto;
    min-height: 0;
    resize: none;
  }

  .test-script-foot {
    align-content: end;
  }
}

.test-code-scroll {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  padding: var(--space-2);
}

.test-code {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
}

/* The code element inside a block is the block's text, not inline code: the
   site's own code styling pads and tints it, which pushed every block's first
   line to the right of the rest. */
.test-code > code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
}

.test-code-frame {
  color: var(--text-muted);
}

.test-code-line {
  margin: var(--space-2) 0;
  padding-left: var(--space-2);
  border-left: 3px solid var(--accent);
}

.test-code-line.is-refused {
  border-left-color: var(--danger);
}

.test-code-words {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}

.test-code-n {
  min-width: 2ch;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.test-code-words > code {
  font-weight: 600;
  white-space: pre-wrap;
  word-break: break-word;
}

.test-code-helpers {
  margin-top: var(--space-2);
}

.test-code-setup {
  margin: 0 0 var(--space-2);
}

.test-code-helpers > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}

.test-steps {
  margin: 8px 0 0;
  padding-left: 24px;
  font-size: 13px;
  line-height: 1.6;
}

.test-steps li.is-refused {
  color: var(--text-muted);
  text-decoration: line-through;
}

.test-steps li.is-refused .automate-field-error {
  text-decoration: none;
}

.test-browser-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-3);
}

.test-browser-group > legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* A row of the Parameters tab is five controls, a tick and a button: the
   selects keep 120px, since "One of a list" needs it, and the text boxes ease
   to 96px, so a row fits a card the page's width with the sidebar open. */
.test-params-table input.form-input {
  min-width: 96px;
}

.test-params-table select.form-select {
  min-width: 120px;
}

/* Browser setup's tail of the driver install's output: a <pre> that wraps and
   scrolls inside a ceiling, since a download's progress lines are long and
   many and the card is not the place for a page of them. */
.test-setup-log {
  margin: var(--space-2) 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow: auto;
}

.automate-test-preview {
  max-height: 180px;
  overflow: auto;
}

/* The other half of the same answer: a value that IS rows and columns is drawn
   as rows and columns rather than as a line of names over a line of commas.
   It takes the same ceiling the <pre> beside it takes, and for the same two
   reasons - five rows of a mailbox listing is a taller cell than the rest of
   the table put together, and an entity's forty columns are wider than the
   264px column this is sometimes drawn in. */
.automate-value-rows {
  max-height: 200px;
  max-width: 100%;
  overflow: auto;
}

/* A list drawn as its elements. The ceiling is the list's rather than each
   part's, because five records is five tables and a preview that fills the
   panel is one nobody reads; each part keeps its own inner scroll box for the
   other axis. */
.automate-value-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 260px;
  max-width: 100%;
  overflow: auto;
}

.automate-value-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--space-2);
  background: var(--surface-alt);
  min-width: 0;
}

/* Which element this is, and what it carries. A run of unlabelled tables is
   not something a reader can point at, which is the whole reason the parts are
   numbered rather than simply stacked. */
.automate-value-item-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.automate-value-item-index {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* The outputs table is laid out FIXED, and its columns are named by class
   rather than by position.

   Fixed because a cell in an auto layout grows to its content's max-content
   width, and a record of fourteen columns is 3248px inside a 478px panel: the
   .table-wrapper around the whole thing then absorbs that into six
   panel-widths of horizontal scroll, with the value pushed off to the far end
   of it. Bounding the cell is what lets the value's own scroll box do its job.
   The <pre> beside it answers the same question with pre-wrap; a table cannot
   wrap, so the column has to be the thing that is bounded. Under a fixed
   layout the first row is what sizes the columns, so the widths go on the
   headings. */
.automate-test-outputs {
  table-layout: fixed;
}

/* The port column takes a third and a long name wraps inside it, and the
   type column is as wide as a badge: at 22% each, in a settings panel a
   few hundred pixels wide, a step's own port names (seg.BusinessUnit,
   problems) ran straight over the type beside them, since a fixed layout
   lets a cell's content overflow it rather than grow it. */
.automate-test-outputs th.automate-test-port {
  width: 36%;
}

.automate-test-outputs th.automate-test-type {
  width: 84px;
}

.automate-test-outputs td.automate-test-port code {
  overflow-wrap: anywhere;
}

.automate-test-outputs td.automate-test-type .type-badge {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.automate-test-outputs td.automate-test-value {
  min-width: 0;
}

.automate-value-table {
  font-size: 12px;
}

/* A templated field's label row: the label and, beside it, the function
   button whose disclosure lists the variables. */
.automate-label-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* The label holds the left and pushes the buttons to the right edge of the
   panel, where the eye already goes looking for a control: left-packed they
   sat in the middle of the row at a different x on every field, since where
   they landed depended on how long the label happened to be.
   justify-content is what keeps them right on a row that has wrapped, where
   there is no label left on the line to push them. */
.automate-label-row .form-label {
  margin-right: auto;
  margin-bottom: 0;
}

/* No bottom margin, and that is the whole of the alignment fix. The row
   centres its children, and `align-items: center` centres the MARGIN box: a
   4px margin under the disclosure lifted the button 2px above the label
   beside it, which read as a glyph floating rather than as a control on the
   same line. */
.automate-vars {
  position: static;
  margin-bottom: 0;
}

/* The button chrome comes from the shared vocabulary on the summary itself
   (btn btn-secondary btn-xs), so these two rules are only what a <summary>
   needs that a <button> does not: no disclosure triangle. */
.automate-vars > summary {
  list-style: none;
}

.automate-vars > summary::-webkit-details-marker {
  display: none;
}

/* Square, for the one of the two whose whole label is its icon. There is no
   base .btn-icon-only rule at this width - the class only sizes a control
   under the touch breakpoint - so the shape of an unlabelled button is its
   padding, and btn-xs's is meant for a button with words in it. */
.automate-vars > summary.btn-icon-only {
  padding: 3px;
}

/* Open reads as pressed. The hover is the shared button's own. */
.automate-vars[open] > summary {
  border-color: var(--accent);
  color: var(--accent);
}

/* A refused cell. The sentence is under the table, where there is width for
   it, so all this has to do is say which cell it is about - the same red the
   form's own has-error uses, on the control rather than around it, because a
   table cell has no room for a border and a label both. */
.automate-rows-table .is-cell-error {
  border-color: var(--sev-prob-text);
  outline: 1px solid var(--sev-prob-text);
}

/* A panel hung off a field's label row. The variables list outgrew this and is
   a modal now; what is left on it is the entity-columns suggestions, which are
   a short list of names beside the box they are written into.

   The ceiling is the phone's, and scrolling is the panel's own and contained,
   so reaching its end does not carry on scrolling the page behind it. */
.automate-vars-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 12px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-size: 12px;
}

/* The list is a modal now, so it needs no positioning of its own: the dialog
   supplies the room, which is the whole reason it moved. It was a panel
   anchored to the field's label row, and it outgrew that twice - a group per
   earlier step plus a reference per key is longer than any screen, and it was
   being searched by scrolling a 264px column - and in a rows table there was
   no label row to anchor to at all. */
/* A ceiling of its own, and the shared .modal-body's flex:1 is not one.
   A dialog whose height is auto sizes to its content and is then clamped by
   max-height, and that clamp does not re-run the flex layout: the body keeps
   the height its content asked for and spills out of a dialog that looks
   correctly sized. Measured on a workflow of ten steps: the dialog 852 tall in
   a 900 viewport, the body 2451 and not scrolling, the last entry at y=2489
   where nothing could reach it. The columns chooser's own table wrapper
   carries the same ceiling for the same reason. */
.automate-vars-modal .modal-body {
  font-size: 12px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* The search stays put while the list scrolls under it: it is the point of
   having one, on a list long enough to need it. */
.automate-vars-search {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: var(--space-2);
  background: var(--surface-elevated);
}

.automate-vars-lead {
  margin: 0 0 8px;
  color: var(--text-muted);
}

/* Where a names panel's list came from, drawn above it: a form capture, or
   the metadata's bound controls alone. Set apart from the lead under it by
   weight rather than by a second colour, since both are the panel's own
   words about itself. */
.automate-suggest-source {
  font-weight: 600;
}

/* What a date pattern may hold: the grammar's own table, under every field
   that takes a pattern and under {{date:...}} in the variables list. In the
   help's own text style - the same size and the same muted colour - because it
   is part of the field's help rather than a panel of its own, and small,
   because it is a reminder of letters somebody half knows. A row per part of a
   date, its tokens wrapping inside the cell rather than the table growing
   sideways in a 264px column. */
.automate-date-tokens {
  margin-top: 5px;
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: var(--text-muted);
}
.automate-date-tokens caption {
  text-align: left;
  padding-bottom: 2px;
}
.automate-date-tokens th {
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  padding: 1px 8px 1px 0;
  vertical-align: top;
}
.automate-date-tokens td {
  padding: 1px 0;
}
.automate-date-token {
  display: inline-block;
  margin-right: 8px;
  white-space: nowrap;
}
.automate-date-token code {
  font-size: 11px;
  color: var(--text);
}
/* Under a field the tokens are buttons that write themselves into the box, so
   they are drawn as the same words with the affordance a button needs and
   nothing else: the table is a reminder, and a row of bordered buttons would
   be the loudest thing in the panel. */
button.automate-date-token {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 3px;
  padding: 0 2px;
  margin-left: -2px;
  margin-right: 6px;
  cursor: pointer;
}
button.automate-date-token:hover,
button.automate-date-token:focus-visible {
  background: var(--accent-dim);
  color: var(--text);
}
button.automate-date-token:hover code {
  text-decoration: underline;
}
.automate-date-tokens tfoot td {
  padding-top: 3px;
}

/* The search box stays put while the names scroll under it. It is the point of
   this panel rather than a refinement of it - an F&O entity can carry four
   hundred columns - and a search box that scrolls out of sight on the first
   flick is one nobody finds twice. */
.automate-suggest-search {
  position: sticky;
  top: -10px;
  z-index: 1;
  margin: -10px -12px 8px;
  padding: 10px 12px 8px;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
}

/* The heading over one group of the panel: a clock heading, or an earlier
   step's own name.

   The panel used to be one flat list, and "step n1" told a reader nothing:
   they were matching node ids against the canvas to work out which entry
   belonged to Read files. A heading per source turns the scroll into a
   lookup - the reader goes to the step they mean and reads three lines,
   rather than reading thirty and sorting them in their head.

   Sticky, so the heading of the group being scrolled through stays visible
   inside the panel's own scroller: the whole point is knowing which step the
   row under the cursor came from. */
.automate-vars-group {
  position: sticky;
  top: -10px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 6px;
  border-radius: 6px;
  background: var(--surface-elevated);
  color: var(--text);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
}

.automate-vars-group:hover {
  background: var(--surface-hover);
}

.automate-vars-group:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Each heading is a group the reader opens. Its tick is hidden for sight and
   is the state: the body shows while it is ticked, or while a search has
   found something in it (.is-found), and the chevron turns with it. A rule
   between groups, so a list of closed groups reads as a list of names. */
.automate-vars-section {
  border-top: 1px solid var(--border);
}

.automate-vars-section:first-child,
.automate-vars-lead + .automate-vars-section {
  border-top: 0;
}

.automate-vars-section-body {
  display: none;
  padding: 0 0 6px 20px;
}

.automate-vars-section:has(> .automate-vars-group input:checked) > .automate-vars-section-body,
.automate-vars-section.is-found > .automate-vars-section-body {
  display: block;
}

.automate-vars-chevron {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.12s;
}

.automate-vars-section:has(> .automate-vars-group input:checked) .automate-vars-chevron,
.automate-vars-section.is-found .automate-vars-chevron {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  .automate-vars-chevron { transition: none; }
}

.automate-vars-group-title {
  flex: 1;
  min-width: 0;
}

/* How many values the group holds, so a closed group still says whether it
   is worth opening. */
.automate-vars-group-count {
  flex: none;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0;
}

/* A step's heading is a name rather than a category, so it is not shouted. */
.automate-vars-step {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
}

/* What the step is and its id, small beside its name: for finding it on the
   canvas, and not what the reader scans the list by. */
.automate-vars-step-meta {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
}

/* The modal's narrowing chips, in the explorer legend's look: a pill that
   reads pressed by its own tick, so it changes the moment it is pressed rather
   than when the answer lands. Two rows, Matching ports and Show, each wrapping
   on a phone. */
.automate-vars-filters {
  display: grid;
  gap: 4px;
  margin: 0 0 8px;
}

.automate-vars-chipset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 12px;
}

.automate-vars-chipset-label {
  min-width: 96px;
  color: var(--text-muted);
  font-weight: 600;
}

.automate-vars-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.automate-vars-chip:hover {
  color: var(--text);
}

.automate-vars-chip:has(input:checked) {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.automate-vars-chip:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* A type nothing upstream carries: there, so the field's own type is always
   where the eye starts, and quiet, since pressing it keeps nothing. */
.automate-vars-chip.is-empty {
  border-style: dashed;
  opacity: 0.7;
}

.automate-vars-chip-icon {
  width: 13px;
  height: 13px;
}

.automate-vars-chip-count {
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.8;
}

/* The date pattern's letters, folded under the clock's group. */
.automate-vars-tokens {
  margin: 4px 0 8px;
  font-size: 12px;
}

.automate-vars-tokens > summary {
  cursor: pointer;
  color: var(--text-muted);
}

/* The group holding a key that matches the field being edited, hoisted to the
   top of the list and marked so the reader knows why it is first. */
.automate-vars-step.is-suggested {
  color: var(--accent);
}

.automate-vars-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.automate-vars-list li {
  display: block;
}

.automate-vars-list code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
  /* One line, cut at its end: the whole reference is the entry's tooltip,
     and what the entry is comes first, so the cut never takes the part
     somebody reads to choose. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automate-vars-list .automate-vars-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automate-vars-list .automate-vars-type {
  color: var(--text-muted);
  font-style: normal;
  font-size: 11px;
  white-space: nowrap;
}

/* Each entry is the button that writes itself into the field, so the whole
   row is the target rather than the reference alone: the description is what
   somebody reads to find the one they want.

   One line each, on a grid every row shares: what it is, its type, then the
   reference. Stacked, a list of the clock's twenty variables was a screen of
   them before the next group began. A reference is as long as its step id and
   its port name happen to make it, which is why it goes last on a fixed
   column rather than first: set first, every description after it started at
   a different x and thirty of those read as rubble. The browser check
   measures that every description starts from the same edge. On a phone there
   is no room for three columns, so the line stacks again there. */
/* A picker beside the box it writes into (contract.FieldPicker). It never
   replaces the box, so it sits under it with a small gap and reads as a second
   way of filling the same field in rather than as a field of its own. */
.automate-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.automate-picker .automate-picker-datetime {
  width: auto;
  flex: 1 1 14rem;
  min-width: 0;
}

.automate-picker .automate-picker-date {
  width: auto;
  flex: 0 1 10rem;
  min-width: 0;
}

/* One column of what arrives, chosen beside the box. It takes the panel's
   whole width rather than sizing to its content, because a column name is as
   long as the entity happens to make it and a control that changed width with
   the name selected would move every row under it. min-width: 0 is what lets
   it shrink inside the flex row instead of pushing the panel sideways: a
   select's intrinsic width is its longest option, and an F&O column name is
   forty characters. */
.automate-picker .automate-picker-column,
.automate-picker .automate-picker-suggest {
  width: auto;
  flex: 1 1 100%;
  min-width: 0;
}

/* The true/false pair marks whichever the box is on, and neither when it holds
   a variable: a value that is not known yet is not false. */
.automate-picker [data-picker-set].is-picked {
  background: var(--surface-raised);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.automate-picker-records {
  display: block;
}

/* The table is the one thing on this page allowed to be wider than the panel,
   and it scrolls inside its own box rather than pushing the form sideways. */
.automate-grid-scroll {
  overflow-x: auto;
}

.automate-grid {
  width: auto;
  min-width: 100%;
}

.automate-grid th,
.automate-grid td {
  padding: 4px;
  white-space: nowrap;
}

.automate-grid th {
  display: table-cell;
}

/* A row stub is its number and the x that drops it, side by side. A th is as
   narrow as the table lets it be, so the two stacked and the x read as
   something belonging to the row below; the pair is laid out in a box of its
   own rather than by making the cell itself a flex container, which would
   take its table-cell behaviour away. */
.automate-grid-head-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* The two halves of the modal, in the order the work happens. */
.automate-grid-section + .automate-grid-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.automate-grid-section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.automate-grid-section > .btn {
  margin-top: 8px;
}

/* The list of columns, between the hint above it and the button that grows
   it. */
.automate-collist {
  margin-top: 6px;
}

/* One column per line: the number, the name, what it holds, and the x. Down
   the page rather than across the table's headings, where a name box and a
   type chooser had to share the width of the data under them - seven
   characters of a name with the chooser beneath it cut to twelve pixels of
   text. The name takes what is left, since that is the part being read. */
.automate-collist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  /* A column name is a word or two, so the list is capped rather than
     stretched across a wide modal: the x that drops a column belongs beside
     the name it drops and not at the far edge of the dialog. */
  max-width: 38rem;
}

.automate-collist-row + .automate-collist-row {
  margin-top: 6px;
}

.automate-collist-num {
  width: 1.5rem;
  flex: 0 0 auto;
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.automate-collist-row .form-input {
  flex: 1 1 auto;
  min-width: 0;
}

.automate-collist-type {
  flex: 0 0 auto;
  width: 11rem;
}

.automate-grid td .form-input {
  min-width: 7rem;
}

/* A column nobody has named yet, drawn as a heading that says which one it is
   rather than as a gap. Nothing in it is written, which the note under the
   table says; this is what the reader looks at while reading that. */
.automate-grid-unnamed {
  color: var(--text-muted);
  font-style: italic;
}

/* The corner above the row numbers, and the numbered stub beside each row:
   a spreadsheet's own furniture, which is where the two buttons that grow the
   table live. The stub is narrow because a row number and a x is all it has
   to hold. */
.automate-grid-corner,
.automate-grid-rowhead {
  width: 1px;
  white-space: nowrap;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* The modal is the room the table did not have in the panel, so the body is
   what scrolls down and the table scrolls sideways inside its own box: the
   columns list above it must not be dragged off screen by a wide table. */
.automate-grid-modal .modal-body {
  overflow: auto;
}

/* The filter builder's swap covers the modal's body and its foot, since
   whether Use this filter is offered at all depends on what the builder found.
   display: contents keeps the two as the dialog's own flex children, so the
   body still takes the room and the foot still sits under it. */
.automate-filter-shell {
  display: contents;
}

/* One condition: the column, the comparison, the value and how it is written,
   on one line where there is room and stacked where there is not. */
.automate-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.automate-filter-row .form-input,
.automate-filter-row .form-select {
  flex: 1 1 10rem;
  min-width: 0;
}

.automate-filter-row .automate-filter-type {
  flex: 0 1 9rem;
}

/* The check that hands a condition's value to the workflow, and the name of
   the port it will arrive on in place of the value box. Neither stretches: the
   row's boxes are what should take the spare width. */
.automate-filter-row .automate-filter-port {
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
}

.automate-filter-fromport {
  flex: 1 1 10rem;
  min-width: 0;
  word-break: break-word;
}

.automate-filter-match {
  max-width: 22rem;
}

.automate-filter-preview {
  margin-top: var(--space-3);
}

/* --- The columns chooser --- */

/* The same arrangement the filter builder's shell has, and for the same
   reason: the swap covers the body and the foot, so display: contents keeps
   the two as the dialog's own flex children. */
.automate-columns-shell {
  display: contents;
}

/* The body is the one part that scrolls, so the search and the count stay put
   while four hundred rows move under them. */
.automate-columns-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.automate-columns-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.automate-columns-filters .form-group {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
}

/* How many are ticked, which is the one number somebody ticking their way
   through a long list wants: the rows they chose first have scrolled away. */
.automate-columns-count {
  flex: 0 0 auto;
  margin: 0 0 6px;
}

/* The list scrolls inside the modal rather than the modal scrolling, so the
   search and the count stay against the rows they describe. The shared
   table-wrapper beside this is what carries the sideways scroll and the
   border; this adds the ceiling and the upright one. */
.automate-columns-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  max-height: 55vh;
}

.data-table.automate-columns-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

/* The tick and its column name are one control: a name is easier to hit than a
   13px box, and the label is what makes it one. */
.data-table.automate-columns-table td label {
  display: block;
  cursor: pointer;
}

.automate-columns-tick-col {
  width: 3rem;
  text-align: center;
}

.data-table.automate-columns-table tr.is-chosen {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* --- Edit checks --- */

/* A target's added checks in its panel, a line each, under the Edit checks
   button that makes them. */
.automate-checks-summary {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.automate-checks-summary li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.automate-checks-summary-icon {
  width: 14px;
  height: 14px;
  flex: none;
  margin-top: 1px;
  color: var(--sev-ok-text);
}

.automate-checks-none {
  margin: 0 0 6px;
}

/* The columns chooser's arrangement: the swap covers the body and the foot,
   so display: contents keeps the two as the dialog's own flex children. */
.automate-checks-shell {
  display: contents;
}

/* The body carries its own ceiling and scrolls inside it: a dialog sized to
   its content and clamped by max-height does not re-run the flex layout, so a
   body without one keeps the height its content asked for and spills out of
   a correctly sized dialog. */
.automate-checks-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 0;
  max-height: 65vh;
  overflow-y: auto;
}

.automate-checks-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.automate-checks-heading {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.data-table.automate-checks-table td {
  vertical-align: top;
}

.automate-checks-name {
  font-size: 11px;
  color: var(--text-muted);
}

/* One added check: which column and which check on one line with the way to
   remove it, and the check's own settings under them. */
.automate-check-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0;
}

.automate-check-card.has-error {
  border-color: var(--sev-prob-border);
}

.automate-check-head,
.automate-checks-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}

.automate-check-head .form-group,
.automate-checks-add .form-group {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
}

.automate-check-remove {
  flex: none;
}

/* The added checks as lines of a table, the way the checks above them are,
   with the one being edited opened into its settings under its own line. */
.data-table.automate-checks-own th.automate-checks-actions {
  width: 76px;
  text-align: right;
}

.data-table.automate-checks-own td.automate-checks-actions {
  text-align: right;
  white-space: nowrap;
}

.data-table.automate-checks-own tr.automate-check-line td {
  vertical-align: middle;
}

.data-table.automate-checks-own tr.automate-check-line.has-error td {
  background: var(--sev-prob-bg);
}

.data-table.automate-checks-own tr.automate-check-line.is-open td {
  background: var(--surface-hover);
  border-bottom-color: transparent;
}

.data-table.automate-checks-own tr.automate-check-editor-row td {
  background: var(--surface-hover);
  padding-top: 0;
}

.automate-check-line-problem {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.automate-check-done {
  display: flex;
  justify-content: flex-end;
}

.automate-check-params {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--space-2) var(--space-3);
}

.automate-check-params .form-group {
  margin: 0;
  min-width: 0;
}

/* A held file: the one setting chosen rather than typed. The name reads as a
   fact about the step, with the way to change it under it. */
.automate-file-held {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  min-width: 0;
  word-break: break-word;
}

.automate-file-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.automate-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* The label is the button. A file input cannot be styled and its own text
   ("No file chosen") says nothing this field has not already said, so it is
   hidden inside a label that looks like every other button here - and hidden
   by size rather than by display:none, which would take it out of the tab
   order and leave the control unreachable from the keyboard. */
.automate-file-choose {
  position: relative;
  overflow: hidden;
}

.automate-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.automate-picker-note {
  margin-top: 6px;
}

.automate-vars-pick {
  display: grid;
  grid-template-columns: minmax(0, 5fr) 64px minmax(0, 6fr);
  align-items: baseline;
  gap: 1px 10px;
  width: 100%;
  padding: 3px 6px;
  margin: 0 -6px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* A sentence saying why a step offers nothing to press takes the whole line:
   it has no type and no reference beside it. */
.automate-vars-pick > span:only-child {
  grid-column: 1 / -1;
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .automate-vars-pick {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .automate-vars-pick code {
    grid-column: 1 / -1;
  }
}

.automate-vars-pick:hover,
.automate-vars-pick:focus-visible {
  background: var(--surface-hover);
  border-color: var(--border);
  outline: none;
}

/* An entry that only illustrates the form is not pressable, so it must not
   look pressable either: no pointer, no hover, and the reference in the muted
   colour rather than the accent the usable ones carry. */
.automate-vars-pick.is-shape {
  cursor: default;
}

.automate-vars-pick.is-shape code {
  color: var(--text-muted);
}

/* A sentence about a step's entries said once under its heading: that a
   document's lines.first and lines.last are positions, not line numbers. */
.automate-vars-group-says {
  margin: 0 0 4px;
  padding: 2px 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

/* The entry whose key matches the field being edited is moved to the front,
   and this is what says so at a glance. An inset bar rather than a
   background, so hover and focus still read on it. */
.automate-vars-list li.is-suggested .automate-vars-pick {
  box-shadow: inset 2px 0 0 var(--accent);
}

/* The names panel beside a field (automate-suggest-body: an entity's own
   columns or relations, a test step's form controls) is a name over what it
   is, in the inspector's 264px column. The variables modal's grid above is a
   name, a type and a reference across a window; laid over this panel it cut
   every name to a few characters with nothing to read the rest by, drew what
   the name is four lines tall in the type's 64px, and left it in the
   button's own colour, which in the dark theme is black on the panel. */
.automate-vars-list.automate-suggest-list .automate-vars-pick {
  grid-template-columns: minmax(0, 1fr);
}

.automate-vars-list.automate-suggest-list code {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}

.automate-vars-list.automate-suggest-list .automate-vars-pick > span {
  color: var(--text-muted);
}

.automate-test-log {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow: auto;
}

/* --- Choose path --- */

/* The columns chooser's arrangement and for its reason: the swap covers the
   body and the foot, so display: contents keeps the two as the dialog's own
   flex children and the body is the one part that scrolls. */
.automate-jsonpath-shell {
  display: contents;
}

.automate-jsonpath-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
}

.automate-jsonpath-body .form-group {
  margin: 0;
}

/* A ceiling on the body itself, for the reason the variables modal carries
   one: a dialog clamped by max-height does not re-run its flex layout, so a
   body without one keeps the height its content asked for and spills out of a
   dialog that looks correctly sized, with the last rows out of reach. */
.automate-jsonpath-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* What the tree is drawn from: three pressable sources, the one showing
   marked, the ones with nothing to draw greyed with the reason in their
   tooltip. */
.automate-jsonpath-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.automate-jsonpath-sources-label {
  margin-right: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* The words wrap only when the source alone is wider than the strip: its
   note is the name of the step above, which is as long as its author made
   it, and a line that cannot break runs out of a phone's dialog. */
.automate-jsonpath-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  text-align: start;
  cursor: pointer;
}

.automate-jsonpath-source:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
}

.automate-jsonpath-source.is-on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.automate-jsonpath-source:disabled {
  opacity: 0.45;
  cursor: default;
}

.automate-jsonpath-source-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.automate-jsonpath-lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.automate-jsonpath-note {
  margin: 0;
}

.automate-jsonpath-example {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
}

.automate-jsonpath-paste-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

/* The tree scrolls inside the modal, so the sources and the search stay put
   above it and the choice stays in the foot below it. */
.automate-jsonpath-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 50vh;
  overflow: auto;
  padding: 4px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.automate-jsonpath-tree {
  margin: 0;
  padding: 0;
  list-style: none;
}

.automate-jsonpath-node {
  margin: 0;
}

/* One row: the key (indented by its depth and nothing else, so the types and
   values line up down the whole tree), its type and what it holds. Relative,
   because the key's button is stretched over the row. */
.automate-jsonpath-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px minmax(0, 36%);
  align-items: center;
  gap: 10px;
  padding: 4px 14px 4px 8px;
  list-style: none;
  cursor: pointer;
}

.automate-jsonpath-row::-webkit-details-marker {
  display: none;
}

.automate-jsonpath-row:hover {
  background: var(--surface-hover);
}

.automate-jsonpath-row.is-picked {
  background: var(--accent-dim);
  box-shadow: inset 3px 0 0 var(--accent);
}

.automate-jsonpath-key {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding-left: calc(var(--automate-jsonpath-depth, 0) * 18px);
}

/* The branch's own control, raised above the stretched button so pressing
   it opens and closes the branch rather than choosing the value. */
.automate-jsonpath-toggle {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}

.automate-jsonpath-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.12s;
}

.automate-jsonpath-branch[open] > .automate-jsonpath-row .automate-jsonpath-chevron {
  transform: rotate(90deg);
}

/* The row's words are the button, and the button covers the row, so
   pressing anywhere on it chooses the value. */
.automate-jsonpath-pick {
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.automate-jsonpath-pick::after {
  content: "";
  position: absolute;
  inset: 0;
}

.automate-jsonpath-pick:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.automate-jsonpath-pick.is-words,
.automate-jsonpath-words {
  font-family: var(--font-body);
  color: var(--text-muted);
}

.automate-jsonpath-row.is-picked .automate-jsonpath-pick {
  color: var(--accent);
  font-weight: 600;
}

/* Which item of a list the keys under it are read from. Raised above the
   stretched button, like the chevron, so a press here is a press here. */
.automate-jsonpath-seg {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-shrink: 0;
  margin-left: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.automate-jsonpath-seg-btn,
.automate-jsonpath-seg-num {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 11.5px;
}

.automate-jsonpath-seg-btn {
  cursor: pointer;
}

.automate-jsonpath-seg > :last-child {
  border-right: 0;
}

.automate-jsonpath-seg-btn:hover:not(:disabled) {
  color: var(--text);
}

.automate-jsonpath-seg-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.automate-jsonpath-seg-btn.is-on,
.automate-jsonpath-seg-num.is-on {
  background: var(--accent-dim);
  color: var(--accent);
}

.automate-jsonpath-step-icon {
  width: 12px;
  height: 12px;
}

.automate-jsonpath-badge {
  justify-self: start;
}

/* An object's or a list's type reads quieter than a value's: it is where a
   value is, not a value. */
.type-badge.automate-jsonpath-badge.is-quiet {
  background: var(--surface-hover);
  color: var(--text-muted);
}

.automate-jsonpath-value,
.automate-jsonpath-note {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-faint);
}

.automate-jsonpath-value {
  font-family: var(--font-mono);
  font-size: 12px;
}

.automate-jsonpath-note {
  font-size: 12px;
  font-style: italic;
}

/* The foot says what Apply will write before it is pressed. */
.automate-jsonpath-foot {
  flex-wrap: wrap;
  row-gap: 10px;
}

.automate-jsonpath-result {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.automate-jsonpath-result-label {
  color: var(--text-faint);
}

.automate-jsonpath-result-path {
  min-width: 0;
  overflow: hidden;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automate-jsonpath-result-as {
  font-size: 12px;
  white-space: nowrap;
  color: var(--text-faint);
}

/* A phone draws the modal full-screen, and a row there cannot hold three
   columns: the value goes under the key, still indented with it. */
@media (max-width: 620px) {
  .automate-jsonpath-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 2px;
  }

  .automate-jsonpath-value,
  .automate-jsonpath-note {
    grid-column: 1 / -1;
    padding-left: calc(22px + var(--automate-jsonpath-depth, 0) * 18px);
  }

  .automate-jsonpath-result {
    flex-basis: 100%;
    flex-wrap: wrap;
  }
}

/* --- Run page --- */
/* Canvas | Log | Files. The radios sit outside the morphed live block (see
   run.html), so the panel rules reach through #automate-run: a live update
   never resets the tab a person is reading. */
.automate-run-tabs .automate-run-panel {
  display: none;
}

#automate-run-tab-canvas:checked ~ #automate-run .automate-run-panel-canvas,
#automate-run-tab-runbook:checked ~ #automate-run .automate-run-panel-runbook,
#automate-run-tab-targets:checked ~ #automate-run .automate-run-panel-targets,
#automate-run-tab-documents:checked ~ #automate-run .automate-run-panel-documents,
#automate-run-tab-log:checked ~ #automate-run .automate-run-panel-log,
#automate-run-tab-files:checked ~ #automate-run .automate-run-panel-files {
  display: block;
  /* The shown panel is what takes the height the header and the summary
     leave, and it is the scroller. See .automate-run-page. It gives way
     down to a floor and no further: the failed step's card above it, with
     the page's picture in it, took the whole of the room in an ordinary
     window and left the canvas, the step table and every link in them no
     height at all, so a press on any of them landed on the page behind.
     Past the floor the columns around it stop shrinking and the page
     scrolls instead. Size containment is what lets them: it keeps what the
     panel holds out of their minimum height, so the floor is that minimum
     rather than the whole step table. Without it the floor only made the
     panel overflow its column and draw over whatever came after it, the
     strip saying one step is being shown, and its button, included. */
  flex: 1 1 auto;
  min-height: min(360px, 45vh);
  contain: size;
  overflow: auto;
}

/* The summary tiles are the Canvas tab's alone. They sat above every tab,
   which is a row of the window's height on the Runbook, the targets, a
   document, the log and the files, none of which is read for the counts; the
   canvas is where a run is looked at as a whole, and it keeps them. The tabs'
   radios are outside the live block, so a live update cannot bring them back
   on another tab. The failed step's card and the run's message are not tiles
   and stay on every tab.

   The first tile is the run's own status, which nothing else on the page
   says, so on every other tab it is a pill at the end of the tabs' own row
   (automate-run-tab-status), costing no height; on Canvas the tile says it. */
#automate-run-tab-canvas:not(:checked) ~ #automate-run .automate-run-summary {
  display: none;
}

.automate-run-tab-status {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

#automate-run-tab-canvas:checked ~ .tool-tabs-header .automate-run-tab-status {
  display: none;
}

/* The run page fills the shell's scroll box rather than flowing down it, the
   same shape as the designer: .main-content has a definite height from
   .main-wrapper's 100vh, so height: 100% resolves here and every box between
   this and the shown panel is a flex column. Those boxes keep the automatic
   minimum height a flex item has, which with the panel size-contained is what
   sits above the panel plus the panel's floor: they shrink to fit the window
   down to that and no further, and past it the page scrolls with everything
   after the tabs below them rather than under the panel.

   The log is why. It carried a max-height of 360px, so on a desktop window it
   used about 40% of the room under the tab strip and left the rest empty -
   with the lines it could not fit scrolling inside that box while the page
   scrolled around it. Giving the panel the remaining height instead also
   keeps the tab strip, with the run's status at its end, in view on every
   tab, which is what a live run wants: the status moves while you are
   reading the log.

   Below 960px the page flows again, the same breakpoint and the same reason
   as the designer: a summary bar, a tab strip and a panel stacked in a phone's
   height leave the panel too little to be worth scrolling inside. */
.automate-run-page {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Everything above the tabs keeps its own height; only the tab block grows. */
.automate-run-page > .tool-header,
.automate-run-page > .alert,
.automate-run-page > .automate-run-message-line {
  flex: 0 0 auto;
}

.automate-run-page > .automate-run-tabs,
.automate-run-tabs > #automate-run,
#automate-run > #automate-run-live,
#automate-run-live > .automate-run-live {
  flex: 1 1 auto;
  min-height: auto;
  display: flex;
  flex-direction: column;
}

.automate-run-tabs > .tool-tabs-header,
.automate-run-live > .summary-bar,
.automate-run-live > .automate-run-failure,
.automate-run-live > .automate-run-message-line {
  flex: 0 0 auto;
}

/* The log panel is a column so the log box itself fills it: a run with four
   lines should still draw its box the full height rather than a short card
   with a void beneath it. */
#automate-run-tab-log:checked ~ #automate-run .automate-run-panel-log {
  display: flex;
  flex-direction: column;
  /* The log box is the scroller, not the panel around it: two nested scroll
     boxes and which one a wheel moves depends on which still has room. */
  overflow: visible;
}

/* The Documents tab is drawn on every run page and offered only while the
   live block holds the documents panel: a run's first document, and the
   question about it, can arrive in a live update, and the tab radios and
   labels are outside what an update redraws. */
.automate-run-tabs:not(:has(.automate-run-panel-documents)) .automate-run-tab-documents-label {
  display: none;
}

#automate-run-tab-canvas:checked ~ .tool-tabs-header .tab-bar label[for="automate-run-tab-canvas"],
#automate-run-tab-runbook:checked ~ .tool-tabs-header .tab-bar label[for="automate-run-tab-runbook"],
#automate-run-tab-targets:checked ~ .tool-tabs-header .tab-bar label[for="automate-run-tab-targets"],
#automate-run-tab-documents:checked ~ .tool-tabs-header .tab-bar label[for="automate-run-tab-documents"],
#automate-run-tab-log:checked ~ .tool-tabs-header .tab-bar label[for="automate-run-tab-log"],
#automate-run-tab-files:checked ~ .tool-tabs-header .tab-bar label[for="automate-run-tab-files"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* The Documents tab: the document as the run left it, then each step's
   version as a disclosure, each the document view (document_view.html) with
   its history under it. */
.automate-run-documents {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.automate-run-doc-heading {
  margin: 0 0 var(--space-3);
}

.automate-run-doc-heading {
  font-size: 14px;
}

.automate-run-doc-chevron {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform 0.15s ease;
}

details[open] > summary > .automate-run-doc-chevron {
  transform: rotate(90deg);
}

details.automate-run-doc {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: var(--space-3);
}

/* The line a document is asked for under, until it arrives. */
.automate-run-doc-loading {
  margin: var(--space-2) 0 0;
}

.automate-run-doc-body {
  min-width: 0;
}

details.automate-run-doc > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  list-style: none;
}

details.automate-run-doc > summary::-webkit-details-marker {
  display: none;
}

details.automate-run-doc[open] > summary {
  margin-bottom: var(--space-3);
}

/* The step's name and the document's gist share the row, the gist taking
   the room and cut where it ends, so the pill sits at the right. */
.automate-run-doc-step {
  font-weight: 600;
  flex: none;
  max-width: 40%;
  overflow-wrap: anywhere;
}

.automate-run-doc-gist {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

/* A document's history, in the modal a run's Documents tab and a workbench
   instance's document open from the document's strip, is one table with one set of column widths.

   It had no layout of its own, so the browser sized every column from the
   rows on screen. A long value in From, To or Why took the room When wanted,
   and the moment broke at its space: most rows were two lines tall for the
   sake of a date. And a workbench narrows its history with chips that leave
   different rows on screen, so every column moved as Header or Lines was
   pressed. Fixed, with a width on every named heading, the columns stand
   still whatever is listed. Every one has a width, none is left to take the
   remainder: under a fixed layout a column with no width is given only what
   the others leave, which on a narrow card is nothing at all. The widths add
   up to less than the table at its narrowest (min-width), and what is spare
   on a wider card is shared out among them. When is written short and never
   wraps (its tooltip is the whole moment), who made a change is cut where its
   column ends (its tooltip is whole too), and a value wraps where it has to,
   since a value is never what gets the ellipsis. Below the width its columns
   need the table scrolls in its wrapper. */
.data-table.doc-changes-table {
  table-layout: fixed;
  min-width: 960px;
}

.data-table.doc-changes-table th.doc-change-seq {
  width: 3rem;
}

.data-table.doc-changes-table th.doc-change-at {
  width: 7.25rem;
}

.data-table.doc-changes-table th.doc-change-by {
  width: 10.5rem;
}

.data-table.doc-changes-table th.doc-change-what {
  width: 22%;
}

.data-table.doc-changes-table th.doc-change-from {
  width: 14%;
}

.data-table.doc-changes-table th.doc-change-to {
  width: 19%;
}

.data-table.doc-changes-table th.doc-change-why {
  width: 10%;
}

.data-table.doc-changes-table td {
  overflow-wrap: anywhere;
}

.data-table.doc-changes-table td.doc-change-at {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.data-table.doc-changes-table td.doc-change-by {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automate-run-waiting-line {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sev-warn-text);
}

.automate-run-waiting-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* --- Runbook tab --- */
/* The style picker stays put while the runbook under it scrolls. It is the
   control for the thing being scrolled, and a long run put it a screen and a
   half above the reader: changing your mind about how to read a run meant
   scrolling back to the top to do it and then scrolling down again.

   The shown run panel is the scroller (see .automate-run-panel-*), so top: 0
   is the top of the panel rather than of the window. Its own ground is painted
   and the gap under it is padding rather than margin, because a margin is not
   part of what the sticky strip paints and the table would scroll through it. */
.automate-style-picker {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: var(--space-3);
  background: var(--bg);
}

.automate-style-choice[aria-current="page"] {
  border-color: var(--accent);
  color: var(--accent);
}

.automate-runbook-stage {
  margin-bottom: var(--space-4);
}

.automate-runbook-stage-title {
  margin: 0 0 var(--space-2);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.automate-runbook-step-label {
  display: block;
  font-weight: 500;
}

.automate-runbook-step-kind {
  display: block;
  margin-top: 2px;
}

.automate-runbook-spur td,
.automate-runbook-spur .automate-plain-text {
  color: var(--text-muted);
}

/* The step name gets a floor, or a long name wraps to a word a line while the
   columns beside it hold three characters each.

   Named by a class rather than by where the column happens to sit. It was
   `td:nth-child(2)` on the board, written when the second cell was the step
   name; adding the Stop column in front of it moved that 200px floor onto the
   column holding one 11px dot, which is how the dots came to sit in a column
   as wide as the names beside them. Nothing about the rule looked wrong, and
   no width set on the Stop column could win against it - a min-width beats a
   width, so the column read as one the browser had simply decided to make
   fat. TestRunbookColumnRulesNameTheirColumn fails on a positional selector
   into either of these tables. */
.data-table.automate-runbook-steps td.automate-runbook-step-cell,
.data-table.automate-runbook-board td.automate-board-calling {
  min-width: 200px;
}

/* One width per column, for every stage.

   A stage is a table of its own - the heading above it is what makes it a
   stage - so the browser sized each one to its own content: the same six
   headings sat at six different x positions down one page, and scrolling
   from Collect to Transform moved every column sideways. Fixed layout plus a
   declared width per column is what holds them still, and the widths are
   declared on the headings because under a fixed layout the first row is what
   sizes the columns; the min-width above no longer participates and is left
   for the board, which shares the rule and is not fixed.

   What came out takes what is left, because it is the one column whose
   content has no shape: a sentence, a schema, a file name and a size. */
.automate-runbook-steps {
  table-layout: fixed;
  /* Below this the columns would be crushed rather than scrolled; the wrapper
     is what scrolls, and every stage's table reaches it at the same width, so
     they stay in step. */
  min-width: 860px;
}

.automate-runbook-steps .automate-runbook-col-step    { width: 220px; }
.automate-runbook-steps .automate-runbook-col-owner   { width: 110px; }
.automate-runbook-steps .automate-runbook-col-state   { width: 160px; }
.automate-runbook-steps .automate-runbook-col-doc     { width: 110px; }
.automate-runbook-steps .automate-runbook-col-started { width: 90px; }
.automate-runbook-steps .automate-runbook-col-took    { width: 80px; }
.automate-runbook-steps .automate-runbook-col-results { width: 150px; }

/* A fixed layout does not grow a cell to fit its content, so anything that
   cannot be broken would run under the column beside it. */
.automate-runbook-steps td {
  overflow-wrap: anywhere;
}

/* The decision card: a boxed request, amber like the waiting pill, with the
   buttons only for a reader CanAct admits. */
.automate-decision-card {
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--sev-warn-border);
  border-left: 4px solid var(--sev-warn-text);
  border-radius: var(--radius-sm);
  background: var(--sev-warn-bg);
}

.automate-decision-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* A wait for other runs to finish (Wait for runs): not a request, so it is
   blue like work in flight rather than amber like a decision. */
.automate-decision-card.is-runs {
  border-color: var(--sev-info-border);
  border-left-color: var(--sev-info-text);
  background: var(--sev-info-bg);
}

.automate-decision-card.is-runs .automate-decision-icon {
  color: var(--sev-info-text);
}

/* The runs such a wait names, on the run page and a workbench. */
.automate-runs-wait-table {
  margin-top: var(--space-2);
}

/* What a workbench instance is waiting for, above its tabs. */
.workbench-runs-wait {
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--sev-info-border);
  border-left: 4px solid var(--sev-info-text);
  border-radius: var(--radius-sm);
  background: var(--sev-info-bg);
}

.workbench-runs-wait-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.workbench-runs-wait-icon {
  width: 20px;
  height: 20px;
  color: var(--sev-info-text);
  flex-shrink: 0;
}

/* A question about a document, on the Runbook: a pointer to the Documents
   tab, where it is answered, with the press that opens it at the right. */
.automate-decision-goto {
  margin-left: auto;
  flex: none;
}

.automate-decision-icon {
  width: 22px;
  height: 22px;
  color: var(--sev-warn-text);
  flex-shrink: 0;
}

.automate-decision-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.automate-decision-instructions {
  margin: var(--space-2) 0 0;
  font-size: 13px;
}

.automate-decision-detail {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  max-height: 220px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
}

.automate-decision-form {
  margin-top: var(--space-3);
}

/* The choices are what the card is for, so they sit at its bottom right
   (.form-actions.is-end) with the card's own padding under them. */
.automate-decision-actions {
  margin-top: var(--space-3);
}

.automate-decision-readonly {
  margin: var(--space-2) 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* The progress tracker: sized to its panel, never wider than drawn, and it
   scrolls sideways inside its own wrapper on a phone. */
.automate-track-wrap {
  overflow-x: auto;
}

.automate-track {
  display: block;
  width: 100%;
  max-width: 640px;
  min-width: 420px;
  height: auto;
  font-family: var(--font-body);
}

.automate-track-head {
  font-size: 13px;
  font-weight: 600;
  fill: var(--text);
}

.automate-track-caption {
  font-size: 11.5px;
  fill: var(--text-muted);
}

/* A bar has no ring to carry its state the way a station does, so it carries
   it as a tint with the state itself on the edge: strong enough to read down
   a column of them, soft enough that ten in a row do not shout. */
.automate-track-bar {
  fill: color-mix(in srgb, var(--automate-state, var(--automate-state-pending)) 40%, var(--surface));
  stroke: var(--automate-state, var(--automate-state-pending));
  stroke-width: 1.5;
}

/* A step that has not started is an empty bar rather than a grey one. */
.automate-track-bar.automate-lamp-pending {
  fill: var(--surface-alt);
  stroke: var(--border);
}

.automate-track-label {
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--text);
  pointer-events: none;
}

.automate-track-took {
  font-size: 10.5px;
  fill: var(--text-muted);
}

.automate-track-state {
  font-size: 10.5px;
  fill: var(--text-muted);
}

/* A turned label runs away from the bar rather than along it: the one above
   extends upward from its anchor, the one below downward, and both read
   bottom to top. The rotation is on the element (render.TrackSeg's geometry);
   these only say which way each one grows from its anchor point. */
.automate-track-took.is-side {
  text-anchor: start;
}

.automate-track-state.is-side {
  text-anchor: end;
}

.automate-track-note {
  margin-top: var(--space-2);
}

/* --- The tube map and the swimlanes ---

   Both are SVG the server lays out, so nothing here positions anything: these
   rules are colour, weight and type only. A station's fill is its state lamp,
   its ring is its app, and every value comes from a stylesheet variable, so
   both drawings follow the theme in both modes. */
.automate-drawing-wrap {
  overflow-x: auto;
  padding-bottom: var(--space-2);
}

/* Both drawings carry their own width and height, so they render at the size
   the server laid them out at and the wrapper above scrolls when the panel is
   narrower - the treatment tables get. Stretching them to the panel instead
   would scale the type with the box, and a three-step workflow would read its
   labels at twice the size of everything around it. */
.automate-tube,
.automate-lanes {
  display: block;
  max-width: none;
  font-family: var(--font-body);
}

.automate-tube-leg {
  fill: none;
  stroke: var(--automate-app, var(--automate-edge));
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A leg that carries only an order is drawn as a connection you walk. */
.automate-tube-leg.is-sequence {
  stroke-width: 3;
  stroke-dasharray: 7 6;
  opacity: 0.75;
}

/* A station is a disc the colour of the page it sits on, ringed in its state,
   the way a transit map draws one. The line keeps the app colour, so the line
   and the ring say different things: which app the step belongs to, and how
   it went. Filling the disc with the state instead put a saturated blob at
   every stop and left the ring saying the same thing as the line. */
.automate-tube-dot {
  fill: var(--surface);
  stroke: var(--automate-state, var(--automate-state-pending));
  stroke-width: 4;
}

/* An interchange is where the line forks: a heavier ring, the one place a
   reader has to look twice. */
.automate-tube-stop.is-interchange .automate-tube-dot {
  stroke-width: 6;
}

.automate-tube-label,
.automate-lane-label {
  font-size: 12px;
  font-weight: 600;
  fill: var(--text);
  text-anchor: middle;
}

.automate-tube-kind {
  font-size: 10.5px;
  fill: var(--text-muted);
  text-anchor: middle;
}

/* The document a step handed on, as a drawing marks it (automateDocGlyph,
   automateDocBar): an outline while it is ready, amber with a stroke while a
   check's finding is outstanding, and filled with a tick once a person
   approved it. One custom property carries the colour, so the tube map's
   page, the swimlanes' bar and the legend's swatches cannot disagree. */
.automate-doc-ready    { --automate-doc: var(--sev-ok-text); }
.automate-doc-notready { --automate-doc: var(--sev-warn-text); }
.automate-doc-approved { --automate-doc: var(--sev-ok-text); }
.automate-doc-rejected { --automate-doc: var(--sev-prob-text); }
.automate-doc-returned { --automate-doc: var(--sev-warn-text); }
.automate-doc-cancelled { --automate-doc: var(--text-muted); }

.automate-doc-page {
  fill: var(--automate-doc);
  stroke: var(--automate-doc);
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.automate-doc-ready .automate-doc-page {
  fill: var(--surface);
}

.automate-doc-sign {
  fill: none;
  stroke: var(--surface);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.automate-doc-bar {
  fill: var(--automate-doc);
}

.automate-doc-bar.automate-doc-ready {
  opacity: 0.45;
}

.automate-doc-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0 0 var(--space-2);
  color: var(--text-muted);
  font-size: 12.5px;
}

.automate-doc-legend strong {
  color: var(--text);
}

.automate-doc-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.automate-doc-swatch {
  flex: none;
  width: 10px;
  height: 12px;
  border: 1.5px solid var(--automate-doc);
  border-radius: 2px;
  background: var(--automate-doc);
}

.automate-doc-swatch.automate-doc-ready {
  background: transparent;
}

.automate-doc-swatch.is-lanes {
  width: 22px;
  height: 5px;
  border: 0;
  border-radius: 2.5px;
}

.automate-doc-swatch.is-lanes.automate-doc-ready {
  background: var(--automate-doc);
  opacity: 0.45;
}

/* Where the document's state changed, on that step of a story: a line of
   its own under what the step did. */
.automate-plain-doc {
  display: flex;
  flex-basis: 100%;
  align-items: center;
  gap: var(--space-2);
  margin-top: 4px;
  font-size: 12.5px;
}

.automate-tube-state,
.automate-lane-state {
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-muted);
  text-anchor: middle;
}

.automate-tube-always,
.automate-lane-always {
  font-size: 10.5px;
  font-style: italic;
  fill: var(--text-muted);
  text-anchor: middle;
}

.automate-lane-band {
  fill: var(--surface-alt);
  opacity: 0;
}

.automate-lane.is-alt .automate-lane-band {
  opacity: 0.55;
}

.automate-lane-rule {
  fill: var(--automate-app, var(--automate-edge));
}

.automate-lane-name {
  font-size: 12px;
  font-weight: 600;
  fill: var(--text-muted);
}

.automate-lane-link {
  fill: none;
  stroke: var(--automate-edge);
  stroke-width: 2;
}

/* A crossing leaves its lane: another system, another credential. Drawn
   heavier and in the accent, because counting them is the point of the view. */
.automate-lane-link.is-crossing {
  stroke: var(--accent);
  stroke-width: 3;
}

.automate-lane-link.is-sequence {
  stroke-dasharray: 6 5;
  opacity: 0.8;
}

.automate-lane-dot {
  fill: var(--surface);
  stroke: var(--automate-state, var(--automate-state-pending));
  stroke-width: 4;
}

/* The departure board's stop column: a dot per calling point, joined down the
   column by a thin line drawn through them.

   A board joins its calling points with a rail, and the dot used to sit inside
   the Calling at cell in front of the step's name, which made it a bullet:
   nothing connected one stop to the next, which is the whole of what the
   drawing has to say. The line is the cell's own ::before, so it needs no
   element of its own and cannot fall out of step with the rows; the first and
   last rows start and end it at their dot rather than letting it run off the
   ends of the table. */
/* As narrow as the word Stop, and no narrower or wider.

   A width in an auto-layout table is a suggestion the browser may overrule
   wherever it has room to spare, and 24px was overruled into two hundred: the
   column sat almost as wide as the step names beside it, with one dot in the
   middle of all that space. 1% is how the same algorithm is asked for "as
   narrow as your content allows", and the content is the heading.

   Qualified with .data-table, the way .num-col is: the shared header rule sets
   text-align: left at (0,1,1) and sits later in this file, so a bare class
   would lose the alignment twice over. */
.data-table th.automate-board-stop-head,
.data-table td.automate-board-stop {
  width: 1%;
  white-space: nowrap;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
  text-align: center;
}

.automate-board-stop {
  position: relative;
}

.automate-board-stop::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 4px;
  margin-left: -2px;
  background: var(--border);
}

.automate-runbook-board tbody tr:first-child .automate-board-stop::before {
  top: 50%;
}

.automate-runbook-board tbody tr:last-child .automate-board-stop::before {
  bottom: 50%;
}

/* A single calling point is a stop, not a journey: no line at all. */
.automate-runbook-board tbody tr:first-child:last-child .automate-board-stop::before {
  display: none;
}

.automate-board-dot {
  position: relative;
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  vertical-align: middle;
  background: currentColor;
  /* A ring in the table's own ground, so the line passes behind the dot
     rather than through it. */
  box-shadow: 0 0 0 3px var(--surface);
}

.automate-board-dot { color: var(--automate-state, var(--automate-state-pending)); }

.automate-board-time {
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

/* Plain English. */
.automate-plain-when {
  margin: 0 0 var(--space-3);
  font-size: 13px;
}

.automate-plain-list {
  margin: 0;
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.automate-plain-step {
  font-size: 13px;
}

.automate-plain-text {
  display: block;
}

.automate-plain-outcome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12.5px;
}

.automate-plain-why {
  color: var(--text-muted);
}

.automate-plain-always {
  color: var(--text-muted);
  margin-left: 6px;
}

.automate-plain-end {
  margin: var(--space-4) 0 0;
  font-size: 13px;
}

.automate-run-summary {
  margin-bottom: var(--space-3);
}

.automate-run-message-line {
  margin: 0 0 var(--space-3);
  font-size: 13px;
}

.automate-run-live .automate-canvas-wrap {
  margin-bottom: var(--space-4);
}

.automate-run-message {
  max-width: 420px;
  word-break: break-word;
}

/* A run's Started by is a sign-in name, which no cell can break on its own:
   an ordinary address held the runs table wider than its frame and left
   Outcome, the column that says what happened, at its heading's width. A test's
   Runs tab, in a card of its own, keeps Outcome 16rem to be read in as well;
   the runs lists have a column more and take the frame's width instead. */
.data-table.automate-runs-table td.automate-run-by {
  overflow-wrap: anywhere;
}

.data-table.test-runs-table td.automate-run-message {
  min-width: 16rem;
}

/* Run's question on a test's page: its foot holds two or three long labels
   (Back to the first tab holding what is not saved, Open the recording, Run
   as last saved), which the shared foot draws in one row, and on a phone that
   row ran past the dialog's edge. They wrap, and stay to the right. */
.modal-foot.test-run-question-foot {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.automate-run-file {
  word-break: break-all;
}

/* A screenshot a step produced, drawn where the file is listed. Capped, so a
   full-page capture of a form is a thumbnail in a table cell and a picture on
   the Files tab, and opening it is the file itself in a new tab. */
.automate-run-shot {
  display: block;
  max-width: 100%;
  max-height: 240px;
  width: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 4px;
}

.automate-run-shot-cell {
  max-height: 96px;
}

/* The failed step's card above the tabs: the sentence and, where the step
   took one, the page as it failed. */
.automate-run-failure {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  padding: 12px 16px;
  margin: 0 0 12px;
  border: 1px solid var(--sev-prob-text);
  border-radius: var(--radius);
  background: var(--surface);
}

.automate-run-failure-words {
  flex: 1 1 280px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.automate-run-failure .automate-run-shot {
  max-height: 320px;
  margin: 0;
}

/* A step's results elsewhere in the product. It reads as a link rather than a
   button because it is one of several cells in a table row, and a row of
   buttons in a table is a toolbar nobody asked for. */
.automate-run-link {
  white-space: nowrap;
}

.automate-run-log {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  /* Fills the Log panel and scrolls inside itself. No max-height: the height
     comes from the panel, which comes from the window. */
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.automate-log-line {
  display: grid;
  /* Time, severity, the Info control, the step, the line itself. The third is
     18px because that is the button: a log is read down its left edge, and a
     column that grew with its content would put the step names at a different
     x on every line. */
  grid-template-columns: 70px 62px 18px minmax(60px, 140px) minmax(0, 1fr);
  gap: var(--space-2);
  padding: 2px 0;
  border-bottom: 1px solid var(--border);
}

/* The severity, beside the line rather than only in its colour: green and
   amber are close under protanopia, which is the same reason every state in
   this module shows its word as well as its colour. */
.automate-log-sev {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.04em;
  align-self: center;
  color: var(--text-faint);
}

.automate-log-sev.sev-warn {
  color: var(--sev-warn-text);
}

.automate-log-sev.sev-error {
  color: var(--sev-prob-text);
}

/* The filter strip above the log. */
.automate-log-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.automate-log-choice {
  cursor: pointer;
}

#automate-log-level-all:checked ~ #automate-run [data-log-filter="all"],
#automate-log-level-problems:checked ~ #automate-run [data-log-filter="problems"],
#automate-log-level-errors:checked ~ #automate-run [data-log-filter="errors"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* What the filter actually does. Nothing is removed from the page: the lines
   are still there, still searchable once the filter is put back, and the
   choice costs no request because the radios sit beside the tab radios,
   outside the block every event morphs. */
#automate-log-level-problems:checked ~ #automate-run .automate-log-line:not(.automate-sev-warn):not(.automate-sev-error),
#automate-log-level-errors:checked ~ #automate-run .automate-log-line:not(.automate-sev-error) {
  display: none;
}

/* The filter hides lines, and a line the step filter has hidden must stay
   hidden whichever severity is chosen: two filters that disagree would show a
   line neither of them wants. */
.automate-log-line[hidden] {
  display: none !important;
}

/* A filter that leaves nothing says so. A blank panel reads as a log that has
   lost its lines rather than as a narrow question with no answer. */
.automate-log-none {
  display: none;
}

#automate-log-level-problems:checked ~ #automate-run .automate-run-log:not(:has(.automate-sev-warn)):not(:has(.automate-sev-error)) .automate-log-none,
#automate-log-level-errors:checked ~ #automate-run .automate-run-log:not(:has(.automate-sev-error)) .automate-log-none {
  display: block;
}

.automate-log-line:last-child {
  border-bottom: 0;
}

.automate-log-at {
  color: var(--text-faint);
}

.automate-log-node {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automate-log-text {
  word-break: break-word;
}

/* A line about a failure is written in the failure colour. It keys on the
   severity, which is the thing that says a line is a failure: it was written
   as .automate-log-error, and no line has ever carried that class - the kind
   classes are the event's type (node, log, waiting, decision, done) and the
   severity is a class of its own. The rule matched nothing for as long as it
   existed, and the only sign was a log where the word ERROR was red and the
   sentence beside it was not.

   There is deliberately no matching rule for a line that went well: a log
   where every ordinary line is green is a log nobody scans for problems,
   which is the same argument the severity filter beside it makes. */
.automate-sev-error .automate-log-text {
  color: var(--sev-prob-text);
}

/* Below 960px the run page flows down the shell's scroller again, so every
   box goes back to sizing itself and the log gets a height measured from the
   viewport instead of from a panel that no longer has one. */
@media (max-width: 960px) {
  .automate-run-page {
    height: auto;
  }
  .automate-run-page,
  .automate-run-page > .automate-run-tabs,
  .automate-run-tabs > #automate-run,
  #automate-run > #automate-run-live,
  #automate-run-live > .automate-run-live,
  #automate-run-tab-log:checked ~ #automate-run .automate-run-panel-log {
    display: block;
    min-height: 0;
  }
  #automate-run-tab-canvas:checked ~ #automate-run .automate-run-panel-canvas,
  #automate-run-tab-runbook:checked ~ #automate-run .automate-run-panel-runbook,
  #automate-run-tab-targets:checked ~ #automate-run .automate-run-panel-targets,
  #automate-run-tab-documents:checked ~ #automate-run .automate-run-panel-documents,
  #automate-run-tab-log:checked ~ #automate-run .automate-run-panel-log,
  #automate-run-tab-files:checked ~ #automate-run .automate-run-panel-files {
    overflow: visible;
    /* A panel that flows takes the height of what it holds, so it has no
       floor and no containment: contained, it would be drawn no taller than
       its padding with everything in it spilling over the page below. */
    min-height: 0;
    contain: none;
  }
  .automate-run-log {
    max-height: 70vh;
  }
}

@media (max-width: 600px) {
  .automate-log-line {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* A cell that would otherwise be pages tall: the files past the fifth, and the
   rest of a long message, folded away behind a count or a word.

   Both are the same shape - what the row shows outright, then a <details> with
   the remainder inside it - and the split is made on the server. The
   alternative was clamping the text with -webkit-line-clamp, which cannot be
   done here: a closed <details> hides everything but its summary, so the
   clamped element would have to be the summary itself, and the "more" the
   reader presses would then be clipped along with the text it belongs to. */
.automate-more {
  display: inline;
}

.automate-more > summary {
  display: inline;
  cursor: pointer;
  list-style: none;
  color: var(--accent);
  font-size: 12px;
}

.automate-more > summary::-webkit-details-marker {
  display: none;
}

.automate-more > summary:hover {
  text-decoration: underline;
}

/* Open, the remainder follows the summary rather than sitting beside it. */
.automate-more[open] > summary {
  display: block;
}

/* Compare Package Registry: SQL Packages | Dataset Packages | Templates */
#compare-packages-tab-sql:checked ~ #compare-packages-panel-sql,
#compare-packages-tab-dataset:checked ~ #compare-packages-panel-dataset,
#compare-packages-tab-templates:checked ~ #compare-packages-panel-templates {
  display: block;
}

#compare-packages-tab-sql:checked ~ .tool-tabs-header .tab-bar label[for="compare-packages-tab-sql"],
#compare-packages-tab-dataset:checked ~ .tool-tabs-header .tab-bar label[for="compare-packages-tab-dataset"],
#compare-packages-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="compare-packages-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#compare-packages-tab-sql:checked ~ .tool-tabs-header .compare-packages-new,
#compare-packages-tab-dataset:checked ~ .tool-tabs-header .compare-packages-new,
#compare-packages-tab-sql:checked ~ .tool-tabs-header .compare-packages-design,
#compare-packages-tab-dataset:checked ~ .tool-tabs-header .compare-packages-design {
  display: inline-flex;
}

/* Assess > Assessment library: My library | Templates. New topic belongs to
   the library tab alone. */
#assess-library-tab-topics:checked ~ #assess-library-panel-topics,
#assess-library-tab-templates:checked ~ #assess-library-panel-templates {
  display: block;
}

#assess-library-tab-topics:checked ~ .tool-tabs-header .tab-bar label[for="assess-library-tab-topics"],
#assess-library-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="assess-library-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#assess-library-tab-topics:checked ~ .tool-tabs-header .assess-library-new {
  display: inline-flex;
}

/* Assess > Journey templates: Journeys | Templates. No per-tab action: New
   engagement is the page's own and starts from either tab's journeys. */
#assess-templates-tab-journeys:checked ~ #assess-templates-panel-journeys,
#assess-templates-tab-templates:checked ~ #assess-templates-panel-templates {
  display: block;
}

#assess-templates-tab-journeys:checked ~ .tool-tabs-header .tab-bar label[for="assess-templates-tab-journeys"],
#assess-templates-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="assess-templates-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Compare Control Groups: My Control Groups | Templates. */
#compare-cg-tab-groups:checked ~ #compare-cg-panel-groups,
#compare-cg-tab-templates:checked ~ #compare-cg-panel-templates {
  display: block;
}

#compare-cg-tab-groups:checked ~ .tool-tabs-header .tab-bar label[for="compare-cg-tab-groups"],
#compare-cg-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="compare-cg-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#compare-cg-tab-groups:checked ~ .tool-tabs-header .compare-cg-new {
  display: inline-flex;
}

/* Meta Collections: My Collections | Templates. The mc- prefix belongs to the
   collection *editor*'s Static/Dynamic tabs, which deliberately keep their
   actions visible on every tab - the opposite of the rule here - so this group
   uses its own prefix. */
#collections-tab-collections:checked ~ #collections-panel-collections,
#collections-tab-templates:checked ~ #collections-panel-templates {
  display: block;
}

#collections-tab-collections:checked ~ .tool-tabs-header .tab-bar label[for="collections-tab-collections"],
#collections-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="collections-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#collections-tab-collections:checked ~ .tool-tabs-header .collections-new {
  display: inline-flex;
}

/* From scratch pad: on My Collections alone, and its menu's links are links
   in a menu, not tab actions the per-tab rule hides. */
.collections-tabs-from-pad {
  display: none;
}

#collections-tab-collections:checked ~ .tool-tabs-header .collections-tabs-from-pad {
  display: block;
}

.tool-tabs-actions-per-tab .tool-tabs-actions .scratchpad-take-menu-item {
  display: flex;
}

/* Form Designer: My Forms | Templates. Both panels are hidden by the shared
   .tool-tabs-pills rule, so without these the page renders its forms and its
   templates into the DOM and shows neither - which is exactly what happened. */
#forms-tab-mine:checked ~ #forms-panel-mine,
#forms-tab-templates:checked ~ #forms-panel-templates {
  display: block;
}

#forms-tab-mine:checked ~ .tool-tabs-header .tab-bar label[for="forms-tab-mine"],
#forms-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="forms-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Built-in templates panel - the shared body of every module's Templates tab
   (see the "builtin-templates-panel" block in templates/partials.html). */
.builtin-templates-search {
  margin-bottom: 12px;
  max-width: 420px;
}

/* The search and Clone all share one line above the table: the search at the
   left, Clone all at the right edge, and the button drops under the search
   where the width runs out rather than squeezing it. */
.builtin-templates-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.builtin-templates-bar .builtin-templates-search {
  flex: 1 1 280px;
  margin-bottom: 0;
}

.builtin-templates-bar .builtin-templates-clone-all {
  margin-left: auto;
}

.builtin-templates-table .builtin-templates-desc {
  color: var(--text-muted);
}

/* A template is two rows, its name and slug and then its description under
   both (builtin-templates-rows), with the tags and Clone spanning the two. The
   name row's own cells lose their line so the description reads as part of
   it, the last template's spanning cells lose theirs at the table's foot, and
   the hover tint takes both rows together. The name wraps rather than keeping
   to one line, since it now shares its row with nothing that needs the room
   more. */
.data-table.builtin-templates-table tr.builtin-templates-lead.has-description td:not([rowspan]) {
  border-bottom: none;
  padding-bottom: 4px;
}

.data-table.builtin-templates-table tr.builtin-templates-desc-row td {
  padding-top: 0;
}

.data-table.builtin-templates-table tr.builtin-templates-lead:has(+ tr.builtin-templates-desc-row:last-child) td {
  border-bottom: none;
}

.data-table.builtin-templates-table tr.builtin-templates-lead:has(+ tr.builtin-templates-desc-row:hover) td,
.data-table.builtin-templates-table tr.builtin-templates-lead:hover + tr.builtin-templates-desc-row td {
  background: var(--surface-hover);
}

.data-table.builtin-templates-table td.friendly-name {
  white-space: normal;
}

/* The slug keeps to its badge and the name takes the rest, the description
   spanning the two whatever they come to. */
.builtin-templates-table .builtin-templates-name-col {
  min-width: 160px;
}

.builtin-templates-table .builtin-templates-slug-col {
  width: 1%;
}

/* A template's description is cut at three lines and whole in its tooltip, so
   one long paragraph does not make its row a dozen lines deep. It takes the
   column's width rather than setting it (width 0, then all of the cell), and
   the clamp is on this inner box: -webkit-box on the <td> would replace its
   table-cell display. */
.builtin-templates-desc-clamp {
  width: 0;
  min-width: 100%;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.builtin-templates-table .builtin-templates-action-col {
  width: 180px;
  text-align: right;
  white-space: nowrap;
}

/* The shared panel draws a template's tags in a row under its description,
   as the module's own list draws them under each name. A module whose own
   list has a Tags column (AI prompts, HTML and Teams templates) keeps one on
   its Templates tab too, and that column keeps to its content and hands the
   rest to the description. */
.builtin-templates-table .builtin-templates-desc-clamp + .builtin-templates-tags {
  margin-top: 6px;
}

.data-table.builtin-templates-table th.builtin-templates-tags,
.data-table.builtin-templates-table td.builtin-templates-tags {
  width: 1%;
  white-space: nowrap;
}

/* ── Tags ─────────────────────────────────────────────────────────────────────
   The tags on Automate's documents, the way Azure DevOps tags a work item (see
   cmd/website/tags.go). A pill is the tag on a row, a link narrowing the list
   to it; the filter bar above a list says which tags it is narrowed to and
   offers the rest; the input is the shared chip list with a dropdown of the
   tags already in use. The pill is deliberately the chip's own look, in the
   accent, so a tag reads the same whether it is being typed or being read. */
.tag-pill-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  vertical-align: middle;
  max-width: 100%;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--text);
  font-size: 11.5px;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-pill:hover {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}

/* Under the name in a list's first cell: a little air from the description
   above it, none below since the cell's padding is that. */
td .tag-pill-list {
  margin-top: 4px;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  font-size: 12.5px;
}

.tag-filter-label {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.02em;
  margin-right: 2px;
}

.tag-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  text-decoration: none;
}

.tag-filter-chip:hover {
  border-color: var(--accent);
  text-decoration: none;
}

/* A selected chip is the pill's own colours, so what the bar says the list is
   narrowed to looks like what the rows carry; the cross is its way out. */
.tag-filter-chip.is-selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.tag-filter-clear {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
}

.tag-filter-chip.is-selected:hover .tag-filter-clear {
  color: var(--text);
}

.tag-filter-reset {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  margin-left: 4px;
}

.tag-filter-reset:hover {
  text-decoration: underline;
}

.tag-input {
  min-width: 0;
}

/* A run log entry's note sits under its label, the way a workflow's
   description sits under its name. */
.runlog-note {
  font-size: 12px;
  white-space: normal;
}

/* Shared table-header look: uppercase muted micro-labels on a divider. */
.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

/* Centre-justify every cell, for a single-row overall summary.
   Deliberately (0,1,1), the same strength as the header rule above, and placed
   AFTER it so it wins on source order - not qualified with .data-table. A
   stronger selector would newly beat .data-table th.num-col, whose right
   alignment has always survived a centred table. */
.data-table-center th,
.data-table-center td { text-align: center; }

/* Left-justify the leading identity column (e.g. Control Group) in an otherwise
   centre-justified summary table - higher specificity than the blanket centre
   rule above so it wins regardless of source order. */
.data-table-center th.col-left,
.data-table-center td.col-left { text-align: left; }

.type-badge {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 12px;
  white-space: nowrap;
}

/* A smaller badge beside a name: the source marks (aot, web, axdb) on the
   Discover lists, which carried this size inline on every row. */
.type-badge-sm { font-size: 0.7em; }

/* A badge whose text is as long as something else made it: a step's kind,
   which a Power Platform API operation runs to ninety characters. A
   .type-badge does not wrap, so one of those ran out of its library card and
   over the next, across a runbook's Owner, State and Started columns, and
   out of the settings panel, which then scrolled sideways. This one is cut to
   its container with an ellipsis, and carries the whole text as its title.
   An inline box takes no max-width, hence inline-block, and an inline-block
   that clips sits its baseline on its bottom edge, hence the alignment. */
.type-badge-cut {
  display: inline-block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* The same text where it is the thing being read, as on a step's own page in
   the node library: wrapped at any character rather than cut, since a kind
   has no spaces to wrap at. */
.type-badge-wrap {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* An enum's type is a different sort of fact from a string's or an int's - it
   names a list somebody defined rather than a primitive - so the badge is
   tinted apart from the rest. It carried the class and no rule, so every field
   table drew an enum identically to everything beside it. */
.type-badge-enum {
  background: rgba(167, 139, 250, 0.14);
  color: #a78bfa;
}

/* Meta Collection mode pill (Static | Dynamic) - shared by the registry grid
   and the preview screen, so it lives here rather than in either page's own
   <style> block. */
.mc-mode {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  color: var(--text);
  white-space: nowrap;
}

.mc-mode-static {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.mc-mode-dynamic {
  background: color-mix(in srgb, var(--sev-ok-text) 20%, transparent);
}

/* Shared wrapping row for chip-style lists (menu items, licenses, ...) inside
   a .detail-value - without this, a long unbroken run of inline badges can
   overflow its card instead of wrapping onto new lines. */
.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.menu-item-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.menu-item-mcp-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  color: var(--text-muted);
}

.menu-item-mcp-link:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.menu-item-mcp-icon {
  width: 13px;
  height: 13px;
}

/* Country flags (D365 localization / CountryRegionCodes) are bundled SVGs, not
   Unicode regional-indicator pairs: Windows ships no flag glyphs, so the emoji
   route renders as two bare letters however the font stack is coaxed. See
   static/icons/flags/README.md. A code with no bundled flag falls back to a chip
   showing the code, so an unrecognised region stays legible. */
.flag {
  display: inline-block;
  width: 20px;
  height: 15px;
  border-radius: 2px;
  object-fit: cover;
  vertical-align: -0.16em;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 12%);
}
.flag-code {
  display: inline-block;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  color: var(--text-muted);
  vertical-align: -0.16em;
}
/* A row of flags needs a little air between them. */
.flag + .flag, .flag + .flag-code, .flag-code + .flag, .flag-code + .flag-code { margin-left: 3px; }

/* A grid's Country cell draws five flags and puts the rest behind this
   (the "country-flags" partial): a pill at a flag's height that opens the
   whole list. A button, so it says it can be pressed, and no wider than its
   count. */
.flag-more {
  display: inline-block;
  margin-left: 3px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  letter-spacing: 0;
  color: var(--text-muted);
  vertical-align: -0.16em;
  cursor: pointer;
}
.flag-more:hover,
.flag-more:focus-visible {
  color: var(--text);
  border-color: var(--accent);
}

/* In a line of prose the button reads "and 72 more" (the partial's Words),
   at the prose's own size, since a bare "+72" after a sentence reads as a
   stray number. */
.flag-more.flag-more-words {
  font-size: 11px;
  font-weight: 600;
  padding: 0 7px;
}
.flags.flags-words { letter-spacing: 0; }

/* The whole list behind a "+n": a country a line, its flag, its name and
   its code, in as many columns as the dialog has room for. The body carries
   its own ceiling, since a dialog clamped by max-height does not re-run the
   flex layout that would hold an auto-height body inside it. */
.country-list-body {
  max-height: calc(100vh - 180px);
}
/* The dialog is a short list; narrower than modal-narrow's 640px reads as a
   list rather than as a form with nothing in it. */
dialog.modal.country-list-modal {
  width: min(560px, calc(100vw - 48px));
}
.country-list {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-3);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 16px;
}
.country-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.country-list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friendly-name {
  font-weight: 500;
  white-space: nowrap;
}

.params-note {
  font-size: 11.5px;
  color: var(--text-muted);
  word-break: break-all;
}

/* Two shades of quiet text, each the token of its own name. .text-muted was
   drawn in the faint token and .text-faint had no rule at all, so the fainter
   class drew at full text colour on two hundred elements, and two pages
   overrode the other to get the shade its name promised. */
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }

/* --- Execution-path badge --- */
.exec-path {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
.exec-path-both    { background: rgba(0,201,167,0.12); color: var(--accent); }
.exec-path-file    { background: rgba(96,165,250,0.12); color: #60a5fa; }
.exec-path-sql     { background: rgba(251,191,36,0.12); color: #fbbf24; }
.exec-path-hybrid  { background: rgba(0,201,167,0.12); color: var(--accent); }
/* A page's checks, built on the page in the browser extension and never run
   by a validation run. */
.exec-path-page    { background: var(--module-validate-dim, var(--accent-subtle)); color: var(--module-validate, var(--accent)); }

.pkg-on-page {
  align-self: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* --- Evaluation-scope badge --- */
.eval-scope {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
.eval-scope-field     { background: rgba(167,139,250,0.12); color: #a78bfa; }
.eval-scope-row       { background: rgba(251,146,60,0.12);  color: #fb923c; }
.eval-scope-aggregate { background: rgba(244,114,182,0.12); color: #f472b6; }

/* A data entity's category, a tint each (entityCategoryTone): parameters
   violet, reference blue, master teal, document amber, transaction rose, and
   anything else the neutral grey of a tag with nothing to say. Light values
   are deeper shades of the same hues, as the scopes below are. */
.category-parameters  { background: rgba(167,139,250,0.14); color: #a78bfa; }
.category-reference   { background: rgba(96,165,250,0.14);  color: #60a5fa; }
.category-master      { background: rgba(0,201,167,0.14);   color: var(--accent); }
.category-document    { background: rgba(251,191,36,0.14);  color: #fbbf24; }
.category-transaction { background: rgba(244,114,182,0.14); color: #f472b6; }
.category-other       { background: rgba(148,163,184,0.14); color: var(--text-muted); }
html[data-theme="light"] .category-parameters  { background: rgba(124,92,214,0.12); color: #5b3fb8; }
html[data-theme="light"] .category-reference   { background: rgba(37,99,235,0.12);  color: #1d4ed8; }
html[data-theme="light"] .category-master      { background: rgba(0,150,125,0.12);  color: #047a66; }
html[data-theme="light"] .category-document    { background: rgba(217,119,6,0.14);  color: #92400e; }
html[data-theme="light"] .category-transaction { background: rgba(219,39,119,0.12); color: #9d174d; }
html[data-theme="light"] .category-other       { background: rgba(100,116,139,0.12); color: var(--text-muted); }

/* The pastel words above are drawn for the dark ground and all but vanish on
   the light one: a Check Library card puts them on every check, where "field"
   in #a78bfa on white read as a smudge rather than a word. Deeper shades of
   the same hues, so a pill means the same thing in either mode. */
html[data-theme="light"] .eval-scope-field     { background: rgba(124, 92, 214, 0.12); color: #5b3fb8; }
html[data-theme="light"] .eval-scope-row       { background: rgba(234, 120, 30, 0.14); color: #9a4a0b; }
html[data-theme="light"] .eval-scope-aggregate { background: rgba(214, 70, 140, 0.12); color: #a12d68; }
html[data-theme="light"] .exec-path-file       { background: rgba(37, 99, 235, 0.10);  color: #1d4ed8; }

/* --- Registry detail card --- */
.registry-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: flex-start;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 720px;
}

.registry-detail-layout .detail-card {
  max-width: none;
  min-width: 0;
}

.detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.registry-detail-reference .detail-row {
  grid-template-columns: minmax(220px, 34%) minmax(0, 1fr);
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.registry-detail-reference .detail-label {
  overflow-wrap: anywhere;
  white-space: normal;
}

.detail-value {
  font-size: 14px;
  line-height: 1.6;
  min-width: 0;
}

.registry-json-card {
  display: flex;
  flex-direction: column;
}

.registry-json-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.registry-json-subhead {
  border-top: 1px solid var(--border);
}

.registry-json-subtitle {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.registry-json-block {
  margin: 0;
  padding: 16px 20px 20px;
  overflow-x: auto;
  background: var(--bg);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.55;
  tab-size: 2;
}

.registry-json-block code {
  font-family: inherit;
  white-space: pre;
}

@media (max-width: 1100px) {
  .registry-detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .registry-detail-reference .detail-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* Menu Explorer tree - server-rendered via nested <details>/<ul>, no JS. */
.menu-tree-root,
.menu-tree-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-tree-children {
  padding-left: 22px;
  border-left: 1px solid var(--border);
  margin-left: 8px;
}

.menu-tree-node {
  margin: 2px 0;
}

.menu-tree-details > summary.menu-tree-summary {
  cursor: pointer;
  list-style: none;
}

.menu-tree-details > summary.menu-tree-summary::-webkit-details-marker {
  display: none;
}

.menu-tree-summary,
.menu-tree-leaf {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--radius);
  font-size: 14px;
}

a.menu-tree-leaf,
.menu-tree-leaf-text {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
}

.menu-tree-summary:hover,
a.menu-tree-leaf:hover {
  background: var(--surface-hover, var(--surface));
}

.menu-tree-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.menu-tree-label {
  font-weight: 500;
}

.param-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.param-meta-desc {
  color: var(--text);
}

.param-meta-pair {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.param-meta-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.06em;
}

.param-meta-value {
  color: var(--text);
}

.params-block {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  word-break: break-all;
}

/* --- Package Builder --- */
.builder-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .builder-layout {
    grid-template-columns: 1fr;
  }
}

.builder-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.builder-validate-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.builder-run-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.run-option-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.run-option-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.run-option-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.run-option-desc {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* --- Results --- */
.results-page { max-width: none; }

/* The strip takes no top margin of its own: whatever sits above it (the
   page header, a notice, an alert) already spaces it. A page whose rows fill
   the window is a flex column, and a flex column never collapses margins, so
   an 18px margin here added to the 12px under the notices on Compare's
   Results tab and collapsed into it on the Summary tab: the strip sat 12px
   lower on one than the other and jumped as the reader moved between them,
   28px lower on a check with no notices. */
.results-tabs {
  margin-top: 0;
}

.results-tabs .tab-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.results-tabs .tab-label:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.results-tabs .tab-label svg,
.results-export-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.results-tabs .tab-panel {
  display: none;
}

/* tab-panel-active is the rendered counterpart of tab-label-selected: the server
   marks the one panel to show, so nothing has to be restored by script after a
   swap.

   That is not a stylistic preference. htmx's settle pass snapshots the
   attributes of every id-matched element across a swap and reverts them when it
   settles, so an inline style written from an htmx:afterSwap handler lives for
   about 20ms and is then removed. compare-check.js used to reveal the Results
   panel exactly that way, and because no ":checked ~ panel" rule can reach the
   per-group panels (see the note further down on why), the revert left every
   panel hidden: the grid appeared for a frame and then the page went blank with
   the tab still selected.

   That pass is switched off site-wide now - layout.html's htmx-config sets
   defaultSettleDelay to 0, because the same revert was also stripping the
   checked attribute off the radios below and blanking the validation results
   page on any filter link that opened another tab. This class stays regardless:
   it is what lets the per-group Results panels be revealed by the server at all,
   and it does not depend on the settle delay either way. */
.results-tabs .tab-panel.tab-panel-active {
  display: block;
}

#results-tab-overall:checked ~ .tool-tabs-header .tab-bar label[for="results-tab-overall"],
#results-tab-entity:checked  ~ .tool-tabs-header .tab-bar label[for="results-tab-entity"],
#results-tab-targets:checked ~ .tool-tabs-header .tab-bar label[for="results-tab-targets"],
#results-tab-checks:checked  ~ .tool-tabs-header .tab-bar label[for="results-tab-checks"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* The validation results strip picks its panel from the radio the server
   rendered checked, with no script involved - which only holds because the
   settle pass described above is off (defaultSettleDelay 0 in layout.html). With
   it on, a swap rewrote the checked ATTRIBUTE without syncing the checkedness
   behind it, so the served markup was right and the group ended up with nothing
   checked: every panel below stayed display:none and the page looked blank until
   the reader reloaded. */
#results-tab-overall:checked ~ #results-panel-overall,
#results-tab-entity:checked  ~ #results-panel-entity,
#results-tab-targets:checked ~ #results-panel-targets,
#results-tab-checks:checked  ~ #results-panel-checks {
  display: block;
}

/* A check's way between checks - previous, the run's summary, next - is a
   small group of square buttons at the top right of the tab row. The tab bar
   takes what is left of the row and wraps its own tabs, so a strip of a tab per
   control group never pushes the group onto a line of its own: three full
   buttons did, a row under the tabs that the rows below paid for. */
.compare-check-tabs .tool-tabs-header {
  flex-wrap: nowrap;
  align-items: flex-start;
  margin-bottom: 10px;
}

/* The tiles open every panel they are on, captioned and close under the tabs,
   and the rows follow close under them: the bar's own top margin was for a
   heading above it that is no longer there, and the section's 28px under it
   was a band of nothing between the tiles and the rows they choose. The bar
   is under no margin of its own on any tab, so it starts at one place on the
   Summary tab, which is a block, and on a Results tab, which is a flex column
   whose first child's margin does not collapse into the strip's. */
.sum-section.compare-check-tiles {
  margin-bottom: 12px;
}

.compare-check-tiles > .compare-tile-bar {
  margin-top: 0;
}

.compare-check-tabs .tool-tabs-header .tab-bar {
  flex: 1;
  min-width: 0;
}

.compare-check-nav {
  flex: none;
  align-items: center;
  gap: 4px;
}

.compare-check-nav-icon {
  width: 18px;
  height: 18px;
}

/* Compare Check's strip: Summary, Fields, Group Summary, then one Results tab per
   control group. Two of these selectors named ids the template does not declare -
   "compare-check-tab-field" and "-data" against the markup's "-fields" and
   "-group-summary" - so those two tabs got no selected look at all: clicking Fields
   switched the panel (compare-check.js does that with an inline style) and left the
   tab button looking unselected. A stale id in a selector list fails silently, which
   is why TestNoCheckedRuleNamesAMissingRadio now checks every "#id:checked" in this
   file against the ids the templates actually declare.

   The per-group Results tabs cannot join this list. Their count is the number of
   control groups, so there is no fixed set of ids to enumerate, and the
   attribute-prefix form that covers the metadata explorers cannot stand in:
   "[id^=...]:checked ~ ... label[for^=...]" cannot correlate a radio with its OWN
   label, so one checked Results tab would light up all of them. They carry
   tab-label-selected instead - see below - which the server renders on the one tab
   it rendered checked. */
#compare-check-tab-summary:checked ~ .tool-tabs-header .tab-bar label[for="compare-check-tab-summary"],
#compare-check-tab-fields:checked ~ .tool-tabs-header .tab-bar label[for="compare-check-tab-fields"],
#compare-check-tab-group-summary:checked ~ .tool-tabs-header .tab-bar label[for="compare-check-tab-group-summary"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* tab-label-selected marks the tab the SERVER rendered as the current one, for a
   strip whose tabs are generated rather than fixed - see the note above on why no
   ":checked ~ label" rule can reach the compare check page's per-group Results
   tabs. Same look as a :checked .tab-label, because it answers the same question:
   this is the one you are on. Specific enough to outrank the base :hover, so the
   selected tab does not lose its look under the pointer.

   Without it a run drilled into a group's rows showed no selected tab anywhere on
   the strip: the three fixed radios are all unchecked in that state, so their rules
   do not fire either, and the reader had nothing saying which tab they were on. */
.tool-tabs-header .tab-bar .tab-label.tab-label-selected,
.tool-tabs-header .tab-bar .tab-label.tab-label-selected:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* The panel reveals below only decide the first paint: compare-check.js switches
   panels with an inline style, which outranks any rule here. They matter for the tab
   the server rendered checked, before that script runs. */
#compare-check-tab-summary:checked ~ #compare-check-panel-summary,
#compare-check-tab-fields:checked ~ #compare-check-panel-fields,
#compare-check-tab-group-summary:checked ~ #compare-check-panel-group-summary {
  display: block;
}

.data-table.compare-results-table th,
.data-table.compare-results-table td {
  white-space: nowrap;
}

/* A field whose whole value is the point - a breadcrumb path - opts out of the
   300px per-cell cap .data-table.is-dense td applies. The cap is right for the general
   case (these tables run to dozens of columns), but clipping a path throws away the
   tail that distinguishes one row from the next: "... > Ledger > General" and
   "... > Ledger > Number sequences" clip to identical text, so the column reads as
   though every row held the same value. The table already scrolls horizontally on
   width: max-content, so a wider column costs scroll distance, not visibility.
   Which columns get this is decided in compareCheckWideField. */
.data-table.compare-results-table td.compare-wide-cell {
  max-width: none;
}

/* The narrow columns whose whole content is a pill or a symbol: centred over
   the heading rather than pushed against the column before them, and never
   wrapped, since a two-word status ("Only in target") on two lines sets the
   height of a row whose other cells are one line. */
.data-table.compare-results-table td.compare-status-cell {
  text-align: center;
}

/* The table is as wide as its columns and never narrower than the box it
   scrolls in. That box is the Row Detail's (.row-detail > .table-wrapper), and
   its own scrollbar is the only one: a copy of it used to be pinned to the foot
   of the window, fed by a script, and under a table of nine rows it sat half a
   screen below the last of them, reading as a bar that belonged to nothing. */
.data-table.compare-results-table,
.data-table.datacache-rows-table,
.data-table.explorer-browse-table {
  width: max-content;
  min-width: 100%;
}

/* The field a Fields tab count chose is brought forward to sit beside the
   row's own columns (compareFocusColumns) and marked, heading and cells, so it
   reads as the reason for the rows beneath it rather than as three more
   columns among dozens. A shadow rather than a background, because the golden
   value's cells carry a tint of their own that the mark must not replace. */
.data-table.compare-results-table th.is-focus-field .th-angle > span {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.data-table.compare-results-table td.is-focus-field {
  box-shadow: inset 0 0 0 100vmax var(--accent-dim);
}

.data-table.compare-results-table td {
  vertical-align: middle;
}

/* A compared field's three columns - its value, the golden value and whether
   they match - are one reading, so a light rule runs down either side of them
   and nowhere else: rules between every column of a table this wide read as a
   grid of boxes rather than as rows, and none at all left the eye to work out
   which three belong together from a heading tilted forty-five degrees. */
.data-table.compare-results-table .cmp-triplet-start {
  border-left: 1px solid var(--border);
}

.data-table.compare-results-table .cmp-triplet-end {
  border-right: 1px solid var(--border);
}

/* A form capture's property toggles sit before Hide matches, and wrap as a
   group rather than one by one. */
.compare-field-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.compare-results-table .compare-overall-hdr,
.compare-results-table .compare-overall-cell {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface-elevated);
  box-shadow: -8px 0 10px -10px rgba(0, 0, 0, 0.45);
}

.compare-results-table .compare-overall-cell .sev-badge {
  font-weight: 700;
}

.compare-results-table .compare-gold-row td {
  background: rgba(255, 192, 0, 0.16);
}

.compare-results-table .compare-gold-row:hover td {
  background: rgba(255, 192, 0, 0.22);
}

/* A dataset (two-sided) compare reports each field's golden-side value beside
   the target's. The gold tint is the same cue the golden ROW carries in an
   intra-environment compare, applied per cell because a two-sided row has no
   separate golden row to highlight. */
.compare-results-table .compare-gold-value-cell {
  background: rgba(255, 192, 0, 0.1);
}

.compare-results-table tr:hover .compare-gold-value-cell {
  background: rgba(255, 192, 0, 0.18);
}

.compare-results-table .compare-gold-value {
  color: #ffc000;
  font-weight: 600;
}

html[data-theme="light"] .compare-results-table .compare-gold-value {
  color: #a67500;
}

.compare-results-table .th-angle span {
  display: inline-block;
}

#results-tab-overall:checked ~ .tool-tabs-header .results-export-btn,
#results-tab-entity:checked  ~ .tool-tabs-header .results-export-btn,
#results-tab-targets:checked ~ .tool-tabs-header .results-export-btn,
#results-tab-checks:checked  ~ .tool-tabs-header .results-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.results-export-btn {
  white-space: nowrap;
}

/* ── Severity filters on the results pages ──
   One set of rules for two pages: the target-detail Data tab, where the five
   tiles pick a row severity, and the run summary, where they narrow the Entity
   Summary, Targets and Checks tables. They started out page-scoped in
   validate/results.html, which is exactly why the run summary had no filters -
   a <style> block inside one template cannot reach a page that renders a
   different one. */
.sev-filter-tile {
  position: relative;
}

/* The whole tile is the target, not the word inside it, so the link is stretched
   over the tile and its own text hidden - the tile already says Total/OK/Warning
   in the copy beneath. Kept as real link text rather than an aria-label so that
   a screen reader and the browser status bar both name the destination. */
.sev-filter-tile-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  color: transparent;
  overflow: hidden;
}

.sev-filter-tile-link:hover {
  color: transparent;
}

.sev-filter-tile-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sev-filter-bar .sev-filter-tile {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sev-filter-bar .sev-filter-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.sev-filter-bar .sev-filter-tile-active {
  box-shadow: 0 0 0 2px var(--accent) inset;
}

/* A count in a table cell that filters or drills through. It inherits its colour
   from the severity class on the cell, so the number keeps reading as a number
   rather than turning link-blue and losing the severity it is counting. */
.sev-filter-link {
  color: inherit;
  text-decoration: none;
}

.sev-filter-link:hover {
  text-decoration: underline;
}

/* The chips state which filters the table below is under. They are the only way
   out of an entity selection: the tiles clear a severity, but the tab strip is
   CSS radios that never re-request the page, so nothing else on screen can widen
   the entity back out. */
.sev-filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 12.5px;
}

.sev-filter-chips-label {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.sev-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-transform: capitalize;
}

.sev-filter-chip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.sev-filter-chip-clear {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.sev-filter-chip-clear:hover {
  color: var(--text);
}

.sev-filter-chips-reset {
  color: var(--accent);
  text-decoration: none;
}

.sev-filter-chips-reset:hover {
  text-decoration: underline;
}

/* ── Summary sections ── */
.sum-section {
  margin-bottom: 28px;
}

.sum-section-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

/* ── Run Stats chips ── */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.chip-val {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--accent);
}

.chip-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

/* ── View breadcrumb / prev-next ── */
.view-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
}

.breadcrumb-sep { color: var(--text-faint); }
.breadcrumb-pos { color: var(--text-muted); }

.nav-arrow {
  color: var(--text-muted);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: border-color 0.15s, color 0.15s;
}

.nav-arrow:hover { border-color: var(--accent); color: var(--accent); }

.view-detail-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.source-path {
  font-size: 12px;
  margin: 4px 0 0;
}

.results-overall {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.overall-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.overall-name {
  font-size: 18px;
  font-weight: 700;
}

.overall-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.overall-timing {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

.section-heading {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.views-summary-section {
  margin-bottom: 36px;
}

.views-detail-sections {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Views summary table specific */
.views-summary-table .num-col {
  text-align: right;
  white-space: nowrap;
  width: 70px;
}

.views-summary-table .desc-cell {
  color: var(--text-muted);
  font-size: 12px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.views-summary-table .view-link-cell {
  white-space: nowrap;
}

/* ── The filterable run-summary tables: Entity Summary, Targets, Checks ──
   These tables, and a target's own Check Summary, size their columns from
   what is in them, and keep every row on one line. They were fixed-layout,
   with a share of the row declared per column, and a share is a guess: the
   Entity Summary's technical name wrapped onto two lines beside a Module
   column of white space, because the two had been given the same room
   whatever they held. An automatic layout gives each column what its widest
   cell needs, so nothing wraps, and a table wider than the window scrolls in
   its .table-wrapper rather than squeezing a name onto a second line.

   They also carry the severity filters, which change which rows are shown
   with no page reload, and an automatic layout sized from the rows left
   visible would redraw at a different width on every press - the page
   flinching rather than a filter being applied. A filtered-out row is drawn
   with the hidden attribute (issue #164), so here it is collapsed rather than
   taken out of the layout: visibility: collapse takes the row's height away
   and keeps its say in the column widths, which therefore come from every row
   of the table whatever the filter shows.

   The Overall Row Summary keeps .table-fit deliberately. It is one row that
   never filters, and stretching eight counts across a wide window would put a
   hand span between a heading and the number under it. */
.data-table.results-sum-table {
  width: 100%;
}

.data-table.results-sum-table tr[hidden] {
  display: table-row;
  visibility: collapse;
}

.data-table.results-sum-table th,
.data-table.results-sum-table td {
  white-space: nowrap;
}

/* The counts come first: as narrow as their numbers and headings allow (the
   1% is what an automatic layout reads as "no wider than the content"), never
   narrower than the floor that makes them read as one block of figures down
   the right of the table, and right-aligned under their headings. The text
   columns share whatever is left. */
.data-table.results-sum-table .num-col {
  width: 1%;
  min-width: 64px;
  text-align: right;
}

/* Wide enough for the status pill ("problem" plus its symbol), not just for the
   STATUS header. */
.data-table.results-targets-table .status-col {
  width: 1%;
  min-width: 112px;
}

/* A check code badge stays on its line like every other name on the row: a
   code is read whole, and VAL.DECFMT.ACQUISITIONPRICEREPORTINGCURRENCY.MaxTwoDecimals
   broken over two lines reads as two codes. */
.data-table.results-sum-table .code-col .type-badge {
  white-space: nowrap;
}

/* The descriptions are the one thing on these rows long enough to want the
   row to itself - a target's description, and the rule a check holds a value
   to - so each takes whatever the other columns leave and is cut with an
   ellipsis there, its whole text in the cell's tooltip. width: 100% is what
   hands it the slack; max-width: 0 is what stops its text from asking for
   more, so it never pushes the counts off the edge; and the min-width keeps a
   few words of it in sight on a narrow window, where the wrapper scrolls. */
.data-table.results-targets-table td.desc-col,
.data-table.results-checks-table td.rule-col {
  width: 100%;
  max-width: 0;
  min-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table.results-targets-table td.desc-col {
  color: var(--text-muted);
  font-size: 12px;
}

.data-table.results-checks-table td.rule-col {
  color: var(--text-muted);
}

/* The Entity Summary's technical name opens the entity in Discover. Every code
   span is drawn in the accent colour whether it links anywhere or not, so a
   linked name carries the Data Entity Explorer's own icon after it, and the
   underline on hover. */
.results-discover-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.results-discover-link:hover code {
  text-decoration: underline;
}

.results-discover-icon {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--accent);
}

.view-nav-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.view-nav-link:hover { text-decoration: underline; }

.summary-row { cursor: pointer; }

/* Severity-tinted header and number cells for the views summary table */
.sev-ok-hdr   { color: var(--sev-ok-text); }
.sev-info-hdr { color: var(--sev-info-text); }
.sev-warn-hdr { color: var(--sev-warn-text); }
.sev-prob-hdr { color: var(--sev-prob-text); }

.sev-ok-num   { color: var(--sev-ok-text); }
.sev-info-num { color: var(--sev-info-text); }
.sev-warn-num { color: var(--sev-warn-text); }
.sev-prob-num { color: var(--sev-prob-text); }

/* Status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

/* A pill sits on the middle of the line, never its baseline. A pill's
   baseline is its first item's, which for a pill led by a glyph (a status
   mark's, "Needs setting up"; a run's "Corrected") is the bottom of the
   glyph, so on the baseline such a pill sat several pixels higher than a
   plain one beside it ("Active"), on the Workflows list and everywhere else
   the two meet. */
.status-pill { vertical-align: middle; }

/* A pill that says a sentence ("Not in the environment", "Taken from the
   process") rather than one word keeps its own case: capitalising every word
   of a sentence reads as a title. */
.status-pill-sentence { text-transform: none; }

/* The glyph a pill carries in front of its word, where it has one: the tick
   of a run somebody put right (automateRunStatus). */
.status-pill-icon {
  width: 13px;
  height: 13px;
  flex: none;
}

.status-ok      { background: var(--sev-ok-bg);   color: var(--sev-ok-text);   }
.status-info    { background: var(--sev-info-bg);  color: var(--sev-info-text);  }
.status-warning { background: var(--sev-warn-bg);  color: var(--sev-warn-text);  }
.status-problem { background: var(--sev-prob-bg);  color: var(--sev-prob-text);  }
.status-neutral { background: var(--surface-elevated); color: var(--text-muted); }

/* Sits beside a runbook execution's status pill when the stored status says the run
   is live but its process has gone. See RunbookExecutionListItem.Stale. */
.runbook-stale-note {
  margin-left: 6px;
  font-size: 11px;
  font-style: italic;
  white-space: nowrap;
}

.summary-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.summary-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon value"
    "icon label";
  align-items: center;
  gap: 2px 12px;
  min-width: 132px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.summary-stat-metric {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 120px;
  flex: 0 1 200px;
  max-width: 200px;
  min-height: 60px;
  padding: 12px 14px;
  text-align: center;
}

.summary-stat-metric .summary-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  background: transparent;
  border-radius: 0;
  color: var(--text-muted);
}

.summary-stat-metric .summary-icon svg {
  width: 36px;
  height: 36px;
}

.summary-stat-metric .summary-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 2px;
}

.summary-stat-metric .summary-copy .stat-value,
.summary-stat-metric .summary-copy .summary-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.summary-stat-metric .summary-copy .stat-label,
.summary-stat-metric .summary-copy .summary-label {
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-align: center;
}

.summary-stat-metric-no-icon .summary-copy .stat-value,
.summary-stat-metric-no-icon .summary-copy .summary-value {
  color: var(--accent);
}

.summary-stat-metric-no-icon .summary-copy .stat-label,
.summary-stat-metric-no-icon .summary-copy .summary-label {
  color: var(--text-muted);
}

.summary-stat-metric-no-icon {
  flex-basis: 170px;
  max-width: 170px;
}

.summary-icon {
  grid-area: icon;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
}

.summary-icon svg {
  width: 34px;
  height: 34px;
}

.summary-glyph {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", "DejaVu Sans", sans-serif;
  font-size: 34px;
  line-height: 1;
  font-weight: 400;
}

.summary-stat-total .summary-icon {
  color: var(--accent);
}

.summary-stat.sev-ok   { background: var(--sev-ok-bg);   border-color: rgba(100,200,80,0.2);  }
.summary-stat.sev-info { background: var(--sev-info-bg);  border-color: rgba(80,150,220,0.2);  }
.summary-stat.sev-warning { background: var(--sev-warn-bg); border-color: rgba(240,180,0,0.2); }
.summary-stat.sev-problem { background: var(--sev-prob-bg); border-color: rgba(220,70,70,0.25); }

.stat-value {
  grid-area: value;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.summary-stat.sev-ok   .summary-icon { color: var(--sev-ok-text);   }
.summary-stat.sev-info .summary-icon { color: var(--sev-info-text);  }
.summary-stat.sev-warning .summary-icon { color: var(--sev-warn-text); }
.summary-stat.sev-problem .summary-icon { color: var(--sev-prob-text); }

.summary-stat.sev-ok   .stat-value { color: var(--sev-ok-text);   }
.summary-stat.sev-info .stat-value { color: var(--sev-info-text);  }
.summary-stat.sev-warning .stat-value { color: var(--sev-warn-text); }
.summary-stat.sev-problem .stat-value { color: var(--sev-prob-text); }

.compare-check-panel .compare-summary-bar .compare-summary-filter-active {
  box-shadow: 0 0 0 2px var(--accent) inset;
}

/* The bar sits under a heading row on the results page and on a check's
   Results tab alike; results.html carried this, and the check's tab drew
   without it. */
.compare-summary-bar { margin-top: 12px; }

/* A compare summary bar is two groups of tiles - the row statuses and the
   overall results - which choose independently, so each group is captioned,
   and the caption says what the other group has narrowed its counts to. */
.compare-summary-bar.compare-tile-bar {
  gap: 12px 28px;
  /* The section it sits in already spaces it from what follows; the bar's own
     margin on top of that set the rows a band of nothing further down. */
  margin-bottom: 0;
}

.compare-tile-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.compare-tile-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.compare-tile-group-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* A tile is as wide as what it holds. They were a fixed 200px each, a width
   chosen for counts of hundreds of thousands of rows, so the eight of them
   filled a wide screen and wrapped onto a second line well before a phone's;
   a long count still widens its own tile, since nothing here caps it, and
   the floor keeps a row of short ones even. */
.compare-summary-bar .summary-stat-metric {
  flex: 0 0 auto;
  min-width: 104px;
  max-width: none;
  min-height: 50px;
  gap: 8px;
  padding: 7px 12px;
}

.compare-summary-bar .summary-stat-metric .summary-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
}

.compare-summary-bar .summary-stat-metric .summary-icon svg {
  width: 24px;
  height: 24px;
}

/* Validate's tile row is five tiles wide and takes the row's width. The run
   page draws the same bar (partials.html), so the sizing is shared rather than
   the results page's own, where it sat and left the run page's tiles narrower. */
.validation-summary-bar .summary-stat-metric {
  min-width: 150px;
  flex: 1 1 150px;
}

.validation-summary-bar .summary-stat-metric .summary-icon svg {
  width: 30px;
  height: 30px;
}

.compare-filter-button {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-decoration: none;
}

.compare-filter-button:hover {
  text-decoration: underline;
}

.stat-label {
  grid-area: label;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
}

.results-meta {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
}

.view-section {
  margin-bottom: 0;
  padding: 28px 0 32px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 16px;
}

.view-section-header {
  margin-bottom: 14px;
}

.view-section-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.view-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.view-desc {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.back-to-summary {
  display: inline-block;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
  transition: color 0.15s;
}

.back-to-summary:hover { color: var(--accent); }

.view-results {
  margin-bottom: 16px;
}

.table-fit {
  overflow-x: auto;
  display: inline-block;   /* shrink-wrap to content */
  max-width: 100%;         /* but never overflow the page */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  vertical-align: top;
}

/* =====================================================
   Angled (45°) column headers - Row Detail table only
   Adapted from the classic CodePen technique: each header
   label is wrapped in a .th-angle div that is rotated -45°
   so long check/column names stay readable without forcing
   very wide columns. Scoped to .data-table-angled so the
   summary tables keep their normal horizontal headers.
   ===================================================== */
.data-table-angled {
  border-collapse: collapse;
}

.data-table.data-table-angled thead th {
  height: var(--th-angle-h, 140px);
  padding: 0 0 4px 0;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: bottom;
  position: static; /* override the sticky default; transform + sticky conflict */
}

.data-table.data-table-angled thead th .th-angle {
  width: 28px;
  transform: translate(18px, 0) rotate(-45deg);
  transform-origin: bottom left;
  white-space: nowrap;
  overflow: visible;
}

/* The band is sized for most of the names rather than the longest
   (angledHeaderHeight), so a label longer than the band can hold is cut with
   an ellipsis where the band ends, and its heading's title carries it whole.
   The max-width is the band's sum turned round: a label rises (its width +
   its 14px line) x sin 45 from 8px above the heading's foot, so the widest
   that fits is (height - 8px) / sin 45 - 14px. */
.data-table.data-table-angled thead th .th-angle > span {
  display: inline-block;
  max-width: calc((var(--th-angle-h, 140px) - 8px) * 1.4142 - 14px);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  padding: 0 6px;
  font-size: 11px;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

/* Give the first header a little left breathing room so its
   rotated label does not clip against the table edge. */
.data-table.data-table-angled thead th:first-child .th-angle {
  transform: translate(24px, 0) rotate(-45deg);
}

/* The last angled heading has nothing after it to lean over: its label starts
   18px into the cell and rises at 45 degrees, so it reaches as far right as
   the band is tall, and a last column only as wide as its values left the
   label hanging past the table's edge, over nothing. The column is widened by
   the band's height, the most a label the band holds can reach (its own sum
   above), so the heading always sits over the table that owns it. */
.data-table.data-table-angled.row-detail-table thead th:last-child:not(.th-plain) {
  padding-right: calc(var(--th-angle-h, 140px) - 12px);
}

/* Summary columns (Status, Info, Warning, Problem) keep a normal
   horizontal header, sitting at the bottom of the tall header band. */
.data-table.data-table-angled thead th.th-plain {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 0 8px 8px;
  vertical-align: bottom;
}

/* Row severity tints */
.row-ok      { background: transparent; }
.row-neutral { background: transparent; }
.row-info    { background: rgba(80, 150, 220, 0.05); }
.row-warning { background: rgba(240, 180, 0, 0.06);  }
.row-problem { background: rgba(220, 70,  70, 0.08); }

/* Check column cells */
.check-cell {
  text-align: center;
  width: 44px;
  min-width: 44px;
  padding: 7px 4px;
}

.sev-badge {
  font-size: 14px;
  line-height: 1;
}

.sev-ok      { color: var(--sev-ok-text);   }
.sev-info    { color: var(--sev-info-text);  }
.sev-warning { color: var(--sev-warn-text);  }
.sev-problem { color: var(--sev-prob-text);  }
.sev-neutral { color: var(--sev-neut-text);  }

/* Settings > Utilisation's failed-call count was written .sev-problem-text
   against a family spelled .sev-problem, so the one number on that page meant
   to be read as a problem was drawn like every other number. Kept as a second
   spelling rather than renamed, because a handler test pins the name. */
.sev-problem-text { color: var(--sev-prob-text); }

/* A target's source issues (validate_source_issues.go): a line per severity,
   worst first, each in its severity's own colours. They were one amber box
   with a bullet per issue, and a DMF preflight raising a dozen of them opened
   the Summary tab on a wall of amber text with a problem and a note drawn
   alike. A banner is one line whatever its message, cut with an ellipsis, and
   the button at its right opens the lot in a modal. */
.source-issues {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.source-issue-banner {
  /* The room the button takes at the right of the line: it is drawn over
     the banner rather than in it (see .source-issue-more), so the line has
     to leave it free, and the same room on every banner ends each message at
     one x however long its button's words are. */
  --source-issue-room: 84px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px calc(12px + var(--source-issue-room)) 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}
.source-issue-banner.is-problem {
  background: var(--sev-prob-bg);
  border-color: var(--sev-prob-border);
  color: var(--sev-prob-text);
}
.source-issue-banner.is-warning {
  background: var(--sev-warn-bg);
  border-color: var(--sev-warn-border);
  color: var(--sev-warn-text);
}
.source-issue-banner.is-info {
  background: var(--sev-info-bg);
  border-color: var(--sev-info-border);
  color: var(--sev-info-text);
}
.source-issue-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.source-issue-count {
  flex-shrink: 0;
  white-space: nowrap;
  font-weight: 600;
}
/* The line is a scroll-state container so the stylesheet can tell whether its
   message was cut: Show, the button a single issue gets, is offered only where
   it was, since a message read whole has nothing more to show. A browser that
   cannot answer the query keeps the button, which is the safe way round. */
.source-issue-line {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  container-type: scroll-state;
}
.source-issue-first { color: var(--text); }
/* Positioned against the banner, outside the line that clips its message, so
   the ellipsis is the message's and never the button's, while staying inside
   the container whose scroll state decides whether Show is drawn. */
.source-issue-more {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}
@container not scroll-state(scrollable: inline-end) {
  .source-issue-more.is-show { display: none; }
}

/* The modal a banner opens: every issue of its severity, whole, a line each.
   The body carries its own ceiling, since a dialog clamped by max-height does
   not re-run the flex layout that would hold an auto-height body inside it. */
dialog.modal.source-issues-modal {
  width: min(760px, calc(100vw - 48px));
}
.source-issues-body {
  max-height: calc(100vh - 180px);
}
.source-issue-list {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-2);
}
.source-issue-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  line-height: 1.5;
}
.source-issue-item + .source-issue-item { border-top: 1px solid var(--border); }
.source-issue-item .source-issue-icon { margin-top: 2px; }
.source-issue-list.is-problem .source-issue-icon { color: var(--sev-prob-text); }
.source-issue-list.is-warning .source-issue-icon { color: var(--sev-warn-text); }
.source-issue-list.is-info .source-issue-icon { color: var(--sev-info-text); }
.source-issue-message {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* =====================================================
   Row Detail - a results page's row table: Validate's Row Detail, and the
   rows of a Compare check's Results tab, which is the same frame
   ===================================================== */

/* The heading and the filter chips share a line, so saying what the rows are
   narrowed by costs no height of its own. */
.row-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-bottom: 4px;
}

.row-detail-head .sum-section-title,
.row-detail-head .sev-filter-chips {
  margin: 0;
}

/* In full screen the page's own header is under the table, so the section
   names what it is of beside its heading. Drawn only then. */
.row-detail-subject {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* A chip naming a check keeps its words as written: the shared chip capitalises
   a severity, which would turn "MaxLen on NAME" into "MaxLen On NAME". */
.sev-filter-chip.sev-filter-chip-check {
  text-transform: none;
}

/* The switches sit with the pager at the right of the count line, rather than
   on a line of their own above a table that wants every row of the window. */
.row-detail-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 14px;
}

.row-detail-full-btn {
  padding: 4px 7px;
}

.row-detail-full-icon {
  width: 16px;
  height: 16px;
}

/* Excel and Copy (the table-tools partial): a pair, a little closer to each
   other than to the full-screen switch beside them, each the switch's size. A
   pager-btn on a <button> as well as an <a>, so the button takes the anchor's
   font rather than the browser's. */
.table-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.table-tool-btn {
  padding: 4px 7px;
  font-family: inherit;
}

.table-tool-icon {
  width: 16px;
  height: 16px;
}

/* Copy says it worked by swapping its icon for a tick for a moment
   (copy-sql.js sets is-copied), in the colour every passed check is drawn
   in, and that it did not in the problem colour. */
.table-tool-done {
  display: none;
}

.table-tool-btn.is-copied .table-tool-copy {
  display: none;
}

.table-tool-btn.is-copied .table-tool-done {
  display: inline;
}

.table-tool-btn.is-copied {
  color: var(--sev-ok-text);
  border-color: var(--sev-ok-text);
}

.table-tool-btn.is-copy-failed {
  color: var(--sev-prob-text);
  border-color: var(--sev-prob-text);
}

/* Where an Excel button's refusal is said, under its toolbar. Empty, it is
   nothing at all, so a flex column the toolbar sits in spends no gap on it. */
.table-export-slot:empty {
  display: none;
}

.table-export-slot > .alert {
  margin: 0 0 10px;
}

/* The rows per page on a Discover list's toolbar: a word and a select at the
   pager's height, beside it. */
.explorer-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.explorer-size-label {
  font-size: 12px;
  color: var(--text-muted);
}

.explorer-size .explorer-size-select {
  width: auto;
  padding: 3px 6px;
  font-size: 12px;
  line-height: 1.2;
}

/* A switch is a checkbox dressed as one: the real input is stretched over the
   track, transparent, so a click anywhere on it is a click on the input and the
   keyboard and a screen reader meet an ordinary checkbox. */
.toggle-switch-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--border-hover);
  transition: background 0.15s;
}

.toggle-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s;
}

.toggle-switch input:checked + .toggle-switch-track {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-switch-track::after {
  transform: translateX(14px);
}

.toggle-switch input:focus-visible + .toggle-switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The heading stays in sight as the rows scroll. The page scrolls in
   .main-content, and a table this wide scrolls sideways in its own wrapper, so
   a sticky heading has no page-length box to stick to - it sticks to the top
   of the nearest scroll box, which was the wrapper, which never scrolled
   downwards. So the wrapper is given a height of its own, sized to the window
   less the line above it, and scrolls both ways.

   The thead sticks rather than each th. A sticky cell is a stacking context of
   its own, so each heading would paint over the rotated label of the one before
   it - which is why the angled headings were left static - where one sticky
   thead is a single context in which the labels still paint over every cell's
   background, as they do unstuck. The rule under the heading is drawn as a
   shadow because a collapsed border belongs to the table, not to the cell, and
   stays behind when the cell moves. */
.row-detail > .table-wrapper {
  max-height: max(320px, calc(100vh - 180px));
  overflow: auto;
}

.data-table.row-detail-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table.row-detail-table thead th {
  box-shadow: inset 0 -1px 0 var(--border);
}

/* Beside its column, each check group is ruled off from the next, so the eye
   can follow which checks belong to which value down a long table. */
.data-table.row-detail-table.is-together td.col-group-start {
  border-left: 1px solid var(--border);
}

/* Each cell says its own result (rowDetailColumn.CellClasses): a check its
   own, a source column the worst of the checks on it, the status and flags
   the row's. The row used to be tinted by its worst result from end to end,
   so a row whose only fault was one date in the wrong format was drawn amber
   across every column and a screen of rows that were nearly all fine read as
   a screen of warnings. Passing is a faint hue; the few cells that did not
   pass are the colour. */
.data-table.row-detail-table td.cell-ok      { background: var(--cell-ok-bg); }
.data-table.row-detail-table td.cell-info    { background: var(--cell-info-bg); }
.data-table.row-detail-table td.cell-warning { background: var(--cell-warn-bg); }
.data-table.row-detail-table td.cell-problem { background: var(--cell-prob-bg); }

/* The row's own result is its first cell, a bar of its colour, in the place a
   spreadsheet keeps its row headers. It stays at the left edge as the table
   scrolls sideways, so the row's result is in sight when its status column is
   not - which, in the workbook's layout, is always. */
.data-table.row-detail-table th.row-marker-head,
.data-table.row-detail-table td.row-marker {
  position: sticky;
  left: 0;
  width: 8px;
  min-width: 8px;
  max-width: 8px;
  padding: 0;
}

.data-table.row-detail-table td.row-marker { z-index: 1; }
.data-table.row-detail-table th.row-marker-head { z-index: 3; }

.data-table.row-detail-table td.row-marker-ok      { background: var(--sev-ok-text); }
.data-table.row-detail-table td.row-marker-info    { background: var(--sev-info-text); }
.data-table.row-detail-table td.row-marker-warning { background: var(--sev-warn-text); }
.data-table.row-detail-table td.row-marker-problem { background: var(--sev-prob-text); }
.data-table.row-detail-table td.row-marker-neutral { background: var(--border); }

/* Full screen: the section is drawn over the whole window, the app's own
   chrome included, and the table takes every line the count and the switches
   leave - up to its own height and no further, so a short table's scrollbar
   sits under its last row rather than at the foot of the screen. Under the
   shared loading overlay, which must stay in front of it. */
.row-detail.is-full {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 14px 20px 16px;
  background: var(--bg);
}

.row-detail.is-full .explorer-toolbar {
  margin: 8px 0;
}

.row-detail.is-full > .table-wrapper {
  flex: 0 1 auto;
  min-height: 0;
  max-height: none;
  overscroll-behavior: contain;
}

/* The second pager, under the rows, at the right where the first one is. */
.row-detail-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* The pager is already on the count line, which in full screen is always in
   sight, so the one under the table would only take a line from it. */
.row-detail.is-full .row-detail-foot {
  display: none;
}

/* On a wide screen a results page whose shown panel holds the row table fills
   the window rather than flowing down it - the Automate run page's shape. The
   page is a flex column with a definite height (.main-content has one, from
   .main-wrapper's 100vh), and every box from it down to the table's scroll box
   is a flex column with min-height: 0, so the scroll box takes what the header,
   the tabs and the tiles leave and no more.

   That is what puts the table's sideways scrollbar at the foot of the window.
   Sized to the whole window instead, the box ran past the fold, the rows
   scrolled inside it while the page stayed where it was, and the scrollbar was
   out of sight until the page itself was scrolled - which nothing on the screen
   suggested. The tiles and the count stay in view above the rows, which is
   where a reader choosing filters wants them.

   A short table keeps its own height (flex: 0 1 auto), so its scrollbar sits
   under its last row rather than at the foot of an empty box. The floor is on
   the section rather than the box for the same reason - on the box it held a
   four-row table's scrollbar forty pixels under its last row - and it is what
   a reader can still use: a window too short for it scrolls as before. The
   pager under the table goes, because the one on the count line is always in
   sight. Below 961px the page flows again, as the run page does, and the box
   keeps the window-sized ceiling above.

   Each shape is named by the radio or class that shows its panel, because a
   panel the strip hides must not be the one that decides the page's shape:
   Compare's Results panels (.tab-panel-active), a target's Data tab, and a
   one-target run's Targets tab, which carries that target's rows. An
   environment's cached item (.datacache-rows-page) and an entity's rows
   browsed over OData (.explorer-browse-page) have no tabs, so their frame
   sits straight under the page. */
@media (min-width: 961px) {
  .results-page:has(> .compare-check-tabs > .compare-check-panel.tab-panel-active > .row-detail),
  .results-page:has(> .results-tabs > #view-detail-tab-data:checked ~ #view-detail-panel-data > .view-results > .row-detail),
  .results-page:has(> .results-tabs > #results-tab-targets:checked ~ #results-panel-targets > .view-results > .row-detail),
  .datacache-rows-page:has(> .row-detail),
  .explorer-browse-page:has(> .row-detail) {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: 12px;
  }

  .results-page > .compare-check-tabs:has(> .compare-check-panel.tab-panel-active > .row-detail),
  .results-page > .results-tabs:has(> #view-detail-tab-data:checked ~ #view-detail-panel-data > .view-results > .row-detail),
  .results-page > .results-tabs:has(> #results-tab-targets:checked ~ #results-panel-targets > .view-results > .row-detail),
  .compare-check-tabs > .compare-check-panel.tab-panel-active:has(> .row-detail),
  #view-detail-tab-data:checked ~ #view-detail-panel-data:has(> .view-results > .row-detail),
  #results-tab-targets:checked ~ #results-panel-targets:has(> .view-results > .row-detail),
  #view-detail-panel-data > .view-results:has(> .row-detail),
  #results-panel-targets > .view-results:has(> .row-detail) {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
  }

  .compare-check-panel.tab-panel-active > .row-detail:not(.is-full),
  #view-detail-panel-data > .view-results > .row-detail:not(.is-full),
  #results-panel-targets > .view-results > .row-detail:not(.is-full),
  .datacache-rows-page > .row-detail:not(.is-full),
  .explorer-browse-page > .row-detail:not(.is-full) {
    flex: 1 1 auto;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
  }

  .compare-check-panel.tab-panel-active > .row-detail:not(.is-full) > .table-wrapper,
  #view-detail-panel-data > .view-results > .row-detail:not(.is-full) > .table-wrapper,
  #results-panel-targets > .view-results > .row-detail:not(.is-full) > .table-wrapper,
  .datacache-rows-page > .row-detail:not(.is-full) > .table-wrapper,
  .explorer-browse-page > .row-detail:not(.is-full) > .table-wrapper {
    flex: 0 1 auto;
    min-height: 0;
    max-height: none;
  }

  .compare-check-panel.tab-panel-active > .row-detail:not(.is-full) > .row-detail-foot,
  #view-detail-panel-data > .view-results > .row-detail:not(.is-full) > .row-detail-foot,
  #results-panel-targets > .view-results > .row-detail:not(.is-full) > .row-detail-foot,
  .datacache-rows-page > .row-detail:not(.is-full) > .row-detail-foot,
  .explorer-browse-page > .row-detail:not(.is-full) > .row-detail-foot {
    display: none;
  }
}

/* =====================================================
   Settings - Environments & Connections
   ===================================================== */

.env-card { max-width: 980px; }
.env-card + .env-card,
.settings-add-card { margin-top: 18px; }

/* .env-detail-card is now used exclusively by the Metadata Explorer detail
   pages (Data Entity, Table, Form) for their property-summary card. Match
   .page-content's 100% width so it's not narrower than the Fields/Indexes/
   Relations tables that follow it. */
.env-detail-card { max-width: 100%; margin-bottom: 4px; }

/* Its rows default to .detail-row's 14px vertical padding, which reads as
   oversized once the Fields/Indexes tables below it are this dense. Trim it
   down so the summary card doesn't dominate the screen. */
.env-detail-card .detail-row { padding-top: 9px; padding-bottom: 9px; }

/* A Discover page's properties are a grid of label and value pairs across
   the page's width, as many to a row as the width holds, rather than a column
   down its left with the right two thirds empty: the tables under them are
   long, and every row this card spends is a row of them pushed off the
   screen. Each pair keeps .detail-row's label beside its value; a pair whose
   value is a list that can run long (a form's data entities) takes a row of
   its own with detail-row-wide. The separators are each cell's bottom and
   right borders, the cell stretched a pixel past its track so they sit on
   the line between two cells, and the card's own edge, with overflow hidden,
   swallows the ones along its foot and its right. Drawn that way round, a
   last row with fewer cells than the rest still has the whole line above it
   and a rule after its last cell, where top and left borders left the line
   over the empty part of the row missing. */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
}

.detail-grid .detail-row {
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  margin: 0 -1px -1px 0;
  padding: 8px 16px;
}

.detail-grid .detail-row-wide { grid-column: 1 / -1; }

.detail-grid .detail-label { font-size: 11px; }

/* Comply Cost Analysis / Upload / Run Log - shared "comply_analysis_rows_table" partial. */
.cascade-step { white-space: nowrap; margin-bottom: 2px; }

.env-info-full {
  grid-column: 1 / -1;
}

.env-editor-grid {
  align-items: start;
}

@media (max-width: 1400px) {
  .env-editor-grid {
    grid-template-columns: 1fr;
  }
}

.env-editor-form {
  display: grid;
  gap: 12px;
}

.env-editor-form .form-row {
  gap: 8px;
  margin-bottom: 6px;
}

.form-field-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.form-field-row .form-label {
  margin-top: 8px;
}

.form-field-row .form-hint {
  grid-column: 2;
  margin-top: -6px;
}

/* The Baseline row's control is a single line of checkbox, not a 34px input, so
   the 8px label nudge above - tuned to optically centre a label against an input -
   lifted "Baseline" clear of the checkbox beside it. Centre the row instead, so the
   label, the checkbox caption and the hint all share one line. */
.form-field-row.baseline-row {
  align-items: center;
}

/* Both margins, not just the top one: align-items centres the label's *margin*
   box, so .form-label's 6px bottom margin left the text sitting 3px above the
   checkbox it is meant to line up with. */
.form-field-row.baseline-row .form-label {
  margin-top: 0;
  margin-bottom: 0;
}

/* Settings > Environment Info: a row per environment, what it runs side by
   side. The table takes the page's width and scrolls sideways in its own
   frame where the columns chosen are more than it holds; the environment
   column stays in sight as it does. */
.env-info-page .env-info-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.env-info-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
}

.env-info-progress-icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.env-info-progress-bar {
  flex: 0 1 220px;
  height: 8px;
  accent-color: var(--accent);
}

.env-info-tabs {
  margin: 0;
}

/* The grid's toolbar: the tabs, the models tab's filters and the count at
   the left, Excel, Copy and the full-screen switch at the right. The body's
   own gap spaces it, so it carries no margin of its own. */
.explorer-toolbar.env-info-toolbar {
  justify-content: flex-start;
  margin: 0;
}

.env-info-toolbar .row-detail-controls {
  margin-left: auto;
}

.env-info-count {
  white-space: nowrap;
}

/* A sorting heading carries its band's word above its label, so the link is
   a block of its own with the sort's arrow beside the label's end. */
.data-table.env-info-table .env-info-th-sort {
  display: inline-block;
}

/* In the Row Detail frame the table scrolls inside its box, so its heading
   stays in sight above the rows, over the environment column that stays in
   sight as the rows scroll sideways. */
.row-detail > .env-info-table-wrap .data-table.env-info-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.row-detail > .env-info-table-wrap .data-table.env-info-table thead th.env-info-env-col {
  z-index: 3;
}

.env-info-table-wrap {
  overflow-x: auto;
}

.data-table.env-info-table {
  width: 100%;
  font-size: 13px;
}

.data-table.env-info-table th {
  vertical-align: bottom;
  overflow-wrap: anywhere;
}

/* Laid out at the widths the colgroup names, never at what the cells hold,
   so a value Refresh all fills in, or a pill turning from Queued to Read,
   moves no column. A value too long for its column is cut with an ellipsis
   and is whole in its tooltip. The table's min-width (set from Go) is every
   column at its own width, so a narrow window scrolls the frame rather than
   squeezing them. */
.data-table.env-info-table.env-info-fixed {
  table-layout: fixed;
  width: 100%;
}

.env-info-w-env { width: 300px; }
.env-info-w-version { width: 150px; }
.env-info-w-date { width: 128px; }
.env-info-w-model { width: 150px; }
.env-info-w-action { width: 44px; }
.env-info-w-model-name { width: 260px; }
.env-info-w-publisher { width: 180px; }
.env-info-w-same { width: 160px; }

/* A model's name may be long (Application Suite Electronic Reporting
   Integration); it wraps within its column rather than widening it. */
.data-table.env-info-models-table .env-info-model-col {
  overflow-wrap: anywhere;
}

.data-table.env-info-table td.env-info-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The heading row above each type's environments. The row runs the
   table's width, so its words are pinned rather than the cell, or they
   scroll away with a wide table. */
.data-table.env-info-table .env-info-type-row th {
  background: var(--surface-elevated);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
}

.env-info-type-words {
  position: sticky;
  left: 12px;
}

.data-table.env-info-table .env-info-action-col {
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

/* The group a heading belongs to - Version, Metadata, Model - small above
   it, with a rule in the group's colour along the heading's top, so a wide
   table reads as three bands rather than a run of similar names. */
.env-info-group {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.env-info-group-version { box-shadow: inset 0 3px 0 var(--accent); }
.env-info-group-meta { box-shadow: inset 0 3px 0 var(--sev-info-text); }
.env-info-group-model { box-shadow: inset 0 3px 0 var(--sev-warn-text); }

.env-info-env-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: inset -1px 0 0 var(--border);
}

/* The environment's name, how its last read went and its own refresh, on
   one line in the column that stays put. */
.env-info-env-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.env-info-env-words {
  flex: 1 1 auto;
  min-width: 0;
}

.env-info-env-words .env-info-env-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.env-info-env-words .env-info-env-sub {
  flex-wrap: nowrap;
  overflow: hidden;
}

.env-info-state {
  flex: none;
}

.env-info-env-name {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.env-info-env-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.env-info-env-sub code {
  font-size: 11px;
  color: var(--text-muted);
}

.env-info-tag {
  font-size: 10.5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 7px;
  color: var(--text-muted);
}

.env-info-cell {
  white-space: nowrap;
}

.env-info-cell.is-differs {
  background: var(--sev-warn-bg);
}

.env-info-cell.is-differs code {
  color: var(--sev-warn-text);
  font-weight: 600;
}

.env-info-cell.is-stale {
  color: var(--sev-warn-text);
}

.env-info-cell.is-missing,
.env-info-none {
  color: var(--text-muted);
}

.data-table.env-info-table tr.is-reading td {
  background: var(--sev-info-bg);
}

/* A row whose own refresh is on its way (the button's htmx indicator is the
   row): its values fade, its state reads Reading..., and the button's icon
   turns, until the answer lands and the row is drawn again. */
.env-info-reading-now {
  display: none;
}

.data-table.env-info-table tr.htmx-request .env-info-reading-now {
  display: inline-flex;
}

.data-table.env-info-table tr.htmx-request .env-info-reading-now ~ * {
  display: none;
}

.data-table.env-info-table tr.htmx-request td.env-info-cell {
  opacity: 0.45;
}

.data-table.env-info-table tr.htmx-request td {
  background: var(--sev-info-bg);
}

/* The tints are translucent, and the environment column stays in place
   over the cells scrolled beneath it, so there the tint is laid over the
   surface: a translucent pinned cell let the version under it show
   through the environment's name. */
.data-table.env-info-table tr.htmx-request td.env-info-env-col,
.data-table.env-info-table tr.is-reading td.env-info-env-col {
  background: linear-gradient(var(--sev-info-bg), var(--sev-info-bg)), var(--surface);
}

.data-table.env-info-table tr.htmx-request .env-info-row-refresh-icon {
  animation: htmx-spin 0.9s linear infinite;
}

.btn.btn-icon-only.env-info-row-refresh {
  width: 24px;
  height: 24px;
}

.env-info-row-refresh-icon {
  width: 14px;
  height: 14px;
}

.env-info-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.env-info-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: -2px;
  border: 1px solid var(--sev-warn-text);
}

.env-info-swatch.is-differs {
  background: var(--sev-warn-bg);
}

.env-info-swatch.is-stale {
  background: transparent;
}

/* The Installed models tab's filters are Discover's legend chips
   (.explorer-attr-legend), sitting on the line above the table as the
   legend does there. */
.explorer-attr-legend.env-info-model-filters {
  margin: 0;
}

.env-info-publisher {
  color: var(--text-muted);
  white-space: nowrap;
}

/* The Columns dialog: the fixed and metadata columns on the left, the
   models - a search and a list that scrolls inside the body - on the right. */
.env-info-columns-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 24px;
}

@media (max-width: 760px) {
  .env-info-columns-grid { grid-template-columns: minmax(0, 1fr); }
}

.env-info-columns-heading {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.env-info-columns-grid > div > .env-info-columns-heading ~ .env-info-columns-heading {
  margin-top: 16px;
}

.env-info-columns .option-flag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.env-info-columns .option-flag:has(input:disabled) {
  color: var(--text-muted);
}

/* The body is the part every press answers; it holds the two columns and
   the count under them. */
.env-info-columns-body {
  min-height: 0;
}

.env-info-columns-microsoft {
  margin-top: 6px;
}

.env-info-columns-list {
  max-height: 46vh;
  overflow-y: auto;
  margin-top: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.env-info-columns-name {
  min-width: 0;
}

.env-info-isv {
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 8px;
  padding: 0 6px;
  background: var(--sev-warn-bg);
  color: var(--sev-warn-text);
}

.env-info-columns-version {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-muted);
}

.env-info-columns-count {
  margin: 10px 0 0;
}

/* The record card's Version Information section: the three versions the
   environment says it runs in a row of three, and a square refresh button the
   inputs' height at the row's right end, so it reads as acting on the row. The
   fields keep the form's 160px label column, so Application version lines up
   with Name above it. */
/* The record card's sections after Environment Information: Version
   Information, Browser Extension and Other Information, each headed like the
   card's own title. */
.env-section {
  margin: 12px 0 4px;
}

.env-section .tool-column-title {
  margin-bottom: 10px;
}

/* Each field keeps to the top of the row, as a lone input does, so the
   labels of the three read on one line however tall the tags grow; the
   Baseline tick is centred in an input's height beside them. */
.form-row.env-section-row {
  align-items: start;
}

.env-section-row .form-field-row.baseline-row {
  min-height: 34px;
}

/* Browser Extension: the banner's three parts take the three columns of
   Other Information below it - its label, its tick and words in the first,
   the coloured strip in the second, the colours in the third. Six tracks of
   160px label and input with the form's 8px gap are exactly a .form-row.cols-3
   of .form-field-rows, so each part starts where a field below it does. The
   partial's wrapper steps aside (display: contents) so its parts are placed on
   this grid. */
.env-banner-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 160px minmax(0, 1fr) 160px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
}

.env-banner-grid > .ext-banner-fields { display: contents; }
.env-banner-grid .form-label { margin: 0; }
.env-banner-grid .env-banner-label { grid-column: 1; grid-row: 1; }
.env-banner-grid .ext-banner-show-line { grid-column: 2; grid-row: 1; flex-wrap: nowrap; }
.env-banner-grid .ext-banner-show-line .form-input.ext-banner-words { flex: 1 1 auto; min-width: 6rem; }
.env-banner-grid .ext-strip-line { grid-column: 3 / span 2; grid-row: 1; }
.env-banner-grid .ext-banner-colours { grid-column: 5 / span 2; grid-row: 1; }

@media (max-width: 1400px) {
  .env-banner-grid { grid-template-columns: 160px minmax(0, 1fr); }
  .env-banner-grid .env-banner-label { grid-column: 1; grid-row: 1; }
  .env-banner-grid .ext-banner-show-line { grid-column: 2; grid-row: 1; }
  .env-banner-grid .ext-strip-line { grid-column: 2; grid-row: 2; }
  .env-banner-grid .ext-banner-colours { grid-column: 2; grid-row: 3; }
}

@media (max-width: 960px) {
  .env-banner-grid { grid-template-columns: minmax(0, 1fr); }
  .env-banner-grid .env-banner-label,
  .env-banner-grid .ext-banner-show-line,
  .env-banner-grid .ext-strip-line,
  .env-banner-grid .ext-banner-colours { grid-column: 1; grid-row: auto; }
}

/* Other Information's Preferred languages box is an input's height, like
   every other control on the card: the chips and the Add language button
   step down to fit inside it. */
.env-section-row .locale-picker {
  box-sizing: border-box;
  height: 34px;
  padding: 2px 3px 2px 8px;
}

.env-section-row .locale-picker-chip { padding: 2px 8px; }
.env-section-row .locale-picker-toggle { padding: 4px 10px; }

/* Tags on one line: "Tags" is a short word, so its label takes only the room
   it needs, and the chips sit to the left of a box that takes what is left,
   since an environment carries a tag or two. */
.env-section-row .form-field-row.env-tags-field {
  grid-template-columns: auto minmax(0, 1fr);
}

.env-tags-field .known-item-list {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

.env-tags-field .known-item-chip-list { flex: 0 1 auto; }
.env-tags-field .known-item-chip-list:empty { display: none; }
.env-tags-field .known-item-entry-row { flex: 1 1 8rem; }
.env-tags-field .known-item-entry-row .form-input { height: 34px; }
.env-tags-field .env-tags-status { grid-column: 2; }

/* Other Information's three fields sit side by side only while each keeps
   room for its control beside the form's 160px label column. */
@media (max-width: 1400px) {
  .form-row.cols-3.env-section-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.env-versions-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 34px;
  gap: 8px;
  align-items: start;
}

.btn.btn-icon-only.env-versions-refresh {
  width: 34px;
  height: 34px;
}

.env-versions-refresh-icon {
  width: 18px;
  height: 18px;
}

.env-versions-status:empty {
  display: none;
}

.env-versions-status {
  margin: 6px 0 0;
}

.env-versions-models {
  margin: 6px 0 0;
}

@media (max-width: 1400px) {
  .env-versions-row {
    grid-template-columns: minmax(0, 1fr) 34px;
  }
  .env-versions-row .form-field-row {
    grid-column: 1;
  }
  .env-versions-row .env-versions-refresh {
    grid-column: 2;
    grid-row: 1;
  }
}

.env-metadata-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.env-metadata-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cache-block-compact {
  padding: 0;
}

/* The connections column stacks these, so the last one must not add a trailing
   gap below the column's own padding. */
.env-connection-column .empty-inline { margin-bottom: 0; }

.env-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.refresh-defaults-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.refresh-locale-field {
  min-width: 0;
}

.refresh-locale-field > div,
.refresh-workers-field > input {
  min-width: 0;
}

.refresh-locale-field > div {
  padding: 0;
}

.refresh-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Why a refresh failed: a row of its own across the whole card, under the title
   and the button, so a long reason wraps rather than squeezing either. */
.refresh-card-error {
  flex: 1 0 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.refresh-card-error-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.refresh-card-error-line,
.refresh-card-error-when {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.refresh-card-error-detail summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
}

/* A failure message has no length anybody chose, so it wraps, and it scrolls
   inside its own box past a ceiling rather than lengthening the page. */
.refresh-card-error-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 240px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 8px 10px;
  font-size: 12px;
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
}

/* The reference data card's parts, a row of its own across the card under the
   title and the button: each part's name, with what reads it in its tooltip,
   and when it was last read, on a grid every row shares so the times line up. */
.refresh-card-sets {
  flex: 1 0 100%;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.refresh-card-set-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  column-gap: 18px;
  row-gap: 4px;
}

.refresh-card-set {
  display: contents;
}

.refresh-card-set-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  cursor: help;
}

.refresh-card-set-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--accent);
}

.refresh-card-set-when {
  color: var(--text-muted);
  font-size: 0.85rem;
  align-self: center;
}

.refresh-card-sets-link {
  font-size: 0.85rem;
  color: var(--accent);
}

/* What a refresh of several parts read, once it has succeeded: a row of its
   own, like the parts above it. */
.refresh-card-detail {
  flex: 1 0 100%;
  margin: 0;
  overflow-wrap: anywhere;
}

.refresh-card-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.refresh-card-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.refresh-card-title {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.refresh-card-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  min-width: 0;
  flex: 0 0 auto;
}

/* The form does not shrink, so a sentence sitting beside the button takes its width
   out of .refresh-card-copy - which ellipsises the card title instead. The other
   inline elements here are a short checkbox label; an explanation long enough to be
   worth reading has to wrap in a bounded column to leave the title its room. */
.refresh-card-note {
  white-space: normal;
  max-width: 34ch;
  margin: 0;
}

/* ── Metadata Copy rows ───────────────────────────────────────────────────────
   One row per copyable source group inside the Metadata Copy section. The row is
   the refresh card's layout - title left, controls right, one line - without the
   card's border and background, because the section's own divider and heading
   already group these and a box per row read as three competing boxes per tab.

   The controls are laid out on a fixed grid rather than by flex intrinsic sizing,
   so "Copy from", the select and the button line up down the column whatever the
   source names happen to be - a longer environment name in one row must not shift
   that row's button out of line with the row above it. */
.seed-section-hint {
  margin: 0 0 10px;
  max-width: none;
}

.seed-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
}

.seed-row + .seed-row {
  border-top: 1px solid var(--border);
}

.seed-row-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.seed-row-title {
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seed-row-form {
  display: grid;
  grid-template-columns: auto 260px auto;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.seed-row-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  justify-self: end;
}

/* Every row renders a select, disabled with a placeholder when there is nothing to
   copy, so the grid needs no special case for an empty row - see the note in
   environment-seed-row. */
.seed-row-select {
  width: 100%;
  min-width: 0;
}

.seed-row-button {
  white-space: nowrap;
}

/* Spans both grid columns so a failure message wraps across the row rather than
   squeezing the controls. */
.seed-row-error {
  grid-column: 1 / -1;
  margin: 4px 0 0;
}

/* The Baseline field is a single checkbox whose caption is the control's name:
   it holds its line, at the size an input's value is drawn, and what the
   snapshot is for is the tooltip rather than a hint beside it. */
.baseline-row .option-flag {
  white-space: nowrap;
  font-size: 13.5px;
}

/* --- Settings footer card ---
   A page-wide card at the foot of a settings page: a title and a sentence on the
   left, the controls they describe on the right, all on one row. Used by the
   environments list's Metadata Import and the credentials page's Encryption at
   rest. Shared rather than copied, because "the same style as the other one" is
   a promise a second copy cannot keep.

   Spans the page rather than taking .form-card's 780px cap. The cap suits a
   column of stacked fields; this is one row of controls, and at 780px they
   wrapped onto a second line and made the card twice as tall as it needed. */
.settings-footer-card {
  margin-top: 18px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

/* Takes the slack so the controls opposite keep their natural width. */
.settings-footer-copy {
  flex: 1 1 20rem;
  min-width: 0;
}

.settings-footer-copy .form-hint {
  margin: 0;
}

.settings-footer-copy .form-hint + .form-hint {
  margin-top: 4px;
}

.settings-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
  flex: 0 1 auto;
}

/* Fixed rather than flexible: a file input growing to fit a long filename would
   push the button out of line, and the row is the point. */
.settings-footer-actions input[type="file"] {
  flex: 0 1 18rem;
  min-width: 0;
}

.locale-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.locale-picker:focus-within {
  border-color: var(--accent);
}

.locale-picker-rail {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}

.locale-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
}

.locale-picker-chip-label {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.locale-picker-chip-remove,
.locale-picker-toggle,
.locale-picker-option {
  border: none;
  background: none;
  color: inherit;
  font: inherit;
}

.locale-picker-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
}

.locale-picker-chip-remove:hover {
  background: var(--surface);
  color: var(--text);
}

.locale-picker-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.locale-picker-toggle::after {
  content: "▾";
  font-size: 10px;
  line-height: 1;
}

.locale-picker.is-open .locale-picker-toggle::after {
  content: "▴";
}

.locale-picker-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 25;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
}

.locale-picker-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}

.locale-picker-option:hover {
  background: var(--surface-hover);
}

.locale-picker-option.is-selected {
  background: var(--accent-dim);
  color: var(--accent);
}

.refresh-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 1120px) {
  .refresh-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .refresh-card-copy,
  .refresh-card-form {
    width: 100%;
  }

  .refresh-card-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .refresh-card-title {
    white-space: normal;
  }

  .refresh-card-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.refresh-state {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-muted);
}

.refresh-state-running {
  background: rgba(90, 145, 255, 0.16);
  color: var(--accent);
}

.refresh-state-success {
  background: rgba(90, 200, 120, 0.14);
  color: var(--sev-ok-text);
}

.refresh-state-failed {
  background: rgba(220, 70, 70, 0.16);
  color: var(--sev-prob-text);
}

/* Stopped on purpose is neither a success nor a failure, so it takes the
   idle pill's neutral colours rather than either. */
.refresh-state-cancelled {
  background: var(--surface-raised);
  color: var(--text-muted);
}

/* The Comply sweep's running strip carries its Cancel at the right-hand end,
   the sentence taking the width between the icon and the button. */
.comply-util-refresh-running {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comply-util-refresh-running > span {
  flex: 1;
}

.comply-util-cancel {
  flex-shrink: 0;
}

/* The validation run's page: a sentence, a bar and a count while it runs. The
   bar's width is a custom property the server renders per event, which the
   morph carries across; a run's position is server state, never a script's. */
.validate-job-live {
  max-width: 720px;
}

.validate-job-track {
  height: 10px;
  margin: 12px 0 6px;
  border-radius: 999px;
  background: var(--surface-raised);
  overflow: hidden;
}

.validate-job-fill {
  display: block;
  height: 100%;
  width: var(--validate-job-percent, 0%);
  border-radius: 999px;
  background: var(--accent);
  transition: width 200ms ease-out;
}

.refresh-spinner {
  /* A <span> is an inline box, and width, height and transform do NOT apply to
     one: without this the spinner renders as a ~4px sliver of its own border and
     the rotate animation has no effect whatsoever - a small static artefact
     beside the text. It looked right only where its parent is a flex or grid
     container (.refresh-card-actions, .seed-row-form), because that blockifies
     its children; in a plain block parent (.alert on the compare job page) or a
     table cell (the migrate job rows) it did not. flex: none keeps it from being
     shrunk to nothing in the flex parents. */
  display: inline-block;
  vertical-align: middle;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  animation: htmx-spin 0.8s linear infinite;
}

/* The ring the accent arc travels round is white at 18%, which is invisible on a
   light background - the spinner reads as a lone comma rather than as a circle
   turning. Only noticeable now that the spinner has a box to draw in at all. */
html[data-theme="light"] .refresh-spinner {
  border-color: rgba(0, 0, 0, 0.12);
  border-top-color: var(--accent);
}

/* The migrate job rows put the spinner in a table cell, immediately before the
   status pill, where there is no flex gap to separate the two. */
.migrate-row-spinner {
  margin-right: 8px;
}

/* The path-pattern presets under a pattern box (the Packager's Package mode and the OData
   push's Single Zip): a pattern per button, in the monospace it is typed in, wrapping inside
   the column rather than widening it. */
.migrate-pattern-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  min-width: 0;
}

.migrate-pattern-preset {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.35;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: left;
}

.migrate-pattern-preset:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* A migrate job row's errors, a line each: an OData push names every row D365
   refused on a line of its own. A message can carry an address or a key with
   no space to break at, so it may break anywhere rather than widen the
   table. */
.migrate-job-errors {
  overflow-wrap: anywhere;
}

/* Past five lines the rest fold behind "N more", Automate's run-table rule
   (see .automate-more): a hundred refused rows would otherwise make one row a
   hundred lines tall. Open, the rest follow the summary a line each. */
.migrate-job-more > summary {
  cursor: pointer;
  list-style: none;
  color: var(--accent);
  font-size: 12px;
}

.migrate-job-more > summary::-webkit-details-marker {
  display: none;
}

.migrate-job-more > summary:hover {
  text-decoration: underline;
}

/* What a migrate run passed over and went on without, a line each under the
   alert's heading. A line names a file path or an entity, which may have no
   space to break at, so it breaks anywhere rather than widen the page. */
.migrate-run-warnings ul {
  margin: 6px 0 0;
  padding-left: 20px;
  overflow-wrap: anywhere;
}

/* An alert whose content is a spinner (or an icon) beside its text: laid out as
   a row so the two align on their centres and are separated by a real gap
   rather than by the inline whitespace between two spans. */
.alert-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cache-details {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.cache-details > summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  list-style: none;
}

.cache-details > summary::-webkit-details-marker {
  display: none;
}

.cache-details[open] > summary {
  margin-bottom: 10px;
}

.stats-grid-compact {
  margin-top: 12px;
}

.env-card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.env-id-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
}

.conn-id-field {
  min-width: 0;
}

.conn-id-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  overflow-wrap: anywhere;
}

.conn-id-input {
  width: fit-content;
  min-width: 180px;
  border: 0;
  outline: 0;
  cursor: default;
  align-self: center;
}

.conn-id-input::placeholder {
  color: var(--accent);
  opacity: 0.7;
}

.conn-id-preview {
  opacity: 0.7;
}

.env-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin: 8px 0 16px;
  line-height: 1.6;
}
.env-meta strong { color: var(--text); font-weight: 600; }

/* Resource table */
/* The "nothing here yet" panel every run log and results history shows when it has
   no entries.

   These three rules lived in an inline <style> at the top of each of the five run-log
   templates - identical copies, inside the fragment htmx swaps into #main-content. A
   rule that arrives with the markup it styles is a rule that is not in force the
   moment that markup is first laid out, and an unsized MDI icon does not degrade
   gently: it has a viewBox and no intrinsic size, so it stretches to fill its
   container, flashing at over a thousand pixels before snapping to 3rem. The
   stylesheet is loaded in <head> and applies before any swapped content is painted,
   so shared rules belong here and not in the fragment. */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state-icon {
  margin-bottom: 1rem;
}

/* The heading of an empty state. It had no rule, so sixty of them drew at
   the browser's own h3 size, which differs from every heading around it. It is
   an h2 where the empty state stands straight under the page's h1 (Comply's),
   and an h3 elsewhere; both draw alike. */
.empty-state h2,
.empty-state h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.empty-state-svg {
  width: 3rem;
  height: 3rem;
  /* The copies asked for var(--color-text-secondary), which this stylesheet has
     never defined, so the declaration was dropped and the icon took the body text
     colour. --text-muted is the muted colour those rules meant. */
  color: var(--text-muted);
}

/* .empty-inline - the OTHER empty state: one muted line, for a list, table or
   panel that has no rows yet (issue #167).

   There were nine of these, one per module - conn-empty, empty-results,
   pkgd-empty, activity-empty, runbook-step-empty, builtin-templates-empty, plus
   three declared in page-level <style> blocks - so "this list has no rows yet"
   read as a plain grey sentence in Connections, a bordered panel in Compare and a
   dashed outlined box in the package designers, depending on which module you
   were in rather than on anything about the emptiness. Empty states are what a
   new user sees first, which makes the inconsistency disproportionately visible.

   Use .empty-state (above) instead when the emptiness IS the page: a first-run
   screen with nothing on it yet, where an icon, a heading and a "create the first
   one" button are the content. .empty-inline is for a region of a page that has
   something else on it. */
.empty-inline {
  margin: 0 0 var(--space-4);
  color: var(--text-muted);
  font-size: 13px;
}

/* Centred with air around it, for a panel or a table cell spanning its columns -
   a sentence hugging the left edge of an otherwise empty panel reads as a
   layout fault. */
.empty-inline.is-centered,
.empty-inline.is-boxed,
.empty-inline.is-outline {
  margin: 0;
  padding: var(--space-4) var(--space-3);
  text-align: center;
}

/* Boxed: the empty region keeps the surface and border of the table or card that
   would have been there. */
.empty-inline.is-boxed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Outlined: a dashed edge, for a list the reader is expected to ADD to - it reads
   as a slot waiting to be filled rather than as a result that came back empty. */
.empty-inline.is-outline {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

/* Not an empty state at all: the marker for one MISSING VALUE inside a row that
   is otherwise present ("-", "not priced"). It was called .detail-empty and was
   counted among the empty states it has nothing to do with. Faint on purpose -
   it is the absence of a value, not a message. */
.value-none { color: var(--text-faint); }

/* An entity's country/region codes, drawn as flag emoji with nothing between
   them: concatenated they read as one wide glyph rather than as four
   countries, and at emoji size the browser's default letter-spacing of zero
   is not enough to tell one from the next. */
.flags { letter-spacing: 2px; }

/* --- Results History table (Compare and Validate) ---
   One listing rendered by two pages - templates/compare/results_history.html and
   templates/validate/results_history.html - which each carried a byte-identical
   copy of these rules in their own <style> block. Shared here per the "a shared
   rule belongs in style.css" rule in cmd/website/README.md; the two copies had
   nothing keeping them in step, and the count-column bug below was in both.

   Fixed layout, so every column but the description is sized here and the
   description takes what is left. */
.results-history-table {
  table-layout: fixed;
  /* The fixed columns below total 60rem, and fixed layout hands the description
     whatever is left - at a narrow window that remainder reaches zero and the
     nowrap uppercase headers (STARTED over DESCRIPTION) draw on top of each
     other. The floor is 60rem plus a readable description (12rem); below it the
     .plain-table-wrapper's overflow-x scrolls instead. */
  min-width: 72rem;
}

/* Qualified with .data-table so it reaches (0,2,1) and actually beats
   .data-table.is-roomy td's top alignment - see TestTablesUseTheSharedBase and
   issue #165. Unqualified, which is how both page <style> blocks had it, this was
   (0,1,1) and had never applied. Measured: it makes no difference today, because
   every cell in this listing is a single line, so the row height comes from the
   action buttons and top and middle land in the same place. It is here for the
   row that is not - a description that wraps rather than ellipsising. */
.data-table.results-history-table th,
.data-table.results-history-table td {
  vertical-align: middle;
}

/* 6.5rem: the "Runbook" pill is the widest trigger and wanted 87px of the 84px
   this was. */
.results-history-trigger-col {
  width: 6.5rem;
}

.results-history-desc-col {
  width: auto;
}

.results-history-started-col {
  width: 11rem;
}

/* 6.75rem, not the 4.5rem this was. Every .data-table th is uppercase and
   white-space: nowrap, and "WARNINGS" needs 91px at the roomy header's 11.5px and
   0.06em tracking - against a 63px cell it overflowed into the next column, which
   is why MATCHED, WARNINGS and PROBLEMS were drawn on top of one another and the
   table demanded 28px more than the page had, giving every run of this listing a
   horizontal scrollbar it did not need. Measure the widest header before lowering
   this. The description column is `auto`, so the room comes out of the one column
   that had it spare. */
.results-history-count-col {
  width: 6.75rem;
}

/* 15.5rem, not 13rem. A runbook-triggered run carries both View report and
   Execution, and .results-history-actions-cell keeps them on one line - the pair
   needs 217px, against the 182px this was. That was the other half of the
   horizontal scrollbar; the count columns above were the first. */
.results-history-actions-col {
  width: 15.5rem;
}

.results-history-desc-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Shared wrapper for plain tables that should keep the light body surface. */
/* The band of still-running jobs above a module's run log. Deliberately set apart
   from the finished runs below it: these are not history yet, and the point of the
   band is that they are still there to go back to. Shared by Compare and Migrate. */
.running-band {
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid var(--sev-info-text);
  border-radius: var(--radius-sm);
  background: var(--sev-info-bg);
}

.running-band-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.running-band-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.running-band-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--sev-info-text);
}

/* The runs that ended without a report, below the running ones: a warning
   rather than information, since each is something to go and read. */
.running-band.is-ended {
  border-color: var(--sev-warn-text);
  background: var(--sev-warn-bg);
}
.running-band.is-ended .running-band-icon {
  color: var(--sev-warn-text);
}
/* A reason is a sentence or two, and wraps in its cell. */
.compare-ended-why {
  min-width: 260px;
  max-width: 520px;
  white-space: normal;
}

.plain-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.conn-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* Kind / system badges */
.kind-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  width: fit-content;
}
.kind-sql  { background: rgba(251,191,36,0.12); color: #fbbf24; }
.kind-rest { background: rgba(0,201,167,0.12);  color: var(--accent); }
.kind-aot  { background: rgba(167,139,250,0.12); color: #a78bfa; }
.kind-mcp  { background: rgba(96,165,250,0.12); color: #60a5fa; }
/* A baseline is a vanilla reference snapshot rather than a connection kind, but
   it reads as one on an environment card, where it explains the absent badges. */
.kind-baseline { background: rgba(148,163,184,0.16); color: #94a3b8; }
/* A Dynamics AX database behind an environment's AXDB connection, on its card:
   what explains an environment of type Dynamics 365 with no entities to offer. */
.kind-ax { background: rgba(244,114,182,0.14); color: #f472b6; }
/* A vault's own environment, on Settings > Environments. */

.system-badge {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-elevated);
  color: var(--text-muted);
  white-space: nowrap;
}

.badge-unavailable {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
  background: var(--sev-warn-bg);
  color: var(--sev-warn-text);
}

/* Small / danger button variants */
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  white-space: nowrap;
}
.btn-danger {
  background: var(--sev-prob-text);
  color: #fff;
  border-color: var(--sev-prob-text);
}
/* Derived from --sev-prob-text rather than hardcoded, so it tracks the theme.
   The literal it replaced (#c94d4d) was a darkened version of the dark theme's
   #d96060, which meant hovering a danger button in the LIGHT theme - where
   --sev-prob-text is the much darker #b01818 - made it lighter instead. */
.btn-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--sev-prob-text) 85%, #000);
  border-color: color-mix(in srgb, var(--sev-prob-text) 85%, #000);
  color: #fff;
}

/* Fixed connection slots */
.conn-slot-grid {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.conn-slot {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  overflow: clip;
}

.conn-slot-empty {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.06), rgba(148, 163, 184, 0.03));
  border-style: dashed;
}

.conn-slot > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 16px;
  padding: 12px 16px;
  align-items: center;
}
.conn-slot > summary::-webkit-details-marker { display: none; }
.conn-slot > summary:hover { background: rgba(255,255,255,0.025); }

.conn-slot-summary-type {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.conn-slot-summary-label {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.conn-slot-summary-value,
.conn-slot-summary-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.conn-slot-summary-name {
  display: grid;
  gap: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.conn-slot-summary-detail {
  display: none;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.conn-slot-summary-hint {
  color: var(--text-faint);
}

.conn-slot-summary-action {
  justify-self: start;
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  border: 1px solid var(--border-hover);
  background: var(--surface-elevated);
  border-radius: 4px;
  padding: 5px 11px;
  margin-top: 0;
}

.conn-slot-summary-action-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
  justify-self: end;
  white-space: nowrap;
}

.conn-slot-summary-action-wrap .conn-slot-summary-label {
  white-space: nowrap;
}

.conn-slot > summary:hover .conn-slot-summary-action {
  border-color: var(--accent);
  color: var(--accent);
}

.conn-slot[open] > summary {
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.conn-slot-panel {
  padding: 14px;
}

.conn-slot-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.conn-slot-panel-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.conn-slot-panel-subtitle {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.conn-slot-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.conn-slot-actions form { margin: 0; }

.conn-slot-form {
  display: grid;
  gap: 10px;
}

.conn-prop-row {
  display: grid;
  grid-template-columns: minmax(170px, 240px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.conn-prop-label {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
}

.conn-prop-input {
  width: 100%;
}

/* A hint inside a row is the row's third item, which the two-column grid would
   put in the label's column on a line of its own; it belongs under the control
   it explains. */
.conn-prop-row > .form-hint {
  grid-column: 2;
}

/* An environment's type and its SQL connections' system type change together
   (internal/environment's retype.go), and the editor says so beside whichever
   select is changed before anything is saved. Each note is drawn for the one
   choice it is about and shown only while that choice is selected, so the
   stylesheet decides and no script does. A note on the create page is about a
   pairing of the page's two selects, since nothing stored has decided either. */
.form-hint.retype-note {
  display: none;
}

.form-hint.retype-note.is-refused {
  color: var(--sev-warn-text);
}

#environment-editor-form:has(#type option[value="dynamics365"]:checked) .retype-note[data-retype-env="dynamics365"],
#environment-editor-form:has(#type option[value="other"]:checked) .retype-note[data-retype-env="other"],
.conn-slot-form:has(select[name="type"] option[value="axdb"]:checked) .retype-note[data-retype-sql="axdb"]:not([data-retype-env-live]),
.conn-slot-form:has(select[name="type"] option[value="other"]:checked) .retype-note[data-retype-sql="other"]:not([data-retype-env-live]),
.tool-page:has(#type option[value="dynamics365"]:checked) .conn-slot-form:has(select[name="type"] option[value="axdb"]:checked) .retype-note[data-retype-sql="axdb"][data-retype-env-live="dynamics365"],
.tool-page:has(#type option[value="dynamics365"]:checked) .conn-slot-form:has(select[name="type"] option[value="other"]:checked) .retype-note[data-retype-sql="other"][data-retype-env-live="dynamics365"],
.tool-page:has(#type option[value="other"]:checked) .conn-slot-form:has(select[name="type"] option[value="axdb"]:checked) .retype-note[data-retype-sql="axdb"][data-retype-env-live="other"],
.tool-page:has(#type option[value="other"]:checked) .conn-slot-form:has(select[name="type"] option[value="other"]:checked) .retype-note[data-retype-sql="other"][data-retype-env-live="other"] {
  display: block;
}

.conn-prop-input[readonly] {
  color: var(--text-muted);
  background: var(--surface-elevated);
  border-color: var(--border);
  cursor: default;
}

.conn-prop-row-check {
  align-items: center;
}

.conn-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12.5px;
}

.conn-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

@media (max-width: 760px) {
  .conn-slot > summary,
  .conn-slot-panel-head,
  .conn-prop-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .conn-prop-row > .form-hint {
    grid-column: auto;
  }

  .conn-slot-grid-header {
    display: none;
  }

  .conn-slot > summary {
    align-items: stretch;
  }

  .conn-slot-summary-type {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .conn-slot-summary-name,
  .conn-slot-summary-detail {
    white-space: normal;
  }

  .conn-slot-actions {
    justify-content: flex-start;
  }

  .tool-header-actions {
    margin-left: 0;
    justify-content: flex-start;
  }

  .form-field-row {
    grid-template-columns: 1fr;
  }

  .form-field-row .form-label,
  .form-field-row .form-hint {
    grid-column: auto;
    margin-top: 0;
  }
}

@media (max-width: 1400px) {
  .conn-slot > summary {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }

  .conn-slot-summary-type {
    align-items: start;
  }

  .conn-slot-summary-action {
    justify-self: start;
  }

  .conn-slot-summary-title {
    white-space: normal;
  }

  .refresh-card {
    gap: 12px;
  }
}

/* Add-environment form grid */
.settings-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
}
.settings-form .btn-primary {
  grid-column: 1 / -1;
  justify-self: start;
  white-space: nowrap;
}

/* Environment card list - capability badges */
.env-cap-badges {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.cap-badge {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-elevated);
  color: var(--text-faint);
  border: 1px solid var(--border);
}
.cap-badge.cap-on {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: transparent;
}

/* An environment's card opens the environment and carries tag pills that
   narrow the list, so the card is not a link itself (a link inside a link is
   not HTML): the name is the link, stretched over the whole card by its
   ::after, and the pills are raised above that so a press on one is the
   pill's. The ring a focused link draws goes round the card, which is what
   the link stands for. */
.env-list-card {
  position: relative;
}
.env-list-card-link,
.env-list-card-link:hover {
  color: inherit;
  text-decoration: none;
}
.env-list-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.env-list-card-link:focus-visible {
  outline: none;
}
.env-list-card:has(.env-list-card-link:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.env-card-tags {
  position: relative;
  z-index: 1;
  max-width: 100%;
}

/* An environment card's foot: the capability badges at the bottom left and the
   tags at the bottom right. The card stretches its body to the row's height
   (.card-grid makes the cards one height) and the foot is pushed to the bottom
   of it, so every card in a row has its badges on one line whatever its lines
   above run to: a card with a client and a version drew them lower than one
   without, and its tags on a line of their own under them. The foot wraps in
   reverse, so the badges keep the bottom line whatever happens and tags with
   no room beside them go on the line above rather than under the badges,
   where they would lift them out of line with the cards beside them, or
   squeezed beside them, which cut the pills' words off. space-between is what
   puts the tags at the right while they share the badges' line and at the
   left once they have a line of their own: a line holding one item starts it
   at the start, so the card says which case it is in without being told. */
.env-list-card {
  align-items: stretch;
}
.env-list-card .tool-card-icon,
.env-list-card .tool-card-arrow {
  align-self: flex-start;
}
.env-card-foot {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  flex-wrap: wrap-reverse;
  justify-content: space-between;
  align-items: flex-end;
  gap: 6px 12px;
}
.env-card-foot .env-cap-badges {
  margin-top: 0;
  flex: none;
  flex-wrap: nowrap;
}
/* A made environment's padlock is inside the stretched name, and raised above
   it like the pills, or its tooltip saying what locks the card was the link's
   and said nothing. A press on it is still the name's. */
.env-list-card .locked-mark {
  position: relative;
  z-index: 1;
}

/* The line under a saved environment's tag box saying the chips were stored
   (or why not). It is in the markup from the start, so a screen reader is
   already watching it when the first answer arrives, and takes no room until
   then. */
.env-tags-status:empty {
  display: none;
}

/* "Add new" card - dashed, muted until hover */
.tool-card-add {
  border-style: dashed;
  border-color: var(--border-hover);
}
.tool-card-add:hover {
  border-color: var(--accent);
}
.tool-card-icon-add {
  background: var(--surface-elevated);
  color: var(--text-muted);
}
.tool-card-add:hover .tool-card-icon-add {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Environment detail header with action on the right */
.detail-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 980px;
}
.detail-header-row .page-title { margin-bottom: 0; }

.section-heading {
  margin: 24px 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* A heading that sorts its table: the label is the link, in the heading's own
   colour, and the arrow saying which way the table is sorted sits in the
   cell's padding just after it, out of the flow, so a column sorted by does
   not widen and move the columns after it. */
.th-sort {
  position: relative;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.th-sort:hover,
.th-sort:focus-visible {
  color: var(--accent);
}

/* 10px with its 1px margin is 11px, inside a roomy cell's 14px of padding.
   Qualified past .explorer-detail-table .num-col svg, which would otherwise
   draw it at an icon column's 15px, as a block, centred. */
.data-table .th-sort .th-sort-icon {
  display: block;
  position: absolute;
  left: 100%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: 0 0 0 1px;
  transform: translateY(-50%);
}

/* The same heading on a table that sorts in the browser (table-sort.js) is a
   button rather than a link, since there is no address to go to: it draws
   as the link does, and carries both arrows with the one aria-sort names
   shown. */
button.th-sort {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  text-align: inherit;
}

.data-table th[aria-sort="none"] .th-sort-asc,
.data-table th[aria-sort="none"] .th-sort-desc,
.data-table th[aria-sort="ascending"] .th-sort-desc,
.data-table th[aria-sort="descending"] .th-sort-asc {
  display: none;
}

/* Browse data's filters are one row across the page: each a label beside its
   control, the two choosers sharing the width and the page size as wide as
   "200 rows" and no wider. As the window narrows they wrap a field at a time,
   and on a phone each is a line of its own. A card of fields under one
   another, with a sentence under them, took a quarter of the window from the
   rows it was there to choose. */
.explorer-browse-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  margin-bottom: 12px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.explorer-browse-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 240px;
  min-width: 0;
}

.explorer-browse-filter .form-label {
  margin: 0;
  white-space: nowrap;
}

.explorer-browse-filter .form-select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding-top: 6px;
  padding-bottom: 6px;
}

.explorer-browse-filter.is-size {
  flex: 0 0 auto;
}

.explorer-browse-filter.is-size .form-select {
  flex: none;
  width: 110px;
}

/* The Filter button at the end of the row: as wide as what it says, so the
   row still fits on one line beside the two selects. On, it is tinted, so a
   page narrowed by a filter says so from the toolbar as well as the chips. */
.explorer-browse-filter.is-filter {
  flex: 0 0 auto;
}

.explorer-browse-filter-btn {
  white-space: nowrap;
}

.explorer-browse-filter-btn.is-on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* A chip per condition, its words as written: the shared chip capitalises a
   severity, which would rewrite a column name and a value. */
.explorer-browse-chip {
  text-transform: none;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* A cell leading to the related entity's rows: the value as a link, or as a
   button asking which entity where several lead from it, drawn as one. */
.explorer-browse-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 2px;
}

.explorer-browse-link:hover {
  text-decoration-color: var(--accent);
}

.explorer-browse-link.is-choice {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  text-decoration-style: dashed;
}

/* The filter's modal: the form is the dialog's column, so its body scrolls
   between a head and a foot that stay put. */
.explorer-browse-filter-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.explorer-browse-filter-match {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.explorer-browse-filter-match .form-label {
  margin: 0;
}

.explorer-browse-filter-match .form-select {
  width: auto;
}

.explorer-browse-filter-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

/* A row is the column, the comparison and the value on one line, the value
   taking what is left; a sentence saying what is wrong goes under them. */
.explorer-browse-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.4fr) auto auto;
  align-items: center;
  gap: 8px;
}

.explorer-browse-filter-novalue,
.explorer-browse-filter-kind {
  font-size: 12px;
  white-space: nowrap;
}

.explorer-browse-filter-problem {
  grid-column: 1 / -1;
  margin: 0;
}

@media (max-width: 600px) {
  .explorer-browse-filter-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* A navigation's join on the explorer's entity page, a pair to a line. */
.explorer-nav-constraint {
  white-space: nowrap;
}

.explorer-nav-constraint + .explorer-nav-constraint {
  margin-top: 2px;
}

/* Where a cell leads, when several entities lead from its column. */
.explorer-browse-related-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.explorer-browse-related-choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}

.explorer-browse-related-choice:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.explorer-browse-related-name code {
  font-size: 12px;
}

/* A global entity has no legal entity to choose, which is said where the
   chooser would be rather than on a line of its own. */
.explorer-browse-global {
  min-width: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Why there are no legal entities to choose from, the one note that can
   still stand under the filters, since it is about something that went
   wrong. */
.explorer-browse-note {
  margin: -4px 0 12px;
}

@media (max-width: 600px) {
  .explorer-browse-filter,
  .explorer-browse-filter.is-size,
  .explorer-browse-filter.is-filter {
    flex: 1 1 100%;
  }

  .explorer-browse-filter .form-label {
    flex: 0 0 92px;
  }

  .explorer-browse-filter.is-size .form-select {
    flex: 1 1 auto;
    width: auto;
  }
}

/* The Data Entity Explorer's Options: a wrapping row of small buttons, each
   something that can be done with the entity. */
.explorer-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

/* Browse data is the option used most: the primary button, pushed to the
   row's far end. */
.explorer-options .explorer-option-primary {
  margin-left: auto;
}

/* The count beside a section's heading, "Fields (42)": a step down from the
   heading, and not bold. */
.section-heading-count {
  font-size: 0.85em;
  font-weight: 400;
}

/* --- Environment detail: metadata cache blocks --- */

.cache-block {
  padding: 16px 20px;
}

.cache-block + .cache-divider + .cache-block {
  padding-top: 16px;
}

.cache-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.cache-block-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.cache-block-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.cache-block-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* cache-block-seeded marks a summary block whose metadata was copied from another
   environment rather than refreshed from this one's sources - amber because it is
   a caveat on the figures beside it, not an error in them. */
.cache-block-seeded {
  background: rgba(251,191,36,0.12);
  color: #fbbf24;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 4px;
  cursor: help;
}

/* cache-block-swept marks an AOT block whose files came off a developer box
   through ESTools AOT Sweep rather than a refresh of this environment's own
   source: a fact about where they came from, in the information blue, with
   the whole of the sweep record in its tooltip. */
.cache-block-swept {
  background: var(--sev-info-bg);
  color: var(--sev-info-text);
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 4px;
  cursor: help;
}

/* --- Package Registry (list + edit) --- */

/* Source-type badge in the packages table */
.pkg-src-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.pkg-src-sql     { background: rgba(251,191,36,0.13);  color: #fbbf24; }
.pkg-src-file    { background: rgba(96,165,250,0.13);  color: #60a5fa; }
.pkg-src-inline  { background: rgba(0,201,167,0.12);   color: var(--accent); }
.pkg-src-target  { background: rgba(167,139,250,0.12); color: #a78bfa; }
.pkg-src-compare { background: rgba(244,114,182,0.13); color: #f472b6; }
.pkg-src--       { background: var(--surface-elevated); color: var(--text-faint); }

.pkg-preview-section {
  display: grid;
  gap: 4px;
}

.pkg-preview-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pkg-preview-entry {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.pkg-preview-entry-head {
  display: grid;
  gap: 4px;
}

.pkg-edit-check-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pkg-preview-entry-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.pkg-preview-entry-desc {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.pkg-preview-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.fv-source-entry {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.fv-source-entry-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.fv-source-entry-desc,
.fv-source-file-note,
.fv-source-entry-note {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.fv-source-values {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.fv-source-value-cell {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 12px;
}

.fv-target-entry {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.fv-target-entry-head {
  display: grid;
  gap: 4px;
}

.fv-target-entry-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.fv-target-entry-desc,
.fv-target-entry-note {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Row that pairs a badge with a name */
.pkg-tag-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 13px;
}
.pkg-tag-row:last-child { margin-bottom: 0; }

.pkg-item-name {
  color: var(--text);
  font-size: 13px;
  /* A generated preflight package names one inline enum source per enum type,
     and those names are long. Unconstrained they widened the Sources column
     until Description was pushed off the right edge of the table. */
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Target name in the list table */
.pkg-target-name {
  font-size: 13px;
  color: var(--text-muted);
}

/* Check code badges - reuse .type-badge, just add spacing */
.pkg-check-badge {
  margin-right: 3px;
  margin-bottom: 3px;
  display: inline-block;
}

/* "+ N more" overflow indicator */
.pkg-extra-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--surface-elevated);
  color: var(--text-muted);
  white-space: nowrap;
}

/* One target name per line in the registry's Targets column. Replaces an inline
   style so the Sources and Targets cells share a rhythm. */
.pkg-target-line {
  font-size: 13px;
  margin-bottom: 2px;
  /* Same reasoning as .pkg-item-name: a schema-qualified object name is long,
     and the Targets column must not grow at the Description's expense. */
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* "+ N more" for the Sources and Targets columns. Unlike .pkg-extra-badge - a
   pill sitting inline among check badges - these cells stack one item per line,
   so the overflow marker is a line too. A real DMF preflight package carries an
   inline enum source per enum type and a target per entity, and printing every
   one made the registry unreadable. */
.pkg-more-line {
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Description column - softer colour and constrain width */
/* Slug and friendly name stacked in one Package column. They were two columns,
   and a name on its own row next to a wide slug forced the table wider than the
   description could then be. Stacking them frees that width for the
   description, which is the column that actually needs it. */
.pkg-identity-col {
  max-width: 260px;
}

.pkg-identity-name {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  /* .friendly-name is nowrap for single-line cells; here the name sits under
     the slug and may wrap onto a second line rather than widening the column. */
  white-space: normal;
  word-break: break-word;
}

.pkg-desc-col {
  color: var(--text-muted);
  font-size: 12.5px;
  /* Roomier than the 280px it had while Name was its own column. */
  max-width: 420px;
  min-width: 240px;
  vertical-align: top;
}

/* Six lines, matching the five-plus-overflow cap on Sources and Targets. A
   generated preflight description runs to a paragraph, and in a narrow column
   that turned one row into a dozen lines and made the registry unreadable.
   The clamp lives on an inner element: -webkit-box on the <td> itself would
   replace its table-cell display and break the column layout, which showed up
   as a half-visible seventh line. */
.pkg-desc-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Package edit - 3-column overview grid */
.pkg-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.pkg-overview-section {
  padding: 14px 16px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.pkg-overview-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

/* Package registry edit page layout. */
.pkg-edit-overview-head {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1.05fr);
  align-items: start;
  gap: 16px;
  margin-bottom: 10px;
}

.pkg-edit-overview-json-head {
  text-align: left;
  padding-top: 18px;
}

/* Spans the page rather than taking .form-card's 780px cap: the body inside it
   is a two-column grid of fields beside the JSON editor, and at 780px neither
   column has room. */
.pkg-edit-overview-card {
  width: 100%;
  max-width: none;
  padding-top: 14px;
  padding-bottom: 18px;
}

.pkg-edit-form {
  display: grid;
  gap: 16px;
}

.pkg-edit-overview-body {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1.05fr);
  gap: 16px;
}

.pkg-edit-overview-fields,
.pkg-edit-json-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.pkg-edit-json-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pkg-edit-json-panel-head .form-label {
  margin: 0;
}

.pkg-edit-file-input {
  display: none;
}

.pkg-edit-field-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.pkg-edit-field-row-center {
  align-items: center;
}

.pkg-edit-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
  padding-top: 7px;
}

.pkg-edit-field-row-center .pkg-edit-field-label {
  padding-top: 0;
}

.pkg-edit-field-value {
  display: grid;
  gap: 6px;
}

.pkg-edit-field-value-inline {
  align-items: center;
}

.pkg-edit-inline-pill,
.pkg-edit-name-pill {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
}

.pkg-edit-name-pill {
  background: rgba(0, 201, 167, 0.12);
  color: var(--accent);
}

.pkg-edit-name-text {
  display: inline-flex;
  width: fit-content;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.pkg-edit-type-pill {
  display: inline-flex;
  width: fit-content;
}

.pkg-edit-json-textarea {
  min-height: 100px;
  max-height: 150px;
  resize: vertical;
}

.pkg-edit-details-grid {
  margin-top: 3mm;
}

/* .btn-icon-ghost is the quiet icon button: a row's remove or move control,
   which should read as available without competing with the page's own
   actions. It lived beside the runbook step editor, its first consumer; the
   form designer is the one that has it now. */
.btn-icon-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-muted);
}

.btn-icon-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: transparent;
  color: var(--text);
}

/* A field's own error line, under the control it belongs to. */
.field-error {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--sev-prob-text);
}

/* .option-flag is a checkbox and its caption on one line: "Force refresh",
   "Run as the application". It was .runbook-flag, defined beside the runbook
   step editor that first used it; the migrate, compare and settings pages are
   the ones that have it now, so it is named for what it is. */
.option-flag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
}

.option-flag input {
  margin: 0;
}

/* --- Insert-reference picker --- */

/* Default (and the common case): a single-line text input plus its button(s)
   - align-items defaults to "stretch" so the Browse/reference buttons grow to
   match the input's height exactly instead of sitting at their own shorter
   intrinsic height. */
.runbook-ref-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

/* A multi-row textarea/key-value-lines field would otherwise stretch its
   button to the same (much taller) height, so it opts back into top
   alignment. */
.runbook-ref-input-multiline {
  align-items: start;
}

/* Target fields with a folder-browse button (see TargetBrowse) add a third
   column for it, ahead of the reference-picker button. */
.runbook-ref-input-browse {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.runbook-ref-btn {
  padding: 6px 8px;
  min-height: 32px;
}

/* --- Migrate: the template controls beside Pull's, Push's and the Packager's
   tabs (a saved-template select, a save popover and the run buttons). The
   three pages carried identical copies; the tab labels each page sizes to the
   same 36px stay with the page, since each strip has a class of its own. --- */
.migrate-template-controls { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; flex-shrink: 0; }
.migrate-template-controls .form-select { max-width: 180px; }
.migrate-template-controls .form-select,
.migrate-template-controls .btn-icon-only { height: 36px; box-sizing: border-box; }
.migrate-template-controls .btn-icon-only { width: 36px; }

.migrate-template-save-details { position: relative; }
.migrate-template-save-details > summary { list-style: none; cursor: pointer; }
.migrate-template-save-details > summary::-webkit-details-marker { display: none; }

.migrate-template-popover {
  position: absolute;
  z-index: 20;
  top: 100%;
  right: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 14px;
  margin-top: 6px;
  width: 320px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.migrate-template-popover .btn { margin-top: 6px; }

/* The popover hangs off the RIGHT edge of a 44px trigger near the right of the
   page, so on a phone its 320px card ran 81px past the LEFT margin and the page
   clip took that end of it. Below this width it stops floating and becomes an
   ordinary block under the controls, the row's full width. */
@media (max-width: 640px) {
  .migrate-template-controls { flex-wrap: wrap; }
  .migrate-template-save-details { flex: 1 1 100%; }
  .migrate-template-popover {
    position: static;
    width: auto;
    box-shadow: none;
  }
}

/* A preview page's row of a summary alert beside its one action (Pull's and
   Push's previews). Only Pull's page defined it, so Push's drew unstyled. */
.tool-page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.tool-page-actions .alert { flex: 1; margin-bottom: 0; }

/* --- Server-local folder-browse picker (shared with the Migrate web tools -
   see static/js/migrate-browse.js) --- */

.migrate-browse-input-row {
  display: flex;
  gap: 8px;
}

.migrate-browse-input-row .form-input {
  flex: 1;
}

.migrate-browse-panel {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  max-height: 260px;
  overflow-y: auto;
}

.migrate-browse-crumb {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* Why the picker is showing a folder other than the one the box names. A
   notice rather than an error: nothing has gone wrong, the folder simply is
   not there yet, which for a cloned template is the ordinary case. */
.migrate-browse-note {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-alt);
}

.migrate-browse-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
}

.migrate-browse-entry:hover {
  background: var(--surface-hover);
}

/* The folder-name span carries the row's hx-get navigation, so it grows to
   fill the row - clicking anywhere except "Use this folder" navigates, the
   same affordance the old whole-row click handler gave. */
.migrate-browse-entry-name {
  flex: 1 1 auto;
}

.migrate-browse-entry-select {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--accent);
}

.runbook-ref-group {
  margin-top: 14px;
  display: grid;
  gap: 6px;
}

.runbook-ref-group-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.runbook-ref-step {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}

.runbook-ref-name {
  font-weight: 600;
}

.runbook-ref-badge {
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.runbook-ref-hint {
  font-size: 11px;
  color: var(--sev-warn-text);
}

.runbook-ref-options {
  display: grid;
  gap: 4px;
}

.runbook-ref-option {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 10px;
  align-items: baseline;
  text-align: left;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}

.runbook-ref-option:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.runbook-ref-option code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  word-break: break-all;
}

.runbook-ref-option span {
  color: var(--text-muted);
}

@media (max-width: 860px) {
  .runbook-step-action-pickers {
    grid-template-columns: 1fr;
  }

  .runbook-ref-option {
    grid-template-columns: 1fr;
  }
}

.runbook-json-details summary {
  cursor: pointer;
  font-weight: 600;
}

.runbook-json-details .code-textarea {
  margin-top: 12px;
  min-height: 220px;
  max-height: none;
}

/* Only the spacing above the box: the box itself is the shared .danger-zone. */
.runbook-danger-zone {
  margin-top: 0;
}

@media (max-width: 1180px) {
  .runbook-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .runbook-step-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .runbook-meta-grid {
    grid-template-columns: 1fr;
  }
}

.pkg-edit-preview-shell {
  display: grid;
  gap: 10px;
}

.pkg-edit-preview-frame {
  display: grid;
  gap: 16px;
}

.pkg-edit-preview-loading {
  margin: 0;
}

.pkg-edit-entry-list,
.pkg-edit-check-groups,
.pkg-edit-check-list {
  display: grid;
  gap: 12px;
}

.pkg-edit-preview-entry {
  display: grid;
  gap: 10px;
}

.pkg-edit-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pkg-edit-entry-detail {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.pkg-edit-section-desc {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.pkg-edit-check-group {
  display: grid;
  gap: 10px;
}

.pkg-edit-check-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pkg-edit-check-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.pkg-edit-param-list {
  display: grid;
  gap: 8px;
}

.pkg-edit-check-head {
  align-items: flex-start;
}

.pkg-edit-check-head-left {
  min-width: 0;
  flex: 1 1 auto;
}

.pkg-edit-check-group-head-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pkg-edit-check-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  min-width: 0;
}

.pkg-edit-check-anchored {
  color: var(--text-muted);
  font-size: 12px;
}

.pkg-edit-fail-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  padding-top: 1px;
}

.pkg-edit-fail-label {
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.pkg-edit-param-summary {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}

.pkg-edit-param-row {
  display: grid;
  grid-template-columns: minmax(120px, 40%) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.pkg-edit-param-name {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  word-break: break-word;
}

.pkg-edit-param-value {
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Only the spacing above the box: the box itself is the shared .danger-zone. */
.pkg-edit-danger-zone {
  /* 20px, matching the environment editor's variant. This was 3mm - a physical
     unit in a screen stylesheet, rendering about 11px, which left this card
     sitting noticeably tighter under the one above it than every other Danger
     Zone. Since the box itself moved onto the shared .danger-zone, the
     margin-top is the only thing a variant still sets, so an odd value here is
     the whole of the remaining difference. */
  margin-top: 20px;
}

.pkg-edit-fail-pill {
  flex-shrink: 0;
  align-self: center;
}

@media (max-width: 960px) {
  .pkg-edit-overview-body {
    grid-template-columns: 1fr;
  }

  .pkg-edit-field-row {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: start;
  }

  .pkg-edit-fail-wrap {
    margin-left: 0;
  }

  .pkg-edit-fail-pill {
    align-self: stretch;
  }
}

/* Danger zone card */
/* --- Danger zone ---
   One component, five call sites (environment, environment data cache, runbook,
   compare package, validate package). It was five near-copies: each page
   restated the flex row and its own vertical padding, and each template carried
   `style="margin-bottom:8px;color:var(--danger)"` on the heading plus
   `style="margin:0"` on the hint. Those inline styles never touched the h2's
   *top* margin, so the browser default (0.83em, ~17px here) stayed - which is
   why every danger zone had visibly more white above "Danger Zone" than under
   the sentence below it.

   Now the whole box lives here and the variants below set only their margin-top.
   Measured on the environment page, the gap from the box's top edge to the cap
   of the "D" is 16.1px against 15.6px from the hint's baseline ink to the bottom
   edge - equal to within half a pixel. Both halves matter: zeroing the margins
   alone still left the heading's leading (the 1.6 body line-height on a 21px
   font) reopening the gap by another route, hence line-height: 1.15. */
.danger-zone {
  border-color: rgba(217, 96, 96, 0.35) !important;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* The danger zone's heading. A class of its own rather than the descendant
   `.danger-zone .form-section-title` it was: `.form-section-title` has no base
   rule anywhere in this sheet, so the same class reads as a styled heading in a
   danger zone and as a bare h2 everywhere else, and a template using it looked
   right or wrong depending on where it happened to sit. */
.danger-zone-title {
  margin: 0;
  line-height: 1.15;
  color: var(--danger);
}

.danger-zone .form-hint {
  margin: 0;
}

.danger-zone form {
  margin: 0;
  display: flex;
  align-items: center;
}

@media (max-width: 640px) {
  .danger-zone {
    flex-direction: column;
    align-items: stretch;
  }
}

/* HTMX loading overlay for long-running requests.
   The element carries popover="manual" so it renders in the top layer, above an
   open <dialog class="modal"> (see js/loading.js and issue #166). The UA
   stylesheet gives [popover] a centred, auto-sized, bordered box; every property
   below that looks redundant is undoing one of those, so the overlay is the
   full-viewport shield it has always been. */
.htmx-loading {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  overflow: visible;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 18, 0.62);
  backdrop-filter: blur(2px);
  z-index: 9999;
}

.htmx-loading-card {
  min-width: 240px;
  max-width: 90vw;
  padding: 20px 24px;
  border-radius: 12px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-hover);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

/* The shared box every animation is drawn inside. Which animation is a THEME
   setting (internal/theme's "Loading overlay"): the "loading-overlay" partial puts
   one .htmx-loading-spinner-<kind> class here, and the stylesheet owns what each
   kind draws - so a theme picks from a list rather than supplying CSS. Keep the
   three the same 38px box, or the card resizes depending on the theme. */
.htmx-loading-spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Ring - the default. Drawn entirely with a border on the box, so it needs no
   child elements. */
.htmx-loading-spinner-ring {
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: htmx-spin 0.8s linear infinite;
}

/* Dots - three, rising and falling in sequence. The negative delays start the
   cycle already in progress, so the three are never momentarily identical. */
.htmx-loading-spinner-dots > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: htmx-dot 1.05s ease-in-out infinite;
}

.htmx-loading-spinner-dots > span:nth-child(1) { animation-delay: -0.32s; }
.htmx-loading-spinner-dots > span:nth-child(2) { animation-delay: -0.16s; }

/* Bar - an indeterminate sweep. The track is the box; the child is the travelling
   fill, so there is one element and no width animation to reflow. */
.htmx-loading-spinner-bar {
  width: 120px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  display: block;
}

.htmx-loading-spinner-bar > span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: htmx-sweep 1.15s ease-in-out infinite;
}

.htmx-loading-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.htmx-loading-text {
  font-size: 12px;
  color: var(--text-muted);
}

body.is-loading .main-content {
  opacity: 0.78;
}

.htmx-loading.is-visible,
body.is-loading #htmx-loading.is-visible,
body.is-loading .htmx-loading.is-visible,
.htmx-request #htmx-loading,
.htmx-request .htmx-loading,
.htmx-loading.htmx-request {
  display: flex;
}

@keyframes htmx-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes htmx-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

@keyframes htmx-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* =====================================================
   Shared modal - the ONE modal in this app (issue #166)
   =====================================================

   A native <dialog>, opened with showModal() by js/modal.js. That is what gives
   the focus trap, Escape, aria-modal and ::backdrop for nothing; the four
   hand-rolled families this replaced (pkgd-modal-*, fm-modal-*, a second native
   dialog, and bare confirm()) each had to implement or forget those separately,
   and their two z-index bands stacked differently against the loading overlay.

   Structure - see cmd/website/README.md's "Modals":

     <dialog class="modal" aria-label="...">   (add .modal-wide for a wide card)
       [ modal-head partial ]
       <div class="modal-steps"> optional step chips </div>
       <div class="modal-body">  the only scrolling part </div>
       <div class="modal-foot">  actions </div>
     </dialog>

   No z-index: an open dialog is in the top layer, above everything with one
   exception, the loading overlay, which is promoted there too (above). */
dialog.modal {
  /* Undo the UA box so the card below is the whole dialog. */
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  width: min(860px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  overflow: visible;
}

/* [open] rather than the bare element: a dialog in the DOM but not yet shown
   must stay laid out as display:none, which is the UA default. */
dialog.modal[open] {
  display: flex;
  flex-direction: column;
}

dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

/* The loading overlay is a full-screen click shield - a click passing through a
   dimmed page could double-fire a long job. It cannot shield an open modal by
   covering it: while a modal dialog is showing, everything outside it is inert
   and so is not hit-tested, whatever the paint order. This restores the shield
   for the one region that needs it, on the same signal (.is-visible) and so at
   the same moment the overlay itself appears. */
body:has(#htmx-loading.is-visible) dialog.modal[open] {
  pointer-events: none;
}

/* The two width variants. Both are qualified with .modal as well as dialog, so
   they beat the base rule above on specificity rather than on source order -
   an unqualified class here would tie with it and silently lose.
   .modal-wide: a card holding a table rather than a form.
   .modal-narrow: a card holding a short list (the runbook reference picker). */
dialog.modal.modal-wide { width: min(1100px, calc(100vw - 48px)); }
dialog.modal.modal-narrow { width: min(640px, calc(100vw - 48px)); }
dialog.modal.modal-html-designer {
  width: calc(100vw - 48px);
  height: calc(100vh - 48px);
}

/* --- The Mermaid viewer (the "mermaid-viewer" partial, mermaid-view.js) ---
   A diagram on the left, drawn by the script into the stage, or its Mermaid
   text in its place; the options, the key and a word on Mermaid down the
   right; the ways of taking the text away along the foot. The form is the
   dialog's one flex child after its head, so it takes the height the
   near-full-screen dialog has and hands it to the stage. */
.mermaid-viewer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  flex: 1;
  min-height: 0;
}

.mermaid-viewer-switch {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.mermaid-viewer-summary {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* Neither panel shows until a radio names it, as on every strip. */
.mermaid-viewer-stage,
.mermaid-viewer-source {
  display: none;
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
}

#mermaid-tab-diagram:checked ~ .mermaid-viewer-stage,
#mermaid-tab-source:checked ~ .mermaid-viewer-source {
  display: block;
}

#mermaid-tab-diagram:checked ~ .mermaid-viewer-switch .tab-label[for="mermaid-tab-diagram"],
#mermaid-tab-source:checked ~ .mermaid-viewer-switch .tab-label[for="mermaid-tab-source"] {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--accent);
}

.mermaid-viewer:has(> input[name="tab"]:focus-visible) .mermaid-viewer-switch {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* The stage clips what it holds: the drawing is panned and zoomed by moving
   the SVG's viewBox, so it never needs to scroll. */
.mermaid-viewer-stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 18px 18px,
    var(--surface);
  cursor: grab;
  touch-action: none;
}

.mermaid-viewer-stage.is-panning {
  cursor: grabbing;
}

.mermaid-viewer-drawing {
  position: absolute;
  inset: 0;
}

.mermaid-viewer-drawing > svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none !important;
}

.mermaid-viewer-drawing .mermaid-viewer-problem {
  margin: var(--space-4);
  color: var(--sev-prob-text);
}

/* A node a press opens a page from wears the dotted rule a link wears at
   rest, on its words, so which shapes lead somewhere is visible before the
   pointer finds one: a child workflow drawn closed is a link to its own page,
   and read as an ordinary step until it was hovered. */
.mermaid-viewer-drawing .is-linked {
  cursor: pointer;
}

.mermaid-viewer-drawing .is-linked .nodeLabel,
.mermaid-viewer-drawing .is-linked text {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

/* A code inside a diagram's node (internal/mermaid's Code): a pill tinted
   by what it names, so a node quoting five users, three cost centres or two
   companies says so before it is read. The rules are not scoped to the
   viewer: Mermaid measures a label in an element of its own on the body
   before it draws it, and a node sized without these rules would cut its
   pills off. The tint mixes a hue with transparency, so it reads on either
   theme's node fill, and the text keeps the node's own colour. */
.mermaid-code {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--mermaid-code-hue, #64748b) 45%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--mermaid-code-hue, #64748b) 20%, transparent);
  font-family: var(--font-mono);
  font-size: 0.92em;
  line-height: 1.45;
  white-space: nowrap;
}

.mermaid-code-user { --mermaid-code-hue: #3b82f6; }
.mermaid-code-group { --mermaid-code-hue: #0ea5e9; }
.mermaid-code-role { --mermaid-code-hue: #8b5cf6; }
.mermaid-code-dimension { --mermaid-code-hue: #f59e0b; }
.mermaid-code-company { --mermaid-code-hue: #10b981; }
.mermaid-code-value { --mermaid-code-hue: #64748b; }

/* A code struck through: a user who is disabled. */
.mermaid-code.mermaid-off {
  text-decoration: line-through;
  opacity: 0.65;
}

/* A counted list: its head, then a code a line, read down the left; past
   five codes (mermaid-across) they are read across instead, so a long list
   does not make a tall node. The line breaks the label carries for a
   renderer drawing the words alone are hidden here, where the list is a
   block of its own. */
.mermaid-list {
  display: block;
  margin: 3px 0 2px;
  text-align: left;
}

.mermaid-list br,
br:has(+ .mermaid-list),
.mermaid-list + br {
  display: none;
}

.mermaid-count {
  display: block;
  font-weight: 600;
}

.mermaid-item {
  display: block;
  line-height: 1.6;
}

/* Read across, the codes wrap onto as many rows as they need within a node
   of a readable width. Mermaid draws a label on one line (white-space:
   nowrap), so without this a list of fourteen users was one row as wide as
   all of them; each code and its name stay together, and wrap as one. */
.mermaid-list.mermaid-across {
  max-width: 30em;
  white-space: normal;
}

.mermaid-across .mermaid-item {
  display: inline-block;
  margin-right: 6px;
  white-space: nowrap;
}

.mermaid-across .mermaid-item .mermaid-code {
  margin-bottom: 2px;
}

.mermaid-viewer-zoom {
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-3);
  display: flex;
  gap: 4px;
}

/* Text whose lines mean something, so it keeps them and scrolls. */
.mermaid-viewer-source {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  overflow: auto;
  white-space: pre;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--surface);
  color: var(--text);
}

.mermaid-viewer-side {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
  border-left: 1px solid var(--border);
}

.mermaid-viewer-heading {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mermaid-viewer-heading:first-child {
  margin-top: 0;
}

.mermaid-viewer-options .form-label-check {
  margin-bottom: var(--space-2);
}

/* Sentences about what the drawing leaves out: information, not a fault. */
.mermaid-viewer-notes {
  margin: var(--space-3) 0 0;
  padding-left: var(--space-4);
  color: var(--text-muted);
  font-size: 12.5px;
}

.mermaid-viewer-legend {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--text-muted);
}

.mermaid-viewer-legend li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 6px;
}

/* A key's swatch is the outline a diagram's source gives the class it names,
   set on each swatch as an inline style from the class's own Mermaid style
   (mermaidSwatch), so no colour of a diagram is written here a second time.
   This rule is what a style leaves unsaid: a class with no stroke of its own
   is drawn in the muted text colour, solid and two pixels wide. */
.mermaid-key {
  flex-shrink: 0;
  width: 18px;
  height: 12px;
  border: 2px solid var(--text-muted);
  border-radius: 3px;
}

/* Several outlines the same words stand for (a group in each colour drawn),
   side by side before them. */
.mermaid-key-swatches {
  display: inline-flex;
  flex-shrink: 0;
  gap: 3px;
}

/* A line's swatch: a stroke in the line's own style, with an arrow head
   where the line ends in one. */
.mermaid-key-line {
  position: relative;
  flex-shrink: 0;
  width: 26px;
  height: 0;
  margin-right: 4px;
  border-top: 2px solid var(--text-muted);
}

.mermaid-key-line.is-solid { border-top-style: solid; }
.mermaid-key-line.is-dotted { border-top-style: dotted; }
.mermaid-key-line.is-thick { border-top-width: 4px; }

.mermaid-key-line.has-head::after {
  content: "";
  position: absolute;
  right: -5px;
  top: -6px;
  border: 5px solid transparent;
  border-left: 6px solid var(--text-muted);
  border-right-width: 0;
}

/* A code's key is the pill itself, drawn small. */
.mermaid-key.mermaid-key-code {
  height: 10px;
  border-width: 1px;
  border-color: color-mix(in srgb, var(--mermaid-code-hue, #64748b) 45%, transparent);
  background: color-mix(in srgb, var(--mermaid-code-hue, #64748b) 20%, transparent);
}

.mermaid-viewer-foot {
  grid-column: 1 / -1;
  grid-row: 3;
  flex-wrap: wrap;
}

/* A phone has no room beside the drawing, so the options go under it. */
@media (max-width: 760px) {
  .mermaid-viewer {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(320px, 1fr) auto auto;
  }

  .mermaid-viewer-side {
    grid-column: 1;
    grid-row: 3;
    border-left: 0;
    border-top: 1px solid var(--border);
    max-height: 40vh;
  }

  .mermaid-viewer-foot {
    grid-row: 4;
  }
}

.automate-html-designer-body {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: var(--space-3);
  min-height: 0;
}

.automate-html-source,
.automate-html-preview {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.automate-html-source textarea,
.automate-html-preview iframe {
  width: 100%;
  min-height: 0;
  flex: 1;
}

.automate-html-preview iframe {
  border: 1px solid var(--border);
  background: #fff;
}

.automate-selection-lasso {
  fill: color-mix(in srgb, var(--accent) 16%, transparent);
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-2);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.modal-steps {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: 0 var(--space-4) var(--space-2);
}

/* The body is the only scrolling part, so the head, steps and foot stay put. */
.modal-body { padding: var(--space-2) var(--space-4); overflow-y: auto; flex: 1; }

/* A dialog that is one form: the form takes the dialog's room below the head
   and holds the body and the foot as its own two parts, so the buttons that
   submit it are outside what scrolls.

     <dialog class="modal">
       [ modal-head partial ]
       <form class="modal-form">
         <div class="modal-body">  the fields, and the only scrolling part </div>
         <div class="modal-foot">  Cancel and the submit button </div>
       </form>
     </dialog>

   The form used to carry .modal-body itself with the foot as its last child,
   which made the foot part of what scrolls: the New workflow dialog grew a
   list of nine triggers and its only two buttons sat 250px below a 950px
   window. min-height: 0 is what lets the form be shorter than its content,
   which a flex item is not by default. */
.modal-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.modal-foot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}

/* A foot whose buttons sit together at the bottom right, as a wizard's do:
   the modals of Comply's role designs, conflict rules and Process map. */
.modal-foot.is-end { justify-content: flex-end; }

/* Pushes what follows to the right edge of a head or foot row. */
.modal-spacer { flex: 1; }

/* Full-bleed on a narrow viewport: a centred card with margins wastes the room
   a stepped configurator needs most. */
@media (max-width: 620px) {
  dialog.modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .automate-html-designer-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(240px, 1fr) minmax(240px, 1fr);
  }
}

/* =====================================================
   Light Theme  (toggled by data-theme="light" on <html>)
   ===================================================== */
html[data-theme="light"] {
  --bg:               #f0f2f7;
  --surface:          #ffffff;
  --surface-hover:    #f4f6fa;
  --surface-elevated: #eef0f6;
  --surface-raised:   #eef0f6;
  --border:           #d5d9e8;
  --border-hover:     #b8becc;
  --accent:           #009e84;
  --accent-dim:       rgba(0, 158, 132, 0.12);
  --accent-hover:     #008a73;
  --text:             #1a1d28;
  --text-muted:       #5a6278;
  --text-faint:       #9aa0b4;
  --sev-ok-bg:        rgba(60, 160, 40, 0.12);
  --sev-ok-text:      #2e7a14;
  --sev-info-bg:      rgba(40, 110, 200, 0.10);
  --sev-info-text:    #2258a8;
  --sev-warn-bg:      rgba(180, 120, 0, 0.10);
  --sev-warn-text:    #8c6000;
  --req-conditional-text: #a38500;
  --sev-warn-border:  rgba(180, 120, 0, 0.30);
  --sev-prob-bg:      rgba(200, 40, 40, 0.10);
  --sev-prob-text:    #b01818;
  --sev-neut-text:    #606878;
  --cell-ok-bg:       rgba(60, 160, 40, 0.06);
  --cell-info-bg:     rgba(40, 110, 200, 0.11);
  --cell-warn-bg:     rgba(220, 150, 0, 0.16);
  --cell-prob-bg:     rgba(200, 40, 40, 0.12);
}

/* Only darken the fallback static logo images on light background. */
html[data-theme="light"] img.brand-logo,
html[data-theme="light"] img.brand-logo-icon {
  filter: brightness(0);
}

/* Loading overlay adjustments for light background */
html[data-theme="light"] .htmx-loading {
  background: rgba(200, 204, 216, 0.65);
}

html[data-theme="light"] .htmx-loading-card {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .htmx-loading-spinner-ring {
  border-color: rgba(0, 0, 0, 0.10);
  border-top-color: var(--accent);
}

html[data-theme="light"] .htmx-loading-spinner-bar {
  background: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .btn-primary {
  color: #fff;
}

html[data-theme="light"] .btn-primary:hover:not(:disabled) {
  color: #fff;
}

html[data-theme="light"] .exec-path-sql,
html[data-theme="light"] .kind-sql,
html[data-theme="light"] .pkg-src-sql {
  background: rgba(245, 208, 66, 0.20);
  color: #8a6a00;
}

/* ─ Metadata Explorer ─────────────────────────────────────────────── */
.advanced-search-panel {
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.advanced-search-toggle {
  cursor: pointer;
  font-size: 0.82em;
  color: var(--text-muted);
  user-select: none;
  list-style: none;
}

.advanced-search-toggle::-webkit-details-marker { display: none; }

.advanced-search-toggle::before {
  content: '▸ ';
  font-size: 0.75em;
}

details[open] .advanced-search-toggle::before {
  content: '▾ ';
}

/* Boolean indicator icons in explorer list and detail tables - match row font-size (13px) */
.explorer-table .num-col svg,
.explorer-detail-table .num-col svg,
.tables-indexes-table .num-col svg {
  width: 15px;
  height: 15px;
  display: block;
  margin: 0 auto;
}

/* Icon/badge columns (Key, Req, Edit, Cmp, Obs, Ext in the Fields table;
   Unique, Duplicates in the Indexes table) on the Data Entity and Table
   Explorer detail pages - centers the header label above the
   already-centered icon (.num-col svg above), instead of leaving it
   left-aligned like the text columns. */
/* Icon columns are CENTRED, not right-aligned, even though they carry .num-col:
   the glyph is centred in its cell by .num-col svg above, and the header label
   belongs over it. Qualified th/td so it matches the base's .num-col rule on
   specificity and wins on source order, as it did before the consolidation. */
.data-table th.icon-col,
.data-table td.icon-col {
  text-align: center;
}

/* Fields-table icon columns only carry a single glyph/badge, so they don't
   need the same horizontal padding as text columns - narrowing them frees
   up width for the columns that actually need it (Label, Type, Country). */
.data-table.explorer-detail-table th.icon-col,
.data-table.explorer-detail-table td.icon-col {
  width: 40px;
  padding-left: 8px;
  padding-right: 8px;
}

/* A heading that sorts the table needs room for its arrow, and at 40px an icon
   column had none: the table's layout is fixed, so EDIT already ran to the
   column's edge and an arrow after it ran into the next heading. 52px holds
   the widest of these labels with 12px on its right for the arrow, heading
   and cells alike so the label stays over its icons. */
.data-table.explorer-detail-table.is-sortable th.icon-col,
.data-table.explorer-detail-table.is-sortable td.icon-col {
  width: 52px;
  padding-right: 12px;
}

/* The 148px below plus 12px for the arrow. */
.data-table.explorer-detail-table.is-sortable .country-col {
  width: 160px;
}

/* Fields table column sizing - table-layout:auto's default "size each
   column to its widest single cell" rule badly misjudges this table: Name
   (an unbroken camelCase identifier) forces a wide column even though most
   rows are much shorter, while Label (ordinary wrapping text) gets
   squeezed down and wraps onto two lines. Switch to a fixed layout and give
   every narrow/structured column (icons, badges, Country, Source · Field)
   an explicit width, leaving Name and Label as the only unconstrained
   columns so they split the real remaining space evenly - the two columns
   that actually need it most. Long unbroken identifiers then wrap within
   their fixed-width cell instead of stretching the column. */
.explorer-detail-table {
  table-layout: fixed;
  min-width: max-content;
}

/* Name and Label are the two auto columns, and under a fixed layout an auto
   column is given whatever the fixed ones leave over. On the Data Entity
   Explorer the fixed ones come to 756px, which a laptop with the sidebar open
   does not have: Name and Label were drawn nothing wide, a field's name stood a
   letter to a line and their headings were drawn on top of Type's. A heading
   cannot be given a min-width - a fixed layout ignores one - so each carries a
   zero-height spacer instead, and min-width: max-content above makes the table
   at least as wide as its headings ask: the fixed widths plus 128px for each of
   the two. Narrower than that, the table scrolls in its frame rather than the
   two columns giving up their room; wider, they share what is left as before.
   100px is the spacer, the roomy heading's 28px of padding the rest. */
.data-table.explorer-detail-table th.fields-name-col::before,
.data-table.explorer-detail-table th.fields-label-col::before {
  content: '';
  display: block;
  width: 100px;
  height: 0;
}

/* The frame the Fields table scrolls in is a size container, so the enum panel
   below can be held to the width the reader can see (100cqi) rather than the
   table's, which may be wider than the frame. */
.explorer-fields-frame {
  container-type: inline-size;
}

.data-table.explorer-detail-table td {
  overflow-wrap: anywhere;
}

.explorer-detail-table .num-col:not(.icon-col) {
  width: 56px;
}

/* 80px, not the 56px of the other number columns. Size holds a decimal's precision and scale
   as SQL Server writes them, and "(38,38)" - SQL Server's widest - is seven characters, about
   78px at the cell's 13px with its 28px of padding; at 56 it wrapped onto two lines. The
   selector matches the one above's weight and comes after it, so it wins. */
.explorer-detail-table .num-col.size-col {
  width: 80px;
}

.explorer-detail-table .type-col {
  width: 84px;
}

/* 256px, not the 150px this was. The column holds an EDT or enum type name in a
   mono badge, and at 150px anything past about 12 characters wrapped onto a second
   or third line - RentalPhysicalStatus, RentalAgreementStatus and
   CustVendorBlocked all did, which made the Fields table look ragged and the enum
   disclosure hard to aim at. Measured: the badge is 12px mono with 14px of its own
   padding, the disclosure caret and its gap take 19px and the cell 28px, so
   BankCentralBankPurposeText - the longest name this stylesheet already names as a
   worst case, at 26 characters - needs 249px. Name and Label are the table's two
   auto columns and had the room to give.
   The wrap below is kept as the fallback, not the normal case: a name longer than
   this still wraps inside its cell rather than overflowing into Size. */
.explorer-detail-table .typebadge-col {
  width: 256px;
}

/* 148px: a Country cell draws at most five flags and a "+n" (the
   "country-flags" partial), and they are held to one line, since a column that
   let them wrap drew three flags over three and doubled the height of every
   localized field's row. Five 20px flags, their gaps and a two-digit pill come
   to 142px; the header, "COUNTRY" uppercase and nowrap, needs 80px. */
.explorer-detail-table .country-col {
  width: 148px;
}
.data-table.explorer-detail-table td.country-col {
  white-space: nowrap;
}

/* 170px is the floor. In the Data Entity Explorer's Fields table the column
   also takes a tenth of what Name and Label share: they are its two auto
   columns and split what the fixed ones leave, and a Source · Field cell (a
   table and its column, two codes) wrapped onto three lines at 170px while
   Name and Label had room to spare. Their share is the frame less the fixed
   columns' 822px (with seven Attributes slots; the eight or nine a table now
   draws add 18px or 36px, which moves a tenth by 2px or 4px and is left
   out of the sum), so a tenth of each of them is 10cqi less 82px, which with
   the 170px is 10cqi + 88px: at 1500px wide Name goes from 181px to 163px and
   Source from 170px to 206px, at 1920px from 391px to 352px and 248px. cqi
   is the frame's width (.explorer-fields-frame is a size container), and a
   length rather than a percentage, which a fixed layout reads as auto inside
   a calc(). Where the frame is narrower than the table, Name and Label are at
   their floor and give nothing, and the table scrolls as it did. */
.explorer-detail-table .source-col {
  width: 170px;
}
.explorer-fields-frame .explorer-detail-table .source-col {
  width: max(170px, calc(10cqi + 88px));
}

/* The fields an explorer's advanced search matched, a line each under the
   record's name in the list, so a row says why it is there. */
.explorer-matched {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  font-size: 12px;
}
.explorer-matched-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}
.explorer-matched-field { overflow-wrap: anywhere; }

/* --- Discover: Wizard search ---
   The steps one form of numbered rows, each answer in sight beside the
   others, then the results a row each: how likely, what it is, why. */
.discover-wizard-form { display: grid; gap: var(--space-3); }
.discover-wizard-steps {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.discover-wizard-step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.discover-wizard-step-body {
  display: grid;
  gap: 6px;
  min-width: 0;
  max-width: 760px;
}
.discover-wizard-env { max-width: 360px; }
.discover-wizard-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}
.discover-wizard-fieldset > legend {
  padding: 0;
  margin-bottom: 6px;
}
.discover-wizard-kinds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  width: 100%;
}
.discover-wizard-related {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.discover-wizard-related > div { display: grid; gap: 6px; align-content: start; }
.discover-wizard-actions { display: flex; justify-content: flex-start; }
.discover-wizard-results { margin-top: var(--space-4); }
.discover-wizard-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.discover-wizard-result {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 4px 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.discover-wizard-likelihood {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-row: span 2;
}
.discover-wizard-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-elevated);
  overflow: hidden;
}
.discover-wizard-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.discover-wizard-pct { font-size: 12px; min-width: 34px; text-align: right; }
.discover-wizard-what {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
}
.discover-wizard-type { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.discover-wizard-owner { font-size: 12px; }
.discover-wizard-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--text-muted);
}
@media (max-width: 640px) {
  .discover-wizard-result { grid-template-columns: minmax(0, 1fr); }
  .discover-wizard-likelihood { grid-row: auto; }
}

/* A cell's own modal control in a Discover detail table: the way a field is
   read to its column (the Source · Field cell), the entities stored in a
   form's or a table's column. A button of the shared vocabulary, held to
   22px so it sits on the line of the codes beside it rather than making every
   row it appears on taller than the rows around it. */
.btn.btn-icon-only.explorer-cell-modal-btn {
  width: 22px;
  height: 22px;
  margin-left: 4px;
  vertical-align: middle;
}
.btn.explorer-cell-modal-btn .btn-icon {
  width: 14px;
  height: 14px;
}
/* The count beside it, where the control opens a list. */
.explorer-cell-modal-count {
  font-size: 12px;
  margin-left: 2px;
  vertical-align: middle;
}

/* A count of the data entity fields stored in a column, pressed to list
   them: the Table Explorer's and the Form Explorer's Entities cells. 84px
   holds the heading and a three-digit count beside its icon. Qualified with
   .num-col to match the weight of the 56px number column rule above, whose
   :not() counts as a class: written as .entities-col alone it lost, and the
   heading was cut to "ENTITI". */
.explorer-detail-table .num-col.entities-col { width: 84px; }
.btn.explorer-entities-btn { gap: 4px; }
.btn.explorer-entities-btn .btn-icon { width: 14px; height: 14px; }

/* The plus after the first five of a form's entities or menu items. */
.btn.form-header-more { gap: 2px; }
.btn.form-header-more .btn-icon { width: 14px; height: 14px; }

/* The modal listing a column's entity fields, and a form's entities and
   menu items: a search over a table held to the modal's height. */
.column-entities-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}
.column-entities-search { max-width: 320px; }
.data-table.column-entities-table td,
.data-table.form-entities-table td,
.data-table.form-menu-items-table td { vertical-align: top; }
.column-entities-frame { max-height: 60vh; overflow: auto; }
.data-table .column-entities-category-col { width: 160px; }
.data-table .column-entities-how-col { width: 180px; }
.data-table .form-entities-rank-col { width: 40px; }

/* The steps of a field's way to its column, one line over the table that
   lists them. */
.explorer-source-line code {
  white-space: normal;
  overflow-wrap: anywhere;
}
.data-table.explorer-source-table th.explorer-source-step-col { width: 56px; }
.explorer-source-step.is-here td { font-weight: 600; }
.explorer-source-kind {
  display: block;
  font-size: 11px;
}

/* .type-badge normally sets white-space:nowrap (fine at its natural width
   elsewhere), but the Fields table's Type/EDT badge column is a fixed width - a
   name longer than it fits (past "BankCentralBankPurposeText", which the width
   above is sized for) would overflow the column and visually bleed into Size/Req
   instead of wrapping. */
.explorer-detail-table .typebadge-col .type-badge {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* --- Data Entity Explorer: the Attributes column ---
   Every yes-or-no fact about a field in one column of fixed slots (Key, Number
   sequence, Mandatory, Editable, Computed, Obsolete, Extension, Validate checks
   and, on an entity carrying an address, Address format), each 15px with 3px
   between, so a fact sits at the same x on every row. The table says how many
   slots its rows draw (--attr-slots, AttrSlotCount): n slots are 18px each
   less the last gap, inside the roomy cell's 28px of padding and 5px over for
   the heading's sort arrow after ATTRIBUTES, so eight slots are 174px and nine
   192px. It was a fixed 156px for seven, which nine slots ran out of. A fact
   the field has not got is a faint copy of its own icon; a slot nobody has
   read is empty. */
.data-table.explorer-detail-table .attrs-col {
  width: calc(var(--attr-slots, 7) * 18px + 30px);
}

.attrs {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 15px;
  gap: 3px;
  vertical-align: middle;
}

.attr-slot {
  display: block;
  width: 15px;
  height: 15px;
}

/* A numbered field's slot opens the number sequences modal: a button drawn as
   nothing but its icon. */
button.attr-slot {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 3px;
}

button.attr-slot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

svg.attr-ico {
  display: block;
  width: 15px;
  height: 15px;
}

svg.attr-seq   { color: var(--accent); }
svg.attr-on    { color: var(--text); }
svg.attr-obs   { color: var(--sev-prob-text); }
svg.attr-ghost { color: var(--text-muted); opacity: 0.22; }

/* The legend names the slots the column has no headings for; each entry is a
   press that sorts the table by it. */
.explorer-attr-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0 0 8px;
  font-size: 12px;
}

.explorer-attr-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
}

.explorer-attr-legend-item:hover,
.explorer-attr-legend-item:focus-visible {
  color: var(--text);
  border-color: var(--border);
}

.explorer-attr-legend-item.is-sorted {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* A slot drawn in several states names each after its own words in the
   legend's one entry: Mandatory, conditional, recommended. */
.explorer-attr-legend-variant {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
}

/* Mandatory is one asterisk in three colours, every source's answer
   together (requirementStateOf): mandatory in the colour of a requirement,
   conditional - under a condition, or one of several fields - in a lighter
   amber of its own, and recommended for the record's purpose in the colour
   of information. */
svg.attr-conditional { color: var(--req-conditional-text); }
svg.attr-purpose { color: var(--sev-info-text); }

/* An entity's Enhanced rules (handlers_discover_rules.go): a heading with the
   section's controls at its right, then a table per tier and the published
   facts in a disclosure. Every rule table shares one set of column widths,
   so Enforced and Purpose line up one above the other. */
.entity-rules {
  margin: 0 0 24px;
}

.entity-rules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.entity-rules-actions {
  display: flex;
  gap: 8px;
}

.entity-rules-intro {
  margin: 0 0 12px;
  max-width: 80ch;
}

.entity-rules-group {
  margin: 0 0 14px;
}

.entity-rules-group-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 13px;
}

.entity-rules-group-title {
  font-weight: 600;
}

.entity-rules-table,
.entity-rules-fields-table,
.entity-rules-suppressions-table {
  table-layout: fixed;
  width: 100%;
}

.data-table.entity-rules-table th.entity-rule-fields-col,
.data-table.entity-rules-fields-table th.entity-rule-fields-col,
.data-table.entity-rules-suppressions-table th.entity-rule-fields-col { width: 24%; }
.data-table.entity-rules-table th.entity-rule-words-col,
.data-table.entity-rules-fields-table th.entity-rule-state-col,
.data-table.entity-rules-suppressions-table th.entity-rule-words-col { width: 24%; }
.data-table.entity-rules-suppressions-table th.entity-rule-actions-col { width: 150px; }
.data-table.entity-rules-table th.entity-rule-origin-col { width: 15%; }
.data-table.entity-rules-table th.entity-rule-evidence-col { width: 76px; }
.data-table.entity-rules-table th.entity-rule-actions-col { width: 150px; }

/* A field's requirement on the rules page: the asterisk the Fields table
   draws, and the state in words beside it. */
.entity-rule-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.entity-rules-fields-table {
  margin-bottom: 20px;
}

.data-table.entity-rules-table td {
  vertical-align: top;
}

.entity-rule-field + .entity-rule-field {
  margin-top: 6px;
}

.entity-rule-countries,
.entity-rule-ignored {
  margin-top: 4px;
  font-size: 12px;
}

.entity-rule-finding {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--sev-warn-text);
}

svg.entity-rule-finding-icon {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

/* A shipped rule this environment ignores still reads, faded, with the pill
   saying why it no longer applies. */
.entity-rule-row.is-ignored > td.entity-rule-fields-col,
.entity-rule-row.is-ignored > td.entity-rule-words-col,
.entity-rule-row.is-ignored > td.entity-rule-reason-col {
  opacity: 0.55;
}

/* The rules page opened at a field (a field's requirement modal, or the
   Routes page) marks its row and every rule naming it. */
.entity-rule-row:target,
.entity-rule-row.is-target > td,
.entity-rules-field-row.is-target > td {
  background: var(--accent-dim);
}

.entity-rules-field-row {
  scroll-margin-top: 96px;
}

.entity-rule-actions-col .btn + .btn {
  margin-left: 4px;
}

/* The rule editor: a label over each control, and a line per field, test or
   piece of evidence, its controls side by side. */
.entity-rule-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 180px);
}

.entity-rule-fieldset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.entity-rule-fieldset > .btn {
  align-self: flex-start;
}

.entity-rule-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.entity-rule-line > .form-select,
.entity-rule-line > .form-input {
  flex: 1 1 0;
  min-width: 0;
}

.entity-rule-line > .entity-rule-op {
  flex: 0 0 150px;
}

.entity-rule-line > .entity-rule-observed {
  flex: 0 0 160px;
}

.entity-rule-logic {
  align-self: flex-start;
  width: auto;
}

.entity-rule-members {
  display: flex;
  flex: 1 1 0;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.entity-rule-choice {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.entity-rule-choice input {
  accent-color: var(--accent);
}

.entity-rule-evidence-detail {
  white-space: pre-wrap;
}

.data-table.entity-rule-evidence-table {
  table-layout: fixed;
  width: 100%;
}

.data-table.entity-rule-evidence-table th.entity-rule-ev-kind-col { width: 200px; }
.data-table.entity-rule-evidence-table th.entity-rule-ev-version-col { width: 120px; }
.data-table.entity-rule-evidence-table th.entity-rule-ev-seen-col { width: 120px; }

/* Why one field is required: its state as the Fields table draws it, then a
   row per source, a rule this environment ignores faded with the pill saying
   so. */
.entity-requirement-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entity-requirement-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.data-table.entity-requirement-table th.entity-requirement-source-col { width: 160px; }

.entity-requirement-table {
  table-layout: fixed;
  width: 100%;
}

.data-table.entity-requirement-table td {
  vertical-align: top;
}

.entity-requirement-rule.is-ignored > td {
  opacity: 0.7;
}

/* What Validate holds one field to: Validate's mark beside the field's code,
   then a row per check rule, its evidence a disclosure in its Why cell. */
.entity-checks-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.entity-checks-lead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.entity-checks-body > .form-hint { margin: 0; }

.entity-checks-table {
  table-layout: fixed;
  width: 100%;
}

.data-table.entity-checks-table th.entity-checks-tier-col { width: 100px; }
.data-table.entity-checks-table th.entity-checks-from-col { width: 140px; }
.data-table.entity-checks-table td { vertical-align: top; }

.entity-checks-evidence { margin-top: 6px; font-size: 12px; }
.entity-checks-evidence summary { cursor: pointer; color: var(--text-muted); }
.entity-checks-evidence ul { margin: 6px 0 0; padding-left: 18px; overflow-wrap: anywhere; }

/* Validate's mark on a check rule, in Validate's own colour where the theme
   gives it one. */
.entity-rule-validate-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px 1px 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
  color: var(--module-validate, var(--accent));
  background: var(--module-validate-dim, var(--accent-subtle));
}

svg.entity-rule-validate-icon { width: 13px; height: 13px; flex: none; }

/* The number sequences modal: a section per numbered field. Its body carries
   its own ceiling, since a dialog clamped by max-height does not re-run the
   flex layout that would hold an auto-height body inside it. */
.explorer-numberseq-body {
  max-height: calc(100vh - 180px);
}

/* The Address format modal (handlers_discover_address.go): a row per
   country, its format and what this environment wants of the part there,
   a three-way switch for an administrator. The body carries its own
   ceiling, as the number sequences modal's does, and the table's head stays
   in sight as the countries scroll under it. */
.address-format-body {
  max-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.address-format-read,
.address-format-summary {
  margin: 0 0 8px;
  font-size: 12px;
}
.address-format-summary { font-size: 13px; }
.address-format-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.address-format-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.address-format-search .form-input { max-width: 320px; }
.address-format-table-wrap {
  overflow: auto;
  min-height: 0;
}
.data-table.address-format-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}
.data-table.address-format-table td { vertical-align: middle; }
.address-format-country-col { width: 28%; }
.address-format-format-col { width: 10%; }
.address-format-by-col { width: 22%; }
.address-format-name { margin: 0 4px; }
.address-format-others { margin-top: 10px; font-size: 12px; }

/* The switch: three pills in a row, the chosen one filled in its
   decision's colour - Required in a requirement's amber, Recommended in
   information's blue, Not needed neutral. The tick is hidden for sight and
   is still the state and what posts. */
.address-state-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.address-state-choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.address-state-choice + .address-state-choice { border-left: 1px solid var(--border); }
.address-state-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.address-state-choice:hover { color: var(--text); }
.address-state-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.address-state-choice:has(input:checked) { font-weight: 600; }
.address-state-required:has(input:checked) { background: var(--sev-warn-bg); color: var(--sev-warn-text); }
.address-state-recommended:has(input:checked) { background: var(--sev-info-bg); color: var(--sev-info-text); }
.address-state-not-needed:has(input:checked) { background: var(--bg); color: var(--text); }

/* A reader who is not an administrator sees the decision as words. */
.address-state { font-size: 12px; font-weight: 600; }
.address-state.address-state-required { color: var(--sev-warn-text); }
.address-state.address-state-recommended { color: var(--sev-info-text); }
.address-state.address-state-not-needed { color: var(--text-muted); }

/* A by-country rule on the Enhanced rules page: what it asks, then the
   countries as flags with "and n more", then the way into the modal. */
.entity-rule-by-country {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.entity-rule-by-country-open { margin-top: 6px; }

.explorer-numberseq-read {
  margin: 0 0 12px;
  font-size: 12px;
}

.explorer-numberseq-field + .explorer-numberseq-field {
  margin-top: 20px;
}

.explorer-numberseq-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 14px;
}

.explorer-numberseq-summary {
  margin: 0 0 8px;
  font-size: 13px;
}

/* A row is two lines: an id or a code, and its name under it. The first
   line holds the "differs" mark against the cell's right edge, so the marks
   line up down the column whatever the id beside them. */
.explorer-numberseq-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.explorer-numberseq-sub {
  margin-top: 2px;
  font-size: 12px;
}

.data-table.explorer-numberseq-table td {
  vertical-align: top;
}

.data-table.explorer-numberseq-table .explorer-numberseq-attrs {
  width: 1%;
  white-space: nowrap;
}

/* The key to the modal's Attributes column, at its foot beside Close. */
.explorer-numberseq-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.explorer-numberseq-key-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* A format and a next number are read whole, never broken at the hyphen. */
.data-table.explorer-numberseq-table td.explorer-numberseq-code {
  white-space: nowrap;
}

/* A company that numbers the field differently from most is the one a
   migration built elsewhere trips over, so it is marked across the row. */
.explorer-numberseq-row.is-different td {
  background: var(--sev-warn-bg);
}

.explorer-numberseq-differs {
  display: inline-block;
  flex: none;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--sev-warn-text);
  color: var(--surface);
  font-size: 11px;
  font-weight: 600;
}

/* --- Field enum values: the disclosure, and the row it opens ---
   The Fields table on both the Table Explorer and the Data Entity Explorer puts an
   expanding disclosure on the EDT / Enum badge. The values used to render inside
   that cell, which .typebadge-col fixes at 150px: a three-column list of value,
   name and label in 150px gave each column one or two characters, and reading an
   enum off it was not possible. Nothing else on a field row expands, so the values
   now go in a row of their own spanning the whole table.

   No script: the row is revealed by :has() on the field row above it, which is how
   a <details> inside a cell can control a sibling <tr> that it cannot contain.

   The summary is a flex row rather than the default list-item: a list-item marker
   makes the badge beside it wrap UNDERNEATH it in the badge column. */
.field-enum > summary {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  list-style: none;
  width: fit-content;
}

.field-enum > summary::-webkit-details-marker {
  display: none;
}

/* An MDI chevron rather than a text glyph, at the 15px every other icon in this
   table uses (.explorer-detail-table .num-col svg - Key, Req, Edit). The glyph it
   replaced was ~10px of a font that draws U+25B8 narrow, so the affordance came out
   two or three pixels wide and read as a rendering artefact rather than a control.
   Rotated rather than swapped for a second icon, so the state change is one asset. */
.field-enum-caret {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--text-muted);
  transition: transform 0.15s;
}

.field-enum[open] > summary .field-enum-caret {
  transform: rotate(90deg);
}

/* A class rather than the hidden attribute: [hidden] is display:none !important
   (see the utilities at the end of this file), which the rule below could not
   override. */
tr.field-enum-row {
  display: none;
}

.explorer-detail-table tr:has(> td > details.field-enum[open]) + tr.field-enum-row {
  display: table-row;
}

/* The panel supplies its own padding and ground, so the cell gives up the roomy
   density's. Ties with .data-table.is-roomy td at (0,2,1) and wins on source
   order, which is why it must stay below the base - see table_test.go. */
.data-table .field-enum-row > td {
  padding: 0;
  background: var(--bg);
}

/* Held to the frame's visible width and to its left edge: the row spans the
   whole table, which can be wider than its frame, and a list of values laid out
   over that width put a column of them past the frame's edge, read only by
   scrolling the table sideways and back. */
.field-enum-panel {
  padding: 10px 14px 12px;
  border-left: 3px solid var(--accent);
  position: sticky;
  left: 0;
  box-sizing: border-box;
  max-width: 100cqi;
}

.field-enum-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.field-enum-count,
.field-enum-for {
  font-size: 11px;
  color: var(--text-faint);
}

.field-enum-for {
  font-family: var(--font-mono);
}

/* auto-fill rather than a column count: a two-value NoYes stays one short line, a
   forty-value enum fills the width instead of running down the page, and a phone
   gets a single column with no media query.
   A track is as wide as the enum's longest name needs, and never narrower than
   19em. The tracks are equal-width 1fr, so the widest member decides whether
   anything has to wrap, and a fixed 19em was narrower than a time zone's name:
   GMTMINUS0600GUADALAJARA_MEXICOCITY_MONTERREY ran into the value beside it and
   its label stood a letter to a line in what was left. The server counts the
   longest name's characters (--enum-name-chars, fieldEnumPanel) and the track is
   that many of the mono font's own characters - the grid is set in it for 1ch to
   be one - plus the number and the gap beside it; on a screen narrower than that
   the track is the screen, and the name wraps. */
.field-enum-grid {
  --enum-name-chars: 12;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  font-family: var(--font-mono);
  font-size: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(19em, calc(var(--enum-name-chars) * 1ch + 2.2em + 9px))), 1fr));
  gap: 2px 18px;
}

.field-enum-item {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  padding: 2px 0;
  font-size: 12px;
  line-height: 1.45;
}

/* The label goes on a line of its own under the name, aligned with the name
   rather than with the number, so it has the track's whole width to be read in.
   Beside the name it had only what the name left over: the tracks are sized for
   the longest name, so a time zone's description was squeezed into the few
   letters of room beside a shorter one, and wrapped there into a column of
   fragments. Under it, a description reads as a description of the name above
   it, which is also how D365 itself pairs the two. */
.field-enum-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Right-aligned in a fixed box so the numbers line up down each column. */
.field-enum-int {
  flex: 0 0 2.2em;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

/* The name is the half that has to be readable in full: it is what a query or a
   script has to spell exactly. The tracks are sized for the longest, so it is on
   one line wherever the screen is wide enough for it, and breaks only where a
   phone is not. */
.field-enum-name {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  font-family: var(--font-mono);
  color: var(--text);
  overflow-wrap: anywhere;
}

/* The label WRAPS rather than truncating - this panel is a reference list
   somebody is reading values off, and an ellipsis there hides the answer. Set in
   the page's own face: the grid around it is mono for its tracks' sake. */
.field-enum-label {
  max-width: 100%;
  font-family: var(--font-body);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* The table list's Obsolete column holds one mark each, so it is as narrow
   as its heading allows: width 1% under the table's auto layout shrinks a
   column to its content, and the padding is just over half a text column's,
   which still leaves the sort arrow room beside the word. */
.data-table.explorer-table th.table-obsolete-col,
.data-table.explorer-table td.table-obsolete-col {
  width: 1%;
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
}
.data-table.explorer-table th.table-obsolete-col {
  letter-spacing: 0.02em;
}

/* The entity list's Attributes column: six slots (OData, Actions, DMF, Read
   only, AOT, Web) of the same 15px and 3px as the Fields table's, as narrow
   as they are. They were four columns of their own and two pills beside the
   entity's name, and took the room the names needed. */
.data-table.explorer-table th.explorer-attrs-col,
.data-table.explorer-table td.explorer-attrs-col {
  width: 1%;
  white-space: nowrap;
}

/* A category as a compact tag, so the list's rows stay one line high. */
.eval-scope.eval-scope-compact {
  font-size: 10px;
  line-height: 1.3;
  padding: 1px 5px;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* Every heading of a Discover list may break at a space, which the table's
   auto layout does only where room runs out: "Public Collection Name" on one
   line made its column wider than any name under it, and that width came
   out of the glyph columns at the right edge. */
.data-table.explorer-table#explorer-list-table th {
  white-space: normal;
  line-height: 1.25;
}

.explorer-table .table-fields-col {
  text-align: right;
}

/* A field D365 has marked obsolete is still listed - it exists, and a query
   naming it still works - but it is not what a reader is looking for, so the
   row stands back instead of reading like the ones above it. */
.explorer-field-obsolete > td {
  color: var(--text-faint);
}

.explorer-table .table-obsolete-col {
  text-align: center;
}

.explorer-table .table-obsolete-col .type-badge {
  display: inline-flex;
  justify-content: center;
}

/* Semantic icon colours used across explorer and table detail pages.
   SVGs use fill:currentColor so the color property drives the fill.
   Variables are already theme-aware (dark/light). */
svg.icon-yes  { color: var(--sev-ok-text);   }
svg.icon-no   { color: var(--sev-prob-text); }
svg.icon-warn { color: var(--sev-warn-text); }

/* ── MCP Explorer ─────────────────────────────────────────────────────────── */
.mcp-explorer { display: flex; flex-direction: column; gap: var(--space-4); }

.mcp-explorer-controls { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.mcp-explorer-row { display: flex; gap: var(--space-3); align-items: flex-end; flex-wrap: wrap; }
.mcp-search-row { display: flex; gap: var(--space-2); align-items: center; }
.mcp-search-group { flex: 1; min-width: 240px; }
.mcp-open-row { border-top: 1px solid var(--border); padding-top: var(--space-3); }
.mcp-open-actions { display: flex; gap: var(--space-2); align-items: flex-end; padding-bottom: 2px; }

.mcp-menu-results { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); padding: var(--space-2); max-height: 220px; overflow-y: auto; }
.mcp-menu-list { display: flex; flex-direction: column; gap: 2px; }
.mcp-menu-item-btn { text-align: left; background: none; border: none; padding: var(--space-1) var(--space-2); border-radius: var(--radius-sm); cursor: pointer; width: 100%; display: flex; align-items: center; gap: var(--space-2); }
.mcp-menu-item-btn:hover { background: var(--surface-hover); }
.mcp-menu-label { color: var(--text-muted); font-size: 0.82em; }
.mcp-menu-loading, .mcp-menu-empty, .mcp-menu-error { padding: var(--space-2); color: var(--text-muted); font-size: 0.85em; }
.mcp-menu-error { color: var(--sev-prob-text); }
.mcp-menu-raw-fallback { font-size: 0.78em; font-family: var(--font-mono); white-space: pre-wrap; word-break: break-all; margin: var(--space-1) var(--space-2); color: var(--text-muted); max-height: 120px; overflow-y: auto; }

.mcp-explorer-body { display: grid; grid-template-columns: 1fr 320px; gap: var(--space-4); align-items: start; }
@media (max-width: 900px) { .mcp-explorer-body { grid-template-columns: 1fr; } }

/* Tree panel */
.mcp-explorer-tree-panel { padding: 0; display: flex; flex-direction: column; min-height: 400px; max-height: 70vh; }
.mcp-tree-toolbar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mcp-tree-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-tree-search { display: flex; gap: var(--space-1); align-items: center; }

.mcp-tree { flex: 1; overflow-y: auto; padding: var(--space-2); }
.mcp-tree-empty { padding: var(--space-4); color: var(--text-muted); text-align: center; font-size: 0.9em; }
.mcp-tree-empty-inline { padding: var(--space-2); font-size: 0.82em; }
.mcp-tree-search-header { padding: var(--space-1) var(--space-2); font-size: 0.8em; font-weight: 600; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: var(--space-2); }

.mcp-tree-list { list-style: none; margin: 0; padding: 0 0 0 16px; }
.mcp-tree-node { margin: 1px 0; }
.mcp-tree-row { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: var(--radius-sm); user-select: none; }
.mcp-tree-row-leaf { cursor: pointer; }
.mcp-tree-row-leaf:hover { background: var(--surface-hover); }
.mcp-tree-row.selected { background: var(--accent-subtle); }
.mcp-tree-icon { font-size: 0.9em; color: var(--text-muted); width: 14px; flex-shrink: 0; }
.mcp-tree-label { font-size: 0.85em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-tree-type { margin-left: 6px; font-size: 0.72em; padding: 1px 5px; background: var(--surface-alt); border-radius: 10px; color: var(--text-muted); }
.mcp-tree-expand-btn { background: none; border: 1px solid var(--border); border-radius: 3px; cursor: pointer; font-size: 0.7em; padding: 1px 5px; color: var(--text-muted); flex-shrink: 0; }
.mcp-tree-expand-btn:hover { background: var(--surface-hover); }

/* Detail panel */
.mcp-explorer-detail-panel { display: flex; flex-direction: column; gap: var(--space-3); }

.mcp-selected-card, .mcp-recorder-card, .mcp-raw-card { padding: var(--space-3); }
.mcp-selected-header { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); font-weight: 600; font-size: 0.85em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.mcp-selected-icon { width: 16px; height: 16px; flex-shrink: 0; }
.btn-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* The same sizing for an icon inside a button whose template did not name a
   class. mdiIcon emits no class attribute when passed "", and an MDI source
   carries only a viewBox, so such an icon falls back to the 24px presentation
   attributes cmd/website's mdiIconFallbackSize injects - noticeably larger than
   the 16px every labelled .btn-icon uses.

   Site-wide rather than scoped to one module: Form Management had 143 unclassed
   icons held at 16px by a `.fm .btn svg` rule, and any other module writing
   {{mdiIcon "x" ""}} inside a button had the same latent problem with no rule to
   catch it. Specificity is deliberately no higher than .btn-icon's, and an icon
   that does name a class is untouched. */
.btn > svg:not([class]) { width: 16px; height: 16px; flex-shrink: 0; }
/* Form Management - inline status icons and colours. Without an explicit size an
   embedded MDI svg (viewBox only, no width/height) renders full-size. */
.form-status-icon { width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.125em; }
.form-tube-done { color: var(--success, #2e7d32); border-color: var(--success, #2e7d32) !important; }
.mcp-recorder-clear { margin-left: auto; }
.mcp-selected-empty { color: var(--text-muted); font-size: 0.85em; padding: var(--space-1) 0; }
.mcp-selected-detail { display: flex; flex-direction: column; gap: 6px; }
.mcp-detail-row { display: flex; align-items: center; gap: var(--space-2); font-size: 0.83em; }
.mcp-detail-key { color: var(--text-muted); min-width: 80px; }
.mcp-detail-val { flex: 1; font-family: var(--font-mono); word-break: break-all; }
.mcp-copy-btn { background: none; border: none; cursor: pointer; padding: 2px; color: var(--text-muted); flex-shrink: 0; }
.mcp-copy-btn:hover { color: var(--text); }
.mcp-copy-icon { width: 14px; height: 14px; }

.mcp-add-step { margin-top: var(--space-3); border-top: 1px solid var(--border); padding-top: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.mcp-step-type-row { display: flex; gap: var(--space-3); }
.mcp-step-type-opt { display: flex; align-items: center; gap: 6px; font-size: 0.85em; cursor: pointer; }

.mcp-steps-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--space-2); }
.mcp-step-row { display: flex; align-items: center; gap: var(--space-2); padding: 4px 6px; background: var(--surface-alt); border-radius: var(--radius-sm); font-size: 0.82em; }
.mcp-step-num { color: var(--text-muted); min-width: 16px; text-align: right; }
.mcp-step-ctrl { font-family: var(--font-mono); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-step-val { color: var(--text-muted); font-size: 0.9em; flex-shrink: 0; }
.mcp-step-del { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0 2px; font-size: 0.9em; flex-shrink: 0; }
.mcp-step-del:hover { color: var(--sev-prob-text); }

.mcp-export-controls { margin-top: var(--space-2); border-top: 1px solid var(--border); padding-top: var(--space-2); display: flex; flex-direction: column; gap: var(--space-2); }
.mcp-export-btns { display: flex; gap: var(--space-2); }

.mcp-raw-details { font-size: 0.82em; }
.mcp-raw-summary { cursor: pointer; display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); list-style: none; font-weight: 600; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.05em; padding: 0; }
.mcp-raw-pre { margin: var(--space-2) 0 0; font-family: var(--font-mono); font-size: 0.78em; max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-all; background: var(--surface-alt); padding: var(--space-2); border-radius: var(--radius-sm); }

.mcp-status { position: fixed; bottom: var(--space-4); right: var(--space-4); padding: var(--space-2) var(--space-4); border-radius: var(--radius); font-size: 0.85em; z-index: 100; }
.mcp-status-ok { background: var(--sev-ok-bg); color: var(--sev-ok-text); border: 1px solid var(--sev-ok-border); }
.mcp-status-error { background: var(--sev-prob-bg); color: var(--sev-prob-text); border: 1px solid var(--sev-prob-border); }

/* --- Comply Licence Utilisation --- */
.util-spark { display:inline-block; vertical-align:middle; }
.util-flag {
  display:inline-block; font-size:11px; padding:1px 6px; border-radius:10px;
  background: var(--sev-warn-bg); color: var(--sev-warn-text);
  border:1px solid var(--sev-warn-bg); white-space:nowrap;
}
.util-detail summary { cursor:pointer; color:var(--accent); }
.util-detail-block { margin:0.5rem 0; }
.data-table.util-detail-table th, .data-table.util-detail-table td { padding: 4px 10px; }

/* --- Comply Utilisation: two-view tabs (shared by the live report + run log) --- */
.comply-util-tabs .tab-bar { margin-bottom: 1rem; }
#comply-util-tab-summary:checked ~ .tool-tabs-header .tab-bar label[for="comply-util-tab-summary"],
#comply-util-tab-cost:checked    ~ .tool-tabs-header .tab-bar label[for="comply-util-tab-cost"] {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
}
#comply-util-tab-summary:checked ~ #comply-util-panel-summary { display: block; }
#comply-util-tab-cost:checked    ~ #comply-util-panel-cost    { display: block; }

/* ── Comply Utilisation Dashboard ─────────────────────────────────────────── */

/* View toggle: Dashboard | Details (two sibling routes). */
.cmpl-view-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
/* Comply's Details/Dashboard pair is now btn btn-secondary btn-sm plus
   btn-selected; this class had been a fifth parallel button implementation (issue
   #163), so the toggle looked unlike every other pair of buttons in the app. */

/* Responsive chart-card grid - two columns, wide cards span both, single column
   at narrow widths (matches the tool-columns collapse breakpoint). */
.cmpl-dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}
.cmpl-dash-card {
  display: flex;
  flex-direction: column;
}
.cmpl-dash-card-wide {
  grid-column: 1 / -1;
}
.es-chart {
  width: 100%;
  height: 340px;
  min-height: 340px;
}
.cmpl-dash-card-wide .es-chart {
  height: 380px;
  min-height: 380px;
}
@media (max-width: 960px) {
  .cmpl-dash-grid {
    grid-template-columns: 1fr;
  }
}

/* Clickable chart cards + drill-down panel. */
.cmpl-dash-clickable .es-chart { cursor: pointer; }
/* The drill panel's heading sits flush against the panel's own padding - it is
   a panel header, not a card title, so it carries no margin of its own. Named
   here rather than inline on each of the two drill fragments that use it. */
.cmpl-drill-head .tool-column-title { margin: 0; }

/* The Explore page's per-tab export buttons, and the dashboard builder's action
   rows: a wrapping row of controls with consistent spacing. */
.comply-explore-actions,
.comply-dash-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* A checkbox and its label on one line, for the builder's "remove this chart"
   and "smallest first" toggles. */
.comply-dash-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
}

/* A collapsible chart card in the dashboard builder.
   The disclosure is a checkbox, not <details> or JS, so its state is form state
   and survives the server-rendered round trip every builder action makes. Hidden
   with position/opacity rather than display:none so it stays focusable and the
   cards are keyboard-reachable - the same rule .tab-radio follows. */
.comply-dash-chart { position: relative; }

.comply-dash-chart .cdc-toggle {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

/* The head row: the fold label takes the width, the move buttons keep their
   own click surface beside it (inside the label they would toggle the fold). */
.comply-dash-chart .cdc-head-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comply-dash-chart .cdc-move {
  display: inline-flex;
  gap: 4px;
  flex: none;
}

.comply-dash-chart .cdc-head {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 2px 0;
  color: var(--text);
}

.comply-dash-chart .cdc-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.comply-dash-chart .cdc-title {
  font-size: 14px;
  font-weight: 600;
}

.comply-dash-chart .cdc-summary {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comply-dash-chart .cdc-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* A CSS triangle, rotated when open - no icon asset for two states of a caret. */
.comply-dash-chart .cdc-caret {
  flex: none;
  width: 0;
  height: 0;
  border-left: 5px solid var(--text-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s;
}

.comply-dash-chart .cdc-toggle:checked ~ .cdc-head .cdc-caret {
  transform: rotate(90deg);
}

/* A keyboard user has to be able to see which card has focus, since the control
   itself is visually hidden. */
.comply-dash-chart .cdc-toggle:focus-visible ~ .cdc-head {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.comply-dash-chart .cdc-body { display: none; }

.comply-dash-chart .cdc-toggle:checked ~ .cdc-body {
  display: block;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* One filter row of the builder, set apart from the chart's own fields. */
.comply-dash-filter {
  border-left: 2px solid var(--border);
  padding-left: 12px;
  margin-bottom: 8px;
}

.cmpl-drill-panel:empty { display: none; }
.cmpl-drill-panel {
  margin-top: 1.25rem;
}
.cmpl-drill-inner {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.25rem 1.25rem;
}
.cmpl-drill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.btn-xs { padding: 3px 9px; font-size: 12px; }

/* Per-side provenance strip on a compare check page: which source fed each side
   and how many rows it supplied. A two-sided compare has no golden row to
   identify the sides, so this is what tells them apart. */
.compare-provenance {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.compare-provenance-side {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12.5px;
}

.compare-provenance-role {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: var(--text-muted);
}

.compare-provenance-label { color: var(--text); }

.compare-provenance-count { color: var(--text-muted); }

/* How a side's rows reached its data cache - SQL, DMF or OData - on the check
   page's provenance strip and the Comparisons tab's Source column. A refresh
   says nothing about a route that worked, so this is where it is shown. */
.compare-route-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-elevated);
  color: var(--text-muted);
}
.compare-route-icon { width: 12px; height: 12px; flex: none; }
.compare-route-col { white-space: nowrap; }
.compare-route-side { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; }
.compare-route-role { font-size: 11px; color: var(--text-muted); }

/* A run's tables - Control Groups, Control by Module, Comparisons - take the
   card's width, as a report should: they were shrink-wrapped to what they held
   (.table-fit), which on a wide window left a third of the card empty beside a
   table whose names wrapped. The counts keep to their own width at the right
   (compare-wide-table), so the names take the rest rather than a hand span
   opening between each heading and its number. */

/* The Comparisons tab: a row per check with its counts at the right, and the
   counts are what the tab is for, so the text columns give up their room
   rather than the counts going past the card. On a run of every parameter
   entity compared over SQL on both sides the table was 644px wider than its
   card at a 1500px window, and the wrapper's sideways scrollbar was at the
   foot of a table a hundred rows long, so Info, Warning, Problem, Missing and
   Additional were simply not on the screen. A report is named in the entity's
   own words, which wrap; the technical name breaks between its words
   (identText puts a <wbr> at each) with the module under it rather than in a
   column of its own; and each side's route takes a line, so no cell holds out
   for the width of one unbroken line. */
/* td is named so this beats the results page's own .compare-tabs .view-link-cell,
   which keeps the other tabs' short names on a line and comes after this sheet. */
.data-table.compare-checks-table td.view-link-cell { white-space: normal; }
.compare-checks-table .compare-entity-cell { font-size: 12px; color: var(--text-muted); }
.data-table.compare-wide-table th.num-col,
.data-table.compare-wide-table td.num-col { width: 1%; white-space: nowrap; padding-left: 6px; padding-right: 10px; }
.compare-entity-module { display: block; font-size: 11px; color: var(--text-faint); }
/* A run of captured forms is a check per form and company, every check of one
   form named alike, so its Comparisons list says which company each line
   compared: the target's, and under a golden record or a control group the
   golden company it was held to beneath it. */
.compare-company-col { white-space: nowrap; }
.compare-company { font-family: var(--font-mono); font-size: 12px; }
.compare-company-gold { display: block; font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }
.compare-checks-table .compare-route-side { display: flex; margin-right: 0; }
.compare-checks-table .compare-route-side + .compare-route-side { margin-top: 3px; }
.compare-checks-table .compare-route-role { min-width: 42px; }

/* --- Standalone auth pages (sign-in, access denied) ------------------------ */
/* These two pages are rendered outside the sidebar layout - a visitor who is not
   signed in cannot use that navigation - but still take their colours, fonts and
   logo from the active theme, so client branding carries through. */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 40px 32px 32px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-logo-mark,
.auth-logo-mark svg,
.auth-logo img {
  height: 48px;
  max-width: 240px;
}

/* No light/dark PAIR here any more. The mark is emitted once and reads its own
   colour from the --logo-fill custom property that StyleBlock already sets per
   mode (theme.LogoMarkupVar), so switching mode is a variable lookup rather than
   a second full SVG revealed by display:none - the same change #269 made to the
   app shell, applied to the two pages an unauthenticated visitor sees. These are
   the product's first impression and the one render with no session to warm
   anything, so a 13KB asset going in twice mattered more here than anywhere
   (issue #272). The rules that hid one of the pair are gone with it.

   The display is now stated rather than left to the pair's reveal rule, which
   was the only thing that ever set one: `html[data-theme="light"]
   .auth-logo-mark-light { display: inline-flex }`. Dropping it silently would
   have left the mark at display:inline, where the height above does not apply to
   the span at all. In practice .auth-logo is a flex container, so the mark is a
   flex item and gets blockified either way - but relying on that is relying on
   the parent, and a mark moved out of that container would collapse. */
.auth-logo-mark {
  display: inline-flex;
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 22px;
  color: var(--text);
  margin: 0 0 8px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 16px;
}

.auth-alert {
  text-align: left;
  margin-bottom: 20px;
}

.auth-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding: 10px 16px;
  font-size: 14px;
  text-decoration: none;
}

.auth-signin-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-signout-form {
  margin-top: 20px;
}

.auth-signout-form .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.auth-foot {
  margin: 20px 0 0;
  font-size: 12px;
  color: var(--text-faint);
}

/* Hint text under a connection form field, e.g. "the secret lives in the
   credentials store". */
.conn-prop-hint {
  grid-column: 1 / -1;
  margin: -4px 0 8px;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

/* --- Build: the MCP script page's and Form Capture's cards (a heading row
   with actions, a body) and the streamed log box under them. Each page had a
   copy, and the Discover Form Captures page a third. --- */
.mcp-card-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.mcp-card-title { margin: 0; }
.mcp-card-actions { display: flex; gap: var(--space-2); }
.mcp-card-body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }

.mcp-script-log { padding: var(--space-3) var(--space-4); font-size: 12px; font-family: var(--font-mono); max-height: 480px; overflow-y: auto; background: var(--surface-elevated); border-radius: 0 0 var(--radius) var(--radius); }
.mcp-log-line { white-space: pre-wrap; word-break: break-all; line-height: 1.5; }
.mcp-log-warn { color: var(--sev-warn-text); }
.mcp-log-err { color: var(--sev-prob-text); }
.mcp-log-ok { color: var(--sev-ok-text); font-weight: 600; }

/* The line under a card's actions saying what the last press did. Form
   Capture's Terminate answer puts ok/err on a child span, so both are read. */
.mcp-save-status { margin: var(--space-2) 0 0; font-size: 12px; min-height: 1em; }
.mcp-save-status.ok, .mcp-save-status .ok { color: var(--sev-ok-text); }
.mcp-save-status.err, .mcp-save-status .err { color: var(--sev-prob-text); font-weight: 600; }

/* ── MCP DSL syntax colouring ──────────────────────────────────────────────────
   Shared by the MCP Scripts detail editor (static/js/mcp_scripts_detail.js
   highlightLine) and the MCP Script Builder's live preview (the Go highlighter in
   cmd/website/dsl_highlight.go). Colour scheme: tool calls are blue, ESTools-custom
   actions (on_modal / on_guidance / es_output) are purple, the form/control/tab name
   being acted on (a call's first argument) is bold plain text, literal values (later
   arguments and quoted strings) are red, {Variable} runtime placeholders are green,
   comments are muted, punctuation is faint. Kept here (not inline) so both surfaces
   colour identically. */
.dsl-tool     { background: rgba(107,159,255,0.15); color: #6b9fff;  border-radius: 3px; padding: 0 4px; font-weight: 600; }
.dsl-data     { background: rgba( 45,212,191,0.15); color: #2dd4bf;  border-radius: 3px; padding: 0 4px; font-weight: 600; }
.dsl-api      { background: rgba(251,191, 36,0.15); color: #fbbf24;  border-radius: 3px; padding: 0 4px; font-weight: 600; }
.dsl-esproxy  { background: rgba(191,145,243,0.15); color: #bf91f3;  border-radius: 3px; padding: 0 4px; font-weight: 600; }
.dsl-label    { font-weight: 700; }
.dsl-value    { color: #ef4444; font-weight: 600; }
.dsl-variable { color: #87d96b; font-weight: 600; }
.dsl-string   { color: #ef4444; }
.dsl-comment  { color: var(--text-muted); font-style: italic; }
.dsl-punct    { color: var(--text-faint); }

html[data-theme="light"] .dsl-tool     { background: rgba( 37, 99,235,0.10); color: #2563eb; }
html[data-theme="light"] .dsl-data     { background: rgba( 13,148,136,0.10); color: #0d9488; }
html[data-theme="light"] .dsl-api      { background: rgba(217,119,  6,0.10); color: #d97706; }
html[data-theme="light"] .dsl-esproxy  { background: rgba(124, 58,237,0.10); color: #7c3aed; }
html[data-theme="light"] .dsl-value    { color: #dc2626; }
html[data-theme="light"] .dsl-variable { color: #16a34a; }
html[data-theme="light"] .dsl-string   { color: #dc2626; }

/* Compare job page: one progress row per concurrent lane. An mcp-rip refresh
   rips both environments at the same time, so each reports its own row rather
   than the two overwriting the single stage line above them. Grid rather than
   flex so the labels, bars and counts line up column-wise however long an
   environment name is. */
.compare-lanes {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.compare-lane {
  display: grid;
  grid-template-columns: minmax(6ch, max-content) minmax(80px, 1fr) max-content minmax(0, 2fr);
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.compare-lane-label {
  font-weight: 600;
  white-space: nowrap;
}

.compare-lane-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.compare-lane-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease-out;
}

.compare-lane-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}

/* The form currently being ripped - truncated rather than wrapped, so a long
   name cannot reflow the rows above it on every update. */
.compare-lane-item {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Run Compare's legal entities, decided by a control group: its members
   drawn locked in place of the tab's own control, which is put away rather
   than redrawn so another method gives back what was typed. The slot is
   always in the markup for the out-of-band answers to land in, and drawn only
   while it holds a lock. */
.cmp-companies-lock:not(.is-locked),
.cmp-companies-lock.is-locked ~ .cmp-companies-free {
  display: none;
}

.cmp-companies-locked .known-item-chip {
  padding-right: 8px;
}

/* A group's golden record carries the Golden record card's key. */
.cmp-company-chip.is-golden {
  font-weight: 600;
}

.cmp-companies-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.cmp-companies-note-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-top: 2px;
}

/* Compare job page: the run's work list under the progress, a group per
   environment and route and one for the comparison, each item marked as it
   starts and ends. The items flow in columns as wide as the page allows,
   since a capture of forty forms in five companies is two hundred of them and
   a single column put most of them below the fold. */
.compare-work {
  margin-top: var(--space-4);
}

.compare-work-groups {
  display: grid;
  gap: var(--space-3);
}

.compare-work-group {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.compare-work-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 6px;
}

.compare-work-title {
  font-size: 13px;
  font-weight: 600;
}

.compare-work-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.compare-work-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.compare-work-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  column-gap: 6px;
  align-items: start;
  padding: 3px 0;
  font-size: 12.5px;
}

.compare-work-ic {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.compare-work-item.is-done .compare-work-ic {
  color: var(--sev-ok-text);
}

.compare-work-item.is-failed .compare-work-ic {
  color: var(--sev-prob-text);
}

.compare-work-item.is-running .compare-work-ic {
  color: var(--accent);
}

.compare-work-item.is-pending,
.compare-work-item.is-skipped {
  color: var(--text-muted);
}

/* What is running reads as the line the eye looks for. */
.compare-work-item.is-running .compare-work-label {
  font-weight: 600;
}

.compare-work-label,
.compare-work-note {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.compare-work-note {
  grid-column: 2;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* A vault capture's items are a few dozen at most, and each one's note is
   its outcome - how many rows, read which way, and what the draft made of
   them - so every note is read whole rather than cut at the column's edge,
   as a comparison's thousands are. */
.vault-capture-work .compare-work-note {
  white-space: normal;
}

/* A failure's reason is the one note worth reading whole. */
.compare-work-item.is-failed .compare-work-note {
  white-space: normal;
  color: var(--sev-prob-text);
}

/* A row that speaks for its whole group - the SQL connection a refresh reads
   over - spans the group and is read whole, whatever its state: a server out
   of reach is one sentence about the environment, said once, where it used to
   be the same sentence cut short under every entity. */
.compare-work-item.is-whole {
  grid-column: 1 / -1;
}

.compare-work-item.is-whole .compare-work-note {
  white-space: normal;
}

.compare-work-more {
  grid-column: 1 / -1;
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .compare-lane {
    grid-template-columns: 1fr max-content;
    row-gap: 2px;
  }
  .compare-lane-track { grid-column: 1 / -1; }
  .compare-lane-item  { grid-column: 1 / -1; }
}

/* A secondary label inside a form group - the "…or a Meta Collection" picker
   that sits under the list it is an alternative to, so it reads as part of the
   same field rather than a new one. */
.form-label-sub {
  margin-top: 8px;
  font-weight: 500;
  color: var(--text-muted);
}

/* --- Package Designer (.pkgd) ---------------------------------------------
   Shared by the validate and compare designer wizards. Unlike the CSS-radio
   tool tabs above, the designer's tabs are server-rendered <button>s (every
   click is a POST that re-renders the workspace), so state rides on
   aria-selected rather than :checked - which also keeps these out of
   tool_tabs_css_test.go's radio-tab rules. */

.pkgd-tabsbar { display: flex; align-items: center; justify-content: space-between;
                gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
/* <button> does not inherit the page font on its own - without this the
   designer's tabs and steps render in the UA font. */
.pkgd button { font-family: inherit; }
/* Parts of a form control are painted by the browser, not by our CSS - the
   multi-select listboxes especially. They follow the UA colour scheme, which
   defaults to light and ignores the custom properties, so state it
   explicitly for the designer's controls (same fix as the collections
   editor). */
.pkgd { color-scheme: dark; }
html[data-theme="light"] .pkgd { color-scheme: light; }
.pkgd-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
/* The compare designer's per-check tabs: a subtle underline groups the tabs
   that act on the selected check rather than the whole package. */
.pkgd-tab-per { border-bottom: 2px solid var(--accent-dim); }

/* The per-check tabs' shared header: which check the panel configures. */
.pkgd-checkbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
                 padding: 8px 12px; margin-bottom: var(--space-4);
                 background: var(--surface-alt); border: 1px solid var(--border);
                 border-radius: var(--radius-sm); }
.pkgd-checkbar .form-label { margin: 0; }
.pkgd-checkbar .form-select { width: auto; min-width: 220px; }
.pkgd-checkbar .pkgd-hint { margin: 0; }

/* The Checks tab's selected-check basics section heading. */
.pkgd-subhead { font-weight: 600; font-size: 13.5px; margin: var(--space-4) 0 var(--space-3);
                padding-top: var(--space-3); border-top: 1px solid var(--border); }

/* The selected check's row on the Checks tab. */
.pkgd-rowlist .pkgd-card[aria-selected="true"] { border-color: var(--accent); }
/* Sized to match .tool-tabs-pills .tab-label (the File Validation tabs). */
.pkgd-tab { display: inline-flex; align-items: center; gap: 9px; padding: 8px 16px 8px 12px;
            border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
            color: var(--text-muted); font-weight: 500; font-size: 13.5px; cursor: pointer;
            transition: background 0.15s, border-color 0.15s, color 0.15s; }
.pkgd-tab:hover { color: var(--text); background: var(--surface-hover); }
.pkgd-tab .n { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center;
               font-size: 11.5px; font-weight: 800; background: var(--surface-alt); color: var(--text-muted);
               border: 1px solid var(--border); }
.pkgd-tab[aria-selected="true"] { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.pkgd-tab[aria-selected="true"] .n { background: var(--accent); border-color: var(--accent); color: var(--bg); }
/* The Review tab wears the report's verdict even while unselected, so the
   author can see where things stand from any tab. */
.pkgd-tab.pkgd-tab-status-ok:not([aria-selected="true"])   { border-color: var(--sev-ok-border); color: var(--sev-ok-text); }
.pkgd-tab.pkgd-tab-status-warn:not([aria-selected="true"]) { border-color: rgba(240, 180, 0, 0.35); color: var(--sev-warn-text); }
.pkgd-tab.pkgd-tab-status-fail:not([aria-selected="true"]) { border-color: var(--sev-prob-border); color: var(--sev-prob-text); }
/* An mdi-icon "Class" lands on the <svg> itself, so these five rules target the
   class directly and NOT ".<class> svg". Written the descendant way they matched
   nothing, and mdiIconFallbackSize is why nobody noticed: an unsized MDI source
   has no intrinsic size and would stretch to fill its column, so mdiIcon stamps
   width/height 24 on it, and a dead rule renders a plausible 24px icon instead
   of an enormous one. What it cost was the two selected-state colour rules
   below, which never fired at all - a picked card's icon stayed text-coloured.
   TestMdiIconClassesAreStyledOnTheSvg keeps the form from coming back. */
.pkgd-tab-ic { width: 15px; height: 15px; }
.pkgd-tabsbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* The strip's action buttons sit beside the tabs, so they share their height. */
.pkgd-tabsbar-actions .btn { padding: 8px 14px; font-size: 13.5px; }
.pkgd-note { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted); }
.pkgd-note-ic { width: 14px; height: 14px; }

.pkgd-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
              padding: var(--space-4); }
.pkgd-panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
                   gap: 12px; margin-bottom: var(--space-3); }
.pkgd-panel-head .pkgd-hint { margin: 0; max-width: 70ch; }
.pkgd-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-3); }
.pkgd-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
/* The Target tab: the column list beside the grid saying what the check
   makes of each column, which needs the room more. */
.pkgd-target-columns { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2.4fr); gap: var(--space-3); align-items: start; }
@media (max-width: 860px) { .pkgd-target-columns { grid-template-columns: 1fr; } }
.pkgd-column-grid th.pkgd-grid-pick,
.pkgd-column-grid td.pkgd-grid-pick { width: 1%; white-space: nowrap; text-align: center; }
.pkgd-column-grid th.pkgd-grid-group { text-align: center; }
.pkgd-column-grid input { margin: 0; accent-color: var(--accent); vertical-align: middle; }
/* Hidden on a column that is not a key: there, and plainly not on offer. */
.pkgd-column-grid input:disabled { opacity: 0.35; cursor: not-allowed; }
@media (max-width: 860px) { .pkgd-grid, .pkgd-two-col { grid-template-columns: 1fr; } }
.pkgd-hint { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; }
.pkgd-mono { font-family: var(--font-mono); font-size: 12.5px; }
.pkgd-radio-row { display: flex; flex-direction: column; gap: 6px; }
.pkgd-radio { display: flex; align-items: baseline; gap: 7px; font-size: 13px; cursor: pointer; }
.pkgd-radio input { accent-color: var(--accent); }
.pkgd-sql { font-family: var(--font-mono); font-size: 12px; background: var(--bg);
            border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
            overflow-x: auto; white-space: pre; max-height: 480px; overflow-y: auto; }
.pkgd-sqlwrap { position: relative; }
.pkgd-sqlwrap .pkgd-sql { margin: 0; }
/* Inset clear of the <pre>'s own vertical scrollbar. */
.pkgd-copybtn { position: absolute; top: 8px; right: 18px; display: inline-flex; align-items: center;
                gap: 6px; padding: 5px 11px; font-size: 12.5px; color: var(--text-muted);
                background: var(--surface); border: 1px solid var(--border);
                border-radius: var(--radius-sm); cursor: pointer; }
.pkgd-copybtn:hover { color: var(--text); border-color: var(--accent); }
.pkgd-copybtn svg { width: 15px; height: 15px; }

/* Control-group editor: the member-row grid (key, name, group, gold, hide,
   remove). The name is the widest cell, since a legal entity's name runs to
   several words where its id is four letters. */
.pkgd-cg-rows { display: flex; flex-direction: column; gap: 6px; max-width: 980px; }
.pkgd-cg-rowhead, .pkgd-cg-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr) 52px 52px 40px;
                                 gap: 8px; align-items: center; }
/* On a phone the six cells cannot share a row: the name takes one of its own
   under the key and group, and the ticks and the remove button follow. */
@media (max-width: 640px) {
  .pkgd-cg-rowhead, .pkgd-cg-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px 40px 40px; }
  .pkgd-cg-row { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .pkgd-cg-col-name { grid-column: 1 / -1; grid-row: 2; }
}
.pkgd-cg-rowhead { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase;
                   letter-spacing: 0.04em; }
/* The two tick columns' headings, centred over their boxes. Named rather than
   counted: this is a grid row, so a column added to the template's five spans
   moves every one after it and nothing would report it. */
.pkgd-cg-col-gold, .pkgd-cg-col-hide { text-align: center; }
.pkgd-cg-flag { display: flex; justify-content: center; cursor: pointer; }
.pkgd-cg-flag input { accent-color: var(--accent); width: 15px; height: 15px; }
/* The row loaders' shared controls: the environment picker beside the button
   that reads its legal entities. align-items: flex-end lines the button up with
   the select rather than with the label above it - and the .form-group's 18px
   bottom margin has to go with it, because flex alignment works on the MARGIN
   box, so that margin pushed the button 18px below the select it is meant to
   sit beside. */
.pkgd-cg-fill { display: flex; align-items: flex-end; flex-wrap: wrap;
                gap: var(--space-3); margin-top: var(--space-4); }
.pkgd-cg-fill .form-group { margin-bottom: 0; }
.pkgd-cg-fill-env { min-width: 240px; }
.pkgd-chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.pkgd-preview-target { margin-bottom: var(--space-4); }
.pkgd-listbox { width: 100%; box-sizing: border-box; font-family: var(--font-mono); font-size: 12px;
                padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm);
                background: var(--bg); color: var(--text); }
.pkgd-listbox:focus { border-color: var(--accent); outline: none; }
/* A multi-select's options do not inherit colour from the page: without these
   they render as the UA default, unreadable on the dark theme. Chromium also
   ignores background-color on a highlighted option but honours a
   background-image, hence the flat gradient. */
.pkgd-listbox option { padding: 3px 6px; border-radius: 3px; background: var(--bg); color: var(--text); }
.pkgd-listbox option:checked { background: var(--accent) linear-gradient(0deg, var(--accent), var(--accent)); color: var(--bg); }

/* Item cards (targets, sources, checks). .pkgd-rowlist lays each card out as
   a full-width slim row - main text left, action buttons hard right - which
   scans far better than a card grid once a package holds many of them. */
.pkgd-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.pkgd-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
             padding: var(--space-3); display: flex; flex-direction: column; gap: 6px; }
.pkgd-rowlist { display: flex; flex-direction: column; gap: var(--space-2); }
.pkgd-rowlist .pkgd-card { flex-direction: row; align-items: center; gap: var(--space-3);
                           padding: 10px var(--space-3); }
.pkgd-rowlist .pkgd-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pkgd-rowlist .pkgd-card-foot { margin-top: 0; padding-top: 0; margin-left: auto; flex-shrink: 0; }
@media (max-width: 700px) { .pkgd-rowlist .pkgd-card { flex-direction: column; align-items: stretch; } }
.pkgd-card-title { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pkgd-card-sub { font-size: 12px; color: var(--text-muted); }
.pkgd-card-meta { font-size: 12px; color: var(--text-muted); }
.pkgd-card-foot { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; }
.pkgd-badge-missing { color: var(--sev-prob-text); border-color: var(--sev-prob-border); }

/* Checks tab: target rail + check pane */
.pkgd-checks-layout { display: grid; grid-template-columns: 220px 1fr; gap: var(--space-4); }
@media (max-width: 860px) { .pkgd-checks-layout { grid-template-columns: 1fr; } }
.pkgd-rail { display: flex; flex-direction: column; gap: 6px; align-self: start; }
.pkgd-rail-item { display: flex; align-items: center; justify-content: space-between; gap: 8px;
                  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
                  background: var(--surface-alt); color: var(--text-muted); font-size: 13px; cursor: pointer;
                  text-align: left; }
.pkgd-rail-item:hover { color: var(--text); background: var(--surface-hover); }
.pkgd-rail-item[aria-selected="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.pkgd-rail-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkgd-count { font-size: 11px; font-weight: 700; background: var(--surface); border: 1px solid var(--border);
              border-radius: 999px; padding: 1px 7px; }

/* Configurator step chips. The modal shell itself is the shared .modal (issue
   #166); only the chips are the package designer's own. */
.pkgd-step { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 8px;
             border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
             color: var(--text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pkgd-step .n { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
                font-size: 10.5px; font-weight: 800; background: var(--surface-alt); color: var(--text-muted); }
.pkgd-step[aria-selected="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.pkgd-step[aria-selected="true"] .n { background: var(--accent); color: var(--bg); }
/* A step whose question the answers so far do not reach: shown, so the shape of
   the sequence is visible from the first step, but not a way in. */
.pkgd-step[disabled] { opacity: 0.45; cursor: default; }

/* Repeating rows (enhancers, field mappings, standalones) */
.pkgd-rows { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-3); }
.pkgd-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3);
            background: var(--surface-alt); }
.pkgd-row-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: var(--space-3); align-items: end; }
@media (max-width: 860px) { .pkgd-row-grid { grid-template-columns: 1fr; } }
.pkgd-row-check { padding-bottom: 8px; }
.pkgd-row-foot { display: flex; justify-content: flex-end; }

/* Check-type picker */
.pkgd-typelist { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
@media (max-width: 860px) { .pkgd-typelist { grid-template-columns: 1fr; } }
.pkgd-typecard { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px;
                 border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt);
                 cursor: pointer; }
.pkgd-typecard:hover { background: var(--surface-hover); }
.pkgd-typecard[aria-selected="true"] { border-color: var(--accent); background: var(--accent-dim); }
.pkgd-typecard input { position: absolute; opacity: 0; pointer-events: none; }
.pkgd-typecard-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.pkgd-typecard-desc { font-size: 12px; color: var(--text-muted); }

/* The "My drafts" dropdown beside Save draft. Re-rendered per post, so its
   open state need not survive - every entry is a plain navigation link. */
.pkgd-menu { position: relative; display: inline-block; }
.pkgd-menu > summary { list-style: none; }
.pkgd-menu > summary::-webkit-details-marker { display: none; }
.pkgd-menu-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 80;
                   min-width: 280px; max-height: 320px; overflow-y: auto;
                   background: var(--surface-elevated); border: 1px solid var(--border);
                   border-radius: var(--radius-sm); box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
                   padding: 4px; display: flex; flex-direction: column; }
.pkgd-menu-panel a { display: flex; align-items: center; justify-content: space-between; gap: 10px;
                     padding: 7px 10px; border-radius: 3px; font-size: 12.5px; color: var(--text);
                     text-decoration: none; }
.pkgd-menu-panel a:hover { background: var(--surface-hover); }
.pkgd-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Advanced foldouts + collection picker */
.pkgd-advanced { margin-top: var(--space-3); font-size: 12.5px; }
.pkgd-advanced > summary { cursor: pointer; color: var(--text-muted); }
.pkgd-advanced[open] > summary { margin-bottom: var(--space-2); }
.pkgd-colpick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pkgd-colpick .form-select { max-width: 240px; }

/* Review & Save */
.pkgd-review-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: var(--space-4); }
.pkgd-review-head .btn { flex-shrink: 0; }
.pkgd-banner { flex: 1; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px;
               border: 1px solid transparent; }
.pkgd-banner-ok   { background: var(--sev-ok-bg); border-color: var(--sev-ok-border); color: var(--sev-ok-text); }
.pkgd-banner-warn { background: var(--sev-warn-bg); border-color: rgba(240, 180, 0, 0.25); color: var(--sev-warn-text); }
.pkgd-banner-fail { background: var(--sev-prob-bg); border-color: var(--sev-prob-border); color: var(--sev-prob-text); }
.pkgd-review-list { display: flex; flex-direction: column; gap: var(--space-3); }
.pkgd-review-check { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3);
                     background: var(--surface-alt); }
.pkgd-rc-ok   { border-left: 3px solid var(--sev-ok-text); }
.pkgd-rc-warn { border-left: 3px solid var(--sev-warn-text); }
.pkgd-rc-fail { border-left: 3px solid var(--sev-prob-text); }
.pkgd-review-check-head { display: flex; align-items: flex-start; gap: 10px; }
.pkgd-review-ic svg { width: 18px; height: 18px; }
.pkgd-rc-ok   .pkgd-review-ic { color: var(--sev-ok-text); }
.pkgd-rc-warn .pkgd-review-ic { color: var(--sev-warn-text); }
.pkgd-rc-fail .pkgd-review-ic { color: var(--sev-prob-text); }
.pkgd-review-title { font-weight: 600; font-size: 13.5px; }
.pkgd-review-sub { font-size: 12px; color: var(--text-muted); }
.pkgd-issues { display: flex; flex-direction: column; gap: 6px; margin-top: var(--space-2); }
.pkgd-issue { display: flex; align-items: center; justify-content: space-between; gap: 10px;
              padding: 7px 10px; border-radius: var(--radius-sm); font-size: 12.5px;
              background: var(--surface); border: 1px solid var(--border); }
.pkgd-issue-fail { border-left: 3px solid var(--sev-prob-text); }
.pkgd-issue-warn { border-left: 3px solid var(--sev-warn-text); }
.pkgd-issue-info { border-left: 3px solid var(--sev-info-text); }
.pkgd-issue-msg { flex: 1; }
.pkgd-issue .btn { flex-shrink: 0; }

/* Summary tab: per-target sections with a compact scannable checks table. */
.pkgd-sum-target { margin-bottom: var(--space-4); padding: var(--space-3); background: var(--surface-alt);
                   border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pkgd-sum-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pkgd-coverage { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
                 padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
                 background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent); }
.pkgd-coverage-ic { width: 13px; height: 13px; }
.pkgd-sum-wrap { overflow-x: auto; margin-top: var(--space-2); }
.pkgd-sum-table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.pkgd-sum-table th { text-align: left; padding: 5px 10px; border-bottom: 1px solid var(--border);
                     font-weight: 600; white-space: nowrap; color: var(--text-muted); }
.pkgd-sum-table td { padding: 4px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.pkgd-sum-col { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }
.pkgd-sev { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pkgd-sev-info { background: var(--sev-info-bg); color: var(--sev-info-text); }
.pkgd-sev-warn { background: var(--sev-warn-bg); color: var(--sev-warn-text); }
.pkgd-sev-prob { background: var(--sev-prob-bg); color: var(--sev-prob-text); }
.pkgd-sev-neut { background: var(--surface); color: var(--text-muted); }

/* Compare designer preview: dataset checks describe their sources as a list. */
.pkgd-desc-list { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-muted); }

/* Compare designer's add flow: the panel that leads the Checks tab. Separated
   from the check list BELOW it by a rule rather than by space alone, because it
   is a different act - it mints checks, the list edits ones that exist. It
   leads rather than trails because after a bulk add the report of what happened
   would otherwise sit under however many checks were just added. */
.pkgd-add { padding-bottom: var(--space-4); margin-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
/* The bulk sequence itself runs in the shared modal (js/modal.js, .modal), the
   way the validate designer's configurator does - a wizard belongs over the
   page, not wedged into the tab it is about. What stays on the tab is the two
   entry cards and the report of what the last run added. */
.pkgd-add-head { display: flex; align-items: flex-start; justify-content: space-between;
                 gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: wrap; }
/* An action card: the same card as the radio ones, as a button. Buttons do not
   inherit the page font or text alignment, and a card whose text is centred in
   the browser default reads as a different control from the radio card beside
   it. */
button.pkgd-kindcard { font: inherit; text-align: left; color: inherit; }
.pkgd-gen-grouping { margin-top: var(--space-3); }
/* The generate outcome's lists: long enough to fold away once a batch is big,
   open while short enough to read at a glance. */
.pkgd-gen-skipped { margin-top: var(--space-2); font-size: 12.5px; }
.pkgd-gen-skipped > summary { cursor: pointer; color: var(--text-muted); }
.pkgd-gen-skipped[open] > summary { margin-bottom: 4px; }
/* The bulk add's sentence saying its metadata is read from an environment
   other than the one the Details tab names: above the lists it explains, and
   set apart from them. */
.pkgd-gen-metanote { margin: 0 0 var(--space-3); }
/* The bulk add's group members, nested under the Control groups card that
   asks for them, as the Control group tab reads; and the golden legal entity
   box or the control group picker under that, each as wide as the card row it
   follows rather than the modal's whole width. */
.pkgd-gen-members { padding-left: var(--space-3); border-left: 2px solid var(--border); }
.pkgd-gen-golden, .pkgd-gen-groups { max-width: 548px; }
/* The fill-from-metadata row on the Target and Control tabs: a kind, a name and
   the button that writes the query, bottom-aligned so the button sits beside
   the inputs rather than below their labels - the same alignment fix
   .pkgd-cg-fill needed, and for the same reason. */
.pkgd-fill { display: flex; align-items: flex-end; flex-wrap: wrap; gap: var(--space-3); }
.pkgd-fill .form-group { margin-bottom: 0; }
.pkgd-fill-name { min-width: 260px; flex: 1; }
/* The tab-level metadata source, now a statement rather than a control: it sits
   above the pickers it feeds, so it is set apart from the fields below it. */
.pkgd-metaenv { margin-bottom: var(--space-3); }

/* Designer kind pickers: radio cards with an icon, used for the package type
   and the reference-source kind. The radio itself is hidden; the card is the
   control. */
.pkgd-kindrow { display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* A fixed comfortable width: wide enough for the title and description, and
   never stretched across a large monitor when there are only a few cards. */
.pkgd-kindcard { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
                 width: 240px; max-width: 100%;
                 padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
                 background: var(--surface-alt); cursor: pointer;
                 transition: background 0.15s, border-color 0.15s; }
.pkgd-kindcard:hover { background: var(--surface-hover); }
.pkgd-kindcard[aria-selected="true"] { border-color: var(--accent); background: var(--accent-dim); }
/* A card's radio is hidden by being absolutely placed, so the card is its
   positioning context: placed against the document instead, at the foot of a
   page several screens long, it was what pressing the card focused, and the
   browser scrolled the window to it - the whole shell went off the top of the
   window and left an empty page. TestAHiddenInputIsPlacedAgainstItsOwnControl. */
.pkgd-kindcard input { position: absolute; opacity: 0; pointer-events: none; }
.pkgd-kindcard-ic { width: 22px; height: 22px; color: var(--text-muted); }
.pkgd-kindcard[aria-selected="true"] .pkgd-kindcard-ic { color: var(--accent); }
.pkgd-kindcard-title { font-size: 13px; font-weight: 600; }
.pkgd-kindcard-desc { font-size: 11.5px; color: var(--text-muted); }
/* A card for a choice this context cannot make - a data cache for a table -
   drawn to say the choice exists and is not this one's, rather than left out,
   since an absent card reads as a product that cannot do it at all. */
.pkgd-kindcard[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.pkgd-kindcard[aria-disabled="true"]:hover { background: var(--surface-alt); }

/* The slim variant, for a two-way choice whose description is one short
   phrase: the icon moves beside the title instead of above it, halving the
   card's height. Used by the dataset grouping and group-members pickers and by
   the control group editor's import source, all of which sit inside a step
   rather than heading a tab. */
.pkgd-kindrow-slim .pkgd-kindcard { display: grid; grid-template-columns: auto 1fr;
                                    align-items: center; column-gap: 9px; row-gap: 1px;
                                    padding: 9px 12px; width: 270px; }
.pkgd-kindrow-slim .pkgd-kindcard-ic { grid-row: span 2; width: 20px; height: 20px; }
.pkgd-kindrow-slim .pkgd-kindcard-title,
.pkgd-kindrow-slim .pkgd-kindcard-desc { grid-column: 2; }

/* Backing tables on the data entity detail: one that resolves to a Table
   Explorer page is a link, one that does not (a view, a nested entity) is not.
   Both were the same accent badge, so which of the seventeen were clickable
   was invisible until the pointer happened to land on one. */
.explorer-backing-link { cursor: pointer; }
.explorer-backing-link:hover { outline: 1px solid var(--accent); text-decoration: underline; }
.explorer-backing-plain { background: var(--surface-alt); color: var(--text-muted); }

/* A code that leads to its record's page (the code-link partial) says so at
   rest, with a dotted rule under it that goes solid and outlined under the
   pointer, while a code drawn alone looks exactly as it always did: which
   codes lead somewhere has to be visible before the pointer happens to find
   one, which is the fault the backing tables' two looks above were written
   to fix. */
a.code-link code {
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, currentColor 60%, transparent);
  text-underline-offset: 3px;
}

a.code-link:hover code,
a.code-link:focus-visible code {
  text-decoration-style: solid;
  text-decoration-color: currentColor;
  outline: 1px solid var(--accent);
}

/* The row a link landed on - a field on its entity's or its table's page in
   Discover (discoverFieldURL), a column on its vault area's page
   (vaultColumnURL) - is marked, and held clear of the top of the scroll box,
   or the row the fragment scrolled to sat flush against the edge with nothing
   to say it was the one asked for. :target answers an address typed by hand;
   is-target answers a link followed inside the app, since history.pushState
   changes nothing :target can see. */
.explorer-field-row,
.vault-column-row {
  scroll-margin-top: 96px;
}

/* The row is outlined rather than given a bar in its first cell, since a
   rule naming a cell by its position is what TestATableColumnRuleNamesItsColumn
   refuses, and an outline drawn inside the row reads as one mark across it. */
.explorer-field-row.is-target,
.explorer-field-row:target,
.vault-column-row.is-target,
.vault-column-row:target {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.explorer-field-row.is-target > td,
.explorer-field-row:target > td,
.vault-column-row.is-target > td,
.vault-column-row:target > td {
  background: var(--accent-dim);
}

/* Automate > Reference > Standard fields: a table per prefix, drawn as the
   document type's Fields table draws the same facts, in one card the page's
   width with the search and the line saying what a property inherits above
   them at the card's width. Every group's columns are one width
   (table-layout: fixed, a width per named column, What it is taking what is
   left), so the tables line up down the page, and on a phone a table scrolls
   sideways in its frame rather than squeezing its columns. A cell's text
   wraps; the aliases keep to one line, capped by the server with "+n more"
   and named in full in the cell's tooltip. The widths were measured at
   1500px rather than guessed: at 130px Format wrapped "A number, without
   currency symbols or thousands separators" to five lines and set fourteen
   rows' height, so it has 176px, three lines, which 200px does not improve
   on; What it is keeps what is left, about 200px, since every pixel taken
   from it makes the longest descriptions taller; Type holds a glyph and
   "number" in 92px; Also known as holds the longest first alias, "Document
   number", beside its "+n more" in 204px; Examples keeps a date such as
   2026-11-02 on one line in 120px, where 110px broke it; and Checks holds
   "Regex Match" and "Format Mask", 98px each, in 124px. The row a link
   names is marked as a Discover field row is, and held clear of the top. */
.automate-standard-card .explorer-toolbar {
  margin-top: 0;
}

.automate-standard-card .explorer-toolbar .form-input {
  flex: 1 1 320px;
}

.automate-standard-inherits {
  margin: 0 0 var(--space-3);
}

.automate-standard-frame {
  margin-top: var(--space-4);
}

/* The named columns are 932px together: narrower than 1000px a table
   scrolls in its frame rather than squeezing What it is to nothing. */
.data-table.automate-standard-table {
  table-layout: fixed;
  width: 100%;
  min-width: 1000px;
}

/* The caption sits inside the table's frame, its words in line with the
   cells' text below it. */
.automate-standard-caption {
  caption-side: top;
  text-align: left;
  padding: var(--space-3) var(--space-3) var(--space-2);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.data-table.automate-standard-table th.automate-col-standard-field {
  width: 216px;
}

.data-table.automate-standard-table th.automate-col-standard-type {
  width: 92px;
}

/* What it is takes what the named columns leave, on every group's table. */
.data-table.automate-standard-table th.automate-col-standard-what {
  width: auto;
}

/* automateStandardAliasesRoom is this width less the cell's padding. */
.data-table.automate-standard-table th.automate-col-standard-aliases {
  width: 204px;
}

.data-table.automate-standard-table th.automate-col-standard-format {
  width: 176px;
}

.data-table.automate-standard-table th.automate-col-standard-examples {
  width: 120px;
}

.data-table.automate-standard-table th.automate-col-standard-checks {
  width: 124px;
}

.data-table.automate-standard-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

.data-table.automate-standard-table td.automate-col-standard-aliases {
  white-space: nowrap;
  overflow: hidden;
}

.data-table.automate-standard-table td.automate-col-standard-examples code {
  display: inline-block;
  margin: 0 4px 4px 0;
}

.automate-standard-field {
  scroll-margin-top: 96px;
}

.automate-standard-field.is-target,
.automate-standard-field:target {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.automate-standard-field.is-target > td,
.automate-standard-field:target > td {
  background: var(--accent-dim);
}

.automate-standard-key {
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.automate-standard-words {
  overflow-wrap: anywhere;
}

.automate-standard-check {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}

.automate-standard-check-icon {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--accent);
}

/* The member-row importer, separated from the rows it appends to: without a
   rule the "Import from" heading sat flush against the last row and read as
   part of it rather than as the start of a new section. */
.pkgd-cg-import { margin-top: var(--space-5); padding-top: var(--space-4);
                  border-top: 1px solid var(--border); }

/* The read-only copy of a control group's member rows, shown once one has been
   copied into a dataset check. Compact because it is confirmation of a copy,
   not something to work in. */
.pkgd-cg-preview { font-size: 12px; }
.pkgd-cg-preview th, .pkgd-cg-preview td { padding: 4px 10px; }

/* Example-data preview: the scrollable sample table inside a .modal.modal-wide. */
.pkgd-sample-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pkgd-sample-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.pkgd-sample-table th { position: sticky; top: 0; background: var(--surface-elevated); text-align: left;
                        padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
                        font-weight: 600; }
.pkgd-sample-table td { padding: 4px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
                        max-width: 320px; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); }
.pkgd-sample-table tbody tr:nth-child(even) td { background: var(--surface-alt); }

/* Package-registry row actions: square icon buttons for inspect and design. */
.pkg-row-actions { display: flex; gap: 6px; margin-top: 6px; }
.pkg-row-actions .btn { padding: 4px 7px; }
.pkg-row-actions .btn svg { width: 14px; height: 14px; }

/* Services test harness: the labelled field list a single-record result
   renders as, and the collapsible raw-JSON view under every result. */
.svc-test-fields { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px;
                   margin: 10px 0; font-size: 13px; }
.svc-test-field { display: contents; }
.svc-test-fields dt { color: var(--text-muted); font-weight: 600; }
.svc-test-fields dd { margin: 0; overflow-wrap: anywhere; }
.svc-test-raw { margin-top: 10px; }
.svc-test-raw summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
.svc-test-raw pre { max-height: 50vh; overflow: auto; margin-top: 6px; padding: 10px;
                    border: 1px solid var(--border); border-radius: var(--radius-sm);
                    background: var(--surface-alt); font-size: 12px; }
/* The pill beside a service card's name saying which product surface it
   exists for, and the instances table of a multi-instance definition. */
.svc-used-by { margin-left: 8px; vertical-align: middle; font-size: 11px; }
/* Who provides a service: one quiet line under its description, on the card
   and on its own page, so a service ES Tools runs itself reads apart from one
   that calls somebody else. */
.svc-provider { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.svc-instances .svc-instance-url { max-width: 28ch; overflow-wrap: anywhere; font-size: 13px; }
.svc-add-instance { max-width: 480px; }
/* The expected-output disclosure under each operation's test form: the
   operation's declared fields/columns, readable without calling the API. */
.svc-example { margin-top: 12px; }
.svc-example summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
.svc-example .table-wrapper { margin-top: 6px; }
/* ============================================================
   Form Management UI (prototype port - scoped under .fm)
   ============================================================ */

/* Theme tokens for the forms UI. Every rule below reads --fm-* only, never the
   raw prototype names, so the forms UI can be retinted without touching the
   component rules. Colour tokens with a site equivalent are mapped onto the
   site's own custom properties (defined in the top-of-file :root dark baseline
   AND the html[data-theme="light"] block, so they flip with the site theme);
   the second var() argument is the prototype's original light value, kept only
   as a defensive fallback. Tokens with no site equivalent (--fm-cyan, shadows)
   carry the prototype's DARK values here - this sheet is dark-by-default, like
   the rest of the site - and are re-stated for light under
   html[data-theme="light"] .fm below. Geometry/mono are theme-independent. */
.fm {
  --fm-accent:        var(--accent, #2f7cf6);
  --fm-accent-strong: var(--accent-hover, #1f6fe8);
  --fm-accent-tint:   var(--accent-dim, #e8f1fe);
  --fm-accent-ink:    #ffffff;
  --fm-surface:       var(--surface, #ffffff);
  --fm-surface-2:     var(--surface-hover, #f5fafd);
  --fm-surface-3:     var(--surface-elevated, #eef6fc);
  --fm-ink:           var(--text, #10263a);
  --fm-muted:         var(--text-muted, #63798c);
  --fm-faint:         var(--text-faint, #93a7b8);
  --fm-line:          var(--border, #e3eef6);
  --fm-line-strong:   var(--border-hover, #d3e3ef);
  --fm-success:       var(--sev-ok-text, #21a97a);
  --fm-success-tint:  var(--sev-ok-bg, #e3f6ee);
  --fm-warn:          var(--sev-warn-text, #e0972f);
  --fm-warn-tint:     var(--sev-warn-bg, #fdf1de);
  --fm-danger:        var(--sev-prob-text, #e5555b);
  --fm-danger-tint:   var(--sev-prob-bg, #fdeaea);

  /* No site equivalent - prototype values, dark baseline. */
  --fm-cyan:      #35c6e6;
  --fm-shadow-lg: 0 18px 48px -18px rgba(0,0,0,.6);
  --fm-shadow-md: 0 8px 24px -12px rgba(0,0,0,.5);
  --fm-shadow-sm: 0 2px 8px -3px rgba(0,0,0,.45);

  /* Geometry + mono (theme-independent). */
  --fm-r-xl: 22px; --fm-r-lg: 16px; --fm-r-md: 11px; --fm-r-sm: 8px; --fm-r-pill: 999px;
  --fm-mono: var(--font-mono, ui-monospace,"SF Mono",Menlo,Consolas,monospace);

  /* What a form's theme sets beside the colours (see "Form themes" below):
     its fonts, and the page behind it, which is the site's own until a theme
     names one. */
  --fm-font-body: var(--font-body);
  --fm-font-heading: var(--font-heading, var(--font-body));
  --fm-bg: transparent;
}

/* Light-mode overrides for the tokens that have no site equivalent - matches
   the site's own html[data-theme="light"] override mechanism. Mapped tokens
   above flip automatically via the site vars, so they are not repeated here. */
html[data-theme="light"] .fm {
  --fm-cyan:      #1fb6d8;
  --fm-shadow-lg: 0 18px 48px -18px rgba(14,52,86,.35);
  --fm-shadow-md: 0 8px 24px -12px rgba(14,52,86,.28);
  --fm-shadow-sm: 0 2px 8px -3px rgba(14,52,86,.20);
}

@media (prefers-reduced-motion: reduce) { .fm * { animation: none !important; transition: none !important; } }
.fm h1, .fm h2, .fm h3, .fm h4 { text-wrap: balance; margin: 0; }
.fm .u-label { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 700; color: var(--fm-faint); }
/* A label that opens with an icon, such as the paperclip over what is
   attached: the icon is the label's size, not the 24px an unsized one takes. */
.fm .u-label > svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
/* What is attached to a record once it is written, under its fields on the
   record's card, ruled off from them since it is not a field of the record. */
.fm .rec-attachments { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--fm-line, var(--border)); }
.fm .rec-attachments > .u-label { display: block; margin-bottom: 6px; }
/* The entity is a name, spelled as Dynamics 365 spells it, where a field's tag is a word set in capitals. */
.fm .rec-attachments .fchip .tag { text-transform: none; letter-spacing: 0; }
.fm .checkline .fhelp > svg { width: 13px; height: 13px; vertical-align: -2px; }
.fm .mono { font-family: var(--fm-mono); }
.fm button { font-family: inherit; cursor: pointer; }
.fm :focus-visible { outline: 2px solid var(--fm-accent); outline-offset: 2px; border-radius: 4px; }

.fm .shell { max-width: 1140px; margin: 0 auto; padding: 22px 22px 90px; }
.fm .appbar { display: flex; align-items: center; gap: 14px; background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-lg); padding: 12px 16px; box-shadow: var(--fm-shadow-sm); flex-wrap: wrap; }
.fm .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.01em; }
.fm .brand .logo { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--fm-accent), var(--fm-cyan)); box-shadow: var(--fm-shadow-sm); }
.fm .brand small { display: block; font-weight: 600; color: var(--fm-muted); font-size: 11px; letter-spacing: .04em; }
.fm .appbar .spacer { flex: 1; }
.fm .formchip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--fm-r-pill); background: var(--fm-surface-2); border: 1px solid var(--fm-line); font-size: 13px; color: var(--fm-muted); }
.fm .formchip b { color: var(--fm-ink); font-weight: 700; }

.fm .seg { display: inline-flex; background: var(--fm-surface-2); border: 1px solid var(--fm-line); border-radius: var(--fm-r-pill); padding: 3px; gap: 2px; }
.fm .seg button { border: 0; background: transparent; color: var(--fm-muted); font-weight: 600; font-size: 13px; padding: 7px 16px; border-radius: var(--fm-r-pill); transition: all .18s ease; white-space: nowrap; }
.fm .seg button[aria-selected="true"] { background: var(--fm-accent); color: var(--fm-accent-ink); box-shadow: var(--fm-shadow-sm); }

.fm .view { margin-top: 20px; animation: fm-rise .3s ease both; }
@keyframes fm-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fm .viewhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.fm .viewhead h1 { font-size: 26px; letter-spacing: -.02em; }
.fm .viewhead p { margin: 4px 0 0; color: var(--fm-muted); font-size: 14px; max-width: 64ch; }

/* The designer's tabs are the shared pill tabs (.tool-tabs-pills .tab-label,
   selected by tab-label-selected); all this adds is the step number each wears
   and the Publish tab's status. The number is a small round count, the shared
   tab's own muted colours, and the selected tab's accent when it is selected. */
/* The strip and the save actions share the header row, with the panel 18px
   below it, as the module's own strip had. */
.fm-designer-tabs .tool-tabs-header { margin-bottom: 18px; }
.fm-designer-tab-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-elevated); color: var(--text-muted); }
.fm-designer-tab.tab-label-selected .fm-designer-tab-n { background: var(--accent); color: var(--bg); }
/* The Publish tab wears the form's status, so it reads as a progress light from
   any tab. The selected state still wins, so the active tab is never ambiguous. */
.fm-designer-tab-ok:not(.tab-label-selected) { border-color: var(--sev-ok-text); color: var(--sev-ok-text); }
.fm-designer-tab-warn:not(.tab-label-selected) { border-color: var(--sev-warn-text); color: var(--sev-warn-text); }
.fm-designer-tab-fail:not(.tab-label-selected) { border-color: var(--sev-prob-text); color: var(--sev-prob-text); }
.fm-designer-tab-ok:not(.tab-label-selected) .fm-designer-tab-n { background: var(--sev-ok-bg); color: var(--sev-ok-text); }
.fm-designer-tab-warn:not(.tab-label-selected) .fm-designer-tab-n { background: var(--sev-warn-bg); color: var(--sev-warn-text); }
.fm-designer-tab-fail:not(.tab-label-selected) .fm-designer-tab-n { background: var(--sev-prob-bg); color: var(--sev-prob-text); }

/* ---- The Publish review. */
.fm .pub-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--fm-r-md); margin-bottom: 16px; font-size: 13.5px; }
.fm .pub-banner svg { width: 22px; height: 22px; flex: none; }
.fm .pub-banner.pub-ok { background: var(--fm-success-tint); color: var(--fm-success); }
.fm .pub-banner.pub-warn { background: var(--fm-warn-tint); color: var(--fm-warn); }
.fm .pub-banner.pub-fail { background: var(--fm-danger-tint); color: var(--fm-danger); }
.fm .pub-list { display: flex; flex-direction: column; gap: 10px; }
.fm .pub-check { border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); padding: 12px 14px; background: var(--fm-surface); }
.fm .pub-check.pub-warn { border-color: color-mix(in srgb, var(--fm-warn) 40%, var(--fm-line)); }
.fm .pub-check.pub-fail { border-color: color-mix(in srgb, var(--fm-danger) 40%, var(--fm-line)); }
.fm .pub-check-head { display: flex; gap: 10px; align-items: flex-start; }
.fm .pub-ic svg { width: 20px; height: 20px; }
.fm .pub-check.pub-ok .pub-ic { color: var(--fm-success); }
.fm .pub-check.pub-warn .pub-ic { color: var(--fm-warn); }
.fm .pub-check.pub-fail .pub-ic { color: var(--fm-danger); }
.fm .pub-title { font-weight: 600; font-size: 14px; }
.fm .pub-sub { color: var(--fm-muted); font-size: 12.5px; margin-top: 1px; }
.fm .pub-issues { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 0 30px; }
.fm .pub-issue { display: flex; gap: 8px; align-items: center; font-size: 13px; background: var(--fm-surface-2); border-radius: var(--fm-r-sm); padding: 8px 10px; }
.fm .pub-issue-ic svg { width: 16px; height: 16px; }
.fm .pub-issue.pub-fail .pub-issue-ic { color: var(--fm-danger); }
.fm .pub-issue.pub-warn .pub-issue-ic { color: var(--fm-warn); }
.fm .pub-issue.pub-info .pub-issue-ic { color: var(--fm-muted); }
.fm .pub-issue-msg { flex: 1; min-width: 0; }
@media (max-width: 620px) { .fm .pub-issues { margin-left: 0; } .fm .pub-issue { flex-wrap: wrap; } }
/* The delivery workflow the form writes through, under the checks: the words
   beside the button that rebuilds it, and whatever is wrong with it under both. */
.fm .pub-delivery { border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); padding: 14px 16px; margin-top: 16px; background: var(--fm-surface); display: flex; flex-direction: column; gap: 10px; }
.fm .pub-delivery-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.fm .pub-delivery h3 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.fm .pub-delivery p { margin: 0; font-size: 13px; max-width: 70ch; }
.fm .pub-delivery p + p { margin-top: 4px; }
.fm .pub-delivery .pub-delivery-note { color: var(--fm-muted); }
.fm .pub-delivery a { color: var(--fm-accent); }
.fm .pub-delivery a:hover { text-decoration: underline; }
.fm .pub-delivery .alert { margin: 0; }
.fm .pub-delivery-copies summary { cursor: pointer; font-size: 13px; color: var(--fm-muted); }
.fm .pub-delivery-copies ul { margin: 6px 0 0 18px; padding: 0; font-size: 13px; }
/* One of the form's own two workflows, inside the Workflows panel: what it is and
   whose it is on the left, and what can be done with it on the right. */
.fm .pub-workflow { border-top: 1px solid var(--fm-line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.fm .pub-workflow-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.fm .pub-workflow h4 { font-size: 13px; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.fm .pub-workflow-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.fm .pub-workflow-uses { border-top: 1px solid var(--fm-line); padding-top: 10px; }
.fm .pub-workflow-uses h4 { font-size: 13px; font-weight: 600; margin: 0 0 4px; }
.fm .pub-workflow-uses ul { margin: 0 0 0 18px; padding: 0; font-size: 13px; }

.fm .panel { background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-xl); box-shadow: var(--fm-shadow-md); padding: 24px; }
.fm .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
/* A panel's heading is the shared card heading (.form-card-title), not a size
   of its own. */
.fm .panel-head .sub { color: var(--fm-muted); font-size: 13px; margin-top: 2px; max-width: 70ch; }

.fm .searchbar { display: flex; align-items: center; gap: 10px; background: var(--fm-surface-2); border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); padding: 10px 14px; color: var(--fm-muted); }
.fm .searchbar input { border: 0; background: transparent; outline: none; flex: 1; font: inherit; color: var(--fm-ink); }
.fm .searchbar svg { width: 18px; height: 18px; color: var(--fm-faint); }

/* min() guards the track floor: auto-fill still lays down one track when the
   container is narrower than the minimum, and a bare minmax(320px, 1fr) makes
   that track 320px inside a 304px box - which then gets clipped rather than
   scrolled (issue #205). min(320px, 100%) lets the single track collapse to the
   container instead, and behaves identically once there is room for 320px. */
.fm .grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
/* A column, so however tall the content runs the footer can be pinned to the
   bottom - cards in a row are already equal height (grid stretches them). */
.fm .card { display: flex; flex-direction: column; background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-lg); padding: 16px; box-shadow: var(--fm-shadow-sm); transition: all .18s ease; position: relative; }
.fm .card:hover { box-shadow: var(--fm-shadow-md); transform: translateY(-2px); border-color: var(--fm-line-strong); }
.fm .card .grip { position: absolute; top: 14px; right: 12px; color: var(--fm-faint); cursor: grab; opacity: .6; }
/* flex-start, not center: the icon belongs at the card's top-left corner, and
   centring drifted it down the card whenever the title/description wrapped. */
.fm .card-top { display: flex; align-items: flex-start; gap: 12px; }
.fm .card-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; background: linear-gradient(135deg, var(--fm-accent), var(--fm-cyan)); }
.fm .card-ic svg { width: 22px; height: 22px; }
.fm .card h3 { font-size: 15.5px; }
.fm .card .meta { color: var(--fm-muted); font-size: 12.5px; margin-top: 1px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* A form's tags sit under its description, a little apart from it. */
.fm .card .card-tags { margin-top: 6px; }
.fm .fieldchips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
/* A METADATA chip strip (record/field/stage counts on a form card), as opposed to
   the content chips on a designer record card, which are the card's body and must
   stay under its heading. Pinned to the bottom so it sits directly above
   .card-foot whatever height the description above it takes: in a grid of cards
   whose descriptions run from one line to five, counts that floated up behind the
   text landed at a different height in every card. .card-foot gives up its own
   auto margin here, or the free space would be split between the two and open a
   gap between the counts and the buttons. */
.fm .fieldchips-foot { margin-top: auto; padding-top: 14px; }
.fm .card > .fieldchips-foot + .card-foot { margin-top: 0; }
.fm .fchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 10px; border-radius: var(--fm-r-sm); background: var(--fm-surface-2); border: 1px solid var(--fm-line); color: var(--fm-ink); }
.fm .fchip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fm-faint); }
.fm .fchip.req .dot { background: var(--fm-danger); }
.fm .fchip.key { border-color: color-mix(in srgb, var(--fm-accent) 40%, var(--fm-line)); }
.fm .fchip .tag { font-size: 9.5px; font-weight: 800; letter-spacing: .06em; color: var(--fm-faint); text-transform: uppercase; }
/* margin-top:auto pushes the footer to the bottom of the card; its actions sit
   at the bottom-left. Trailing meta text is pushed right by taking flex:1. */
.fm .card-foot { margin-top: auto; padding-top: 14px; display: flex; gap: 8px; align-items: center; justify-content: flex-start; flex-wrap: wrap; color: var(--fm-muted); font-size: 12px; }
/* Duplicate is a pure <details> disclosure: closed it sits inline as a third
   action; open it takes the whole footer row so its name form gets full width. */
.fm .card-foot .dup > summary { list-style: none; cursor: pointer; }
.fm .card-foot .dup > summary::-webkit-details-marker { display: none; }
.fm .card-foot .dup[open] { flex-basis: 100%; }
.fm .card-foot .dup-form { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.fm .card-foot .dup-form label { font-weight: 600; color: var(--fm-ink); }
.fm .card-foot .dup-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
/* The add-card closes a card grid, matching Environments/Credentials/Themes.
   display:grid overrides .card's column layout (it centres rather than pinning a
   footer), and it stays flat and undecorated even as an anchor. */
.fm .add-card { border: 2px dashed var(--fm-line-strong); background: transparent; box-shadow: none; display: grid; place-items: center; align-content: center; min-height: 150px; color: var(--fm-muted); font-weight: 600; gap: 8px; text-align: center; cursor: pointer; text-decoration: none; }
.fm .add-card:hover { border-color: var(--fm-accent); color: var(--fm-accent); box-shadow: none; transform: none; }
.fm .add-card .plus { width: 40px; height: 40px; border-radius: 12px; background: var(--fm-accent-tint); color: var(--fm-accent); display: grid; place-items: center; }

.fm .tube { display: flex; align-items: stretch; overflow-x: auto; padding-bottom: 6px; }
/* A column, so the foot's buttons sit at the bottom of every card however much
   the card above them says, and the cards of one tube line up at their feet. */
.fm .stage { flex: 1 1 0; min-width: 240px; background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-lg); padding: 16px; box-shadow: var(--fm-shadow-sm); position: relative; display: flex; flex-direction: column; }
.fm .stage + .stage { margin-left: 26px; }
.fm .stage + .stage::before { content: ""; position: absolute; left: -26px; top: 34px; width: 26px; height: 2px; background: linear-gradient(90deg, var(--fm-line-strong), var(--fm-accent)); }
.fm .stage.cur { border-color: var(--fm-accent); box-shadow: 0 0 0 3px var(--fm-accent-tint), var(--fm-shadow-md); }
.fm .stage .num { width: 26px; height: 26px; border-radius: 50%; background: var(--fm-accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12.5px; margin-bottom: 10px; }
.fm .stage h3 { font-size: 15px; }
.fm .stage .owner { color: var(--fm-muted); font-size: 12.5px; margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.fm .stage .sla { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--fm-warn); background: var(--fm-warn-tint); padding: 3px 9px; border-radius: var(--fm-r-pill); }
.fm .stage .verb { margin-top: 12px; font-size: 12px; color: var(--fm-muted); }
.fm .stage .verb b { color: var(--fm-ink); }
.fm .actions-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
/* A stage pill that is a button: the designer's Preview makes each one clickable so an
   author can see a review stage's checklist without filling the form in. Inherits the
   pill's look so the bar does not change shape between the two surfaces. */
.fm .stagepill-btn { border: 0; font: inherit; cursor: pointer; }
.fm .stagepill-btn:hover { filter: brightness(1.15); }

/* The add-field chip. It sat among the field chips looking exactly like them, so the
   one button an author wants was the hardest thing in the row to find. Dashed and
   accented: reads as "and one more" rather than as another field. */
.fm .fchip-add { background: transparent; border-style: dashed; border-color: var(--fm-accent); color: var(--fm-accent-strong); font-weight: 700; }
.fm .fchip-add:hover { background: var(--fm-accent-tint); }
/* A designer record card lists its fields a line each: the name on the left, its tags
   and the Validate shield hard against the right so they line up down the card. */
.fm .fieldchips-list { flex-direction: column; flex-wrap: nowrap; gap: 5px; }
.fm .fieldchips-list .fchip { display: flex; width: 100%; text-align: left; }
.fm .fieldchips-list .fchip-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fm .fieldchips-list .fchip-tags { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.fm .fieldchips-list .fchip-add { justify-content: center; }
/* A shaping step is a row of its own controls, not a rule condition: the
   condition's four-column grid put a Find and replace step's fifth control, its
   remove button, on a line of its own drawn as wide as a box. Flex, the kind
   first and the boxes sharing what is left. */
.fm .cond-row.tf-row { display: flex; flex-wrap: wrap; }
.fm .cond-row.tf-row > select.tf-op { flex: 0 0 210px; }
.fm .cond-row.tf-row > input { flex: 1 1 110px; min-width: 0; }
.fm .cond-row.tf-row > .checkline, .fm .cond-row.tf-row > button { flex: none; }
/* The separator row: how a multiselect's answers are joined in this one field,
   said before the steps that shape the joined value. */
.fm .cond-row.tf-row.tf-join > label { font-size: 12.5px; color: var(--fm-muted); }
.fm .cond-row.tf-row.tf-join > input { flex: 0 0 72px; }

/* The record card's foot, stacked. It was one flex row of count + id + two buttons,
   which wrapped onto two or three lines as soon as a record had a long id - so the id
   now sits above its own buttons, both right-aligned. */
.fm .card-foot-stack { flex-direction: column; align-items: flex-end; gap: 6px; }
.fm .card-foot-id { opacity: .6; font-size: 11px; }
.fm .card-foot-acts { display: flex; gap: 8px; align-items: center; }

/* The stage card's buttons - Move, Configure and Delete together - pinned
   bottom-right like the record card's, so the two kinds of card behave the same
   way. margin-top: auto is what pins them, which is why the card is a column. */
.fm .actions-row-foot { margin-top: auto; padding-top: 12px; justify-content: flex-end; align-items: center; }

/* "This has a condition on it." One look wherever it appears - stage, section, record,
   question, check - because a rule is what makes a form behave differently for two
   people filling it in, and it was marked on questions only. */
.fm .condtag-rule { display: inline-flex; align-items: center; gap: 4px; color: var(--fm-cyan); background: color-mix(in srgb, var(--fm-cyan) 14%, transparent); font-weight: 700; }
.fm .condtag-ic { width: 12px; height: 12px; flex-shrink: 0; }

/* Checkbox lists, used by the action picker. A multiple <select> loses every other
   choice on a plain click; these cannot. */
.fm .checkset { display: flex; flex-direction: column; gap: 4px; }
.fm .checkset .checkline { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--fm-line); border-radius: var(--fm-r-sm); cursor: pointer; font-size: 12.5px; }
.fm .checkset .checkline:hover { border-color: var(--fm-line-strong); background: var(--fm-surface-2); }
.fm .checkset .checkline input { flex-shrink: 0; }

/* Controls tab: a review stage's sections, each with its checks beneath. Grouped the
   way Sections & Questions groups questions, so the two tabs read alike - a flat list
   made a stage's second section invisible. */
.fm .rvsec { border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); margin-bottom: 12px; overflow: hidden; }
.fm .rvsec-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--fm-surface-2); border-bottom: 1px solid var(--fm-line); }
.fm .rvsec .qcard { border: 0; border-bottom: 1px solid var(--fm-line); border-radius: 0; margin: 0; }
.fm .rvsec .qcard:last-child { border-bottom: 0; }

/* Stage cards are coloured by what happens at the stage, so a three-stage form reads
   at a glance rather than as three identical cards distinguished only by their text.
   Reuses the existing --fm-* severity tokens: entry is the neutral accent, review the
   warn hue (something is pending on a person), submit the success hue (this is where it
   completes). Nothing new is invented, so a theme change carries these along. */
.fm .stage.stage-review    { border-left: 4px solid var(--fm-warn); }
.fm .stage.stage-complete  { border-left: 4px solid var(--fm-success); }
.fm .stage.stage-entry     { border-left: 4px solid var(--fm-accent); }
.fm .stage.stage-automated { border-left: 4px solid var(--fm-cyan); }

/* A stage wears an icon per kind of action it has - a bolt writes records, an
   envelope sends a message, a robot is an automated stage's work - so what a
   stage does reads before its card is read closely. Inline in the heading, beside
   the stage number: the top-right corner is where the drag grip sits. The class
   is on the MDI svg's wrapper, so the size rule names the svg inside it. */
.fm .stage-kind { display: inline-flex; align-items: center; opacity: .9; vertical-align: -0.15em; margin-right: 2px; }
.fm .stage-kind svg { width: 15px; height: 15px; }
.fm .stage-kind-commit     { color: var(--fm-success); }
.fm .stage-kind-notify     { color: var(--fm-accent-strong); }
.fm .stage-kind-automation { color: var(--fm-cyan); }
.fm .stage-kind-legacy     { color: var(--fm-warn); }

/* A stage's actions, each by its name at the moment it answers, coloured by what
   it does. A long name is cut to the chip and carried whole in the tooltip. */
.fm .stage-acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.fm .stage-acts .act { display: inline-flex; max-width: 100%; gap: 4px; min-width: 0; }
.fm .act .act-when { flex-shrink: 0; font-weight: 800; }
.fm .act .act-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-weight: 600; }
.fm .act.act-commit     { background: var(--fm-success-tint); color: var(--fm-success); border-color: transparent; }
.fm .act.act-notify     { background: var(--fm-accent-tint); color: var(--fm-accent-strong); border-color: transparent; }
.fm .act.act-automation { background: color-mix(in srgb, var(--fm-cyan) 14%, transparent); color: var(--fm-cyan); border-color: transparent; }
.fm .act.act-legacy     { background: var(--fm-warn-tint); color: var(--fm-warn); border-color: transparent; }

/* The actions matrix: an action per row and each stage's events as columns, the one
   place a stage's moments are set. Wider than the panel on a form with several
   stages, so it scrolls sideways inside its own box rather than taking the page with
   it, and the action names stay in sight as it does. */
.fm .actions-matrix-wrap { overflow-x: auto; border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); }
.fm .actions-matrix { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.fm .actions-matrix th, .fm .actions-matrix td { padding: 6px 8px; border-bottom: 1px solid var(--fm-line); text-align: center; white-space: nowrap; }
.fm .actions-matrix thead th { background: var(--fm-surface-2); font-weight: 700; }
.fm .actions-matrix .am-stage { color: var(--fm-ink); }
.fm .actions-matrix .am-moment { color: var(--fm-muted); font-weight: 600; font-size: 11.5px; }
.fm .actions-matrix .am-starts { border-left: 1px solid var(--fm-line-strong); }
.fm .actions-matrix .am-action { text-align: left; position: sticky; left: 0; background: var(--fm-surface); z-index: 1; max-width: 260px; }
.fm .actions-matrix thead .am-action { background: var(--fm-surface-2); }
.fm .actions-matrix .am-action svg { width: 14px; height: 14px; vertical-align: -0.15em; flex-shrink: 0; }
.fm .actions-matrix .am-name { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.fm .actions-matrix .am-cell input { cursor: pointer; }
.fm .actions-matrix .am-cell input:disabled { cursor: not-allowed; }
.fm .actions-matrix tbody tr:last-child th, .fm .actions-matrix tbody tr:last-child td { border-bottom: 0; }

.fm .actions-matrix-label { display: block; margin: 22px 0 10px; }

/* The Controls tab's left pane, a heading per review stage with its checks and
   its own "Add a check" under it. */
.fm .rv-stage-head { display: block; margin: 10px 0 4px; }
.fm .rv-stage-empty { margin: 0 0 4px; }

/* A stage's "What it does" step: what the matrix says of the stage, read-only. */
.fm .stage-answers .stage-answer { display: flex; align-items: baseline; gap: 6px; padding: 4px 0; }
.fm .stage-answers .stage-answer svg { width: 14px; height: 14px; flex-shrink: 0; align-self: center; }

/* Stage-type radios: three mutually exclusive options each needing a line of
   explanation, so all three stay visible instead of hiding behind a dropdown. */
.fm .radioset { display: flex; flex-direction: column; gap: 6px; }
.fm .radioline { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--fm-line); border-radius: var(--fm-r-sm); cursor: pointer; }
.fm .radioline:hover { border-color: var(--fm-line-strong); }
.fm .radioline input { margin-top: 2px; flex-shrink: 0; }
.fm .radioline.is-disabled { opacity: .55; cursor: not-allowed; }

/* A question rendering a control, shown on the Sections tab only because it has drifted
   into an entry stage - visible and marked rather than hidden, since the contract
   rejects it and a hidden cause is worse than a visible one. */
.fm .qcard.qcard-control { border-left: 3px solid var(--fm-warn); }

.fm .act { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: var(--fm-r-pill); background: var(--fm-surface-2); border: 1px solid var(--fm-line); color: var(--fm-muted); }
.fm .act.commit { background: var(--fm-success-tint); color: var(--fm-success); border-color: transparent; }
.fm .act.approve { background: var(--fm-accent-tint); color: var(--fm-accent-strong); border-color: transparent; }

/* The left pane holds section names on the Sections & Questions tab and control names
   on Controls, both of which carry a stage label and badges beside them - at 280px
   those wrapped onto two or three lines for any name of ordinary length. */
.fm .builder { display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start; }
/* Stacks earlier than it used to, because the left pane is wider: at 820px a 420px
   pane left the questions beside it in about 350px, which is narrower than the cards
   it has to render. */
@media (max-width: 1000px) { .fm .builder { grid-template-columns: 1fr; } }
.fm .seclist { display: flex; flex-direction: column; gap: 8px; }
.fm .secitem { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--fm-r-md); background: var(--fm-surface); border: 1px solid var(--fm-line); box-shadow: var(--fm-shadow-sm); transition: all .15s ease; cursor: pointer; }
.fm .secitem:hover { border-color: var(--fm-line-strong); }
.fm .secitem[aria-selected="true"] { border-color: var(--fm-accent); background: var(--fm-accent-tint); }
.fm .secitem .grip { color: var(--fm-faint); cursor: grab; }
.fm .secitem .nm { font-weight: 600; font-size: 13.5px; flex: 1; }
.fm .secitem .stg { font-size: 10px; font-weight: 800; color: var(--fm-faint); text-transform: uppercase; letter-spacing: .05em; }
.fm .qpane { background: var(--fm-surface-2); border: 1px solid var(--fm-line); border-radius: var(--fm-r-lg); padding: 16px; min-height: 320px; }
.fm .qpane-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.fm .qlist { display: flex; flex-direction: column; gap: 10px; }
.fm .qcard { display: flex; align-items: center; gap: 12px; background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); padding: 12px 14px; box-shadow: var(--fm-shadow-sm); transition: all .15s ease; }
.fm .qcard.drag-over { border-color: var(--fm-accent); box-shadow: 0 0 0 2px var(--fm-accent-tint); }
.fm .qcard.dragging { opacity: .4; }
.fm .qcard .grip { color: var(--fm-faint); cursor: grab; }
.fm .qcard .qbody { flex: 1; min-width: 0; }
.fm .qcard .qlabel { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.fm .qcard .qbind { font-size: 12px; color: var(--fm-muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fm .ctrltag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: var(--fm-r-sm); background: var(--fm-surface-3); color: var(--fm-muted); }
.fm .bindtag { font-size: 11.5px; color: var(--fm-accent-strong); background: var(--fm-accent-tint); padding: 2px 8px; border-radius: 5px; display: inline-flex; align-items: center; gap: 5px; }
.fm .bindtag .guid { font-family: var(--fm-mono); font-size: 9.5px; opacity: .6; }
.fm .condtag { font-size: 11px; color: var(--fm-warn); background: var(--fm-warn-tint); padding: 2px 8px; border-radius: 5px; }
/* A question that writes the field, on the field's own step: its name, how it is
   answered, and the way to it, on one line where it fits. */
.fm .fm-writer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.fm .fm-writer > span { flex: 1 1 240px; min-width: 0; }
.fm .fm-writer > button { flex: none; }
.fm .qcard .qacts { display: flex; gap: 4px; color: var(--fm-faint); }
.fm .hint { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--fm-muted); margin-top: 14px; }
.fm .hint svg { flex: none; margin-top: 1px; }

/* logic tab */
.fm .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 780px){ .fm .two-col { grid-template-columns: 1fr; } }
.fm .listcard { display: flex; flex-direction: column; gap: 10px; background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); padding: 13px 15px; box-shadow: var(--fm-shadow-sm); }
.fm .listcard .lc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fm .listcard .lc-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.fm .listcard .lc-sub { font-size: 12px; color: var(--fm-muted); margin-top: 4px; }
/* Which of the form's workflows carries an action, and the way to it. */
.fm .listcard .lc-carried { font-size: 12px; color: var(--fm-muted); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.fm .listcard .lc-carried svg { width: 14px; height: 14px; }
.fm .listcard .lc-carried a { color: var(--fm-accent); }
.fm .opt-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fm .opt-preview span { font-size: 11.5px; background: var(--fm-surface-2); border: 1px solid var(--fm-line); border-radius: var(--fm-r-pill); padding: 3px 9px; display: inline-flex; align-items: center; gap: 5px; }
.fm .exprbox { font-family: var(--fm-mono); font-size: 12px; background: var(--fm-surface-2); border: 1px solid var(--fm-line); border-radius: var(--fm-r-sm); padding: 8px 10px; margin-top: 8px; color: var(--fm-ink); overflow-x: auto; }

/* entry */
/* Two declarations here are load-bearing on a narrow screen, and both exist
   because of the same trap (issue #200).

   `justify-items: center` used to do the centring. That stops a grid item being
   stretched, which makes it SHRINK-TO-FIT - and shrink-to-fit can never go below
   the item's min-content width. The wizard's stepper is a horizontal scroller,
   but a scroll container still contributes its contents' min-content to its
   ancestors' intrinsic widths, so a form with enough steps gave the item a
   405px floor inside a 332px box. The card overflowed and was clipped, looking
   for all the world like the nowrap footer that was fixed alongside it.

   So: the track is capped with minmax(0, 1fr), and the item is left to STRETCH
   to it. Centring moves onto the children that need it, where it costs nothing,
   because a stretched item is sized by the track rather than by its contents. */
.fm .entry-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.fm .entry-wrap > * { min-width: 0; }
/* The entry card is the page's panel - bordered, not floating (no drop shadow). */
.fm .entry-card { width: 100%; max-width: 780px; margin-inline: auto; background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-xl); box-shadow: none; overflow: hidden; }
.fm .entry-banner { padding: 20px 26px; background: linear-gradient(120deg, var(--fm-accent), var(--fm-cyan)); color: #fff; }
.fm .entry-banner h2 { font-size: 20px; }
.fm .entry-banner p { margin: 4px 0 0; opacity: .92; font-size: 13.5px; }
.fm .stagebar { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.fm .stagepill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: var(--fm-r-pill); background: rgba(255,255,255,.16); color: #fff; }
.fm .stagepill.cur { background: #fff; color: var(--fm-accent-strong); }
/* A stage already passed. Until stages could actually be advanced there was nothing
   to style: entryTubeStop documented a "done" state that nothing ever assigned, so a
   completed stage rendered identically to one still ahead. */
.fm .stagepill.done { background: rgba(255,255,255,.34); color: #fff; }

/* --- Review checklist (form-review-panel) ---
   Deliberately few rules: the checklist reuses the Publish tab's .pub-* vocabulary,
   and these only cover what a *run-time* check has that a design-time one does not -
   the entry answer being judged, an automated suggestion, and a control nested inside
   a check card. */
.fm .rev-answer {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: 8px 0 0; padding: 6px 10px;
  background: var(--fm-surface-2); border-radius: var(--fm-r-sm); font-size: 12.5px;
}
.fm .rev-answer-label { color: var(--fm-muted); }
.fm .rev-answer-value { font-weight: 600; word-break: break-word; }
.fm .rev-answer-missing { color: var(--fm-warn); font-style: italic; }
.fm .rev-suggested {
  display: flex; align-items: center; gap: 6px; margin-top: 8px;
  font-size: 12.5px; color: var(--fm-muted);
}
.fm .rev-suggested svg { width: 16px; height: 16px; flex: none; }
.fm .rev-found-run { margin-left: auto; font-weight: 600; white-space: nowrap; }
/* What a process gave for a check, a table per record or set of rows. The rows are
   the process's, of any width, so the table scrolls in a box of its own rather than
   taking the check card sideways. */
.fm .rev-found { margin-top: 8px; }
.fm .rev-found-title { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.fm .rev-found-count { font-weight: 400; color: var(--fm-muted); margin-left: 6px; }
.fm .rev-found-scroll { overflow-x: auto; max-height: 260px; overflow-y: auto; border: 1px solid var(--fm-line); border-radius: var(--fm-r-sm); }
.fm .rev-found-table { margin: 0; font-size: 12px; }
.fm .rev-found-table th, .fm .rev-found-table td { white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
/* The control sits inside the check card, so it needs its own top margin rather than
   .q's usual spacing between stacked questions. */
.fm .rev-control { margin-top: 10px; }
.fm .rev-control .q { margin: 0; }
.fm .stepper { display: flex; gap: 8px; padding: 16px 26px 0; flex-wrap: wrap; }
/* The wizard's step buttons match the tab buttons: site button radius, flat. */
.fm .step { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 8px; border-radius: 4px; background: var(--fm-surface-2); border: 1px solid var(--fm-line); color: var(--fm-muted); font-weight: 600; font-size: 13px; cursor: pointer; box-shadow: none; }
.fm .step .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--fm-surface-3); color: var(--fm-muted); }
.fm .step[aria-selected="true"] { background: var(--fm-accent-tint); border-color: color-mix(in srgb, var(--fm-accent) 30%, var(--fm-line)); color: var(--fm-accent-strong); }
.fm .step[aria-selected="true"] .n { background: var(--fm-accent); color: #fff; }
.fm .step.done .n { background: var(--fm-success); color: #fff; }
/* A step carrying validation errors. Last of the .n tone rules on purpose: it must
   beat both the selected and the done badge, and all three tie on specificity. */
.fm .step .n.n-error { background: var(--fm-danger); color: #fff; }
.fm .entry-body { padding: 22px 26px 8px; }
/* flex-wrap is load-bearing, not cosmetic. Without it this row's min-content
   width is the SUM of its four children (Back + "Step 1 of 3" + Save draft +
   Next) plus gaps and padding, which came to 364px - and since the row is inside
   .entry-card, that became the card's own minimum width. The card could not
   shrink below 366px on any viewport, so on a 360px phone the right edge of
   every field was clipped (issue #200). Letting the row wrap removes the floor
   entirely; the card is free to be as narrow as its fields are. */
.fm .entry-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 26px 22px; border-top: 1px solid var(--fm-line); margin-top: 6px; }
.fm .entry-foot .prog { color: var(--fm-muted); font-size: 12.5px; }

.fm .q { position: relative; margin-bottom: 22px; animation: fm-rise .22s ease both; }
.fm .q > .qh { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.fm .q > .qh .req { color: var(--fm-danger); }
.fm .q .qsub { color: var(--fm-muted); font-size: 12.5px; margin: 3px 0 12px; }

.fm .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 12px; margin-top: 10px; }
.fm .tile { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 14px 8px; border-radius: var(--fm-r-lg); background: var(--fm-surface); border: 1px solid var(--fm-line); box-shadow: var(--fm-shadow-sm); transition: all .16s ease; text-align: center; cursor: pointer; }
.fm .tile:hover { transform: translateY(-2px); border-color: var(--fm-line-strong); }
.fm .tile .ti { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: var(--fm-surface-2); border: 1px solid var(--fm-line); transition: all .16s ease; overflow: hidden; }
.fm .tile .ti.flag { width: 60px; height: 40px; border-radius: 8px; }
.fm .tile .ti.flag svg { width: 100%; height: 100%; display: block; }
/* A choice icon: a country flag fills the tile, an MDI glyph sits inside it. */
.fm .tile .ti .flag { width: 100%; height: 100%; border-radius: 8px; vertical-align: 0; box-shadow: none; }
.fm .tile .ti .choice-mdi { width: 26px; height: 26px; }
.fm .tile .ti .flag-code { border: 0; font-size: 15px; line-height: 1; color: inherit; vertical-align: 0; }
.fm .tile .tt { font-size: 12.5px; font-weight: 600; color: var(--fm-muted); }
.fm .tile[aria-pressed="true"] { border-color: var(--fm-accent); box-shadow: 0 0 0 2px var(--fm-accent-tint), var(--fm-shadow-md); }
.fm .tile[aria-pressed="true"] .ti:not(.flag) { background: linear-gradient(135deg, var(--fm-accent), var(--fm-cyan)); border-color: transparent; color: #fff; }
.fm .tile[aria-pressed="true"] .tt { color: var(--fm-ink); }

.fm .chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.fm .chip { padding: 8px 15px; border-radius: var(--fm-r-pill); background: var(--fm-accent-tint); border: 1px solid transparent; color: var(--fm-accent-strong); font-weight: 600; font-size: 13px; transition: all .15s ease; cursor: pointer; }
.fm .chip[aria-pressed="true"] { background: var(--fm-accent); color: #fff; box-shadow: var(--fm-shadow-sm); }


.fm textarea.in { resize: vertical; min-height: 74px; }
.fm select.in { appearance: none; background-image: linear-gradient(45deg,transparent 50%,var(--fm-faint) 50%),linear-gradient(135deg,var(--fm-faint) 50%,transparent 50%); background-position: right 16px center, right 11px center; background-size: 5px 5px,5px 5px; background-repeat: no-repeat; padding-right: 34px; }
/* ---- Field state slot: the control, then its state icon *beside* it. The
   control flexes so the row leaves room rather than the icon overlapping the
   text (it used to sit inside the box). */
.fm .in-row { display: flex; align-items: center; gap: 10px; }
.fm .in-row > .form-input, .fm .in-row > .form-select,
.fm .in-row > .form-textarea, .fm .in-row > .tiles, .fm .in-row > .chips,
.fm .in-row > .toggle, .fm .in-row > .fm-checklist, .fm .in-row > .checkline { flex: 1 1 auto; min-width: 0; }
/* A fixed slot, so fields line up whether or not they currently show an icon.
   The icon is small: the box beside it carries the state too (below), so the
   icon only has to say which state it is. */
.fm .fstat { flex: 0 0 22px; width: 22px; height: 22px; display: grid; place-items: center; }
.fm .fs { display: grid; place-items: center; cursor: help; }
.fm .fs svg { width: 18px; height: 18px; display: block; }
.fm .fs.ok { color: var(--fm-success); }
.fm .fs.bad { color: var(--fm-danger); }
.fm .fs.warn { color: var(--fm-warn); }
.fm .fs.req { color: var(--fm-muted); }
/* The answer box wears its field's state as well as the icon beside it: grey
   while a required answer is still to give, green once the answer holds, amber
   for a warning and red where it is refused. Read off the state slot with
   :has, so a live check landing recolours the box with no script, and left
   off while the box has the focus, whose own ring says where the typing is. */
.fm .in-row:has(> .fstat .fs.req) { --fm-field-state: var(--fm-faint); }
.fm .in-row:has(> .fstat .fs.ok) { --fm-field-state: var(--fm-success); }
.fm .in-row:has(> .fstat .fs.warn) { --fm-field-state: var(--fm-warn); }
.fm .in-row:has(> .fstat .fs.bad) { --fm-field-state: var(--fm-danger); }
.fm .in-row:has(> .fstat .fs) > :is(.form-input, .form-select, .form-textarea):not(:focus) {
  border-color: var(--fm-field-state);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--fm-field-state) 18%, transparent);
}
/* A refusal the last render drew under a field is spent once the field, left
   again, comes back answered: the box is green and the sentence under it would
   say otherwise. */
.fm .q:has(> .in-row > .fstat .fs.ok) > .hint.fm-hint-danger { display: none; }
/* The reason a live check failed is shown under the control rather than only
   in its title - warning during entry is the point of checking as the answer
   is typed. See .fm .fstat > .fs-msg below. */
/* A field's error message sits in .q's own margin gap rather than adding to
   its height, so a check flipping between OK and failing, or a live D365 check
   landing, does not push every question below it down the page. It used to do
   that by being absolutely positioned under .q, which held for one line and
   not for two: a message that wrapped, which on a phone is most of them, was
   drawn straight over the next question. It is in the flow now, one line
   exactly the height of the gap (2px above, 16px of text, 2px of padding each
   side: 22px, .q's margin-bottom), with a negative bottom margin of that same
   22px, so one line takes the gap and adds nothing, and every further line
   pushes the next question down by its own height rather than covering it. */
.fm .q .hint.fm-hint-danger {
  margin: 2px 0 -22px;
  padding: 2px 8px;
  line-height: 16px;
  background: var(--fm-danger-tint);
  border-radius: var(--fm-r-sm);
  position: relative;
  z-index: 1;
}
/* The live check's reason is swapped into the 22px slot beside the control,
   which is no place for a sentence. While it is there the slot dissolves into
   the row (display: contents), the row wraps, the icon keeps its 22px and the
   reason takes a line of its own under the control, with the same
   gap-absorbing margin as the message above. */
.fm .in-row:has(.fs-msg) { flex-wrap: wrap; }
.fm .in-row:has(.fs-msg) > :not(.fstat) { flex-basis: calc(100% - 32px); }
.fm .fstat:has(> .fs-msg) { display: contents; }
.fm .fstat:has(> .fs-msg) > .fs { flex: 0 0 22px; width: 22px; height: 22px; }
.fm .fstat > .fs-msg { flex: 1 0 100%; margin-left: 0; margin-top: 2px; }
/* Tiles and a list of ticks are taller than one line, so their icon sits at
   the top. A row of chips is centred like a box: it is one line wherever there
   is room for it, and the icon then sits on the middle of the chips. */
.fm .in-row:has(> .tiles), .fm .in-row:has(> .fm-checklist) { align-items: flex-start; }
/* A choice group's gap above it belongs to the row, not the group: on the
   group, the row centred its icon against the margin as well as the group and
   the icon sat several pixels high of the choices beside it. */
.fm .in-row:has(> :is(.tiles, .chips, .toggle)) { margin-top: 10px; }
.fm .in-row:has(> .fm-checklist) { margin-top: 8px; }
.fm .in-row > :is(.tiles, .chips, .toggle, .fm-checklist) { margin-top: 0; }
/* Beside a list of ticks the icon is centred on its first line: the slot and
   a ticked line are one height. */
.fm .fm-check { min-height: 22px; }

/* The autosave line under the entry form: present but quiet, and reserving its
   height so an autosave landing does not nudge the page. */
.fm .entry-autosave { display: flex; align-items: center; gap: 6px; justify-content: flex-end;
  min-height: 22px; margin-top: 8px; font-size: 12px; color: var(--fm-muted); }
.fm .entry-autosave svg { width: 14px; height: 14px; }
.fm .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px){ .fm .field-row { grid-template-columns: 1fr; } }

/* link / prefill bar + resume */
.fm .util { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 780px; margin-inline: auto; }
.fm .linkbar { background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-lg); padding: 14px 16px; box-shadow: var(--fm-shadow-sm); }
.fm .linkbar .lb-top { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.fm .linkbar .lb-row { display: flex; gap: 8px; }
.fm .linkbar input { flex: 1; font-family: var(--fm-mono); font-size: 12px; }
.fm .presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.fm .preset { font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: var(--fm-r-pill); background: var(--fm-surface-2); border: 1px solid var(--fm-line); color: var(--fm-muted); }
.fm .preset:hover { border-color: var(--fm-accent); color: var(--fm-accent); }
.fm .resume { display: flex; align-items: center; gap: 12px; background: var(--fm-warn-tint); border: 1px solid color-mix(in srgb, var(--fm-warn) 35%, transparent); border-radius: var(--fm-r-lg); padding: 12px 16px; }
.fm .resume .rt { flex: 1; font-size: 13px; }
.fm .resume b { color: var(--fm-ink); }

.fm details.json { background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-lg); box-shadow: var(--fm-shadow-sm); overflow: hidden; }
.fm details.json > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; list-style: none; }
.fm details.json > summary::-webkit-details-marker { display: none; }
.fm details.json[open] > summary { border-bottom: 1px solid var(--fm-line); }
.fm details.json pre { margin: 0; padding: 14px 16px; font-family: var(--fm-mono); font-size: 12px; line-height: 1.6; color: var(--fm-ink); overflow-x: auto; background: var(--fm-surface-2); }
.fm .jk { color: var(--fm-accent-strong); } .fm .js { color: var(--fm-success); } .fm .jn { color: var(--fm-warn); } .fm .jc { color: var(--fm-faint); }

/* preview */
.fm .pv-section { background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-lg); box-shadow: var(--fm-shadow-sm); padding: 18px 20px; margin-bottom: 14px; position: relative; }
.fm .pv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.fm .pv-head h3 { font-size: 15.5px; }
.fm .pv-editbtn { font-size: 12px; font-weight: 600; color: var(--fm-accent-strong); background: var(--fm-accent-tint); border: 0; padding: 6px 11px; border-radius: var(--fm-r-pill); display: inline-flex; align-items: center; gap: 6px; }
.fm .pv-editbtn svg { width: 14px; height: 14px; }
.fm .pv-note { display: flex; align-items: center; gap: 10px; background: var(--fm-accent-tint); border-radius: var(--fm-r-md); padding: 10px 14px; margin-bottom: 16px; font-size: 13px; color: var(--fm-accent-strong); font-weight: 600; }
/* Tone modifiers for .pv-note. The base note is accent-toned; a note reporting a
   failure or a success says so with one of these rather than an inline
   background/colour pair, which is how the same value ended up copied into four
   templates - see inline_style_test. They follow the base rule because a single
   class ties with it on specificity and only wins on source order. */
.fm .pv-note-danger { background: var(--fm-danger-tint); color: var(--fm-danger); }
.fm .pv-note-ok { background: var(--fm-success-tint); color: var(--fm-success); }
/* A note whose body is a list of problems rather than one sentence. */
.fm .pv-note-list { margin: 6px 0 0; padding-left: 18px; }

/* The panel a submission shows while its records are written: a heading with
   the spinner beside it while it goes, the sentence, a line per record, and
   what can be done next. */
.fm .fm-delivery { padding: 24px 26px; display: flex; flex-direction: column; gap: 12px; }
.fm .fm-delivery-head { display: flex; align-items: center; gap: 10px; }
.fm .fm-delivery-title { font-size: 15.5px; margin: 0; }
.fm .fm-delivery-sentence { margin: 0; font-size: 13.5px; max-width: 72ch; }
.fm .fm-delivery-records td, .fm .fm-delivery-records th { vertical-align: top; }
.fm .fm-delivery-rows { width: 64px; text-align: right; }
.fm .fm-delivery-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
/* Cancel and send back: a disclosure whose summary is a button, opening onto
   where to send the submission and why, under a rule of its own so it reads as
   a second way on rather than one more link beside the first. */
.fm .fm-delivery-cancel { border-top: 1px solid var(--fm-line); padding-top: 12px; }
.fm .fm-delivery-cancel > summary { list-style: none; width: fit-content; cursor: pointer; }
.fm .fm-delivery-cancel > summary::-webkit-details-marker { display: none; }
.fm .fm-delivery-cancel-body { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; max-width: 72ch; }
.fm .fm-delivery-cancel-body .form-hint { margin: 0; }

/* Forms' entry page and the designer's preview both draw form_parts.html, so
   the geometry those parts carried inline lives here, where both read it. */
.fm .entry-card-pad { padding: 24px 26px; }
.fm .entry-card-pad .fm-delivery-actions { margin-top: 16px; }
.fm .pv-note-warn { background: var(--fm-warn-tint, var(--fm-success-tint)); color: var(--fm-warn, var(--fm-success)); }
.fm .stagebar-sep { color: #fff; opacity: 0.55; }
.fm .review-body { padding: 20px 22px; }
.fm .pub-check-body { flex: 1; min-width: 0; }
.fm .rev-answer.is-nested { padding-left: 14px; }
.fm .rev-answer.is-nested-2 { padding-left: 28px; }
.fm .entry-foot.is-end { justify-content: flex-end; }
.fm .entry-foot.is-end-spaced { margin-top: 18px; }
.fm .hint.options-error { color: var(--fm-danger); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* A submission's answers: the question at the left, a column wide enough to
   read it in, and the answer beside it. */
.form-answers .form-answer-question {
  text-align: left;
  width: 40%;
}

/* The ways into a delivery: what it was writing, sending it again, and the
   run in Automate for somebody who may open it. */
.form-delivery-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* One commit point's delivery on a submission's page. A submission written at
   several commit points lists them one after another, so each after the first
   is set apart by a rule of its own rather than run into the one above. */
.form-delivery-summary + .form-delivery-summary {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* drawer */
.fm .backdrop { position: fixed; inset: 0; background: rgba(10,30,50,.4); backdrop-filter: blur(2px); z-index: 70; animation: fm-fade .2s ease; }
@keyframes fm-fade { from { opacity: 0; } to { opacity: 1; } }
.fm .drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(460px, 100%); background: var(--fm-surface); border-left: 1px solid var(--fm-line); box-shadow: var(--fm-shadow-lg); z-index: 71; display: flex; flex-direction: column; animation: fm-slide .24s cubic-bezier(.2,.7,.3,1); }
@keyframes fm-slide { from { transform: translateX(100%); } to { transform: none; } }
.fm .drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--fm-line); }
.fm .drawer-head h3 { font-size: 16px; }
.fm .drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.fm .drawer-foot { padding: 16px 20px; border-top: 1px solid var(--fm-line); display: flex; gap: 10px; justify-content: flex-end; }
.fm .frow { margin-bottom: 16px; }
.fm .frow > label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 6px; }
.fm .frow .fhelp { font-size: 11.5px; color: var(--fm-muted); margin-top: 5px; }
/* A collapsible whose summary is styled as help text still has to look clickable. */
.fm summary.fhelp { cursor: pointer; }
.fm .segsm { display: inline-flex; background: var(--fm-surface-2); border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); padding: 3px; gap: 2px; flex-wrap: wrap; }
.fm .segsm button { border: 0; background: transparent; color: var(--fm-muted); font-weight: 600; font-size: 12.5px; padding: 7px 12px; border-radius: var(--fm-r-sm); }
.fm .segsm button[aria-selected="true"] { background: var(--fm-accent); color: #fff; }
.fm .checkline { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.fm .switch { position: relative; width: 40px; height: 23px; flex: none; }
.fm .switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.fm .switch .tr { position: absolute; inset: 0; background: var(--fm-line-strong); border-radius: 999px; transition: .18s; }
.fm .switch .tr::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; background: #fff; border-radius: 50%; transition: .18s; box-shadow: var(--fm-shadow-sm); }
.fm .switch input:checked + .tr { background: var(--fm-accent); }
.fm .switch input:checked + .tr::after { transform: translateX(17px); }
.fm .bind-row, .fm .cond-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.fm .bind-row select, .fm .cond-row select, .fm .cond-row input { flex: 1; padding: 8px 10px; font-size: 12.5px; }
/* The name label in a picker result row (the entity/table it offers) takes the
   remaining width beside its Use button. A class rather than an inline style so it
   does not win the cascade over a later stylesheet fix - see inline_style_test. */
.fm .picker-result-name { flex: 1; font-size: 12.5px; }
/* A file lookup's Storage browser: the locations, the way down, and a row per
   folder or readable file. The rows are buttons, a whole row the target of the
   press, so a long file name wraps rather than pushing its size off the edge. */
.fm .file-lookup-browser { border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; }
.fm .file-lookup-roots { display: flex; flex-wrap: wrap; gap: 6px; }
.fm .file-lookup-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.fm .file-lookup-sep { width: 14px; height: 14px; color: var(--fm-faint); }
.fm .file-lookup-list { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.fm .file-lookup-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--fm-ink); font: inherit; font-size: 12.5px; padding: 7px 8px; border-radius: var(--fm-r-sm); cursor: pointer; }
.fm .file-lookup-row:hover, .fm .file-lookup-row:focus-visible { background: var(--fm-surface-2); }
.fm .file-lookup-row.is-chosen { background: var(--fm-accent-tint); color: var(--fm-accent-strong); font-weight: 600; }
.fm .file-lookup-row > span:first-of-type { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fm .file-lookup-size { color: var(--fm-muted); font-size: 11.5px; flex: none; }
.fm .file-lookup-ic { width: 16px; height: 16px; flex: none; color: var(--fm-muted); }
.fm .file-lookup-chosen .picker-result-name { display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.fm .file-lookup-value { opacity: .65; font-size: 10.5px; }
/* The columns a file lookup carries: a tick per heading, wrapping as the
   static list's attribute columns sit side by side. */
.fm .file-lookup-attrs { display: flex; flex-wrap: wrap; gap: 6px; }
.fm .file-lookup-attr { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--fm-surface-2); border: 1px solid var(--fm-line); border-radius: var(--fm-r-pill); padding: 4px 10px; cursor: pointer; }
.fm .file-lookup-attr.is-missing { border-color: var(--fm-danger); }
.fm .file-lookup-missing { color: var(--fm-danger); font-size: 11px; }
/* The sample, as the static list's grid lays its rows out: a column per
   attribute, scrolled sideways inside its own box rather than the page. */
.fm .file-lookup-table-wrap { overflow-x: auto; border: 1px solid var(--fm-line); border-radius: var(--fm-r-sm); }
.fm .file-lookup-table { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.fm .file-lookup-table th { text-align: left; font-weight: 600; color: var(--fm-muted); background: var(--fm-surface-2); white-space: nowrap; }
.fm .file-lookup-table th, .fm .file-lookup-table td { padding: 6px 9px; border-bottom: 1px solid var(--fm-line); vertical-align: top; }
.fm .file-lookup-table td { max-width: 240px; overflow-wrap: anywhere; }
.fm .file-lookup-table tbody tr:last-child td { border-bottom: 0; }
.fm .file-lookup-problem { margin-bottom: 10px; }
.fm .removex { border: 0; background: var(--fm-surface-2); color: var(--fm-danger); width: 30px; height: 30px; border-radius: var(--fm-r-sm); flex: none; font-size: 15px; }
.fm .bind-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--fm-accent-tint); color: var(--fm-accent-strong); border-radius: var(--fm-r-pill); padding: 6px 12px; font-size: 12.5px; font-weight: 600; margin: 0 6px 6px 0; }
.fm .bind-chip .guid { font-family: var(--fm-mono); font-size: 9.5px; opacity: .6; }
.fm .bind-chip button { border: 0; background: transparent; color: inherit; font-size: 14px; }
.fm .drawer-note { font-size: 11.5px; color: var(--fm-muted); background: var(--fm-surface-2); border-radius: var(--fm-r-sm); padding: 9px 11px; display: flex; gap: 8px; }
/* What a role design lookup offers: each approved role's D365 name and who
   it is for, a line each. */
.fm .role-design-offers { margin: 0; padding-left: 18px; font-size: 12.5px; }
.fm .role-design-offers .mono { margin-right: 6px; }
/* One check in the entry-checks editor (see form_build.html's entry-checks-editor).
   The card stacks its header above the parameter rows, so it overrides
   .drawer-note's flex row; the header itself is the row: name, description, remove. */
/* Validate's mark: the module's own icon and name, as a small pill, wherever
   Forms uses a check from its catalogue - the checks editor's heading, the
   picker's lead, a question card and a field chip. One class so it reads the
   same in all four places. The size rule lands on the <svg> itself. */
.fm .fm-validate-mark { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--fm-accent-strong); background: var(--fm-accent-tint); padding: 2px 7px; border-radius: 999px; vertical-align: middle; }
.fm .fm-validate-mark b { font-weight: 800; }
.fm-validate-mark-icon { width: 12px; height: 12px; flex: none; }
/* The shield alone, where the mark repeats down a list. */
.fm .fm-validate-mark.is-compact { padding: 3px; flex: none; }
.fm .fm-validate-mark.is-compact .fm-validate-mark-icon { width: 14px; height: 14px; }
.fm .qcard > .fm-validate-mark.is-compact { margin-left: auto; }
.fm .echk-title { display: inline-flex; align-items: center; gap: 8px; }
/* A check in the editor is the Check Library's card with its settings under
   the text: the chip, the name and the key read exactly as they read in the
   library, and the parameters take the card's whole width beneath a rule. */
.fm .library-card.echk-card { margin-top: 8px; grid-template-rows: auto auto; }
.fm .echk-card .echk-params { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--border); }
.fm .echk-card .echk-params .frow { margin-top: 6px; }
.fm .echk-head { position: relative; padding-right: 32px; }
.fm .echk-head .echk-remove { position: absolute; right: 0; top: -4px; }
.fm .echk-card.is-inherited { opacity: .85; background: var(--surface-2, var(--surface)); }
.fm .echk-inherited { margin-top: 12px; }
.fm .echk-pick-cards .library-card { text-align: left; font: inherit; cursor: pointer; }
.fm .echk-pick-lead { margin-bottom: 10px; line-height: 1.6; }
/* The format wizard's shapes: a card per shape with its example under the
   name, two to a row where the drawer has the room. */
.fm .pat-shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); gap: 6px; }
.fm .pat-shape > span .fhelp { margin: 0; }

/* ---- Configurator modal: the shared .modal (issue #166) - Form Management's
   own family is gone. Only the step chips inside it stay module-styled; the
   .drawer rules above are kept for future small, single-pane editors. */
.modal-steps .step.cur { background: var(--fm-accent-tint); border-color: color-mix(in srgb, var(--fm-accent) 30%, var(--fm-line)); color: var(--fm-accent-strong); }
.modal-steps .step.cur .n { background: var(--fm-accent); color: #fff; }

/* ---- The tab strip carries the form-level save actions on its right. */
.fm .tabsbar-actions { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
/* Same height as a tab: the strip is one row of controls, not two sizes. */
.fm .tabsbar-actions .btn { padding-top: 0; padding-bottom: 0; min-height: 40px; font-size: 13px; }
.fm .tabsbar-note { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--fm-muted); }
.fm .tabsbar-note svg { width: 14px; height: 14px; }

/* ---- Details: two columns of short fields, with room for a full-width one. */
.fm .detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 4px 20px; }
.fm .detail-grid .frow-wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .fm .detail-grid { grid-template-columns: 1fr; } }

/* ---- Reorder buttons (see the fm-move template).
   The keyboard- and touch-operable counterpart to the drag grip, which is
   pointer-only. Kept tight and quiet so a pair of them does not outweigh the
   card's real actions; they still reach 44px on a touch device through the
   .btn-icon-only rule in the responsive section. */
.fm .fm-move { display: inline-flex; gap: 2px; flex: none; }
.fm .fm-move-btn { color: var(--fm-faint); }
.fm .fm-move-btn:not(:disabled):hover { color: var(--fm-accent); }
.fm .fm-move-btn:disabled { opacity: .35; cursor: default; }
/* The stage tube's pair sits in the card foot beside Configure, so it needs to
   stop the foot's other controls being pushed out of line. */
.fm .actions-row-foot .fm-move { margin-right: 4px; }

/* A draggable stage needs its handle, and the tube must allow the drop styling. */
.fm .stage .grip { position: absolute; top: 10px; right: 10px; color: var(--fm-faint); cursor: grab; }
.fm .stage.fm-dragging { opacity: .5; }
.fm .stage.fm-drag-over { border-color: var(--fm-accent); box-shadow: 0 0 0 2px var(--fm-accent-tint); }

/* ---- Icon picker (form details). */
.fm .iconpick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fm .iconpick-current { width: 40px; height: 40px; border-radius: var(--fm-r-sm); background: var(--fm-accent-tint); color: var(--fm-accent); display: grid; place-items: center; }
.fm .iconpick-current svg { width: 22px; height: 22px; }
.fm .icongrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-top: 10px; }
.fm .iconopt { display: grid; place-items: center; height: 44px; border-radius: var(--fm-r-sm); background: var(--fm-surface-2); border: 1px solid var(--fm-line); color: var(--fm-ink); transition: all .12s ease; }
.fm .iconopt:hover { border-color: var(--fm-accent); color: var(--fm-accent); }
.fm .iconopt.sel { background: var(--fm-accent-tint); border-color: var(--fm-accent); color: var(--fm-accent-strong); }
.fm .iconopt svg { width: 20px; height: 20px; }
/* The form's icon beside its title, on the entry page's banner/heading. */
.fm .entry-banner-ic svg, .fm .entry-linear-head .entry-banner-ic svg { width: 1.1em; height: 1.1em; vertical-align: -0.12em; }
/* Condition builder: one row per condition (what to test · how · value), so a
   rule is assembled from pickers instead of typed as an expression. */
.fm .cond-list { display: flex; flex-direction: column; gap: 8px; }
.fm .cond-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 6px; align-items: center; background: var(--fm-surface-2); border: 1px solid var(--fm-line); border-radius: var(--fm-r-sm); padding: 8px; }
.fm .cond-row .in { padding: 8px 10px; font-size: 12.5px; min-width: 0; }
.fm .cond-row select.cond-op { width: auto; }
.fm .cond-novalue { font-size: 11.5px; color: var(--fm-faint); font-style: italic; }
/* Static lookup choices: display · stored value · icon · remove. */
.fm .entry-row { display: grid; grid-template-columns: 1fr 1fr 150px var(--attr-cols,) auto; gap: 6px; align-items: center; }
.fm .entry-icon .form-input { min-width: 0; }
.fm .entry-row .attr-head { display: inline-flex; align-items: center; gap: 2px; }
.fm .entry-add-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.fm .entry-add-attr { display: inline-flex; align-items: center; gap: 6px; }
.fm .entry-add-attr .form-input { width: 160px; }
.fm .entry-row .in { padding: 8px 10px; font-size: 12.5px; min-width: 0; }
.fm .entry-row-head { padding: 0 2px; }
/* Service lookup input/output tables: Show and Primary are narrow columns
   whose heading and control are both centred, so the tick sits under its
   title; the name and Default columns stay left-aligned. Outputs have no
   Default column. */
.fm .svc-io .entry-row { grid-template-columns: 1fr 72px 72px 1fr; }
.fm .svc-io-out .entry-row { grid-template-columns: 1fr 72px 72px; }
.fm .svc-io .svc-c { justify-self: center; text-align: center; }
/* The icon column shows what it will look like as you type it. */
.fm .entry-icon { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fm .entry-icon .in { min-width: 0; }
.fm .entry-icon-preview { flex: none; display: grid; place-items: center; width: 24px; height: 18px; }
.fm .entry-icon-preview .choice-mdi { width: 18px; height: 18px; }
@media (max-width: 560px) { .fm .cond-row { grid-template-columns: 1fr auto; } }
/* On a phone a choice's four or more cells cannot share a line: the row is two
   columns, so the shown words and the stored value sit side by side, then the
   icon and any attributes, and the remove button ends the row at its right.
   The heading row is the same grid, so each label sits over its cell. A
   service's inputs keep Show and Primary beside the name, narrower, and the
   Default box takes a line of its own under them. */
@media (max-width: 560px) {
  .fm .entry-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fm .entry-row > .btn-icon-only:last-child { justify-self: end; }
  /* Two lines a choice, so a rule under each says where one ends. */
  .fm .cond-list > .entry-row:not(.entry-row-head) { padding-bottom: 8px; border-bottom: 1px solid var(--fm-line); }
  .fm .svc-io .entry-row,
  .fm .svc-io-out .entry-row { grid-template-columns: minmax(0, 1fr) 52px 52px; }
  .fm .svc-io .entry-row > .svc-default { grid-column: 1 / -1; }
  .fm .svc-io .entry-row > .mono { overflow-wrap: anywhere; }
}

/* The app-wide transient toast (showToast in mcp_scripts_detail.js): appended
   to <body> with class="toast" alone and removed 2.5s later, so it must be
   visible without a .show class - hence the animation rather than a toggled
   transition. Styled with the global tokens; the Form Management shell's own
   .fm .toast below is more specific and keeps its look. Until this rule
   existed the MCP save/format toast rendered unstyled at the end of <body>,
   i.e. invisibly. */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--surface-elevated); color: var(--text); border: 1px solid var(--border); padding: 12px 20px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); font-weight: 600; font-size: 14px; pointer-events: none; z-index: 90; animation: toast-in 0.2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.fm .toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--fm-ink); color: var(--fm-surface); padding: 13px 20px; border-radius: var(--fm-r-pill); box-shadow: var(--fm-shadow-lg); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 10px; pointer-events: none; transition: all .3s ease; z-index: 90; }
.fm .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.fm .toast svg { width: 18px; height: 18px; color: #74e0a8; }

.fm .fab { position: fixed; right: 22px; bottom: 22px; width: 54px; height: 54px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--fm-accent), var(--fm-cyan)); color: #fff; display: grid; place-items: center; box-shadow: var(--fm-shadow-lg); z-index: 50; transition: transform .2s ease; }
.fm .fab:hover { transform: scale(1.06) rotate(-4deg); }
.fm .fab svg { width: 24px; height: 24px; }
.fm .feedback { position: fixed; right: 22px; bottom: 88px; width: 320px; background: var(--fm-surface); border: 1px solid var(--fm-line); border-radius: var(--fm-r-lg); box-shadow: var(--fm-shadow-lg); overflow: hidden; z-index: 55; animation: fm-pop .2s ease; }
@keyframes fm-pop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
.fm .feedback .fh { background: linear-gradient(120deg, var(--fm-accent), var(--fm-cyan)); color: #fff; padding: 16px 18px; position: relative; }
.fm .feedback .fh h4 { font-size: 16px; } .fm .feedback .fh p { margin: 4px 0 0; font-size: 12px; opacity: .9; }
.fm .feedback .fh .x { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.2); border: 0; color: #fff; width: 26px; height: 26px; border-radius: 50%; }
.fm .feedback .fb { padding: 16px 18px; }
.fm .emojis { display: flex; gap: 10px; margin: 6px 0 14px; }
.fm .emoji { font-size: 26px; background: transparent; border: 0; filter: grayscale(1) opacity(.5); transition: all .15s ease; }
.fm .emoji:hover, .fm .emoji[aria-pressed="true"] { filter: none; transform: scale(1.15); }
.fm .radio-row { display: flex; gap: 14px; margin: 12px 0; font-size: 13px; color: var(--fm-muted); }
.fm .radio-row label { display: inline-flex; align-items: center; gap: 6px; }

/* ---- input-driven selected states (entry controls are native radio/checkbox
   inputs so answers live in the form and post with hx-include - no JS) ---- */
.fm button.fchip, .fm .tile, .fm .chip { font: inherit; }
.fm .tile { position: relative; }
.fm .tile input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.fm .tile:has(input:checked) { border-color: var(--fm-accent); box-shadow: 0 0 0 2px var(--fm-accent-tint), var(--fm-shadow-md); }
.fm .tile:has(input:checked) .ti:not(.flag) { background: linear-gradient(135deg, var(--fm-accent), var(--fm-cyan)); border-color: transparent; color: #fff; }
.fm .tile:has(input:checked) .tt { color: var(--fm-ink); }
.fm .tile:has(input:focus-visible) { outline: 2px solid var(--fm-accent); outline-offset: 2px; }
.fm .chip { position: relative; display: inline-flex; align-items: center; }
.fm .chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.fm .chip:has(input:checked) { background: var(--fm-accent); color: #fff; box-shadow: var(--fm-shadow-sm); }
.fm .chip:has(input:focus-visible) { outline: 2px solid var(--fm-accent); outline-offset: 2px; }
/* A chip whose option is a long word wraps it rather than running past its
   card on a phone: a chip may be narrower than its words, and the words break
   inside it. */
.fm .chip { max-width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.fm .fm-step[hidden] { display: none; }
.fm .qcard.fm-dragging { opacity: .4; }
.fm .qcard.fm-drag-over, .fm .secitem.fm-drag-over { border-color: var(--fm-accent); box-shadow: 0 0 0 2px var(--fm-accent-tint); }

/* ---- fm-flat: on-brand flatten (ES radii, no drop shadows). Applied to the
   Form Designer and the Traditional (linear) entry theme. Achieved purely by
   re-pointing the --fm-* tokens the components already consume. ---- */
.fm-flat {
  /* Cards/panels sit at the site card radius (--radius, like .tool-card);
     buttons/inputs at the small radius, with .btn pinned to the site's 4px. */
  --fm-r-xl: var(--radius);
  --fm-r-lg: var(--radius);
  --fm-r-md: var(--radius-sm);
  --fm-r-sm: var(--radius-sm);
  --fm-shadow-lg: none;
  --fm-shadow-md: none;
  --fm-shadow-sm: none;
}
.fm-flat .btn { border-radius: 4px; }
/* The token reset above is not enough on its own: html[data-theme="light"] .fm
   re-defines --fm-shadow-* and, being the more specific selector, wins over
   .fm-flat - so in light mode the shadows came back. Flatten the components with
   the plain property, which beats the token indirection in either theme. The
   drawer keeps its shadow: it is a modal overlay, where elevation is meaning. */
.fm-flat .panel, .fm-flat .btn, .fm-flat .card, .fm-flat .card:hover,
.fm-flat .stage, .fm-flat .secitem, .fm-flat .qcard, .fm-flat .listcard,
.fm-flat .tile, .fm-flat .appbar, .fm-flat .pv-section, .fm-flat .brand .logo,
.fm-flat .seg button[aria-selected="true"] { box-shadow: none; }
/* Keep the current-stage ring, drop only its drop shadow. */
.fm-flat .stage.cur { box-shadow: 0 0 0 3px var(--fm-accent-tint); }

/* ---- Form themes (internal/formmgmt/form/theme.go). A form's container wears
   fm-themed, its style's class (fm-style-<id>) and the author's own colours,
   fonts and corners as inline --fm-* properties, which beat the style's. A
   style is nothing but tokens and a few component rules, so every part of the
   form - the banner, the boxes, the chips, the state outline - follows it with
   no rule of its own. Each style states a dark palette and, under
   html[data-theme="light"], a light one, as the forms tokens above do; the
   light rules match html[data-theme="light"] .fm's weight and come later, so a
   style's shadows are its own in either theme. Placed after .fm-flat so a style
   also sets the Traditional layout's corners. ---- */
.fm-themed { font-family: var(--fm-font-body); color: var(--fm-ink); }
.fm-themed :is(h1, h2, h3, h4) { font-family: var(--fm-font-heading); }
.fm-themed.fm-has-bg { background: var(--fm-bg); border-radius: var(--fm-r-lg); }
/* A page colour of the form's own reaches the foot of the window, or a short
   form sits on a block of its colour with the site's below it. */
.tool-page.fm-themed.fm-has-bg { padding: 20px 16px 28px; min-height: calc(100dvh - 140px); }
.fm-theme-frame.fm-has-bg { padding: 16px; }

/* The site's buttons and form controls read the site's tokens, so inside a
   themed form they are pointed at the form's: Submit wears the form's accent,
   a box its card and lines. */
.fm-themed .btn-primary { background: var(--fm-accent); border-color: var(--fm-accent); color: var(--fm-accent-ink); }
.fm-themed .btn-primary:hover:not(:disabled) { background: var(--fm-accent-strong); border-color: var(--fm-accent-strong); }
.fm-themed .btn-secondary { background: var(--fm-surface); border-color: var(--fm-line-strong); color: var(--fm-ink); }
.fm-themed .btn-secondary:hover:not(:disabled) { background: var(--fm-surface-2); }
.fm-themed .btn { border-radius: var(--fm-r-sm); font-family: inherit; }
.fm-themed :is(.form-input, .form-select, .form-textarea) { background: var(--fm-surface); color: var(--fm-ink); border-color: var(--fm-line-strong); border-radius: var(--fm-r-sm); }
.fm-themed a:not(.btn) { color: var(--fm-accent); }

/* The Theme tab: the settings beside the form drawn as it will look, the
   sample taking the wider column since it is what the settings are judged by.
   Stacked once there is no room for both side by side. */
.fm .fm-theme-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
@media (max-width: 1100px) { .fm .fm-theme-grid { grid-template-columns: minmax(0, 1fr); } }
.fm .fm-theme-settings { min-width: 0; }
.fm .fm-theme-sample { position: sticky; top: 12px; min-width: 0; }
.fm .fm-theme-sample > .fm-theme-frame { margin-top: 8px; }
.fm .fm-theme-cards { display: grid; gap: 10px; margin-top: 8px; }
.fm .fm-theme-layouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fm .fm-theme-styles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.fm .fm-theme-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); background: var(--fm-surface); cursor: pointer; }
.fm .fm-theme-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.fm .fm-theme-card b { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.fm .fm-theme-card b svg { width: 16px; height: 16px; }
.fm .fm-theme-card span { font-size: 12.5px; color: var(--fm-muted); line-height: 1.45; }
.fm .fm-theme-card.is-chosen { border-color: var(--fm-accent); box-shadow: 0 0 0 2px var(--fm-accent-tint); }
.fm .fm-theme-card:has(input:focus-visible) { outline: 2px solid var(--fm-accent); outline-offset: 2px; }
.fm .fm-theme-swatch { display: flex; gap: 4px; margin-bottom: 4px; }
.fm .fm-theme-swatch i { width: 18px; height: 18px; border-radius: 50%; background: var(--sw, transparent); border: 1px solid color-mix(in srgb, var(--fm-ink) 18%, transparent); }
.fm .fm-theme-colours { display: grid; gap: 6px; margin-top: 8px; }
.fm .fm-theme-colour { display: grid; grid-template-columns: minmax(0, 1fr) auto 72px; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--fm-line); border-radius: var(--fm-r-sm); }
.fm .fm-theme-colour .checkline { margin: 0; }
.fm .fm-theme-colour .fhelp { display: inline; margin: 0; }
.fm .fm-theme-picker { width: 44px; height: 30px; padding: 2px; border: 1px solid var(--fm-line-strong); border-radius: var(--fm-r-sm); background: var(--fm-surface); cursor: pointer; }
.fm .fm-theme-colour:not(.is-on) .fm-theme-picker { opacity: .55; }
.fm .fm-theme-hex { font-size: 12px; color: var(--fm-muted); }
.fm .fm-theme-colour.is-on .fm-theme-hex { color: var(--fm-ink); }
.fm .fm-theme-fonts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; margin-top: 8px; }
/* The button first and the words under it, so the button sits on the row the
   selects beside it sit on. */
.fm .fm-theme-summary { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

/* The Theme tab's Logo section: the three sources as cards, the upload beside
   the picture already on the form, and each place as a sketch of the page -
   the page around the card, the banner across its top, and where the logo
   sits drawn as a spot. */
.fm .fm-theme-logos { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.fm .fm-theme-logo-sample { display: flex; align-items: center; height: 28px; margin: 2px 0; }
.fm .fm-theme-logo-sample img { height: 24px; width: auto; max-width: 100%; object-fit: contain; object-position: left center; }
.fm .fm-theme-upload { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.fm .fm-theme-upload .fhelp { margin: 0; }
.fm .fm-theme-upload-thumb { display: inline-flex; padding: 6px 10px; border: 1px dashed var(--fm-line-strong); border-radius: var(--fm-r-sm); background: var(--fm-surface-2); line-height: 0; }
.fm .fm-theme-upload-thumb img { height: 40px; width: auto; max-width: 220px; object-fit: contain; }
.fm .fm-theme-upload-btn { position: relative; cursor: pointer; }
.fm .fm-theme-upload-btn:has(input:focus-visible) { outline: 2px solid var(--fm-accent); outline-offset: 2px; }
.fm .fm-theme-places { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.fm .fm-theme-place { align-items: flex-start; }
.fm .fm-place-sketch { display: block; position: relative; flex: none; width: 64px; height: 44px; border: 1px solid var(--fm-line-strong); border-radius: 4px; background: var(--fm-surface-2); }
.fm .fm-place-card { position: absolute; left: 12px; right: 12px; top: 10px; bottom: 8px; border: 1px solid var(--fm-line); border-radius: 2px; background: var(--fm-surface); }
.fm .fm-place-banner { position: absolute; z-index: 1; left: 12px; right: 12px; top: 10px; height: 10px; border-radius: 2px 2px 0 0; background: color-mix(in srgb, var(--fm-accent) 55%, transparent); }
.fm .fm-place-spot { position: absolute; z-index: 2; width: 10px; height: 5px; border-radius: 1px; background: var(--fm-accent); }
.fm .fm-place-sketch.is-page-top-left .fm-place-spot { top: 3px; left: 3px; }
.fm .fm-place-sketch.is-page-top-centre .fm-place-spot { top: 3px; left: calc(50% - 5px); }
.fm .fm-place-sketch.is-page-top-right .fm-place-spot { top: 3px; right: 3px; }
.fm .fm-place-sketch.is-page-bottom-left .fm-place-spot { bottom: 2px; left: 3px; }
.fm .fm-place-sketch.is-page-bottom-right .fm-place-spot { bottom: 2px; right: 3px; }
.fm .fm-place-sketch.is-banner-left .fm-place-spot { top: 12px; left: 14px; background: var(--fm-surface); box-shadow: 0 0 0 1px var(--fm-accent); }
.fm .fm-place-sketch.is-banner-right .fm-place-spot { top: 12px; right: 14px; background: var(--fm-surface); box-shadow: 0 0 0 1px var(--fm-accent); }

/* ---- A form's logo (form.FormLogo, handlers_formmgmt_logo.go). An <img>
   as tall as its size says and as wide as the picture is; the site's logo
   comes as one per mode where the two modes recolour it, and only the one for
   the reader's mode is shown. On the page it is a row of its own above or
   under the form, and one under the form sits at the foot of the page, the
   page being a column (fm-logo-foot) whose last row takes the space left. In
   the banner it floats in a top corner with the banner's words beside it, on
   a card of the form's own colour unless the author asked for it bare. ---- */
.fm-logo { display: inline-flex; align-items: center; max-width: 100%; line-height: 0; }
.fm-logo img { display: block; height: var(--fm-logo-h, 48px); width: auto; max-width: 100%; object-fit: contain; }
html[data-theme="light"] img.fm-logo-mode-dark,
html:not([data-theme="light"]) img.fm-logo-mode-light { display: none; }
.fm-logo-row { display: flex; }
.fm-logo-row.is-left { justify-content: flex-start; }
.fm-logo-row.is-centre { justify-content: center; }
.fm-logo-row.is-right { justify-content: flex-end; }
.tool-page > .fm-logo-row.is-top { margin-bottom: 16px; }
.tool-page > .fm-logo-row.is-bottom { margin-top: 20px; }
.tool-page.fm-logo-foot { display: flex; flex-direction: column; min-height: calc(100dvh - 140px); }
.tool-page.fm-logo-foot > .fm-logo-row.is-bottom { margin-top: auto; padding-top: 20px; }
.fm .entry-banner:has(> .fm-logo), .fm .entry-linear-head:has(> .fm-logo) { display: flow-root; }
.fm .fm-logo.in-banner { max-width: 45%; }
.fm .fm-logo.in-banner.is-left { float: left; margin: 0 18px 10px 0; }
.fm .fm-logo.in-banner.is-right { float: right; margin: 0 0 10px 18px; }
.fm .fm-logo.on-plate { padding: 6px 10px; border-radius: var(--fm-r-sm); background: var(--fm-surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }

/* Larger text, a size up throughout, for any style. */
.fm-text-large .q > .qh { font-size: 17px; }
.fm-text-large .qsub { font-size: 14.5px; }
.fm-text-large :is(.form-input, .form-select, .form-textarea) { font-size: 16px; min-height: 44px; }
.fm-text-large :is(.chip, .toggle label span) { font-size: 15px; }
.fm-text-large .entry-banner h2 { font-size: 23px; }

/* Professional: navy and slate, a gold rule under a solid banner, square
   shapes and quiet shadows. */
.fm-style-professional {
  --fm-accent: #7aa2d6; --fm-accent-strong: #9dbbe3; --fm-accent-tint: #1f3049; --fm-accent-ink: #0d1726;
  --fm-cyan: #d4b34a;
  --fm-bg: #0e1622; --fm-surface: #152131; --fm-surface-2: #1b2a3d; --fm-surface-3: #223349;
  --fm-ink: #e8eef6; --fm-muted: #a3b1c2; --fm-faint: #7d8ca0; --fm-line: #2a3a50; --fm-line-strong: #364a63;
  --fm-font-body: "Segoe UI", Candara, "Gill Sans", "Trebuchet MS", "Noto Sans", sans-serif;
  --fm-font-heading: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --fm-r-xl: 6px; --fm-r-lg: 5px; --fm-r-md: 4px; --fm-r-sm: 3px; --fm-r-pill: 5px;
  --fm-banner: #1b2f4d; --fm-banner-ink: #ffffff;
  --fm-shadow-lg: 0 10px 28px -16px rgba(0,0,0,.55); --fm-shadow-md: 0 6px 18px -12px rgba(0,0,0,.5); --fm-shadow-sm: 0 1px 3px rgba(0,0,0,.35);
}
html[data-theme="light"] .fm-style-professional {
  --fm-accent: #1d3557; --fm-accent-strong: #142640; --fm-accent-tint: #e6ecf4; --fm-accent-ink: #ffffff;
  --fm-cyan: #c9a227;
  --fm-bg: #eef1f5; --fm-surface: #ffffff; --fm-surface-2: #f6f8fb; --fm-surface-3: #eef2f7;
  --fm-ink: #1b2733; --fm-muted: #52606f; --fm-faint: #8592a1; --fm-line: #dde3ea; --fm-line-strong: #c8d1dc;
  --fm-banner: #1d3557; --fm-banner-ink: #ffffff;
  --fm-shadow-lg: 0 10px 28px -16px rgba(20,38,64,.28); --fm-shadow-md: 0 6px 18px -12px rgba(20,38,64,.22); --fm-shadow-sm: 0 1px 3px rgba(20,38,64,.12);
}
/* Its banner keeps to deep navy in either theme, where the accent lightens for
   the dark one: a solid banner is the form's letterhead, not a control. */
.fm-style-professional .entry-banner { background: var(--fm-banner); color: var(--fm-banner-ink); border-bottom: 4px solid var(--fm-cyan); }
.fm-style-professional .entry-banner h2 { font-weight: 600; letter-spacing: -.005em; }
.fm-style-professional .q > .qh { font-weight: 600; }

/* Accessible: strong contrast, larger text and targets, thick focus rings, a
   solid banner and nothing that moves. */
.fm-style-accessible {
  --fm-accent: #8cc4ff; --fm-accent-strong: #b5d9ff; --fm-accent-tint: #10283f; --fm-accent-ink: #001428;
  --fm-cyan: #8cc4ff;
  --fm-bg: #000000; --fm-surface: #0d0d0d; --fm-surface-2: #1a1a1a; --fm-surface-3: #262626;
  --fm-ink: #ffffff; --fm-muted: #dedede; --fm-faint: #c4c4c4; --fm-line: #8a8a8a; --fm-line-strong: #c4c4c4;
  --fm-success: #6fdc8c; --fm-danger: #ff8a80; --fm-warn: #ffd166;
  --fm-font-body: "Atkinson Hyperlegible", Verdana, Tahoma, "DejaVu Sans", sans-serif;
  --fm-font-heading: "Atkinson Hyperlegible", Verdana, Tahoma, "DejaVu Sans", sans-serif;
  --fm-r-xl: 10px; --fm-r-lg: 8px; --fm-r-md: 6px; --fm-r-sm: 6px;
}
html[data-theme="light"] .fm-style-accessible {
  --fm-accent: #0b4ea2; --fm-accent-strong: #083a7a; --fm-accent-tint: #dbe8f8; --fm-accent-ink: #ffffff;
  --fm-cyan: #0b4ea2;
  --fm-bg: #f2f2f2; --fm-surface: #ffffff; --fm-surface-2: #f2f2f2; --fm-surface-3: #e6e6e6;
  --fm-ink: #0b0b0b; --fm-muted: #333333; --fm-faint: #595959; --fm-line: #6b6b6b; --fm-line-strong: #3d3d3d;
  --fm-success: #116329; --fm-danger: #b3261e; --fm-warn: #8a5300;
}
.fm-style-accessible .entry-banner { background: var(--fm-accent); color: var(--fm-accent-ink); }
.fm-style-accessible .entry-banner h2 { font-size: 24px; }
.fm-style-accessible .q > .qh { font-size: 18px; }
.fm-style-accessible :is(.qsub, .hint) { font-size: 15.5px; }
.fm-style-accessible :is(.form-input, .form-select, .form-textarea) { font-size: 17px; min-height: 48px; border-width: 2px; }
.fm-style-accessible :is(.chip, .toggle label span) { font-size: 16px; }
.fm-style-accessible .chip { padding: 11px 18px; }
.fm-style-accessible .btn { font-size: 16px; min-height: 44px; }
.fm-style-accessible :focus-visible { outline: 3px solid var(--fm-accent); outline-offset: 3px; }
.fm-style-accessible a:not(.btn) { text-decoration: underline; text-underline-offset: 3px; }
.fm-style-accessible .fstat { flex-basis: 28px; width: 28px; height: 28px; }
.fm-style-accessible .fs svg { width: 22px; height: 22px; }
.fm-style-accessible .in-row:has(> .fstat .fs) > :is(.form-input, .form-select, .form-textarea):not(:focus) {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fm-field-state) 30%, transparent);
}
.fm-style-accessible, .fm-style-accessible * { animation: none !important; transition: none !important; }

/* Organic: sage and terracotta on warm paper, soft round shapes, a book serif
   for headings and a banner of overlapping washes. */
.fm-style-organic {
  --fm-accent: #8cbf95; --fm-accent-strong: #a9d2b0; --fm-accent-tint: #263427; --fm-accent-ink: #142016;
  --fm-cyan: #d99a6c;
  --fm-bg: #161a15; --fm-surface: #20251f; --fm-surface-2: #272d25; --fm-surface-3: #2f362c;
  --fm-ink: #ecebe2; --fm-muted: #b3b6a6; --fm-faint: #8b8f80; --fm-line: #353c32; --fm-line-strong: #444c40;
  --fm-font-body: "Segoe UI", Candara, "Gill Sans", "Trebuchet MS", "Noto Sans", sans-serif;
  --fm-font-heading: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --fm-r-xl: 28px; --fm-r-lg: 22px; --fm-r-md: 16px; --fm-r-sm: 12px;
  --fm-shadow-lg: 0 18px 40px -20px rgba(0,0,0,.6); --fm-shadow-md: 0 10px 30px -16px rgba(0,0,0,.5); --fm-shadow-sm: 0 3px 10px -4px rgba(0,0,0,.4);
}
html[data-theme="light"] .fm-style-organic {
  --fm-accent: #4f7d5b; --fm-accent-strong: #3d6448; --fm-accent-tint: #e6efe6; --fm-accent-ink: #ffffff;
  --fm-cyan: #c9824e;
  --fm-bg: #f3eee3; --fm-surface: #fffdf8; --fm-surface-2: #f8f3e8; --fm-surface-3: #f1eadb;
  --fm-ink: #2f3a2f; --fm-muted: #6b7563; --fm-faint: #9a9f8d; --fm-line: #e4dccb; --fm-line-strong: #d5cab3;
  --fm-shadow-lg: 0 18px 40px -20px rgba(70,55,30,.3); --fm-shadow-md: 0 10px 30px -16px rgba(70,55,30,.25); --fm-shadow-sm: 0 3px 10px -4px rgba(70,55,30,.18);
}
.fm-style-organic .entry-banner {
  background:
    radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--fm-accent) 70%, #fff) 0%, transparent 55%),
    radial-gradient(90% 140% at 100% 100%, var(--fm-cyan) 0%, transparent 62%),
    var(--fm-accent);
  color: var(--fm-accent-ink);
}
.fm-style-organic .entry-banner h2 { font-weight: 600; font-size: 22px; }
.fm-style-organic .entry-card { border-color: transparent; box-shadow: var(--fm-shadow-md); }

/* Artistic: violet into pink, a striped banner, display serif headings and a
   card that throws a coloured block behind it. */
.fm-style-artistic {
  --fm-accent: #a78bfa; --fm-accent-strong: #c4b5fd; --fm-accent-tint: #2b2147; --fm-accent-ink: #1a0b33;
  --fm-cyan: #f472b6;
  --fm-bg: #120c1d; --fm-surface: #1c1430; --fm-surface-2: #241a3d; --fm-surface-3: #2d214a;
  --fm-ink: #f3edff; --fm-muted: #b7a8d4; --fm-faint: #8f80ad; --fm-line: #34284f; --fm-line-strong: #44365f;
  --fm-font-body: "Century Gothic", "Avenir Next", Avenir, Futura, "Trebuchet MS", sans-serif;
  --fm-font-heading: Didot, "Bodoni 72", "Bodoni MT", "Playfair Display", Georgia, serif;
  --fm-r-xl: 18px; --fm-r-lg: 14px; --fm-r-md: 10px; --fm-r-sm: 8px;
}
html[data-theme="light"] .fm-style-artistic {
  --fm-accent: #7c3aed; --fm-accent-strong: #6425d0; --fm-accent-tint: #f1e9fe; --fm-accent-ink: #ffffff;
  --fm-cyan: #ec4899;
  --fm-bg: #f7f2fd; --fm-surface: #ffffff; --fm-surface-2: #faf6ff; --fm-surface-3: #f3ecfd;
  --fm-ink: #1f1235; --fm-muted: #6c5a86; --fm-faint: #9b8db3; --fm-line: #e7def5; --fm-line-strong: #d6c7ee;
}
.fm-style-artistic .entry-banner {
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.1) 0 2px, transparent 2px 12px),
    linear-gradient(115deg, var(--fm-accent) 0%, var(--fm-cyan) 100%);
  color: var(--fm-accent-ink);
}
.fm-style-artistic .entry-banner h2 { font-style: italic; font-weight: 600; font-size: 26px; letter-spacing: .01em; }
.fm-style-artistic .entry-card { box-shadow: 10px 10px 0 0 color-mix(in srgb, var(--fm-accent) 22%, transparent); }

/* ---- inline (in-text) icon sizing: mdiIcon emits an <svg> with no intrinsic
   size, so bare icons must be constrained by context (components like .btn/.card-ic
   already do). ---- */
/* mdiIcon emits an <svg> with no intrinsic size, so any icon in a context
   without an explicit rule would stretch to its container. This default keeps
   an unruled icon text-sized; the more specific rules above/below still win.
   Under :where() so it weighs only as much as a bare `svg` (0,0,1): written as
   `.fm svg` it was (0,1,1), which outranked the shared `.btn-icon` (0,1,0), so
   a designer button's icon naming its class was still drawn at 1em and about
   140 of them were left with no class at all. A default must lose to every
   class that says something more specific. */
:where(.fm) svg { width: 1em; height: 1em; flex: none; }
.fm .add-card .plus svg { width: 22px; height: 22px; }
.fm .in-status svg { width: 15px; height: 15px; vertical-align: -0.15em; }
.fm .hint svg, .fm .drawer-note svg, .fm .pv-note svg, .fm .fhelp svg,
.fm .lb-top svg, .fm .lc-name svg, .fm .fm-back svg,
.fm .linkbar-collapsed summary svg { width: 1.05em; height: 1.05em; vertical-align: -0.15em; flex: none; }
.fm .fchip svg { width: 0.95em; height: 0.95em; vertical-align: -0.1em; }
.fm .grip svg { width: 16px; height: 16px; display: block; }

/* ---- wider entry (more space now the page header is gone) ---- */
.fm .entry-card { max-width: 920px; }
.fm .fm-back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--fm-muted); text-decoration: none; margin-bottom: 12px; }
.fm .fm-back:hover { color: var(--fm-accent); }

/* ---- collapsed pre-fill link: below the form, left, out of the way ---- */
.fm .linkbar-collapsed { max-width: 920px; margin: 18px auto 0; }
.fm .linkbar-collapsed > summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--fm-muted); list-style: none; padding: 8px 12px; border: 1px solid var(--fm-line); border-radius: var(--fm-r-md); background: var(--fm-surface-2); width: max-content; }
.fm .linkbar-collapsed > summary::-webkit-details-marker { display: none; }
.fm .linkbar-collapsed[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.fm .linkbar-collapsed .linkbar-body { border: 1px solid var(--fm-line); border-top: 0; border-radius: 0 var(--fm-r-md) var(--fm-r-md) var(--fm-r-md); padding: 14px; background: var(--fm-surface); max-width: 640px; }
.fm .linkbar-collapsed .linkbar-body .in { font-family: var(--fm-mono); font-size: 12px; }

/* ---- Traditional (linear) theme ---- */
.fm .entry-linear { max-width: 920px; margin: 0 auto; }
.fm .entry-linear-head { margin-bottom: 16px; }
.fm .entry-linear-head h2 { font-size: 22px; letter-spacing: -0.01em; }
.fm .entry-linear-head p { color: var(--fm-muted); margin: 4px 0 0; font-size: 14px; }
.fm .fm-stage-title { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--fm-faint); margin: 20px 0 8px; }
.fm .fm-lin-section { margin-bottom: 14px; padding: 18px 20px; }
.fm .fm-lin-section h3 { font-size: 15.5px; margin-bottom: 4px; }
.fm .fm-checklist { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; }
.fm .fm-check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.fm .fm-check input { width: 16px; height: 16px; }
/* A long list of ticks is set in columns and read down each, as many as fit
   at a width a choice's words still read on one line, so twenty choices take
   seven lines of the card rather than twenty with most of its width empty. A
   block, not the flex column a short list is: columns divide a block's
   content, and the gap between the lines is each line's own margin, kept
   whole with its line where a column breaks. */
.fm .fm-checklist.is-long { display: block; columns: 4 190px; column-gap: 24px; }
.fm .fm-checklist.is-long .fm-check { break-inside: avoid; margin-bottom: 9px; }
.fm .fm-checklist.is-long .fm-check > span:first-of-type { min-width: 0; overflow-wrap: anywhere; }

/* A choice the rest of the form suggests - a role covering the work asked
   for, or work the page asked about is used for - is listed first and
   marked, and nothing is ticked for the person: the mark is a tag beside a
   checklist row and a dashed edge round a chip or a tile. The note under the
   question says why. */
.fm .fm-suggested-tag { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: var(--fm-r-pill); background: var(--fm-accent-tint); color: var(--fm-accent-strong); }
.fm .chip.is-suggested, .fm .tile.is-suggested { border: 1px dashed var(--fm-accent); }
.fm .fm-suggest { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--fm-accent-tint); font-size: 13px; }
.fm .fm-suggest-lead, .fm .fm-suggest-missing { display: flex; align-items: flex-start; gap: 6px; margin: 0; }
.fm .fm-suggest-missing { margin-top: 6px; color: var(--fm-warn); }
.fm .fm-suggest-ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.fm .fm-suggest-list { margin: 6px 0 0 22px; padding: 0; }
.fm .fm-suggest-list li { margin: 2px 0; }
.fm .fm-suggest-why { color: var(--fm-muted); }

/* Fill-time service lookup modal: the results table scrolls inside the card
   so a large result set never grows the modal past the viewport. */
.fm-svc-results { overflow: auto; max-height: 50vh; margin-top: 10px; }
/* Choose is the first column and stays in sight as a wide answer scrolls sideways. */
.fm-svc-results .fm-svc-choose-col { width: 1%; white-space: nowrap; position: sticky; left: 0; z-index: 1; background: var(--fm-surface, var(--surface)); }
.fm-svc-req { color: var(--fm-danger); margin-left: 2px; }
.fm-svc-error { color: var(--fm-danger); display: flex; align-items: center; gap: 8px; }
.fm-svc-inrow { margin-bottom: var(--space-2); }
.fm-svc-inlabel { min-width: 140px; }
/* A row is a label, its box and (on the first) Search, and wraps rather than
   running past the modal: the box keeps room for a few words before it gives
   way, and on a phone the label takes a line of its own above the box. */
.fm .fm-svc-inrow { flex-wrap: wrap; }
.fm .fm-svc-inrow > .form-input { flex: 1 1 10rem; min-width: 0; }
.fm .fm-svc-inrow > .fm-svc-search-btn { flex: none; }
@media (max-width: 560px) {
  .fm .fm-svc-inlabel { flex: 1 0 100%; min-width: 0; }
}
.fm-hint-danger { color: var(--fm-danger); }
/* The Search button is inert while any required input in the modal is still
   empty. CSS-only: every required input carries a placeholder, so
   :placeholder-shown means "still blank"; the server re-checks regardless. */
.modal-body:has(input[required]:placeholder-shown) .fm-svc-search-btn {
  pointer-events: none; opacity: .55;
}

/* Designer kind pickers inside the forms designer: icon cards where the label
   is the control and the radio is hidden - the fm dialect's counterpart of
   .pkgd-kindcard. A 3-across grid because the fm modal body is ~684px wide;
   :has(input:checked) gives the selected state without waiting for the swap. */
.fm .kindrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fm .kindcard { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
                padding: 12px 14px; border: 1px solid var(--fm-line);
                border-radius: var(--fm-r-md); background: var(--fm-surface-2);
                cursor: pointer; transition: background .15s, border-color .15s; }
.fm .kindcard:hover { background: var(--fm-surface-3); }
.fm .kindcard:has(input:checked) { border-color: var(--fm-accent); background: var(--fm-accent-tint); }
.fm .kindcard input { position: absolute; opacity: 0; pointer-events: none; }
.fm .kindcard-ic { width: 22px; height: 22px; color: var(--fm-muted); }
.fm .kindcard:has(input:checked) .kindcard-ic { color: var(--fm-accent); }
.fm .kindcard-title { font-size: 13px; font-weight: 600; }
.fm .kindcard-desc { font-size: 11.5px; color: var(--fm-muted); }
/* Two-option pickers (e.g. Value comes from) span the same width in halves. */
.fm .kindrow-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 620px) { .fm .kindrow { grid-template-columns: 1fr; } }

/* =====================================================
   Responsive: tablet, phone and touch
   =====================================================

   Until this block existed the stylesheet had 39 media queries and not one of
   them touched the app shell, so the 258px sidebar rendered at full width on
   every viewport: on a 390px phone that left 132px - 34% of the screen - for
   content, and the in-app Form Entry page had 262px of its card clipped off the
   right edge with no way to reach it (issue #199).

   FOUR SIGNALS, deliberately kept separate rather than collapsed into one
   "mobile" breakpoint, because they answer different questions:

     max-width: 1200px   Is the sidebar worth 258px of this window? Below this
                         the icon rail is the better DEFAULT. Applied by nav.js,
                         not here, because it is only a default: the user's own
                         choice is remembered and always wins.

     max-width: 900px    Is there room for a sidebar COLUMN at all? Below this
                         there is not, so it becomes an off-canvas drawer and
                         the document goes back to scrolling itself.

     pointer: coarse     Is this being touched? A width query cannot answer
                         that. A touchscreen laptop is wide and touched; a
                         narrow desktop window is neither. Touch sizing and the
                         hover-only affordances key off this, not off width.

     max-width: 640px    Phone-scale padding and stacking, where 28px of page
                         gutter is a tenth of the screen.

   Ordered widest-first so the narrower blocks win on source order. */

/* ---- Sidebar drawer: the topbar's menu button ----
   Hidden by default and revealed only in drawer mode. It is rendered in the
   SHARED topbar block, which layout-bare also uses, so it is additionally
   suppressed on .app-bare: a shared form-entry link has no sidebar to open.
   (The <label> would be inert there anyway, since #nav-drawer only exists in
   the full layout, but an inert control the user can press is worse than no
   control at all.) */
.topbar-nav-toggle {
  display: none;
}

/* The drawer's own checkbox. Separate from #nav-toggle rather than reusing it,
   because the two mean opposite things at rest: #nav-toggle is CHECKED by
   default (the sidebar starts expanded on a desktop), while a drawer must start
   CLOSED. One checkbox cannot default to both. */
.nav-drawer {
  display: none;
}

/* Click-away layer. A <label> rather than a scripted overlay, so dismissing the
   drawer needs no JavaScript and cannot get out of step with the checkbox. */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.5);
  border: 0;
}

/* ---- Tablet and below: the sidebar becomes a drawer ---- */
@media (max-width: 900px) {
  /* Hand scrolling back to the DOCUMENT. The app-shell pattern above pins
     everything to 100vh and scrolls .main-content inside it, which on a phone
     also disables the browser's own URL-bar collapse, overscroll and
     pull-to-refresh - the user permanently loses that vertical band instead of
     reclaiming it by scrolling (issue #212). 100dvh rather than 100vh for the
     same reason: 100vh is the LARGE viewport height and excludes the collapsing
     chrome, so a 100vh shell starts life partly underneath it. */
  html, body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .main-wrapper {
    height: auto;
    overflow: visible;
  }

  .main-content {
    overflow-y: visible;
  }

  /* layout-bare gets the same treatment: it is the shell a shared form-entry
     link opens in, so it is the one most likely to be read on a phone. */
  .bare-shell {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  /* Out of flow entirely, so .main-wrapper gets the full width rather than
     258px less than it. */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 60;
    height: auto;
    width: var(--sidebar-w);
    /* Never the whole screen: the sliver of backdrop is what tells the reader
       this is a layer over the page and can be dismissed by tapping past it. */
    max-width: 86vw;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .nav-drawer:checked ~ .sidebar {
    transform: none;
  }

  .nav-drawer:checked ~ .nav-backdrop {
    display: block;
  }

  .topbar-nav-toggle {
    display: inline-flex;
  }

  body.app-bare .topbar-nav-toggle {
    display: none;
  }

  /* The launcher page renders no sidebar, so there is no drawer to open. An
     inert control the reader can press is worse than no control. */
  body.app-nosidebar .topbar-nav-toggle {
    display: none;
  }

  /* The sidebar is an overlay here, so the corner it owns is off screen until the
     drawer opens - and a launcher you have to open a drawer to reach is not one.
     The topbar starts at the left edge at these widths, so its copy is the corner.
     body.app-bare still outranks this and keeps the bare shell without one. */
  .btn.sidebar-waffle {
    display: none;
  }

  .btn.topbar-waffle {
    display: inline-flex;
  }

  /* The icon rail is meaningless once the sidebar is an overlay: there is no
     column to reclaim room from. Hiding the chevron also means #nav-toggle
     cannot be changed while in drawer mode, which is what lets every
     .nav-toggle:not(:checked) rule above stay inert here without being
     individually overridden. nav.js forces it checked below this width. */
  .sidebar-collapse-btn {
    display: none;
  }

  /* Sticky so the menu button stays reachable now that the document scrolls. */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 0 12px;
  }
}

/* ---- Touch: sizing and hover-only affordances ---- */
@media (pointer: coarse) {
  /* 44px is the floor in both the iOS HIG and WCAG 2.5.5. Before this, 26 of
     the 35 interactive elements on the home page were under it, and every one
     of the 16 controls on a form-entry step was (issues #202, #209). */
  .btn {
    min-height: 44px;
  }

  .btn.topbar-icon-btn,
  .btn.btn-icon-only {
    width: 44px;
    height: 44px;
  }

  .nav-link,
  .nav-section-toggle,
  .topbar-app,
  .topbar-profile,
  .topbar-profile-menu > summary,
  .topbar-activity-summary,
  .topbar-scratchpad-summary,
  .brand,
  .tab-label {
    min-height: 44px;
  }

  /* Narrow chrome: these are tall enough already and fail only on width. */
  .nav-section-collapse,
  .topbar-activity-summary,
  .topbar-scratchpad-summary,
  summary.btn {
    min-width: 44px;
  }

  /* Two places deliberately size a button to match a 40px tab or header row.
     That alignment is a desktop concern; on touch the floor wins. */
  .tool-header-actions .btn,
  .fm .tabsbar-actions .btn,
  .runbook-home-action-row .btn {
    min-height: 44px;
  }

  /* --topbar-h is 52px, so 44px controls already fit the band; this is a
     sizing change rather than a layout one. */

  /* Text entry at 16px or more, or mobile Safari zooms the viewport on focus
     and does not zoom back out when the field is blurred - which on a form
     meant panning horizontally between every question (issue #201). Scoped to
     touch so the desktop density is untouched. Deliberately NOT solved with
     maximum-scale=1 on the viewport meta, which would also take away
     deliberate pinch-zoom and is an accessibility regression. */
  .form-input,
  .form-select,
  .form-textarea,
  .fm .in,
  .fm .cond-row .in,
  .fm .entry-row .in {
    font-size: 16px;
    min-height: 44px;
  }

  /* A textarea's height is its rows, not a tap target to enlarge. */
  .form-textarea {
    min-height: 74px;
  }

  .fm .chip,
  .fm .step,
  .fm .seg button,
  .fm .segsm button {
    min-height: 44px;
  }

  /* The whole row is the target on a checkable line, not just the 13px box. */
  .fm .fm-check,
  .fm .checkline,
  .fm .radioline {
    min-height: 44px;
  }

  /* "All forms" above the entry card. A standalone navigation control rather
     than a link inside a sentence, so the inline-link exception does not cover
     it - it needs to be as reachable as any other button on the page. */
  .fm .fm-back {
    min-height: 44px;
  }

  /* The collapsed rail labels its items with a :hover pseudo-element, which a
     touch device can never show - leaving nine unlabelled icons and no way to
     find out what any of them is (issue #211). Rather than inventing a
     touch-tooltip, the rail itself is switched off here: the drawer already
     solves the space problem below 900px, and above it there is room for the
     labelled column. */
  .sidebar-collapse-btn {
    display: none;
  }

  .nav-toggle:not(:checked) ~ .sidebar {
    width: var(--sidebar-w);
  }

  .nav-toggle:not(:checked) ~ .sidebar .nav-link-text,
  .nav-toggle:not(:checked) ~ .sidebar .nav-section-label-text,
  .nav-toggle:not(:checked) ~ .sidebar .nav-section-chevron {
    display: inline;
  }

  /* The labelled column again, so a group's collapse button and what it
     collapsed are back as well. */
  .nav-toggle:not(:checked) ~ .sidebar .nav-section-collapse {
    display: flex;
  }

  .nav-toggle:not(:checked) ~ .sidebar .nav-section.collapsed .nav-section-items {
    display: none;
  }
}

/* Keyboard users get the rail's tooltip too. It was hover-only, so tabbing
   through a collapsed rail gave no more information than touching one did. */
.nav-toggle:not(:checked) ~ .sidebar .nav-link:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 200;
}

/* ---- Phone: gutters, chrome and the entry card ---- */
@media (max-width: 640px) {
  /* 28px each side is a sixth of a 360px screen. */
  .tool-page,
  .page-content {
    padding: 20px 14px 32px;
  }

  /* A table narrower than its columns need wraps every cell a word to a line
     before its wrapper ever scrolls, which is what a four-column list looked
     like on a phone: a description column one word wide and a page ten
     screens tall. Inside a scroll wrapper the table takes the width its
     columns ask for, a long cell wraps at a reading width, and the wrapper
     scrolls the rest. A fixed-layout table sizes its own columns from its
     headings and is left alone. */
  .table-wrapper > .data-table:not(.vault-mapping-rows):not(.vault-checks-table):not(.results-sum-table):not(.automate-io-checks):not(.automate-test-outputs):not(.automate-runbook-steps):not(.migrate-runlog-table):not(.mc-group-table):not(.ext-compare-table),
  .plain-table-wrapper > .data-table:not(.results-history-table):not(.automate-runbook-steps) {
    width: max-content;
    min-width: 100%;
  }
  .table-wrapper > .data-table td,
  .plain-table-wrapper > .data-table td {
    max-width: 20rem;
  }

  /* A button whose words are a sentence (Administration's reset) is wider
     than a phone on one line; let it wrap rather than run past its card. */
  .settings-admin-reset-row .btn {
    white-space: normal;
    text-align: left;
  }

  /* A bare code span in prose holds an identifier with nothing to break at,
     and How It Works' SECURITYROLEDUTYPRIVILEGEEXPLODEDGRAPH_POPULATE ran
     50px past a phone's edge; a badge keeps its nowrap. */
  code:not([class]) { overflow-wrap: anywhere; }

  /* The brand already names the product inside the drawer, and at this width
     the topbar has to fit a menu button, the theme toggle, the activity
     indicator and an identity. The Settings cog goes too: it is a shortcut to a
     tile the launcher already offers, and the app icon beside the name, because
     between them they left an eight-letter app name ("Automate", "Discover")
     45px to be drawn in; the name is the identity, the icon is decoration. */
  .topbar-title,
  .topbar-app-slogan,
  .topbar-profile-name,
  .topbar-settings,
  .topbar-app-icon {
    display: none;
  }

  /* The activity panel is a dropdown pinned to the bell: absolutely positioned,
     right edge on the bell's right edge, a constant 328px wide. On a phone the
     bell sits with the Settings cog and the identity to its right, so its right
     edge is only ~265px in from the left on a 390px screen - a 328px panel
     hanging off it starts at a NEGATIVE x. Its first column was off the left of
     the screen, and .main-wrapper clips (overflow: hidden), so no gesture could
     reach it.
     Below this width it is anchored to the VIEWPORT instead of to its trigger,
     and sized from the viewport rather than from a constant, so it fits whatever
     screen it is on. position: fixed rather than absolute is what escapes that
     clipping ancestor, and it is safe here because below 900px the topbar is
     sticky at top: 0 - the panel's top edge tracks it. */
  .topbar-activity-panel {
    position: fixed;
    top: calc(var(--topbar-h) + 4px);
    left: auto;
    right: 10px;
    width: min(328px, calc(100vw - 20px));
    max-height: calc(100dvh - var(--topbar-h) - 20px);
  }

  /* The scratch pad's popover, anchored to the viewport for the same reason. */
  .topbar-scratchpad-panel {
    position: fixed;
    top: calc(var(--topbar-h) + 4px);
    left: auto;
    right: 10px;
    width: min(384px, calc(100vw - 20px));
    max-height: calc(100dvh - var(--topbar-h) - 20px);
  }

  /* The form-entry card: 26px of horizontal padding on a 360px screen leaves
     the fields under 300px. */
  .fm .entry-banner,
  .fm .entry-body,
  .fm .entry-foot,
  .fm .stepper {
    padding-left: 16px;
    padding-right: 16px;
  }

  .fm .entry-body {
    padding-top: 18px;
  }

  /* Back / progress / Save draft / Submit stack rather than crowd. The primary
     action goes full width and last, where a thumb reaches it. */
  .fm .entry-foot {
    justify-content: stretch;
  }

  .fm .entry-foot .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .fm .entry-foot .prog {
    flex: 1 0 100%;
    order: -1;
    text-align: center;
  }

  /* One step per line turned a 3-step form's stepper into 140px of chrome
     before the first question, and a longer form would push the first field off
     the screen entirely (issue #204). A single scrolling row keeps the wizard's
     shape and costs one line of height whatever the step count. */
  .fm .stepper {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 6px;
  }

  .fm .step {
    flex: 0 0 auto;
  }

  .fm .entry-banner h2 {
    font-size: 17px;
  }

  .fm .entry-banner {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  /* The field state icon beside each control (required, valid, failed) is the
     first thing off the right edge on a narrow screen, and it is the one part
     of the row a filler needs to see. Under the control it always has room. */
  .fm .in-row {
    flex-wrap: wrap;
  }

  .fm .in-row > .fstat {
    flex-basis: 100%;
    justify-content: flex-start;
    justify-items: start;
    height: auto;
  }
}

/* ── Vertical spacing utilities ────────────────────────────────────────────────
   The one intent these name is "a gap above/below this block", which appeared as
   190 inline style attributes across the templates at ten different values -
   6px, 8px, 10px, 12px, 14px, 16px, 0.75rem, 1rem, 1.25rem, 1.5rem - for the same
   purpose, chosen per template (issue #164). That is the mechanism by which two
   modules end up looking subtly unlike each other for no reason anyone can point
   at, and an inline style also wins the cascade, so a later stylesheet fix
   silently does not apply wherever one already sits.

   Deliberately only margin-top and margin-bottom, and deliberately only the
   --space-* scale. This is not a utility framework: those two properties covered
   190 of the 228 purely-spacing attributes, while the rest are shorthand margins
   and paddings with 30-odd distinct values that are real one-off geometry, and a
   .p-3 used twice would be noise rather than a vocabulary. If you need a value
   that is not on the scale, that is a sign it belongs in the component's own rule
   with a name, not in a new utility.

   THESE MUST STAY LAST IN THIS FILE. A utility is a single class, so it ties on
   specificity with the component rules it is meant to override (.form-label sets
   its own margin-bottom, for one) and only wins on source order. The inline styles
   these replaced won automatically by being inline; putting the block anywhere but
   the end silently gives some elements no spacing at all. */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

/* Form file-upload widget (file question type). The wrapper holds either the
   file input or, once uploaded, the attached file with its preview link and a
   remove button. */
.fmfile { width: 100%; }
.fm-attached { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.fm-attached-link { display: inline-flex; align-items: center; gap: 4px; }
.fm-thumb { max-height: 32px; max-width: 48px; border-radius: 3px; vertical-align: middle; object-fit: cover; }

/* Stage-tube pills are links on the review page (view a stage read-only) and
   buttons in the designer preview; keep them looking like the inert pills. */
.fm a.stagepill { cursor: pointer; text-decoration: none; }
.fm .stagepill.sel { outline: 2px solid var(--accent, #4c8bf5); outline-offset: 1px; }

/* Settings > Translations. The catalogue landing (language chips + coverage
   table) and the per-namespace editor grid. Kept together and prefixed so the
   block is self-contained; colours reuse the shared theme variables. */
.translations-section { margin-top: 22px; }
.translations-locales { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; min-height: 8px; }
.translations-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px;
  background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 20px; font-size: 12.5px; }
.translations-chip-name { font-weight: 600; color: var(--text); }
.translations-chip-tag { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.translations-chip-remove-form { display: inline; margin: 0; }
.translations-chip-remove { border: none; background: transparent; color: var(--text-muted); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 3px; border-radius: 50%; }
.translations-chip-remove:hover { color: var(--sev-prob-text, #b3261e); }

.translations-add { display: flex; gap: 8px; align-items: center; }
.translations-add-input { max-width: 240px; }

.data-table.translations-table td, .data-table.translations-table th { vertical-align: middle; }
.translations-group-link { font-weight: 600; }
.translations-group-ns { font-size: 11px; color: var(--text-muted); font-family: var(--mono, ui-monospace, monospace); }

.data-table.translations-editor-table th { white-space: nowrap; }
.data-table.translations-editor-table td { vertical-align: top; }
.translations-th-tag { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; font-weight: 600; }
/* Keep the key and source columns compact so the editable language columns get
   the room; both wrap rather than stretch the table wide. */
.translations-key-col { width: 20%; max-width: 220px; }
.translations-key { font-size: 11.5px; color: var(--text); overflow-wrap: anywhere; }
.translations-note { font-size: 11px; color: var(--text-muted); margin-top: 3px; max-width: 34ch; }
.translations-source-col { width: 22%; max-width: 260px; white-space: normal; overflow-wrap: anywhere;
  background: color-mix(in srgb, var(--surface-elevated) 55%, transparent); }
.translations-source { color: var(--text-muted); font-size: 13px; }
.translations-cell { min-width: 220px; }
.translations-input { width: 100%; }
.translation-status { display: inline-block; min-height: 14px; font-size: 11px; margin-top: 3px; }
.translation-status-saved { color: var(--sev-ok-text, #146c2e); }
.translation-status-cleared { color: var(--text-muted); }

/* Form-entry page bar (see form_entry.html): "All forms" and the language
   switcher, one row at the top left of the page above the logo, so neither
   comes between a logo and the form under it. The switcher is quiet until a
   filler needs it, and only rendered when more than the default language is
   offered. */
.fm-entry-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px 16px; margin-bottom: 12px; }
.fm .fm-entry-bar > .fm-back { margin-bottom: 0; }
.fm-lang { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.fm-lang-icon { width: 18px; height: 18px; }
.fm-lang-select { max-width: 200px; }

/* Run-list table cells, shared by Comply's Reports page and the other run-log
   style tables (compare results history, MCP run log) which each still carry a
   local copy of the actions rule. Timestamps and durations must not wrap: a
   wrapped "2026-08-21 15:04:05" reads as two different values. */
.runlog-time-cell,
.runlog-duration-cell { white-space: nowrap; color: var(--text-muted); font-size: 0.8rem; }
.runlog-count-cell { vertical-align: middle; }

/* A storage path is as long as the deployment makes it and a <code> breaks at
   nothing on its own, so the one column whose width nobody chose took the
   storage table sideways. */
.path-inline { overflow-wrap: anywhere; }
.results-history-actions-cell { white-space: nowrap; }
.results-history-actions-cell .btn { margin-right: 6px; }

/* A module's home page (templates/module_home_parts.html): where to start,
   drawn as the page's first and largest card for somebody who has not used
   the module before - what its work is, its steps, and the button that
   starts it - then the latest runs and the rest of the module as cards.
   Comply's page is where it was worked out, and every module home draws
   it. */
.module-start {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: linear-gradient(135deg, var(--accent-dim), var(--surface) 60%);
  margin-bottom: var(--space-4);
}
.module-start-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.module-start-title {
  margin: 0 0 8px;
  font-size: 22px;
}
/* The card's own width, so the description runs as far as the steps under
   it and wraps as the window narrows: capped at a reading measure it stopped
   half way across a wide card, which read as a column with a hole beside it. */
.module-start-lede {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
}
.module-start-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}
.module-start-steps > li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.module-start-steps > li > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.module-start-n {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-size: 13px;
  font-weight: 700;
}
.module-start-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}
.module-start-actions > .btn {
  padding: 10px 20px;
  font-size: 15px;
}
.module-home-more { margin: var(--space-4) 0 var(--space-3); }
.module-home-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 12px;
}
/* The latest runs keep their outcome, start and Open in one line each, and
   give what ran and what it came to the rest. */
.module-home-latest-table .module-home-outcome-col { width: 8rem; }
.module-home-latest-table .module-home-started-col { width: 9.5rem; }
.module-home-latest-table .module-home-open-col { width: 5rem; }

/* A module's guide (templates/guide.html, module_guide.go): one template for
   every module's Reference > Guide, so the guides read alike. The contents
   row under the header is the page's own navigation, a button per section
   like the tab rows on every other page. Everything takes the card's width:
   a reading measure left half of a wide screen empty beside every section. */
.module-guide-contents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 var(--space-4);
}
.module-guide-section {
  margin-bottom: var(--space-4);
  scroll-margin-top: var(--space-4);
}
.module-guide-prose p {
  margin: 0 0 var(--space-3);
  line-height: 1.6;
}
.module-guide-prose p:last-child { margin-bottom: 0; }
.module-guide-needs {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.6;
}
.module-guide-audience,
.module-guide-words {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}
.module-guide-audience > div,
.module-guide-words > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}
.module-guide-audience dt,
.module-guide-words dt {
  margin: 0;
  font-weight: 600;
}
.module-guide-audience dd,
.module-guide-words dd {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}
/* The term beside its meaning once there is room for both. */
@media (min-width: 761px) {
  .module-guide-audience > div,
  .module-guide-words > div {
    grid-template-columns: 14rem minmax(0, 1fr);
    gap: var(--space-3);
  }
}
.module-guide-steps {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.module-guide-steps > li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.module-guide-steps > li > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.module-guide-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  text-decoration: none;
}
.module-guide-page-icon {
  width: 16px;
  height: 16px;
  flex: none;
}
.module-guide-pages .module-guide-page-col { width: 16rem; }
.module-guide-pages td p { margin: 0 0 4px; }
.module-guide-pages td p:last-child { margin-bottom: 0; }
.module-guide-questions {
  display: grid;
  gap: 6px;
}
.module-guide-qa {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.module-guide-qa > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  list-style: none;
}
.module-guide-qa > summary::-webkit-details-marker { display: none; }
.module-guide-qa > summary::before {
  content: "+";
  display: inline-block;
  width: 1.1em;
  color: var(--accent);
}
.module-guide-qa[open] > summary::before { content: "\2212"; }
.module-guide-qa > p {
  margin: 0;
  padding: 0 14px 12px 14px;
  color: var(--text-muted);
  line-height: 1.6;
}
.module-guide-links {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.module-guide-links a { font-weight: 600; }

/* Comply's New analysis page (handlers_comply_analyse_new.go): the shared
   wizard questions below in a card the page's width, the data already
   loaded a choice a line in a box of its own. An answer that cannot be
   chosen stays readable, since the sentence saying why, and what to do
   about it, is the most useful thing on its card. */
.analysis-wizard-inputs {
  max-height: 280px;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.analysis-wizard-load {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.analysis-wizard-why { color: var(--sev-warn-text, var(--text-muted)); }
#analysis-new-wizard .wizard-option:has(input:disabled) { opacity: 0.85; }

/* ── Comply: dashboard designer, editor and preview in pairs ────────────────
   A chart is edited by looking at what it draws, so each chart's editor sits
   directly beside that chart's own preview card - one pair per chart, rather
   than a page split into an editor half and a preview half where the pair a
   reader is working on can be a screen apart.

   minmax(0, ...) on both tracks, not 1fr alone: a chart canvas and a wide
   table both refuse to shrink below their content otherwise, and the grid
   grows past the page instead of scrolling inside its own column. */
.comply-dash-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* No run to preview against: the editor takes the whole row. */
.comply-dash-pair-solo {
  grid-template-columns: minmax(0, 1fr);
}

/* The preview side reuses the dashboard grid markup (which is what carries the
   click-to-drill data attributes), holding exactly one card. */
.comply-dash-pair-preview {
  grid-template-columns: 1fr;
}

/* One column on anything narrower than a comfortable pair - the same 960px
   breakpoint .tool-columns uses, so the page reflows all at once rather than
   in stages: the preview lands directly under its own editor. */
@media (max-width: 960px) {
  .comply-dash-pair {
    grid-template-columns: 1fr;
  }
}

/* ── Comply: review ────────────────────────────────────────────────────────
   The select column of a bulk-reviewable table. Narrow and centred, so it
   reads as a control rather than a data column. */
.comply-review-select {
  width: 28px;
  text-align: center;
  vertical-align: middle;
}

/* The verdict controls of one row, and the bulk bar's own.
   nowrap, not wrap: Keep and Remove wrapping onto two lines made adjacent
   rows different heights and the column impossible to scan down. The cell is
   given its content width instead (.comply-review-cell), so the space goes to
   the name column - the one worth widening. */
.comply-review-inline {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 6px;
}

/* ── Comply: the review's tool palette ──────────────────────────────────────
   A sticky box of controls beside the review content (selection, tree
   expand/collapse, bulk verdicts) - one palette instead of button bars above
   and below the tables, so the actions read as a set and stay in reach while
   the reader scrolls a long review. */
.comply-review-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.comply-review-tools-col {
  position: sticky;
  top: 16px;
  min-width: 0;
}

.comply-review-toolbox {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comply-tool-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comply-tool-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Full-width, left-aligned buttons: a palette reads as a list of actions,
   and ragged centred pills do not. */
.comply-review-toolbox .btn {
  width: 100%;
  justify-content: flex-start;
}

@media (max-width: 900px) {
  .comply-review-layout {
    grid-template-columns: 1fr;
  }
  .comply-review-tools-col {
    position: static;
  }
}

/* ── Comply: a collapsible section of a drill-through ───────────────────────
   <details>/<summary> rather than a scripted toggle: the browser owns the
   state, it survives an htmx swap of anything outside it, and it needs no
   JavaScript at all. The marker is replaced with our own so it matches the
   rest of the app's disclosure affordances. */
.comply-section > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comply-section > summary::-webkit-details-marker {
  display: none;
}

.comply-section > summary::before {
  content: "\25B8"; /* right-pointing triangle */
  color: var(--text-muted);
  font-size: 11px;
  transition: transform 120ms ease;
}

.comply-section[open] > summary::before {
  transform: rotate(90deg);
}

.comply-section > summary:hover {
  color: var(--accent);
}


/* A form-card holding a wide data table rather than a form.
   .form-card caps at 780px, which is right for fields somebody reads and
   types into and wrong for a table of ten columns - Comply's drill-through
   and review pages are mostly the latter, and half a screen of whitespace
   beside a horizontally-scrolling table helps nobody. Opt in per card rather
   than raising the cap for every form in the app. */
.form-card.is-wide {
  max-width: none;
}

/* Settings > Administration: the reset-everything card. The phrase sits beside
   its button rather than above it, so the one irreversible action on the page
   reads as a row of its own weight; it wraps to two lines on a narrow screen
   like every other action row here. */
.settings-admin-reset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}

.settings-admin-reset-row .form-group {
  flex: 1 1 260px;
  margin-bottom: 0;
  min-width: 0;
}

/* ── Comply: the role > duty > privilege > object tree ──────────────────────
   One table of indented rows rather than nested tables, so every row keeps the
   same columns and the eye runs straight down them. The indent is a spacer
   element rather than padding on the cell, so the icon and name stay aligned
   with each other at every level.

   Computed from the row's own --comply-tree-depth rather than from a rule per
   depth, because the depth the renderer emits has no ceiling: a row sits under
   however many levels that role's facts actually state. Enumerating it covered
   0, 1 and 2, so when the object tier arrived every object fell back to the
   base width and sat flush left with the role it hangs three or four levels
   under - the shape looked like a sibling of the role rather than a child of
   the privilege. A calc cannot run out of levels. */
.comply-tree-indent {
  display: inline-block;
  width: calc(var(--comply-tree-depth, 0) * 22px);
}

.comply-tree-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
  color: var(--text-muted);
}

/* A role row anchors its subtree, so it carries the weight; what hangs under
   it is quieter, which is what makes the shape readable at a glance without
   drawing connector lines.

   By kind and not by depth, because depth does not identify a kind: a
   privilege granted straight to a role is depth 1 where one under a duty is
   depth 2, and an object is depth 1, 2 or 3 depending on how much of the path
   its source stated. A depth-2 rule therefore quietened a privilege on one row
   and an object on the next, and left the objects under a full path at full
   strength - louder than the privilege they hang off. */
.comply-tree-kind-role > .comply-tree-name {
  font-weight: 600;
}

.comply-tree-kind-privilege > .comply-tree-name code,
.comply-tree-kind-object > .comply-tree-name code {
  color: var(--text-muted);
}

/* The route from the reviewed role down to a granting sub-role, shown beside
   the name rather than in its own column - it is provenance for that one row,
   not a value to scan down. */
.comply-tree-path {
  margin-left: 8px;
  font-size: 11.5px;
}

/* ── Comply: collapsing the review tree ─────────────────────────────────────
   The disclosure triangle beside a tree row. A button rather than a styled
   span because it is one - it is clicked, focused and read out - and a leaf
   gets the same box as a spacer so names stay aligned whether or not the row
   above has children. */
.comply-tree-toggle {
  display: inline-block;
  width: 14px;
  height: 14px;
  padding: 0;
  margin-right: 2px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 14px;
  text-align: center;
  vertical-align: -1px;
  cursor: pointer;
}

.comply-tree-toggle::before {
  content: "\25BE"; /* down-pointing triangle: expanded */
  display: inline-block;
  transition: transform 120ms ease;
}

.comply-tree-toggle[aria-expanded="false"]::before {
  transform: rotate(-90deg);
}

.comply-tree-toggle:hover {
  color: var(--accent);
}

.comply-tree-toggle.is-leaf {
  cursor: default;
}

.comply-tree-toggle.is-leaf::before {
  content: "";
}

/* ── Comply > Scenario Planning ─────────────────────────────────────────────
   The editor is a narrow search column beside the item it adds to. The search
   sticks while the item scrolls, because adding twenty duties is twenty
   presses in the same place and the item is what grows. One column below
   960px, where a sticky panel would cover what it is adding to. */
.comply-scenario-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.comply-scenario-search {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}

.comply-scenario-body {
  min-width: 0;
}

@media (max-width: 960px) {
  .comply-scenario-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .comply-scenario-search {
    position: static;
    max-height: none;
  }
}

.comply-scenario-search-form .form-select,
.comply-scenario-search-form .form-input {
  width: 100%;
}

/* A disclosure of the scenario editor's that says it is one: an MDI chevron
   turned when it opens, the field-enum caret's shape, because a bare summary
   line reads as a label rather than as something that opens. */
.comply-scenario-disclosure {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  list-style: none;
}

.comply-scenario-disclosure::-webkit-details-marker {
  display: none;
}

.comply-scenario-caret {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--text-muted);
  transition: transform 0.15s;
}

details[open] > .comply-scenario-disclosure .comply-scenario-caret {
  transform: rotate(90deg);
}

/* The role editor's "add roles as sub-roles" tick, beside its label. */
.comply-scenario-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
}

/* The pasted list under the search: a disclosure, so the column is the
   search until somebody has a list to paste. */
.comply-scenario-list {
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.comply-scenario-list textarea {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.comply-scenario-results {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comply-scenario-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.comply-scenario-result-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.comply-scenario-result-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.comply-scenario-result-detail,
.comply-scenario-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.comply-scenario-result > .comply-scenario-result-detail {
  grid-column: 1 / -1;
}

.comply-scenario-result-actions {
  display: flex;
  gap: 4px;
}

.comply-scenario-meta {
  margin-left: 4px;
}

.comply-scenario-levels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.comply-scenario-levels .form-label {
  margin: 0 4px 0 0;
}

/* The rows that set the licence are the ones a reader is hunting for, so they
   are picked out by an edge rather than a fill: the status pill in the row
   already carries colour, and two fills fight. */
.comply-scenario-drives > .comply-tree-name {
  box-shadow: inset 3px 0 0 var(--accent);
}

.comply-scenario-member {
  overflow-wrap: anywhere;
}

.comply-scenario-new {
  margin-top: 14px;
}

.comply-scenario-new-row {
  display: flex;
  gap: 8px;
}

.comply-scenario-new-row .form-input {
  flex: 1 1 auto;
  min-width: 0;
}

.comply-scenario-tiers {
  max-width: 480px;
}

/* A role's planned users is a number in a table cell: wide enough for six
   digits and the spinner, and no wider, so the column stays a number column. */
.comply-scenario-users {
  width: 7rem;
  text-align: right;
}

.comply-scenario-history > .form-card-title {
  cursor: pointer;
}

/* Export for D365's prefix is a dozen characters at most, so its box is as
   wide as that rather than the modal's. */
.scenario-d365-prefix {
  max-width: 12rem;
}
/* A created object's label is what a reader looks for in the plan; its GUID
   is beside it for whoever checks the import. */
.scenario-d365-label {
  font-weight: 600;
}

/* ── Column filters (table-filter.js) ───────────────────────────────────────
   The injected filter row under a filterable table's header. Inputs are
   deliberately small and quiet: they are a narrowing tool, not a form. */
.es-filter-row th {
  padding: 4px 8px;
  background: var(--surface);
}

.es-filter-input {
  width: 100%;
  min-width: 60px;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-elevated);
  color: var(--text);
}

.es-filter-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* A label that switches the run page's tab strip (its `for` names a tab
   radio), styled as the link it behaves as. */
.comply-tab-link {
  color: var(--accent);
  cursor: pointer;
}

.comply-tab-link:hover {
  text-decoration: underline;
}

/* The decision column of a review table. width:1% is the usual shrink-to-fit
   idiom: the browser gives the cell its content width and the slack goes to
   the name column. A class rather than td:last-child, which would catch every
   table in the app, or :has(), which is newer than this stylesheet's baseline. */
.comply-review-cell {
  width: 1%;
  white-space: nowrap;
}

/* =====================================================
   Workbenches
   =====================================================

   The reader's half of Automate: a process as somebody who runs it reads it,
   rather than as the person who drew it. Four bands down the page - the
   window, where the work is, what it adds up to, the instances - and then one
   instance's own page.

   There is deliberately very little here. The board is a flex row of counts,
   the tiles are the shared summary-stat, the tables are the shared data-table
   and the pills are the shared status-pill: a workbench is meant to look like
   the rest of the product, because the people reading it are the ones least
   likely to have been taught where anything is. */

.workbench-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

/* The icon a workbench wears on the menu, beside its name on the list. */
.workbench-name-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -3px;
  fill: currentColor;
}

/* The settings form's icon palette: the icons as they will look, each a radio
   whose tile lights up when it is chosen. */
.workbench-icons {
  margin: 0;
  padding: 0;
  border: 0;
}

/* As wide as the card: the card is the page's width now, and a palette capped
   at a third of it left the rest of the row empty beside it. */
/* The start button's words say nothing until there is a button, so they are
   put away while the tick that makes one is off. */
.workbench-start-settings:has(#workbench-allow-start:not(:checked)) .workbench-start-label {
  display: none;
}
/* A button's few words, not a line of text. */
.workbench-start-label .form-input {
  max-width: 24rem;
}

.workbench-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
}

.workbench-icon-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.workbench-icon-option:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* The radio itself is the whole tile's to press, drawn by the tile. */
.workbench-icon-option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.workbench-icon-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.workbench-icon-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.workbench-icon-glyph {
  width: 20px;
  height: 20px;
  fill: currentColor;
  pointer-events: none;
}

/* A workbench's settings: The process | What it counts | Who may see it. An
   editor, so its tab row holds the whole form's controls - Save among them,
   which the global rule hides as a button - on every tab. */
.workbench-form-tabs #workbench-form-tab-process:checked ~ #workbench-form-panel-process,
.workbench-form-tabs #workbench-form-tab-counts:checked ~ #workbench-form-panel-counts,
.workbench-form-tabs #workbench-form-tab-access:checked ~ #workbench-form-panel-access {
  display: block;
}

.workbench-form-tabs #workbench-form-tab-process:checked ~ .tool-tabs-header .tab-bar label[for="workbench-form-tab-process"],
.workbench-form-tabs #workbench-form-tab-counts:checked ~ .tool-tabs-header .tab-bar label[for="workbench-form-tab-counts"],
.workbench-form-tabs #workbench-form-tab-access:checked ~ .tool-tabs-header .tab-bar label[for="workbench-form-tab-access"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.workbench-form-tabs .tool-tabs-actions button {
  display: inline-flex;
}

/* A test's page: Script | Browser | Parameters | Runs | Workflow, each a
   panel of its own; Run, Record and the rest are the header's, so the tab
   row holds no action. */
.test-page-tabs #test-page-tab-script:checked ~ #test-page-panel-script,
.test-page-tabs #test-page-tab-browser:checked ~ #test-page-panel-browser,
.test-page-tabs #test-page-tab-parameters:checked ~ #test-page-panel-parameters,
.test-page-tabs #test-page-tab-runs:checked ~ #test-page-panel-runs,
.test-page-tabs #test-page-tab-workflow:checked ~ #test-page-panel-workflow {
  display: block;
}

.test-page-tabs #test-page-tab-script:checked ~ .tool-tabs-header .tab-bar label[for="test-page-tab-script"],
.test-page-tabs #test-page-tab-browser:checked ~ .tool-tabs-header .tab-bar label[for="test-page-tab-browser"],
.test-page-tabs #test-page-tab-parameters:checked ~ .tool-tabs-header .tab-bar label[for="test-page-tab-parameters"],
.test-page-tabs #test-page-tab-runs:checked ~ .tool-tabs-header .tab-bar label[for="test-page-tab-runs"],
.test-page-tabs #test-page-tab-workflow:checked ~ .tool-tabs-header .tab-bar label[for="test-page-tab-workflow"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* =====================================================
   Settings > HTML templates
   -----------------------------------------------------
   The list is two pill tabs, My templates and Built-in templates, with New
   on the row of the first. The editor puts the source and the preview side
   by side, the way Format HTML's designer does, tall enough to fill the
   window, and lists every placeholder the source holds under both. */
#html-templates-tab-mine:checked ~ #html-templates-panel-mine,
#html-templates-tab-builtin:checked ~ #html-templates-panel-builtin {
  display: block;
}

#html-templates-tab-mine:checked ~ .tool-tabs-header .tab-bar label[for="html-templates-tab-mine"],
#html-templates-tab-builtin:checked ~ .tool-tabs-header .tab-bar label[for="html-templates-tab-builtin"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#html-templates-tab-mine:checked ~ .tool-tabs-header .html-templates-new {
  display: inline-flex;
}

.data-table.html-templates-table .html-templates-col-name {
  min-width: 200px;
  max-width: 320px;
}

.data-table.html-templates-table .html-templates-col-description {
  min-width: 240px;
  max-width: 560px;
}

.data-table .html-templates-col-kind,
.data-table .html-templates-col-tags,
.data-table .html-templates-col-variables,
.data-table .html-templates-col-updated {
  width: 1%;
  white-space: nowrap;
}

.data-table .html-templates-col-variables {
  text-align: right;
}

/* The Built-in templates tab's search box and kind dropdown, on one line. */
.builtin-templates-search.html-template-builtin-filters {
  display: flex;
  gap: var(--space-2);
  max-width: 640px;
}

.html-template-builtin-filters .form-select {
  flex: 0 0 200px;
}

.html-template-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.html-template-details,
.html-template-variables {
  padding: var(--space-4) var(--space-5);
}

.html-template-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3) var(--space-5);
}

.html-template-details-grid .form-group {
  margin-bottom: 0;
}

/* The tags wrap to a row of their own where the grid has room for only two
   columns, rather than squeezing a chip input into a third of the width. */
.html-template-tags {
  min-width: 0;
}

/* The source and the preview share the height of the window less the header
   and the details above them, with a floor so a short window still shows a
   useful amount of each. Both halves are flex columns whose one growing
   child - the box, the frame - takes what is left. */
.html-template-designer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-3);
  height: max(520px, calc(100vh - 260px));
}

.html-template-source,
.html-template-preview-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.html-template-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 24px;
  margin-bottom: 6px;
}

.html-template-pane-head .form-label {
  margin-bottom: 0;
}

.html-template-source .code-textarea {
  flex: 1;
  min-height: 0;
  resize: none;
}

.html-template-preview {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* The frame is white whatever the theme, because it is a page as a mail
   client draws it and an email's own background is the template's business. */
.html-template-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.html-template-preview-problem {
  margin: 0 0 6px;
}

.html-template-variables-head .form-hint {
  margin-top: 0;
  margin-bottom: var(--space-3);
}

.html-template-variables-table .html-template-col-placeholder {
  width: 1%;
  white-space: nowrap;
}

.html-template-variables-table .html-template-col-role {
  min-width: 220px;
}

/* What a placeholder stands for, where that is more than its role says: a
   line of its own under the role, in the hint's colour. */
.html-template-meaning {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.html-template-variables-table .html-template-col-sample {
  width: 45%;
  min-width: 220px;
}

.html-template-variables-table .html-template-col-sample .form-input {
  width: 100%;
}

/* A placeholder no step can fill says so in the colour a problem is. */
.html-template-variables-table tr.is-problem .html-template-col-role,
.html-template-variables-table tr.is-problem .html-template-meaning {
  color: var(--sev-prob-text);
}

.html-template-grammar {
  margin-top: var(--space-3);
}

.html-template-grammar > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}

.html-template-grammar-table {
  margin-top: var(--space-2);
}

.html-template-used-by {
  margin: 0;
}

/* A shipped template before it is cloned: the page as big as the dialog
   allows, and what it holds in a column beside it. */
.html-template-builtin-preview-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: var(--space-3);
  min-height: 0;
}

.html-template-builtin-preview .html-template-preview {
  min-height: 0;
}

.html-template-builtin-preview-variables {
  min-width: 0;
  overflow-y: auto;
}

.html-template-builtin-preview-variables h4 {
  margin: 0 0 var(--space-2);
  font-size: 13px;
  font-weight: 600;
}

.html-template-builtin-variable-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

@media (max-width: 960px) {
  .html-template-designer {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .html-template-source .code-textarea {
    min-height: 320px;
    resize: vertical;
  }

  .html-template-frame {
    min-height: 420px;
  }

  .html-template-builtin-preview-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(320px, 1fr) auto;
  }
}

/* =====================================================
   Settings > Teams templates
   -----------------------------------------------------
   The HTML templates library's pages for an Adaptive Card: the list's two
   pill tabs, and an editor laid out with the html-template-* classes. What is
   a card's own is the preview, a pane of Teams' own chat colours with the
   card drawn on it by teams-card-preview.js. */
#teams-templates-tab-mine:checked ~ #teams-templates-panel-mine,
#teams-templates-tab-builtin:checked ~ #teams-templates-panel-builtin {
  display: block;
}

#teams-templates-tab-mine:checked ~ .tool-tabs-header .tab-bar label[for="teams-templates-tab-mine"],
#teams-templates-tab-builtin:checked ~ .tool-tabs-header .tab-bar label[for="teams-templates-tab-builtin"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

#teams-templates-tab-mine:checked ~ .tool-tabs-header .teams-templates-new {
  display: inline-flex;
}

.data-table.teams-templates-table .teams-templates-col-name {
  min-width: 200px;
  max-width: 320px;
}

.data-table.teams-templates-table .teams-templates-col-description {
  min-width: 240px;
  max-width: 560px;
}

.data-table .teams-templates-col-tags,
.data-table .teams-templates-col-variables,
.data-table .teams-templates-col-updated {
  width: 1%;
  white-space: nowrap;
}

.data-table .teams-templates-col-variables {
  text-align: right;
}

.builtin-templates-search.teams-template-builtin-filters {
  display: flex;
  gap: var(--space-2);
  max-width: 640px;
}

/* The pane a card is drawn on: Teams' chat background, light or dark with
   the page, since the card's own colours come from Teams' host configuration
   for the same mode. It scrolls, as a tall card does in a Teams channel. */
:root {
  --teams-chat-bg: #1f1f1f;
}

html[data-theme="light"] {
  --teams-chat-bg: #f5f5f5;
}

.teams-card-preview {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--teams-chat-bg);
}

/* The card sits as a message does: at most the width Teams gives one, with
   its own rounded edge and shadow. */
.teams-card-surface {
  max-width: 560px;
}

.teams-card-surface .ac-adaptiveCard {
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.teams-card-preview-note {
  margin: 0;
}

.teams-card-advice {
  margin: 0 0 6px;
}

@media (max-width: 960px) {
  .teams-card-preview {
    min-height: 420px;
  }
}

/* The editor's two views of a card, JSON and preview or Microsoft's
   designer, as pill tabs. */
#teams-template-view-json:checked ~ #teams-template-panel-json,
#teams-template-view-designer:checked ~ #teams-template-panel-designer {
  display: block;
}

#teams-template-view-json:checked ~ .tool-tabs-header .tab-bar label[for="teams-template-view-json"],
#teams-template-view-designer:checked ~ .tool-tabs-header .tab-bar label[for="teams-template-view-designer"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.teams-card-designer-source {
  margin-bottom: var(--space-3);
}

.teams-card-designer-source .alert {
  margin: var(--space-2) 0 0;
}

/* Microsoft's Adaptive Cards Designer, drawn by teams-card-designer.js into
   the host. It lays itself out as a flex column filling its parent, so the
   host gives it a height: most of the window, and never so little that the
   palette and the properties cannot both be read. It wears the active
   theme: every pane, control and dropdown below is drawn in the theme's own
   tokens, and its property sheet - an Adaptive Card the designer renders with
   a host configuration of its own - is recoloured from the same tokens by
   teams-card-designer.js, since a host configuration takes colours rather
   than variables. The one area left alone is the card surface, which is
   Teams' chat in Teams' own colours, as the preview on the JSON tab is. */
.teams-card-designer-host {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.teams-card-designer-host:empty {
  display: none;
}

/* The font is inherited by everything the designer draws but the card, which
   takes Teams' own from its host configuration; the controls that name a
   font of their own are named here. */
.teams-card-designer-root.acd-designer-root,
.teams-card-designer-root .ms-ctrl,
.teams-card-designer-root .acd-toolbar-button,
:root .acd-dialog-button {
  font-family: var(--font-body);
}

/* The theme's colours over Microsoft's. Each rule is qualified by the root
   (or by :root for what the designer draws onto the page's body: a dropdown's
   list and a dialog), which lifts it over the vendored rule it replaces, since
   that sheet loads after this one. */
.teams-card-designer-root.acd-designer-root,
.teams-card-designer-root .acd-treeView-pane,
.teams-card-designer-root .acd-treeView-host,
.teams-card-designer-root .acd-toolPalette-pane,
.teams-card-designer-root .acd-propertySheet-pane,
.teams-card-designer-root .acd-inplace-editor-host {
  color: var(--text);
  background-color: var(--surface);
}

.teams-card-designer-root .acd-toolbar,
.teams-card-designer-root .acd-palette-category,
.teams-card-designer-root .acd-toolbox-header {
  color: var(--text);
  background-color: var(--surface-alt);
}

.teams-card-designer-root .acd-toolbox-header-title,
.teams-card-designer-root .acd-toolbar-label,
.teams-card-designer-root .acd-designer-card-header,
.teams-card-designer-root .acd-textBlock-inplace-editor {
  color: var(--text) !important;
}

.teams-card-designer-root .acd-tree-item-additionalText {
  color: var(--text-muted);
}

.teams-card-designer-root .acd-toolbar,
.teams-card-designer-root .acd-toolbox,
.teams-card-designer-root .acd-toolPalette-pane,
.teams-card-designer-root .acd-dockedLeft,
.teams-card-designer-root .acd-dockedRight,
.teams-card-designer-root .acd-vertical-splitter,
.teams-card-designer-root .acd-horizontal-splitter,
.teams-card-designer-root .acd-toolbar-separator,
.teams-card-designer-root .acd-designer-cardArea,
.teams-card-designer-root .acd-verticalCollapsedTabContainer > .acd-toolbox-header,
.teams-card-designer-root .acd-horizontalCollapsedTabContainer > .acd-toolbox-header {
  border-color: var(--border);
}

.teams-card-designer-root .acd-palette-item:hover,
.teams-card-designer-root .acd-tree-item:hover,
.teams-card-designer-root .acd-toolbar-button:hover,
.teams-card-designer-root .acd-toolbox-header-commandButton:hover {
  background-color: var(--surface-hover);
}

.teams-card-designer-root .acd-tree-item.selected,
.teams-card-designer-root .acd-tree-item.selected:hover,
.teams-card-designer-root .acd-toolbar-button.acd-toolbar-button-toggled {
  background-color: var(--accent-dim);
}

.teams-card-designer-root .acd-toolPalette-icon,
.teams-card-designer-root .acd-treeView-icon {
  color: var(--accent);
}

.teams-card-designer-root .acd-toolbar-button:active {
  border-color: var(--accent);
}

.teams-card-designer-root .acd-error-pane {
  color: var(--sev-warn-text);
  background-color: var(--sev-warn-bg);
  border-color: var(--sev-warn-border);
}

/* A message naming an element is pressed to select it, and the designer's
   own hover is navy, which clashes with the warning it sits on: a deeper
   shade of the same warning picks it out in either theme. */
.teams-card-designer-root .acd-error-pane-message.selectable:hover {
  background-color: var(--sev-warn-border);
}

/* The handles drawn on the selected element of the card: the theme's accent
   on the theme's surface, over whatever colours the card has. */
.teams-card-designer-root .acd-peerButton {
  color: var(--accent);
  background-color: var(--surface);
  border-color: var(--accent);
}

.teams-card-designer-root .acd-peerButton:hover {
  color: var(--surface);
  background-color: var(--accent);
}

.teams-card-designer-root *:hover::-webkit-scrollbar-thumb {
  background-color: var(--border-hover);
}

/* The toolbar's dropdowns and the list they open. */
.teams-card-designer-root .ms-ctrl-dropdown,
.teams-card-designer-root .ms-ctrl-textbox,
.teams-card-designer-root .ms-ctrl-datePicker,
:root .ms-ctrl-popup-container {
  color: var(--text);
  background-color: var(--bg);
  border-color: var(--border);
}

.teams-card-designer-root .ms-dropdown-label,
.teams-card-designer-root .ms-ctrl-checkbox label span,
.teams-card-designer-root .ms-ctrl-radiobutton label span {
  color: var(--text);
}

.teams-card-designer-root .ms-ctrl-dropdown:hover,
.teams-card-designer-root .ms-ctrl-dropdown:focus,
.teams-card-designer-root .ms-ctrl-textbox:hover,
.teams-card-designer-root .ms-ctrl-textbox:focus {
  border-color: var(--accent);
}

.teams-card-designer-root .ms-ctrl-dropdown-button:hover {
  color: var(--accent);
}

:root .ms-ctrl-dropdown-item:hover,
:root .ms-ctrl-dropdown-item:focus {
  background-color: var(--surface-hover);
}

:root .acd-dialog-frame {
  color: var(--text);
  background-color: var(--surface-elevated);
}

/* The property sheet's controls: an Adaptive Card's inputs and buttons, drawn
   as the product's own form controls are. Its text and grounds come from its
   host configuration, which the script recolours. */
.teams-card-designer-root .default-ac-input {
  color: var(--text);
  font-family: var(--font-body);
}

/* A box, as the vendored rule names one; its toggle is an input too, and
   keeps no ground of its own. */
:root .teams-card-designer-root .default-ac-input.default-ac-textInput,
:root .teams-card-designer-root .default-ac-input.default-ac-numberInput,
:root .teams-card-designer-root .default-ac-input.default-ac-dateInput,
:root .teams-card-designer-root .default-ac-input.default-ac-timeInput,
:root .teams-card-designer-root .default-ac-input.default-ac-multichoiceInput {
  color: var(--text);
  background-color: var(--bg);
  border-color: var(--border);
  border-radius: var(--radius-sm);
}

:root .teams-card-designer-root .default-ac-input.default-ac-textInput:hover,
:root .teams-card-designer-root .default-ac-input.default-ac-textInput:focus,
:root .teams-card-designer-root .default-ac-input.default-ac-numberInput:focus,
:root .teams-card-designer-root .default-ac-input.default-ac-multichoiceInput:hover,
:root .teams-card-designer-root .default-ac-input.default-ac-multichoiceInput:focus {
  border-color: var(--accent);
}

.teams-card-designer-root .default-ac-input.default-ac-toggleInput {
  background-color: transparent;
}

.teams-card-designer-root .default-ac-pushButton {
  color: var(--text);
  background-color: var(--surface-alt);
  border-color: var(--border);
  font-family: var(--font-body);
}

.teams-card-designer-root .default-ac-pushButton:hover,
.teams-card-designer-root .default-ac-pushButton.subdued:hover,
.teams-card-designer-root .default-ac-pushButton.expanded {
  color: var(--accent);
  background-color: var(--accent-dim);
  border-color: var(--accent);
}

.teams-card-designer-root .teams-card-designer-json {
  font-family: var(--font-mono);
}

/* The designer's JSON pane is the JSON tab, so it is not drawn twice; the
   textarea standing in for its editor is still there, holding its card. */
.teams-card-designer-root #jsonEditorPanel,
.teams-card-designer-root #bottomCollapsedPaneTabHost {
  display: none;
}

.teams-card-designer-json {
  width: 100%;
  height: 100%;
}

/* The designer's icons are glyphs of Microsoft's FabricMDL2Icons font, which
   it loads from SharePoint's CDN. The vendored stylesheet has its
   @font-face rules taken out and each glyph is drawn here instead from a
   bundled MDI asset, as a mask in the text's own colour, so the designer
   reaches no other host and its icons are the product's. :root lifts each
   rule over the vendored one it replaces, which loads after this sheet. */
:root [class*="acd-icon-"]::before,
:root [class*="ms-icon-"]::before,
:root .ms-ctrl-checkbox input[type=checkbox]:checked + label::after {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  background-color: currentColor;
  -webkit-mask: var(--acd-icon) center / contain no-repeat;
  mask: var(--acd-icon) center / contain no-repeat;
}

:root .ms-ctrl-checkbox input[type=checkbox]:checked + label::after {
  --acd-icon: url("/static/icons/mdi/check.svg");
}

:root .acd-icon-bolt { --acd-icon: url("/static/icons/mdi/lightning-bolt.svg"); }
:root .acd-icon-addColumn { --acd-icon: url("/static/icons/mdi/table-column-plus-after.svg"); }
:root .acd-icon-remove { --acd-icon: url("/static/icons/mdi/close.svg"); }
:root .acd-icon-drag { --acd-icon: url("/static/icons/mdi/drag.svg"); }
:root .acd-icon-defaultElementIcon { --acd-icon: url("/static/icons/mdi/shape-outline.svg"); }
:root .acd-icon-unknownPeer { --acd-icon: url("/static/icons/mdi/help-box-outline.svg"); }
:root .acd-icon-image { --acd-icon: url("/static/icons/mdi/image-outline.svg"); }
:root .acd-icon-adaptiveCard { --acd-icon: url("/static/icons/mdi/card-text-outline.svg"); }
:root .acd-icon-column { --acd-icon: url("/static/icons/mdi/view-column-outline.svg"); }
:root .acd-icon-columnSet { --acd-icon: url("/static/icons/mdi/view-column.svg"); }
:root .acd-icon-container { --acd-icon: url("/static/icons/mdi/checkbox-blank-outline.svg"); }
:root .acd-icon-factSet { --acd-icon: url("/static/icons/mdi/format-list-text.svg"); }
:root .acd-icon-actionSet { --acd-icon: url("/static/icons/mdi/gesture-tap-button.svg"); }
:root .acd-icon-imageSet { --acd-icon: url("/static/icons/mdi/image-multiple-outline.svg"); }
:root .acd-icon-inputChoiceSet { --acd-icon: url("/static/icons/mdi/format-list-checks.svg"); }
:root .acd-icon-inputDate { --acd-icon: url("/static/icons/mdi/calendar.svg"); }
:root .acd-icon-inputNumber { --acd-icon: url("/static/icons/mdi/numeric.svg"); }
:root .acd-icon-inputText { --acd-icon: url("/static/icons/mdi/form-textbox.svg"); }
:root .acd-icon-inputTime { --acd-icon: url("/static/icons/mdi/clock-outline.svg"); }
:root .acd-icon-inputToggle { --acd-icon: url("/static/icons/mdi/toggle-switch-outline.svg"); }
:root .acd-icon-textBlock { --acd-icon: url("/static/icons/mdi/format-text.svg"); }
:root .acd-icon-richTextBlock { --acd-icon: url("/static/icons/mdi/text-box-outline.svg"); }
:root .acd-icon-carousel { --acd-icon: url("/static/icons/mdi/view-carousel-outline.svg"); }
:root .acd-icon-carouselPage { --acd-icon: url("/static/icons/mdi/card-outline.svg"); }
:root .acd-icon-chevronDown { --acd-icon: url("/static/icons/mdi/chevron-down.svg"); }
:root .acd-icon-chevronUp { --acd-icon: url("/static/icons/mdi/chevron-up.svg"); }
:root .acd-icon-chevronRight { --acd-icon: url("/static/icons/mdi/chevron-right.svg"); }
:root .acd-icon-chevronLeft { --acd-icon: url("/static/icons/mdi/chevron-left.svg"); }
:root .acd-icon-newCard { --acd-icon: url("/static/icons/mdi/file-plus-outline.svg"); }
:root .acd-icon-fullScreen { --acd-icon: url("/static/icons/mdi/fullscreen.svg"); }
:root .acd-icon-actionShowCard { --acd-icon: url("/static/icons/mdi/card-text-outline.svg"); }
:root .acd-icon-actionOpenUrl { --acd-icon: url("/static/icons/mdi/open-in-new.svg"); }
:root .acd-icon-actionSubmit { --acd-icon: url("/static/icons/mdi/send-outline.svg"); }
:root .acd-icon-actionToggleVisibility { --acd-icon: url("/static/icons/mdi/eye-outline.svg"); }
:root .acd-icon-actionHttp { --acd-icon: url("/static/icons/mdi/web.svg"); }
:root .acd-icon-copy { --acd-icon: url("/static/icons/mdi/content-copy.svg"); }
:root .acd-icon-help { --acd-icon: url("/static/icons/mdi/help-circle-outline.svg"); }
:root .acd-icon-header-expanded { --acd-icon: url("/static/icons/mdi/chevron-down.svg"); }
:root .acd-icon-header-collapsed { --acd-icon: url("/static/icons/mdi/chevron-right.svg"); }
:root .acd-icon-undo { --acd-icon: url("/static/icons/mdi/undo.svg"); }
:root .acd-icon-redo { --acd-icon: url("/static/icons/mdi/redo.svg"); }
:root .acd-icon-media { --acd-icon: url("/static/icons/mdi/play-box-outline.svg"); }
:root .acd-icon-dot { --acd-icon: url("/static/icons/mdi/circle-small.svg"); }
:root .acd-icon-dataStructure { --acd-icon: url("/static/icons/mdi/file-tree-outline.svg"); }
:root .acd-icon-preview { --acd-icon: url("/static/icons/mdi/eye-outline.svg"); }
:root .acd-icon-open { --acd-icon: url("/static/icons/mdi/folder-open-outline.svg"); }
:root .acd-icon-customPaletteItem { --acd-icon: url("/static/icons/mdi/puzzle-outline.svg"); }
:root .acd-icon-table { --acd-icon: url("/static/icons/mdi/table.svg"); }
:root .acd-icon-tableRow { --acd-icon: url("/static/icons/mdi/table-row.svg"); }
:root .acd-icon-tableCell { --acd-icon: url("/static/icons/mdi/square-outline.svg"); }
:root .ms-icon-close { --acd-icon: url("/static/icons/mdi/close.svg"); }
:root .ms-icon-chevronLeft { --acd-icon: url("/static/icons/mdi/chevron-left.svg"); }
:root .ms-icon-chevronRight { --acd-icon: url("/static/icons/mdi/chevron-right.svg"); }
:root .ms-icon-chevronDown { --acd-icon: url("/static/icons/mdi/chevron-down.svg"); }
:root .ms-icon-calendar { --acd-icon: url("/static/icons/mdi/calendar.svg"); }
:root .ms-icon-radioOff { --acd-icon: url("/static/icons/mdi/radiobox-blank.svg"); }
:root .ms-icon-radioOn { --acd-icon: url("/static/icons/mdi/radiobox-marked.svg"); }
:root .ms-icon-checkboxOff { --acd-icon: url("/static/icons/mdi/checkbox-blank-outline.svg"); }
:root .ms-icon-checkboxOn { --acd-icon: url("/static/icons/mdi/checkbox-marked.svg"); }
:root .ms-icon-checkboxOn-reversed { --acd-icon: url("/static/icons/mdi/checkbox-marked.svg"); }
:root .ms-icon-checkMark { --acd-icon: url("/static/icons/mdi/check.svg"); }

.workbench-windows {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Whose instances: the two pills beside the window's, drawn as the window's
   are, with how many instances each holds in a count that stands back from
   its words. */
.workbench-who {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workbench-who-count {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Who an instance is assigned to: a stack of faces and their names, on one
   line, so a row is a row whoever it is with. */
.workbench-instances .workbench-assigned-col {
  white-space: nowrap;
}

/* Drawn as the By column beside it draws its one person: the face at the
   chip's small size and the name on its right. The stack wraps where it runs
   out of room, and in a column sized to its heading that put every name
   under its face, beside a By column whose names sat beside theirs. */
.workbench-instances .workbench-assigned-col .people-stack {
  flex-wrap: nowrap;
  gap: 6px;
}

.workbench-instances .workbench-assigned-col .people-stack-face,
.workbench-instances .workbench-assigned-col .people-stack-more {
  width: 20px;
  height: 20px;
}

/* How many steps of an instance wait on a person, on the tab that holds
   them: the tab is where the decision is made, so it says there is one before
   it is opened. */
.workbench-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 2px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--sev-warn-text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.workbench-band {
  margin-bottom: var(--space-5);
}

.workbench-band-title {
  margin: 0 0 var(--space-3);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* The board: one column per stage, then the three terminal columns. It wraps
   rather than scrolls, because a process with nine stages on a phone is a
   list of nine counts and reads perfectly well as one. A grid rather than a
   wrapping row, so every tile is one width on every row: flex shared each
   row's room among its own tiles, and a board of thirteen drew seven narrow
   tiles over six wide ones. */
.workbench-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

.workbench-column {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
}

/* The terminal three are outcomes rather than places, so they are set apart
   from the stages by a dashed edge rather than by a colour of their own: the
   count already carries the severity colour. */
.workbench-column.is-terminal {
  border-style: dashed;
  background: var(--surface-alt);
}

/* Every column narrows the page to it, so it is a link that does not look
   like one, and the chosen one is marked by its edge rather than by a colour
   that would fight the count's own severity. */
a.workbench-column {
  text-decoration: none;
  color: inherit;
}

a.workbench-column:hover {
  border-color: var(--accent);
}

.workbench-column.is-current {
  border-style: solid;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* The sentence under a narrowed board, saying what the numbers below now
   count and how to get back to all of them. */
.workbench-narrowed {
  margin: var(--space-3) 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.workbench-column-count {
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.workbench-column-label {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* On a phone a run page's figures, and a workbench instance's in its
   header, are one compact row of pills rather than a block of cards, and their tab strips
   one row that scrolls sideways: five cards two to a row and seven tabs four
   rows deep took the whole first screen, and the document the page is about
   started below the fold. A workbench's instances stack to what matters on a
   phone - the document and where it is - and its board shows the stages
   holding work beside the outcomes, two to a row, since a stage reading 0 is
   a tile with nothing to act on. */
@media (max-width: 640px) {
  .summary-bar.automate-run-summary {
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .automate-run-summary .summary-stat-metric {
    flex: 0 0 auto;
    min-width: 0;
    max-width: none;
    min-height: 0;
    padding: 3px 10px;
    border-radius: 999px;
  }

  .automate-run-summary .summary-stat-metric .summary-copy {
    flex-direction: row;
    align-items: baseline;
    gap: 5px;
    white-space: nowrap;
  }

  .automate-run-summary .summary-stat-metric .summary-copy .summary-value {
    font-size: 13px;
  }

  .automate-run-summary .summary-stat-metric .summary-copy .summary-label {
    font-size: 11.5px;
    text-transform: none;
    letter-spacing: 0;
  }

  /* A page's figures in its header (a workbench instance's) are the same
     row of small pills. */
  .summary-bar.tool-header-stats {
    gap: 6px;
    scrollbar-width: thin;
  }

  .tool-header-stats .summary-stat-metric.tool-header-stat,
  .tool-header-stats .summary-stat-metric.tool-header-stat.is-wide {
    width: auto;
    min-width: 0;
    max-width: none;
    min-height: 0;
    padding: 3px 10px;
    border-radius: 999px;
  }

  .tool-header-stats .summary-stat-metric .summary-copy {
    flex-direction: row;
    align-items: baseline;
    gap: 5px;
    white-space: nowrap;
  }

  .tool-header-stats .summary-stat-metric.tool-header-stat.is-people {
    width: auto;
    min-width: 0;
    max-width: none;
    min-height: 0;
    padding: 3px 10px;
    border-radius: 999px;
  }

  /* Who it is assigned to is a pill of the row's own height: the faces at
     the size a line of the pill is, centred on the words beside them. */
  .tool-header-stat.is-people .summary-copy {
    align-items: center;
  }

  .tool-header-stat.is-people .people-stack {
    flex-wrap: nowrap;
    gap: 5px;
  }

  .tool-header-stat.is-people .people-stack-face,
  .tool-header-stat.is-people .people-stack-more {
    width: 18px;
    height: 18px;
  }

  .tool-header-stats .summary-stat-metric .summary-copy .summary-value {
    font-size: 13px;
  }

  .tool-header-stats .summary-stat-metric .summary-copy .summary-label {
    font-size: 11.5px;
    text-transform: none;
    letter-spacing: 0;
  }

  /* The strip is as wide as its tabs and its header scrolls: the strip's
     own wrapping stays the base rule's (TestTabBarHasSingleBaseRule), and a
     row as wide as what it holds has nothing to wrap. */
  .automate-run-tabs > .tool-tabs-header,
  .workbench-instance-tabs > .tool-tabs-header {
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .automate-run-tabs > .tool-tabs-header .tab-bar,
  .workbench-instance-tabs > .tool-tabs-header .tab-bar {
    flex: 0 0 auto;
    width: max-content;
  }

  .automate-run-tabs > .tool-tabs-header .tab-label,
  .workbench-instance-tabs > .tool-tabs-header .tab-label {
    white-space: nowrap;
  }

  /* A run's status leads its strip on a phone: at the row's end it is past
     the last tab, a sideways scroll away, and wrapped under the strip it is
     the row of height the tiles were taken off the other tabs to give back. */
  .automate-run-tabs > .tool-tabs-header {
    flex-wrap: nowrap;
  }

  .automate-run-tab-status {
    order: -1;
    flex: 0 0 auto;
    margin-left: 0;
  }

  .workbench-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
  }

  .workbench-column.is-empty {
    display: none;
  }

  .workbench-column {
    flex-direction: row;
    align-items: center;
    gap: var(--space-2);
    padding: 6px var(--space-2);
  }

  .workbench-instances thead {
    display: none;
  }

  .workbench-instances tr {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
  }

  .workbench-instances td {
    display: none;
    padding: 0;
    border: 0;
  }

  .workbench-instances.has-document td.workbench-document-col,
  .workbench-instances:not(.has-document) td.workbench-started-col,
  .workbench-instances td.workbench-where-col {
    display: block;
  }

  .workbench-instances tr.is-waiting {
    box-shadow: inset 3px 0 0 0 var(--sev-warn-text);
  }

  .workbench-instances tr.is-waiting > td:first-child {
    box-shadow: none;
  }
}

.workbench-tiles {
  margin-bottom: 0;
}

/* A tile says how its number was arrived at, which the run page's tiles have
   no need of: "2" means one thing under Invoices and another under Suppliers,
   and a reader who cannot see the settings has nowhere else to find out. */
.workbench-tile-detail {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--text-muted);
}

.workbench-tiles .summary-stat-metric {
  flex: 0 1 240px;
  max-width: 240px;
}

/* An instance stopped on a person is the one row in the table that is a
   request rather than a record, so it is marked as one. */
.workbench-instances tr.is-waiting > td:first-child {
  box-shadow: inset 3px 0 0 0 var(--sev-warn-text);
}

/* Who started it: a chip and a name on one line, never wrapped under the
   picture. */
.workbench-instances .workbench-by {
  white-space: nowrap;
}

/* What it is making: what became of each record as a pill, which never
   wraps, and beside it the record the write created. An id can be as long as
   its number sequence makes it, so it is cut to a line and is whole in the
   cell's tooltip. */
.workbench-instances .workbench-target-col {
  white-space: nowrap;
}

.workbench-instances .workbench-record-col {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* The record's id beside its heading on the record itself, in the code face
   the list's Record column draws it in. */
.workbench-record-ref {
  font-family: var(--font-mono);
  font-size: 0.9em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-record-id {
  color: var(--text);
}

.workbench-record-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

.workbench-record-icon {
  width: 13px;
  height: 13px;
  flex: none;
  opacity: 0.7;
}

.workbench-stage {
  margin-bottom: var(--space-4);
}

.workbench-stage-title {
  margin: 0 0 var(--space-2);
  font-size: 13px;
  font-weight: 600;
}

.workbench-step-message {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* One width per column, for every stage of What happened, as the runbook's
   stage tables have (.automate-runbook-steps) and for the same reason: a stage
   is a table of its own, so each was sized to its own content and the columns
   stepped left and right from one stage to the next. The widths are on the
   headings, which is what a fixed layout sizes its columns by, and What came
   out takes what is left, since it is the one column with no shape of its own.
   Below the floor the wrapper scrolls rather than the columns being crushed,
   and every stage's table reaches it at the same width, so they stay in
   step. */
.workbench-steps {
  table-layout: fixed;
  min-width: 900px;
}

.workbench-steps .workbench-col-step    { width: 260px; }
.workbench-steps .workbench-col-who     { width: 120px; }
.workbench-steps .workbench-col-state   { width: 170px; }
.workbench-steps .workbench-col-doc     { width: 110px; }
.workbench-steps .workbench-col-started { width: 90px; }
.workbench-steps .workbench-col-took    { width: 80px; }

/* A fixed layout does not grow a cell to fit its content, so anything that
   cannot be broken would run under the column beside it. */
.workbench-steps td {
  overflow-wrap: anywhere;
}

/* The decision an instance is stopped for. Same shape as the Runbook tab's
   card - it is the same decision - in the workbench's own words. */
.workbench-decision {
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--sev-warn-border);
  border-left: 4px solid var(--sev-warn-text);
  border-radius: var(--radius-sm);
  background: var(--sev-warn-bg);
}

.workbench-decision-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.workbench-decision-icon {
  width: 22px;
  height: 22px;
  color: var(--sev-warn-text);
  flex-shrink: 0;
}

.workbench-decision-head .form-hint {
  display: block;
}

.workbench-decision-instructions {
  margin: var(--space-2) 0 0;
  font-size: 13px;
}

.workbench-decision-detail {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  max-height: 220px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
}

/* A decision's detail as a list when it is a flat object: the reader who has
   to answer is the one least likely to read JSON. */
.workbench-decision-rows {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: var(--space-2) 0 0;
}

.workbench-decision-rows dt {
  font-size: 12.5px;
  color: var(--text-muted);
}

.workbench-decision-rows dd {
  margin: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.workbench-decision-form {
  margin-top: var(--space-3);
}

.workbench-decision-actions {
  margin-top: var(--space-3);
}

/* A workbench instance's tabs: what it is creating, what happened as a table,
   a departure board and a story in plain English, what it recorded, its
   files, and the run page's three drawings. They were bands down one page,
   and a band of one card sat beside the page's whole width with nothing in
   it; a tab gives each the width. */
#workbench-instance-tab-checking:checked ~ .tab-panel[data-tab="checking"],
#workbench-instance-tab-document:checked ~ .tab-panel[data-tab="document"],
#workbench-instance-tab-creating:checked ~ .tab-panel[data-tab="creating"],
#workbench-instance-tab-steps:checked ~ .tab-panel[data-tab="steps"],
#workbench-instance-tab-board:checked ~ .tab-panel[data-tab="board"],
#workbench-instance-tab-plain:checked ~ .tab-panel[data-tab="plain"],
#workbench-instance-tab-recorded:checked ~ .tab-panel[data-tab="recorded"],
#workbench-instance-tab-files:checked ~ .tab-panel[data-tab="files"],
#workbench-instance-tab-tube:checked ~ .tab-panel[data-tab="tube"],
#workbench-instance-tab-lanes:checked ~ .tab-panel[data-tab="lanes"],
#workbench-instance-tab-tracker:checked ~ .tab-panel[data-tab="tracker"] {
  display: block;
}

#workbench-instance-tab-checking:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-checking"],
#workbench-instance-tab-document:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-document"],
#workbench-instance-tab-creating:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-creating"],
#workbench-instance-tab-steps:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-steps"],
#workbench-instance-tab-board:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-board"],
#workbench-instance-tab-plain:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-plain"],
#workbench-instance-tab-recorded:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-recorded"],
#workbench-instance-tab-files:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-files"],
#workbench-instance-tab-tube:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-tube"],
#workbench-instance-tab-lanes:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-lanes"],
#workbench-instance-tab-tracker:checked ~ .tool-tabs-header .tab-bar label[for="workbench-instance-tab-tracker"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* An instance's document: the document view as it stands, with its history
   the modal its strip's history button opens (handlers_workbench_document.go). */
.workbench-document {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workbench-document-history-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.workbench-document-history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workbench-document-history-filters .form-input {
  flex: 1 1 200px;
  max-width: 320px;
}

/* A change a person made, tinted: the rows somebody answers for. */
.workbench-document-history-table tr.is-person td {
  background: var(--accent-dim);
}

/* A question about a document on a decision card (automate_ask.go): the
   document view, with what the person may change as boxes in it. */
.automate-ask {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

/* A submission on a form's workbench: what was written for it, its answers,
   and how it got here, a tab each as an instance's are. */
#workbench-submission-tab-written:checked ~ .tab-panel[data-tab="written"],
#workbench-submission-tab-answers:checked ~ .tab-panel[data-tab="answers"],
#workbench-submission-tab-history:checked ~ .tab-panel[data-tab="history"] {
  display: block;
}

#workbench-submission-tab-written:checked ~ .tool-tabs-header .tab-bar label[for="workbench-submission-tab-written"],
#workbench-submission-tab-answers:checked ~ .tool-tabs-header .tab-bar label[for="workbench-submission-tab-answers"],
#workbench-submission-tab-history:checked ~ .tool-tabs-header .tab-bar label[for="workbench-submission-tab-history"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* A form's workbench lists its submissions: a pill says where each stands and
   must not break across two lines in a narrow column. */
.workbench-submissions .status-pill {
  white-space: nowrap;
}

/* When a submission moved, on one line whatever the column's width. */
.workbench-history .workbench-history-when {
  white-space: nowrap;
}

/* What an instance is creating: a row per thing, the record taking the width
   and its card at the side at the size it has always been, which is the size
   it reads at. A bar as well as the sentence on the card, because "8 of 10"
   is read by its length. The card is first in the markup, so a phone, which
   stacks the two, shows how far the thing has got before what it holds.

   Side by side the two are one row and stretch to its height, whichever of
   them is the taller: two panels next to each other ending a centimetre apart
   read as a layout that has slipped rather than as two halves of one thing.
   Stacked, each is a row of its own, so stretching is its own height. */
.workbench-creating {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.workbench-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  grid-template-areas: "record card";
  gap: var(--space-4);
  align-items: stretch;
}

.workbench-unit > .workbench-target {
  grid-area: card;
}

.workbench-unit > .workbench-unit-record {
  grid-area: record;
}

@media (max-width: 960px) {
  .workbench-unit {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "card" "record";
  }
}

/* The record beside its card, on the surface a card sits on so the two read as
   one thing with two halves. */
.workbench-unit-record {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.workbench-record-sub {
  margin: 0;
}

.workbench-target {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  min-width: 0;
}

.workbench-target-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* The name takes the room, so the pill sits at the right whatever the name's
   length. */
.workbench-target-head > strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* A bundle is one thing made of several: the accent down its edge says so,
   and its parts are listed under the bar. */
.workbench-target.is-bundle {
  border-left: 3px solid var(--accent);
}

.workbench-target-parts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}

/* A part's name above what it says, rather than beside it: a card is a few
   hundred pixels wide and a step's name is often a sentence, so side by side
   squeezed "6 of 8 columns filled in" into a column three words tall. */
.workbench-target-parts li {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.workbench-target-parts li + li {
  margin-top: 4px;
}

.workbench-target-parts li > span:first-child {
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* The record. A record's properties are a list of the entity's own words
   beside what each holds; a transaction lays its header's across the width in
   columns, the way the header of an invoice is laid out, with its lines as a
   table underneath. */
.workbench-record {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.workbench-record + .workbench-record {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.workbench-record-item {
  margin: 0;
  font-size: 14px;
}

/* An instance that is going: a strip over the tabs saying where it has got to,
   polled until it stops (workbenchProgressHandler). */
.workbench-progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.workbench-progress-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.workbench-progress-where {
  color: var(--text-muted);
  font-size: 13px;
}

/* A record's heading, and the Adjustments button beside it where somebody
   changed some of its values: the one place the record says it was changed,
   so it sits with the name rather than under the values. */
.workbench-record-part-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
}

.workbench-record-part-title {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.workbench-adjust-all {
  flex: none;
}

.workbench-adjust-count {
  min-width: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--sev-info-bg);
  color: var(--sev-info-text);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* The magnifier beside a value somebody changed, and the mark on the value
   itself: a quiet rule down its edge in the information colour, which a
   problem's own rule replaces where the value is also still wrong. */
.workbench-adjust-open {
  flex: none;
  vertical-align: middle;
}

/* A button beside a value sits in the line rather than setting its height:
   a row with a magnifier or a pencil in it was taller than the rows without,
   and its value dropped below its label. */
.workbench-record-prop .workbench-adjust-open,
.workbench-record-prop .workbench-record-pencil,
.workbench-record-cell .workbench-adjust-open,
.workbench-record-cell .workbench-record-pencil {
  margin-block: -6px;
}

/* The count on a field's button in the adjustments modal, readable on the
   chosen one's fill as well as on the others'. */
.btn-primary .workbench-adjust-count {
  background: color-mix(in srgb, currentColor 22%, transparent);
  color: inherit;
}

.workbench-record-prop.is-adjusted:not(.workbench-check-problem),
.data-table td.is-adjusted {
  box-shadow: inset 3px 0 0 var(--sev-info-text);
}

.workbench-record-props {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.workbench-record-prop {
  display: grid;
  grid-template-columns: minmax(8rem, 2fr) 3fr;
  gap: var(--space-3);
  padding: 6px 10px;
  font-size: 13px;
}

.workbench-record-prop + .workbench-record-prop {
  border-top: 1px solid var(--border);
}

.workbench-record-prop dt {
  color: var(--text-muted);
}

.workbench-record-prop dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* What a target's checks found of a property: a green shield where every
   check passed, and the property picked out where one did not, with the
   finding under the value. The row is tinted as well as the icon changed,
   because a record of thirty properties is read by scanning for the one that
   is wrong rather than by reading every icon. */
.workbench-check-shield {
  display: inline-flex;
  vertical-align: -2px;
}
.workbench-check-icon {
  width: 14px;
  height: 14px;
}
.workbench-check-ok .workbench-check-icon {
  color: var(--sev-ok-text);
}
.workbench-check-problem .workbench-check-icon {
  color: var(--sev-prob-text);
}
.workbench-record-prop.workbench-check-problem {
  background: var(--sev-prob-bg);
  box-shadow: inset 3px 0 0 var(--sev-prob-text);
}
.workbench-record-prop.workbench-check-problem dt {
  color: var(--sev-prob-text);
  font-weight: 600;
}
th.workbench-check-problem {
  color: var(--sev-prob-text);
}
/* The one value a check failed on, in a set of rows: the column's heading says
   some row's value failed, and on a table of hundreds of rows that is not a
   place anybody can find. The cell carries the problem tint and an outline,
   what was found is its tooltip, and the number of a row holding one is
   picked out too, so the wrong rows can be found down the table's edge. */
.data-table td.workbench-cell-problem {
  background: var(--sev-prob-bg);
  box-shadow: inset 0 0 0 1px var(--sev-prob-text);
  color: var(--sev-prob-text);
}
.data-table tr.workbench-row-problem > td.num-col {
  color: var(--sev-prob-text);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--sev-prob-text);
}
.workbench-record-problem {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--sev-prob-text);
}
.workbench-record-held {
  margin: 0 0 var(--space-2);
  color: var(--sev-warn-text);
}

/* A held-back record drawn to be put right: its values as boxes, the shield
   and what was found beside them, and Check and carry on under the lot. The
   form is the record, so it takes the record's own layout and adds nothing
   around it. */
.workbench-record-edit {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
}

.workbench-record-prop dd:has(.workbench-record-box),
.workbench-record-prop dd:has(.workbench-adjust-open),
.workbench-record-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px var(--space-2);
}

/* A value of a record being put right is read-only until its pencil is
   pressed. The pencil is the label of a visually hidden tick the server reads
   (automateCorrectionEdits), so a value is a change only where somebody chose
   to change it, and pressing it again - it has become a cross - takes the
   change back whatever was typed. The box and the value it replaces are
   siblings of the tick, which is what lets a stylesheet do the whole of it. */
.workbench-record-shown {
  flex: 1 1 10rem;
  min-width: 0;
}

.workbench-record-edit .workbench-record-box,
.workbench-record-edit .workbench-record-tick,
.automate-ask .workbench-record-box,
.automate-ask .workbench-record-tick,
.workbench-record-pencil-off {
  display: none;
}

.workbench-record-editing:checked ~ .workbench-record-box {
  display: block;
}

.workbench-record-editing:checked ~ .workbench-record-tick {
  display: inline-block;
}

.workbench-record-editing:checked ~ .workbench-record-shown,
.workbench-record-editing:checked ~ .workbench-record-pencil .workbench-record-pencil-on {
  display: none;
}

.workbench-record-editing:checked ~ .workbench-record-pencil .workbench-record-pencil-off {
  display: inline-flex;
}

.workbench-record-pencil {
  flex: none;
  cursor: pointer;
}

.workbench-record-pencil-on {
  display: inline-flex;
}

.workbench-record-editing:focus-visible ~ .workbench-record-pencil {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.workbench-record-box {
  flex: 1 1 10rem;
  min-width: 0;
  padding: 3px 6px;
  font-size: 13px;
}

.workbench-record-prop dd .workbench-record-problem {
  flex-basis: 100%;
}

/* Top-aligned, so the values stay where they were when a row's reason is
   opened beside them. */
.workbench-record-grid td {
  padding: 2px 4px;
  vertical-align: top;
}

.workbench-record-grid .workbench-record-box {
  width: 100%;
  min-width: 6rem;
}

/* A cell of a set of rows keeps its pencil on the value's line. The value asks
   for 10rem in a property's row, which is right there and wider than most
   cells are, so in a cell it wrapped the pencil onto a line of its own under
   every value and doubled the height of every row of the table. Here the value
   takes what it holds and the pencil sits after it, and the cell grows to the
   box only once the pencil has opened it. */
.workbench-record-grid .workbench-record-cell {
  flex-wrap: nowrap;
}
/* The value takes the rest of the cell, so the pencil is always the last
   thing in it, against the cell's right edge: a slot of its own at the same
   place on every row of a column. Sized to what the value holds, the pencil
   followed the end of each value and stood at a different place on every
   row. The value lines up inside its part as the column does (is-align-*). */
.workbench-record-grid .workbench-record-shown {
  flex: 1 1 auto;
  white-space: nowrap;
}

/* A column lines up by what it holds, heading and cells alike: text from the
   left, the way it is read; a number from the right, so its units sit under
   each other; a date or a tick in the middle (workbenchAlignOf). Headings and
   cells share their inline padding, so a heading starts or ends exactly where
   its values do, and in a record being put right a heading keeps clear of
   the pencil's slot at the right of every cell, which is how a right-aligned
   heading ends over its numbers rather than over their pencils. */
.workbench-record-grid {
  --record-pencil-slot: calc(28px + var(--space-2));
}
@media (pointer: coarse) {
  .workbench-record-grid {
    --record-pencil-slot: calc(44px + var(--space-2));
  }
}
.data-table.workbench-record-grid th,
.data-table.workbench-record-grid td {
  text-align: left;
  padding-inline: 4px;
}
.data-table.workbench-record-grid th:not(.num-col) {
  padding-right: calc(4px + var(--record-pencil-slot));
}
.data-table.workbench-record-grid th.num-col,
.data-table.workbench-record-grid td.num-col,
.data-table th.is-align-end,
.data-table td.is-align-end {
  text-align: right;
}
.data-table th.is-align-center,
.data-table td.is-align-center {
  text-align: center;
}

/* Why a row was not written, and a reason a card lists: one line, its gist,
   cut with an ellipsis where there is no room, and the whole reason under it
   once it is opened. D365's reason is several lines a row, and drawn whole it
   was the widest and tallest thing on the page, beside the values somebody
   came to put right. The ceiling is on the disclosure rather than the cell,
   since a table cell's own max-width is ignored, and it is what gives the
   ellipsis an edge to cut at. */
.workbench-why {
  min-width: 0;
}
/* A width rather than only a ceiling, so opening a reason does not size the
   table again: as a ceiling the column grew from the gist to the whole reason
   and every other column moved under the pointer. */
.workbench-record-grid .workbench-why {
  width: min(32rem, 40vw);
}
/* A reason a card lists opens with its own chevron, which a bullet beside it
   would only double. */
.workbench-target-problems li:has(> .workbench-why) {
  list-style: none;
  margin-left: -18px;
}
.workbench-why > summary {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  list-style: none;
  cursor: pointer;
}
.workbench-why > summary::-webkit-details-marker {
  display: none;
}
.workbench-why-chevron {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.12s ease;
}
.workbench-why[open] > summary .workbench-why-chevron {
  transform: rotate(90deg);
}
/* What the target checked of a record, under the record's heading: shut, as
   its Validate mark and how the checks came out, since the marks on the
   values already say which passed; opened, the step's own Checks table. */
.workbench-record-checks {
  margin: 0 0 var(--space-2);
}
.workbench-record-checks > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  cursor: pointer;
  font-size: 13px;
}
.workbench-record-checks > summary::-webkit-details-marker {
  display: none;
}
.workbench-record-checks[open] > summary .workbench-why-chevron {
  transform: rotate(90deg);
}
.workbench-record-checks > .table-wrapper {
  margin-top: var(--space-2);
}
.workbench-why-gist {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.workbench-why-full {
  margin: 4px 0 2px 18px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: normal;
  overflow-wrap: anywhere;
}
.workbench-target-problems .workbench-why-full {
  color: inherit;
}

/* What the form sends, on the left, and the button that sends it on the
   right, at the record's bottom corner where a form's action is looked for. */
.workbench-record-edit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.workbench-record-edit-actions .form-hint {
  flex: 1 1 16rem;
  margin: 0;
}

.workbench-record-edit-answer:empty {
  display: none;
}

.workbench-record-edit-answer {
  font-size: 13px;
  color: var(--sev-prob-text);
}

/* A record's adjustments: what somebody changed on it before the run carried
   on with it, read off the run's own log - who, when, what, and from what to
   what - with a button per field above the list to narrow it. */
.workbench-adjustments-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.workbench-adjust-fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.workbench-adjust-fields .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.data-table.workbench-adjust-table {
  table-layout: fixed;
}

.data-table.workbench-adjust-table th.workbench-adjust-when {
  width: 13rem;
}

.data-table.workbench-adjust-table td.workbench-adjust-when {
  white-space: nowrap;
}

.data-table.workbench-adjust-table th.workbench-adjust-who {
  width: 12rem;
}

.data-table.workbench-adjust-table th.workbench-adjust-what {
  width: 12rem;
}

.data-table.workbench-adjust-table td {
  overflow-wrap: anywhere;
}

/* A transaction's header: its properties across the width, a label over each
   value, as an invoice's header reads. */
.workbench-record.is-transaction .workbench-record-part.is-main .workbench-record-props {
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  border: 0;
  gap: var(--space-3);
}

.workbench-record.is-transaction .workbench-record-part.is-main .workbench-record-prop {
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 0;
  border-top: 0;
}

.workbench-record.is-transaction .workbench-record-part.is-main .workbench-record-prop dt {
  font-size: 11.5px;
}

.workbench-record.is-transaction .workbench-record-part.is-main .workbench-record-prop dd {
  font-weight: 600;
}

/* A property here has no padding of its own, so the bar a problem or a change
   is marked with down its left edge was drawn over the first letter of its
   label and of what it holds, in the label's own colour: a question about an
   invoice read "egal entity". A marked property takes its room out of the gap
   around it instead, so its words stay level with its neighbours'. */
.workbench-record.is-transaction .workbench-record-part.is-main .workbench-record-prop.workbench-check-problem,
.workbench-record.is-transaction .workbench-record-part.is-main .workbench-record-prop.is-adjusted {
  margin: -4px -8px;
  padding: 4px 8px;
}

/* And a value takes what it holds, as a cell's does: the 10rem it asks for in
   a property's row is more than a column of a header has, so the mark, the
   value and its pencil stood on three lines. An open box asks for less for
   the same reason, or the cross that closes it went under it. */
.workbench-record.is-transaction .workbench-record-part.is-main .workbench-record-shown {
  flex: 0 1 auto;
}

.workbench-record.is-transaction .workbench-record-part.is-main .workbench-record-box {
  flex-basis: 6rem;
}

@media (max-width: 600px) {
  .workbench-record-prop {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.workbench-target-meter {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-alt);
  overflow: hidden;
}

.workbench-target-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.workbench-target-words {
  font-size: 12.5px;
}

.workbench-target-problems {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--sev-warn-text);
  overflow-wrap: anywhere;
}

/* The document view (document_view.html, automate_docview.go): one document as
   every page that reads one draws it. A strip says what it is and how far it
   has got; the page it was read from takes about 560px of a 1200px card on the
   left, never less than 40 percent, and the fields take the rest; the lines
   run across the whole card under both. Below 960px of card the panes stack,
   the page first. Measured against the card rather than the window, since
   the same view is drawn in a tab the page's width, in the Info panel's
   dialog and in a decision card. */
.docview {
  container: docview / inline-size;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  min-width: 0;
}

.docview-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.docview-strip-name {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px var(--space-2);
  min-width: 0;
}

.docview-strip-title {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.docview-strip-type,
.docview-strip-by,
.docview-strip-progress {
  color: var(--text-muted);
  font-size: 12.5px;
}

.docview-strip-by strong {
  color: var(--text);
  font-weight: 600;
}

.docview-strip-progress {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.docview-meter {
  width: 120px;
  height: 6px;
  flex: none;
  border-radius: 3px;
  background: var(--surface-alt);
  overflow: hidden;
}

.docview-meter-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* A document that has ended: a banner in its status's colour saying who and
   why, over everything else, and what a check found under it faded, since it
   is nobody's to put right now. */
.docview-closed {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text);
}
.docview-closed-problem { border-color: var(--sev-prob-border); background: var(--sev-prob-bg); color: var(--sev-prob-text); }
.docview-closed-warning { border-color: var(--sev-warn-border); background: var(--sev-warn-bg); color: var(--sev-warn-text); }
.docview-closed-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: currentColor; }
.docview-closed-words { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.docview-closed-why { overflow-wrap: anywhere; }
.docview.is-closed .docview-unplaced,
.docview.is-closed .docview-field.is-problem,
.docview.is-closed .docview-field.is-notice,
.docview.is-closed .docview-lines-table td.is-problem,
.docview.is-closed .docview-lines-table td.is-notice { opacity: 0.6; }

/* A problem about no value the view draws: the document as a whole, its lines
   as a list, or one a question was handed beside the document's own. */
.docview-unplaced {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  list-style: none;
  border: 1px solid var(--sev-prob-border);
  border-radius: var(--radius-sm);
  background: var(--sev-prob-bg);
  color: var(--sev-prob-text);
  font-size: 13px;
}

.docview-unplaced li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  overflow-wrap: anywhere;
}

.docview-unplaced-icon {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
}

.docview-read-from {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: 12.5px;
}

.docview-read-from-label {
  color: var(--text-muted);
}

.docview-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
}

.docview-sources li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.docview-sources a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow-wrap: anywhere;
}

.docview-sources li.is-drawn a {
  font-weight: 600;
}

.docview-source-icon {
  width: 14px;
  height: 14px;
  flex: none;
}

.docview-source-size {
  color: var(--text-muted);
}

.docview-panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}

/* Beside the fields the page takes the height the fields need, never less
   than 480px, and scrolls or is fitted inside it: size containment keeps the
   page's own height out of the row's, so a page taller than the properties no
   longer holds the lines down under a void beside the fields. */
.docview-panes.has-page {
  grid-template-columns: max(40%, min(560px, 47%)) minmax(0, 1fr);
  align-items: stretch;
}

.docview-panes.has-page > .docview-page {
  contain: size;
  min-height: 480px;
}

.docview-panes.has-page .docview-page-stage {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
}

/* The page: a bar naming the file with the stage's controls, then the stage,
   the alt surface with the page centred on it, fitted to the pane's width
   and scrolling over the page once it is zoomed past it (document-page.js). */
.docview-page {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.docview-page-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px var(--space-2);
  padding: 6px var(--space-2);
  border-bottom: 1px solid var(--border);
}

.docview-page-title {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  flex: 1 1 10rem;
  min-width: 0;
}

.docview-page-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docview-page-meta {
  display: inline-flex;
  gap: var(--space-2);
  flex: none;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.docview-page-count:empty {
  display: none;
}

.docview-page-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  margin-left: auto;
}

.docview-page-sources {
  padding: 4px var(--space-2);
  border-bottom: 1px solid var(--border);
}

/* The gutter is kept whether or not the page scrolls: a scroll bar that came
   and went would change the width the page is fitted to, and a page just
   taller than the stage at one width and not at the other is drawn again on
   every turn. */
.docview-page-stage {
  display: flex;
  min-height: 240px;
  max-height: min(78vh, 900px);
  padding: var(--space-3);
  overflow: auto;
  scrollbar-gutter: stable;
  background: var(--surface-alt);
}

.docview-page-stage.can-pan {
  cursor: grab;
}

.docview-page-stage.is-panning {
  cursor: grabbing;
  user-select: none;
}

.docview-page-stage:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* margin: auto centres a page smaller than the stage and leaves one larger
   than it at the start, where the stage can scroll to every part of it;
   centring by alignment would cut off what overflows above and to the left. */
.docview-page-sheet {
  position: relative;
  flex: none;
  margin: auto;
  outline: 1px solid var(--border);
}

.docview-page-img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  user-select: none;
}

.docview-page-canvas {
  display: block;
}

.docview-page-problem,
.docview-page-drawing {
  max-width: 36ch;
  margin: var(--space-3);
  text-align: center;
}

/* A page that could not be drawn is one sentence with the two ways to the
   file beside it (document-page.js's say): no outline round it, and the
   stage gives up the height it keeps for a page, which left the sentence
   under hundreds of pixels of nothing on a run's PDF and the PDF output
   tab's Preview. */
.docview-page-problem {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  max-width: none;
}

.docview-page-problem > p {
  margin: 0;
}

.docview-page-problem-actions {
  display: inline-flex;
  gap: var(--space-2);
}

.docview-page-sheet:has(> .docview-page-problem) {
  outline: none;
}

.docview-page-stage:has(.docview-page-problem),
.automate-run-pdf .docview-page-stage:has(.docview-page-problem),
.automate-give-pdf .docview-page-stage:has(.docview-page-problem),
.pdfd-preview .docview-page-stage:has(.docview-page-problem) {
  height: auto;
  min-height: 0;
  align-self: start;
}

.pdfd-mirror-why:empty,
.pdfd-mirror-why[hidden] {
  display: none;
}

/* The fields: the key facts as tiles, then everything else as rows in two
   columns, each measured against the pane rather than the card. */
.docview-fields {
  container: docfields / inline-size;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.docview-band {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.docview-band-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px var(--space-2);
  color: var(--text-muted);
  font-size: 12px;
}

.docview-band-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.docview-band-count {
  font-variant-numeric: tabular-nums;
}

.docview-band-end,
.docview-band-totals {
  margin-left: auto;
}

.docview-band-totals {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.docview-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

/* Beside a page the fields have half the card, and four tiles across cut
   every value they held: three across, and two in a card under 1300px. */
:where(.docview-panes.has-page) .docview-facts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.docview-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.docview-fact-label {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docview-fact .docview-value-text,
.docview-fact .workbench-record-shown {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

/* A tile's label and, in its top right-hand corner, the shield of the
   checks its value is held to. */
.docview-fact-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
}

.docview-fact .docview-by {
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}

.docview-fact.is-problem {
  border-color: var(--sev-prob-border);
  background: var(--sev-prob-bg);
}

.docview-fact.is-problem .docview-fact-label {
  color: var(--sev-prob-text);
}

/* A value a check found something wrong with, once its box holds something
   the page was not drawn with (docview-answer.js): the sentence was about the
   value as it stood, so it no longer says in red under one the reader has
   just typed that it is missing. Sending the answer is what checks it. */
.docview-fact.is-problem.is-answered {
  border-color: var(--border);
  background: var(--surface);
}

.docview-fact.is-problem.is-answered .docview-fact-label {
  color: var(--text-muted);
}

.docview-row.is-problem.is-answered .docview-row-label {
  box-shadow: none;
  color: var(--text-muted);
}

.docview-field.is-answered .docview-problem {
  display: none;
}

/* A value as a tile or a row draws it: what it holds, wrapping where its
   place ends rather than cut, since a value is never what gets the ellipsis;
   who worked it out on a line of its own under it, always, cut only where
   that line cannot hold it (its tooltip is whole); and what a check found
   under both. Beside it where there was room and under it where there was
   not put who worked it out in a different place on every row, and a box
   shared its row with it rather than taking the row's whole width. */
.docview-value {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.docview-value-line {
  display: flex;
  align-items: baseline;
  gap: 0 var(--space-2);
  min-width: 0;
}

/* The shield of the checks a value is held to (doc-view-shield): Validate's
   own mark, drawn in Validate's colour where the theme gives it one, and red
   where a check found something wrong with the value. */
.docview-shield {
  display: inline-flex;
  flex: none;
  align-items: center;
  color: var(--module-validate, var(--accent));
  cursor: help;
}

.docview-shield.is-problem {
  color: var(--sev-prob-text);
}

.docview-shield-icon {
  width: 16px;
  height: 16px;
}

/* A row's shield is its last cell, after the value, which takes the rest. */
.docview-row-shield {
  display: flex;
  align-items: center;
  padding: 0 var(--space-2) 0 0;
}

/* On a line column's heading the shield follows the words, since the rule
   protects the column rather than one of its cells. */
.docview-th-checked {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.docview-th-checked .docview-shield-icon {
  width: 14px;
  height: 14px;
}

.docview-value-text,
.docview-value .workbench-record-shown {
  flex: 0 1 auto;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.docview-value .value-none {
  color: var(--text-faint);
  font-weight: 400;
}

.docview-by {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docview-problem {
  color: var(--sev-prob-text);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.docview-value .workbench-record-pencil,
.docview-value .workbench-adjust-open {
  margin-block: -6px;
}

.docview-value .workbench-record-pencil {
  align-self: center;
}

/* A value the card lets somebody change is a box at rest, drawn as the
   product's own inputs are (the input ground, a border, the input radius)
   with its pencil inside its right-hand edge, and a value they may not change
   stays plain text. The two were drawn alike: the same weight on the same
   ground, with a bare pencil glyph beside the two or three a card was asking
   about, so a card of twenty values did not say which they were.

   The whole box is the control. The value in it is a label of the pencil's
   own tick, so a press anywhere in the box opens it, and the box takes the
   accent once it is open and holds the real input, drawn without a border of
   its own so there is one box and not a box in a box. It fits the 34px row,
   which has 25px between the value's padding once its own rule is taken off
   (so 24px: the pencil's 22 and the border), and the key-fact tile. Who
   worked the value out sits after the box, outside it. */
.docview-box {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 24px;
  padding: 0 2px 0 6px;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.docview-fact .docview-box {
  min-height: 32px;
}

.docview-box:hover {
  border-color: var(--accent);
}

.docview-box:has(.workbench-record-editing:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

/* The keyboard's focus is on the tick, which is hidden for sight, so the box
   wears it; the pencil inside does not wear a second ring. */
.docview-box:has(.workbench-record-editing:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.docview-box .workbench-record-editing:focus-visible ~ .workbench-record-pencil {
  outline: none;
}

.docview-box .workbench-record-shown {
  flex: 1 1 auto;
  cursor: text;
}

.docview-box .workbench-record-box {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background-color: transparent;
}

.docview-box .btn.btn-icon-only.workbench-record-pencil {
  width: 22px;
  height: 22px;
  margin-block: 0;
}

/* A box a check found something wrong with says so on its own edge, until it
   holds something new or is open. */
.docview-field.is-problem:not(.is-answered) .docview-box:not(:hover):not(:has(.workbench-record-editing:checked)) {
  border-color: var(--sev-prob-border);
}

/* The label of a value that can be changed reads as a field's label, in the
   text colour rather than the muted one every other label wears. */
.docview-row.is-editable:not(.is-problem) .docview-row-label,
.docview-fact.is-editable:not(.is-problem) .docview-fact-label {
  color: var(--text);
}

/* How many of a band's values can be changed, beside how many are filled. */
.docview-band-change {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Everything else: a row 34px tall, its label on the alt surface beside its
   value, a rule under every row and between the two columns. A row a check
   found something wrong with carries a red rule down its label and grows to
   say what under its value.

   The two columns share their rows. Each column was a stack of its own, so
   a row that grew - a label on two lines, a problem said under a value - grew
   in its own column alone and every row under it sat lower than the row
   beside it for the rest of the band: two columns of a table whose rows did
   not line up. The band has as many row tracks as its longer column holds
   (--docview-rows, from the template) and each column is a subgrid over all
   of them, so a track is as tall as the taller of the two rows in it and both
   stretch to it. Not a multiple of 34px: a track is what its taller row
   needs, since a value is never cut to fit one. */
.docview-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(var(--docview-rows, 1), auto);
  border-top: 1px solid var(--border);
}

.docview-rows-col {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: 1 / -1;
  min-width: 0;
}

.docview-rows-col + .docview-rows-col {
  border-left: 1px solid var(--border);
}

.docview-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  min-height: 34px;
  border-bottom: 1px solid var(--border);
}

/* A label wraps to a second line rather than being cut: "Claimant's vendor
   account" read "Claimant's vendor a..." in a 150px column, and the row
   already grows for a second line of its value. A label of one line sits
   in the middle of the row's 34px. */
.docview-row-label {
  display: flex;
  align-items: center;
  padding: 4px var(--space-2);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* Padding small enough that a value on one line keeps the row its 34px, and
   enough that one with who worked it out under it does not touch the rules. */
.docview-row > .docview-value {
  padding: 4px var(--space-2);
}

.docview-row.is-problem .docview-row-label {
  box-shadow: inset 3px 0 0 var(--sev-prob-text);
  color: var(--sev-prob-text);
}

.docview-row.is-problem > .docview-value {
  justify-content: flex-start;
  padding-block: 8px;
}

/* The lines, across the whole card, numbered as they were given. */
.docview-lines-wrap,
.docview-lines-table {
  width: 100%;
}

.data-table.docview-lines-table th.docview-line-number,
.data-table.docview-lines-table td.docview-line-number {
  width: 3.5em;
  color: var(--text-muted);
}

.data-table.docview-lines-table td.is-problem {
  background: var(--sev-prob-bg);
}

.data-table.docview-lines-table td .docview-problem {
  display: block;
  margin-top: 2px;
  white-space: normal;
}

/* What a check said that stops nothing: a warning in amber, information in
   blue, drawn where a finding is drawn in red and with the severity colours
   Validate's own results use, so a document reads its checks as Validate's
   report does. The document stays ready; the words say why somebody may want
   to look. */
.docview-notice {
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.docview-notice.is-warning {
  color: var(--sev-warn-text);
}

.docview-notice.is-info {
  color: var(--sev-info-text);
}

.docview-fact.is-notice.is-warning {
  border-color: var(--sev-warn-border);
  background: var(--sev-warn-bg);
}

.docview-fact.is-notice.is-info {
  border-color: var(--sev-info-border);
  background: var(--sev-info-bg);
}

.docview-row.is-notice.is-warning .docview-row-label {
  box-shadow: inset 3px 0 0 var(--sev-warn-text);
}

.docview-row.is-notice.is-info .docview-row-label {
  box-shadow: inset 3px 0 0 var(--sev-info-text);
}

.docview-row.is-notice > .docview-value {
  justify-content: flex-start;
  padding-block: 8px;
}

.data-table.docview-lines-table td.is-notice.is-warning {
  background: var(--sev-warn-bg);
}

.data-table.docview-lines-table td.is-notice.is-info {
  background: var(--sev-info-bg);
}

.data-table.docview-lines-table td .docview-notice {
  display: block;
  margin-top: 2px;
  white-space: normal;
}

/* A cell of the lines a question lets somebody change: the box a header's
   value has (docview-box), in its own cell. The cell is at least wide enough
   to type in, and a number's box keeps its value at the end as the column
   does. A cell a check marked loses its tint and its sentence once its box
   holds something new (docview-answer.js), as a header's value does. */
.data-table.docview-lines-table td.is-editable {
  min-width: 7.5rem;
  padding-block: 3px;
}

.docview-cell-box {
  flex: none;
  width: 100%;
}

.data-table.docview-lines-table td.is-align-end .docview-cell-box .workbench-record-shown,
.data-table.docview-lines-table td.is-align-end .docview-cell-box .workbench-record-box {
  text-align: right;
}

.data-table.docview-lines-table td.is-problem.is-answered {
  background: transparent;
}

.data-table.docview-lines-table td.is-problem.is-answered .docview-problem {
  display: none;
}

.data-table.docview-lines-table td.is-problem:not(.is-answered) .docview-box:not(:hover):not(:has(.workbench-record-editing:checked)) {
  border-color: var(--sev-prob-border);
}

/* A value somebody has seen to: a person approved the document over what a
   check found on it (is-accepted), or gave the value themselves (is-corrected).
   Green where it was red, and who did it said on the value: in a tile's top
   right-hand corner, and on a row on a line of its own under the value. What
   was found stays under an accepted value, in the muted colour rather than
   red: it is what was found, and the green says somebody saw it and went on. */
.docview-fact.is-seen {
  border-color: var(--sev-ok-border);
  background: var(--sev-ok-bg);
}

.docview-fact.is-seen .docview-fact-label {
  color: var(--sev-ok-text);
}

.docview-row.is-seen .docview-row-label {
  box-shadow: inset 3px 0 0 var(--sev-ok-text);
  color: var(--sev-ok-text);
}

.docview-row.is-seen > .docview-value {
  justify-content: flex-start;
  padding-block: 8px;
}

.docview-field.is-seen .docview-problem {
  color: var(--text-muted);
}

.docview-fact-marks {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.docview-seen {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 3px;
  min-width: 0;
  color: var(--sev-ok-text);
  font-size: 11.5px;
  line-height: 1.35;
}

.docview-seen-icon {
  flex: none;
  width: 13px;
  height: 13px;
}

.docview-seen-words {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table.docview-lines-table td.is-accepted {
  background: var(--sev-ok-bg);
}

.data-table.docview-lines-table td.is-accepted .docview-problem {
  color: var(--text-muted);
}

/* The bin at the end of a line. It is the label of a tick the server reads
   (del.<line number>), so a line is removed only where it was pressed and a
   second press, on what has become an undo, keeps the line. While it is set
   the line is struck through and its boxes stand back: what was typed on it
   is not sent, since the line is going. */
.data-table.docview-lines-table th.docview-line-act,
.data-table.docview-lines-table td.docview-line-act {
  width: 2.5rem;
  padding-block: 2px;
  text-align: center;
}

.docview-line-remove {
  cursor: pointer;
}

.docview-line-remove-off,
.docview-line-removing:checked ~ .docview-line-remove .docview-line-remove-on {
  display: none;
}

.docview-line-remove-on,
.docview-line-removing:checked ~ .docview-line-remove .docview-line-remove-off {
  display: inline-flex;
}

.docview-line-removing:focus-visible ~ .docview-line-remove {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.data-table.docview-lines-table tr:has(.docview-line-removing:checked) td:not(.docview-line-act) {
  color: var(--text-muted);
  text-decoration: line-through;
}

.data-table.docview-lines-table tr:has(.docview-line-removing:checked) .docview-box {
  opacity: 0.55;
  pointer-events: none;
}

.data-table.docview-lines-table tr:has(.docview-line-removing:checked) .docview-line-remove {
  color: var(--sev-prob-text);
}

/* The lines a question lets somebody add: rows of the lines table after the
   lines there are, a slot per line one answer may add, each behind a tick the
   server drew, so a live update's morph and a refused answer keep every line
   open and everything typed. A stylesheet shows the ones in use: a row whose
   tick is set draws its boxes, each under the heading it fills, and is
   numbered on from the last line (the docview-add counter, reset on the
   table's body to the number before the first new line); of the rows not in
   use only the first draws anything, its Add a line button, which is that
   row's tick's label. So there is one button, pressing it opens the next
   line, and the cross at the end of a line takes it back and frees its row.
   Once every row is in use the button gives way to a line saying so. The
   new lines were a block of their own under the table, each box under a
   label of its own, and their values sat nowhere near the columns they
   belong in. */
.docview-add-row:not(:has(.docview-add-tick:checked)) ~ .docview-add-row:not(:has(.docview-add-tick:checked)) {
  display: none;
}

/* An open line is counted, and numbered, only once something is in it: an
   open line left empty is no line (automateAskAnswer), so counting it drew 5
   on the line the document makes 4. A box holding something is one whose
   placeholder (a space, drawn for this) is no longer shown. */
.docview-add-row:has(.docview-add-tick:checked):has(input.form-input.docview-add-box:not(:placeholder-shown), select.docview-add-box option:checked:not([value=""]), input.docview-add-flag:checked) {
  counter-increment: docview-add;
}

.docview-add-row:has(.docview-add-tick:checked):not(:has(input.form-input.docview-add-box:not(:placeholder-shown), select.docview-add-box option:checked:not([value=""]), input.docview-add-flag:checked)) .docview-add-n::before {
  content: "-";
}

.data-table.docview-lines-table .docview-add-row > td {
  padding-block: 3px;
}

.docview-add-row:has(.docview-add-tick:checked) > td {
  background: var(--accent-dim);
}

/* A row not in use is its button alone: the button sits over the row from
   the number's cell, laid out where it takes no room from the columns, and
   the row's other cells are empty. */
.docview-add-row:not(:has(.docview-add-tick:checked)) > td {
  border-bottom: none;
}

.docview-add-row:not(:has(.docview-add-tick:checked)) > td:not(.docview-add-number) > *,
.docview-add-row:not(:has(.docview-add-tick:checked)) .docview-add-n,
.docview-add-row:has(.docview-add-tick:checked) .docview-add-open {
  display: none;
}

.data-table.docview-lines-table td.docview-add-number {
  position: relative;
  height: 38px;
}

.docview-add-open {
  position: absolute;
  top: 50%;
  left: var(--space-2);
  white-space: nowrap;
  cursor: pointer;
  transform: translateY(-50%);
}

.docview-add-n::before {
  content: counter(docview-add);
}

.docview-add-tick:focus-visible ~ .docview-add-open,
.docview-add-row:has(.docview-add-tick:focus-visible) .docview-add-close {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Room to type in, only on a line that is open: on every row it widened a
   question's table past a phone before anything was added. */
.data-table.docview-lines-table .docview-add-row:has(.docview-add-tick:checked) td.docview-add-cell:has(.docview-add-box) {
  min-width: 7.5rem;
}

.docview-add-box {
  width: 100%;
  min-height: 24px;
  padding: 2px 6px;
  font-size: 13px;
}

.docview-add-cell.is-align-end .docview-add-box {
  text-align: right;
}

.docview-add-flag {
  width: auto;
  min-height: 0;
  margin: 4px 0;
}

.docview-add-close {
  cursor: pointer;
}

.docview-add-full {
  display: none;
}

[data-doc-band="lines"]:has(.docview-add-row):not(:has(.docview-add-tick:not(:checked))) .docview-add-full {
  display: block;
  margin: 0;
}

@container docview (max-width: 1299px) {
  :where(.docview-panes.has-page) .docview-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container docview (max-width: 959px) {
  .docview-panes.has-page {
    grid-template-columns: minmax(0, 1fr);
  }

  .docview-panes.has-page > .docview-page {
    contain: none;
    min-height: 0;
  }

  .docview-panes.has-page .docview-page-stage {
    flex: none;
    min-height: 240px;
    max-height: min(78vh, 900px);
  }

  :where(.docview-panes.has-page) .docview-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@container docfields (max-width: 559px) {
  /* One column: the two stack, each a column of its own rows again, since
     there is no row beside any of them to line up with. */
  .docview-rows {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  .docview-rows-col {
    display: flex;
    flex-direction: column;
    grid-row: auto;
  }

  .docview-rows-col + .docview-rows-col {
    border-left: 0;
  }
}

@container docfields (max-width: 479px) {
  .docview-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =====================================================
   Automate overview
   =====================================================

   The landing page: four bands answering "is anything wrong?" in the order
   somebody asks it. Almost everything here is the shared vocabulary already -
   summary-bar, data-table, status-pill - so what is left is the band headings,
   the attention list, and making a stat that links look like one. */

.automate-overview-band {
  margin-bottom: var(--space-5);
}

.automate-overview-band-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.automate-overview-title {
  margin: 0 0 var(--space-3);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.automate-overview-band-head .automate-overview-title {
  margin-bottom: var(--space-3);
}

.automate-overview-windows {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-3);
}

/* The four numbers at the top are links: each one goes to the list that
   explains it, so a count is a way in rather than a fact to memorise. They
   carry no underline and no accent colour, because the tile is the target. */
a.summary-stat {
  text-decoration: none;
  color: inherit;
}

a.summary-stat:hover {
  border-color: var(--accent);
}

/* The attention band is a list rather than a table: the rows have three parts
   of very different lengths, and a table would give the longest one a column
   as wide as the page. */
.automate-attention {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.automate-attention-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.automate-attention-name {
  font-weight: 600;
}

.automate-attention-detail {
  flex: 1 1 260px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* The sentence beside a live run's state pill. It is not in the pill because
   the pill title-cases its contents, which turns an email address into
   Bruno@Demo.Local. */
.automate-overview-doing {
  margin-left: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* The trigger and last-run cells stack a fact under their value. */
.automate-overview-estate .form-hint {
  display: block;
  margin: 2px 0 0;
}

/* The inspector's actions stick to the foot of the column they scroll in, so
   Save is reachable from any field rather than below a dozen of them, and the
   unsaved marker sits beside the button that clears it. The negative margins
   take the bar to the column's edges, past the padding it scrolls inside. */
.automate-inspector-actions {
  position: sticky;
  bottom: calc(var(--space-4) * -1);
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: var(--space-4) calc(var(--space-4) * -1) calc(var(--space-4) * -1);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* Delete is the last of the foot actions, at the far end of the bar: Save is
   in the head now, and what is pressed by mistake down here should be the
   least destructive thing on the row. */
.automate-inspector-delete {
  margin-left: auto;
  flex-shrink: 0;
}

/* Unsaved changes: a word beside a dot, never the dot alone. */
.automate-unsaved {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sev-warn-text);
  white-space: nowrap;
}

.automate-unsaved-dot {
  width: 16px;
  height: 16px;
}

/* The node the unsaved form belongs to says so on the canvas too, so a person
   who has scrolled away from the inspector can still see which step they left
   half-edited. */
.automate-node.is-dirty .automate-node-box {
  stroke: var(--sev-warn-text);
  stroke-dasharray: 4 3;
}

/* --- Libraries ---
   A library is a catalogue browsed at full width: a strip of categories across
   the top (the library-tabs partial) and a card per entry with room to say what
   it is for. Automate's Node Library and Validate's Check Library are both drawn
   from these rules, so a reader who has browsed one has browsed the other, and a
   third library is a page of markup rather than a second card vocabulary. What a
   card holds is each library's own: the step's port line and module badge in
   Automate (.automate-palette-chip, .library-card-note), the rule and the facts
   of a check in Validate (.check-library-*). Every card is one shape whatever
   it holds: its name, its key on a line of its own under the name, what it is
   for, and a foot (.library-card-foot) level along its row. */
.library-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.library-tab-count {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* The same shape the palette gives a category, so a step found here is found
   under the same heading when building. */
.library-group-title {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* min() so a phone narrower than a card's floor gets one card the width of the
   page rather than a card wider than it. */
.library-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-3);
}

.library-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: var(--space-2);
  align-items: start;
  min-width: 0;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.library-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.library-card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* The name, and under it the key - always under it, never beside it. Beside
   it when both were short and under it when they were not put the key in a
   different place on every other card, and a key longer than the card (a
   service step's, service.companies-house.persons-with-significant-control)
   ran straight out of it. On a line of its own the key has the card's whole
   width, and one too long even for that is cut where the card ends, with the
   whole of it in its title. */
.library-card-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.library-card-head .type-badge {
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-card-label {
  font-size: 14px;
  font-weight: 600;
}

/* A section of a large category (contract.Descriptor.Subcategory), under the
   category's own title: sentence case and the text's colour, as the palette
   draws the same section inside its heading. */
.automate-library-section-title {
  margin: var(--space-3) 0 var(--space-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.automate-library-section-title .automate-library-tab-count {
  margin-left: var(--space-1);
  font-weight: 400;
}

.library-card-summary {
  font-size: 12.5px;
  color: var(--text-muted);
}

.library-card-note {
  font-size: 11px;
  color: var(--text-muted);
}

/* A card's last line, across the whole card and at its foot, starting at one
   height along every row of cards. Automate's foot is what the step takes and
   gives, Validate's the marks saying where a check runs and what it reads.

   The card takes two of the grid's rows and shares them with the cards beside
   it (subgrid), so a row's bodies are as tall as its tallest and so are its
   feet. Pushing the foot down inside each card on its own was the first
   answer and only got the bottoms level: a step's ports run to two lines
   where a setting adds a type, and that foot then started a line higher than
   its neighbours', dividers and all. The gap between a card's body and its
   foot is its own rather than the grid's, which is the gap between cards. */
.library-card:has(> .library-card-foot) {
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: var(--space-2);
}

.library-card-foot {
  grid-column: 1 / -1;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

/* An entry's icon, tinted with the product's accent: the square Automate's
   palette chip draws, for a library whose entries have no app colour of their
   own. The size rule is on the <svg> the mdi-icon helper renders, never on a
   wrapper. */
.library-card-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent);
  flex: none;
}

.library-card-chip-icon {
  width: 16px;
  height: 16px;
}

/* What the entries under a heading have in common, in a sentence: under the
   group's title where every group is on show, and under the strip where one
   category has been chosen and its title is the tab. */
.library-group-note {
  margin: 0 0 var(--space-2);
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 100ch;
}

/* --- Validate's Check Library ---
   A card per check, kept small: its name and type key, what it does in a
   couple of lines, and its marks along its foot - whether it runs on a file,
   whether it runs as SQL, and what it reads - with the key to them beside the
   search, doubling as the toggles that filter by them. Its rule, what a
   failure raises and its parameters are the check's own page. */

/* The search and the key share one line, so the key costs no height; on a
   narrow screen the key wraps under the search. */
.check-library-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  margin-bottom: var(--space-3);
}

.check-library-search {
  flex: 1 1 320px;
  max-width: 520px;
}

.check-library-search .form-group {
  margin: 0;
}

/* The key has a heading of its own in the search label's style, so beside
   the search the two headings share a line and its entries are level with the
   box, and under it on a narrow screen it reads as a field of its own. */
.check-library-key-groups {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

.check-library-key-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.check-library-key-label {
  margin-right: var(--space-1);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.check-library-key-entry {
  gap: 4px;
}

/* Two lines of what the check does, the rest on hover and on its page, so a
   long description does not make its card - and every card in its row - the
   tallest thing on the page. */
.check-library-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* The marks are the card's foot (.library-card-foot), laid out as a row. */
.check-library-marks {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.check-library-mark-slot {
  display: inline-flex;
}

/* What a check reads sits at the far end of the footer, apart from the two
   places it can run. */
.check-library-mark-slot[data-check-mark="field"],
.check-library-mark-slot[data-check-mark="row"],
.check-library-mark-slot[data-check-mark="aggregate"] {
  margin-left: auto;
}

/* A place the check cannot run is drawn faded rather than left out, so the
   file and SQL marks are in the same two places on every card. */
.check-library-mark-slot.is-off {
  opacity: 0.22;
}

/* The mdi-icon class is on the <svg> itself. Each mark keeps the colour its
   word pill has had, so a reader who knows the pills knows the marks. */
.check-library-mark {
  width: 16px;
  height: 16px;
}

.check-library-mark-file { color: #60a5fa; }
.check-library-mark-sql { color: #fbbf24; }
.check-library-mark-field { color: #a78bfa; }
.check-library-mark-row { color: #fb923c; }
.check-library-mark-aggregate { color: #f472b6; }

html[data-theme="light"] .check-library-mark-file { color: #2563eb; }
html[data-theme="light"] .check-library-mark-sql { color: #b45309; }
html[data-theme="light"] .check-library-mark-field { color: #5b3fb8; }
html[data-theme="light"] .check-library-mark-row { color: #9a4a0b; }
html[data-theme="light"] .check-library-mark-aggregate { color: #a12d68; }

.check-library-mark-slot.is-off .check-library-mark {
  color: var(--text-muted);
}

/* A check's own page names its kind as a link to the library narrowed to the
   rest of that kind. Links inherit the text colour here, so this one is marked
   as one by the accent and by weight. */
.check-library-kind-link {
  color: var(--accent);
  font-weight: 600;
}

.check-library-kind-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* One step, on its own page: the kind, where it sits, and the two facts that
   change what a workflow does with it and are visible in none of its fields. */
.automate-library-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.automate-library-fact {
  font-size: 12px;
  color: var(--text-muted);
}

/* A step reads left to right, the way it runs: what it takes, what it is set
   to do, what it gives. The settings track is capped rather than stretched -
   a form is read down a column, and fields drawn the width of a desktop are
   worse to fill in - and the two outer tracks are the width of the values
   that go in and come out of them. */
/* The three columns share the whole width rather than a fixed 1260px of it.
   They were 320px, 620px and 320px, which on any monitor wider than that left
   the rest of the screen empty while the Gives column - the one holding the
   tables - was the narrowest thing on the page.

   Proportions rather than fixed widths, weighted towards Gives for that
   reason, with a floor under each so none collapses to nothing. Settings
   keeps a ceiling: a form does not read better for being a thousand pixels
   wide, and the room is worth more to the value beside it. */
.automate-library-bench {
  display: grid;
  /* min(..., 100%) on every floor so a track can collapse to its container
     rather than overflowing it, which is what TestGridTracksFitAPhone asks
     for and is identical once there is room. */
  grid-template-columns:
    minmax(min(280px, 100%), 1fr)
    minmax(min(400px, 100%), 1.5fr)
    minmax(min(320px, 100%), 2fr);
  gap: var(--space-4);
  /* Side by side, the three read as one thing, so they are one height: the
     tallest decides and the other two fill their row. It was `start`, which is
     each box to its own content, and three bordered boxes of three different
     heights along one row is what made the screen read as unfinished rather
     than as three parts of a bench.

     It costs nothing once they stop being side by side, which is why there is
     no second rule for it: a stretch is a fact about a grid ROW, so below
     1200px - one column, one item per row - every box is back to its own
     height without anything having to say so. */
  align-items: stretch;
}

.automate-library-column {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

/* The first heading in a column sits at its top: tool-column-subheading
   carries 20px above it for a heading in the middle of a form. */
.automate-library-column > .tool-column-subheading:first-child {
  margin-top: 0;
}

.automate-take + .automate-take {
  margin-top: var(--space-4);
}

/* A value typed into a box for a port is code, not prose. */
.automate-take-value {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* A date port's box, the calendar button that opens its chooser and Now on
   one row, the box taking what is left. */
.automate-take-date {
  display: flex;
  align-items: center;
  gap: 6px;
}
.automate-take-date > .automate-take-value {
  flex: 1 1 0;
  min-width: 7rem;
  width: auto;
}
.automate-take-date > .automate-take-picker {
  position: relative;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  margin-top: 0;
}
/* The input the calendar button opens: there, under the button, so the
   browser's picker opens beside it, and out of sight. */
.automate-take-picker .automate-take-pick {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
/* The one muted line under a date box, cut where it ends and whole in its
   tooltip. */
.automate-take-hint {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automate-give {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.automate-give:last-child {
  border-bottom: 0;
}

/* The sequencing ports carry order rather than a value, and are dimmed for
   the same reason the canvas draws them hollow. */
.automate-give.is-sequence {
  opacity: 0.7;
}

.automate-give .form-hint {
  margin: 4px 0 0;
}

/* A signal that went off on the last test.
   A signal carries no value, so there is nothing to preview and nothing worth
   putting in a type badge: what there is to know is whether the path was
   taken. The whole row is tinted rather than the word alone, because a branch
   step draws several of these one under another and the eye is looking for
   which of them went, not for a word to read. */
.automate-give.has-fired {
  background: rgba(100, 200, 80, 0.1);
  border-radius: var(--radius-sm);
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.automate-give-fired {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--sev-ok-text);
  font-size: 12px;
  font-weight: 600;
}

/* An mdi-icon Class lands on the <svg> itself, so this is not a descendant
   rule: see CLAUDE.md's note on mdiIconFallbackSize. */
.automate-give-fired-icon {
  width: 14px;
  height: 14px;
}

/* And one that did not. Said in words rather than left blank, so a reader can
   tell a branch that was not taken from a step that has not been tried. */
.automate-give-quiet {
  color: var(--text-muted);
  font-size: 12px;
}

/* What a test produced, on the port it came out of. */
/* The box a produced value sits in: the line naming it, the magnifier that
   opens it, and the value itself where it is small enough to be drawn. It
   holds the dialog too, which is what data-dialog-host walks up to. */
.automate-value {
  min-width: 0;
}

/* A value is named in a line, with the magnifier that opens the whole of it
   at the end of that line. The row exists so the two sit together whether or
   not the value itself is drawn under them. */
.automate-value-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.automate-value-summary {
  font-size: 12px;
  color: var(--text-muted);
}

/* Held to the row's own height so a magnifier does not stretch the line it
   sits on. */
.automate-value-open {
  flex: none;
}

/* Full screen is what the modal is for: a table of forty rows and seven
   columns is why the reader opened it, so it gets the window rather than a
   dialog's ordinary width. */
.automate-value-modal {
  width: min(96vw, 1400px);
  max-width: min(96vw, 1400px);
}

/* Inside the modal the ceilings that keep a value inside a 320px column are
   what is being escaped, so they are lifted to the room the dialog has. */
.automate-value-items.is-wide,
.automate-value-rows.is-wide,
.automate-test-preview.is-wide {
  max-height: min(70vh, 900px);
  max-width: none;
}

.automate-give-value {
  margin-top: var(--space-2);
}

/* The file a step wrote, offered as a download beside the sentence
   describing it. A button rather than a bare link, from the shared
   vocabulary: a control that can be pressed is drawn as one. */
.automate-give-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-2);
  margin-right: var(--space-2);
  max-width: 100%;
}

.automate-give-file-size {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* What the ceiling left behind, said above the ports rather than on one of
   them: it is a fact about the test and not about a particular port. */
.automate-give-cut {
  margin-bottom: var(--space-2);
}

/* The sample chooser under a file box. A second label on the same field,
   drawn smaller than the port's own, because it is the fallback rather than
   the question: an upload beats it. */
.automate-take-sample-label {
  margin-top: var(--space-2);
  font-size: 12px;
  color: var(--text-muted);
  text-transform: none;
}

.automate-take-sample {
  width: 100%;
}

/* What a step takes and gives, side by side: the two halves of the same
   question, and a step with neither is worth seeing as neither. */
.automate-library-ports {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.automate-library-portlist {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.automate-library-portlist li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

/* The sequencing ports are the engine's, not the author's: they carry order
   rather than a value, and they are dimmed here for the same reason the
   canvas draws them hollow. */
.automate-library-portlist li.is-sequence {
  opacity: 0.7;
}

.automate-library-portlist .form-hint {
  flex-basis: 100%;
  margin: 0;
}

.automate-library-note {
  margin: 0 auto 0 0;
}

/* The words a search also finds the step by, under its settings: as quiet
   as the other small labels on the bench, since they explain a search
   rather than ask anything of the reader. */
.automate-library-aliases {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin: var(--space-2) 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.automate-library-aliases-label {
  margin-right: var(--space-1);
}

.automate-library-alias {
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 18px;
  white-space: nowrap;
}

/* Below the desktop the three columns stack in the same order they read in:
   what it takes, what it does, what it gives.

   The only breakpoint the bench has, and it was not: a two-column band at
   1180px with Gives spanning both, and a one-column band at 760px, sat above
   this one and were dead for as long as they existed. Same specificity, and
   this rule is later, so it won at every width either of them matched - the
   bench has always gone straight from three columns to one, whatever the
   stylesheet appeared to say. Nothing looked wrong, because what was drawn was
   a reasonable layout; it was simply not the one the rules above described. */
@media (max-width: 1200px) {
  .automate-library-bench {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A phone has no room for the three side by side, so they stack - and as a
   two-column grid, each group's label and box falling into it, so the three
   boxes start at one x rather than wherever each label happened to end. */
@media (max-width: 600px) {
  .automate-library-search {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: var(--space-2) var(--space-3);
  }

  .automate-library-search .form-group {
    display: contents;
  }

  .automate-library-search-q {
    max-width: none;
  }

  .automate-library-search .form-select {
    width: 100%;
  }
}

/* ============================================================================
   Assess: health-check engagements
   ============================================================================

   Everything here is in theme tokens rather than colours, so the journey
   drawing and its chips follow light and dark mode with the rest of the
   product. The chips are the module's one new visual idea and the rule behind
   them is worth stating: a chip's tone is the finding's STATE at that stage,
   not its impact. Raised here, carried in and still acting, worked around. A
   reader learns three colours once and they mean the same thing in the drawing,
   in the accumulation table, in the register and in the change list. */

/* The tab strip across one engagement.
   
   Links rather than the CSS-radio tabs used elsewhere, because these are five
   URLs and not five panels of one document: a reader who sends somebody "the
   findings" has to be able to send a link to them.

   They must still LOOK like every other tab strip in the product, so .record-tab
   is LISTED ON the shared pill rule above rather than carrying a copy of it.
   Wearing .tab-label inside a .tool-tabs-pills container was tried first and is
   wrong: that whole machinery is radio-and-panel, so the strip would have had to
   register as a tab group with no radios and no panels for a guard to then check
   reveal rules that do not exist.

   This block therefore holds only what the shared rule cannot know: the strip's
   own layout, which is .tab-bar's, and which tab is current, which every group
   declares for itself because the others are :checked selectors naming their own
   ids. The current-tab selector deliberately does not mention .tab-label, so it
   cannot read as a second copy of the skin. */
/* The strip and the page's own actions are one row, the tabs on the left and
   the actions on the right, which is the arrangement the Package Designer
   settled on (.pkgd-tabsbar). Assess had every Save as the last child of its
   form instead: a finding's editor is seven panels long, so the button was a
   scroll away from the field just typed, and on the pages that are a register
   rather than a form the action row sat under the tabs spending a line of its
   own on two buttons. */
/* nowrap, deliberately, and it is the whole trick. Flexbox wraps an item to a
   new line at its BASE size and only shrinks within a line, so a wrapping bar
   put the nine tabs on one line at their natural 1186px and the buttons on
   another - the arrangement this replaced. With the bar held to one line the
   tabs shrink instead (flex-basis 0 below) and the actions keep their width.
   The media query at the foot gives the wrap back where it is right. */
.record-tabsbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

/* The strip YIELDS width to the actions rather than taking what it likes and
   pushing them onto a line of their own. An engagement has nine sections, which
   at 1500px measured 1186px - the whole row - so the tabs wrapped to two lines
   and the buttons landed under both of them, which is the arrangement this
   replaced rather than the one asked for. Shrinking the tabs instead costs a
   line the tabs were going to take anyway and keeps the actions where a reader
   looks for them: top right, level with the first row of tabs. The basis is
   the floor under that: with five strip buttons (Findings) the tabs were
   squeezed to one tab per line at 1366px, so below 520px of room the actions
   drop to a line of their own instead, right-aligned there too. */
.record-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1 1 520px;
  min-width: 0;
}

.record-tabsbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  margin-left: auto;
}

/* On a phone the two stack: nine tabs squeezed into whatever a row of buttons
   leaves is a column one word wide. Same width and same reasoning as
   .tool-header-actions, which drops under the title at the same point. */
@media (max-width: 760px) {
  .record-tabsbar {
    flex-wrap: wrap;
  }

  .record-tabs,
  .record-tabsbar-actions {
    flex-basis: 100%;
  }
}

/* The row's buttons sit beside the tabs, so they share their height - the same
   sizing .pkgd-tabsbar-actions gives its own. */
.record-tabsbar-actions .btn {
  padding: 8px 14px;
  font-size: 13.5px;
}

.record-tab {
  text-decoration: none;
  white-space: nowrap;
}

.record-tab.is-current {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.record-tab-count {
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 9px;
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.record-tab.is-current .record-tab-count {
  background: var(--surface);
  color: var(--accent);
}

/* A finding chip. Small, round and readable at a glance, because a stage card
   holds a dozen of them. */
.assess-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 19px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

a.assess-chip:hover {
  border-color: var(--border-hover);
}

.assess-chip-wide {
  min-width: 0;
  padding: 0 9px;
}

.assess-chip-sample {
  min-width: 22px;
  padding: 0;
}

/* Raised at this stage: the accent, because it is what is new here. */
.assess-chip-raised {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Carried in and still acting: warning, because it is still doing damage. */
.assess-chip-active {
  background: var(--sev-warn-bg);
  border-color: var(--sev-warn-text);
  color: var(--sev-warn-text);
}

/* Worked around, or no longer acting directly. Muted, but still present: a
   workaround hides a finding from the next stage, it does not remove it, and a
   chip that vanished would say the opposite. */
.assess-chip-worked-around {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--text-faint);
}

/* A strength. Green, because it is the one chip that is not a problem, and it
   only ever appears in a process area - never in a chip row along the journey,
   where every other chip means something is still acting. */
.assess-chip-strength {
  background: var(--sev-ok-bg);
  border-color: var(--sev-ok-text);
  color: var(--sev-ok-text);
}

.assess-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.assess-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  font-size: 12px;
}

.assess-legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* A panel of derived content: the journey, the accumulation, a register table.
   It is .form-card without the two things a form wants and a panel does not -
   the 780px cap, which squeezes a seven-stage diagram into a third of the page,
   and overflow: clip, which would cut off the journey frame's own scroll rather
   than letting it scroll. The engagement-level forms (New, Settings, Issue a
   version) still use .form-card, because a column of fields 1400px wide is
   unreadable for the opposite reason; the record editors are panels by
   decision, because each carries something a column cannot - the travel strip,
   a two-column grid of findings, a paper's options side by side. */
.assess-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 0;
  box-sizing: border-box;
}

.assess-panel + .assess-panel,
.assess-panel + .form-card,
.form-card + .assess-panel {
  margin-top: 16px;
}

/* A collapsible panel.

   <details> and <summary>, so the collapse is the browser's own: no script, no
   state to keep, and it works before any of ours has run. A register with seven
   stages and sixty findings is otherwise a page somebody scrolls past rather
   than reads, which is the whole reason this exists.

   The panel stays open by default. Collapsing one is a reader saying "not this
   one now", and a page that opened shut would hide the content from somebody
   who never asked it to.

   An input inside a shut panel is still in the form and still submitted, which
   is what makes the area assessments safe to collapse while editing them.
   TestCollapsingAnAreaDoesNotDropItsEdits is the guard. */
.assess-panel-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  /* Both, because they are two different browsers' markers: list-style clears
     the modern one and the pseudo-element clears WebKit's older triangle. A
     panel showing a native triangle beside the chevron reads as two controls. */
  list-style: none;
}

.assess-panel-summary::-webkit-details-marker {
  display: none;
}

/* The title carries the panel's bottom margin when the panel is a plain div, so
   inside a summary it must not, or a shut panel keeps the gap under a heading
   with nothing below it. */
.assess-panel-summary .form-card-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

/* What the panel holds, so a shut one still says whether it is worth opening.
   "Set up" alone does not. */
.assess-panel-count {
  flex: 0 0 auto;
  padding: 1px 8px;
  border-radius: 9px;
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.assess-panel-chevron {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform 120ms ease;
}

details[open] > .assess-panel-summary .assess-panel-chevron {
  transform: rotate(180deg);
}

/* The first thing under a summary needs the gap the heading used to give it. */
.assess-panel-summary + * {
  margin-top: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .assess-panel-chevron {
    transition: none;
  }
}

/* An action row: the buttons that act on the card above them.

   It is used in twenty-odd templates and had no rule at all, which is the
   failure this stylesheet keeps repeating - a class that looks styled, renders
   plausibly, and is doing nothing. The buttons sat wherever inline-block and
   the whitespace between the tags happened to put them. Left-aligned by
   default, because that is where those twenty-odd rows already were and moving
   every one of them is not what fixing this means; .is-end is the modifier for
   a row that belongs against the right edge of its card. */
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.tool-actions.is-end {
  justify-content: flex-end;
}

/* The journey drawing.

   It is capped to its frame and it wraps, so it always flows DOWN the panel and
   never out of it. Both halves are needed and one without the other was tried:
   a single row at natural size took the last two stages out of view past the
   panel's right edge, and the same row scaled to fit rendered at about 45% of
   natural size, where the stage names and the chip codes are illegible. Wrapping
   at four cards a row is what makes the cap harmless - the drawing is about 950
   units wide, so at desktop width it is already inside the panel and the cap
   never bites.

   The frame keeps overflow-x as a floor rather than as the plan: below about
   600px even a wrapped row is wider than the panel, and scrolling a diagram is
   better than shrinking it past reading. */
.assess-journey {
  display: block;
  max-width: 100%;
  height: auto;
}

.assess-journey-box {
  fill: var(--surface);
  stroke: var(--border);
}

.assess-journey-title {
  fill: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
}

.assess-journey-count {
  fill: var(--text-muted);
  font-family: inherit;
  font-size: 10.5px;
}

.assess-journey-arrow {
  fill: none;
  stroke: var(--border-hover);
  stroke-width: 1.5;
}

/* The connector that drops from the end of one row to the start of the next is
   drawn more lightly: it is the same sequence continuing, not a relationship
   between the cards it passes on the way back. */
.assess-journey-arrow.is-wrap {
  stroke: var(--border);
  stroke-dasharray: 4 3;
}

.assess-journey-arrowhead {
  fill: var(--border-hover);
}

.assess-journey-chip text {
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
}

.assess-journey-chip-raised rect {
  fill: var(--accent-dim);
  stroke: var(--accent);
}

.assess-journey-chip-raised text {
  fill: var(--accent);
}

.assess-journey-chip-active rect {
  fill: var(--sev-warn-bg);
  stroke: var(--sev-warn-text);
}

.assess-journey-chip-active text {
  fill: var(--sev-warn-text);
}

.assess-journey-chip-worked-around rect {
  fill: var(--surface-elevated);
  stroke: var(--border);
}

.assess-journey-chip-worked-around text {
  fill: var(--text-faint);
}

/* The accumulation table. The stage column is fixed so the chip rows line up
   down the page, which is what makes the build-up legible. */
.assess-accumulation .assess-acc-stage {
  width: 180px;
}

.assess-accumulation .assess-acc-count {
  width: 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.assess-register .assess-code-col {
  width: 70px;
}

/* A recommendation's code. Its own tone because a recommendation is not a
   finding: the accent says "this is the thing to do about it", and the chip
   palette's three states all mean something is wrong. */
.assess-chip-rec {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* The recommendation list, shown five times over on the roadmap page. */
.assess-rec-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.assess-rec-list > li {
  padding: 12px 0;
}

.assess-rec-list > li + li {
  border-top: 1px solid var(--border);
}

.assess-rec-list p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.assess-rec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.assess-rec-title {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.assess-rec-title:hover {
  color: var(--accent);
}

/* What it answers sits under the paragraph rather than beside the title: the
   codes are the answer to a different question from the one the title asks. */
.assess-rec-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

/* Only the spacing above the box: the box itself is the shared .danger-zone. */
.assess-danger-zone {
  margin-top: 20px;
}

/* One open question or decision paper. Kept apart from the recommendation list
   by a rule rather than by spacing alone: a paper is several paragraphs and two
   option boxes, so a run of them needs a visible seam. */
.assess-question + .assess-question {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.assess-question > p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* The options of a decision paper, side by side.

   Two columns and not a stack, because that is how a paper is READ - down two
   columns, comparing - and stacked options are compared by scrolling, which is
   to say not compared. Below 720px they stack anyway: two 180px columns are
   not a comparison either. */
.assess-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.assess-option {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

/* The proposed one is marked on the box as well as with a pill. A pill alone is
   one word in a paragraph of them; the border is what a reader sees first. */
.assess-option.is-recommended {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.assess-option-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.assess-option p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.assess-option ul {
  margin: 4px 0 8px;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 13px;
}

.assess-option ul li {
  margin: 2px 0;
}

.assess-option .form-hint {
  display: block;
  margin-top: 6px;
}

/* One option in the editor. A box of its own, because a paper is written one
   option at a time and a run of unseparated fields reads as one long form
   rather than as two choices. */
.assess-option-edit {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.assess-option-edit + .assess-option-edit {
  margin-top: 12px;
}

/* The roadmap and the value-against-effort square. The row header carries the
   axis name, so it is styled like a header rather than like a cell. */
.assess-grid th[scope="row"] {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  /* The shared table head shouts, which is right for a column label and wrong
     for a row's: the workstream names are content, not furniture. */
  text-transform: none;
  letter-spacing: normal;
  font-size: 13px;
}

.assess-grid th .form-hint {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  text-transform: none;
}

.assess-grid td {
  vertical-align: top;
}

/* Every finding, offered as something a recommendation answers. Two columns at
   desktop width, because the question is read down the whole register and a
   single column of twenty-one puts the Save button off the screen. */
.assess-address-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 8px;
}

.assess-address-grid .assess-check {
  align-items: flex-start;
}

.assess-address-grid .assess-check > span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* The brief. A tall monospace box, because what it is for is selecting the
   whole thing, and a proportional font makes a long structured document harder
   to scan for the section somebody wants to check before pasting. */
.assess-brief-box {
  min-height: 420px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  /* Wrapped rather than scrolled sideways. The box is read before it is
     pasted - to check a figure, or that a section is there - and a line that
     runs off the right is a line nobody checks. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The import's paste box and its preview. The box is shorter than the brief's:
   it is pasted into, not read, and a tall empty box pushes the Preview button
   below the fold. The plan is a boxed notice inside the panel rather than a
   panel of its own, because it belongs to the document above it. */
.assess-import-box {
  min-height: 200px;
}

.assess-import-plan {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
}

.assess-import-plan.is-empty {
  border-color: var(--border);
  background: var(--surface-alt);
}

.assess-import-plan .form-card-title {
  margin-bottom: 4px;
}

.assess-import-plan p {
  margin: 4px 0;
}

/* One process area on the assessment page: the findings it holds, the rating,
   and the words that go with it.

   The cards stack inside one form, so the panel-to-panel rule cannot reach the
   first of them - the form is the sibling there, not the card - and the spacing
   is the card's own. It is the same 16px, so the two rules agree wherever both
   apply. */
.assess-area-card {
  margin-top: 16px;
}

.assess-area-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.assess-area-head .form-card-title {
  margin: 0;
  margin-right: auto;
}

/* As a <summary> it is the panel's own head, and .assess-panel-summary + *
   already gives the first thing under it its gap. Both would be 28px. */
.assess-panel-summary.assess-area-head {
  margin-bottom: 0;
}

/* Issues on one side, strengths on the other. Side by side rather than stacked,
   because the pair is the judgement: a column of problems with nothing beside
   it reads as an area with nothing good about it, which is rarely what is
   meant. */
.assess-area-findings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.assess-area-findings .form-hint {
  display: block;
  margin-bottom: 6px;
}

@media (max-width: 720px) {
  .assess-area-findings {
    grid-template-columns: 1fr;
  }
}

/* The template picker on the new-engagement form. */
.assess-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.assess-template {
  display: flex;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  cursor: pointer;
}

.assess-template:hover {
  border-color: var(--border-hover);
}

.assess-template:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.assess-template-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.assess-template-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

.assess-template-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.assess-template-stage {
  padding: 2px 8px;
  border-radius: 9px;
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 11px;
}

/* A file in the library folder that is not a journey template. It is listed
   rather than skipped, so it needs to read as the problem it is: a library
   showing three of the four files in the folder sends somebody looking for a
   bug in the upload instead of at the file they dropped in. */
.assess-template-problem {
  color: var(--sev-prob-text);
}

.assess-area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

/* A tickbox and its words, as one target. The product's other checkbox styling
   lives inside the .fm forms designer and is scoped to it, so this is the
   general shape rather than a second copy of that one. */
.assess-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  cursor: pointer;
  font-size: 13px;
}

.assess-check:hover {
  border-color: var(--border-hover);
}

.assess-check:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
}

.assess-check input {
  flex: none;
  accent-color: var(--accent);
}

.assess-relation-row {
  align-items: end;
}

/* How far a finding travels: a strip along the journey rather than a column of
   settings. It wraps, so a long journey flows down the panel.

   pan-y rather than none, which was written first and is wrong. The gesture here
   is horizontal - painting along the journey - and the page it sits in scrolls
   vertically, so "none" would have claimed the one direction the reader needs
   and left a finger starting on a segment unable to scroll the form at all. This
   claims across and leaves down alone; a browser that takes a touch for a pan
   sends pointercancel and the paint simply ends, which is the right outcome when
   the reader meant to scroll. */
.assess-travel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
  touch-action: pan-y;
}

.assess-travel-seg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
}

button.assess-travel-seg:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

button.assess-travel-seg:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The stage a finding is raised at heads the strip and is not paintable: a
   finding is raised once, and a segment that looked pressable but was not would
   be the first thing anybody tried. */
.assess-travel-seg.is-raised {
  cursor: default;
  border-style: dashed;
  background: transparent;
}

.assess-travel-stage {
  font-size: 12px;
  color: var(--text-muted);
}

/* A chip inside a segment sizes to its words rather than to a code. */
.assess-travel-seg .assess-chip {
  height: auto;
  min-height: 19px;
  padding: 3px 9px;
  white-space: normal;
  text-align: left;
  line-height: 1.35;
}

.assess-axis-table .assess-axis-name {
  min-width: 180px;
}

.assess-axis-table .assess-axis-prefix {
  width: 90px;
}

.assess-change-heading {
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.assess-change-list,
.assess-finding-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assess-change-list li,
.assess-finding-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.assess-finding-list li p {
  flex-basis: 100%;
  margin: 2px 0 0;
  color: var(--text-muted);
}

/* Issue a version: four fields, then the button.

   The fields are a grid and the button is NOT one of its cells. It was, which
   made it a fifth column the width of a field, sitting beside the inputs rather
   than under them - and `align-items: end` then lifted every field whose help
   text made it taller, so the four inputs sat at three different heights. The
   fields stretch to a common height and their labels line up; the action row
   below is the shared .tool-actions, against the right edge of the card. */
.assess-issue-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: start;
}

/* The hint under one field must not push its input out of line with the others,
   so every field is a column of its own and the input sits at the top of it. */
.assess-issue-fields .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.assess-issue-fields .form-hint {
  margin-top: auto;
}

/* The report. One article of sections, and the sections are the unit both print
   profiles are built from. */
.assess-report {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}

.assess-section + .assess-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.assess-title-page h1 {
  margin: 0 0 8px;
}

.assess-lede {
  font-size: 15px;
  color: var(--text-muted);
}

.assess-byline {
  color: var(--text-faint);
  font-size: 13px;
}

.assess-exec {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.assess-exec h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.assess-focus {
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 960px) {
  .assess-issue-fields,
  .assess-exec,
  .assess-template-grid,
  .assess-area-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .assess-report {
    padding: 16px;
  }

  .assess-panel {
    padding: 16px;
  }

  /* The stage column is fixed so the chip rows line up down the page, but at
     180px it takes half a phone and pushes the count - the number the table
     exists to report - off the end of the scrollable wrapper. */
  .assess-accumulation .assess-acc-stage {
    width: 96px;
  }

  .assess-accumulation .assess-acc-count {
    width: 48px;
  }
}

/* Printing the report: A4 portrait, flowing, and nothing else.

   There was a second, landscape profile with a page break between sections,
   meant to replace the deck. A section is however tall its content makes it, so
   the break landed wherever the flow reached and a stage with four findings got
   the same page as one with fourteen. A deck is a design job rather than a
   page-break rule, and the Claude Design brief is what answers that now. */
@media print {
  .topbar,
  .sidebar,
  .record-tabs,
  .tool-header,
  .tool-actions,
  .assess-report-actions {
    display: none !important;
  }

  .assess-report {
    border: 0;
    padding: 0;
    background: transparent;
  }

  .assess-section {
    break-inside: avoid;
  }

  .assess-section + .assess-section {
    border-top: 0;
  }

  .assess-journey-frame {
    overflow: visible;
  }
}

/* Assess: evidence and validation. */

.assess-evidence {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assess-evidence-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-hover);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.assess-evidence-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

/* The sentence the report prints, so it is set as the report sets it rather
   than as a form field's caption. */
.assess-evidence-statement {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

/* A statement naming a value nobody has taken. It is shown rather than hidden,
   because the gap is the point: this is what the report would print. */
.assess-evidence-statement.is-awaiting {
  color: var(--text-muted);
  font-style: italic;
}

.assess-evidence-quote {
  margin: 8px 0;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
}

.assess-evidence-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

/* Taking a measure again is one field and one button, inline. Sending somebody
   to a page to type one number is how a pre-readout sweep stops being done. */
.assess-evidence-take {
  display: flex;
  gap: 6px;
  align-items: center;
}

.assess-evidence-take .form-input {
  width: 150px;
}

/* The Kind choice on the finding and question editors: a fieldset so its
   legend names the radios, drawing nothing of its own. min-width undoes a
   fieldset's min-content width, and the legend is the form label it replaced. */
.assess-kind-fieldset {
  min-width: 0;
  margin-inline: 0;
  padding: 0;
  border: 0;
}

.assess-kind-fieldset > legend {
  padding: 0;
}

.assess-kind-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

@media (max-width: 960px) {
  .assess-kind-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .assess-evidence-take .form-input {
    width: auto;
    flex: 1 1 auto;
  }
}

/* Evidence under a finding in the report. Indented and quieter than the finding
   itself: it is the support, not the claim. */
.assess-report-evidence {
  flex-basis: 100%;
  margin: 6px 0 0;
  padding-left: 16px;
  list-style: none;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.assess-report-evidence .form-hint {
  display: inline;
  margin: 0;
}

/* ── Assess: the assessment library and one engagement's checks ─────────────
   A row of the library editor, and of the check editor that mirrors it. A card
   rather than a bare stack because these lists run long - a topic is a dozen
   controls - and without a boundary the fields of one control read as belonging
   to the one above. */
.assess-topic-row {
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.assess-topic-row:last-of-type {
  margin-bottom: 0;
}

.assess-topic-row .form-group:last-child {
  margin-bottom: 0;
}

/* Two fields that belong together on one line, stacking on a phone. */
.assess-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

@media (max-width: 860px) {
  .assess-two-col {
    grid-template-columns: 1fr;
  }
}

/* The controls a question tests. Wraps rather than scrolls: a topic with eight
   controls is eight short labels, and a row that scrolled sideways would hide
   the ones nobody ticked. */
.assess-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

/* Bringing a topic in: the picker and its button on one line. */
.assess-bring-in {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.assess-bring-in .form-group {
  margin-bottom: 0;
  min-width: 260px;
}

/* An icon inside a hint line, sized to the text beside it rather than to the
   24px an unsized MDI source would stretch to. The class lands on the <svg>
   itself, never on a wrapper - see the mdi-icon rule in the instructions. */
.form-hint-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 2px;
}

/* The controls one finding is raised against, printed under it in the report.
   The codes are what a reader looks up in the Controls section, so they sit on
   one line with the standing at the end of it. */
.assess-report-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: var(--space-2) 0 0;
}

/* The report's Controls table. The columns are named rather than numbered,
   which is the rule the runbook tables already keep: this table drops its
   "Raised against it" column for nothing today, but a column added in front of
   another would silently move a positional rule onto the wrong one. */
.assess-control-table .assess-control-col-code {
  width: 5.5rem;
  white-space: nowrap;
}

.assess-control-table .assess-control-col-state {
  width: 9rem;
}

/* The control's name and what it prevents are the two columns carrying
   sentences, so they take what the four fixed ones leave - the name narrower,
   because it is a title and the other is prose. Declared rather than left off:
   the table is table-layout: auto, so two undeclared columns split the
   remainder evenly and a one-line name sat as wide as a paragraph. */
.assess-control-table .assess-control-col-name {
  width: 22%;
}

.assess-control-table .assess-control-col-what {
  width: auto;
  min-width: 14rem;
}

.assess-control-table .assess-control-col-raised {
  width: 9rem;
}

/* The questions a set holds, listed on the Checks tab rather than only inside
   its editor. A list and not a table: a question is a sentence of its own
   length, and a table of one long column plus three short ones reads as a
   table with a problem. */
.assess-ask-list {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
}

.assess-ask {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.assess-ask:first-child {
  border-top: 0;
}

/* The question is the thing being read, so it leads: larger and heavier than
   the answer field and the note under it. At the body size it sat level with
   its own metadata and a list of ten read as one block of grey. */
.assess-ask-words {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

/* A question already put is quieter than one still outstanding, which is the
   only thing on this list anybody has to act on. Quieter in colour alone: it
   keeps its size and weight, or a list half worked through reads as two
   different kinds of thing. */
.assess-ask.is-asked .assess-ask-words {
  color: var(--text-muted);
}

.assess-ask-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 4px;
}

.assess-ask-meta .form-hint {
  margin: 0;
}

/* The tick and the answer on one line, the answer taking what is left. They
   are answered from this page rather than from inside the set, so they are
   fields rather than text: a question is a tick and a sentence, and opening a
   set to record one was three navigations for two keystrokes. */
.assess-ask-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: 6px;
}

.assess-ask-row .assess-check {
  flex: none;
  margin: 0;
  white-space: nowrap;
}

.assess-ask-input {
  flex: 1 1 auto;
  min-width: 0;
}

.assess-ask-raise {
  flex: none;
  white-space: nowrap;
}

/* On a phone the answer takes its own line: a text box sharing a row with a
   tick and its label has about half a screen left, which is not a sentence. */
@media (max-width: 640px) {
  .assess-ask-row {
    flex-wrap: wrap;
  }

  .assess-ask-input {
    flex-basis: 100%;
  }
}

/* A control's attached findings and the picker that adds one. Its own region
   because a press swaps it alone: the editor around it is a form somebody is
   part-way through, and a redirect would throw away every state and note typed
   since the last Save. */
.assess-control-tag {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.assess-control-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 0;
}

/* The chip and its detach sit together, so it reads as one thing that can be
   taken off rather than as a chip beside an unrelated button. */
.assess-control-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.assess-control-attach {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* The picker takes the room and the button keeps its words: a finding's label
   is its code and its title, which is the longest thing in this region. */
.assess-control-attach .form-select {
  flex: 1 1 260px;
  min-width: 0;
}

.assess-control-attach .btn {
  flex: none;
  white-space: nowrap;
}

/* Settings > Services: the list of addresses a workflow may call. It sits
   under the service cards because it answers the same question about the one
   step that names its own address (#489). The icon class lands on the <svg>
   itself, so it is sized here and never through a descendant selector. */
.outbound-panel { margin-top: 24px; padding: 20px; max-width: 760px; }
.outbound-heading { display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
                    font-size: 16px; }
.outbound-heading-icon { width: 20px; height: 20px; color: var(--text-muted); }
.outbound-state { display: flex; align-items: center; gap: 8px; margin: 0 0 16px;
                  font-size: 13px; color: var(--text-muted); }

/* The Used by dialog's list: one canvas per line, its kind beside it. Each
   name opens its canvas, so it is drawn as the link it is. */
.automate-used-by-list {
  margin: 0;
  padding-left: var(--space-4);
}

.automate-used-by-list a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.automate-used-by-list li + li {
  margin-top: var(--space-2);
}

/* Settings > Storage: a folder's listing, and the dialogs acting on it. The
   locations are a row of links, the breadcrumb and the folder's own actions
   share a row that wraps on a narrow screen, and a name cell grows while the
   size, date and actions keep to their content. The icon class lands on the
   <svg> itself, so it is sized here and never through a descendant selector. */
.storage-roots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.storage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.storage-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.storage-crumb-here {
  color: var(--text);
  font-weight: 600;
}

/* A crumb inside the Move dialog walks the dialog rather than the page, so it
   is a button; it reads as the link the page's own crumbs are. */
.storage-crumb-button {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.storage-crumb-button:hover {
  text-decoration: underline;
}

.storage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.storage-col-name {
  min-width: 220px;
}

.storage-col-size,
.storage-col-modified,
.storage-col-actions {
  white-space: nowrap;
}

/* The actions take what their buttons need and no more, so the name takes
   the rest, and they sit against the right edge so each button lines up down
   the table whether or not its row also offers Download. */
.storage-col-actions {
  width: 1%;
}

/* Through the table's own class, or .data-table th's left alignment wins on
   the heading and the column's words sit over nothing. */
.storage-listing .storage-col-actions {
  text-align: right;
}

.storage-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow-wrap: anywhere;
}

.storage-icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.storage-row-actions {
  display: inline-flex;
  gap: 6px;
}

/* The dialog's form is display: contents so its body and foot are the
   dialog's own flex rows: the head and the buttons stay put while the body
   scrolls, exactly as in a dialog with no form in it. */
.storage-modal-form {
  display: contents;
}

.storage-move-browser {
  display: grid;
  gap: 8px;
}

.storage-move-list {
  max-height: 320px;
}

/* On a phone a row is a card: the name across the top, its size and date
   under it, and the actions below those, wrapping as they need to. As a table
   the actions sat past the right edge of its scroll box, so the one thing a
   row is for was the part nobody could see. */
@media (max-width: 760px) {
  .storage-listing thead {
    display: none;
  }

  .storage-listing tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
  }

  .storage-listing tr:last-child {
    border-bottom: none;
  }

  .storage-listing td {
    display: block;
    padding: 0;
    border-bottom: none;
  }

  .storage-listing .storage-col-name,
  .storage-listing .storage-col-actions {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .storage-listing .storage-col-size,
  .storage-listing .storage-col-modified {
    color: var(--text-muted);
    font-size: 12px;
    text-align: left;
  }

  .storage-listing .storage-col-size:empty {
    display: none;
  }

  .storage-listing .storage-col-actions {
    width: auto;
    padding-top: 4px;
    text-align: left;
    white-space: normal;
  }

  .storage-row-actions {
    flex-wrap: wrap;
  }
}

/* Comply > Process map: the process tree beside the chosen process. The tree
   scrolls in a box of its own and every control answers the page by morph, so
   choosing a process deep in the tree leaves the tree where it was. */
.process-map-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.process-map-tree {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 160px);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.process-map-root,
.process-map-children {
  list-style: none;
  margin: 0;
  padding: 0;
}
.process-map-children { padding-left: 14px; }
/* The arrow is drawn beside the link rather than as the summary's marker. A
   marker is a box of its own on the line, so a link deep in the tree that
   could not fit beside it dropped to the next line and left the arrow alone
   above its words. Beside the link, the words wrap and the arrow stays on the
   first line with them, at a width the leaves are indented by. */
.process-map-summary {
  display: flex;
  align-items: baseline;
  gap: 2px;
  cursor: pointer;
  list-style: none;
}
.process-map-summary::-webkit-details-marker { display: none; }
.process-map-summary::before {
  content: "\25B8"; /* right-pointing triangle */
  flex: none;
  width: 12px;
  text-align: center;
  color: var(--text-faint);
  font-size: 11px;
  transition: transform 120ms ease;
}
details[open] > .process-map-summary::before { transform: rotate(90deg); }
.process-map-summary > .process-map-link { flex: 0 1 auto; min-width: 0; }
.process-map-leaf { padding-left: 14px; }
.process-map-link {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.process-map-link:hover { background: var(--surface-hover); }
.process-map-link.is-selected {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}
.process-map-seq {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.process-map-title { min-width: 0; }
.process-map-count {
  flex: none;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--sev-info-bg);
  color: var(--sev-info-text);
}
/* A process's Microsoft references, at the foot of its description: a link
   in the accent each, its host and where it came from beside it. */
.process-map-references { margin-top: 12px; }
.process-map-reference-list {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}
.process-map-reference-list li + li { margin-top: 2px; }
.process-map-reference-list a {
  color: var(--accent);
  font-weight: 600;
}
.process-map-reference-list a:hover { text-decoration: underline; }
.process-map-reference-list .form-hint-inline a { font-weight: 400; }
.process-map-tree-title {
  margin: 12px 6px 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.process-map-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.process-map-path {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.process-map-process-title {
  margin: 0 0 4px;
  font-size: 18px;
}
/* A process's description as the catalog release wrote it: Markdown drawn
   across the whole card (internal/markdown), or, for a release imported before
   descriptions kept their layout, its lines as they were kept. */
.process-map-description { margin: 12px 0 4px; }
.process-map-description.is-lines { white-space: pre-line; }
.process-map-activity-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.process-map-activity-head .form-card-title { margin: 0; }
/* Text drawn from Markdown by internal/markdown, which writes only these
   elements. Its paragraphs fill the width they are given, its headings sit a
   step above its text and below the page's own, and its lists are indented
   one inside another. */
.md-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: anywhere;
}
.md-text > :first-child { margin-top: 0; }
.md-text > :last-child { margin-bottom: 0; }
.md-text p { margin: 0 0 10px; }
.md-text h1, .md-text h2, .md-text h3, .md-text h4, .md-text h5, .md-text h6 {
  margin: 18px 0 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}
.md-text h1, .md-text h2, .md-text h3 { font-size: 15px; }
.md-text ul, .md-text ol { margin: 0 0 10px; padding-left: 22px; }
.md-text li { margin: 2px 0; }
.md-text li > ul, .md-text li > ol { margin: 4px 0 6px; }
.md-text li > p { margin: 0 0 6px; }
.md-text hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.md-text blockquote {
  margin: 0 0 10px;
  padding-left: 12px;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}
.md-text code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
}
.md-text pre {
  margin: 0 0 10px;
  padding: 10px 12px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
}
.md-text pre code { padding: 0; background: none; }
.md-text a { color: var(--accent); }
/* A run of proposals on the Process map: Cancel or Dismiss at the end of its
   heading, a bar of how far through its activities it is, which the sentence
   under it counts out, and what failed as a list. */
.pm-run-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 8px;
}
.pm-run-bar {
  height: 8px;
  margin: 12px 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-elevated);
  overflow: hidden;
}
.pm-run-fill {
  display: block;
  height: 100%;
  width: var(--pm-run-done, 0%);
  background: var(--accent);
  transition: width 0.4s ease;
}
.pm-run-failures {
  margin: 0;
  padding-left: 20px;
}
.process-map-note { margin: 8px 0; }
/* Comply > Conflict rules: a rule's Change and Switch off at the end of its
   heading, and the rule dialog, which shows the fields of the kind of rule
   chosen - the processes of a rule between two, or the processes where a
   rule of any one process does not hold - and lists what a search offers in
   a box of its own. */
.conflict-rule-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.conflict-rule-kind {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.conflict-rule-kind legend { margin-bottom: 4px; }
.conflict-rule-form:has(#conflict-rule-same:checked) [data-kind-between],
.conflict-rule-form:has(#conflict-rule-between:checked) [data-kind-same] { display: none; }
.conflict-rule-form [data-kind-between] { margin-top: 8px; }
.conflict-rule-picks {
  max-height: 180px;
  overflow: auto;
  margin-top: 6px;
}
/* What a process's scenarios add to its own entry, set off from it by a
   rule, since it is theirs and cannot be changed here. */
.process-map-rollup {
  margin-top: 14px;
  padding-top: 2px;
  border-top: 1px solid var(--border);
}
/* The scenarios a rolled-up grant comes from, one to a line, since a
   scenario's title is often a sentence long. */
.process-map-from { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.process-map-from-label { display: block; margin-bottom: 2px; }
.process-map-from ul { margin: 0; padding-left: 16px; }
.process-map-from li { margin: 2px 0; }
.process-map-from a { color: var(--accent); }
.process-map-grants {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.process-map-grant {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.process-map-choice { margin-top: 6px; }
.process-map-grant-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}
.process-map-kind {
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--text-muted);
}
.process-map-privilege-list,
.process-map-role-list,
.process-map-objects {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13px;
}
.process-map-privileges,
.process-map-roles,
.process-map-evidence { margin-top: 6px; }
.process-map-privileges > summary,
.process-map-roles > summary,
.process-map-evidence > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}
/* The review: a disclosure under each entry holding its forms, and the small
   form beside each grant and need that takes one away. */
.process-map-review {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.process-map-review > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.process-map-review-form { margin-top: 8px; }
.process-map-review-form .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
/* Add a grant and Add a need: a field each for what they ask, its label over
   its control so the two read as one, each as wide as what it holds rather
   than a sixth of the row (the explorer grid gave every field a 120px label
   column and an equal share, so the last wrapped onto a row of its own as
   wide as the page). The name takes the room there is, since it is the one
   somebody types words into; an object's type and access are drawn only once
   Kind says object, because on a duty they are two controls that mean
   nothing. */
.process-map-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: end;
}
.process-map-field {
  display: grid;
  gap: 3px;
  flex: 0 1 auto;
  min-width: 0;
}
.process-map-field > .form-label {
  margin-bottom: 0;
  white-space: nowrap;
}
.process-map-field .form-select,
.process-map-field .form-input {
  width: auto;
  min-width: 0;
}
.process-map-field-name { flex: 1 1 280px; }
.process-map-field-case { flex: 1 1 200px; }
.process-map-field-name .form-input,
.process-map-field-case .form-input { width: 100%; }
.process-map-object-only { display: none; }
.process-map-grant-form:has(select[name="grantKind"] > option[value="object"]:checked) .process-map-object-only { display: grid; }
/* The matches a typed name could have meant, each a press that names it. */
.process-map-matches { margin-top: 8px; }
.process-map-match-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.process-map-match code { font-size: 12px; }
.process-map-inline {
  display: inline-flex;
  margin-left: auto;
}
@media (max-width: 960px) {
  .process-map-layout { grid-template-columns: minmax(0, 1fr); }
  .process-map-tree {
    position: static;
    max-height: 50vh;
  }
}

/* Comply > Process security > Coverage: a share as a number over a bar of
   approved, reviewed and proposed, the three in the status pills' own
   colours so the bar reads as the pills do on the Process map. The long lists
   are disclosures, shut until the reader opens the one they want. */
.data-table.coverage-table td { vertical-align: top; }
.coverage-share {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 120px;
}
.coverage-share-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.coverage-bar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-alt);
  overflow: hidden;
}
.coverage-bar-approved { background: var(--sev-ok-text); }
.coverage-bar-reviewed { background: var(--sev-info-text); }
.coverage-bar-proposed { background: var(--text-faint); }
.coverage-kind {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.coverage-kind > summary,
.coverage-group > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.coverage-group {
  margin: 6px 0 0 14px;
}
.coverage-group > summary { font-weight: 500; }
/* The Coverage page's quick add, in a column of the duties not mapped yet:
   the process box, the activity and the button on one line, the box taking
   what the other two leave, so a row stays a row. */
.coverage-map-col { min-width: 420px; }
.coverage-map-form { display: flex; align-items: center; gap: 6px; }
.coverage-map-form .autocomplete { flex: 1 1 200px; min-width: 0; }
.coverage-map-form .form-select { flex: 0 0 auto; width: auto; }
.coverage-note {
  max-width: 48ch;
  font-size: 13px;
  color: var(--text-muted);
}

/* Comply > Process security > Catalog releases: an entry of a process the
   newer release does not have, as its activity beside its status pill, a row
   of them to a process. The changes that need nothing reuse Coverage's
   disclosures. */
.releases-entry {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 10px 4px 0;
  white-space: nowrap;
}

/* Comply > Process security > Security drift: each grant the map has that the
   update took away, as a grant reads on the Process map, with what opens the
   same menu items now beneath it. */
.drift-gone { padding: 10px 0; }
.drift-gone + .drift-gone { border-top: 1px solid var(--border); }

/* Comply > Role designs: one customer's engagement in five tabs, whose
   :checked rules are in the page's own style block, beside the radios they
   name. */
/* The About tab's settings, disabled whole for a reader who may not change
   the design. It draws no box of its own: the disabled controls are the
   whole of what it says. */
.design-locked {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
/* A group of tick boxes under one legend: a fieldset carries a border, a
   padding and a min-content width of its own, none of which a form card
   wants. */
.design-fieldset {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}
.design-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* A process's suggested catalog processes, each under the process it
   belongs to: the process on its own line and its scenarios indented under
   it, joined by a rule, so a process ticked with three of its scenarios reads
   as one process rather than four unrelated lines. */
.design-search-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.design-search-group {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.design-search-item,
.design-search-head {
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  color: var(--text);
}
.design-search-head { display: flex; flex-wrap: wrap; }
.design-search-children {
  margin: 2px 0 0 7px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}
/* A catalog level as a coloured tag, a colour per level. */
.design-level-tag {
  flex: none;
  min-width: 82px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
}
.design-level-tag[data-level="1"] {
  color: var(--sev-prob-text, var(--text));
  border-color: var(--sev-prob-border, var(--border));
  background: var(--sev-prob-bg, var(--surface));
}
.design-level-tag[data-level="2"] {
  color: var(--sev-warn-text, var(--text));
  border-color: var(--sev-warn-border, var(--border));
  background: var(--sev-warn-bg, var(--surface));
}
.design-level-tag[data-level="3"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-dim);
}
.design-level-tag[data-level="4"] {
  color: var(--sev-info-text, var(--text));
  border-color: var(--sev-info-border, var(--border));
  background: var(--sev-info-bg, var(--surface));
}
/* A department's or a process's name heading the rows grouped under it. */
.data-table th.design-rowgroup {
  vertical-align: top;
  text-align: left;
  font-size: 13px;
  letter-spacing: normal;
  font-weight: 600;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
/* Comply > Role designs: the list and its Templates tab, one panel each. */
#designs-tab-designs:checked   ~ #designs-panel-designs,
#designs-tab-templates:checked ~ #designs-panel-templates {
  display: block;
}
#designs-tab-designs:checked   ~ .tool-tabs-header .tab-bar label[for="designs-tab-designs"],
#designs-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="designs-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
/* Comply > Process security > Industry profiles: the list and its Templates
   tab, one panel each; and a profile's scope, each process area set in under
   its end-to-end process with its two ticks in narrow centred columns. */
#profiles-tab-profiles:checked  ~ #profiles-panel-profiles,
#profiles-tab-templates:checked ~ #profiles-panel-templates {
  display: block;
}
#profiles-tab-profiles:checked  ~ .tool-tabs-header .tab-bar label[for="profiles-tab-profiles"],
#profiles-tab-templates:checked ~ .tool-tabs-header .tab-bar label[for="profiles-tab-templates"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.profile-tick-col {
  width: 96px;
  text-align: center;
}
.profile-area-name {
  display: inline-block;
  padding-left: 24px;
}
.profile-uses {
  margin: 0 0 12px;
  padding-left: 20px;
}
.profile-delete {
  margin-top: 8px;
}
/* Comply > Process security > Conflict rules: a rule between two processes
   draws each side in a column of its own with its duties under its heading,
   and the standard roles already holding both sides as a list, all three
   behind a disclosure whose summary carries the counts. */
.conflict-rule-detail {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.conflict-rule-detail > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.conflict-rule-detail[open] > summary { margin-bottom: 8px; }
.conflict-sides {
  margin-bottom: 8px;
}
.conflict-side > div {
  margin: 2px 0;
}
.conflict-holding {
  margin: 4px 0 0;
  padding-left: 20px;
}
/* Step-at-a-time wizards (cmd/website/wizard.go): the New role design
   dialog and the New analysis page, which look alike: a card holding the
   chips, the step it is at, the step's question and a foot. A question is a set of answers drawn as
   cards, what each means beneath its name, and what an answer needs set in
   under it (.wizard-more). Where the server draws the question again on a
   change, it hides what an answer does not need with [hidden], which the
   sheet's own [hidden] rule keeps above a display; where every answer's
   controls are drawn at once, a .wizard-branch holds a card and its controls
   together and shows the controls only while the card is chosen, which asks
   nothing of the server. The last step reads every answer back as a list. */
.wizard-body {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}
.wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
/* The step the wizard is at, said under its chips. */
.wizard-at {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
/* Cancel, Back and the step's own button, under the step, together at the
   bottom right of every wizard - always in that order, so Next, Create or
   Run is in the same place on every screen and Cancel is beside it rather
   than across the page. A spacer left in a foot is spent. */
.wizard-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.wizard-foot > .modal-spacer { display: none; }
.wizard-choice {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}
.wizard-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.wizard-option:hover { border-color: var(--border-hover); }
.wizard-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.wizard-option:has(input:disabled) {
  opacity: 0.6;
  cursor: not-allowed;
}
.wizard-option > input {
  flex: none;
  margin-top: 3px;
}
.wizard-option > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wizard-more {
  display: grid;
  gap: 6px;
  margin: -2px 0 4px 34px;
}
.wizard-branch {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.wizard-branch > .wizard-more { display: none; }
.wizard-branch:has(> .wizard-option input:checked) > .wizard-more { display: grid; }
.wizard-review {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 18px;
  margin: 0;
}
.wizard-review > dt {
  font-weight: 600;
  color: var(--text-muted);
}
.wizard-review > dd { margin: 0; }
@media (max-width: 640px) {
  .wizard-review { grid-template-columns: minmax(0, 1fr); }
  .wizard-more { margin-left: 0; }
  /* The foot's buttons do not fit one line: Back and Cancel share one and
     the step's own button takes the next to itself. */
  .wizard-foot > .modal-spacer { display: none; }
  .wizard-foot > .btn { flex: 1 1 auto; justify-content: center; }
  .wizard-foot > .btn-primary { flex-basis: 100%; }
}
/* A wizard's modal is drawn as a page is - the page's own ground, a header,
   and the wizard in a card under it - three quarters of the window's width,
   centred over the page, the questions centred in it. Its buttons never
   move: the card fills the modal's height whatever the step asks, the step's
   question scrolls inside it when it is long, and the foot is pinned to the
   card's bottom with Back at its left and the step's own button at its
   right, so the pointer finds Next in one place on every screen. Cancel is
   the X at the right of the page's header, level with its title, rather
   than on the corner of the frame round it. */
dialog.modal.modal-full {
  width: min(75vw, 1280px);
  min-width: min(calc(100vw - 32px), 760px);
  height: calc(100vh - 48px);
  background: var(--bg);
}
/* A held-back record opened full screen takes nearly the whole window,
   since a record with a hundred columns is why it was opened, and its body
   scrolls between a head and a foot that stay put. */
dialog.modal.modal-full.target-record-modal {
  width: min(calc(100vw - 32px), 1600px);
}
dialog.modal.modal-full.target-record-modal[open] {
  display: flex;
  flex-direction: column;
}
dialog.modal.target-record-modal > .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.target-record-modal-body { width: 100%; }
.target-record-modal-body .workbench-unit { max-width: none; }
/* The modal holds one target, so its card says how it stands above the record
   rather than beside it, and the record takes the window's whole width and
   whatever height is left under the card. Beside it, as a page of several
   targets draws them, the card took a quarter of the width from a table that
   is the reason the modal was opened, and the record ended halfway down an
   otherwise empty window. */
dialog.modal.target-record-modal > .modal-body {
  display: flex;
  flex-direction: column;
}
.target-record-modal-body {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}
.target-record-modal-body .workbench-unit {
  flex: 1 0 auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "card" "record";
}
.target-record-modal-body .workbench-target-meter {
  max-width: 320px;
}
/* A header holding a dialog's close (tool-header's CloseID) keeps it at its
   right, level with the title, out of the centred title's way. */
.tool-header:has(> .tool-header-close) {
  position: relative;
  padding-right: 64px;
}
.tool-header-close {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
}
.wizard-page {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 24px 28px 24px;
}
.wizard-page > .page-header { text-align: center; }
.wizard-page > .page-header .tool-header-main { justify-content: center; }
.wizard-page > .form-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.wizard-page > .form-card > .wizard-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.wizard-page .wizard-steps { justify-content: center; }
.wizard-page .wizard-at { text-align: center; }
.wizard-content {
  display: grid;
  flex: 1;
  align-content: start;
  gap: var(--space-3);
  min-height: 0;
  overflow-y: auto;
  padding: 2px;
}
.wizard-page .wizard-content :is(.wizard-choice > legend, .wizard-load-title) { width: 100%; text-align: center; }
.wizard-page .wizard-content > section > .form-hint,
.wizard-page .wizard-content > section > p {
  max-width: 760px;
  margin-inline: auto;
  text-align: center;
}
.wizard-page .wizard-choice { justify-content: center; }
/* A question's own field - a drop-down, a number, a box to type in - sits
   centred under it as its answer cards do: the label centred over the
   control, the control no wider than a field needs and centred too, and a
   narrow one (a count, a currency) kept narrow. A pair of fields side by side
   is centred as a pair. */
.wizard-page .wizard-content :is(section, .wizard-load) > .form-label,
.wizard-page .wizard-content :is(section, .wizard-load) > .form-row .form-label {
  text-align: center;
}
.wizard-page .wizard-content :is(section, .wizard-load) > :is(.form-input, .form-select) {
  width: min(100%, 480px);
  margin-inline: auto;
}
.wizard-page .wizard-content :is(section, .wizard-load) > .form-row {
  width: min(100%, 760px);
  margin-inline: auto;
}
.wizard-foot.is-split {
  justify-content: flex-end;
  margin-top: auto;
}
.wizard-foot.is-split > .wizard-back {
  order: -1;
  margin-right: auto;
}
:is(.wizard-page, .wizard-roomy) .wizard-choice {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
/* In a wizard, a question's answers are a row of cards no wider than they
   need, centred under the question rather than stretched across the card. */
.wizard-page .wizard-choice { grid-template-columns: repeat(auto-fit, minmax(260px, 360px)); }
:is(.wizard-page, .wizard-roomy) .wizard-choice > legend {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 600;
}
/* What an answer needs opens under every answer rather than after its own
   card: in a grid of cards side by side, controls after the middle card
   took a row of their own between the cards and pushed the next one down. */
:is(.wizard-page, .wizard-roomy) .wizard-choice > .wizard-more {
  grid-column: 1 / -1;
  order: 1;
  margin: 4px 0 0;
}
/* A box under an answer is as wide as what it holds needs, not the window. */
:is(.wizard-page, .wizard-roomy) .wizard-more > .form-select,
:is(.wizard-page, .wizard-roomy) .wizard-more > .form-input { max-width: 560px; }
:is(.wizard-page, .wizard-roomy) .wizard-option {
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
}
:is(.wizard-page, .wizard-roomy) .wizard-option > input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
:is(.wizard-page, .wizard-roomy) .wizard-option strong { font-size: 15px; }
:is(.wizard-page, .wizard-roomy) .wizard-option .form-hint { font-size: 13px; }
/* An answer's icon, beside its name. */
.wizard-option-icon {
  width: 26px;
  height: 26px;
  margin-bottom: 4px;
  color: var(--accent);
}

/* Compare > Compare Wizard (templates/compare/wizard.html): the wizard drawn
   as a page of the shell rather than in a modal, its header and its card the
   page's width. Its answers are cards pressed like the tabs they stand in
   for, so a card's radio is out of sight - still focused, still what posts -
   and the card chosen is said by its outline and ground alone. */
.cmpw-page {
  min-height: 100%;
  box-sizing: border-box;
}
.cmpw-page .wizard-option {
  position: relative;
}
.cmpw-page .wizard-option > input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.cmpw-page .wizard-option:has(input:checked) {
  box-shadow: 0 0 0 1px var(--accent);
}
.cmpw-page .wizard-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* The environment selects sit under the two answer cards and take their
   widths: a column per card, the cards' own gap between them. */
.cmpw-page .form-row.cmpw-pair {
  grid-template-columns: repeat(2, minmax(0, 360px));
  gap: 12px;
  justify-content: center;
  margin-top: 4px;
}
.cmpw-page .cmpw-pair .form-select {
  width: 100%;
}
.cmpw-single {
  width: min(100%, 360px);
  margin: 4px auto 0;
}
/* An environment's label, select, badges and words, packed at the top of
   its column: the two columns of a pair are one height, and a column with
   no environment chosen was stretched to the height of one with, which
   spread its rows - its select drawn taller and lower than its neighbour's,
   and jumping into place when an environment was chosen. */
.cmpw-env {
  display: grid;
  align-content: start;
  gap: 4px;
}
.cmpw-caps {
  margin-top: 6px;
}
/* The badge row keeps its place before an environment is chosen. */
.cmpw-caps.is-empty {
  visibility: hidden;
}
/* What a data or forms card would read by. */
.cmpw-route {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
/* The answers so far, above each step's question. */
.cmpw-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 4px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  font-size: 13px;
  color: var(--text-muted);
  box-sizing: border-box;
}
.cmpw-summary-ic {
  width: 18px;
  height: 18px;
  color: var(--accent);
}
/* A note under the two answer cards spans exactly the two of them. */
.cmpw-under-cards {
  width: min(100%, 732px);
  margin-inline: auto;
  box-sizing: border-box;
}
.cmpw-centre {
  max-width: 760px;
  margin: 10px auto 0;
  text-align: center;
}
.cmpw-flat {
  margin-bottom: 0;
}
.pkgd-kindrow.cmp-method-cards.cmpw-methods {
  width: 100%;
  max-width: 900px;
  margin: 0 auto 4px;
}
/* What the chosen method asks for is one field, kept to a field's width. */
.cmpw-detail {
  width: min(100%, 420px);
  margin-inline: auto;
  box-sizing: border-box;
}
.cmpw-why {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-top: 4px;
  color: var(--sev-warn-text);
}
.cmpw-why-ic {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 1px;
}
.cmpw-items {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 860px;
  margin-inline: auto;
}
.cmpw-review {
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}
.cmpw-options {
  margin-top: 10px;
}
/* The options' fields - the refresh route and the package's name - are one
   width, as wide as the longest route and no wider: drawn the step's width
   they read as boxes to type a paragraph into, and side by side at two
   widths they did not read as one column of fields. */
.cmpw-fit {
  width: min(100%, 520px);
}
/* A page that loads something: what it loads, how to get it, and the one
   button that loads it. */
.wizard-load {
  display: grid;
  gap: 8px;
  max-width: 760px;
}
.wizard-load-title {
  margin: 0 0 4px;
  font-size: 16px;
}
.wizard-howto {
  margin: 0 0 6px;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 13px;
}
.wizard-howto > li { margin: 2px 0; }
/* A page drawn as the wizards are, every question on the one page: the
   questions spaced as a wizard's steps, and the same large answer cards. */
.wizard-roomy {
  display: grid;
  gap: var(--space-4);
}
/* New scenario: each question numbered as a wizard's chips are, and the
   design file's box shown only while its answer is chosen. */
.scenario-new-question {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.scenario-new-question > .form-hint { margin: 0; }
.scenario-new-n {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  vertical-align: 1px;
}
.wizard-choice:has(#scenario-new-start-design:not(:checked)) > #scenario-new-design-more { display: none; }
/* The step's question, which draws itself again on a change inside it. */
.design-new-step { min-width: 0; }
/* The Excel files loader reads as a wizard: uploading is put away once the
   workbooks are staged and the mapping form is on the page, so what is on
   screen is the next step; Discard empties the workspace and brings it back. */
.comply-sheets-loader:has(#comply-sheets-mapping) > .comply-sheets-upload-card { display: none; }
.comply-sheets-why { margin: 4px 0 8px; }
.comply-sheets-why > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
}
/* What a sheet holds is an answer card to tick; the columns it asks for open
   under it while it is ticked. */
.comply-sheets-binding { margin: 8px 0; }
.comply-sheets-binding > summary { list-style: none; }
.comply-sheets-binding > summary::-webkit-details-marker { display: none; }
.comply-sheets-binding > summary > .wizard-option { padding: 12px 14px; }
.design-wizard-e2e {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  max-height: min(52vh, 520px);
  overflow: auto;
  padding: 2px;
}
/* An end-to-end process to tick is a small card of its own, so a list of
   twenty reads as a set of choices rather than a column of small print. */
.design-wizard-e2e-pick {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.design-wizard-e2e-pick:hover { border-color: var(--border-hover); }
.design-wizard-e2e-pick:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.design-wizard-e2e-pick > input {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--accent);
}
.design-wizard-e2e-pick .form-hint { display: block; margin: 2px 0 0; }
.design-wizard-e2e-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.design-wizard-e2e-head > .form-hint { margin: 0 6px 0 0; }
@media (max-width: 620px) {
  dialog.modal.modal-full { width: 100vw; height: 100%; }
  .wizard-page { padding: 16px; }
  :is(.wizard-page, .wizard-roomy) .wizard-choice { grid-template-columns: minmax(0, 1fr); }
}
/* The Import data page: below each tab's workbook and how it works, the
   page's width for where the sheet keeps each part and what it reads as. A
   taxonomy's rows are drawn as its tree, each indented by how deep it is
   (--design-tree-depth, which has no ceiling), a grouping's words bold. */
.design-import-mapping {
  margin-top: 20px;
  min-height: 0;
}
.design-tree-name {
  display: inline-block;
  padding-left: calc(var(--design-tree-depth, 0) * 20px);
}
.design-tree-grouping .design-tree-name {
  font-weight: 600;
}
/* The four activities' colours, as the role design's key draws them: doing
   in the accent, approving amber, viewing blue and setting up purple, each a
   lightness apart as well as a hue. A tick and a key's chip read --activity
   off their data-activity. */
:root {
  --activity-perform:   var(--accent);
  --activity-approve:   #e8a820;
  --activity-view:      #70aadf;
  --activity-configure: #a58be6;
}
html[data-theme="light"] {
  --activity-approve:   #8c6000;
  --activity-view:      #2258a8;
  --activity-configure: #6f52c9;
}
.design-tick[data-activity="perform"],
.design-chip[data-activity="perform"] { --activity: var(--activity-perform); }
.design-tick[data-activity="approve"],
.design-chip[data-activity="approve"] { --activity: var(--activity-approve); }
.design-tick[data-activity="view"],
.design-chip[data-activity="view"] { --activity: var(--activity-view); }
.design-tick[data-activity="configure"],
.design-chip[data-activity="configure"] { --activity: var(--activity-configure); }
/* Who does what: the counts over the grid and its key, then the grid beside
   the cell it explains. The grid scrolls sideways in its own wrapper with the
   process names held at its left edge, since a workshop's matrix is wider
   than any screen and a row of ticks with no name beside it is a row nobody
   can read. */
.design-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.design-tile {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-muted);
}
.design-tile b {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.design-tile.is-warning { border-color: var(--sev-warn-border); }
.design-tile.is-warning b { color: var(--sev-warn-text); }
.design-tile.is-problem { border-color: var(--sev-prob-border); }
.design-tile.is-problem b { color: var(--sev-prob-text); }
.design-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.design-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.design-chip {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border: 1.5px solid var(--activity);
  border-radius: 5px;
  background: color-mix(in srgb, var(--activity) 16%, transparent);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--activity);
}
.design-chip[data-unanswered] {
  border-style: dashed;
  background: transparent;
}
.design-conflict-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
.design-matrix-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 16px;
  align-items: start;
}
.data-table.design-matrix {
  width: auto;
  min-width: 100%;
}
.data-table.design-matrix th,
.data-table.design-matrix td {
  padding: 4px 6px;
}
/* The processes' column is one width all the way down, its names in the
   customer's own words and case and wrapped, with the catalog processes each
   stands for under it, since a name spilling over the ticks beside it hides
   the very cells it names. */
/* It is stacked above everything a cell draws (the explaining button and a
   conflict's mark are raised within their cell), or they slide over it as
   the grid scrolls sideways; the header row is stacked above it in turn. */
.data-table.design-matrix th.design-matrix-corner,
.data-table.design-matrix th.design-matrix-process {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 248px;
  min-width: 248px;
  max-width: 248px;
  padding: 8px 12px;
  text-align: left;
  border-right: 1px solid var(--border);
}
.data-table.design-matrix th.design-matrix-process {
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
  border-bottom: 1px solid var(--border);
}
.design-matrix-words {
  display: block;
  line-height: 1.3;
}
.design-matrix-seqs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.design-matrix-seq {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-elevated);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-muted);
}
/* A process pointing at no catalog process says so where its IDs would be,
   a line rather than a pill, so its row is no taller than its box of ticks. */
.design-matrix-unmapped {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sev-warn-text);
}
.data-table.design-matrix th.design-matrix-label { vertical-align: bottom; }
.data-table.design-matrix th.design-matrix-hint {
  vertical-align: bottom;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  color: var(--text-muted);
}
/* A department's name is cut to the columns of its roles rather than
   widening them: the span inside the heading asks for no width of its own. */
.data-table.design-matrix th.design-matrix-department {
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.design-matrix-clip {
  display: block;
  width: 0;
  min-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* A role's column is as narrow as its box of ticks, its title wrapped at the
   top left of its heading with the button that lists its job titles beside
   it, and the title leads to its suggestions. It widens to its longest word
   rather than breaking one, since "Manageme nt" reads as two words. */
.data-table.design-matrix th.design-matrix-role {
  width: 78px;
  min-width: 78px;
  padding: 6px 7px 8px;
  vertical-align: top;
  text-align: left;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
  border-left: 1px solid var(--border);
}
.design-matrix-role-head {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.design-matrix-role-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}
.btn.design-explain.design-role-info {
  position: static;
  flex: none;
  transform: none;
}
.design-matrix-role-link:hover .design-matrix-role-title { color: var(--accent); }
.design-matrix-role-title {
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}
.design-matrix-area > th {
  padding: 10px 12px 6px;
  background: var(--surface-alt);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
}
/* The area's name stays in sight as the grid scrolls sideways under it. */
.design-matrix-area-name {
  position: sticky;
  left: 12px;
}
/* A cell is its four ticks filling it, doing and approving over viewing and
   setting up, each a rounded square in its activity's colour, with the button
   that explains the cell where the four meet and a conflict's mark on that
   button. Off, a tick is its activity's outline, faint; on, the outline whole
   and the square filled; on but dashed where the map gives the process
   nothing for the activity yet, so the tick asks for nothing. The squares grow
   with the column up to a size a pointer finds at once, so a cell is all
   ticks rather than a small box in a wide one, without a grid of two roles
   drawing squares the size of the page; condensed rows draw them small. */
.data-table.design-matrix td.design-matrix-cell {
  padding: 5px;
  text-align: center;
  vertical-align: middle;
  border-left: 1px solid var(--border);
}
.design-grid { --tick: 26px; }
.design-ticks {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, var(--tick));
  justify-content: center;
  gap: 3px;
}
.btn.design-tick {
  justify-content: center;
  width: var(--tick);
  min-width: var(--tick);
  height: var(--tick);
  padding: 0;
  border: 2px solid color-mix(in srgb, var(--activity) 28%, var(--border));
  border-radius: 7px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: color-mix(in srgb, var(--activity) 40%, var(--text-faint));
}
.btn.design-tick:hover:not(:disabled) {
  border-color: var(--activity);
  color: var(--activity);
}
.btn.design-tick.is-on {
  border-color: var(--activity);
  background: color-mix(in srgb, var(--activity) 18%, transparent);
  color: var(--activity);
}
.btn.design-tick.is-on[data-unanswered] {
  border-style: dashed;
  background: transparent;
}
.btn.design-explain {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  justify-content: center;
  width: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--border-hover);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
}
.btn.design-explain:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.design-explain-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
}
/* The mark of a conflict sits on the explaining button's shoulder, ringed in
   the cell's own ground so it reads over the squares beneath it. */
.design-ticks .design-conflict-dot {
  position: absolute;
  left: calc(50% + 4px);
  top: calc(50% - 12px);
  z-index: 2;
  box-shadow: 0 0 0 1.5px var(--surface);
}
/* One activity drawn: its tick alone, the explaining button beside it. */
.design-ticks.is-single {
  grid-template-columns: var(--tick) 18px;
  align-items: center;
  gap: 4px;
}
.design-ticks.is-single .btn.design-explain {
  position: static;
  transform: none;
}
.design-ticks.is-single .design-conflict-dot {
  left: auto;
  right: -3px;
  top: calc(50% - 12px);
}
/* Condensed: a row a line tall, its words cut where the column ends and whole
   in the heading's tooltip, a process pointing at no catalog process marked
   down its edge rather than in a line of its own, and small squares. */
.design-grid.is-condensed { --tick: 18px; }
.design-grid.is-condensed .design-ticks { grid-template-columns: repeat(2, var(--tick)); gap: 2px; }
.design-grid.is-condensed .design-ticks.is-single { grid-template-columns: var(--tick) 12px; }
.design-grid.is-condensed .btn.design-tick {
  border-width: 1.5px;
  border-radius: 5px;
  font-size: 9.5px;
}
.design-grid.is-condensed .btn.design-explain {
  width: 12px;
  min-width: 12px;
  height: 12px;
}
.design-grid.is-condensed .btn.design-explain .design-explain-icon {
  width: 9px;
  height: 9px;
}
.design-grid.is-condensed .design-ticks .design-conflict-dot {
  left: calc(50% + 3px);
  top: calc(50% - 9px);
  width: 6px;
  height: 6px;
}
.design-grid.is-condensed .data-table.design-matrix td.design-matrix-cell { padding: 2px 4px; }
.design-grid.is-condensed .data-table.design-matrix th.design-matrix-process { padding: 3px 12px; }
.design-grid.is-condensed .design-matrix-words {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.design-grid.is-condensed th.design-matrix-process[data-unmapped] {
  box-shadow: inset 3px 0 0 var(--sev-warn-text);
}
/* The roles' names at 45 degrees: the shared angled band over the role row,
   its height sized for most of the names (angledHeaderHeight), so a column is
   as narrow as its squares. The department row and the corner keep their
   own height, since only the role row's names are turned. */
.data-table.design-matrix.data-table-angled thead th.design-matrix-label,
.data-table.design-matrix.data-table-angled thead th.design-matrix-department {
  height: auto;
  padding: 4px 6px;
}
.data-table.design-matrix.data-table-angled thead th.design-matrix-department { padding-left: 8px; }
/* Turned, a name rises from the middle of its column, over the button that
   lists the role's job titles, and the column is as narrow as its box of
   ticks: the table no longer stretches to the frame's width, which spread
   the spare width over every column and kept them as wide as when the
   names lay flat. */
.data-table.design-matrix.data-table-angled { min-width: 0; }
.data-table.design-matrix.data-table-angled th.design-matrix-role {
  position: relative;
  width: auto;
  min-width: 0;
  padding: 0 0 28px;
  vertical-align: bottom;
  text-align: center;
}
/* Placed rather than laid out: a turned name's text still takes its length
   in the flow, and in the flow it would widen the column it is turned to
   keep narrow. */
.data-table.design-matrix.data-table-angled th.design-matrix-role .th-angle {
  position: absolute;
  bottom: 28px;
  left: 50%;
  width: 28px;
  transform: translate(-7px, 0) rotate(-45deg);
}
.data-table.design-matrix.data-table-angled th.design-matrix-role .design-role-info {
  position: absolute;
  top: auto;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
}
.data-table.design-matrix.data-table-angled .design-matrix-role-link {
  display: inline;
  color: var(--text);
}
.data-table.design-matrix.data-table-angled .design-matrix-role-link:hover { color: var(--accent); }
/* What the grid shows and how it is drawn, over the counts and the full
   screen switch beside them: small controls sharing one row where they fit,
   so the grid starts high on the page rather than under two rows of full
   size boxes. */
.design-grid-filter {
  margin-bottom: 10px;
  padding: 10px 14px;
}
.design-grid-filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 12px;
  align-items: start;
}
.design-grid-filters .form-label {
  margin-bottom: 2px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.design-grid-filters .form-input,
.design-grid-filters .form-select {
  padding: 4px 8px;
  font-size: 12.5px;
}
.design-grid-filters .form-label-check { font-size: 12px; gap: 6px; }
/* A group of switches is one line under its heading, two columns wide. */
.design-grid-filters > .design-grid-switches {
  grid-column: span 2;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 2px 14px;
}
.design-grid-filters > .design-grid-switches > legend {
  float: left;
  margin: 0 2px 0 0;
}
.design-grid-filter .form-hint { margin: 6px 0 0; }
.design-grid-narrowed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 6px;
}
.design-grid-narrowed > .form-hint { margin: 0; }
.design-grid-switches {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.design-grid-switches > legend { padding: 0; }
.design-grid-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0 16px;
}
.design-grid-full-btn { gap: 6px; }
.design-grid-full-icon {
  width: 16px;
  height: 16px;
}
/* The grid scrolls in a box of its own under headings that stay, as
   Compare's results do, so the business roles stay in sight however far down
   the processes go. The headings stick as a whole rather than cell by cell,
   since a turned heading's transform and a sticky cell do not go together,
   and a heading sticks to its nearest scroll box: the wrapper scrolling only
   sideways would give it nothing to stick to. */
.design-matrix-layout > .table-wrapper {
  max-height: calc(100vh - 120px);
  overflow: auto;
  overscroll-behavior: contain;
}
.data-table.design-matrix thead {
  position: sticky;
  top: 0;
  z-index: 5;
}
/* Full screen: the grid and the cell panel drawn over the whole window and
   nothing else, the filters and the key put away so the grid has the room. */
.design-grid.is-full > .design-grid-filter,
.design-grid.is-full > .design-legend { display: none; }
.design-grid.is-full {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  padding: 14px 20px 16px;
  overflow: hidden;
  background: var(--bg);
}
.design-grid.is-full > .design-grid-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}
.design-grid.is-full .design-matrix-layout {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}
.design-grid.is-full .design-matrix-layout > .table-wrapper {
  min-height: 0;
  max-height: none;
}
.design-grid.is-full .design-cell-panel {
  position: static;
  max-height: none;
}
.design-cell-panel {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 160px);
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.design-cell-activity { margin-bottom: 12px; }
/* The Suggestions tab's switch between the standard roles to use, the
   standard duties to use and the custom roles to build: three answer cards
   side by side, and the views not chosen put away, so the switch costs no
   request. */
.design-sugg-switch {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}
.design-sugg-switch > legend { margin-bottom: 6px; }
.design-suggestions:has(#design-sugg-standard:checked) .design-sugg-custom,
.design-suggestions:has(#design-sugg-standard:checked) .design-sugg-duties,
.design-suggestions:has(#design-sugg-duties:checked) .design-sugg-standard,
.design-suggestions:has(#design-sugg-duties:checked) .design-sugg-custom,
.design-suggestions:has(#design-sugg-custom:checked) .design-sugg-standard,
.design-suggestions:has(#design-sugg-custom:checked) .design-sugg-duties { display: none; }
.design-sugg-duty-list > li { margin: 4px 0; font-size: 14px; }
.design-sugg-roles > li { margin: 4px 0; font-size: 14px; }
/* What the design leaves unanswered is a disclosure, closed until somebody
   asks: its heading is the summary, and opening it puts room under it. */
.design-gaps > .form-card-title { cursor: pointer; margin: 0; }
.design-gaps[open] > .form-card-title { margin-bottom: 10px; }
/* The Suggestions tab: a card per system role. */
.design-suggestions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.design-price {
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid var(--sev-info-border);
  border-radius: var(--radius-sm);
  background: var(--sev-info-bg);
}
.design-price p { margin: 0 0 4px; }
/* A scenario made from a role design and the design listing the scenarios
   made from it link to each other in running text, where a link inherits the
   text's colour: the accent and the weight are what mark it as one. */
.design-scenario-list a,
.scenario-made-from a {
  color: var(--accent);
  font-weight: 600;
}
.design-scenario-list a:hover,
.scenario-made-from a:hover { text-decoration: underline; }
.design-list {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13px;
}
@media (max-width: 960px) {
  .design-matrix-layout { grid-template-columns: minmax(0, 1fr); }
  .design-cell-panel {
    position: static;
    max-height: none;
  }
}

/* Comply run's Risks tab (risks_parts.html): a role, the rule it breaks, how
   surely, and the two duties with what gives each. The evidence takes what
   the three narrow columns leave. */
.comply-risks-table { table-layout: fixed; width: 100%; }
.comply-risks-role { width: 22%; }
.comply-risks-rule { width: 26%; }
.comply-risks-strength { width: 12%; }
.comply-risks-evidence { width: auto; }
.data-table.comply-risks-table td { overflow-wrap: anywhere; vertical-align: top; }
.comply-risks-side + .comply-risks-side { margin-top: 6px; }
.comply-risks-side > summary { cursor: pointer; }
.comply-risks-objects { margin: 4px 0 0; padding-left: 18px; font-size: 12px; }
.comply-risks-objects li + li { margin-top: 2px; }
.comply-risks-how-list { margin: 4px 0 8px; padding-left: 20px; }
.comply-risks-how-list li + li { margin-top: 2px; }

/* A business role's job titles in the panel beside the grid. */
.design-role-jobs { margin: 4px 0 10px; padding-left: 18px; }
.design-role-jobs li + li { margin-top: 2px; }
.design-job-titles { max-width: 360px; }

/* A business role's D365 roles on the approval card, a line each. */
.design-approval-built {
  min-width: 260px;
  font-family: var(--font-mono);
  font-size: 13px;
  resize: vertical;
}

/* Settings > Resolver queries: My queries and Built-in queries, with New and
   Upload a .sql file on the row of the first (both anchors or labels, hidden
   by .tool-tabs-actions-per-tab and revealed by the My queries radio). The
   editor is the HTML templates editor's shape - the details across the top,
   the SQL under them - with the contract beside the box and a test run's rows
   under both. */
#resolver-queries-tab-mine:checked ~ #resolver-queries-panel-mine,
#resolver-queries-tab-builtin:checked ~ #resolver-queries-panel-builtin {
  display: block;
}

#resolver-queries-tab-mine:checked ~ .tool-tabs-header .tab-bar label[for="resolver-queries-tab-mine"],
#resolver-queries-tab-builtin:checked ~ .tool-tabs-header .tab-bar label[for="resolver-queries-tab-builtin"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.tool-tabs-actions-per-tab .tool-tabs-actions .resolver-queries-upload {
  display: none;
}

#resolver-queries-tab-mine:checked ~ .tool-tabs-header .resolver-queries-new,
#resolver-queries-tab-mine:checked ~ .tool-tabs-header .resolver-queries-upload {
  display: inline-flex;
}

.data-table.resolver-queries-table .resolver-queries-col-name {
  min-width: 200px;
  max-width: 320px;
}

.data-table.resolver-queries-table .resolver-queries-col-description {
  min-width: 240px;
  max-width: 560px;
}

.data-table .resolver-queries-col-owner,
.data-table .resolver-queries-col-updated {
  width: 1%;
  white-space: nowrap;
}

.resolver-query-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 16px);
}

.resolver-query-details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--space-4, 16px);
}

.resolver-query-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--space-4, 16px);
  align-items: start;
}

.resolver-query-sql {
  min-height: 420px;
  width: 100%;
  resize: vertical;
}

.resolver-query-test-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2, 8px);
  align-items: center;
  margin-top: var(--space-3, 12px);
}

.resolver-query-test-bar .form-select {
  max-width: 360px;
}

/* The contract sits beside a tall SQL box, so it starts at the top of its
   column and its two columns keep their words on one line each. */
.resolver-query-contract {
  align-self: start;
}

.data-table.resolver-query-contract-table .resolver-query-contract-col {
  white-space: nowrap;
}

/* A test run's rows: nine columns of names and flags, each kept to one line
   so the table scrolls sideways in its wrapper rather than wrapping a name. */
.resolver-query-result {
  margin-top: 0;
}

.data-table.resolver-query-result-table td {
  white-space: nowrap;
}

.resolver-query-used-by {
  margin: 0;
}

@media (max-width: 960px) {
  .resolver-query-details-grid,
  .resolver-query-editor-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Compare: the strip naming the columns one side has not got, above the
   rows it was left out of. */
.compare-column-gaps {
  margin-bottom: var(--space-4, 16px);
}

/* Validate > Dimension validation. The string is read character by
   character, so it and every value are in the code face; the facts a check
   found sit as a two-column list, and the tables name their columns. */
.dimval-string {
  font-family: var(--font-mono);
}

/* Build's rows, stacked: the state's icon and the dimension's name and source,
   the box and its lookup, then half the row for one line saying what the box
   needs, cut where the line ends and whole in its tooltip. A grid of boxes
   with their messages under them set every box a different height below the
   one beside it, and a sentence of Finance and Operations' four lines tall
   pushed the whole row down. */
/* The line above the rows shares their columns: Dimensions over the names,
   the account structure the rows are judged against starting where the boxes
   do, and the legend at the right. */
.dimval-rows-head {
  display: grid;
  grid-template-columns: minmax(180px, 20%) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 6px 16px;
  margin: 6px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.dimval-rows-head .form-label {
  margin: 0;
}

.dimval-rows-structure {
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.dimval-rows-structure strong {
  color: var(--text);
  font-weight: 600;
}

.dimval-legend {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
}

.dimval-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dimval-legend-icon {
  width: 14px;
  height: 14px;
}

.dimval-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dimval-row {
  display: grid;
  grid-template-columns: minmax(180px, 20%) minmax(220px, 30%) minmax(0, 1fr);
  align-items: center;
  gap: 0 16px;
}

.dimval-row-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dimval-row-state {
  flex: none;
  display: inline-flex;
  color: var(--text-faint);
}

.dimval-row-icon {
  width: 18px;
  height: 18px;
}

.dimval-row-words {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
  cursor: pointer;
}

.dimval-row-dim {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.dimval-row-source {
  font-size: 11.5px;
  color: var(--text-muted);
}

.dimval-row-says {
  margin: 0;
  min-width: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The state's colour is the icon's and the line's: red for a box the
   structure needs and for a value refused, green for one allowed, amber for a
   warning, blue for a note and for where to start, and faint for a box whose
   value would be dropped. */
.dimval-row.is-required .dimval-row-state,
.dimval-row.is-required .dimval-row-says,
.dimval-row.is-refused .dimval-row-state,
.dimval-row.is-refused .dimval-row-says,
.dimval-legend-item.is-required,
.dimval-legend-item.is-refused {
  color: var(--sev-prob-text);
}

.dimval-row.is-allowed .dimval-row-state,
.dimval-row.is-allowed .dimval-row-says,
.dimval-legend-item.is-allowed {
  color: var(--sev-ok-text);
}

.dimval-row.is-warning .dimval-row-state,
.dimval-row.is-warning .dimval-row-says,
.dimval-row.is-unchecked .dimval-row-state,
.dimval-row.is-unchecked .dimval-row-says {
  color: var(--sev-warn-text);
}

.dimval-row.is-info .dimval-row-state,
.dimval-row.is-info .dimval-row-says,
.dimval-row.is-start .dimval-row-state,
.dimval-row.is-start .dimval-row-says {
  color: var(--sev-info-text);
}

.dimval-row.is-optional .dimval-row-state,
.dimval-legend-item.is-optional {
  color: var(--text-muted);
}

.dimval-legend-item.is-dropped,
.dimval-row.is-unused .dimval-row-dim {
  color: var(--text-faint);
}

.dimval-row.is-required .form-input,
.dimval-row.is-refused .form-input {
  border-color: var(--sev-prob-text);
  box-shadow: 0 0 0 1px var(--sev-prob-text);
}

.dimval-row.is-warning .form-input {
  border-color: var(--sev-warn-text);
}

.dimval-row.is-allowed .form-input {
  border-color: var(--sev-ok-border);
}

.dimval-row.is-start .form-input {
  border-color: var(--sev-info-text);
}

/* A box whose value would be dropped is still a box - a value typed into it
   is checked and said to be dropped - so it stays a control, dashed rather
   than filled. */
.dimval-row.is-dropped .form-input,
.dimval-row.is-unused .form-input {
  background: transparent;
  border-style: dashed;
}

/* On a narrow screen the three parts of a row stack, the line under the box
   and wrapping, since there is no width beside it to cut it to. */
@media (max-width: 720px) {
  .dimval-row,
  .dimval-rows-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .dimval-rows {
    gap: 14px;
  }

  .dimval-row-says {
    white-space: normal;
  }
}

.dimval-result {
  margin-top: 16px;
}

/* A Build box and its lookup: the box gives up the button's width and keeps
   its own height, and the button is as tall as the box it sits beside. */
.dimval-seg-control {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.dimval-seg-control .form-input {
  flex: 1;
  min-width: 0;
}

.dimval-lookup-btn {
  flex: none;
  padding: 0 9px;
}

.dimval-lookup-icon {
  width: 16px;
  height: 16px;
}

/* The lookup's list scrolls inside the modal, under its search: a dialog of
   auto height is clamped by max-height without the flex layout running again,
   so the list carries a ceiling of its own. */
.dimval-lookup-list {
  max-height: min(60vh, 560px);
  overflow-y: auto;
}

.dimval-lookup-summary {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.dimval-lookup-group {
  margin: 14px 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dimval-lookup-values {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* A value is one line on a grid every row shares - the value, its name, its
   marks - with why it is not allowed on the line under it. */
.dimval-lookup-pick {
  display: grid;
  grid-template-columns: minmax(90px, max-content) 1fr auto;
  align-items: baseline;
  gap: 2px 12px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.dimval-lookup-pick:hover,
.dimval-lookup-pick:focus-visible {
  background: var(--surface-hover);
  border-color: var(--border);
}

.dimval-lookup-value {
  font-family: var(--font-mono);
  font-weight: 600;
}

.dimval-lookup-pick.is-refused .dimval-lookup-value,
.dimval-lookup-pick.is-refused .dimval-lookup-name {
  color: var(--text-muted);
}

.dimval-lookup-marks {
  display: inline-flex;
  gap: 6px;
}

.dimval-lookup-why {
  grid-column: 1 / -1;
  font-size: 12px;
  line-height: 1.4;
  color: var(--sev-prob-text);
}

.dimval-built {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 14px;
}

.dimval-built code {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.dimval-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0 0 16px;
}

.dimval-facts dt {
  color: var(--text-muted);
  font-size: 13px;
}

.dimval-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.dimval-result .sum-section-title {
  margin-top: 16px;
}

/* The columns are named rather than counted, and qualified by .data-table so
   the density variants do not outrank them. */
.data-table.dimval-segments-table th.dimval-dim,
.data-table.dimval-findings-table th.dimval-dim {
  width: 22%;
}

.data-table.dimval-segments-table th.dimval-val {
  width: 26%;
}

.data-table.dimval-segments-table th.dimval-used {
  width: 28%;
}

.data-table.dimval-segments-table th.dimval-found {
  width: 120px;
}

.data-table.dimval-findings-table th.dimval-sev {
  width: 110px;
}

/* What D365 says names values and accounts whole, which a narrow screen has
   to break somewhere. */
.data-table.dimval-findings-table td.dimval-msg {
  overflow-wrap: anywhere;
}

/* Settings > Secrets: a value row is its name beside its write-only box, and
   the environments and workflows a secret is kept for are a wrapping list of
   tick boxes. The row's label sits at the top, since the control beside it is
   several lines tall. */
.conn-prop-row.secret-values-row {
  align-items: start;
}

.secret-values {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.secret-value {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr);
  gap: 8px;
}

.secret-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.secret-choices > .form-hint {
  flex-basis: 100%;
  margin: 0;
}

@media (max-width: 600px) {
  .secret-value {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Settings > Upgrade (templates/settings/upgrade.html): a card of facts
   about the site, then the check panel loaded after the page, each fact a
   row of a definition list so the labels line up and a long image reference
   wraps under its own label rather than beside it. */
.settings-upgrade-card + .settings-upgrade-card {
  margin-top: 16px;
}

.settings-upgrade-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0 0 12px;
}

.settings-upgrade-facts dt {
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.settings-upgrade-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.settings-upgrade-facts dd .status-pill {
  margin-right: 6px;
  vertical-align: middle;
}

.settings-upgrade-muted {
  color: var(--text-muted);
}

.settings-upgrade-checking {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 640px) {
  .settings-upgrade-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px 0;
  }
  .settings-upgrade-facts dd {
    margin-bottom: 8px;
  }
}

/* The lookup beside a Values from Dynamics 365 box, and the square that
   opens it: the square sits against its box, and the lookup's list scrolls
   inside the dialog under a search bar that stays put. */
.automate-doctype-sheet-find {
  flex: none;
}

.automate-doctype-values-picker-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.automate-doctype-values-picker-bar input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
}

.automate-doctype-values-picker-bar .form-select {
  flex: 0 1 220px;
  width: auto;
}

.automate-doctype-values-picker-env {
  flex: none;
  color: var(--text-muted);
  font-size: 12px;
}

.automate-doctype-values-picker-list {
  max-height: min(56vh, 520px);
  overflow: auto;
}

.automate-doctype-values-picker-table {
  width: 100%;
}

.automate-doctype-values-picker-table .automate-col-pick-name,
.automate-doctype-values-picker-table .automate-col-pick-label,
.automate-doctype-values-picker-table .automate-col-pick-more {
  overflow-wrap: anywhere;
}

.automate-doctype-values-picker-table .automate-col-pick-use {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

/* The workflow a step runs, named above the step's settings with the way
   into it: set off from the form under it as the process's block is. */
.automate-inspector-child {
  margin-bottom: var(--space-3);
}


/* A workflow's Document values setting and its Default AI model: two
   controls under one heading each in the Settings dialog, with no frame of
   the fieldset's own. */
.automate-settings-values,
.automate-settings-model {
  min-width: 0;
  padding: 0;
  border: 0;
}

.automate-settings-values > legend,
.automate-settings-model > legend {
  padding: 0;
}

/* The two parts of the question a change of defaults asks, where both the
   environment and the model changed in one Save. */
.automate-defaults-heading {
  margin: 0 0 var(--space-2);
  font-size: 13px;
  font-weight: 600;
}

.automate-environment-list + .automate-defaults-heading,
.form-label-check + .automate-environment-list + .automate-defaults-heading {
  margin-top: var(--space-3);
}

/* The steps a change of default environment would reach, a disclosure under
   each count so the question stays three lines until somebody asks which. */
.automate-environment-list {
  margin: 4px 0 12px;
  font-size: 13px;
}

.automate-environment-list ul {
  margin: 6px 0 0;
  padding-left: 18px;
  max-height: 180px;
  overflow: auto;
}

/* ------------------------------------------------------------------------
   What's new: the release notes, on a page of their own (templates/whatsnew).

   The page stands outside the app shell and is drawn in the light mode of the
   EntityShift theme, so everything here reads the theme's tokens and nothing
   names a colour of its own. Its three columns are the top bar, a menu of
   versions and modules that stays in view, and the reading column.
   ------------------------------------------------------------------------ */

.wn-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  /* The app shell's html and body never scroll (overflow: hidden at the
     window's height), and this page is a document that does. The body is
     the scroll box, at the window's height: left to grow past an html that
     hides its overflow, everything below the first screen was cut off with
     no way to reach it. */
  height: 100%;
  overflow-y: auto;
}

.wn-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.wn-brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.wn-brand-mark,
.wn-brand-mark svg {
  display: block;
  height: 22px;
  max-width: 180px;
}

.wn-top-title {
  flex-shrink: 0;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

/* The external site's sections, beside the logo where the product says
   "What's new". */
.wn-nav {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.wn-nav-link {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.wn-nav-link:hover,
.wn-nav-link.is-active {
  background: var(--accent-dim);
  color: var(--accent);
}

.wn-search {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.wn-search input[type="search"] {
  width: 100%;
  max-width: 560px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.wn-search input[type="search"]:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
  background: var(--surface);
}

.wn-page {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 36px;
  /* The menu sits at the left of the window, under the logo, as a sidebar
     does; a wide window's spare room goes to the right of the article. */
  max-width: 1480px;
  margin: 0;
  padding: 24px 40px 80px;
}

.wn-menu-button {
  display: none;
}

.wn-menu {
  position: sticky;
  top: 72px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-right: 4px;
}

.wn-menu-heading {
  margin: 20px 0 6px;
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wn-menu-link,
.wn-month-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.wn-menu-link:hover,
.wn-month-summary:hover {
  background: var(--surface-hover);
}

.wn-menu-link.is-active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.wn-menu-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--accent);
}

.wn-menu-name {
  flex: 1;
  min-width: 0;
}

.wn-menu-count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.wn-month-summary {
  font-weight: 600;
  list-style: none;
}

.wn-month-summary::-webkit-details-marker {
  display: none;
}

.wn-month-caret {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.12s;
}

.wn-month[open] > .wn-month-summary .wn-month-caret {
  transform: rotate(90deg);
}

.wn-day-link {
  padding-left: 26px;
  font-size: 13px;
}

.wn-day-version {
  font-family: var(--font-mono);
}

.wn-day-date {
  color: var(--text-muted);
}

.wn-day-link.is-active .wn-day-date {
  color: inherit;
}

.wn-day-dot {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
}

.wn-unlicensed {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.wn-main {
  min-width: 0;
}

.wn-title {
  margin: 8px 0 8px;
  font-size: 30px;
  line-height: 1.2;
}

.wn-lead {
  max-width: 660px;
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
}

.wn-eyebrow {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wn-version-head,
.wn-results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.wn-results-head {
  margin-top: 8px;
}

.wn-version {
  margin: 2px 0 4px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 30px;
  line-height: 1.2;
}

.wn-version-line {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

.wn-steps {
  display: flex;
  gap: 8px;
}

.wn-clear {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.wn-clear:hover {
  text-decoration: underline;
}

.wn-note {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  /* A note is linked to by its name; the top bar must not cover it. */
  scroll-margin-top: 76px;
}

.wn-note:target {
  border-color: var(--accent);
}

.wn-note-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--accent-dim);
  color: var(--accent);
}

.wn-note-icon.is-small {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

.wn-note-icon-svg {
  width: 24px;
  height: 24px;
}

.wn-note-icon.is-small .wn-note-icon-svg {
  width: 17px;
  height: 17px;
}

.wn-note-body {
  flex: 1;
  min-width: 0;
}

.wn-note-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.wn-kind {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.wn-kind-new {
  background: var(--accent-dim);
  color: var(--accent);
}

.wn-kind-improved {
  background: var(--sev-info-bg);
  color: var(--sev-info-text);
}

.wn-status-in-progress {
  background: var(--accent-dim);
  color: var(--accent);
}

.wn-status-planned {
  background: var(--sev-info-bg);
  color: var(--sev-info-text);
}

.wn-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 12px;
}

.wn-tag-icon {
  width: 13px;
  height: 13px;
}

.wn-tag-internal {
  border-color: var(--sev-warn-text);
  color: var(--sev-warn-text);
}

.wn-note-title {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.3;
}

.wn-note-summary {
  max-width: 720px;
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.5;
}

.wn-prose {
  max-width: 720px;
  font-size: 15px;
  line-height: 1.6;
}

.wn-prose p {
  margin: 0 0 12px;
}

.wn-prose ul,
.wn-prose ol {
  margin: 0 0 12px;
  padding-left: 22px;
}

.wn-prose li {
  margin-bottom: 6px;
}

.wn-prose code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.wn-after {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.wn-after .wn-eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
}

.wn-shot {
  margin: 16px 0 0;
}

.wn-shot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.wn-shot figcaption {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.wn-fixes {
  margin-top: 24px;
}

.wn-fix-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
}

.wn-fix-count {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* The catalogue: a card a module, then a module's own page. */
.wn-catalogue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.wn-catalogue-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.wn-catalogue-card:hover {
  border-color: var(--accent);
}

.wn-catalogue-card .wn-card-more {
  margin-top: auto;
}

.wn-guide-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wn-guide-summary {
  margin-bottom: 24px;
}

.wn-audience {
  display: grid;
  gap: 10px;
  margin: 10px 0 28px;
}

.wn-audience-row {
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.wn-audience dt {
  margin-bottom: 4px;
  font-weight: 600;
}

.wn-audience dd {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.wn-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 10px 0 28px;
}

.wn-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.wn-card:hover {
  border-color: var(--accent);
}

.wn-card-picture {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--accent-dim);
}

.wn-card-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}

.wn-card-picture-icon {
  width: 64px;
  height: 64px;
  color: var(--accent);
}

.wn-card-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
}

.wn-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.wn-card-version {
  margin-left: auto;
  font-family: var(--font-mono);
}

.wn-card-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.wn-card-summary {
  flex: 1;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.wn-card-more {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.wn-rows {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.wn-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
}

.wn-row + .wn-row {
  border-top: 1px solid var(--border);
}

.wn-row:hover {
  background: var(--surface-hover);
}

.wn-row-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wn-row-title {
  font-size: 15px;
  font-weight: 600;
}

.wn-row-summary {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.wn-row-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.wn-row-version {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* The profile menu's mark on its What's new link: the build holds release
   notes the person has not opened. */
.topbar-profile-unseen {
  width: 7px;
  height: 7px;
  margin-left: auto;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
}

a.topbar-profile-action {
  box-sizing: border-box;
  text-decoration: none;
}

@media (max-width: 1100px) {
  .wn-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A tablet and a phone: one column, with the menu folded behind its button. */
@media (max-width: 860px) {
  .wn-top {
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 10px 16px;
  }

  .wn-search {
    flex-basis: 100%;
  }

  .wn-nav {
    padding-left: 8px;
  }

  .wn-nav-link {
    padding: 6px 8px;
    font-size: 14px;
  }

  .wn-search input[type="search"] {
    max-width: none;
  }

  .wn-page {
    display: block;
    padding: 12px 16px 60px;
  }

  .wn-menu-button {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }

  .wn-menu-button-icon {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: transform 0.12s;
  }

  .wn-menu-toggle:checked + .wn-menu-button .wn-menu-button-icon {
    transform: rotate(180deg);
  }

  .wn-menu-toggle:focus-visible + .wn-menu-button {
    outline: 2px solid var(--accent);
  }

  .wn-menu {
    display: none;
    position: static;
    max-height: none;
    margin-bottom: 16px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .wn-menu-toggle:checked ~ .wn-menu {
    display: block;
  }

  .wn-note {
    flex-direction: column;
    padding: 16px;
  }

  .wn-title,
  .wn-version {
    font-size: 24px;
  }
}

/* =====================================================
   PDF output: a document type's PDF layouts and the designer for one
   (templates/automate/doctype_pdf.html, static/js/pdf-designer.js).

   The page is drawn in millimetres: every length on it is a number of
   millimetres times --mm, the one scale the script fits to the stage's width,
   so the whole page zooms by one property. A band is its height times --mm in
   a column, the lines band taking what is left; an element sits at --x and
   --y inside its band. Words are an SVG <text> on the baseline the renderer
   draws them on (pdfdoc.TextBaseline), in the face the PDF draws them in.

   The paper is paper in both themes: a PDF is printed on white, and a dark
   page would say nothing about how the document will look.
   ===================================================== */
:root {
  --pdfd-paper:      #ffffff;
  --pdfd-ink:        #1a1d28;
  --pdfd-rule:       #444a5c;
  --pdfd-band-line:  #b9c0d4;
  --pdfd-band-label: #6f7689;
  --pdfd-stage:      #1d2130;
  --pdfd-token:      rgba(0, 158, 132, 0.12);
  --pdfd-token-ink:  #00705e;
  --pdfd-select:     #009e84;
  --pdfd-anchor:     #00594b;
  --pdfd-screen:     #b07a00;
}

html[data-theme="light"] {
  --pdfd-stage:      #dfe3ec;
}

/* The bundled faces, from the bytes a PDF embeds (pdfdoc.BundledFontFile),
   loaded only where the designer's page draws in one. */
@font-face { font-family: "ES Noto Sans"; src: url("/automate/pdf-fonts/noto-sans-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "ES Noto Sans"; src: url("/automate/pdf-fonts/noto-sans-bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "ES Noto Serif"; src: url("/automate/pdf-fonts/noto-serif-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "ES Noto Serif"; src: url("/automate/pdf-fonts/noto-serif-bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "ES Great Vibes"; src: url("/automate/pdf-fonts/great-vibes-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "ES Libre Barcode 39"; src: url("/automate/pdf-fonts/libre-barcode-39-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }

/* The core three are named, not embedded, by a PDF; on the page they are the
   metric-compatible faces of each (Liberation, Arimo, Tinos, Cousine), which
   draw a line of words the width the PDF's own metrics measure it. */
.pdfd-font-helvetica { font-family: Helvetica, Arial, "Liberation Sans", Arimo, sans-serif; }
.pdfd-font-times { font-family: "Times New Roman", Times, "Liberation Serif", Tinos, serif; }
.pdfd-font-courier { font-family: "Courier New", Courier, "Liberation Mono", Cousine, monospace; }
.pdfd-font-noto-sans { font-family: "ES Noto Sans", sans-serif; }
.pdfd-font-noto-serif { font-family: "ES Noto Serif", serif; }
.pdfd-font-great-vibes { font-family: "ES Great Vibes", cursive; }
/* The Code 39 barcode (BC39): what it draws is pdfdoc.Code39's encoding of
   the words, which the page is handed already encoded. */
.pdfd-font-bc39 { font-family: "ES Libre Barcode 39", monospace; }

/* How many layouts a type has, and how many checks, beside the PDF output
   and Checks tabs' names. */
label[for="automate-doctype-tab-pdf"] .tab-count,
label[for="automate-doctype-tab-checks"] .tab-count {
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-elevated);
  font-size: 11px;
  font-weight: 600;
}

/* The tab is a column: the layouts strip, then the designer. */
.pdfd { display: flex; flex-direction: column; gap: 8px; }

/* Nothing made yet (a type's PDF output with no layout, its Fields tab with
   no property): the words, then the ways to start as cards straight under
   them, so the press is where the eye ends rather than a corner away. */
.start-empty { text-align: left; }
.start-empty-head { display: flex; align-items: flex-start; gap: 14px; }
.start-empty-head .form-hint { margin: 4px 0 0; max-width: 80ch; }
.start-empty-icon { width: 32px; height: 32px; flex: none; color: var(--text-muted); }
.start-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  max-width: 880px;
  margin: 16px 0 0 46px;
}
.start-option { width: 100%; color: var(--text); font: inherit; text-align: left; }
.start-option .form-hint { margin: 0; }

/* The layouts, one strip: a chip per layout, the chosen one's actions beside
   it, and the ways to make another at the end. It wraps to a second row only
   where the chips do not fit one. */
.pdfd-layouts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.pdfd-layouts-label {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: help;
}
.pdfd-layout-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pdfd-layout-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 32px;
  padding: 1px 2px 1px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
}
.pdfd-layout-row:not(.is-chosen) { padding-right: 8px; }
.pdfd-layout-row.is-chosen { border-color: var(--accent); background: var(--accent-dim); }
.pdfd-layout-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}
.pdfd-layout-name span { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdfd-layout-mark { width: 16px; height: 16px; flex: none; color: var(--accent); }
.pdfd-layout-page { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.pdfd-layout-actions { display: inline-flex; gap: 2px; flex: none; }
.pdfd-layouts-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }

.pdfd-designer { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pdfd-panes {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 260px;
  min-height: 560px;
}
.pdfd-place,
.pdfd-selected {
  min-width: 0;
  padding: 10px;
  font-size: 13px;
}
.pdfd-place { border-right: 1px solid var(--border); }
.pdfd-selected { border-left: 1px solid var(--border); }
.pdfd-pane-title {
  margin: 2px 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pdfd-place-list + .pdfd-pane-title { margin-top: 10px; }
.pdfd-pane-subtitle { margin: 10px 0 4px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.pdfd-pane-note { margin: 0 0 4px; font-size: 12px; }

/* The Place pane is a dense list: a row is 26px, its mark in one column at
   the right whatever the words' depth, and the elements two to a row. */
.pdfd-place-list { list-style: none; margin: 0; padding: 0; }
.pdfd-place-elements { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
/* Page number is the one element too long for half the pane: it takes the
   last row whole. */
.pdfd-place-elements > li:has(> [data-pdf-place="page-number"]) { grid-column: 1 / -1; order: 1; }
/* Text block is as long, and goes on a row of its own with them. */
.pdfd-place-elements > li:has(> [data-pdf-place="text-block"]) { grid-column: 1 / -1; order: 1; }
/* An Image slot takes a row of its own under them, so its words are never cut
   to read as the Image... beside Box. */
.pdfd-place-elements > li:has(> [data-pdf-place="image-slot"]) { grid-column: 1 / -1; order: 2; }
.pdfd-place-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 26px;
  padding: 2px 6px 2px calc(6px + 10px * var(--depth, 0));
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  line-height: 1.25;
  text-align: left;
  box-sizing: border-box;
  cursor: grab;
  touch-action: manipulation;
}
.pdfd-place-item:hover { background: var(--surface-hover); border-color: var(--border); }
.pdfd-place-words { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdfd-place-mark { flex: none; width: 3.6em; font-size: 11px; color: var(--accent); text-align: right; }
.pdfd-place-icon { width: 16px; height: 16px; flex: none; color: var(--text-muted); }
.pdfd-image-form { margin: 0; }
.pdfd-image-form .pdfd-place-item { cursor: pointer; }

/* The centre: the toolbar, then the stage or the Preview. */
.pdfd-centre { display: flex; flex-direction: column; min-width: 0; }
.pdfd-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.pdfd-switch {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.pdfd-switch-label {
  padding: 4px 11px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.pdfd-switch-label + .pdfd-switch-label { border-left: 1px solid var(--border-hover); }
.pdfd-switch-label.is-on,
#pdf-view-design:checked ~ .pdfd-bar [data-pdf-view="design"],
#pdf-view-preview:checked ~ .pdfd-bar [data-pdf-view="preview"] {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}
#pdf-view-design:focus-visible ~ .pdfd-bar [data-pdf-view="design"],
#pdf-view-preview:focus-visible ~ .pdfd-bar [data-pdf-view="preview"] {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.pdfd-page-form { display: inline-flex; flex: none; gap: 6px; margin: 0; }
.pdfd-page-form .form-select { width: auto; min-width: 0; height: 28px; padding-top: 2px; padding-bottom: 2px; font-size: 13px; }
/* The zoom is the script's (pdf-designer.js): never posted, the way the
   page is fitted pressed. */
.pdfd-zoom { display: inline-flex; align-items: center; flex: none; gap: 2px; }
.pdfd-zoom .btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.pdfd-several,
.pdfd-background-tools,
.pdfd-sample-tools { flex: none; font-size: 13px; white-space: nowrap; }

/* The status of the last change takes what the row leaves, at its right,
   before the help: a sentence arriving fills it and moves nothing. */
.pdfd-alert { display: flex; justify-content: flex-end; flex: 1 1 0; min-width: 0; }
.pdfd-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.35;
}
.pdfd-status.is-done { color: var(--sev-ok-text); background: var(--sev-ok-bg); }
.pdfd-status.is-problem { color: var(--sev-prob-text); background: var(--sev-prob-bg); border: 1px solid var(--sev-prob-border); }
.pdfd-status-icon { width: 14px; height: 14px; flex: none; }
.pdfd-status-words { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdfd-status.is-problem .pdfd-status-words {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

/* The help, a press away rather than two lines under the page. */
.pdfd-help { position: relative; flex: none; }
.pdfd-help > summary { list-style: none; cursor: pointer; }
.pdfd-help > summary::-webkit-details-marker { display: none; }
.pdfd-help[open] > summary { border-color: var(--accent); color: var(--accent); }
.pdfd-help-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: min(360px, 70vw);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.25));
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}
.pdfd-help-panel p { margin: 0; }
.pdfd-help-panel p + p { margin-top: 6px; }

/* The sample a layout was traced from, under the page. Shown and how
   strongly is the reader's (pdf-designer.js sets the two properties on the
   stage), never the server's, and it is never drawn into a PDF. */
.pdfd-sample-tools { display: inline-flex; align-items: center; gap: 6px; }
.pdfd-sample-opacity { width: 80px; accent-color: var(--accent); }
.pdfd-sample {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: var(--pdfd-sample-opacity, 0.45);
  pointer-events: none;
  user-select: none;
}
.pdfd-stage.is-sample-hidden .pdfd-sample { display: none; }

/* A page background (a printed form) is part of what the PDF draws, so the
   page draws it at full strength under everything; the tick that hides it is
   the reader's alone (pdf-designer.js sets is-background-hidden on the stage),
   and it is still drawn into every PDF. */
.pdfd-background-tools { display: inline-flex; align-items: center; gap: 8px; }
.pdfd-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}
.pdfd-stage.is-background-hidden .pdfd-background { display: none; }
/* The lines band's sentence would be written over the form or the sample
   behind it, so it goes while either shows. */
.pdfd-stage:not(.is-background-hidden) .pdfd-page:has(> .pdfd-background) .pdfd-table-note,
.pdfd-stage:not(.is-sample-hidden) .pdfd-page:has(> .pdfd-sample) .pdfd-table-note { display: none; }
/* The tracing controls and the view's own are about the design, so they go
   while the Preview shows: the Preview is the PDF, which draws no sample and
   has a zoom of its own. */
#pdf-view-preview:checked ~ .pdfd-bar .pdfd-sample-tools,
#pdf-view-preview:checked ~ .pdfd-bar .pdfd-background-tools,
#pdf-view-preview:checked ~ .pdfd-bar .pdfd-zoom,
#pdf-view-preview:checked ~ .pdfd-bar .pdfd-several { display: none; }

/* Mirror a sample's by-hand button says what it will do for the way chosen. */
.pdfd-when-fill { display: none; }
.modal-form:has(#pdf-mirror-how-fill:checked) .pdfd-when-fill { display: inline; }
.modal-form:has(#pdf-mirror-how-fill:checked) .pdfd-when-rebuild { display: none; }

/* A dialog's fields side by side: one grid, every label on one line over its
   control at the top of its cell, and every control of a row the same
   height, so a label with a mark and one without, or a select beside a box,
   share a y. */
.pdfd-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0 12px;
  align-items: start;
}
.pdfd-fields > .form-group { min-width: 0; }
.pdfd-fields .form-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; }
.pdfd-fields .form-input,
.pdfd-fields .form-select { height: 38px; }
.pdfd-fields-page { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
.pdfd-fields-font { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }

/* Mirror a sample: the sample's first page beside the fields once it is
   drawn; its column takes nothing until then. The two ways are cards. */
.pdfd-mirror-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.pdfd-mirror-fields { min-width: 0; }
.pdfd-mirror-thumb {
  display: block;
  width: 180px;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--border);
  background: #fff;
}
.pdfd-mirror-thumb[hidden] { display: none; }
.pdfd-mirror-fields > .form-hint { margin: -4px 0 12px; }
.pdfd-how { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.pdfd-how > legend { margin-bottom: 6px; }
.pdfd-how .wizard-option .form-hint { margin: 0; }
.pdfd-how .wizard-option-icon { width: 20px; height: 20px; margin-bottom: 2px; }
.pdfd-mirror-take { margin-bottom: 12px; }
.pdfd-mirror-take .form-hint { margin: 2px 0 0 24px; }
.pdfd-mirror-take .form-label-check:has(input:disabled) { color: var(--text-muted); }
/* Take the fields from the sample too: once the model has answered, the
   dialog is the review of what it read, and its own fields and buttons step
   aside until Back. */
.modal-foot .pdfd-when-review { display: none; }
[data-pdf-mirror]:has([data-pdf-mirror-proposal]) .modal-foot .pdfd-when-review { display: inline-flex; }
[data-pdf-mirror]:has([data-pdf-mirror-proposal]) .pdfd-mirror-ask,
[data-pdf-mirror]:has([data-pdf-mirror-proposal]) .modal-foot .pdfd-when-asking { display: none; }
.pdfd-mirror-review { min-width: 0; }
/* The review of fields a model read off a sample (doctype-fields-review),
   Suggest from a sample's and Mirror a sample's alike: a fixed table whose
   boxes and choosers take their columns' width, a row left out standing
   back, and what the sample showed cut where its column ends and whole in
   its tooltip. */
.doctype-fields-review { min-width: 0; }
.doctype-fields-review-lead { margin: 0 0 12px; }
.doctype-fields-review-table { width: 100%; table-layout: fixed; }
.data-table.doctype-fields-review-table th.doctype-review-col-use { width: 52px; }
.data-table.doctype-fields-review-table th.doctype-review-col-words { width: 22%; }
.data-table.doctype-fields-review-table th.doctype-review-col-name { width: 19%; }
.data-table.doctype-fields-review-table th.doctype-review-col-type { width: 15%; }
.data-table.doctype-fields-review-table th.doctype-review-col-where { width: 112px; }
.data-table.doctype-fields-review-table th.doctype-review-col-standard { width: 14%; }
.data-table.doctype-fields-review-table td { vertical-align: top; }
.data-table.doctype-fields-review-table td.doctype-review-col-use { text-align: center; padding-top: 14px; }
.data-table.doctype-fields-review-table td.doctype-review-col-standard,
.data-table.doctype-fields-review-table td.doctype-review-col-sample { padding-top: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doctype-fields-review-table .form-input,
.doctype-fields-review-table .form-select { width: 100%; min-width: 0; }
.doctype-review-parts {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doctype-review-known {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--accent-dim);
  color: var(--text);
}
.data-table.doctype-fields-review-table tr:has(input[name="keep"]:not(:checked)) td:not(.doctype-review-col-use) { opacity: 0.55; }
@media (max-width: 720px) {
  .pdfd-mirror-body { grid-template-columns: minmax(0, 1fr); }
  .pdfd-fields-page,
  .pdfd-fields-font { grid-template-columns: minmax(0, 1fr); }
}

/* The Fonts dialog's list of uploaded families, each drawn in its own face. */
.pdfd-font-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pdfd-font-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.pdfd-font-row > button { grid-column: 2; grid-row: 1 / span 3; }
.pdfd-font-name code { font-size: 12px; color: var(--text-muted); }
.pdfd-font-sample { font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.pdfd-font-meta { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
.pdfd-font-used { font-size: 12px; }
[data-pdf-fonts] .modal-body > .pdfd-pane-title { margin: 14px 0 6px; }
[data-pdf-fonts] .modal-body > .pdfd-pane-title:first-of-type { margin-top: 4px; }
.pdfd-stage.is-cropping .pdfd-page,
.pdfd-stage.is-cropping .pdfd-el { cursor: crosshair; }
.pdfd-crop-box {
  position: absolute;
  z-index: 4;
  border: 1.5px dashed var(--pdfd-select);
  background: rgba(0, 158, 132, 0.12);
  pointer-events: none;
}
.pdfd-notes { margin: 8px 10px 0; }
.pdfd-notes-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pdfd-notes-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }

/* The stage the page sits on: a height of its own and its own scroll, so a
   page zoomed past it is scrolled here rather than moving the whole page.
   The left padding is the gutter the bands' tags are drawn in. The page is
   centred while it is smaller than the stage and starts at the stage's
   start once it is larger (margin: auto in a flex box), where every part of
   it can be scrolled to. Only the page's own handles forbid the pan, so a
   finger on the paper still scrolls the screen. */
.pdfd-design { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.pdfd-stage {
  --mm: 2.5px;
  display: flex;
  height: clamp(420px, 75vh, 1100px);
  padding: 14px 18px 14px 64px;
  overflow: auto;
  scrollbar-gutter: stable;
  background: var(--pdfd-stage);
  outline: none;
  box-sizing: border-box;
}
.pdfd-page {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: none;
  margin: auto;
  width: calc(var(--mm, 2.5px) * var(--pw, 210));
  height: calc(var(--mm, 2.5px) * var(--ph, 297));
  /* A layout's page colour (--pdfd-page-colour, set on the page only where
     it has one) is the printed document's, as an element's colour is. */
  background: var(--pdfd-page-colour, var(--pdfd-paper));
  color: var(--pdfd-ink);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.25);
}
/* A page of its own colour may be as dark as the stage around it, so it is
   edged in a faint light line that the shadow alone does not give it. */
.pdfd-page[data-pdf-page-colour] { outline: 1px solid rgba(255, 255, 255, 0.14); }
.pdfd-page-empty { margin: auto; padding: 20px; color: var(--pdfd-band-label); font-size: 13px; text-align: center; }
.pdfd-band {
  position: relative;
  flex: none;
  height: calc(var(--mm, 2.5px) * var(--bh, 20));
  border-bottom: 1px dashed var(--pdfd-band-line);
}
/* The lines band clips its table at the page's edges and its own, and not
   on the left, where its tag stands in the gutter. */
.pdfd-band-lines { flex: 1 1 0; min-height: 0; height: auto; clip-path: inset(0 0 0 -80px); }
.pdfd-band-page-footer { margin-top: auto; border-bottom: 0; border-top: 1px dashed var(--pdfd-band-line); }
.pdfd-band-lines + .pdfd-band-page-footer { margin-top: 0; }
.pdfd-band.is-selected { background: rgba(0, 158, 132, 0.05); }
/* A band's tag stands in the gutter beside the page, level with the band's
   top, so it is never written over what the band or a background draws. */
.pdfd-band-label {
  position: absolute;
  top: 0;
  right: 100%;
  z-index: 1;
  margin-right: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--pdfd-paper);
  color: var(--pdfd-band-label);
  font: 600 9.5px/1.3 var(--font-body);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}
.pdfd-band.is-selected .pdfd-band-label { background: var(--pdfd-select); color: #fff; }
.pdfd-band-edge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 8px;
  z-index: 3;
  cursor: ns-resize;
  touch-action: none;
}
.pdfd-band-edge:hover { background: rgba(0, 158, 132, 0.18); }

.pdfd-el {
  position: absolute;
  left: calc(var(--mm, 2.5px) * var(--x, 0));
  top: calc(var(--mm, 2.5px) * var(--y, 0));
  width: calc(var(--mm, 2.5px) * var(--w, 10));
  height: calc(var(--mm, 2.5px) * var(--h, 4));
  z-index: 2;
  outline: 1px dotted transparent;
  cursor: move;
  touch-action: none;
}
.pdfd-el:hover { outline-color: #8a91a6; }
.pdfd-el.is-selected { outline: 1.5px solid var(--pdfd-select); outline-offset: 1px; }
.pdfd-el.is-anchor { outline: 2.5px solid var(--pdfd-anchor); outline-offset: 1px; }
.pdfd-el.is-screen { outline: 2px dashed var(--pdfd-screen); outline-offset: 1px; }
.pdfd-el.is-dragging { opacity: 0.85; }
/* An element's own colour (--pdfd-el-ink, --pdfd-el-fill, set on it only
   where the layout gives one) is the printed document's, so it is drawn as
   the PDF draws it in either theme; where none is given the page's own ink
   stands in for the PDF's black. */
.pdfd-words { display: block; width: 100%; height: 100%; overflow: visible; fill: var(--pdfd-el-ink, var(--pdfd-ink)); }
.pdfd-words text { white-space: pre; }
.pdfd-token { fill: var(--pdfd-token); }
.pdfd-el-field .pdfd-words text,
.pdfd-tbody .pdfd-words text { fill: var(--pdfd-el-ink, var(--pdfd-token-ink)); }
.pdfd-el-rule { border-top: calc(var(--mm, 2.5px) * var(--stroke, 0.3)) solid var(--pdfd-el-ink, var(--pdfd-rule)); height: 0; }
.pdfd-el-rule.is-vertical { border-top: 0; border-left: calc(var(--mm, 2.5px) * var(--stroke, 0.3)) solid var(--pdfd-el-ink, var(--pdfd-rule)); width: 0; }
.pdfd-el-rule::after { content: ""; position: absolute; inset: -4px; }
.pdfd-el-box { border: calc(var(--mm, 2.5px) * var(--stroke, 0.3)) solid var(--pdfd-el-ink, var(--pdfd-rule)); background: var(--pdfd-el-fill, transparent); }
.pdfd-img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; user-select: none; }
.pdfd-img.is-contain { object-fit: contain; }
/* An image set when the document is made: a mark naming the input it is
   supplied on, over its top left corner, and, where it has no picture of its
   own, an empty dashed frame, since the PDF draws nothing there until a
   picture arrives. */
.pdfd-slot-empty {
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border: 1.5px dashed var(--pdfd-band-label);
  background: rgba(0, 158, 132, 0.06);
}
/* An image taking the theme's logo says so under its box rather than over
   it, since what it draws there is the logo itself. */
.pdfd-slot-mark.pdfd-logo-mark { top: calc(100% + 2px); left: 0; opacity: 0.85; }
.pdfd-slot-mark {
  position: absolute;
  top: 2px;
  left: 2px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: calc(100% - 4px);
  padding: 1px 5px 1px 3px;
  border-radius: 3px;
  background: var(--pdfd-select);
  color: #fff;
  font: 600 10px/1.4 var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.pdfd-slot-icon { width: 12px; height: 12px; flex: none; }

.pdfd-table {
  position: absolute;
  left: calc(var(--mm, 2.5px) * var(--tx, 0));
  top: 0;
  right: 0;
}
.pdfd-trow { display: flex; }
.pdfd-thead { height: calc(var(--mm, 2.5px) * var(--th, 8)); border-bottom: 1px solid var(--pdfd-rule); }
.pdfd-tbody { height: calc(var(--mm, 2.5px) * var(--tr, 6)); }
.pdfd-cell { position: relative; flex: none; overflow: hidden; cursor: pointer; }
.pdfd-cell.is-selected { background: rgba(0, 158, 132, 0.12); }
.pdfd-col-edge {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  width: 6px;
  z-index: 3;
  cursor: ew-resize;
  touch-action: none;
}
.pdfd-col-edge:hover { background: rgba(0, 158, 132, 0.25); }
.pdfd-table-note {
  margin: calc(var(--mm, 2.5px) * 6) 0 0;
  padding-right: calc(var(--mm, 2.5px) * 15);
  font: 400 11px/1.4 var(--font-body);
  color: var(--pdfd-band-label);
  text-align: center;
}

/* What a property or an element dragged from the Place pane looks like on
   its way to a band (pdf-designer.js makes it, and takes it away on drop). */
.pdfd-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: 600 12px/1.4 var(--font-body);
  white-space: nowrap;
}

.pdfd-warnings:empty { display: none; }
.pdfd-warning-list {
  list-style: none;
  margin: 0;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--sev-warn-text);
}
.pdfd-warning-list li { display: flex; gap: 6px; align-items: flex-start; }
.pdfd-warning-icon { width: 14px; height: 14px; flex: none; margin-top: 2px; }

/* The Preview takes the designer's whole width (the panes have nothing to
   place or choose in it), and its one row is the switch of lines beside the
   viewer's own bar: the viewer's section is display: contents here, so its
   bar and its stage are the grid's. The stage has a height of its own and
   fits the whole page into it (data-doc-fit, document-page.js). */
.pdfd-preview-pane { display: none; flex: 1 1 auto; min-height: 0; height: clamp(420px, 80vh, 1100px); }
#pdf-view-preview:checked ~ .pdfd-design { display: none; }
#pdf-view-preview:checked ~ .pdfd-preview-pane { display: flex; flex-direction: column; }
.pdfd-panes:has(#pdf-view-preview:checked) { grid-template-columns: minmax(0, 1fr); }
.pdfd-panes:has(#pdf-view-preview:checked) > .pdfd-place,
.pdfd-panes:has(#pdf-view-preview:checked) > .pdfd-selected { display: none; }
.pdfd-preview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
}
.pdfd-preview > .form-hint { grid-column: 1 / -1; margin: 0; padding: 10px 12px; }
.pdfd-preview-bar {
  display: flex;
  align-items: center;
  grid-column: 1;
  grid-row: 1;
  gap: 10px;
  padding: 5px 0 5px 10px;
  border-bottom: 1px solid var(--border);
}
.pdfd-preview > .docview-page { display: contents; }
.pdfd-preview .docview-page-bar { grid-column: 2; grid-row: 1; }
.pdfd-preview-note { grid-column: 1 / -1; grid-row: 2; }
.pdfd-preview > .alert.pdfd-preview-note { margin: 8px 10px 0; }
.pdfd-preview .docview-page-stage { grid-column: 1 / -1; grid-row: 3; min-height: 0; max-height: none; }

/* The Selected pane. Every form is one grid of two columns: a field is its
   label on one line over its box, so two fields on a row share a y and so do
   their boxes, and a field with nothing beside it spans the row. */
.pdfd-form { margin: 0; }
.pdfd-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}
.pdfd-grid > .is-span { grid-column: 1 / -1; }
.pdfd-field { min-width: 0; }
.pdfd-grid .form-label {
  margin: 0 0 3px;
  overflow: hidden;
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdfd-grid .form-input,
.pdfd-grid .form-select { width: 100%; height: 30px; padding: 3px 8px; font-size: 13px; }
.pdfd-tick { display: flex; align-items: center; min-height: 30px; }
/* A text block's words are a textarea, so a new line can be typed: as wide as
   the pane, taller as the reader drags it, never wider. */
.pdfd-words-area { width: 100%; min-height: 6em; resize: vertical; font: inherit; line-height: 1.4; }
.pdfd-tick.is-boxed { margin-top: 19px; }
.pdfd-what { margin: 0 0 6px; overflow-wrap: anywhere; }
.pdfd-grid > .pdfd-what { margin: 0; }
.pdfd-unit { margin: 0; color: var(--text-muted); font-size: 12px; }
.pdfd-grid > .form-hint { margin: 0; font-size: 12px; }
.pdfd-kv {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  margin: 0 0 6px;
}
.pdfd-grid > .pdfd-kv { margin: 0; }
.pdfd-kv dt { color: var(--text-muted); }
.pdfd-kv dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.pdfd-quality { margin: 6px 0; font-size: 12px; line-height: 1.5; }
.pdfd-grid > .pdfd-quality { margin: 0; }
/* A colour: the browser's own picker, the box holding #rrggbb beside it and
   the press back to the default on one row, the colour said as its parts
   under them. */
.pdfd-colour-row { display: flex; align-items: center; gap: 6px; }
.pdfd-colour-pick {
  flex: none;
  width: 36px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}
.pdfd-grid .pdfd-colour-hex { flex: 1 1 auto; min-width: 0; font-family: var(--font-mono); }
.pdfd-colour-words { display: block; margin-top: 3px; color: var(--text-muted); font-size: 12px; }
#pdf-several-colour-form { margin-top: 12px; }
.pdfd-grid > .pdfd-pane-subtitle { margin: 0; }
.pdfd-choose { width: 100%; justify-content: center; }
#pdf-image-replace-form { margin-top: 8px; }
.pdfd-source-link { display: block; margin-top: 6px; font-size: 12px; }
.pdfd-align-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pdfd-align-grid .btn { justify-content: flex-start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdfd-col-actions { display: flex; gap: 6px; margin-top: 10px; }
.pdfd-band-ticks { list-style: none; margin: 0; padding: 0; }
.pdfd-band-ticks .form-label-check { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 24px; }
.pdfd-band-ticks .form-label-check input { flex: none; margin: 0; }
.pdfd-band-words { min-width: 0; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.pdfd-band-words .text-muted { font-size: 12px; }
.pdfd-selected .form-actions { margin-top: 12px; }
.pdfd-background-pane { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
/* The page's colour, under the bands and ruled off from them as the
   background is: the layout's own, not a band's. */
.pdfd-page-colour-form { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.pdfd-page-colour-form .pdfd-pane-subtitle { display: flex; align-items: center; gap: 4px; margin-top: 0; }
.pdfd-background-pane .pdfd-pane-subtitle { display: flex; align-items: center; gap: 4px; margin-top: 0; }
.pdfd-info { display: inline-flex; color: var(--text-muted); cursor: help; }
.pdfd-info-icon { width: 14px; height: 14px; }
.pdfd-background-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.pdfd-background-actions .pdfd-image-form { flex: 1 1 auto; min-width: 0; }
.pdfd-background-pane > [data-pdf-background-status] { margin: 6px 0 0; font-size: 12px; }

/* A laptop keeps the three panes, the outer two narrower; below that the
   Selected pane goes under the page, and on a phone everything stacks. */
@media (max-width: 1280px) {
  .pdfd-panes { grid-template-columns: 184px minmax(0, 1fr) 232px; }
}
@media (max-width: 1100px) {
  .pdfd-panes { grid-template-columns: 184px minmax(0, 1fr); }
  .pdfd-selected { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 720px) {
  .pdfd-panes { grid-template-columns: minmax(0, 1fr); }
  .pdfd-place { border-right: 0; border-bottom: 1px solid var(--border); }
  .start-options { margin-left: 0; }
}

/* While its PDF output tab holds a layout being designed, a type's page
   fills the window as the workflow designer does: the page is a grid inside
   .main-content (whose height is definite), the header and the tabs one
   row, the layouts strip under them and the designer taking what is left.
   The Place pane, the stage and the Selected pane each scroll on their own,
   and the page itself does not scroll. Below 960px the page flows again. The
   tab strip's container is display: contents, so its tabs and the panel are
   the page grid's own. */
@media (min-width: 961px) {
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto minmax(0, 1fr);
    column-gap: 10px;
    height: 100%;
    padding: 8px;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) > .tool-header {
    display: flex;
    align-items: center;
    gap: 14px;
    grid-row: 1;
    grid-column: 1;
    min-width: 0;
    margin: 0;
    padding: 5px 12px;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) > .tool-header .back-link {
    flex: none;
    margin: 0;
    white-space: nowrap;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .tool-header-main {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    min-width: 0;
    gap: 10px;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .page-header-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .page-header-icon-svg { width: 16px; height: 16px; }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .tool-header-text {
    display: flex;
    align-items: baseline;
    flex: 1 1 auto;
    gap: 10px;
    min-width: 0;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .page-title {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .page-subtitle {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* The description is a sentence nobody reads beside a page being designed;
     it is on the other tabs and the list. */
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .page-subtitle:not(.page-title-code) { display: none; }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .tool-header-actions {
    flex: none;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .tool-header-actions .btn {
    height: 32px;
    min-height: 0;
    padding: 0 10px;
    font-size: 13px;
    white-space: nowrap;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) > .automate-doctype-notices { grid-row: 2; grid-column: 1 / -1; }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) > .automate-doctype-notices > .alert { margin: 8px 0 0; }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) > .tool-tabs { display: contents; }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .tool-tabs-header {
    grid-row: 1;
    grid-column: 2;
    align-self: center;
    margin: 0;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .tool-tabs-pills .tab-label { padding: 6px 12px; }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) #automate-doctype-panel-pdf {
    display: flex;
    flex-direction: column;
    grid-row: 3;
    grid-column: 1 / -1;
    min-height: 0;
    margin-top: 8px;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) #pdf-output { flex: 1 1 auto; min-height: 0; }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-designer { flex: 1 1 auto; min-height: 0; }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-panes {
    flex: 1 1 auto;
    grid-template-columns: 200px minmax(0, 1fr) 260px;
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-panes:has(#pdf-view-preview:checked) { grid-template-columns: minmax(0, 1fr); }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-place,
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-selected {
    min-height: 0;
    overflow: auto;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-centre { min-height: 0; }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-stage,
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-preview-pane {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-warnings {
    flex: none;
    max-height: 30%;
    overflow: auto;
  }
}
/* A laptop narrower than that keeps the three panes, narrower, rather than
   putting the Selected pane under a page that fills the window; the header's
   row gives up the type's code and the tabs' icons before the type's name. */
@media (min-width: 961px) and (max-width: 1280px) {
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-panes { grid-template-columns: 184px minmax(0, 1fr) 232px; }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-selected {
    grid-column: auto;
    border-top: 0;
    border-left: 1px solid var(--border);
  }
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .page-title-code,
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .tool-tabs-pills .tab-label svg { display: none; }
}
/* A wide screen gives the panes the room their longer names want: a part's
   property ("Supplier address: Postcode") and a font's ("House Serif
   (uploaded)") are whole there. */
@media (min-width: 1600px) {
  .automate-doctype-page:has(#automate-doctype-tab-pdf:checked):has(#pdf-designer) .pdfd-panes { grid-template-columns: 240px minmax(0, 1fr) 300px; }
}

/* A PDF a run made, on a row of its own under its file on the Files tab, by
   the page stage a document view draws its page in, behind a disclosure so a
   run of many files opens on the list. It takes the table's whole width, and
   the page is fitted whole to a stage of its own height and centred. */
.automate-run-files tr:has(+ .automate-run-pdf-row) > td { border-bottom: 0; }
.automate-run-pdf-row > td { padding-top: 0; }
.automate-run-pdf > summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.automate-run-pdf .docview-page { margin-top: 6px; }
.automate-run-pdf .docview-page-stage { height: min(80vh, 1000px); max-height: none; }

/* A Model box offered its provider's models (the model-choice partials): a
   value the provider does not list is kept and marked, in the warning's
   colour, under the box. */
.model-choice-unlisted { display: flex; align-items: center; gap: 4px; color: var(--sev-warn-text); margin: 4px 0 0; }
.model-choice-mark { width: 14px; height: 14px; flex: none; }
.model-choice-problem { margin: 4px 0 0; }
.form-input.is-unlisted { border-color: var(--sev-warn-border); }
.model-choice { min-width: 0; }

/* The PDF a step drew on the node library's bench, under its download, drawn
   whole in a stage of its own height as a run's PDF is on its Files tab. */
.automate-give-pdf { margin-top: 8px; }
.automate-give-pdf .docview-page-stage { height: min(70vh, 820px); max-height: none; }

/* The date control (the date-control partial) on a run screen, a
   workbench's start modal and a wizard page as on the bench: the row takes
   the field's width, and the calendar button's icon is drawn in the text's
   colour of the theme, where the browser's own date box drew its picker in
   a colour of its own that the dark theme all but hid. */
.date-control { max-width: 100%; }
.date-control .date-control-open .btn-icon { color: var(--text); }
/* On a run screen the row is as wide as the field's other boxes, the
   buttons taking their room out of the box rather than past it. */
.run-field > .date-control { max-width: var(--run-field-width); }
.run-field .date-control > .form-input { min-width: 10rem; }

/* A document type's Checks tab: Validate's shield in its own colour where
   the theme gives one, beside the tab's word and each heading. */
svg.automate-doctype-checks-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -3px;
  color: var(--module-validate, var(--accent));
}

.automate-doctype-checks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* The Checks tab's table: the field and the check have room to be read, the
   condition and the severity are narrow, and why takes what is left. */
.data-table.automate-doctype-checks-table th.automate-doctype-checks-field-col { width: 18%; }
.data-table.automate-doctype-checks-table th.automate-doctype-checks-check-col { width: 28%; }
.data-table.automate-doctype-checks-table th.automate-doctype-checks-when-col { width: 16%; }
.data-table.automate-doctype-checks-table th.automate-doctype-checks-sev-col { width: 96px; }
.data-table.automate-doctype-checks-table td { vertical-align: top; }
.automate-doctype-check-asks { margin-top: 2px; }
.automate-doctype-check-from { white-space: nowrap; }
.data-table.automate-doctype-checks-table td.col-actions,
.data-table.automate-doctype-checks-table th.col-actions { width: 1%; text-align: right; }


/* The one way of setting up one of Validate's checks outside its Package
   Designer (check_configure.html): the Check Library's cards, three a row
   where there is room, the chosen one outlined; the chosen check named above
   every later step; a condition's field, test and value on one row; the
   settings two a row; the check's own sentence under them; and the boxes a
   sentence is typed into, the dialog's width. */
/* One height whatever step shows, so Next and Back stay under the pointer:
   the dialog is sized, and its body takes what the head and foot leave. */
#check-cfg-dialog[open] { height: min(88vh, 860px); }
.check-cfg-form .modal-body { overflow: auto; }
.check-cfg-lead { margin-top: 0; }
.check-cfg-search { max-width: 420px; margin: 6px 0 4px; }
.check-cfg-field { max-width: 420px; }
.check-cfg-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .check-cfg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .check-cfg-cards { grid-template-columns: minmax(0, 1fr); } }
.check-cfg-card { cursor: pointer; text-align: left; }
.check-cfg-card.is-chosen { outline: 2px solid var(--accent); outline-offset: -1px; }
.check-cfg-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-cfg-chosen {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--accent-dim);
}
svg.check-cfg-chosen-icon { width: 20px; height: 20px; flex: none; color: var(--accent); margin-top: 2px; }
.check-cfg-chosen-desc { margin: 2px 0 0; }
.check-cfg-cond {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.check-cfg-cond-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.check-cfg-logic { width: auto; }
.check-cfg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; }
@media (max-width: 640px) { .check-cfg-grid, .check-cfg-cond { grid-template-columns: minmax(0, 1fr); } }
.check-cfg-flag { display: flex; align-items: center; gap: 8px; }
.check-cfg-sentence {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}
svg.check-cfg-sentence-icon { width: 16px; height: 16px; flex: none; color: var(--module-validate, var(--accent)); }
.check-cfg-wide { width: 100%; }
/* The severity cards on one row, each an equal share, wherever a check is set
   up: four of them wrapped three and one in the Package Designer. */
.pkgd-kindrow.check-cfg-sevs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.pkgd-kindrow.check-cfg-sevs .pkgd-kindcard { min-width: 0; width: auto; }
