/* admin.css — the CMS surface.
   Same palette as the public site (the book's ink #143B43 / accent #BB7545),
   but a denser, working layout: this is a tool, not a page to read.

   ── HOW THEMING WORKS HERE ────────────────────────────────────────────────
   The chrome is uikitten's (<uk-shell>, <uk-layout>), and its components read
   `--uk-*` tokens. So this file does two things:

     1. it defines the `--uk-*` tokens for `system`, `light` and `dark` as the
        book's palette, light and dark. The CMS's own look IS the light theme,
        rather than a separate named one, so <uk-theme-picker>'s Reset -- which
        goes to `system` -- lands back on the book's palette instead of
        uikitten's own sandy default. uikitten's other four themes
        (paper-maker, techno-mystic, retro-vector, cyber-goth) are left alone
        and stay selectable;

     2. it derives this file's own variables from those tokens, so the ~250
        lines of rules below did not have to change and every theme drives all
        of them.

   admin.css is linked after the generated uikitten stylesheet and is OUTSIDE
   its `@layer uikitten.*` layers, so these rules win wherever they overlap.

   Text size is not here: <uk-theme-picker>'s A−/A+ scale the root font-size as
   a percentage, so every `rem` below follows automatically. That is why this
   file uses `rem` and not `px` for anything typographic. */

/* ── The book's palette, light ─────────────────────────────────────────────
   `:not([data-theme])` is the unset case, before anyone has chosen. */
:root:not([data-theme]),
:root[data-theme='system'],
:root[data-theme='light'] {
  color-scheme: light;

  --uk-bg: #fbf8f4;
  --uk-surface: #ffffff;
  --uk-side: #f1f5f4;
  --uk-inset: #f1f5f4;
  --uk-border: #e0dcd4;
  --uk-fg: #202828;
  --uk-muted: #4d5c5c;
  --uk-accent: #bb7545;
  --uk-success: #2f6b4f;
  --uk-danger: #a4342f;
  --uk-warn: #8a5024;
  --uk-gold: #8a5024;
  --uk-control: #f1f5f4;
  --uk-glow: #bb7545;
  --uk-shadow-1: 0 1px 2px rgb(20 59 67 / 0.06);
  --uk-shadow-2: 0 1px 2px rgb(20 59 67 / 0.06), 0 8px 24px rgb(20 59 67 / 0.06);
  --uk-shadow-3: 0 12px 32px rgb(20 59 67 / 0.14);

  /* Headings are the book's deep teal rather than the body colour. The
     derivation below falls back to --uk-fg for themes that say nothing. */
  --ink: #143b43;
  --ink-2: #1c4d56;
}

/* ── The book's palette, dark ──────────────────────────────────────────────
   The same hues taken down to a deep teal ground. The accent lightens to
   #D98F5C: #BB7545 on this background is too dark to read. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]),
  :root[data-theme='system'] {
    color-scheme: dark;

    --uk-bg: #0e2429;
    --uk-surface: #16333a;
    --uk-side: #122b31;
    --uk-inset: #0b1d21;
    --uk-border: #2a4c54;
    --uk-fg: #e8eceb;
    --uk-muted: #9db0b2;
    --uk-accent: #d98f5c;
    --uk-success: #6fbf8f;
    --uk-danger: #e9918a;
    --uk-warn: #e0b44a;
    --uk-gold: #e0b44a;
    --uk-control: #1b3b43;
    --uk-glow: #d98f5c;
    --uk-shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --uk-shadow-2: 0 4px 12px rgb(0 0 0 / 0.45);
    --uk-shadow-3: 0 12px 32px rgb(0 0 0 / 0.55);

    --ink: #e8eceb;
    --ink-2: #ffffff;
  }
}

/* An explicit `dark` choice is the same palette, whatever the OS says. */
:root[data-theme='dark'] {
  color-scheme: dark;

  --uk-bg: #0e2429;
  --uk-surface: #16333a;
  --uk-side: #122b31;
  --uk-inset: #0b1d21;
  --uk-border: #2a4c54;
  --uk-fg: #e8eceb;
  --uk-muted: #9db0b2;
  --uk-accent: #d98f5c;
  --uk-success: #6fbf8f;
  --uk-danger: #e9918a;
  --uk-warn: #e0b44a;
  --uk-gold: #e0b44a;
  --uk-control: #1b3b43;
  --uk-glow: #d98f5c;
  --uk-shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --uk-shadow-2: 0 4px 12px rgb(0 0 0 / 0.45);
  --uk-shadow-3: 0 12px 32px rgb(0 0 0 / 0.55);

  --ink: #e8eceb;
  --ink-2: #ffffff;
}

/* ── This file's own variables, derived ───────────────────────────────────
   Every rule below reads these, so a theme that only sets `--uk-*` -- which
   is every uikitten theme -- styles the whole CMS. */
:root {
  /* `--ink` is set above for the book's themes; anything else uses the
     theme's own foreground. */
  --ink: var(--uk-fg);
  --ink-2: var(--uk-fg);
  --text: var(--uk-fg);
  --text-2: var(--uk-muted);
  --text-3: color-mix(in oklab, var(--uk-muted) 80%, var(--uk-bg));
  --accent: var(--uk-accent);
  /* Accent as TEXT, darkened for contrast on a light surface. Links and
     small print use this; fills and borders use --accent. */
  --accent-2: color-mix(in oklab, var(--uk-accent) 85%, var(--uk-fg));
  --paper: var(--uk-bg);
  --paper-2: var(--uk-inset);
  --card: var(--uk-surface);
  --rule: var(--uk-border);
  --rule-strong: color-mix(in oklab, var(--uk-border) 75%, var(--uk-fg));
  --danger: var(--uk-danger);
  --ok: var(--uk-success);
  --font-sans: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: var(--uk-radius, 10px);
  --shadow: var(--uk-shadow-2);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 0.9375rem; text-transform: uppercase; letter-spacing: 0.05em; }
/* Links. This file had no `a` rule: the CMS was light-only, and the browser's
   default blue passed unnoticed. On a dark theme the same default is a
   periwinkle that belongs to no palette here, so links take the accent. */
a {
  color: var(--accent-2);
  text-decoration-color: color-mix(in oklab, var(--uk-accent) 50%, transparent);
  text-underline-offset: 0.15em;
}
a:hover { color: var(--accent); }
a:visited { color: var(--accent-2); }

::selection { background: var(--accent); color: var(--uk-bg); }

.muted { color: var(--text-3); }
.small { font-size: 0.8125rem; }
[hidden] { display: none !important; }

/* ---- Controls ---- */
label { display: block; font-weight: 500; color: var(--text-2); margin-block: 0.9rem 0; }
label.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
/* Every text-ish input, by exclusion rather than by listing types — adding a
   type="email" or type="url" field should not need a new selector here. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]),
textarea,
select {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
}
textarea { resize: vertical; }
#f-body { font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.6; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  font: inherit;
  font-weight: 600;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.small { padding: 0.35rem 0.7rem; font-size: 0.8125rem; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--paper); }
.btn[disabled] { opacity: 0.5; cursor: progress; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.3rem;
}
.stack { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }

/* ---- Account screens ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: min(27rem, 100%); box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: 0.6rem; }
.login-card .btn { width: 100%; margin-top: 1.2rem; }
.panel > .muted { margin-bottom: 0.2rem; }
/* ── A password field you can read ────────────────────────────────────────────
   The wrapper positions the Show/Hide button inside the input's trailing edge;
   the input keeps the shared rule above, including its 0.35rem top margin,
   which is why the button is inset from the top by exactly that much.

   Used by BOTH password surfaces -- <cms-account>'s sign-in and register
   panels, and the static /cms/auth/reset-password page, which has its own
   script. Same markup, same classes, one stylesheet. */
.reveal { position: relative; display: block; }
/* Room for the button, so a long password does not run underneath it. */
.reveal > input { padding-inline-end: 4rem; }
.reveal-toggle {
  position: absolute;
  inset-inline-end: 1px;
  top: calc(0.35rem + 1px);
  bottom: 1px;
  display: flex;
  align-items: center;
  padding-inline: 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  background: none;
  border: 0;
  border-radius: 0 7px 7px 0;
  cursor: pointer;
}
.reveal-toggle:hover { color: var(--ink); background: var(--paper-2); }

/* For the screen readers that cannot see a password appear. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.hint { display: block; margin-top: 0.3rem; font-size: 0.8125rem; color: var(--text-3); font-weight: 400; }
.error { color: var(--danger); font-size: 0.875rem; margin-top: 0.8rem; }
.ok { color: var(--ok); font-size: 0.875rem; margin-top: 0.8rem; }
.alt {
  display: flex; flex-wrap: wrap; gap: 0.25rem 1rem;
  justify-content: space-between; margin-top: 1rem;
}
.link {
  font: inherit; font-size: 0.875rem; font-weight: 600;
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent-2); text-decoration: none;
}
.link:hover { text-decoration: underline; }
.banner.pending { border-color: var(--accent); color: var(--accent-2); }

/* ---- Shell ----------------------------------------------------------------
   <uk-shell> and <uk-layout kind="border"> do the placing: the header fills
   the `top` region, the sections the `start` region, the view `main`. Their
   own CSS already gives the shell 100dvh, makes `start` and `main` scroll
   independently, paints the header and nav with --uk-side and draws the
   border between them. What is left here is this app's own look. */

/* These two rules go INSIDE uikitten's own layer, and that is deliberate.
   Unlayered, `[region='start'] { display: flex }` beats uikitten's
   `[region='start'][collapsed] { display: none }` -- which is in a layer, and
   a layer loses to unlayered CSS however specific it is -- and the ☰ button
   silently stops hiding the navigation. Inside the layer, normal specificity
   applies again: these win over uikitten's base rules (same specificity, and
   admin.css is linked second), and its state rules win over these.

   The <uk-theme-picker> rules further down are NOT in the layer, and for the
   mirror-image reason: they exist to undo this file's own unlayered `label`
   and form-control rules, so they have to be unlayered too. */
@layer uikitten.components {
  uk-shell > uk-layout > [region='top'] {
    /* uikitten pads with --uk-gap-1/3, which density changes. A little more
       room suits a single-row header with an identity in it. */
    padding: var(--uk-gap-2) var(--uk-gap-4);
    gap: var(--uk-gap-3) var(--uk-gap-4);
  }

  /* The sections. A vertical list now rather than a tab row: on a narrow
     screen <uk-shell> moves this whole <nav> into a modal drawer, and a
     column is what a drawer wants. */
  uk-shell > uk-layout > [region='start'] {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: var(--uk-gap-3) var(--uk-gap-2);
  }
}
.brand { font-weight: 700; color: var(--ink); display: inline-flex; align-items: center; gap: 0.5rem; }
.mark { width: 1rem; height: 1rem; border-radius: 3px; background: var(--ink); border-left: 4px solid var(--accent); }

/* The appearance controls sit between the brand and the identity, and are the
   first thing <uk-shell> folds into the ⋯ popover when the header runs out of
   room (they carry `data-overflow`). */
/* The header's visual order, which is NOT its DOM order -- see the comment in
   app.js. <uk-shell> folds the last `data-overflow` child first, so `who` is
   written first (to fold last, because Sign out is the thing you least want
   hidden) and placed last here. */
.to-site {
  /* Pushes everything after it to the far side, whichever of the controls
     below are currently folded away. An `auto` margin here survives items
     disappearing; `margin-left: auto` on one of THEM does not. */
  margin-inline-end: auto;
}
.appearance { order: 1; }
.who { order: 2; }
/* <uk-shell> appends its ⋯ button to the header, so without this it inherits
   order 0 and lands between the brand and View site. It belongs at the end,
   next to what it holds. */
uk-shell > uk-layout > [region='top'] > .uk-shell-more { order: 3; }

/* The way back to the public site. Quiet by default -- it is an exit, not an
   action -- but a real target, and it keeps its arrow at every text size. */
.to-site {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.to-site:hover {
  color: var(--ink);
  border-color: var(--rule-strong);
}

/* This file styles `label`, `select` and text inputs globally -- a form-heavy
   tool, so that is the right default -- but those rules are unlayered and so
   beat uikitten's own. Inside the picker they would stretch its <select>s to
   100% and stack its labels. Put uikitten's intent back, scoped to it. */
uk-theme-picker > label {
  display: inline-flex;
  align-items: center;
  gap: var(--uk-gap-1);
  margin-block: 0;
  font-weight: 400;
}
uk-theme-picker :is(select, button) {
  width: auto;
  margin-top: 0;
  border-radius: var(--uk-radius, 6px);
}

.who { display: flex; align-items: center; gap: 0.7rem; font-size: 0.875rem; color: var(--text-2); }
.roles { font-size: 0.75rem; color: var(--text-3); background: var(--paper-2); padding: 0.1rem 0.5rem; border-radius: 999px; }

/* In the drawer the nav is a child of the <dialog>, not of the layout, so it
   needs the same column treatment by a different selector. */
uk-shell > dialog > [region='start'] {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

/* A LINK, since a section is a URL. `display: block` and no underline are
   what a <button> used to give for free. */
.tab {
  font: inherit;
  font-weight: 500;
  text-align: left;
  display: block;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--text-2);
  cursor: pointer;
}
.tab:hover { background: var(--card); color: var(--ink); }
/* A SECTION IS NOT A VISITED LINK. `a:visited` above is (0,2,0) and `.tab` is
   (0,1,0), so without this the tabs you have been to turn accent-coloured and
   the navigation reads as though half of it were current. Same for the
   sections. Found by looking at the screen, not at the file. */
.tab:visited { color: var(--text-2); }
/* The current section: an inline bar on the leading edge, which survives a
   right-to-left page and does not move the label.

   Both values, because the router sets `page` on the exact path and `true` on
   a path UNDER it -- Articles while the editor is open at /cms/articles/edit.
   Marking only `page` left no section looking current in the editor. */
.tab[aria-current='page'],
.tab[aria-current='true'] {
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--accent);
}

.view { padding: 1.5rem; max-width: 76rem; margin-inline: auto; }
.bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.bar .actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.bar h2 { margin-right: auto; }

/* Notices that belong IN the flow, because they are part of what the view is
   saying and they stay put: #no-role, the playground's verdict, the library's
   upload progress. What used to be here too was the transient one -- it
   appeared and disappeared on a timer and moved everything below it, which is
   issue #21. That one is a toast now (uk-toast-region); see notify() in
   state.js. Do not bring a come-and-go message back into this class. */
.banner {
  margin: 1.5rem 1.5rem 0;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.875rem;
  border: 1px solid var(--rule-strong);
  background: var(--card);
}
/* A banner immediately above a view would otherwise be spaced twice. */
.banner + .banner { margin-top: 0.5rem; }
.banner.ok { border-color: var(--ok); color: var(--ok); }
.banner.bad { border-color: var(--danger); color: var(--danger); }

/* ---- Categories ---- */
/* The two-step delete, laid out on one line so the warning and its answer
   read as one sentence. Wraps rather than overflowing: the warning names the
   category, so its length is somebody else's choice. */
/* A radio or checkbox with a label and an explanation beside it: the
   navigation screen's target chooser. */
.choice {
  display: flex;
  align-items: start;
  gap: 0.6rem;
  font-weight: 400;
  margin-block: 0.7rem 0;
}
.choice input { margin-top: 0.25rem; }
.choice span { display: grid; gap: 0.1rem; }
.choice strong { color: var(--ink); font-weight: 600; }

/* A hidden navigation item. Still listed, still editable, visibly not on the
   site -- which is the whole difference between hiding one and deleting it. */
tr.dim td:not(.right) { opacity: 0.55; }
/* Something that will not be built. Not an error: the row is fine, the site
   simply cannot render a link to an unpublished page. */
.warn { color: var(--accent-2); }
td.order { white-space: nowrap; }
td.order .btn { padding-inline: 0.5rem; }

.confirm { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.confirm .muted { max-width: 34ch; text-align: right; }
#categories-table td code { font-size: 0.8125rem; color: var(--muted); }
#category-form { margin-bottom: 1rem; }

/* ---- Table ---- */
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--rule); }
.table th { background: var(--paper-2); color: var(--ink); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table tr:last-child td { border-bottom: 0; }
.table td.right { text-align: right; }
.title-cell { font-weight: 600; color: var(--ink); background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; text-align: left; padding: 0; }
.title-cell:hover { color: var(--accent-2); text-decoration: underline; }

/* Status pills. Each is the theme's own status colour as the text, over a
   wash of it -- `color-mix` toward --uk-surface -- so every theme gets a
   readable pill without this file knowing any of their palettes. */
.pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--uk-chip-padding, 2px) 0.6rem;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  white-space: nowrap;
}
/* The three kinds of navigation link. The colours are the ones NavTarget
   declares in backend/domains/cms.yaml -- ink for a page, accent for a topic,
   slate for a literal link -- expressed in this app's own tokens so a theme
   change moves them together with everything else. */
.pill.target-page { background: color-mix(in oklab, var(--ink) 12%, var(--uk-surface)); color: var(--ink); }
.pill.target-category { background: color-mix(in oklab, var(--accent) 18%, var(--uk-surface)); color: var(--accent-2); }
.pill.target-link { background: color-mix(in oklab, var(--uk-muted) 14%, var(--uk-surface)); color: var(--text-2); }

.pill.draft { background: color-mix(in oklab, var(--uk-muted) 14%, var(--uk-surface)); color: var(--text-2); }
.pill.review { background: color-mix(in oklab, var(--uk-warn) 16%, var(--uk-surface)); color: var(--uk-warn); }
.pill.published { background: color-mix(in oklab, var(--uk-success) 16%, var(--uk-surface)); color: var(--uk-success); }
.pill.archived { background: color-mix(in oklab, var(--uk-muted) 10%, var(--uk-surface)); color: var(--text-3); }

/* ---- Accounts ----
   A role is not a status, so it does not borrow .pill's colour scale: those
   say where an article is in its life, and tinting `author` the same green as
   `published` would read as a claim about state. Role chips are the neutral
   control colour, with two exceptions worth spotting across a long table --
   `admin`, and an account holding nothing at all. */
.who-name { font-weight: 600; color: var(--ink); display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
.role-list { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.role-chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--uk-chip-padding, 2px) 0.55rem;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--text-2);
  border: 1px solid var(--rule);
  white-space: nowrap;
}
.role-chip.admin { background: color-mix(in oklab, var(--uk-accent) 16%, var(--uk-surface)); color: var(--accent-2); border-color: color-mix(in oklab, var(--uk-accent) 40%, transparent); }
/* Dashed, because "no roles" is an absence rather than a thing the account
   holds -- and an absence that matters: it can sign in and do nothing. */
.role-chip.none { background: transparent; color: var(--text-3); border-style: dashed; font-weight: 500; }
.role-chip.you { background: transparent; color: var(--text-3); border-style: dashed; font-weight: 500; text-transform: lowercase; }

/* ---- Editor ---- */
.editor-grid { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; }
.col-side { display: grid; gap: 1rem; }
.body-head { display: flex; align-items: end; gap: 1rem; flex-wrap: wrap; margin-top: 0.9rem; }
.body-head label { margin: 0; }
.body-tools { margin-left: auto; display: flex; gap: 0.4rem; }
.featured {
  margin-top: 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper-2);
  overflow: hidden;
}
.featured.empty { display: grid; place-items: center; aspect-ratio: 16 / 9; color: var(--text-3); font-size: 0.8125rem; }
.featured img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
@media (max-width: 60rem) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Library ---- */
.grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); }
.asset { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.asset img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--paper-2); }
.asset .meta { padding: 0.5rem 0.6rem; font-size: 0.75rem; color: var(--text-3); display: grid; gap: 0.15rem; }
.asset .name { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.asset .row { display: flex; gap: 0.35rem; padding: 0 0.6rem 0.6rem; }
.asset button { flex: 1; }
.asset.pick { cursor: pointer; text-align: left; padding: 0; border-color: var(--rule); }
.asset.pick:hover { border-color: var(--accent); box-shadow: var(--shadow); }

/* The toolbar. Every text input in this file is width:100% by default, which
   is right in a form column and wrong in a row of controls -- unset, the
   search box takes the whole bar and pushes the rest onto a second line.
   (It did, the first time this was written.)

   The selector repeats that rule's `:not()` chain rather than saying
   `.bar .actions input`, and not for taste: each `:not([type=...])` carries
   the specificity of its argument, so the base rule scores five attribute
   selectors and a plain `.bar .actions input[type='search']` LOSES to it.
   Repeating the chain is what outranks it. `select` needs no such trick --
   it is a bare element selector there. */
.bar .actions input:not([type='checkbox']):not([type='radio']):not([type='file']):not([type='submit']):not([type='button']),
.bar .actions select {
  width: auto;
  margin-top: 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.8125rem;
}
.bar .actions input[type='search'] { min-width: 11rem; }

/* ── The library's two columns ─────────────────────────────────────────────
   This was a CSS grid with a fixed 22rem panel. It is <uk-layout kind="row"
   splitters> now, so the split is DRAGGABLE -- and the drag, the arrow keys,
   Home/End and Enter-to-collapse all come from the component rather than from
   300 lines here that would have to be kept correct in both directions. The
   width persists; <cms-library> watches the element uk-layout writes it on,
   because the layout fires no event when a drag ends.

   The row has no height of its own: the files scroll inside their own box
   (.table-scroll / .grid), so the toolbar and the panel stay put while the
   rows move. */
.library-layout { gap: 1.2rem; min-height: 24rem; }
.library-layout > .library-main { min-width: 0; }
/* The children STRETCH, and that is load-bearing: `align-items: start` here
   left the splitter -- which has no content of its own -- 6px wide and ZERO
   high, so it was in the page, correct in every other way, and impossible to
   grab. Measured in the browser, not read off the markup. */
.library-layout > .library-side {
  align-self: stretch; position: static;
  overflow: auto; max-height: min(60vh, 34rem); overscroll-behavior: contain;
}
@media (max-width: 64rem) {
  /* No room to split: stack them, and the splitter goes away with the row. */
  .library-layout { display: block; }
  .library-layout > .library-side { margin-top: 1.2rem; width: auto; }
}

/* The whole view accepts a drop; this is the part that SHOWS it. A dashed
   accent border rather than a tint, because a tint over a grid of thumbnails
   reads as the thumbnails changing. */
.library-main { border: 2px dashed transparent; border-radius: var(--radius); padding: 2px; transition: border-color 0.12s; }
.library-main.dropping { border-color: var(--accent); }

.asset-wrap { display: grid; gap: 0.35rem; align-content: start; }
.asset-wrap.selected .asset { border-color: var(--accent); box-shadow: var(--shadow); }

/* Used / unused, under each tile. The used one is the louder of the two: it
   is the one that changes what you can do next. */
.use-tag {
  justify-self: start;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 0.1rem 0.45rem; border-radius: 999px; border: 1px solid var(--rule);
  color: var(--text-3); background: var(--paper-2);
}
.use-tag.used { color: var(--accent-2); border-color: color-mix(in oklab, var(--uk-accent) 40%, transparent); background: color-mix(in oklab, var(--uk-accent) 12%, var(--uk-surface)); }
.use-tag.free { border-style: dashed; }

/* ── The list ──────────────────────────────────────────────────────────────
   The default view. It scrolls inside its own box with a sticky header, so
   the columns are still named at row 180. */
.table-scroll {
  overflow: auto;
  max-height: min(60vh, 34rem);
  overscroll-behavior: contain;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
}
.library-main table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.8125rem; min-width: 34rem; }
.library-main thead th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; background: var(--paper-2); color: var(--ink);
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.library-main tbody td {
  padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: middle;
  background: var(--card); transition: background 0.12s ease;
}
.library-main tbody tr:last-child td { border-bottom: 0; }
.library-main th.tick, .library-main td.tick { width: 2.2rem; }
.library-main td.num { font-variant-numeric: tabular-nums; color: var(--text-3); white-space: nowrap; }
.cell-name { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.cell-name .names { display: grid; min-width: 0; }
.cell-name .sub { color: var(--text-3); font-size: 0.6875rem; }
.cell-name .tn {
  width: 2.25rem; height: 2.25rem; flex: none; border-radius: 6px; object-fit: cover;
  background: var(--paper-2); border: 1px solid var(--rule);
}
.cell-name .tn.doc {
  display: grid; place-items: center;
  font-size: 0.5625rem; font-weight: 700; letter-spacing: 0.04em; color: var(--text-3);
}
.link-name {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 600; text-align: left;
  color: var(--accent-2); cursor: pointer; overflow-wrap: anywhere;
}
.link-name:hover { text-decoration: underline; }
.asset-row { cursor: pointer; }

/* ── Row states ────────────────────────────────────────────────────────────
   Four of them, and they have to be rankable at a glance: under the pointer,
   ticked, open in the panel, and ticked while open. One scale carries all
   four -- the same accent over the same surface in rising amounts -- so they
   read as degrees of one thing rather than four unrelated colours, and they
   are mixed from the theme's accent, so the ladder survives cyber-goth as
   well as the book's palette.

   The colour goes on the CELLS, not the row: with border-collapse separate a
   td's own background paints over its tr's, so a background set on the row
   would be invisible the moment a cell had one.

   Hover is deliberately the faintest step. It follows the pointer and is gone
   a moment later; the two states that mean something the person chose must
   outrank it, including while the pointer is over them. It also leans toward
   the FOREGROUND, not only the accent: a few per cent of accent over a
   near-black surface is still near-black, while a mix with the foreground
   lightens a dark theme and darkens a light one -- either way a step away
   from the surface, which is all "the pointer is here" has to mean. */
@media (hover: hover) {
  .library-main tbody tr:hover td {
    background: color-mix(in oklab, var(--uk-fg) 7%, color-mix(in oklab, var(--uk-accent) 9%, var(--card)));
  }
  .library-main tbody tr.sel:hover td {
    background: color-mix(in oklab, var(--uk-fg) 6%, color-mix(in oklab, var(--uk-accent) 19%, var(--card)));
  }
  .library-main tbody tr.open:hover td {
    background: color-mix(in oklab, var(--uk-fg) 6%, color-mix(in oklab, var(--uk-accent) 32%, var(--card)));
  }
}
.library-main tbody tr.sel td { background: color-mix(in oklab, var(--uk-accent) 14%, var(--card)); }
.library-main tbody tr.open td { background: color-mix(in oklab, var(--uk-accent) 30%, var(--card)); }
/* The open row keeps a mark that does not depend on colour: a bar down its
   leading edge, and its name in the ink colour, underlined. On the FIRST cell
   only -- an inset shadow on every td draws the bar again at every column
   boundary. */
.library-main tbody tr.open td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.library-main tbody tr.open .link-name { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

/* Minimal mode: the name, and nothing else. Hiding the later columns rather
   than rendering a second table keeps one row builder and one set of ids, so
   the selection and the open row survive the toggle. `min-width: 0` is the
   half that matters -- without it the table keeps its 34rem floor and the
   splitter cannot give the preview the room this mode exists to free. */
.table-scroll.minimal table { min-width: 0; }
.table-scroll.minimal th:nth-child(n + 3),
.table-scroll.minimal td:nth-child(n + 3) { display: none; }
.table-scroll.minimal .tn,
.table-scroll.minimal .cell-name .sub { display: none; }
.table-scroll.minimal td { padding-block: 0.25rem; }
.table-scroll.minimal .link-name { font-weight: 500; }

/* ── The selection, and what can be done with it ──────────────────────────── */
.bulk {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 0.8rem; padding: 0.45rem 0.6rem; border-radius: var(--radius);
  font-size: 0.8125rem;
  background: color-mix(in oklab, var(--uk-accent) 12%, var(--card));
  border: 1px solid color-mix(in oklab, var(--uk-accent) 40%, transparent);
}
.bulk strong { color: var(--accent-2); font-variant-numeric: tabular-nums; margin-right: auto; }

/* A pair of buttons that act as one control. */
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 8px; overflow: hidden; }
.seg-btn {
  font: inherit; font-size: 0.8125rem; font-weight: 500;
  background: transparent; color: var(--text-2); border: 0; padding: 0.3rem 0.6rem; cursor: pointer;
}
.seg-btn.lone { border: 1px solid var(--rule-strong); border-radius: 8px; }
.seg-btn + .seg-btn { border-left: 1px solid var(--rule-strong); }
.seg-btn:hover { background: var(--paper-2); color: var(--ink); }
.seg-btn[aria-pressed='true'] {
  background: color-mix(in oklab, var(--uk-accent) 16%, var(--card));
  color: var(--accent-2);
}

/* A tile's checkbox, over its top-left corner. */
/* The tick sits over a thumbnail that can be any colour, so it carries its
   own backing rather than hoping for contrast. */
.tile-tick {
  position: absolute; top: 0.35rem; left: 0.35rem; z-index: 1;
  display: grid; place-items: center; padding: 0.15rem;
  border-radius: 6px; background: color-mix(in oklab, var(--card) 80%, transparent);
  border: 1px solid var(--rule);
}
.asset-wrap { position: relative; }
.asset-wrap.sel .asset { border-color: color-mix(in oklab, var(--uk-accent) 45%, transparent); background: color-mix(in oklab, var(--uk-accent) 14%, var(--card)); }
.asset-wrap.selected .asset { background: color-mix(in oklab, var(--uk-accent) 30%, var(--card)); }

/* ── The full-size preview ───────────────────────────────────────────────── */
.detail-preview.zoomable { display: block; width: 100%; padding: 0; cursor: zoom-in; position: relative; }
.detail-preview .zoom-tag {
  position: absolute; right: 0.4rem; bottom: 0.4rem;
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(0, 0, 0, 0.55); color: #fff; padding: 0.15rem 0.4rem; border-radius: 4px;
}
/* `margin: auto` is not decoration: something in the stylesheets this page
   loads sets a margin on dialog, and without it the modal opens hard against
   the top-left corner instead of centred. */
dialog.lightbox {
  width: min(60rem, calc(100vw - 2rem)); max-height: calc(100vh - 3rem);
  margin: auto; background: var(--paper);
}
.lightbox-body { margin: 0; display: grid; }
.lightbox-body img { display: block; width: 100%; max-height: calc(100vh - 8rem); object-fit: contain; background: var(--paper-2); }
.lightbox-body figcaption { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; }
.lightbox-body figcaption .small { margin-right: auto; }

/* ---- The details panel ---- */
.library-side {
  position: sticky; top: 1rem; min-width: 0;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1rem;
}
.detail-head { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.7rem; }
.detail-head h3 { margin: 0; margin-right: auto; font-size: 0.95rem; text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }
.detail-preview { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.detail-preview img, .detail-preview object { display: block; width: 100%; max-height: 14rem; object-fit: contain; }
.detail-facts { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.8rem; margin: 0.8rem 0 0; font-size: 0.8125rem; }
.detail-facts dt { color: var(--text-3); }
.detail-facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.detail-sub { margin: 1rem 0 0.4rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.detail-uses { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; font-size: 0.8125rem; }
.detail-uses li { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

/* ---- Picker ---- */
dialog {
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0;
  width: min(54rem, calc(100vw - 2rem));
  max-height: min(42rem, calc(100vh - 4rem));
  background: var(--paper);
  color: var(--text);
}
dialog::backdrop { background: rgba(20, 59, 67, 0.35); }
.picker-head { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--paper); }
.picker-head h3 { margin-right: auto; text-transform: none; letter-spacing: 0; font-size: 1.05rem; }
.picker-grid { padding: 1.2rem; }

/* ---- Alt-text step ---- */
.alt-body { padding: 1.2rem; display: grid; gap: 0.2rem; }
.alt-body img { width: 100%; max-height: 16rem; object-fit: contain; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 8px; }
#alt-dialog { width: min(34rem, calc(100vw - 2rem)); }

/* A destructive action confirms in place rather than in a native dialog. */
.btn.confirming { background: var(--danger); color: var(--paper); border-color: var(--danger); }

/* ---- Attachments ---- */
.attachments { list-style: none; padding: 0; margin-top: 0.6rem; display: grid; gap: 0.4rem; }
.attachments li {
  display: flex; align-items: center; gap: 0.5rem;
  border: 1px solid var(--rule); border-radius: 8px; padding: 0.45rem 0.55rem;
  background: var(--paper-2); font-size: 0.8125rem;
}
.attachments .name { font-weight: 500; overflow-wrap: anywhere; min-width: 0; }
.attachments .size { color: var(--text-3); margin-left: auto; white-space: nowrap; }
.attachments .drop { background: none; border: 0; color: var(--danger); cursor: pointer; font: inherit; font-weight: 600; padding: 0 0.2rem; }
.attachments .drop:hover { text-decoration: underline; }
.doc-badge {
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--paper); background: var(--ink); border-radius: 3px; padding: 0.15rem 0.3rem; flex: none;
}

/* A library tile for something with no picture to show. */
.asset .doc-face {
  width: 100%; aspect-ratio: 4 / 3; background: var(--paper-2);
  display: grid; place-items: center; gap: 0.3rem;
  color: var(--text-3); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em;
}
.asset .doc-face .glyph {
  font-size: 0.6875rem; color: var(--paper); background: var(--ink);
  border-radius: 4px; padding: 0.2rem 0.45rem; letter-spacing: 0.08em;
}

/* An asset whose bytes could not be fetched — shown as a gap with a reason on
   hover, rather than the browser's broken-image glyph. */
.media-failed { background: repeating-linear-gradient(45deg, var(--paper-2), var(--paper-2) 6px, #e8e2da 6px, #e8e2da 12px); }

/* ---- Development user switcher ----
   Visibly a development tool, not part of the product: a dashed border and a
   warning label, so nobody mistakes it for something a reader should see. */
.dev-switcher {
  width: min(27rem, 100%);
  margin-top: 1rem;
  border-style: dashed;
  border-color: var(--accent);
  background: #fffdf9;
}
.dev-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.dev-users { list-style: none; padding: 0; margin-top: 0.7rem; display: grid; gap: 0.35rem; }
/* The account button, and beside it the password that works for it. The
   password is OUTSIDE the button so it can be selected and copied without the
   click signing you in. */
.dev-users li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.dev-users li > .dev-user { flex: 1 1 11rem; }
.dev-pass {
  font-family: var(--font-mono); font-size: 0.8125rem;
  color: var(--text-2); background: var(--paper-2);
  border: 1px solid var(--rule); border-radius: 6px; padding: 0.3rem 0.45rem;
  /* One click selects the whole thing: this exists to be copied. */
  user-select: all;
}
/* Narrow, and it does not grow: the account button takes the slack, so the
   three parts of a row stay in the same columns down the list. */
.dev-fill { flex: 0 0 auto; padding: 0.3rem 0.5rem; font-size: 0.75rem; }

.dev-pass.unknown {
  font-family: inherit; font-size: 0.75rem; color: var(--text-3);
  background: none; border-style: dashed; user-select: auto;
}
.dev-user {
  display: flex; align-items: baseline; gap: 0.6rem; width: 100%;
  font: inherit; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--rule); border-radius: 8px;
  padding: 0.45rem 0.6rem;
}
.dev-user:hover { border-color: var(--accent); box-shadow: var(--shadow); }
/* `progress` is the right cursor for a button disabled while something runs,
   which is what .btn[disabled] means. A row here is disabled because the
   password is not known, and that is not going to finish. */
.dev-user[disabled] { opacity: 0.55; cursor: default; }
.dev-user[disabled]:hover { border-color: var(--rule); box-shadow: none; }
.dev-name { font-weight: 600; color: var(--ink); }
.dev-roles { font-size: 0.8125rem; color: var(--text-3); margin-left: auto; }
.dev-flag {
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--paper); background: var(--text-3);
  border-radius: 3px; padding: 0.1rem 0.3rem;
}

/* ── Settings ──────────────────────────────────────────────────────────────
   Appearance used to be three controls in the header strip. A section has the
   room to show what a choice did, which is the whole point of choosing a
   theme. */
.setting {
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card);
  padding: 1rem; margin-bottom: 1rem; max-width: 46rem;
}
.setting h3 { margin: 0 0 0.2rem; font-size: 0.95rem; text-transform: none; letter-spacing: 0; color: var(--ink); }
.setting .appearance { display: block; margin-top: 0.6rem; }
.setting-sample {
  margin-top: 0.9rem; padding: 0.7rem; border-radius: 8px;
  border: 1px solid var(--rule); background: var(--paper-2);
  display: grid; gap: 0.2rem; justify-items: start;
}
.stored { margin: 0.4rem 0 0.8rem; padding-left: 1.1rem; display: grid; gap: 0.2rem; font-size: 0.8125rem; color: var(--text-2); }
.stored code { font-size: 0.9em; }

/* ── Schema ────────────────────────────────────────────────────────────────
   The platform described by the platform. Dense on purpose: this is reference
   material, read in columns, not prose. */
.schema-head { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; margin: 0 0 1rem; font-size: 0.8125rem; }
.schema-head dt { color: var(--text-3); }
.schema-head dd { margin: 0 0 0 0.3rem; font-weight: 600; color: var(--ink); }
.schema-head dt, .schema-head dd { display: inline; }
.schema-sub { margin: 1.4rem 0 0.5rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }

/* <uk-diagram> is an editor; here it draws a picture, so it gets a frame and
   a fixed height rather than filling the page. */
.schema-diagram {
  display: block; block-size: 22rem; inline-size: 100%;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card);
}
.schema-diagram.short { block-size: 14rem; margin-top: 0.4rem; }

.schema-list { display: grid; gap: 0.5rem; }
.schema-card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.schema-card.open { border-color: color-mix(in oklab, var(--uk-accent) 45%, transparent); }
.schema-head-btn {
  width: 100%; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  background: none; border: 0; padding: 0.6rem 0.7rem; cursor: pointer; font: inherit; text-align: left;
}
.schema-head-btn strong { color: var(--ink); }
.schema-head-btn:hover { background: color-mix(in oklab, var(--uk-accent) 8%, var(--card)); }
.schema-card.open .schema-head-btn { background: color-mix(in oklab, var(--uk-accent) 12%, var(--card)); }
.schema-detail { padding: 0 0.7rem 0.8rem; display: grid; gap: 0.2rem; }

.schema-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.8125rem; margin-top: 0.3rem; }
.schema-table th {
  text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--rule);
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3);
}
.schema-table td { padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.schema-table tr:last-child td { border-bottom: 0; }
.schema-table code { font-size: 0.9em; }
.schema-plain { margin: 0.3rem 0 0; padding-left: 1.1rem; font-size: 0.8125rem; display: grid; gap: 0.15rem; }

/* ── The page builder ──────────────────────────────────────────────────────
   A page is a list of blocks, so the editor is a list too: one card per
   block, closed to its summary until you open it. */
.blocks { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.block-card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.block-card.open { border-color: color-mix(in oklab, var(--uk-accent) 45%, transparent); }
.block-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.6rem; }
.block-title {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.5rem;
  background: none; border: 0; padding: 0; font: inherit; text-align: left; cursor: pointer;
}
.block-summary { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8125rem; }
.block-tools { display: flex; gap: 0.3rem; flex: none; }
.block-tools .btn { padding-inline: 0.5rem; }
.btn.ghost.danger { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 40%, transparent); }
.block-fields { padding: 0 0.6rem 0.7rem; display: grid; gap: 0.5rem; }
.block-fields textarea { font-family: var(--mono, ui-monospace, monospace); font-size: 0.8125rem; }
.add-block { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; padding: 0.6rem; border: 1px dashed var(--rule-strong); border-radius: var(--radius); }

/* ── Playground ────────────────────────────────────────────────────────────
   A document on the left, what the server makes of it on the right. */
.pg-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 68rem) { .pg-grid { grid-template-columns: minmax(0, 1fr); } }
.pg-text {
  width: 100%; font-family: var(--mono, ui-monospace, monospace); font-size: 0.8125rem;
  line-height: 1.5; tab-size: 2; resize: vertical;
}
.pg-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.pg-side { display: grid; gap: 0.3rem; align-content: start; }
.pg-sql {
  margin: 0.3rem 0 0; padding: 0.6rem; border-radius: 8px; overflow: auto;
  background: var(--paper-2); border: 1px solid var(--rule);
  font-family: var(--mono, ui-monospace, monospace); font-size: 0.75rem; white-space: pre-wrap;
}
.pg-danger {
  margin-top: 0.8rem; padding: 0.7rem; border-radius: var(--radius);
  border: 1px solid var(--danger); background: color-mix(in oklab, var(--danger) 8%, var(--card));
}
.pg-danger strong { color: var(--danger); }
.pg-danger input { margin-top: 0.4rem; }
uk-adl-field { display: block; margin: 0.4rem 0; }

/* The dashboard: one card per section of the platform (components/dashboard.js). */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; margin-top: 1.25rem; }
.dash-card { border: 1px solid var(--uk-border, var(--border, #d0d7de)); border-radius: 12px; padding: 1.1rem 1.2rem; background: var(--uk-surface, transparent); display: flex; flex-direction: column; }
.dash-card h3 { margin: .2rem 0 .5rem; }
.dash-card p { margin: .35rem 0; }
.dash-eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .75; }
.dash-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: auto !important; padding-top: .6rem; }
