﻿/* Nocturne — the design system this application's interface is drawn from.
   Ported from the Claude Design project's `_ds/nocturne-…/styles.css` together with the two
   overrides both page designs carry inline: the accent is replaced with green, and a light theme
   is layered over what is otherwise a dark-first system.

   Two scoping rules keep this file from fighting `site.css`, which still dresses every page that
   has not been redesigned yet:

     · Tokens, the shell chrome (`.oa-*`) and the theme control are GLOBAL. They have to be —
       the rail is on every page, and a dark mode that stopped at the redesigned ones would be
       worse than none.
     · Every base element rule and every component class is scoped under `.oa`, which the layout
       puts on a page's content column only when that page has been redesigned. `site.css` owns
       bare `h1`, `table` and `.tag`; without the prefix the two files would take turns winning
       depending on load order, which is not a thing anybody should have to reason about.

   `site.css` reads the tokens below for its own three variables, so legacy pages follow the
   theme without being restyled. */

/* ══════════════════════════════════════════════════════════════════════════════════════════
   Tokens — dark is the base, light is the override. Both are complete: nothing here resolves
   against a value defined only in the other block.
   ══════════════════════════════════════════════════════════════════════════════════════════ */

:root {
  --color-bg: #161826;
  --color-surface: #232532;
  --color-text: #e9e9ed;
  --color-divider: color-mix(in srgb, #e9e9ed 16%, transparent);

  /* Declared, and not only for form controls. Without it Chrome decides the page is a light one
     that has not been told about dark mode and repaints it at composite time — which leaves the
     computed styles saying one thing and the pixels showing another, and is unanswerable from
     CSS. Saying which scheme is in force turns that off and hands the decision back to the
     tokens above. */
  color-scheme: dark;

  /* Nocturne ships a blurple accent. This application overrides it to green, which is the mark's
     own colour — the logo has been green since before there was an interface around it. The ramp
     is the design's, kept whole so `--color-accent-N` still means the same step it does there. */
  --color-accent: #5cc27a;
  --color-accent-100: #eefaf1;
  --color-accent-200: #d6f2de;
  --color-accent-300: #aee6c1;
  --color-accent-400: #7fd39c;
  --color-accent-500: #5cc27a;
  --color-accent-600: #3f9c5d;
  --color-accent-700: #2c7545;
  --color-accent-800: #215333;
  --color-accent-900: #193324;

  /* Tonal ramp — generated in OKLCH on one shared lightness scale, so the same step of any role
     matches the others in visual value. */
  --color-neutral-100: #f3f5fe;
  --color-neutral-200: #e4e7f5;
  --color-neutral-300: #cfd3e5;
  --color-neutral-400: #b2b6ca;
  --color-neutral-500: #9397ab;
  --color-neutral-600: #75798c;
  --color-neutral-700: #595d6c;
  --color-neutral-800: #3f424d;
  --color-neutral-900: #292b31;

  --font-heading: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-heading-weight: 500;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: Consolas, "Courier New", monospace;

  --space-1: 2.8px;
  --space-2: 5.6px;
  --space-3: 8.4px;
  --space-4: 11.2px;
  --space-5: 14px;
  --space-6: 16.8px;
  --space-8: 22.4px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  /* Elevation is derived from the ground: a hairline edge plus ambient darkness on a dark theme,
     soft ink-tinted shadow on a light one. */
  --shadow-sm: 0 0 0 1px #3f424d;
  --shadow-md: 0 0 0 1px #595d6c, 0 6px 18px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 0 0 1px #9397ab, 0 16px 40px rgba(0, 0, 0, 0.65);

  /* Status roles. The accent carries "good" wherever a tag can borrow it, but a figure that is
     merely fine should not shout in the brand colour, so `--oa-ok-fg` is a quieter green. */
  --oa-ok-fg: #7fd39c;
  --oa-ok-dot: #4f9d76;
  --oa-warn-fg: #e8b567;
  --oa-warn-bg: color-mix(in srgb, #c98a2e 22%, transparent);
  --oa-warn-bd: color-mix(in srgb, #c98a2e 50%, transparent);
  --oa-danger-fg: #f0a09b;
  --oa-danger-bd: color-mix(in srgb, #f0a09b 45%, transparent);
  --oa-danger-bg: color-mix(in srgb, #c9534e 14%, transparent);

  /* The mark's ring and ticks: solid, so overlapping strokes do not darken (Shared/_Mark). */
  --oa-mark-ink: color-mix(in srgb, var(--color-text) 78%, var(--color-bg));
}

[data-theme="light"] {
  color-scheme: light;

  --color-bg: #f4f5fb;
  --color-surface: #fdfdff;
  --color-text: #292b31;
  --color-divider: color-mix(in srgb, #292b31 14%, transparent);

  --color-accent: #2b7a4b;

  --shadow-sm: 0 0 0 1px #dfe2ee;
  --shadow-md: 0 0 0 1px #dfe2ee, 0 6px 18px rgba(41, 43, 49, 0.10);
  --shadow-lg: 0 0 0 1px #cfd3e5, 0 18px 44px rgba(41, 43, 49, 0.18);

  --oa-ok-fg: #26663f;
  --oa-warn-fg: #8a5a12;
  --oa-warn-bg: color-mix(in srgb, #c98a2e 18%, transparent);
  --oa-warn-bd: color-mix(in srgb, #c98a2e 45%, transparent);
  --oa-danger-fg: #b8443f;
  --oa-danger-bd: color-mix(in srgb, #c9534e 55%, transparent);
  --oa-danger-bg: color-mix(in srgb, #c9534e 8%, transparent);
}

/* The signed-out pages (_SignedOutLayout) have no account yet whose choice to honour, so they
   follow the browser: light unless it asks for dark. The same values as the block above, which
   this must be kept in step with; a selector cannot be put inside a media query any other way. */
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    color-scheme: light;

    --color-bg: #f4f5fb;
    --color-surface: #fdfdff;
    --color-text: #292b31;
    --color-divider: color-mix(in srgb, #292b31 14%, transparent);

    --color-accent: #2b7a4b;

    --shadow-sm: 0 0 0 1px #dfe2ee;
    --shadow-md: 0 0 0 1px #dfe2ee, 0 6px 18px rgba(41, 43, 49, 0.10);
    --shadow-lg: 0 0 0 1px #cfd3e5, 0 18px 44px rgba(41, 43, 49, 0.18);

    --oa-ok-fg: #26663f;
    --oa-warn-fg: #8a5a12;
    --oa-warn-bg: color-mix(in srgb, #c98a2e 18%, transparent);
    --oa-warn-bd: color-mix(in srgb, #c98a2e 45%, transparent);
    --oa-danger-fg: #b8443f;
    --oa-danger-bd: color-mix(in srgb, #c9534e 55%, transparent);
    --oa-danger-bg: color-mix(in srgb, #c9534e 8%, transparent);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
}

/* ══════════════════════════════════════════════════════════════════════════════════════════
   The shell — global, because the rail is on every page whether or not its content has been
   redesigned. Named `.oa-*` throughout so nothing here can collide with `site.css`.
   ══════════════════════════════════════════════════════════════════════════════════════════ */

.oa-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}

.oa-rail {
  width: 226px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-4);
  border-right: 1px solid var(--color-divider);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.oa-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 17px;
  letter-spacing: -0.01em;
}

.oa-brand .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The mark (Shared/_Mark.cshtml) follows the theme: the ring and the four ticks in a solid ink
   mixed from the text and the ground, the two arcs in the accent. Solid, not the text colour at an
   opacity: the ticks cross the ring, and two translucent strokes darken where they overlap. Sized
   on whole pixels so its 27/250 stroke lands on the pixel grid as nearly as it can. */
.mark { display: block; flex: none; overflow: visible; }
.mark .ring { stroke: var(--oa-mark-ink); }
.mark .arc { stroke: var(--color-accent); }
.oa-brand .mark { width: 28px; height: 28px; }

/* — the workspace identity, under the brand (D46) —
   The brand and the workspace are one group, closer to each other than to the rail's links. A
   switcher is a <details> with a hairline box and a caret; a label has neither, so it does not
   look as if it opens. The list opens in place, pushing the links down, as the user menu does. */
.oa-head { display: flex; flex-direction: column; gap: var(--space-3); }

.oa-ws > summary,
.oa-ws.static {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--color-text);
}

.oa-ws > summary {
  border: 1px solid var(--color-divider);
  cursor: pointer;
  list-style: none;
}

.oa-ws > summary::-webkit-details-marker { display: none; }
.oa-ws > summary:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.oa-ws > summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.oa-ws[open] > summary { background: color-mix(in srgb, var(--color-text) 4%, transparent); }

.oa-ws .i { width: 16px; height: 16px; flex: none; color: color-mix(in srgb, var(--color-text) 60%, transparent); }
.oa-ws .caret { width: 12px; height: 12px; color: color-mix(in srgb, var(--color-text) 45%, transparent); }

.oa-ws-logo { width: 24px; height: 24px; flex: none; border-radius: 6px; object-fit: contain; }

.oa-ws-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.oa-ws .oa-spaces { padding: var(--space-2) 0 0; }

/* A branded workspace's accent tints the page you are on: the fill and the leading bar take it,
   the text keeps the ink, so an accent chosen against one theme still reads in the other. */
.oa-shell.branded .oa-nav a[aria-current="page"] {
  color: var(--color-text);
  background: color-mix(in srgb, var(--oa-brand) 16%, transparent);
  box-shadow: inset 3px 0 0 var(--oa-brand);
}

.oa-nav { display: flex; flex-direction: column; gap: 2px; }

.oa-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 14px;
  color: var(--color-text);
}

.oa-nav a:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }

/* The page you are on is stated three ways — colour, fill, and a bar down the leading edge — so
   it survives a high-contrast mode that drops two of them. */
.oa-nav a[aria-current="page"] {
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  box-shadow: inset 2px 0 0 var(--color-accent);
}

.oa-nav a .i { width: 16px; height: 16px; flex: none; }

/* One-sided fade, unlike the symmetric `.hr`: it separates two groups inside a 226px column, and
   a rule that faded at the rail's edge too would read as a smudge rather than a division. */
.oa-nav .group-rule {
  height: 1px;
  margin: var(--space-3) 0;
  border: 0;
  background: linear-gradient(to right, var(--color-divider), transparent);
}

/* Admin, System Settings and the signed-in row, pinned to the bottom above a hairline. */
.oa-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

.oa-foot .kicker {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

.oa-foot .who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}

.oa-foot .who .i { width: 18px; height: 18px; flex: none; }

.oa-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.oa-content > main { padding: var(--space-8) calc(var(--space-8) * 1.4); }

/* A page that fills the window instead of growing past it. Both editors ask for it: they are
   worked in rather than read, so their own scrollers have to be what moves and the page behind
   them has to stay still. */
.oa-shell.fixed { height: 100vh; overflow: hidden; }
.oa-shell.fixed .oa-content { min-height: 0; }
.oa-shell.fixed .oa-content > main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.oa-shell.fixed.flush .oa-content > main { padding: 0; }

/* Only ever seen on a narrow window: the rail folds away and this is what opens it. A checkbox
   rather than script, so it cannot show the wide layout first while a bundle loads. */
.oa-topbar { display: none; }
.oa-nav-state { display: none; }

@media (max-width: 55rem) {
  .oa-rail {
    position: fixed;
    z-index: 40;
    left: 0;
    top: 0;
    background: var(--color-bg);
    transform: translateX(-100%);
    transition: transform .15s ease-out;
    pointer-events: none;
  }

  .oa-nav-state:checked ~ .oa-shell .oa-rail { transform: none; pointer-events: auto; }

  .oa-topbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-divider);
  }

  .oa-topbar .toggle {
    cursor: pointer;
    display: inline-flex;
    padding: 4px 7px;
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-sm);
  }

  .oa-topbar .toggle .i { width: 16px; height: 16px; }
  .oa-topbar .here { font-size: 13px; color: color-mix(in srgb, var(--color-text) 65%, transparent); }
  .oa-content > main { padding: var(--space-6) var(--space-4); }
}

/* ══════════════════════════════════════════════════════════════════════════════════════════
   Everything below is scoped to `.oa` — a redesigned page's content column.
   ══════════════════════════════════════════════════════════════════════════════════════════ */

.oa h1, .oa h2, .oa h3, .oa h4, .oa h5, .oa h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
}

.oa h1 { font-size: 42px; }
.oa h2 { font-size: 32px; }
.oa h3 { font-size: 25px; }
.oa h4 { font-size: 20px; }
.oa h5 { font-size: 16px; }
.oa h6 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }

.oa p { margin: 0 0 var(--space-3); }
.oa a { color: var(--color-accent); text-underline-offset: 3px; }
.oa img { display: block; max-width: 100%; }

.oa :focus { outline: none; }
.oa :focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.oa ::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

.oa .text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.oa .mono { font-family: var(--font-mono); font-size: .85em; }
.oa .nw { white-space: nowrap; }
.oa .num { font-variant-numeric: tabular-nums; }

/* — rules —
   Rules fade to transparent at both ends instead of stopping cleanly. The ramp is 48px an end,
   painted from the divider token. Freestanding rules fade; box outlines and short accent marks
   stay solid. */
.oa .hr {
  height: 1px;
  border: 0;
  margin: var(--space-4) 0;
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent);
}

/* — buttons — */
.oa .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 14px;
  line-height: 1.2;
  color: var(--color-text);
  background: transparent;
  border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}

.oa .btn .i { width: 15px; height: 15px; flex: none; }
.oa .btn:disabled { opacity: .4; cursor: not-allowed; }

.oa .btn-primary { color: var(--color-accent); border-color: var(--color-accent); }
.oa .btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.oa .btn-primary:active:not(:disabled) { background: color-mix(in srgb, var(--color-accent) 22%, transparent); }

.oa .btn-secondary { border-color: var(--color-divider); }
.oa .btn-secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.oa .btn-secondary:active:not(:disabled) { background: color-mix(in srgb, var(--color-text) 14%, transparent); }

.oa .btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.oa .btn-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.oa .btn-ghost:active:not(:disabled) { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }

.oa .btn-icon { width: 36px; height: 36px; padding: 0; }
.oa .btn-danger { color: var(--oa-danger-fg); border-color: var(--oa-danger-bd); }
.oa .btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--oa-danger-fg) 12%, transparent); }
.oa .btn-sm { font-size: 12px; }
.oa .btn-sm .i { width: 13px; height: 13px; }

/* — forms — */
.oa .field { margin: 0; }
.oa .field > label {
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}

.oa .input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}

.oa .input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.oa .input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.oa textarea.input { min-height: 90px; resize: vertical; }
.oa select.input { appearance: none; padding-right: 26px; }

/* A control with something laid over it — a search glyph, a select's caret. */
.oa .adorned { position: relative; display: block; }
.oa .adorned > .i {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  width: 15px;
  height: 15px;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}
.oa .adorned > .i.lead { left: 10px; }
.oa .adorned > .i.trail { right: 9px; width: 12px; height: 12px; opacity: .6; }
.oa .adorned > .input.has-lead { padding-left: 31px; }

.oa .check { accent-color: var(--color-accent); width: 15px; height: 15px; }

/* — segmented control —
   One component for every either/or on the site: the theme picker (buttons), the calendar's month
   and week (links), and the designer's, library's and site dialog's radios (labels wrapping a
   hidden radio). Whichever it is, the chosen option is `.on`, `[aria-pressed="true"]`,
   `[aria-current]` or a label holding a checked radio.

   The frame is padded and the options are rounded inside it, so the chosen one is a whole pill
   sitting in the frame. It used to be an inset ring on a square option with the frame clipping
   it (`overflow: hidden`), which cut the ring off at whichever end was rounded. */
.oa .seg, .oa-foot .seg {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
  vertical-align: middle;
}

.oa .seg-opt, .oa-foot .seg-opt {
  position: relative;
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 5px 12px;
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: calc(var(--radius-md) - 3px);
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  color: color-mix(in srgb, var(--color-text) 72%, transparent);
}

.oa .seg-opt input, .oa-foot .seg-opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.oa .seg-opt:hover, .oa-foot .seg-opt:hover {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-text) 7%, transparent);
}

.oa .seg-opt.on, .oa .seg-opt[aria-pressed="true"], .oa .seg-opt[aria-current]:not([aria-current="false"]),
.oa .seg-opt:has(input:checked),
.oa-foot .seg-opt.on, .oa-foot .seg-opt[aria-pressed="true"] {
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 13%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-accent) 60%, transparent);
}

.oa .seg-opt:focus-visible, .oa-foot .seg-opt:focus-visible,
.oa .seg-opt:has(input:focus-visible) {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  z-index: 1;
}

.oa .seg-opt .i, .oa-foot .seg-opt .i { width: 14px; height: 14px; flex: none; }

/* The rail's theme picker fills the column. */
.oa-foot .seg { display: flex; width: 100%; }

/* — the space switcher — */

.oa-spaces { display: flex; flex-direction: column; gap: 2px; }

.oa-space {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  appearance: none;
  background: none;
  border: 0;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 13px;
  text-align: left;
  color: color-mix(in srgb, var(--color-text) 78%, transparent);
  cursor: pointer;
}

.oa-space .i { width: 15px; height: 15px; flex: none; }

.oa-space:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }

.oa-space.on {
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
}

.oa-space:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* — the signed-in row —
   Initials, email and what the account is here, with a caret; opening it shows the menu under it.
   A <details>, so it opens and closes with no script. */
.oa-user > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  list-style: none;
}

.oa-user > summary::-webkit-details-marker { display: none; }
.oa-user > summary:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.oa-user > summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.oa-avatar {
  width: 27px;
  height: 27px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 11px;
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
  color: var(--color-accent);
}

.oa-user-text { min-width: 0; flex: 1; }

.oa-user .caret {
  width: 12px;
  height: 12px;
  flex: none;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}

.oa-user-menu {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) 6px 2px;
}

.oa-user-name { font-size: 13px; }

/* Long text truncates in fixed-width chrome, as the design asks of the sidebar email. */
.oa-user .who-name { display: block; font-size: 12.5px; color: var(--color-text); }

.oa-user .who-name,
.oa-user .who-role {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oa-user .who-role {
  display: block;
  font-size: 10.5px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

/* — account settings and sign out, under a hairline at the foot of the menu — */
.oa-user-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-divider);
}

.oa-user-actions form { margin: 0; }

.oa-user-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  appearance: none;
  background: none;
  border: 0;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  text-decoration: none;
  color: color-mix(in srgb, var(--color-text) 75%, transparent);
  cursor: pointer;
}

.oa-user-link .i { width: 15px; height: 15px; flex: none; }

.oa-user-link:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }

.oa-user-link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* — the branding rows and form on Admin → Settings (D46) — */
.oa .brand-logo-preview {
  width: 32px;
  height: 32px;
  margin-right: 8px;
  border-radius: 6px;
  object-fit: contain;
  vertical-align: middle;
}

.oa .brand-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  border: 1px solid var(--color-divider);
  border-radius: 4px;
  vertical-align: middle;
}

.oa .brand-colour { width: 52px; padding: 2px; }

/* — cards — */
.oa .card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.oa .card-kicker {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.oa .card-figure {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 26px;
  line-height: 1.1;
}

.oa .card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}

.oa .elev-sm { box-shadow: var(--shadow-sm); }
.oa .elev-md { box-shadow: var(--shadow-md); }
.oa .elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.oa .tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: calc(var(--radius-md) * 0.75);
}

.oa .tag .i { width: 12px; height: 12px; flex: none; }
.oa .tag-accent { background: var(--color-accent-800); color: var(--color-accent-100); }
.oa .tag-neutral { background: var(--color-neutral-800); color: var(--color-neutral-100); }
.oa .tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }

[data-theme="light"] .oa .tag-accent { background: var(--color-accent-200); color: var(--color-accent-700); }
[data-theme="light"] .oa .tag-neutral { background: var(--color-neutral-200); color: var(--color-neutral-700); }

.oa .tag-ok {
  background: color-mix(in srgb, var(--color-accent) 16%, transparent);
  color: var(--oa-ok-fg);
  border: 1px solid color-mix(in srgb, var(--color-accent) 45%, transparent);
}

.oa .tag-warn {
  background: var(--oa-warn-bg);
  color: var(--oa-warn-fg);
  border: 1px solid var(--oa-warn-bd);
}

/* A toggle that looks like a tag — the report chips in the site dialog. */
.oa .tag-toggle {
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  padding: 4px 11px;
  border: 1px solid var(--color-divider);
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 65%, transparent);
  border-radius: calc(var(--radius-md) * 0.75);
}

.oa .tag-toggle:has(input:checked), .oa .tag-toggle.on {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 16%, transparent);
  color: var(--color-accent);
}

.oa .tag-toggle input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }

/* A live dot beside a word. Its own colour rather than the accent: "connected" is a state of the
   world, not a brand moment, and it sits next to accent-coloured links. */
.oa .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--oa-ok-dot);
  flex: none;
}

.oa .state-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

/* — tables — */
.oa .scroll-x { overflow-x: auto; }

.oa .table { width: 100%; border-collapse: collapse; font-size: 14px; }

.oa .table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2);
  border-bottom: 1px solid transparent;
  font-weight: var(--font-heading-weight);
}

.oa .table td { padding: var(--space-2); border-bottom: 1px solid transparent; }

/* Row rules are painted on the row rather than the cell, so one fade spans the whole row instead
   of restarting at every column boundary. */
.oa .table thead tr {
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}

.oa .table tbody tr {
  background: linear-gradient(to right,
    transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
    color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent)
    no-repeat bottom / 100% 1px;
}

.oa .table tbody tr:hover {
  background:
    linear-gradient(color-mix(in srgb, var(--color-text) 4%, transparent),
                    color-mix(in srgb, var(--color-text) 4%, transparent)) no-repeat 0 0 / 100% 100%,
    linear-gradient(to right,
      transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
      color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent)
      no-repeat bottom / 100% 1px;
}

/* A column header that sorts. It is a button because it does something; it is dressed as a header
   because that is where the eye looks for it. */
.oa .sort {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.oa .sort:hover { color: var(--color-accent); }
.oa .sort .i { width: 11px; height: 11px; opacity: .55; }
.oa .sort[aria-sort] .i { opacity: 1; color: var(--color-accent); }

/* — dialog — */
.oa .dialog-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent);
  backdrop-filter: blur(2px);
  z-index: 40;
}

.oa .dialog {
  width: min(660px, 100%);
  max-height: 88vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

.oa .dialog-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 20px; }
.oa .dialog-sub { font-size: 12px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.oa .dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* A bordered group inside the dialog — the provider credentials. */
.oa .panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
}

.oa .panel-kicker {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
}

/* The one destructive control on the page, dressed so it reads as one before it is clicked. */
.oa .danger-zone {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--oa-danger-bd);
  background: var(--oa-danger-bg);
}

.oa .danger-zone .title {
  font-size: 13px;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  color: var(--oa-danger-fg);
}

.oa .problem {
  font-size: 13px;
  color: var(--oa-danger-fg);
  margin: 0;
}

/* — page furniture shared by both site screens — */
.oa .page-head {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.oa .page-head .grow { margin-right: auto; }
.oa .page-head h2 { margin: 0 0 2px; }
.oa .page-sub { font-size: 13px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }

.oa .filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.oa .filters .search { flex: 1 1 260px; max-width: 320px; }
.oa .filters .adorned .input { width: auto; min-width: 170px; }
.oa .filters .search .input { width: 100%; }

.oa .section-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.oa .section-head h4 { margin: 0; }
.oa .section-head .grow { margin-left: auto; }

.oa .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3);
  margin: var(--space-6) 0;
}

.oa .pager {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.oa .pager .count {
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  margin-right: auto;
}

.oa .chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.oa .row-actions { text-align: right; white-space: nowrap; }
.oa .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

@media (max-width: 40rem) {
  .oa .grid-2 { grid-template-columns: 1fr; }
  .oa .page-head { flex-wrap: wrap; }
}

/* The bulk bar appears when something is ticked. `:has()` rather than script: the checkboxes are
   already in the form, and the browser knows whether any is checked without being told. */
.oa .bulk-bar {
  display: none;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.oa form:has(.row-check:checked) .bulk-bar { display: flex; }

.oa .bulk-bar .label {
  font-size: 13px;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  margin-right: auto;
}

/* The site cell: a domain you click and the client it belongs to underneath. */
.oa .site-cell { padding-top: var(--space-3); padding-bottom: var(--space-3); }

.oa .site-cell .domain {
  display: block;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 15px;
  text-decoration: none;
  color: var(--color-accent);
}

.oa .site-cell .client { font-size: 12px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }

.oa .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  text-decoration: none;
}

.oa .back-link .i { width: 13px; height: 13px; }

.oa .meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}

.oa .meta-line .sep { opacity: .45; }
.oa .meta-line .live { display: inline-flex; align-items: center; gap: 6px; color: var(--color-text); }

.oa .empty {
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  font-size: 14px;
  padding: var(--space-6) 0;
}

.oa .outcome {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-accent) 45%, transparent);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
  font-size: 13px;
  margin-bottom: var(--space-4);
}

.oa .outcome.failed {
  border-color: var(--oa-danger-bd);
  background: var(--oa-danger-bg);
  color: var(--oa-danger-fg);
}

/* Icons are drawn from one inline sprite, so a page carries each shape once however many times it
   uses it. `currentColor` throughout — an icon beside a word is that word's colour. */
.i { display: inline-block; width: 16px; height: 16px; fill: currentColor; vertical-align: -0.15em; }

/* — the site dialog —
   A real <dialog>, so the browser supplies the modal behaviour the design draws: a backdrop, a
   focus trap, and Escape. `.dialog-backdrop` above is what a non-modal overlay would use; this is
   the same look expressed as ::backdrop. */
.oa dialog.dialog {
  border: 0;
  margin: auto;
  color: var(--color-text);
}

.oa dialog.dialog:not([open]) { display: none; }

.oa dialog.dialog::backdrop {
  background: rgba(22, 24, 38, 0.55);
  backdrop-filter: blur(2px);
}

[data-theme="light"] .oa dialog.dialog::backdrop { background: rgba(41, 43, 49, 0.35); }

.oa dialog.dialog > form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.oa .dialog-head { display: flex; align-items: flex-start; gap: var(--space-4); }
.oa .dialog-head .grow { margin-right: auto; }

/* One cadence's worth of chips, with the cadence named beside them. The label is what stops two
   identical rows of the same template names reading as a duplicate. */
.oa .chip-row { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-2); }

.oa .chip-row-label {
  flex: none;
  width: 56px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

/* A report chip no offering the client holds allows is greyed rather than hidden: somebody
   looking for it should find it and learn what it needs, not conclude the design is missing. */
.oa .tag-toggle.unavailable { opacity: .45; }

.oa .collection-row { display: flex; align-items: center; gap: var(--space-4); }
.oa .collection-row .grow { margin-right: auto; }

.oa .collection-title {
  font-size: 14px;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
}

.oa .danger-zone .grow { margin-right: auto; }

/* Present for a screen reader, absent for everyone else — the label on a control the design
   identifies by its glyph alone. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════════════════
   The template designer.

   A ribbon over a sheet over a status bar, filling the window. The screen never scrolls; the
   paper does. Everything here is scoped under `.dsg` so none of it reaches the other pages.
   ══════════════════════════════════════════════════════════════════════════════════════════ */

.oa .dsg {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* — the title bar — */
.oa .dsg-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-surface);
  flex: none;
}

.oa .dsg-picker { font-size: 13px; padding: 5px 10px; height: 30px; gap: 8px; }
.oa .dsg-picker .name { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }
.oa .dsg-picker .caret { width: 11px; height: 11px; opacity: .6; }
.oa .dsg-title .scope { font-size: 10px; }
.oa .dsg-title .right { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.oa .dsg-title .bar { width: 1px; height: 20px; background: var(--color-divider); }

.oa .dsg-title .save-state {
  font-size: 11.5px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

.oa .accent { color: var(--color-accent); }

/* — the tab strip — */
.oa .dsg-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-surface);
  flex: none;
}

.oa .dsg-tabs > button[data-tab] {
  appearance: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-family: var(--font-heading);
  cursor: pointer;
  padding: 9px 13px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  color: color-mix(in srgb, var(--color-text) 62%, transparent);
}

.oa .dsg-tabs > button[data-tab]:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

.oa .dsg-tabs > button[data-tab]:hover { color: var(--color-text); }

.oa .dsg-tabs > button[data-tab].current {
  border-bottom-color: var(--color-accent);
  color: var(--color-accent);
  font-weight: var(--font-heading-weight);
}

.oa .dsg-tabs .collapse {
  margin-left: auto;
  align-self: center;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}

/* — the ribbon — */
.oa .dsg-ribbon {
  display: flex;
  align-items: stretch;

  /* One height for every tab. The groups differ — a tab of large buttons is taller than a tab of
     number boxes — and left to their content the ribbon changed height on every tab click, which
     moved the paper under the pointer. Each group's label is pushed to the bottom by its own
     margin, so switching tabs changes what is in the ribbon and nothing else.

     A minimum rather than a fixed height, deliberately: this is the tallest tab's own height
     today, and a group added later that needed more would make the ribbon grow rather than clip.
     A returning jump is visible and gets fixed; a control quietly cut off the bottom is not.

     The tallest tab is the Format tab with one shape selected, whose text box is two rows deep.
     What a tab shows depends on the selection as well as on which tab it is, so the number has to
     clear the tallest of those states and not merely the tallest tab with nothing selected — that
     was the 128 this replaces, and it left the ribbon growing the moment anything was picked. */
  min-height: 143px;

  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  background: color-mix(in srgb, var(--color-surface) 70%, var(--color-bg));
  overflow-x: auto;
  flex: none;
}

.oa .ribbon-tab { display: flex; align-items: stretch; }
.oa .ribbon-groups { display: flex; align-items: stretch; }

/* Anything given a display beats the hidden attribute's own rule, and this screen sets one on
   nearly everything: ribbon tabs, group rows, library rows, the rename strip. Rather than a
   matching :not([hidden]) on each, hidden wins outright inside the designer — every use of it
   here means "this does not apply to what is selected", and none of them ever wants overriding. */
.oa .dsg [hidden], .oa .gph [hidden], .oa dialog [hidden] { display: none !important; }

.oa .grp {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  padding: 0 var(--space-3);
  flex: none;
}

.oa .grp-l {
  font-size: 9.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  margin-top: auto;
}

.oa .grp .row { display: flex; align-items: center; gap: 3px; }
.oa .grp .stack { display: flex; flex-direction: column; gap: 2px; }

.oa .div {
  width: 1px;
  align-self: stretch;
  flex: none;
  background: linear-gradient(to bottom,
    transparent, var(--color-divider) 20%, var(--color-divider) 80%, transparent);
}

/* A group whose controls need a selection dims as a whole, so the reason they are unavailable
   reads once rather than once per button. */
.oa .grp.off { opacity: .5; }

/* — ribbon buttons —
   Three sizes, all of them borderless until hovered, because a ribbon of outlined buttons is a
   wall of boxes. */
.oa .btn.rb {
  font-size: 12px;
  padding: 5px 8px;
  height: 28px;
  white-space: nowrap;
  font-family: var(--font-body);
  border-color: transparent;
}

.oa .btn.rb:hover:not(:disabled) { border-color: var(--color-divider); }

.oa .btn.rb.lg {
  flex-direction: column;
  gap: 3px;
  width: 64px;
  height: auto;
  padding: 6px 4px;
  font-size: 10.5px;
  line-height: 1.25;
  text-align: center;
}

.oa .btn.rb.ic { width: 28px; height: 28px; padding: 0; }
.oa .btn.rb.sm { height: 24px; font-size: 11.5px; }
.oa .btn.rb.tiny { height: 22px; font-size: 11px; padding: 0 6px; }
.oa .btn.rb.ic.tiny { width: 22px; padding: 0; }
.oa .btn.rb.danger { color: var(--oa-danger-fg); }
.oa .btn.sm { font-size: 12px; height: 30px; }

.oa .i.big { width: 19px; height: 19px; }
.oa .i.flip { transform: scaleX(-1); }
.oa .i.flip-y { transform: scaleY(-1); }
.oa .i.rot { transform: rotate(90deg); }
.oa .btn.rb.sm .i { width: 13px; height: 13px; }
.oa .btn.rb.tiny .i { width: 12px; height: 12px; }
.oa .small-a { font-size: 11px; font-family: var(--font-heading); }

/* A label drawn as an icon in front of the control it names, where a word would not fit. */
.oa .rb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 28px;
  color: var(--color-text-muted);
}

/* A toggle drawn as a pressed button, over a checkbox or radio the form actually reads. */
.oa .tgl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  color: var(--color-text);
}

.oa .tgl input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.oa .tgl:hover { border-color: var(--color-divider); }

.oa .tgl:has(input:checked) {
  border-color: color-mix(in srgb, var(--color-accent) 45%, transparent);
  background: color-mix(in srgb, var(--color-accent) 15%, transparent);
  color: var(--color-accent);
}

.oa .tgl:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 1px; }

/* — ribbon inputs — */
.oa .input.sel { font-size: 12px; height: 28px; padding: 0 var(--space-2); }

.oa .input.num {
  font-size: 12px;
  height: 28px;
  padding: 0 var(--space-2);
  width: 62px;
  font-variant-numeric: tabular-nums;
}

.oa .input.num.narrow { width: 44px; }
.oa .input.num.wide { width: 86px; }
.oa .input.text-area { width: 210px; min-height: 42px; font-size: 12px; padding: 4px 6px; }

.oa .grp .lbl {
  font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  min-width: 12px;
}

.oa .grp .lbl.wide { min-width: 44px; }
.oa .grp .unit { font-size: 11px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }

.oa .check-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.oa .check-inline input { accent-color: var(--color-accent); }

/* A colour well small enough to sit in a ribbon row. */
.oa .swatch-mini {
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
  overflow: hidden;
  flex: none;
}

.oa .swatch-mini input[type="color"] {
  width: 150%;
  height: 150%;
  margin: -25%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.oa .grp .shortcuts {
  font-size: 11.5px;
  max-width: 250px;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  text-wrap: pretty;
  line-height: 1.5;
  display: block;
}

.oa .ribbon-tab .nothing {
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  align-self: center;
  padding: 0 var(--space-3);
  margin: 0;
}

.oa .sel-id {
  align-self: flex-end;
  font-size: 10.5px;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  padding: 0 var(--space-3);
  margin: 0 0 2px;
  white-space: nowrap;
}

/* Page chips wrap, because a design with a dozen pages is not unusual. */
.oa .pages-grp { min-width: 260px; max-width: 340px; }
.oa .grp .row.chips { flex-wrap: wrap; max-width: 100%; gap: 4px; }

.oa .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  height: 26px;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--color-divider);
  background: transparent;
  color: var(--color-text);
}

.oa .chip:hover { border-color: color-mix(in srgb, var(--color-text) 40%, transparent); }

.oa .chip.current {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
  color: var(--color-accent);
}

.oa .chip .count {
  opacity: .55;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

/* — the paper — */
.oa .dsg-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--color-bg);
  padding: var(--space-8) var(--space-6);
}

/* Centred while a sheet fits, and pinned to the left edge once one is wider than the stage —
   which it is whenever the window is narrower than the page at its own size. Plain centring
   would push the overflow out past both edges, and the left half is past where a scroller can
   reach. */
.oa .dsg-stage .pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-items: safe center;
  gap: var(--space-8);
}

/* The sheet keeps its own light colours whichever theme the interface is in. It is paper: a
   report printed from it is white, and a designer that showed it dark would be showing something
   that never gets exported. */
.oa .dsg-stage svg.paper {
  display: block;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  touch-action: none;
}

.oa .dsg-stage .sheet-label {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  margin-bottom: 6px;
}

.oa .dsg-stage svg.paper .handle {
  fill: var(--color-surface);
  stroke: var(--color-accent);
  stroke-width: 1.5;
  cursor: nwse-resize;
}

.oa .dsg-stage svg.paper .outline {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 1.5;
  pointer-events: none;
}

.oa .dsg-stage svg.paper .guide {
  stroke: #d4452f;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

/* The margin, as a line to place against. Thinner and paler than a snapping guide, because it is
   always there and a guide is a thing that has just happened. Stroke widths on this canvas are
   millimetres — the viewBox is the paper — so the numbers are small. */
.oa .dsg-stage svg.paper .margin-guide {
  fill: none;
  stroke: #b8b2c8;
  stroke-width: 0.25;
  stroke-dasharray: 2 2;
  pointer-events: none;
}

/* The page's own writing, drawn as it will print. Its colour is fixed rather than themed: this is
   ink on white paper, and it looks the same whichever way the editor is dressed. */
.oa .dsg-stage svg.paper .furniture {
  fill: #77737f;
  font-family: var(--font-mono, ui-monospace, monospace);
  pointer-events: none;
}

/* Where a page will be cut. Amber rather than the guide grey: this one changes how many pages
   the report has, which is worth noticing. */
.oa .dsg-stage svg.paper .break-rule {
  stroke: #c8901f;
  stroke-width: 0.4;
  stroke-dasharray: 4 2;
  pointer-events: none;
}

/* The copies the editor draws of a repeated group. Faint, because they are not in the document —
   they are what the design will become once a client's list arrives. */
.oa .dsg-stage svg.paper .repeat-ghost { opacity: .45; }

/* And what a list with no rows looks like, which is the case nobody designs for. */
.oa .dsg-stage svg.paper .repeat-empty { opacity: .12; }

.oa .dsg-stage svg.paper .marquee {
  fill: color-mix(in srgb, var(--color-accent) 12%, transparent);
  stroke: var(--color-accent);
  stroke-width: 1;
}

/* — the status bar — */
.oa .dsg-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  height: 34px;
  flex: none;
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface);
  font-size: 11.5px;
}

.oa .dsg-status .bar { width: 1px; height: 16px; background: var(--color-divider); }
.oa .dsg-status .quiet { color: color-mix(in srgb, var(--color-text) 60%, transparent); }
.oa .dsg-status .right { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }
.oa .dsg-status .zoom { width: 38px; text-align: right; }
.oa .dsg-status input[type="range"] { width: 120px; accent-color: var(--color-accent); }

/* — the template library — */
.oa dialog.lib { width: min(720px, 100%); max-height: 86vh; }
.oa .lib-controls { display: flex; align-items: center; gap: var(--space-3); }
.oa .lib-controls .grow { flex: 1; }
.oa .lib-list { display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow: auto; }

.oa .lib-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.oa .lib-row:hover { background: color-mix(in srgb, var(--color-text) 5%, transparent); }

.oa .lib-row.current {
  border-color: color-mix(in srgb, var(--color-accent) 45%, transparent);
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
}

.oa .lib-row .pick {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.oa .lib-row .text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.oa .lib-row .line { display: flex; align-items: center; gap: 7px; }

.oa .lib-row .name {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 13.5px;
}

.oa .lib-row .meta {
  font-size: 11.5px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

.oa .tag.tiny { font-size: 9.5px; padding: 2px 7px; }
.oa .lib-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.oa .lib-actions .btn.rb { height: 26px; font-size: 11px; }

.oa .lib-empty {
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  padding: var(--space-4);
  margin: 0;
}

.oa .lib-rename {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--color-accent) 45%, transparent);
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
}

.oa .lib-rename .grow { flex: 1; }

/* The two layers the model always carried and the editor never showed: a band the report can be
   asked to leave out, and a region whose contents are drawn once per row of a list. Both are
   annotations rather than parts of the design, so both stay faint and neither takes a click. */
.oa .dsg-stage svg.paper .band-rule {
  stroke: color-mix(in srgb, #5d5294 35%, transparent);
  stroke-width: 0.2;
  stroke-dasharray: 1.2 1.2;
}

.oa .dsg-stage svg.paper .band-label {
  fill: color-mix(in srgb, #5d5294 55%, transparent);
  font-family: ui-monospace, monospace;
  letter-spacing: 0.12em;
}

.oa .dsg-stage svg.paper .repeat-region {
  fill: none;
  stroke: #2b7a4b;
  stroke-width: 0.25;
  stroke-dasharray: 1.6 1.2;
}

.oa .dsg-stage svg.paper .repeat-badge {
  fill: #2b7a4b;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.04em;
}

/* — the work area —
   Canvas and the variables panel side by side, so what a template can bind to is on screen while
   somebody lays it out rather than behind a menu. */
.oa .dsg-work { flex: 1; min-height: 0; display: flex; align-items: stretch; }

.oa .dsg-vars {
  width: 236px;
  flex: none;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--color-divider);
  background: var(--color-surface);
  min-height: 0;
}

.oa .vars-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--color-divider);
  flex: none;
}

.oa .vars-head .title {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 13px;
}

.oa .vars-head .input { font-size: 12px; min-height: 28px; }
.oa .vars-list { flex: 1; min-height: 0; overflow: auto; padding: var(--space-2) var(--space-2) var(--space-4); }
.oa .vars-group + .vars-group { margin-top: var(--space-3); }

.oa .vars-group-l {
  font-size: 9.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  padding: var(--space-2) var(--space-2) var(--space-1);
}

.oa .var {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
}

.oa .var:hover { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.oa .var:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

.oa .var-name {
  font-family: var(--font-mono);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A list is marked because it behaves differently — it cannot go in a sentence. */
.oa .var-kind {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
  color: var(--color-accent);
  flex: none;
}

.oa .vars-empty,
.oa .vars-note {
  font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  margin: 0;
  padding: var(--space-3);
  text-wrap: pretty;
  line-height: 1.45;
}

.oa .vars-note { border-top: 1px solid var(--color-divider); flex: none; }

/* — the canvas context menu — */
.oa .dsg-menu,
.oa .gph-menu {
  position: fixed;
  z-index: 60;
  width: 186px;
  display: flex;
  flex-direction: column;
  padding: var(--space-1);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

.oa .dsg-menu[hidden],
.oa .gph-menu[hidden] { display: none !important; }

.oa .dsg-menu button,
.oa .gph-menu button {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 5px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
}

.oa .dsg-menu button:hover:not(:disabled),
.oa .gph-menu button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-text) 8%, transparent);
}

.oa .dsg-menu button:disabled,
.oa .gph-menu button:disabled { opacity: .4; cursor: default; }
.oa .dsg-menu button.danger,
.oa .gph-menu button.danger { color: var(--oa-danger-fg); }

.oa .dsg-menu .key,
.oa .gph-menu .key {
  margin-left: auto;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}

.oa .dsg-menu hr,
.oa .gph-menu hr {
  height: 1px;
  border: 0;
  margin: var(--space-1) var(--space-2);
  background: var(--color-divider);
}

/* Holding a style is a state worth seeing — the button says "Apply style" and looks armed. */
.oa .btn.rb.held {
  border-color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
  color: var(--color-accent);
}

/* The editor answering back, in the status bar. Muted, because it is a remark and not a warning
   — the things it says are all outcomes somebody just asked for. */
.oa .dsg-note {
  font-size: 11px;
  color: var(--color-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40ch;
}

.oa dialog.find { width: min(420px, 100%); }

/* The columns of a table, one row each. A grid rather than a table element so the heading strip
   and the rows share one set of column widths without either measuring the other, and so the row
   of controls at the end can sit outside the tracks the fields line up in. */
.oa dialog.columns { width: min(880px, 100%); }

/* Pages as cards to drag. The thumbnail is the sheet the editor already drew, shrunk — a second
   way of drawing a page would be a second renderer to keep in step for a picture nobody edits. */
.oa dialog.pages { width: min(760px, 100%); }

.oa .page-cards {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.oa .page-card {
  width: 132px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
  background: var(--color-bg);
  cursor: grab;
}

.oa .page-card.current { border-color: var(--color-accent); }
.oa .page-card.lifted { opacity: .4; }

.oa .page-card.over {
  border-color: var(--color-accent);
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.oa .page-card .thumb {
  width: 100%;
  height: auto;
  display: block;
  background: #ffffff;
  border-radius: 2px;
  pointer-events: none;
}

/* The furniture and the margin inside a thumbnail. Their own rules are written against the stage,
   which this is not, and a header that came out black on a card would be the wrong page. */
.oa .page-card .thumb .furniture { fill: #77737f; }

.oa .page-card .thumb .margin-guide {
  fill: none;
  stroke: #b8b2c8;
  stroke-width: 0.25;
  stroke-dasharray: 2 2;
}

.oa .page-card .thumb .break-rule {
  stroke: #c8901f;
  stroke-width: 0.4;
  stroke-dasharray: 4 2;
}

.oa .page-card-foot {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 11px;
}

.oa .page-card-foot .count {
  margin-right: auto;
  opacity: .55;
  font-size: 10px;
}

.oa .col-head,
.oa .col-row {
  display: grid;
  grid-template-columns: 1.6fr 1.4fr 84px 72px 84px 44px 72px 96px;
  gap: var(--space-2);
  align-items: center;
}

.oa .col-head {
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--color-divider);
}

.oa .col-rows { display: flex; flex-direction: column; gap: var(--space-2); }

.oa .col-row .input { width: 100%; }
.oa .col-row input[type="checkbox"] { justify-self: center; }
.oa .col-buttons { display: flex; gap: var(--space-1); justify-content: flex-end; }

.oa .col-empty {
  font-size: 13px;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}

.oa #columns-add { margin-right: auto; }

.oa .find-count {
  margin-right: auto;
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}


/* ─────────────────────────────────────────────────────────────────────────────────────────────
   The data graph editor.

   The same shape as the template designer and deliberately so — one strip along the top, one
   canvas that fills what is left, one panel beside it — because they are the same kind of screen
   and somebody who has learned one should not have to learn the other. What differs is what the
   strip holds: a designer has a ribbon of tools because a page has a hundred properties, and a
   graph has four kinds of box.
   ───────────────────────────────────────────────────────────────────────────────────────────── */

.oa .gph {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--color-bg);

  /* One hue per kind of node, written as hues rather than taken from the palette.

     The palette has one accent, and this screen needs four colours that are told apart at a
     glance — the whole reason the design colours a node's header is that its kind is the first
     thing you read. Tying any of them to the accent would make two kinds the same colour on a
     workspace whose accent happened to be green, which is this one's. They are mixed into the
     surface below, so they follow the theme even though they do not follow the accent. */
  --gph-source: #5b8def;
  --gph-constant: #c8901f;
  --gph-math: #8a7bd8;
  --gph-output: #2f9e6b;
  --gph-events: #1f9e8f;
  --gph-list: #3f7fd4;
}

/* — the strip —
   What the design draws along the top of the canvas: the name, what is in the graph, and whether
   it is stored. Quiet on purpose. The bar it replaces was thirteen controls in a row along the
   bottom, and the canvas is the thing worth looking at. */
.oa .gph-strip {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-surface);
}

.oa .gph-strip .right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.oa .gph-strip .bar {
  width: 1px;
  height: 20px;
  background: var(--color-divider);
  margin: 0 var(--space-1);
}

.oa .gph-strip form { display: contents; }

.oa .gph-picker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px var(--space-3);
}

.oa .gph-picker .name {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 14px;
}

.oa .gph-picker .caret { width: 12px; height: 12px; opacity: .6; }

.oa .gph-strip .counts,
.oa .gph-strip .save-state {
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

/* The dot the design puts between the name and the counts, drawn rather than typed so the markup
   stays a list of facts. */
/* Which client the editor is looking through. Beside the counts because it is the same kind of
   fact — something about this view, not about the document. */
.oa .gph-strip .lens {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
}

.oa .gph-strip .lens .i { width: 13px; height: 13px; opacity: .6; }
.oa .gph-strip .lens .input.sel { max-width: 190px; }
.oa .gph-strip .lens .quiet {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}

.oa .gph-strip .counts::before,
.oa .gph-strip .save-state::before {
  content: "·";
  margin-right: var(--space-3);
  opacity: .5;
}

.oa .gph-work {
  display: flex;
  flex: 1;
  min-height: 0;
}

.oa .gph-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.oa .gph-stage #canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

.oa .gph-stage #canvas.panning { cursor: grabbing; }

/* — what the editor says back —
   Over the canvas, never above it: a message that pushed the canvas down would move the node
   under the pointer at the moment somebody was told something. */
.oa .gph-notices {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  right: var(--space-4);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.oa .gph-notices .notes {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.oa .gph-notices .note {
  pointer-events: auto;
  margin: 0;
  max-width: 620px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
}

.oa .gph-notices .note.bad {
  border-color: var(--oa-danger-bd);
  background: var(--oa-danger-bg);
  color: var(--oa-danger-fg);
}

.oa .gph-notices .note.good { border-color: color-mix(in srgb, var(--color-accent) 45%, transparent); }

/* A notice that offers to do something rather than only telling you. */
.oa .gph-notices .note .btn { margin-left: var(--space-2); vertical-align: middle; }

/* — the view controls —
   In the corner of the canvas they act on. Zoom and framing are facts about the view rather than
   about the graph, so they are not up in the strip among the things that change it. */
.oa .gph-view {
  position: absolute;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.oa .gph-view .zoom {
  min-width: 42px;
  text-align: center;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}

/* — the canvas itself —
   Nodes are boxes with ports and wires run between them. Coloured by kind, from the palette
   rather than from hex written here, so the graph follows the theme like everything else. */
.oa .gph-stage #canvas .node { cursor: move; }

/* — the card —
   The design's node: a coloured header naming what it is, and its own settings underneath. Real
   HTML inside a foreignObject, so these are ordinary controls in the ordinary theme. */
.oa .gph-stage #canvas .gnode {
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  font-family: var(--font-body);
  color: var(--color-text);
}

.oa .gph-stage #canvas .node.selected .gnode {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent);
}

.oa .gph-stage #canvas .gnode .head {
  flex: none;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  font-size: 10px;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  color: #ffffff;
}

.oa .gph-stage #canvas .gnode .head .title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* The chevron folds the card away. A button, so it is reachable by keyboard and so the press that
   lands on it is never mistaken for the start of a drag. */
.oa .gph-stage #canvas .gnode .fold {
  flex: none;
  width: 13px;
  height: 13px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, .18);
  color: #ffffff;
  font: inherit;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}

.oa .gph-stage #canvas .gnode .fold:hover { background: rgba(255, 255, 255, .34); }

.oa .gph-stage #canvas .gnode .body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}

.oa .gph-stage #canvas .gnode .row {
  flex: none;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  font-size: 10px;
}

.oa .gph-stage #canvas .gnode .row .lbl {
  flex: none;
  width: 52px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

.oa .gph-stage #canvas .gnode .row.check .lbl { width: auto; }

.oa .gph-stage #canvas .gnode .in {
  flex: 1;
  min-width: 0;
  height: 18px;
  box-sizing: border-box;
  padding: 0 4px;
  border-radius: 3px;
  border: 1px solid var(--color-divider);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: 10px;
}

.oa .gph-stage #canvas .gnode .in:focus-visible {
  outline: 1px solid var(--color-accent);
  outline-offset: 0;
}

.oa .gph-stage #canvas .gnode input[type="checkbox"] {
  flex: none;
  width: 11px;
  height: 11px;
  margin: 0;
  accent-color: var(--color-accent);
}

/* The name of a port, beside the circle it belongs to. The design labels them, and a graph of
   Math nodes is unreadable without knowing which side of a subtraction you are wiring. */
.oa .gph-stage #canvas .gnode .port-row {
  flex: none;
  height: 15px;
  display: flex;
  align-items: center;
  padding: 0 4px;
  font-size: 9px;
  letter-spacing: .04em;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}

.oa .gph-stage #canvas .gnode .port-row.out { justify-content: flex-end; }

/* One hue per kind, on the header where the design puts it. */
.oa .gph-stage #canvas .node.kind-input .gnode .head { background: var(--gph-source); }
.oa .gph-stage #canvas .node.kind-constant .gnode .head { background: var(--gph-constant); }
.oa .gph-stage #canvas .node.kind-operation .gnode .head { background: var(--gph-math); }
.oa .gph-stage #canvas .node.kind-output .gnode .head { background: var(--gph-output); }
.oa .gph-stage #canvas .node.kind-eventset .gnode .head { background: var(--gph-events); }
.oa .gph-stage #canvas .node.kind-foreach .gnode .head { background: var(--gph-list); }
.oa .gph-stage #canvas .node.kind-rollup .gnode .head { background: var(--gph-math); }

/* — the event list on an event set —
   Two groups the way the design draws them: what the provider collects on its own, locked and
   never sent, and what this client decided counts. Denser than a control row, because it is a
   list to read down rather than a field to fill in. */
.oa .gph-stage #canvas .gnode .events {
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 0 6px 6px;
  overflow: hidden;
}

.oa .gph-stage #canvas .gnode .events-head {
  height: 17px;
  display: flex;
  align-items: center;
  font-size: 7.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}

.oa .gph-stage #canvas .gnode .event {
  height: 15px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
}

.oa .gph-stage #canvas .gnode .event .event-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.oa .gph-stage #canvas .gnode .event .event-count {
  flex: none;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}

/* The provider collects these whatever anybody wants, so there is nothing to tick. The dash keeps
   the names lined up with the ones below that do have a box. */
.oa .gph-stage #canvas .gnode .event.locked { color: color-mix(in srgb, var(--color-text) 50%, transparent); }

.oa .gph-stage #canvas .gnode .event .lock {
  flex: none;
  width: 11px;
  text-align: center;
  opacity: .6;
}

/* A row holding a sentence rather than a control, which needs to wrap where a control does not. */
.oa .gph-stage #canvas .gnode .says-row {
  flex: none;
  min-height: 30px;
  display: flex;
  align-items: center;
  padding: 0 6px 4px;
}

/* A line of the card that says something rather than asking it. */
.oa .gph-stage #canvas .gnode .says {
  font-size: 9.5px;
  line-height: 1.3;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}

.oa .gph-stage #canvas .port {
  fill: var(--color-surface);
  stroke: color-mix(in srgb, var(--color-text) 45%, transparent);
  stroke-width: 1.5;
  cursor: crosshair;
}

.oa .gph-stage #canvas .port:hover { fill: var(--color-accent); }

/* A port that carries a list is filled rather than hollow, and its wire is heavier. The design
   draws the two apart, and it has to: a wire is the only thing on this canvas that says what is
   travelling, and a list and a figure are not interchangeable. */
.oa .gph-stage #canvas .port.rows {
  fill: var(--gph-events);
  stroke: var(--gph-events);
}

.oa .gph-stage #canvas .wire.rows {
  stroke: color-mix(in srgb, var(--gph-events) 80%, transparent);
  stroke-width: 3;
}

.oa .gph-stage #canvas .wire {
  fill: none;
  stroke: color-mix(in srgb, var(--color-text) 40%, transparent);
  stroke-width: 1.5;
  cursor: crosshair;
}

/* Red on hover because clicking a wire cuts it, and a control whose only action is destructive
   should say so before it is used rather than afterwards. */
.oa .gph-stage #canvas .wire:hover {
  stroke: var(--oa-danger-fg);
  stroke-width: 2.5;
}

.oa .gph-stage #canvas .wire.pending {
  stroke: var(--color-accent);
  stroke-dasharray: 4 3;
  pointer-events: none;
}

/* — the graph list — */
.oa dialog.graphs { width: min(460px, 100%); }

.oa .graph-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.oa .graph-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
}

.oa .graph-row:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.oa .graph-row.current { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.oa .graph-row .name { font-size: 13px; }
.oa .graph-row .tag { margin-left: auto; }

/* On a narrow window the panel goes under the canvas rather than squeezing it, the same as every
   other two-column screen here. */
/* — the help — */
.oa dialog.help { width: min(520px, 100%); }

.oa .help-list {
  margin: 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: 13px;
  line-height: 1.5;
}

.oa .help-list .key {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--color-divider);
}

/* — limit meters, on the space admin screen —
   "9 of 15", with a bar that turns warning-coloured at 85%. The threshold is SpaceLimits'
   WarnAtFraction; the class is decided server-side so the bar and the number never disagree. */
.oa .meters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-4);
  margin: var(--space-5) 0 var(--space-2);
}

.oa .meter { display: flex; flex-direction: column; gap: 6px; }

.oa .meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.oa .meter-name {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

.oa .meter-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}

.oa .meter-count strong { color: var(--color-text); }

.oa .meter-track {
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text) 10%, transparent);
  overflow: hidden;
}

.oa .meter-fill { height: 100%; background: var(--color-accent); }

.oa .meter.warn .meter-fill { background: var(--oa-warn-fg); }
.oa .meter.warn .meter-count strong { color: var(--oa-warn-fg); }

/* — tabs —
   Links rather than buttons: each tab is a URL, so it can be linked to, opened in a new tab and
   come back to after a post. Underlined active tab, 2px accent, as the design draws it. */
.oa .tabs {
  display: flex;
  gap: var(--space-5);
  margin: var(--space-5) 0 var(--space-4);
  /* The rule is an inset shadow rather than a border, so the chosen tab's underline lies over it
     without a negative margin, which a strip that scrolls would turn into a vertical scrollbar. */
  box-shadow: inset 0 -1px 0 var(--color-divider);
  /* A strip wider than a phone scrolls sideways rather than pushing the page wide. */
  overflow-x: auto;
  scrollbar-width: thin;
}

.oa .tab {
  flex: none;
  padding: 8px 2px;
  font-family: var(--font-heading);
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  color: color-mix(in srgb, var(--color-text) 62%, transparent);
  border-bottom: 2px solid transparent;
}

.oa .tab:hover { color: var(--color-text); }

.oa .tab.on, .oa .tab[aria-current="page"] {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: var(--font-heading-weight);
}

/* Inset, because the strip scrolls and would clip an outline drawn outside the tab. */
.oa .tab:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; border-radius: var(--radius-sm); }

/* A blocked root domain is the one chip the design tints as danger: it is the entry that stops a
   whole organisation rather than one person or one agent. */
.oa .chip.danger {
  border-color: var(--oa-danger-bd);
  color: var(--oa-danger-fg);
  background: var(--oa-danger-bg);
}

/* — System Settings · API Keys —
   A Google reference serves GA4 and Search Console both, so a row can carry more than one
   provider chip. */
.oa .keys-providers { white-space: nowrap; }
.oa .keys-providers .chip + .chip { margin-left: 4px; }
.oa .keys-enter { margin-top: var(--space-6); max-width: 64ch; }
.oa .keys-enter form { display: flex; flex-direction: column; gap: var(--space-4); }
.oa .keys-actions { display: flex; align-items: center; gap: var(--space-3); }

/* — the signed-out pages: sign in, second factor, reset, invitation —
   One column centred on the page, the mark and the name above a single card. No rail: nothing in
   it is reachable until somebody has signed in. These pages are outside `.oa-shell`, so they set
   their own type. */
.oa-gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--space-8) 16px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, color-mix(in srgb, var(--color-accent) 9%, transparent), transparent 70%),
    var(--color-bg);
}

.oa-gate .oa-gate-column {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-8);
}

.oa-gate .oa-gate-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--color-text);
  text-decoration: none;
}

.oa-gate .oa-gate-brand .mark { width: 56px; height: 56px; }

.oa-gate .oa-gate-brand .name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.oa-gate .oa-gate-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: 28px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.oa-gate .oa-gate-card h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
}

.oa-gate .oa-gate-card h1 + .page-sub { margin-top: calc(var(--space-3) * -1); }
.oa-gate .page-sub { margin: 0; font-size: 13.5px; line-height: 1.5; }

.oa-gate form { display: flex; flex-direction: column; gap: var(--space-5); margin: 0; }
.oa-gate form > .page-sub { margin-bottom: calc(var(--space-2) * -1); }

.oa-gate .field > label {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: color-mix(in srgb, var(--color-text) 82%, transparent);
}

.oa-gate .input { min-height: 42px; padding: 8px 12px; font-size: 15px; }

/* A ring as well as the border, so where the cursor is reads at a glance and survives a
   high-contrast mode that flattens one of the two. */
.oa-gate .input:focus,
.oa-gate .input:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 28%, transparent);
}

.oa-gate .input[aria-invalid="true"], .oa-gate .input.input-validation-error { border-color: var(--oa-danger-bd); }

.oa-gate .btn {
  min-height: 42px;
  justify-content: center;
  font-size: 15px;
}

/* The one thing to do on each of these pages, so it is filled rather than outlined. */
.oa-gate .btn-primary {
  color: var(--color-surface);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.oa-gate .btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-accent) 86%, var(--color-text));
}

.oa-gate .btn-primary:active:not(:disabled) {
  background: color-mix(in srgb, var(--color-accent) 74%, var(--color-text));
}

.oa-gate .btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* "You are signed out", "We sent a link": a status. A refusal, a lockout or the rate limit: an
   alert. Both are boxes with an icon, so neither depends on its colour to be read. */
.oa-gate .outcome, .oa-gate .problem {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.45;
}

.oa-gate .outcome .i, .oa-gate .problem .i { width: 16px; height: 16px; flex: none; margin-top: 1px; }

.oa-gate .outcome {
  color: var(--color-text);
  border: 1px solid color-mix(in srgb, var(--color-accent) 45%, transparent);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.oa-gate .outcome .i { color: var(--color-accent); }

.oa-gate .problem {
  color: var(--oa-danger-fg);
  border: 1px solid var(--oa-danger-bd);
  background: var(--oa-danger-bg);
}

/* The validation summary is a .problem too, and is empty until something is wrong. */
.oa-gate .problem.validation-summary-valid { display: none; }
.oa-gate .problem ul { margin: 0; padding-left: 1.1em; }

.oa-gate .oa-gate-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
  font-size: 13px;
}

.oa-gate .oa-gate-foot a {
  color: var(--color-accent);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.oa-gate .oa-gate-foot a:hover { text-decoration: underline; text-underline-offset: 3px; }
.oa-gate .oa-gate-foot a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

@media (max-width: 30rem) {
  .oa-gate { place-items: start center; padding-top: 40px; }
  .oa-gate .oa-gate-card { padding: 22px 18px; }
}

.oa .oa-field-error { display: block; margin-top: 4px; font-size: 12px; color: var(--oa-danger-fg); }

/* Account settings: the forms are a column of cards, each one thing. */
.oa .account-cards { display: grid; gap: var(--space-5); max-width: 560px; }
.oa .account-cards form { display: flex; flex-direction: column; gap: var(--space-3); }
.oa .account-cards .actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.oa .recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px var(--space-4);
  padding: var(--space-3);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 13px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
}
.oa .authenticator-key { font-family: var(--font-mono, ui-monospace, monospace); font-size: 14px; letter-spacing: .06em; word-break: break-all; }

