/*
  app.css: the building blocks every page uses.

  Uses only the variables from tokens.css (var(--...)), so colours stay in
  one place and dark mode works everywhere automatically.

  Sections:
    1. Base          4. Buttons
    2. Text          5. Forms and alerts
    3. Cards, stacks 6. Sign-in page   7. App layout (sidebar, top bar, menus)
    8. Lists, badges  9. Page head, forms, pop-ups (0.3.5)
*/

/* 1. Base ---------------------------------------------------------------- */

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

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
}

/* A visible focus ring on everything you can reach with the Tab key. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

/* 2. Text ---------------------------------------------------------------- */

.page-title    { margin: 0; font-size: 22px; line-height: 28px; font-weight: 600; }
.section-title { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.text-strong   { font-weight: 600; }
.text-secondary{ margin: 0; color: var(--ink-2); }
.text-muted    { margin: 0; color: var(--ink-3); }
.text-small    { font-size: 13px; line-height: 18px; }
.text-xsmall   { font-size: 12px; line-height: 16px; }
/* ops 1.3.19: status words in a table cell (used before without a style). */
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }

/* 3. Cards and vertical stacks -------------------------------------------- */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

/* .stack-N puts N px of space between the children of a box. */
.stack-4  { display: flex; flex-direction: column; gap: var(--space-1); }
.stack-8  { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-16 { display: flex; flex-direction: column; gap: var(--space-4); }

/* 4. Buttons -------------------------------------------------------------- */

/* .btn works on <button> and on links (<a class="btn">): inline-flex
   centres the text both ways, and links lose their underline. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 44px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-block { width: 100%; }

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface-1);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); }

/* 5. Forms and alerts ----------------------------------------------------- */

/* Form spacing, the same on every form:
     label → its input            6px   (.field gap)
     input → its own error text   6px   (.field gap)
     field → next field          20px   (.form gap)
     last field → .form-actions  28px   (.form gap 20 + margin 8)
     message → button            12px   (.form-actions gap)
   Fields read as one group; the message and the button as another. */
.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--ink-2);
}

.input {
  width: 100%;          /* fill the field, also inside .input-wrap */
  height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}

/* Field validation: red border, ! icon and a message under the field.
   Two ways a field becomes red, neither needs JavaScript:
     .has-error         the server found a problem (set by partials/fields.html)
     .input:user-invalid the browser sees an empty required field after the
                        user has left it (CSS only; message text comes from
                        the server on submit) */

.input-wrap { position: relative; }

.field-icon {
  display: none;               /* only shown when the field is invalid */
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--danger);
  pointer-events: none;        /* clicks go through to the input */
}

.has-error .input,
.input:user-invalid {
  border-color: var(--danger);
  padding-right: 40px;         /* room for the icon */
}

.has-error .field-icon,
.input:user-invalid + .field-icon {
  display: block;
}

.has-error .input:focus-visible,
.input:user-invalid:focus-visible {
  outline-color: var(--danger);
}

.field-error {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--danger);
}

/* Message line: soft background, no border, a coloured icon, then the text.
   The text stays in --ink for easy reading; the icon carries the colour. */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 20px;
  color: var(--ink);
}
.alert-icon {
  flex-shrink: 0;
  margin-top: 1px;             /* lines the icon up with the first text line */
}
.alert-danger { background: var(--danger-soft); }
.alert-danger .alert-icon { color: var(--danger); }

/* 6. Sign-in page --------------------------------------------------------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  padding: 48px var(--space-4);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Logo + "ops" word mark */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-size: 20px; font-weight: 600; letter-spacing: -0.5px; }
.brand-large .brand-name { font-size: 28px; line-height: 1; }
.brand-tag { margin-left: auto; }

/* 7. App layout: sidebar | top bar + page (live check F9) ---------------- */

/* Wide screens: sidebar on the left (its own height and scroll), the rest
   on the right. The top bar sticks to the top while the page scrolls. */
.app { display: flex; min-height: 100vh; }

.sidebar {
  flex: 0 0 240px;
  width: 240px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  padding: 14px var(--space-3) 20px;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.sidebar-brand {
  height: 36px; padding: 0 var(--space-2);
  color: inherit; text-decoration: none; border-radius: var(--radius-md);
}
.sidebar-brand:hover { color: inherit; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--space-3);
  height: 56px; padding: 0 var(--space-6) 0 var(--space-3);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.topbar-name { display: none; font-weight: 600; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }

.content {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Icons from /static/img/icons.svg take the text colour. */
.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* Menu */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-heading {
  padding: 0 var(--space-2) 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-md);
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* Collapsed sidebar (wide screens): icons only; the label shows as a
   tooltip (title). Chosen with the ☰ button, remembered by app.js. */
@media (min-width: 800px) {
  .sidebar-collapsed .sidebar { flex-basis: 64px; width: 64px; padding-left: 10px; padding-right: 10px; }
  .sidebar-collapsed .nav-text,
  .sidebar-collapsed .nav-heading { display: none; }
  .sidebar-collapsed .nav-item,
  .sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
  .sidebar-collapsed .nav-group .nav-heading + .nav-item { margin-top: var(--space-3); }
}

/* Phones. With the script: the sidebar slides in over the page (☰), with a
   dark layer behind it. Without the script: it sits above the page. */
@media (max-width: 799px) {
  .app { flex-direction: column; }
  .sidebar { position: static; width: auto; height: auto; flex-basis: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .topbar { padding-right: var(--space-4); }
  .topbar-name { display: inline-flex; }
  .content { padding: var(--space-4); }
  .avatar-name { display: none; }

  .js .sidebar {
    position: fixed; z-index: 40; top: 0; left: 0; bottom: 0;
    width: 260px; height: 100vh;
    border-right: 1px solid var(--border); border-bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .js.nav-open .sidebar { transform: none; }
  .js.nav-open .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 30;
    background: rgba(0, 0, 0, 0.35);
  }
}
.nav-scrim { display: none; }
html:not(.js) .topbar [data-action="toggle-sidebar"] { display: none; }

/* The avatar menu: a native popover (opens without JavaScript, closes on a
   click outside or Esc). It sits in the browser's top layer, so it is
   placed against the screen: just under the top bar, at the right. */
.avatar-btn {
  display: flex; align-items: center; gap: var(--space-2);
  height: 40px; padding: 0 var(--space-2) 0 4px;
  border: 0; border-radius: 20px; background: transparent;
  color: var(--ink-2); font: inherit; cursor: pointer;
}
.avatar-btn:hover { background: var(--surface-2); color: var(--ink); }
.avatar-name { color: var(--ink); font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.menu-panel {
  position: fixed; inset: 56px 16px auto auto; margin: 0;
  min-width: 240px; max-width: calc(100vw - 32px);
  padding: 6px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
/* Only when open: a display value on .menu-panel itself would beat the
   browser's own "hidden until opened" rule for popovers, and the menu
   would show on every page (found in the 0.4.1 checks). */
.menu-panel:popover-open { display: flex; flex-direction: column; gap: 2px; }
.menu-panel form { margin: 0; }
.menu-head {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px 10px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 38px; padding: 0 10px;
  border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--ink);
  font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item:hover, .menu-item.is-active { background: var(--surface-2); color: var(--ink); }
.menu-item .icon { color: var(--ink-3); }

/* 8. Phase 3: lists, badges, small buttons, messages ---------------------- */

/* Page heading with buttons on the right (wraps on phones). */
.page-head, .section-head {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: var(--space-3);
}

/* Small buttons inside tables and headings. */
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-danger { background: var(--danger); color: var(--surface-1); border-color: transparent; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
/* 0.14.0 (owner, 5 Nov): a page's main action (Add site, Invite, New
   role) is a small + beside the title on a phone; its words show on a
   wide screen and as its tooltip. */
/* 0.14.0: row actions as small icons, kept together at the row's end. */
td.row-actions { width: 1%; white-space: nowrap; text-align: right; }
.row-actions form { display: inline; }
/* 0.15.3 (owner, 5 Nov, seen on Workers): outside a table (a card's head)
   the actions are a row of their own at the right, the badge beside the
   icons; the 1% width is only for a table's last cell. */
div.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
.wrap-anywhere { overflow-wrap: anywhere; }
/* 0.14.0 (owner, 3 Nov, review of 0.11.7): on a phone a long value (an
   address, a SHA-256, an IPv6 address) breaks where it would overflow,
   instead of pushing the page sideways; wide screens keep their tables. */
@media (max-width: 640px) {
  .table td, .card-cell, .kv dd, .notes, .alert span { overflow-wrap: anywhere; min-width: 0; }
}
.menu-heading { display: block; padding: 6px 12px 4px; font-size: 12px; color: var(--ink-3); }
@media (max-width: 640px) {
  .page-head:has(> .btn-main) { flex-wrap: nowrap; align-items: flex-start; }
  .btn-main { flex: 0 0 auto; width: 44px; height: 44px; padding: 0; justify-content: center; }
  .btn-main .btn-label { display: none; }
}
.btn-row form { margin: 0; }

/* Tables: the wrapper scrolls sideways on phones instead of the page. */
.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--space-2)); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: var(--space-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px var(--space-2); border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table a { color: var(--ink); font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.cell-action { text-align: right; white-space: nowrap; }
.cell-action form { margin: 0; display: inline; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.empty { color: var(--ink-3); padding: var(--space-4) 0; }

/* Badges: account status, "This device", "Dangerous". */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2);
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-paused  { background: var(--paused-soft);  color: var(--paused); }

/* More message colours (alert-danger is in section 5). */
.alert-success { background: var(--success-soft); }
.alert-success .alert-icon { color: var(--success); }
.alert-warning { background: var(--warning-soft); }
.alert-warning .alert-icon { color: var(--warning); }
.alert-info { background: var(--info-soft); }
.alert-info .alert-icon { color: var(--info); }

/* Label / value pairs (account details). */
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--space-6); margin: 0; }
.details dt { color: var(--ink-3); }
.details dd { margin: 0; word-break: break-word; }

/* Forms that should not stretch across a wide screen. */
.form-narrow { max-width: 420px; }
textarea.input { min-height: 72px; resize: vertical; font-family: inherit; }
/* 0.11.11 (owner, 3 Nov): our own arrow, set in from the right edge (the
   browser's own sat against the edge); grey that reads on both themes. */
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("../img/select-arrow.svg"); /* a file: the CSP allows no data: images */
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 12px;
}
select.input::-ms-expand { display: none; }

/* A list of permissions with tick boxes. */
.checks { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; border: 0; }
.check {
  display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start;
  padding: 8px; border-radius: var(--radius-md);
}
.check:hover { background: var(--surface-2); }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); }
.check-text { display: flex; flex-direction: column; gap: 2px; }
.check-disabled { opacity: 0.6; }


/* Text only screen readers read (e.g. a column without a heading). */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Overview numbers. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-4); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 26px; line-height: 32px; font-weight: 600; }
.plain-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.input-inline { width: auto; min-width: 220px; }

/* Columns that are dropped on phones (the page stays readable without
   sideways scrolling; the details are one tap away). */
@media (max-width: 640px) {
  .hide-narrow { display: none; }
}
.nav-group .nav-heading:not(:first-child) { margin-top: var(--space-3); }

/* 9. Page head, breadcrumb, form bar, pop-ups (live check F6, F10) -------- */

/* Title with the breadcrumb under it; the page's main buttons on the right. */
.page-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.breadcrumb a { color: var(--ink-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--ink-3); }

/* Save / Cancel stay visible at the bottom of the screen on long forms. */
.form-bar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center;
  margin: 0 calc(-1 * var(--space-6));
  padding: var(--space-3) var(--space-6);
  background: var(--surface-0);
  border-top: 1px solid var(--border);
}
@media (max-width: 799px) {
  .form-bar { margin: 0 calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4); }
  .form-bar .btn { flex: 1 1 0; }
}

/* The row just saved (the address ends in #role-3 or #user-7). */
@keyframes row-saved { from { background: var(--primary-soft); } to { background: transparent; } }
.table tr:target td { animation: row-saved 3s ease-out; }
.table tr { scroll-margin-top: 80px; }

/* Pop-ups (<dialog>), opened by app.js. */
.dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  color: var(--ink);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.dialog-body { padding: var(--space-6); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }
.dialog form { margin: 0; }
/* Without JavaScript a pop-up form is simply shown in the page. */
html:not(.js) dialog.dialog-inline {
  display: block; position: static; width: auto; margin: 0;
  box-shadow: none; border: 0; background: transparent;
}
html:not(.js) dialog.dialog-inline .dialog-body { padding: 0; }
html:not(.js) [data-open-dialog],
html:not(.js) dialog.dialog-inline [data-close-dialog] { display: none; }

.confirm-card { max-width: 560px; }

/* ------------------------------------------------------------------ */
/* Two-step sign-in (0.4.2): code boxes, the method choice, the QR code,
   recovery codes. */
.input-code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 20px; letter-spacing: 0.2em; }
.input-code-wide { font-size: 16px; letter-spacing: 0.05em; }
.divider { border: 0; border-top: 1px solid var(--border); margin: var(--space-2) 0; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%;
  padding: 14px 16px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
}
.choice:hover, .choice:focus-visible { border-color: var(--primary); background: var(--surface-2); }
.qr { display: flex; justify-content: center; }
.qr svg { width: 200px; height: 200px; border-radius: var(--radius-md); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.recovery summary { cursor: pointer; color: var(--ink-2); }
.recovery[open] summary { margin-bottom: var(--space-3, 12px); }
.recovery-codes {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px;
  margin: 0; padding: 16px 16px 16px 36px; font-size: 17px;
  background: var(--surface-2); border-radius: var(--radius-md);
}

/* ------------------------------------------------------------------ */
/* Lists (0.6.0, partials/list.html): filters, sortable headings, pages. */
.list-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.list-filters .field { flex: 1 1 160px; max-width: 240px; margin: 0; }
.list-filter-actions { display: flex; gap: var(--space-2); align-items: center; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.table th .sort-link {
  color: inherit; font-weight: inherit; text-decoration: none;
  display: inline-flex; gap: 4px; align-items: center;
}
.table th .sort-link:hover { color: var(--ink); text-decoration: underline; }
.table th[aria-sort="ascending"], .table th[aria-sort="descending"] { color: var(--ink); }
.sort-mark { font-size: 10px; }
.table .num { text-align: right; }
.pager {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: var(--space-2); margin-top: var(--space-3);
}
.pager-links { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pager-links a, .pager-current {
  min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex;
  align-items: center; justify-content: center; border-radius: var(--radius-sm);
  font-size: 14px; text-decoration: none; color: var(--ink-2);
}
.pager-links a:hover { background: var(--surface-2); color: var(--ink); }
.pager-current { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
@media (max-width: 640px) {
  .list-filters .field { max-width: none; flex-basis: 100%; }
}
.nowrap { white-space: nowrap; }

/* Numbered steps in a card (two_step_elsewhere.html, 0.7.0). */
.steps-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }

/* Show / Hide password (0.7.0, U2; the button is added by app.js, part 7).
   It sits inside the box on the right; the ! icon of a refused field moves
   left of it. */
.has-reveal .input { padding-right: 72px; }
.has-reveal .field-icon { right: 64px; }
.has-error .has-reveal .input,
.has-reveal .input:user-invalid { padding-right: 96px; }
.reveal-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 32px;
  min-width: 52px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.reveal-btn:hover { background: var(--surface-1); color: var(--ink); }
.reveal-btn[aria-pressed="true"] { color: var(--ink); }

/* 0.10.6 (owner): a button whose form is being sent in the background
   (app.js part 8) shows a spinner over its greyed text. */
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink-3);
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
/* The other buttons of that form are off meanwhile: shown faded. */
.btn:disabled:not(.is-busy) { opacity: 0.55; cursor: default; }
/* On a filled button, the spinner in the button's text colour. */
.btn-primary.is-busy::after, .btn-danger.is-busy::after { border-color: var(--on-primary); border-right-color: transparent; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn.is-busy::after { animation-duration: 2s; }
}

/* 0.11.0 (owner): pop-ups that load a page part (app.js part 9); they
   stack, the newest on top. */
dialog.layer {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  color: var(--ink);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
  overflow: auto;
}
dialog.layer::backdrop { background: rgba(0, 0, 0, 0.4); }
.layer-head { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: var(--space-2) var(--space-2) 0; background: var(--surface-1); z-index: 1; }
.layer-close { width: 36px; height: 36px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink-2); font-size: 22px; line-height: 1; cursor: pointer; }
.layer-close:hover { background: var(--surface-2); color: var(--ink); }
.layer-body { padding: 0 var(--space-6) var(--space-6); }
.layer-body > .card { border: 0; box-shadow: none; padding: 0; margin: 0; background: transparent; }
.layer-loading { padding: var(--space-6) 0; }

/* Command buttons in a table row: view, edit, seeds, remove. */
.row-commands { display: flex; gap: 2px; justify-content: flex-end; white-space: nowrap; }
.row-commands form { margin: 0; display: inline-flex; }
.row-commands .icon-btn { width: 32px; height: 32px; color: var(--ink-3); text-decoration: none; }
.row-commands .icon-btn:hover { color: var(--ink); }
.row-commands .icon-btn.danger:hover { color: var(--danger); }
.icon-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
/* A state badge that opens the pause / resume pop-up. */
.badge-button { border: 0; cursor: pointer; font: inherit; }
.badge-button:hover { filter: brightness(0.95); text-decoration: underline; }

/* Tabs under a page title (a site's Summary, Discovery, Pages, History). */
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); }
.tabs a { padding: var(--space-2) var(--space-3); color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: 14px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }

/* The live Overview (0.11.0). */
.live-note { color: var(--ink-3); font-size: 12px; }

.text-break  { overflow-wrap: anywhere; }


/* ======================================================================
   10. The 0.11.3 look (owner, 3 Nov 2026; proposal "Ops 0.11.3 UI
   proposal"): denser tables, a status dot on badges, the top bar's light
   / dark switch, waiting states for lists, pop-ups with a title bar and
   Save in view, the Overview's band of totals, bars and event feed.
   These rules come last on purpose: they refine the ones above.
   ====================================================================== */

body { font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
code, .mono { font-family: var(--font-mono); }

/* Buttons and boxes a little lower: more rows fit on a screen. */
.btn { height: 40px; gap: var(--space-2); }
.btn .icon { width: 16px; height: 16px; }
.input { height: 40px; }
textarea.input { height: auto; padding-top: 8px; padding-bottom: 8px; }
.card { padding: 20px; }
.content { padding: var(--space-6) 28px 40px; gap: 20px; }

/* Top bar: the middle is kept free (search, AI assistant, shortcuts). */
.topbar-space { flex: 1 1 auto; min-width: 0; }
.topbar-tools { margin-left: 0; gap: 4px; }
.topbar-sep { width: 1px; height: 24px; background: var(--border); margin: 0 6px; }
.theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-btn .icon-sun { display: block; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .icon-moon { display: none; }
}
.avatar-btn { border-radius: var(--radius-md); height: 44px; }
.avatar-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.avatar-sub { font-size: 11px; color: var(--ink-3); }
.menu-panel { border-radius: 12px; box-shadow: var(--shadow-pop); min-width: 260px; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-item-danger, .menu-item-danger .icon { color: var(--danger) !important; }
@media (max-width: 799px) { .avatar-text { display: none; } .topbar-space { display: none; } }

/* The side menu's foot: the version. */
.sidebar-foot {
  margin-top: auto; padding: 12px var(--space-2) 0; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--ink-3);
}
.sidebar-collapsed .sidebar-foot { display: none; }

/* Tables: sentence-case headings on a band, rows of about 40 px. */
.table { font-size: 14px; }
.table th {
  text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 500; color: var(--ink-2);
  background: var(--surface-2); padding: 8px var(--space-3); border-bottom: 1px solid var(--border);
}
.table td { padding: 9px var(--space-3); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2h); }
.table th[aria-sort="ascending"], .table th[aria-sort="descending"] { color: var(--ink); }
/* In a card the table runs to the card's edges. */
.card > .table-wrap, .card .table-wrap { margin: 0 -20px; }
.card .table th:first-child, .card .table td:first-child { padding-left: 20px; }
.card .table th:last-child, .card .table td:last-child { padding-right: 20px; }
.cell-sub { display: block; font-size: 12px; line-height: 16px; color: var(--ink-3); font-weight: 400; }
/* ops 1.3.22 (F4): a state cell keeps its badge on one line; the note
   under it wraps within a set width, so the table never grows sideways. */
.state-cell .badge { white-space: nowrap; }
.cell-note { max-width: 13rem; white-space: normal; overflow-wrap: anywhere; }
.table .cell-sub.mono { font-size: 12px; }
.text-faint { color: var(--ink-3); }

/* Status badges carry a dot as well as the word. */
.badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; padding: 2px 8px; }
.badge-success::before, .badge-warning::before, .badge-danger::before,
.badge-info::before, .badge-paused::before {
  content: ""; width: 6px; height: 6px; border-radius: 3px; background: currentColor; flex-shrink: 0;
}
.badge-button { text-decoration: none; font-size: 12px; font-weight: 500; line-height: 18px; }
.badge-button:hover { text-decoration: none; filter: brightness(0.96); }
.badge-button .icon { width: 12px; height: 12px; }

/* List bars: filters inside the card, a count on the right. */
.list-filters { margin-bottom: var(--space-4); gap: 10px; }
.list-filters .input, .list-filters .btn { height: 36px; }
.list-filters .field { max-width: 260px; }
.list-filters .field label { font-size: 12px; }
.pager { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.pager-links a, .pager-current { border-radius: var(--radius-md); }
.list-count { font-size: 13px; color: var(--ink-3); }

/* Waiting for a list (owner, 3 Nov): the pressed control turns, the rows
   fade, "Loading…" floats over them; the page keeps its place. Set by
   app.js part 10 and taken away when the new rows arrive. */
.is-loading { position: relative; }
.is-loading table, .is-loading .feed { opacity: 0.45; transition: opacity 0.2s; }
.loading-pill {
  position: absolute; left: 50%; top: 96px; transform: translateX(-50%); z-index: 5;
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-radius: 18px; background: var(--surface-1); border: 1px solid var(--border);
  box-shadow: var(--shadow-pop); font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.spinner, .loading-pill::before {
  width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: btn-spin 0.8s linear infinite; flex-shrink: 0;
}
.loading-pill::before { content: ""; }
a.is-busy, .seg a.is-busy { position: relative; color: transparent !important; pointer-events: none; }
/* 0.16.2: a pressed link while its card shows "Loading…": no second sign,
   but no second press either. */
.is-pending { pointer-events: none; }
a.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 12px; height: 12px;
  border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%;
  animation: btn-spin 0.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .spinner, .loading-pill::before, a.is-busy::after { animation-duration: 2.4s; }
}

/* A segmented switch (All / Pages / Failed only). */
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-1); }
.seg a { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.seg a + a { border-left: 1px solid var(--border); }
.seg a:hover { background: var(--surface-2); color: var(--ink); }
.seg a[aria-current="true"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* Bars: a day's requests against its limit, and the like. */
/* A <progress> (the page's security rules allow no inline styles, so no
   width="…%" boxes): the track and its fill, in every browser. */
.meter {
  appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 6px;
  border: 0; border-radius: 3px; background: var(--surface-2); overflow: hidden; color: var(--primary);
}
.meter::-webkit-progress-bar { background: var(--surface-2); border-radius: 3px; }
.meter::-webkit-progress-value { background: currentColor; border-radius: 3px; }
.meter::-moz-progress-bar { background: currentColor; border-radius: 3px; }
.meter-warning { color: var(--warning); }
.meter-success { color: var(--success); }
.meter-info { color: var(--info); }
/* 1.1.0 (owner, 7 Nov, the Sites list): every bar has the same width, and
   the numbers beside it take the same room whatever their length, so the
   bars of a list line up. */
.bar-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.bar-cell .meter { flex: 0 0 120px; width: 120px; min-width: 0; }
.bar-cell span { font-size: 13px; color: var(--ink-2); white-space: nowrap; min-width: 9ch; font-variant-numeric: tabular-nums; }

/* The Overview: one band of totals, live dot, sites with bars, a feed. */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.kpi { padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; border-left: 1px solid var(--border); }
.kpi:first-child { border-left: 0; }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.kpi-value { font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; }
.kpi-of { font-size: 15px; font-weight: 500; color: var(--ink-3); }
.kpi .meter { height: 4px; margin-top: 6px; }
.kpi-note { font-size: 12px; color: var(--ink-3); }
@media (max-width: 640px) { .kpi { border-left: 0; border-top: 1px solid var(--border); } .kpi:first-child { border-top: 0; } }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface-1);
  font-size: 13px; color: var(--ink-2);
}
.live-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--success); animation: live-pulse 2s infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(11, 122, 92, 0.45); } 70% { box-shadow: 0 0 0 7px rgba(11, 122, 92, 0); } 100% { box-shadow: 0 0 0 0 rgba(11, 122, 92, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
/* 0.14.0: a live list's small pill in its tools row. */
.live-pill-sm { height: 26px; padding: 0 10px; font-size: 12px; gap: 6px; }
/* 0.14.0 (owner, 5 Nov): a live part that cannot reach the server says so. */
.live-pill.is-offline { color: var(--danger); border-color: var(--danger); }
.live-pill.is-offline .live-dot { background: var(--danger); animation: none; }
.overview-grid { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-start; }
.overview-main { flex: 2 1 640px; min-width: 0; }
.overview-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.card-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.card-head .section-title { flex: 1 1 auto; }
.feed { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow-y: auto; }
.feed li:first-child { padding-top: 0; }
.feed li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; line-height: 18px; }
.feed li:first-child { border-top: 0; }
.feed-dot { width: 8px; height: 8px; border-radius: 4px; margin-top: 5px; background: var(--ink-3); }
.feed-dot.is-site { background: var(--primary); }
.feed-dot.is-scan { background: var(--info); }
.feed-dot.is-worker { background: var(--success); }
.feed-dot.is-settings { background: var(--paused); }
.feed-main { min-width: 0; }
.feed-main .feed-detail { display: block; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-time { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.worker-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.worker-line:first-of-type { border-top: 0; }
.worker-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--ink-3); }
.worker-icon.is-online { background: var(--success-soft); color: var(--success); }
.worker-icon .icon { width: 16px; height: 16px; }
.worker-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.worker-reading { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A site's head: name, state, address, then its buttons; small numbers. */
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.addr-chip { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px 8px; overflow-wrap: anywhere; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.page-actions form { margin: 0; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-3); }
.stat-tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat-tile-label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.stat-tile-value { font-size: 20px; line-height: 28px; font-weight: 600; }
.stat-tile-note { font-size: 12px; color: var(--ink-3); }
.tabs { gap: 4px; margin-bottom: 0; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; font-weight: 500; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tab-count { font-size: 11px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); border-radius: 9px; padding: 1px 7px; }
.row-commands .icon-btn { color: var(--ink-2); }
.seed-count { font-size: 12px; font-weight: 600; margin-left: 2px; }
.row-commands .icon-btn.with-count { width: auto; padding: 0 8px; gap: 2px; }

/* Pop-ups (0.11.0) with a title bar, Save and Cancel kept in view. */
dialog.layer {
  width: min(820px, calc(100vw - 32px)); border: 0; border-radius: 14px;
  box-shadow: var(--shadow-pop); animation: layer-in 0.16s ease-out;
}
dialog.layer::backdrop { background: var(--scrim); }
@keyframes layer-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
@media (prefers-reduced-motion: reduce) { dialog.layer { animation: none; } }
.layer-head {
  justify-content: space-between; align-items: center; gap: var(--space-3);
  padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border);
}
.layer-title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; align-items: flex-start; text-align: left; }
.layer-kicker { font-size: 12px; color: var(--ink-3); }
.layer-title h2 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; }
.layer-back {
  width: 32px; height: 32px; border: 0; border-radius: 8px; background: var(--surface-2);
  color: var(--ink-2); cursor: pointer; font-size: 18px; line-height: 1; flex-shrink: 0;
}
.layer-body { padding: 18px 20px 20px; }
.layer-body .layer-moved-title { display: none; }
/* Forms in a pop-up: two columns; long boxes and the buttons span both. */
.layer-body form.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; max-width: none; }
.layer-body form.form > :not(.field), .layer-body form.form > .field:has(textarea) { grid-column: 1 / -1; }
.layer-body .form-actions, .layer-body .form-bar, .layer-body form.form > .btn-row:last-child {
  position: sticky; bottom: 0; z-index: 2; flex-direction: row; justify-content: flex-end; flex-wrap: wrap;
  margin: 4px -20px -20px; padding: 12px 20px; background: var(--surface-2h); border-top: 1px solid var(--border);
}
/* The same two columns for the site's settings and seed forms on the page. */
#settings form.form, #seed-form form.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; max-width: 920px; }
#settings form.form > :not(.field), #seed-form form.form > :not(.field), #seed-form form.form > .field:has(textarea) { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .layer-body form.form, #settings form.form, #seed-form form.form { grid-template-columns: minmax(0, 1fr); }
}
.dialog { border: 0; border-radius: 14px; box-shadow: var(--shadow-pop); }
.dialog::backdrop { background: var(--scrim); }

/* Seeds as cards (the seeds pop-up and the Summary tab). */
.seed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.seed-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.seed-address { font-family: var(--font-mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.seed-rules { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
/* Small one-box forms in a row (days, fetched by): the box keeps a fitting width. */
.btn-row > .input, .btn-row > select.input { width: auto; flex: 0 1 240px; }
.btn-row > .input[size] { flex-basis: 96px; }

/* 0.11.3 (owner, 3 Nov): slim scroll bars everywhere. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

/* The Overview fits the screen on a desktop (owner, 3 Nov): the cards share
   the height left under the totals, and a tall list scrolls inside its card
   (its heading row stays in view) instead of making the page long. Smaller
   or shorter screens keep the normal page scroll. */
.scroll-y { overflow-y: auto; min-height: 0; }
@media (min-width: 1100px) and (min-height: 640px) {
  .content:has(> #live.fit-screen) { height: calc(100vh - 56px); overflow: hidden; padding-bottom: var(--space-6); }
  #live.fit-screen { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #live.fit-screen > * { flex: 0 0 auto; }
  #live.fit-screen > .overview-grid { flex: 1 1 auto; min-height: 0; align-items: stretch; flex-wrap: nowrap; }
  #live.fit-screen .overview-main,
  #live.fit-screen .overview-side > .card { display: flex; flex-direction: column; min-height: 0; }
  #live.fit-screen .overview-main { max-height: 100%; align-self: flex-start; }
  #live.fit-screen .overview-side { min-height: 0; }
  #live.fit-screen .overview-side > .card-workers { flex: 0 0 auto; }
  #live.fit-screen .card-workers .scroll-y { max-height: 26vh; }
  #live.fit-screen .kpi { padding: 12px 18px; }
  #live.fit-screen .overview-side > .card-events { flex: 1 1 auto; }
  #live.fit-screen .overview-main .scroll-y, #live.fit-screen .card-events .scroll-y { flex: 1 1 auto; max-height: none; }
  /* core 1.3.39 (owner, 12 Nov 2026): the headings stay above every
     body cell, the frozen ones too (z-index 2, part 2), and the frozen
     headings above the others when the list also scrolls sideways. */
  #live.fit-screen .table-wrap.scroll-y .table th { position: sticky; top: 0; z-index: 3; }
  #live.fit-screen .table-wrap.scroll-y .table > thead.list-head th:first-child,
  #live.fit-screen .table-wrap.scroll-y .table:has(:is(.row-more, .row-commands, td.row-actions)) > thead th:last-child { z-index: 4; }
}

/* 0.11.5 (owner, 3 Nov): nested pop-ups step down in width, the parent
   always wider than the one on top of it (heights follow their content). */
dialog.layer[data-depth="1"] { width: min(720px, calc(100vw - 80px)); }
dialog.layer[data-depth="2"] { width: min(620px, calc(100vw - 128px)); }
dialog.layer[data-depth="3"] { width: min(540px, calc(100vw - 176px)); }
@media (max-width: 640px) {
  dialog.layer[data-depth] { width: calc(100vw - 32px); }
}

/* 0.11.5 (owner, 3 Nov): a pop-up taller than the screen keeps its title
   bar at the top and its buttons at the bottom; only the part between them
   scrolls (slim bar). app.js puts a form's fields in .layer-fields and
   marks its button row .layer-foot (dialog.has-foot). */
dialog.layer[open] { display: flex; flex-direction: column; overflow: hidden; max-height: calc(100dvh - 32px); }
dialog.layer .layer-head { position: static; flex: 0 0 auto; }
dialog.layer .layer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
dialog.layer.has-foot .layer-body { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
dialog.layer.has-foot .layer-body > * { flex: 0 0 auto; }
dialog.layer.has-foot .layer-body > :has(form.form) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
dialog.layer.has-foot .layer-body > :has(form.form) > * { flex: 0 0 auto; }
dialog.layer.has-foot .layer-body form.form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; gap: 0; }
dialog.layer.has-foot .layer-fields {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px;
  margin: 0 -20px; padding: 2px 20px 32px; /* 0.11.11 (owner): more room above the footer; the last field scrolls fully into view */
}
dialog.layer.has-foot .layer-fields > :not(.field), dialog.layer.has-foot .layer-fields > .field:has(textarea) { grid-column: 1 / -1; }
dialog.layer.has-foot .layer-foot {
  position: static; flex: 0 0 auto; margin: 0 -20px; padding: 12px 20px;
  display: flex; flex-direction: row; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-2);
  background: var(--surface-2h); border-top: 1px solid var(--border);
}
@media (max-width: 640px) {
  dialog.layer.has-foot .layer-fields { grid-template-columns: minmax(0, 1fr); }
  dialog.layer[open] { max-height: calc(100dvh - 24px); }
}

/* 11. Phones (0.11.7, owner 3 Nov): ops is for urgent viewing and small
   changes on a phone, not a full phone app. ----------------------------- */

/* The light / dark switch in the account menu: phones only (the top bar
   has its own). Its icon and words follow the state. */
.menu-theme { display: none; }
.menu-theme .icon-sun, .menu-theme .when-dark { display: none; }
.menu-theme[aria-pressed="true"] .icon-sun, .menu-theme[aria-pressed="true"] .when-dark { display: inline; }
.menu-theme[aria-pressed="true"] .icon-moon, .menu-theme[aria-pressed="true"] .when-light { display: none; }
.menu-theme { width: 100%; border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; }

/* A row's commands: in the row on a wide screen (the popover's own
   styles undone), behind one "more" button on a phone (app.js part 12). */
.row-more { display: none; }
.row-menu-title { display: none; }
.row-commands[popover] {
  position: static; inset: auto; margin: 0; padding: 0; border: 0;
  width: auto; height: auto; overflow: visible; background: none; color: inherit;
  display: flex;
}

@media (max-width: 799px) {
  /* Top bar: menu, name, then the account at the right edge. */
  .topbar-tools { margin-left: auto; }
  .topbar .theme-btn, .topbar-sep { display: none; }
  .menu-theme { display: flex; }

  /* Fingers: every control at least 44 px high. */
  .icon-btn { width: 44px; height: 44px; }
  .btn, .input { height: 44px; }
  .nav-item, .menu-item { min-height: 44px; }
  .tabs a { height: 44px; }
  .seg a { height: 44px; }
  .pager-links a, .pager-current { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .badge-button { min-height: 32px; padding-top: 6px; padding-bottom: 6px; }
}

@media (max-width: 640px) {
  /* The Overview's totals: small tiles, two a row (the last alone spans
     the row), so the sites show without scrolling. */
  .kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 10px 14px; gap: 2px; border-left: 0; border-top: 1px solid var(--border); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--border); }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi-value { font-size: 22px; line-height: 26px; }
  .kpi-of { font-size: 13px; }
  .kpi .meter { margin-top: 2px; }
  .kpi-note { font-size: 11px; line-height: 14px; }

  /* Tables: each row a card. Line 1: the first cell and the commands;
     then the other cells, each with its column's heading (data-label,
     app.js part 12). The headings row is hidden: sorting on a phone
     comes with the Sort menu (core list). */
  .table-wrap { overflow-x: visible; margin: 0; }
  .table thead { display: none; }
  .table, .table tbody { display: block; width: 100%; }
  .table tbody tr {
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 14px;
    padding: 12px 2px; border-bottom: 1px solid var(--border);
  }
  .card .table tbody tr { padding-left: 20px; padding-right: 20px; }
  .table tbody tr:last-child { border-bottom: 0; }
  .table tbody tr::before { content: ""; order: -1; flex: 0 0 100%; height: 0; }
  .table td { display: block; min-width: 0; }
  .table td, .card .table td:first-child, .card .table td:last-child { padding: 0; border: 0; }
  .table td.hide-narrow { display: none; }
  /* 0.15.3 (owner, 5 Nov, seen on Pages and facts): the labelled cells
     line up at their tops (a short item's two lines no longer push Price
     and Stock down); the first line (name, badge, commands) stays centred. */
  .table td:first-child { order: -4; flex: 1 1 0; font-size: 15px; align-self: center; }
  .table td:has(.badge) { order: -3; align-self: center; }
  .table td:has(> .row-commands), .table td:has(> .row-more), .table td.row-actions { order: -2; margin: -8px -6px -8px 0; align-self: center; }
  /* 0.16.2 (owner, 5 Nov, seen on Staff): on a phone a row is a card of
     flex cells; the 1% width meant for a wide table's last cell squeezed
     the icons out of the card. Here it takes the icons' own width. */
  .table td.row-actions { width: auto; flex: 0 0 auto; }
  /* 0.16.2 (owner, 5 Nov, seen on a person's Recent changes): a long-text
     column (what happened, an address, an item's name, a SHA-256) always
     takes its own full line, so every card of a list has the same layout
     whatever the text's length. */
  .table td.cell-wide { flex: 1 1 100%; }
  .table td.num { text-align: left; }
  .table td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: 11px; line-height: 14px; font-weight: 500; color: var(--ink-3);
  }
  .table td[colspan] { flex: 1 1 100%; order: -3; }
  /* 1.1.0 (owner, 8 Nov, the Sites cards): a bar takes its own full line
     and the same width in every card, so the cells after it (Waiting,
     Facts) always start the next line: each card has the same layout. */
  .bar-cell { min-width: 0; width: 100%; }
  .bar-cell .meter { flex: 1 1 auto; width: auto; }
  .table td:has(.bar-cell) { flex: 1 1 100%; }
  .table td:has(.bar-cell)[data-label] { display: flex; align-items: center; gap: 10px; }
  .table td:has(.bar-cell)[data-label]::before { white-space: nowrap; }

  /* The "more" button and its commands as a sheet from the bottom, with
     the row's name on top and a line per command with its name. */
  .row-more { display: inline-flex; color: var(--ink-2); }
  .row-commands[popover] { display: none; }
  .row-commands[popover]:popover-open {
    position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none;
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: var(--surface-1); border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0; box-shadow: var(--shadow-pop);
  }
  .row-commands[popover]::backdrop { background: var(--scrim); }
  .row-commands:popover-open .row-menu-title {
    display: block; padding: 8px 12px 10px; font-weight: 600; color: var(--ink);
    border-bottom: 1px solid var(--border); margin-bottom: 4px;
  }
  .row-commands:popover-open .icon-btn,
  .row-commands:popover-open .icon-btn.with-count {
    width: 100%; height: 48px; justify-content: flex-start; gap: 12px;
    padding: 0 12px; font-size: 15px; color: var(--ink);
  }
  .row-commands:popover-open .icon-btn::after { content: attr(title); }
  .row-commands:popover-open .icon-btn.with-count .seed-count { order: 2; margin-left: auto; }
  .row-commands:popover-open form { display: flex; }
  /* Refinery 0.3.0: a command written as a button (Turn off, Let
     through) is a line of the sheet too. */
  .row-commands:popover-open .btn {
    width: 100%; height: 48px; justify-content: flex-start; padding: 0 12px;
    font: inherit; font-size: 15px; font-weight: 600; color: var(--ink); background: transparent; border: 0; box-shadow: none;
  }
}
@media (max-width: 640px) {
  /* A heading with a quick switch: the switch goes under it, one line. */
  .card-head:has(.seg) { flex-wrap: wrap; }
  .card-head .section-title { white-space: nowrap; }
  /* 0.11.9 (owner: a slim sideways scroll bar under the switch): on a
     phone the switch is a grid as wide as the card, two choices a row
     when they do not fit in one; nothing scrolls. */
  .card-head .seg, .title-row .seg {
    display: grid; width: 100%; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px; background: var(--border); overflow: hidden;
  }
  .seg a { white-space: nowrap; justify-content: center; background: var(--surface-1); }
  .card-head .seg a + a, .title-row .seg a + a { border-left: 0; }
}

/* 0.11.8 (owner, 3 Nov, found on 0.11.7): a long value without spaces (a
   SHA-256, a long address, an IPv6 address, typed text) breaks onto the
   next line on a phone instead of pushing the page sideways. Only where it
   would overflow: normal words stay whole. Wide screens keep their tables
   (a wide table still scrolls inside its card there). */
@media (max-width: 640px) {
  .content, .content .table td, .content dd, .content .alert, dialog.layer { overflow-wrap: break-word; }
  .content .table td, .content .card, .content .details > * { min-width: 0; max-width: 100%; }
  .content .table td.mono, .content .table td .mono, .content .table td code { overflow-wrap: anywhere; }
  .content .details dd { overflow-wrap: anywhere; }
  /* A card has room in height, not width: "keep on one line" is for the
     wide table only (a badge keeps its own line). */
  .content .table td.nowrap { white-space: normal; }
  .content .table td .badge { white-space: nowrap; }
}

/* 12. Sorting (0.11.8, owner 3 Nov): chips and the Sort menu over a list
   (partials/list.html). The menu is a native popover under its button. */
.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.sort-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.sort-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 2px 4px 2px 10px; border-radius: 999px; font-size: 12px; line-height: 20px;
  background: var(--primary-soft); color: var(--ink);
}
.sort-chip strong { font-weight: 600; }
.sort-chip-x {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; color: var(--ink-2); text-decoration: none; font-size: 15px; line-height: 1;
}
.sort-chip-x:hover { background: var(--surface-2); color: var(--ink); }
.sort-btn { margin-left: auto; }
/* 0.14.0 (owner, 5 Nov): on a phone the filters are a sheet from the
   bottom, opened by Filter beside Sort (app.js 10); on a wide screen, and
   without the script, they stay above the list. */
.filter-btn, .filter-sheet-head { display: none; }
@media (max-width: 640px) {
  .js .filter-btn { display: inline-flex; margin-left: auto; }
  .js .filter-btn + .sort-btn { margin-left: 0; }
  .js .list-filters { display: none; }
  .js .list-filters.is-open {
    display: flex; flex-direction: column; gap: 12px; position: fixed; inset: auto 0 0 0; z-index: 60;
    margin: 0; max-height: 80vh; overflow-y: auto; background: var(--surface-1);
    border-top: 1px solid var(--border); border-radius: 14px 14px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 0 0 100vmax var(--scrim);
  }
  .js .list-filters.is-open { align-items: stretch; justify-content: flex-start; }
  .js .list-filters.is-open .field { max-width: none; width: 100%; flex: 0 0 auto; text-align: left; }
  .js .list-filters.is-open .filter-sheet-head { display: flex; align-items: center; justify-content: space-between; }
  .js .list-filters.is-open .list-filter-actions { display: flex; gap: 8px; }
  .js .list-filters.is-open .list-filter-actions .btn { flex: 1 1 0; height: 44px; }
}
/* 0.11.9: under its button, placed by app.js part 10 when it opens (CSS
   CSS anchor positioning was not dependable: a browser that reads it but has no anchor
   for it put the menu in the top left corner, seen by the owner on
   0.11.8). Without the script: the account menu's place, top right. */
.sort-menu:popover-open { min-width: 280px; padding: 14px; }
.sort-form { display: flex; flex-direction: column; gap: 12px; }
.sort-form-actions { display: flex; gap: 8px; }
.table th .sort-mark { font-size: 11px; margin-left: 3px; }
@media (max-width: 640px) {
  .sort-chip-x { width: 32px; height: 32px; }
  /* On a phone the menu comes up from the bottom, like a row's commands. */
  .sort-menu:popover-open {
    inset: auto 0 0 0; width: 100%; max-width: none; top: auto; right: 0;
    border-radius: 14px 14px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .sort-menu::backdrop { background: var(--scrim); }
}

/* 0.11.9 (owner, phone): a list's filter boxes take the card's width on a
   phone (a later rule had capped them at 260 px). */
@media (max-width: 640px) {
  .list-filters .field { max-width: none; flex-basis: 100%; }
  .list-tools { margin-top: 0; }
}

/* 0.11.9 (owner: a site's Pages and Discovery tabs looked odd on a phone):
   a short form in one row (label, box, Save) puts its label on a line of
   its own and lets the box take the rest of the next line, so the boxes
   line up and none runs past the card. */
@media (max-width: 640px) {
  .btn-row > label { flex: 0 0 100%; margin-bottom: -2px; }
  .btn-row > label ~ label { margin-top: 6px; }
  .btn-row > .input, .btn-row > select.input { flex: 1 1 0; min-width: 0; width: auto; }
  .btn-row > .input[size] { flex: 0 1 120px; }
}

/* 0.11.9 (owner, 3 Nov): a part of a page that is a pop-up's form (a
   site's Discovery and Pages settings) is not shown on the page itself
   when the script runs; its button opens it. Without the script it shows
   at its place, and the button's link goes there. */
.js main.content > .layer-source { display: none; }
/* 1.1.2 (owner, 8 Nov): in the pop-up it keeps its own layout (every
   layer-source is a stack-12), so its parts keep their 12px gaps; "block"
   put the Seeds pop-up's Add seed button right against the last seed. */
dialog.layer .layer-source { display: flex; }
/* A card's one action at its foot, in the middle (Run discovery now). */
.card-foot-center { display: flex; justify-content: center; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border); }
.layer-refused { margin-bottom: 4px; grid-column: 1 / -1; }

/* 0.11.11 (owner, 4 Nov): the site's one Settings pop-up: three panels
   (Site, Discovery, Pages), one under another, each a two-column grid
   (one column on a phone). */
fieldset.settings-panel {
  grid-column: 1 / -1; min-width: 0; margin: 0; padding: 14px 16px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px;
}
fieldset.settings-panel > legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
fieldset.settings-panel + fieldset.settings-panel { margin-top: 4px; }
@media (max-width: 640px) {
  fieldset.settings-panel { grid-template-columns: minmax(0, 1fr); padding: 12px; }
}

/* 0.11.11 (owner, 4 Nov): the site's Progress tab: the last scan's report
   beside the reading since; one column on a phone. */
.progress-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; }
.progress-grid .subhead { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.progress-big { margin: 0; font-size: 22px; line-height: 28px; }
.details-num dd { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .progress-grid { grid-template-columns: minmax(0, 1fr); } }

/* 0.12.0: the notification bell (layout_app.html, app.js section 12). */
.bell-btn { position: relative; }
.bell-btn.is-active { color: var(--primary); }
.bell-count {
  position: absolute; top: 4px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}
.bell-count[hidden] { display: none; }
.bell-panel { width: 360px; }
.bell-head { flex-direction: row; justify-content: space-between; align-items: baseline; }
.bell-body { max-height: min(60vh, 480px); overflow-y: auto; }
.bell-empty { padding: 12px 10px; margin: 0; }
.bell-list { list-style: none; margin: 0; padding: 0; }
.bell-list form { margin: 0; }
.bell-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--ink-2); font: inherit; text-align: left; cursor: pointer;
}
.bell-item:hover { background: var(--surface-2); }
.bell-item.is-unread { color: var(--ink); }
.bell-item.is-unread .bell-item-title { font-weight: 600; }
.bell-item.is-unread .bell-item-title::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px;
  border-radius: 50%; background: var(--primary); vertical-align: middle;
}
.bell-item-title { overflow-wrap: anywhere; }
tr.is-unread td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.check-inline { display: inline-flex; align-items: center; min-height: 32px; cursor: pointer; }
.check-inline input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }

/* 0.15.0 (owner, 5 Nov): the record switcher (partials/switcher.html). The
   name in the breadcrumb is a button; its list opens under it (placed by
   app.js part 13), on a phone as a sheet from the bottom. */
.switcher-btn {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 28px; padding: 2px 6px; margin: -2px -6px;
  border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  max-width: 100%;
}
.switcher-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-btn:hover, .switcher-btn:focus-visible { background: var(--surface-2); }
.switcher-menu:popover-open { width: 340px; max-height: min(70vh, 520px); padding: 10px; gap: 8px; }
.switcher-find { width: 100%; flex: 0 0 auto; }
.switcher-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.switcher-item { height: auto; min-height: 38px; justify-content: space-between; }
.switcher-name { overflow-wrap: anywhere; }
.switcher-note { flex: 0 0 auto; font-size: 12px; color: var(--ink-3); }
.switcher-item[hidden] { display: none; }
@media (max-width: 640px) {
  .switcher-menu:popover-open {
    inset: auto 0 0 0; width: 100%; max-width: none; max-height: 75vh;
    border-radius: 14px 14px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .switcher-menu::backdrop { background: var(--scrim); }
  .switcher-item { min-height: 44px; }
}

/* 0.15.0: a page's own menus (New role, a person's Actions): under their
   button (app.js part 14); on a phone a sheet from the bottom. */
.menu-under form { width: 100%; }
@media (max-width: 640px) {
  .menu-under:popover-open {
    inset: auto 0 0 0; width: 100%; max-width: none;
    border-radius: 14px 14px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  }
  .menu-under::backdrop { background: var(--scrim); }
  .menu-under .menu-item { min-height: 44px; }
}

/* 0.15.0 (owner, 5 Nov): the settings window (My profile, ops Settings).
   The sections on the left, the chosen one on the right; on a phone the
   list first, then the chosen section slides in with a back arrow. As a
   pop-up (dialog.layer.layer-window) it is large; on a phone full screen. */
.settings-window { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 72px; }
.settings-tab {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px;
  border-radius: var(--radius-md); color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.settings-tab:hover { background: var(--surface-2); color: var(--ink); }
.settings-tab.is-active { background: var(--primary-soft, var(--surface-2)); color: var(--primary); font-weight: 600; }
.settings-tab > span { flex: 1 1 auto; }
.settings-tab-go { display: none; transform: rotate(-90deg); color: var(--ink-3); }
.settings-pane { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.settings-section { display: none; }
.settings-section.is-open { display: flex; flex-direction: column; gap: 16px; }
.settings-back { display: none; }
.settings-back .icon { transform: rotate(90deg); }
dialog.layer.layer-window { width: min(980px, calc(100vw - 32px)); height: min(760px, calc(100vh - 32px)); max-width: none; }
dialog.layer.layer-window .layer-body { background: var(--surface-0, var(--bg)); }
dialog.layer.layer-window .settings-nav { top: 0; }
@media (max-width: 640px) {
  .settings-window { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .settings-window.is-list .settings-pane { display: none; }
  .settings-window:not(.is-list) .settings-nav { display: none; }
  .settings-window:not(.is-list) .settings-pane { animation: settings-in 0.18s ease-out; }
  .settings-nav { position: static; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-1); overflow: hidden; }
  .settings-tab { min-height: 52px; border-radius: 0; border-bottom: 1px solid var(--border); }
  .settings-tab:last-child { border-bottom: 0; }
  .settings-tab.is-active { background: transparent; color: var(--ink-2); font-weight: 500; }
  .settings-tab-go { display: block; }
  .settings-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; color: var(--ink); text-decoration: none; }
  dialog.layer.layer-window { width: 100vw; height: 100dvh; max-height: none; margin: 0; border-radius: 0; inset: 0; }
}
@keyframes settings-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .settings-window:not(.is-list) .settings-pane { animation: none; } }
/* Inside a settings window the forms keep their page look (one column,
   buttons where they are), also in the pop-up. */
.layer-body .settings-window form.form { display: flex; flex-direction: column; gap: 20px; max-width: 520px; }
.layer-body .settings-window .form-actions, .layer-body .settings-window .form-bar,
.layer-body .settings-window form.form > .btn-row:last-child {
  position: static; margin: 0; padding: 0; background: transparent; border: 0; justify-content: flex-start;
}
/* 0.15.0: shown only when the card is in a pop-up (the page has the same
   button in its header). */
.layer-only { display: none; }
dialog.layer .layer-only { display: block; margin-bottom: 12px; }

/* 0.16.0 (owner, 3 Nov): the permission grid on a role's page. Areas are
   rows under their menu headings, actions are columns; "·" where an area
   has no such action. It stays a table on a phone too (it scrolls
   sideways inside its card, the area names stay in view). The All boxes
   need the script (app.js part 15). */
.perm-grid th, .perm-grid td { vertical-align: middle; }
.perm-grid .perm-col { text-align: center; width: 1%; white-space: nowrap; }
.perm-grid input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); vertical-align: middle; }
.perm-grid .perm-area { font-weight: 500; text-align: left; white-space: nowrap; background: transparent; color: var(--ink); font-size: 14px; }
/* The danger mark sits beside the box without moving it off its column. */
.perm-grid td.perm-col { position: relative; }
.perm-grid td.perm-col .perm-danger { position: absolute; top: 50%; left: calc(50% + 11px); transform: translateY(-80%); margin: 0; }
.perm-grid .perm-heading th { padding-top: 14px; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; text-align: left; background: transparent; }
.perm-grid .perm-all-row th, .perm-grid .perm-all-row td { background: var(--surface-2); }
.perm-extras { white-space: normal; }
.perm-extra { display: inline-flex; gap: 6px; margin: 2px 14px 2px 0; }
.perm-danger { display: inline-block; margin-left: 3px; font-size: 11px; font-weight: 700; color: var(--warning); vertical-align: super; }
html:not(.js) .perm-js { display: none; }
.perm-help summary { cursor: pointer; color: var(--ink-2); }
.perm-help .details { margin-top: 10px; }
/* 0.16.2 (owner, 5 Nov, seen on a phone: the sideways-scrolling grid left
   a gap at its left edge and mixed its columns): on a phone the grid does
   not scroll sideways. Each area is a small card: its name on top, then its
   boxes, each with its own label (the column's name, or the named action's);
   an action the area does not have is not shown. The headings stay as
   small titles; the "All areas" row is a card too. */
@media (max-width: 640px) {
  .table-wrap.perm-wrap { overflow: visible; margin: 0; padding: 0; }
  .table.perm-grid, .perm-grid thead, .perm-grid tbody { display: block; width: 100%; }
  .perm-grid thead tr:first-child { display: none; }
  .table.perm-grid tbody tr, .perm-grid .perm-all-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
    padding: 12px 0; border-bottom: 1px solid var(--border);
  }
  .table.perm-grid tbody tr::before { content: none; }
  .table.perm-grid td, .table.perm-grid th { display: block; padding: 0; border: 0; background: transparent; }
  .perm-grid .perm-area, .perm-grid .perm-all-row th { flex: 1 1 100%; font-size: 15px; white-space: normal; }
  .perm-grid .perm-heading { padding: 14px 0 0; border-bottom: 0; }
  .perm-grid .perm-heading th { flex: 1 1 100%; }
  .perm-grid .perm-heading td { display: none; }
  .table.perm-grid td.perm-col { display: inline-flex; align-items: center; gap: 8px; width: auto; min-height: 44px; }
  .table.perm-grid td.perm-col::before {
    content: attr(data-label); order: 2; display: inline; font-size: 14px; font-weight: 400; color: var(--ink-2);
  }
  .table.perm-grid td.perm-none, .table.perm-grid td:empty, .perm-grid .perm-all-row td:empty { display: none; }
  .perm-grid td.perm-col .perm-danger { position: static; transform: none; order: 3; margin-left: -4px; }
  .perm-grid td.perm-row-all { margin-left: auto; }
  .perm-grid td.perm-extras { display: contents; }
  .table.perm-grid td.perm-extras::before { content: none; }
  .perm-extra { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; white-space: nowrap; }
  .perm-grid input[type="checkbox"] { width: 22px; height: 22px; }
}

/* 0.17.0: the UI kit demo page (SysMgr /uikit): "How" under each example
   and the code it shows. */
.kit-how { border-top: 1px solid var(--border); padding-top: var(--space-2); }
.kit-how summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.kit-code { margin: var(--space-2) 0 0; padding: var(--space-3); background: var(--surface-2); border-radius: var(--radius-md); overflow-x: auto; font-size: 12px; line-height: 18px; white-space: pre; }

/* ops 1.3.19: the site's Activity tab: bar and line charts drawn as SVG on
   the server, coloured from the theme (light and dark alike). */
.chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .ax { fill: var(--ink-3); font-size: 11px; }
.chart .limit { stroke: var(--warning); stroke-width: 1.5; stroke-dasharray: 6 5; fill: none; }
.chart .limit-text { fill: var(--warning); }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2.5; }
.chart .dot { fill: var(--primary); }
.c-scan { fill: var(--info); }      .sw-scan { background: var(--info); }
.c-page { fill: var(--primary); }   .sw-page { background: var(--primary); }
.c-read { fill: var(--success); }   .sw-read { background: var(--success); }
.c-skip { fill: var(--border-strong); } .sw-skip { background: var(--border-strong); }
.c-fail { fill: var(--danger); }    .sw-fail { background: var(--danger); }
.c-wait { fill: var(--warning); }   .sw-wait { background: var(--warning); }
.c-facts { fill: var(--paused); }   .sw-facts { background: var(--paused); }
/* ops 1.3.25: estimated page requests, addresses added / removed, prices. */
.c-page-est { fill: var(--primary); fill-opacity: .4; } .sw-page-est { background: var(--primary); opacity: .4; }
.c-added { fill: var(--success); }  .sw-added { background: var(--success); }
.c-removed { fill: var(--danger); } .sw-removed { background: var(--danger); }
.c-price { fill: var(--info); }     .sw-price { background: var(--info); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.chart-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

/* core 1.3.25: a command to copy (ops' Help page): where it runs, the
   command in a box, a Copy button (app.js part 16). */
.cmd { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.cmd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 4px 12px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--ink-3); }
.cmd pre { margin: 0; padding: 10px 12px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; white-space: pre; }
.help-link { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--ink-2); font-size: 13px; font-weight: 600; text-decoration: none; vertical-align: middle; margin-left: 6px; }
.help-link:hover { background: var(--surface-2); color: var(--ink); }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.help-steps { margin: 0; padding-left: 1.3rem; display: grid; gap: 10px; }

/* core 1.3.34 (owner, 11 Nov 2026; Platform Core Design "Lists the user
   shapes"). 1. The columns a person turned off (the Columns menu): the
   headings row says which (hide-cN, N = the column's place; app.js
   part 17 sets them from this browser's choice), so every page's cells
   follow without a change to its rows. Wide screens only: on a phone
   the rows are cards and stay as they are (owner, 11 Nov 2026). */
@media (min-width: 641px) {
.table:has(> thead.hide-c2) :is(th, td):nth-child(2),
.table:has(> thead.hide-c3) :is(th, td):nth-child(3),
.table:has(> thead.hide-c4) :is(th, td):nth-child(4),
.table:has(> thead.hide-c5) :is(th, td):nth-child(5),
.table:has(> thead.hide-c6) :is(th, td):nth-child(6),
.table:has(> thead.hide-c7) :is(th, td):nth-child(7),
.table:has(> thead.hide-c8) :is(th, td):nth-child(8),
.table:has(> thead.hide-c9) :is(th, td):nth-child(9),
.table:has(> thead.hide-c10) :is(th, td):nth-child(10),
.table:has(> thead.hide-c11) :is(th, td):nth-child(11),
.table:has(> thead.hide-c12) :is(th, td):nth-child(12),
.table:has(> thead.hide-c13) :is(th, td):nth-child(13),
.table:has(> thead.hide-c14) :is(th, td):nth-child(14),
.table:has(> thead.hide-c15) :is(th, td):nth-child(15),
.table:has(> thead.hide-c16) :is(th, td):nth-child(16),
.table:has(> thead.hide-c17) :is(th, td):nth-child(17),
.table:has(> thead.hide-c18) :is(th, td):nth-child(18),
.table:has(> thead.hide-c19) :is(th, td):nth-child(19),
.table:has(> thead.hide-c20) :is(th, td):nth-child(20),
.table:has(> thead.hide-c21) :is(th, td):nth-child(21),
.table:has(> thead.hide-c22) :is(th, td):nth-child(22),
.table:has(> thead.hide-c23) :is(th, td):nth-child(23),
.table:has(> thead.hide-c24) :is(th, td):nth-child(24) { display: none; }
}

/* 2. Frozen edges: the first column (the list's key) at the left and the
   row's commands at the right stay in view while the middle scrolls
   (app.js part 15 shades the edge that has more beyond it). Not on a
   phone, where rows are cards. */
@media (min-width: 641px) {
  .table-wrap > .table > thead.list-head th:first-child,
  .table-wrap > .table:has(> thead.list-head) > tbody > tr > td:first-child {
    position: sticky; left: 0; z-index: 2; background: var(--surface-1);
  }
  .table-wrap > .table > thead.list-head th:first-child { background: var(--surface-2); z-index: 3; }
  .table-wrap > .table:has(> thead.list-head):has(:is(.row-more, .row-commands, td.row-actions)) > thead th:last-child,
  .table-wrap > .table:has(> thead.list-head) > tbody > tr > td:last-child:is(:has(.row-more, .row-commands), .row-actions) {
    position: sticky; right: 0; z-index: 2; background: var(--surface-1);
  }
  .table-wrap > .table:has(> thead.list-head):has(:is(.row-more, .row-commands, td.row-actions)) > thead th:last-child { background: var(--surface-2); z-index: 3; }
  .table-wrap > .table:has(> thead.list-head) > tbody > tr:hover > td:first-child,
  .table-wrap > .table:has(> thead.list-head) > tbody > tr:hover > td:last-child:is(:has(.row-more, .row-commands), .row-actions) { background: var(--surface-2h); }
  .table-wrap.more-left > .table:has(> thead.list-head) :is(th, td):first-child { box-shadow: 6px 0 6px -6px rgba(0, 0, 0, .35); }
  .table-wrap.more-right > .table:has(> thead.list-head):has(:is(.row-more, .row-commands, td.row-actions)) :is(th:last-child, td:last-child) { box-shadow: -6px 0 6px -6px rgba(0, 0, 0, .35); }
}

/* 3. A row's commands: one "more" button on every screen (app.js part
   12); on a wide screen its menu opens under the button, a line per
   command with its name (on a phone: the sheet above). */
@media (min-width: 800px) {
  .row-more { display: inline-flex; color: var(--ink-2); }
  .row-commands[popover] { display: none; }
  .row-commands[popover]:popover-open {
    position: fixed; margin: 0; display: flex; flex-direction: column; gap: 2px; text-align: left;
    min-width: 200px; padding: 6px; background: var(--surface-1);
    border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop);
  }
  .row-commands:popover-open .row-menu-title {
    display: block; padding: 6px 10px 8px; font-size: 12px; font-weight: 600; color: var(--ink-2);
    border-bottom: 1px solid var(--border); margin-bottom: 2px;
  }
  .row-commands:popover-open .icon-btn,
  .row-commands:popover-open .icon-btn.with-count {
    width: 100%; height: 36px; justify-content: flex-start; gap: 10px;
    padding: 0 10px; font-size: 14px; color: var(--ink); border-radius: 8px;
  }
  .row-commands:popover-open .icon-btn::after { content: attr(title); }
  .row-commands:popover-open .icon-btn.with-count .seed-count { order: 2; margin-left: auto; position: static; }
  .row-commands:popover-open form { display: flex; }
  .row-commands:popover-open .btn {
    width: 100%; height: 36px; justify-content: flex-start; padding: 0 10px;
    font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); background: transparent; border: 0; box-shadow: none;
  }
}

/* 4. A state as a dot; "!" when it has a message (a small pop-up). */
.state-dot-cell { display: inline-flex; align-items: center; }
.state-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; background: var(--ink-3); }
.state-dot-ok { background: var(--success); }
.state-dot-off { background: var(--paused); }
.state-dot-wait { background: var(--warning); }
.state-dot-bad { background: var(--danger); }
/* core 1.3.35 (owner, 11 Nov 2026; item 108b): the dot sits in the key
   cell before the name (no State column); "!" is a small red mark at
   the dot's top right that takes no width. The button keeps the dot's
   size; its ::before gives a finger-sized target. */
.key-line { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.key-line > a { min-width: 0; }
.key-cell .cell-sub { padding-left: 20px; }
.state-dot-btn {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 10px; height: 10px; padding: 0; margin: 0; border: 0; border-radius: 50%;
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.state-dot-btn::before { content: ""; position: absolute; inset: -9px -9px -9px -9px; border-radius: 50%; }
.state-dot-btn:hover::before, .state-dot-btn:focus-visible::before { background: var(--surface-2); z-index: -1; }
.state-dot-btn:focus-visible { outline: none; }
.state-dot-btn:focus-visible::before { outline: 2px solid var(--primary); }
.state-bang {
  position: absolute; top: -10px; right: -6px; margin: 0;
  color: var(--danger); font-size: 12px; font-weight: 700; line-height: 1;
}
/* core 1.3.37: a pop-up inside a cell reads from the left, whatever the
   cell's alignment (the commands cell is right-aligned, part 6). */
.row-commands[popover], .state-pop { text-align: left; }
.state-pop:popover-open { min-width: 240px; max-width: 340px; padding: 12px 14px; gap: 8px; }
.state-pop-head { display: flex; align-items: center; gap: 8px; margin: 0; }
.state-pop-text { margin: 0; font-size: 13px; color: var(--ink-2); white-space: normal; }
.state-pop .btn { align-self: flex-start; }

/* 5. The Columns menu. */
.columns-menu:popover-open { min-width: 240px; padding: 14px; }
.columns-form { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.columns-title { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.columns-check { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.card-head-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
/* core 1.3.34: Sort and Columns side by side at the right of the tools
   row; the sort chips take the left (bar widths: part 6). */
.list-tools { justify-content: flex-end; }
.list-tools .sort-chips { margin-right: auto; }
.sort-btn ~ .columns-btn { margin-left: 0; }
@media (max-width: 640px) { .columns-btn { display: none !important; } }
.columns-note { margin: 4px 0 0; }

/* 6. core 1.3.35 (owner, 11 Nov 2026; item 108b): each column only as
   wide as its content or heading; the space left goes to the commands
   column (so "more" stays at the right edge) or, in a list without
   commands (one command or "more"), to the last shown column (app.js part 17 marks it with
   fill-cN), so there are no gaps between columns. Not on a phone. */
@media (min-width: 641px) {
  .table:has(> thead.list-head) :is(th, td) { width: 1%; white-space: nowrap; }
  .table:has(> thead.list-head) .bar-cell { min-width: 0; gap: 8px; }
  .table:has(> thead.list-head) .bar-cell .meter { flex-basis: 64px; width: 64px; }
  .table:has(> thead.list-head) td:is(:has(> :is(.row-more, .row-commands)), .row-actions),
  .table:has(> thead.list-head):has(:is(.row-more, .row-commands, td.row-actions)) > thead th:last-child { width: auto; text-align: right; }
  .table:has(> thead.fill-c1) :is(th, td):nth-child(1),
  .table:has(> thead.fill-c2) :is(th, td):nth-child(2),
  .table:has(> thead.fill-c3) :is(th, td):nth-child(3),
  .table:has(> thead.fill-c4) :is(th, td):nth-child(4),
  .table:has(> thead.fill-c5) :is(th, td):nth-child(5),
  .table:has(> thead.fill-c6) :is(th, td):nth-child(6),
  .table:has(> thead.fill-c7) :is(th, td):nth-child(7),
  .table:has(> thead.fill-c8) :is(th, td):nth-child(8),
  .table:has(> thead.fill-c9) :is(th, td):nth-child(9),
  .table:has(> thead.fill-c10) :is(th, td):nth-child(10),
  .table:has(> thead.fill-c11) :is(th, td):nth-child(11),
  .table:has(> thead.fill-c12) :is(th, td):nth-child(12),
  .table:has(> thead.fill-c13) :is(th, td):nth-child(13),
  .table:has(> thead.fill-c14) :is(th, td):nth-child(14),
  .table:has(> thead.fill-c15) :is(th, td):nth-child(15),
  .table:has(> thead.fill-c16) :is(th, td):nth-child(16),
  .table:has(> thead.fill-c17) :is(th, td):nth-child(17),
  .table:has(> thead.fill-c18) :is(th, td):nth-child(18),
  .table:has(> thead.fill-c19) :is(th, td):nth-child(19),
  .table:has(> thead.fill-c20) :is(th, td):nth-child(20),
  .table:has(> thead.fill-c21) :is(th, td):nth-child(21),
  .table:has(> thead.fill-c22) :is(th, td):nth-child(22),
  .table:has(> thead.fill-c23) :is(th, td):nth-child(23),
  .table:has(> thead.fill-c24) :is(th, td):nth-child(24) { width: auto; text-align: left; }
  .table:has(> thead.wide-c1) :is(th, td):nth-child(1),
  .table:has(> thead.wide-c2) :is(th, td):nth-child(2),
  .table:has(> thead.wide-c3) :is(th, td):nth-child(3),
  .table:has(> thead.wide-c4) :is(th, td):nth-child(4),
  .table:has(> thead.wide-c5) :is(th, td):nth-child(5),
  .table:has(> thead.wide-c6) :is(th, td):nth-child(6),
  .table:has(> thead.wide-c7) :is(th, td):nth-child(7),
  .table:has(> thead.wide-c8) :is(th, td):nth-child(8),
  .table:has(> thead.wide-c9) :is(th, td):nth-child(9),
  .table:has(> thead.wide-c10) :is(th, td):nth-child(10),
  .table:has(> thead.wide-c11) :is(th, td):nth-child(11),
  .table:has(> thead.wide-c12) :is(th, td):nth-child(12),
  .table:has(> thead.wide-c13) :is(th, td):nth-child(13),
  .table:has(> thead.wide-c14) :is(th, td):nth-child(14),
  .table:has(> thead.wide-c15) :is(th, td):nth-child(15),
  .table:has(> thead.wide-c16) :is(th, td):nth-child(16),
  .table:has(> thead.wide-c17) :is(th, td):nth-child(17),
  .table:has(> thead.wide-c18) :is(th, td):nth-child(18),
  .table:has(> thead.wide-c19) :is(th, td):nth-child(19),
  .table:has(> thead.wide-c20) :is(th, td):nth-child(20),
  .table:has(> thead.wide-c21) :is(th, td):nth-child(21),
  .table:has(> thead.wide-c22) :is(th, td):nth-child(22),
  .table:has(> thead.wide-c23) :is(th, td):nth-child(23),
  .table:has(> thead.wide-c24) :is(th, td):nth-child(24) { width: auto; white-space: normal; min-width: 16em; }
}

/* 7. core 1.3.38 (owner, 12 Nov 2026): a row's commands as buttons in
   the row (app.js part 16 sets cmds-inline when they fit, or when the
   person chose buttons): the "more" button hidden, the commands shown in
   place of its menu. Wide screens only; phones keep the sheet. */
@media (min-width: 800px) {
  .table.cmds-inline .row-more { display: none; }
  .table.cmds-inline .row-commands[popover] {
    display: inline-flex; flex-direction: row; align-items: center; gap: 2px;
    position: static; inset: auto; width: auto; height: auto; min-width: 0;
    margin: 0; padding: 0; overflow: visible; border: 0; background: none; box-shadow: none; color: inherit;
  }
  .table.cmds-inline .row-commands[popover] .row-menu-title { display: none; }
}
.columns-commands { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.columns-commands[hidden] { display: none; }
