/*
 * nomiacloud: Graphite + blue.
 *
 * Neutral graphite ink on white, one blue for what is interactive, and no
 * shadows on anything that sits on the page. Only floating layers (menus,
 * the palette, sheets, toasts) are lifted, with --sh-pop. Grouping comes from
 * space and hairlines, not from boxes.
 *
 * Token NAMES are kept from the previous system. hosting.css, lp.css and
 * audit.css used to follow them; all three are deleted — no view had linked them
 * for weeks and check-design.mjs was the only thing still reading them.
 *
 * Motion (Emil Kowalski's rules): custom ease-out only, 300ms or less, only
 * transform and opacity move, scale(0.97) on press, hover behind a pointer
 * query. Anything a user can grab (sheets, toasts) stays spring-driven in
 * ui.js; CSS transitions cannot be interrupted or handed velocity.
 */

:root {
  --sys: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --t-press: 160ms; --t-pop: 150ms; --t-menu: 200ms;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;

  /* 7px controls, 9px floating layers, 14px on the bottom sheet's top corners. */
  --r-sm: 6px; --r: 7px; --r-lg: 9px; --r-sheet: 14px;
}

:root, [data-theme="light"] {
  --paper:   #ffffff;
  --wash:    #fafafa;
  --sink:    #f4f4f5;
  --hover:   #f6f6f7;
  --ink:     #18181b;
  --ink-2:   #52525b;
  --ink-3:   #6b6b73;   /* 5.28:1 on white, 4.89:1 on --hover, 4.81:1 on --sink. Hints and meta must pass AA too. */
  --hair:    #ececee;
  --hair-2:  #dcdce0;
  --accent:  #2563eb;
  --accent-hi:#1d4ed8;
  --accent-soft:#dbe6fd;
  --link:    #1d4ed8;
  --btn:     #18181b;
  --btn-ink: #ffffff;
  --ok:      #15803d;
  --ok-soft: #e8f7ee;
  --warn:    #b45309;
  --warn-soft:#fdf3e7;
  --err:     #b91c1c;
  --err-soft:#fdecec;
  /* Flat at rest. The old names stay so older rules resolve to "no shadow". */
  --sh-btn:  none;
  --sh-card: none;
  --sh-pop:  0 0 0 1px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04), 0 12px 32px -8px rgba(0,0,0,.16);
  --sh-lift: var(--sh-pop);
  --scrim:   rgba(0,0,0,.28);
  --glass:   rgba(255,255,255,.92);
  --fade-to: rgba(255,255,255,0);
}

[data-theme="dark"] {
  --paper:   #111113;
  --wash:    #161618;
  --sink:    #1c1c1f;
  --hover:   #1a1a1d;
  --ink:     #ededef;
  --ink-2:   #a1a1aa;
  --ink-3:   #8b8b93;   /* 5.6:1 on #111113 */
  --hair:    #26262a;
  --hair-2:  #34343a;
  --accent:  #3b82f6;
  --accent-hi:#60a5fa;
  --accent-soft:#1e2a44;
  --link:    #60a5fa;
  --btn:     #ededef;
  --btn-ink: #111113;
  --ok:      #4ade80;
  --ok-soft: #10261a;
  --warn:    #fbbf24;
  --warn-soft:#2a2112;
  --err:     #f87171;
  --err-soft:#2c1515;
  --sh-btn:  none;
  --sh-card: none;
  --sh-pop:  0 0 0 1px rgba(255,255,255,.08), 0 12px 32px -8px rgba(0,0,0,.7);
  --sh-lift: var(--sh-pop);
  --scrim:   rgba(0,0,0,.5);
  --glass:   rgba(17,17,19,.92);
  --fade-to: rgba(17,17,19,0);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sys); font-size: 15px; line-height: 1.55; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
/* Tabbing was invisible: dropping the underline also drops the UA focus ring,
   and only .btn and the app-bar controls had one of their own. Every other link
   on the site — the whole public header included — showed nothing at all. */
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* .link had a hover colour and nothing at rest, so with no pointer to hover
   the public header's nav rendered as grey body text. --link, like .btn-plain. */
a.link { color: var(--link); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; }

/* ── type ──────────────────────────────────────────────── */
.display { font-size: clamp(36px, 4.6vw, 52px); line-height: 1.08; letter-spacing: -0.025em; font-weight: 600; margin: 0; text-wrap: balance; }
.h1 { font-size: 28px; line-height: 1.2; letter-spacing: -0.012em; font-weight: 600; margin: 0; text-wrap: balance; }
.h2 { font-size: 18px; line-height: 1.35; letter-spacing: -0.008em; font-weight: 600; margin: 0; }
.h3 { font-size: 15px; line-height: 1.4; font-weight: 600; margin: 0; }
.lede { font-size: 17px; line-height: 1.6; color: var(--ink-2); margin: 0; text-wrap: pretty; }
.body { font-size: 15px; line-height: 1.65; color: var(--ink-2); margin: 0; text-wrap: pretty; }
.small { font-size: 14px; line-height: 1.55; color: var(--ink-2); margin: 0; }
.tiny { font-size: 13px; line-height: 1.45; color: var(--ink-3); margin: 0; }
.eyebrow { font-size: 13px; font-weight: 500; color: var(--ink-3); margin: 0; }
/*
 * The accent word inside a display heading (data-i18n-em wraps *starred* runs).
 *
 * The rule went with the serif-italic accent in Phase 1 and was never replaced,
 * so five headings have been marking a word that rendered exactly like its
 * neighbours. Weight only — same colour, same family, no italic.
 *
 * 700 rather than the 500 the ruling names: every element carrying
 * data-i18n-em is a .display or .h1, both 600, so 500 would render the accent
 * LIGHTER than the words around it. 700 is that same one-step bump, measured
 * from what the markup actually is.
 */
.em { font-weight: 700; }
.mono { font-family: var(--mono); font-size: 13px; }
.tab { font-variant-numeric: tabular-nums; }
.ink { color: var(--ink); }

/* ── controls ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 38px; padding: 0 16px; border-radius: var(--r);
  font-size: 14px; font-weight: 500; color: var(--ink);
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-pop) ease,
              color var(--t-pop) ease, opacity var(--t-pop) ease;
  white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--btn); color: var(--btn-ink); }
.btn-quiet { background: var(--paper); box-shadow: inset 0 0 0 1px var(--hair-2); }
.btn-plain { padding: 0; height: auto; color: var(--link); }
.btn-danger { background: var(--err); color: var(--btn-ink); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }

.field { display: block; margin-bottom: var(--s4); }
.field > .label { display: block; font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.field > .hint { font-size: 13px; line-height: 1.45; color: var(--ink-3); margin-top: 5px; }
.field > .err { font-size: 13px; color: var(--err); margin-top: 5px; display: none; }
.field.is-invalid > .err { display: block; }
/* The same reason, beside an inline editor rather than a form field: it is only
   ever in the DOM while there is something to say, so it has no hidden state. */
.inline-err { display: block; font-size: 13px; line-height: 1.4; color: var(--err); margin-top: 5px; flex-basis: 100%; }
.input {
  width: 100%; padding: 9px 12px; min-height: 41px; border-radius: var(--r);
  background: var(--paper); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hair-2);
  outline: none; transition: box-shadow var(--t-pop) var(--ease-out);
}
.input::placeholder { color: var(--ink-3); }
.input:focus { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.field.is-invalid .input { box-shadow: inset 0 0 0 1px var(--err); }
.field.is-invalid .input:focus { box-shadow: inset 0 0 0 1px var(--err), 0 0 0 3px var(--err-soft); }
textarea.input { min-height: 70px; resize: vertical; line-height: 1.5; }
@media (max-width: 720px) { .input { font-size: 16px; } }  /* iOS does not zoom a 16px input */

/* ── surfaces ──────────────────────────────────────────── */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--s7); }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 0 var(--s7); }
/* For a surface whose whole job is to be looked at — the demo's preview frame.
   Wider than reading measure, still centred, still off the screen edges. */
.wrap-wide { max-width: 1600px; margin: 0 auto; padding: 0 var(--s7); }
.section { padding: var(--s9) 0; }
.section-sm { padding: var(--s8) 0; }
.wash { background: var(--wash); }
.card { background: var(--paper); border-radius: 8px; box-shadow: inset 0 0 0 1px var(--hair); }
.card-lift { box-shadow: var(--sh-pop); }
.hair { height: 1px; background: var(--hair); border: 0; margin: 0; }
.row { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack-2 > * + * { margin-top: var(--s2); }
.stack-3 > * + * { margin-top: var(--s3); }
.stack-4 > * + * { margin-top: var(--s4); }
.stack-5 > * + * { margin-top: var(--s5); }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s8); }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--s6); }
.cols-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: var(--s5); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 20px; padding: 0 7px;
         border-radius: 5px; font-size: 12px; font-weight: 500;
         background: var(--hover); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--hair); }
.badge-ok   { background: var(--ok-soft);   color: var(--ok);   box-shadow: none; }
.badge-warn { background: var(--warn-soft); color: var(--warn); box-shadow: none; }
.badge-err  { background: var(--err-soft);  color: var(--err);  box-shadow: none; }
.badge-accent { background: var(--accent-soft); color: var(--link); box-shadow: none; }
.dot { width: 6px; height: 6px; border-radius: 980px; background: currentColor; }

.note { border-radius: var(--r); padding: 11px 14px; font-size: 14px; line-height: 1.55; }
.note-err  { background: var(--err-soft);  color: var(--err); }
.note-warn { background: var(--warn-soft); color: var(--warn); }
.note-ok   { background: var(--ok-soft);   color: var(--ok); }
.note-info { background: var(--hover); color: var(--ink-2); }

.empty { text-align: center; padding: var(--s8) var(--s5); }

/* ── icons: one set, one stroke weight, aligned to a 20px grid ── */
.i { width: 20px; height: 20px; flex: 0 0 auto; stroke: currentColor; fill: none;
     stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }

/* ── keyboard hints ── */
kbd { font-family: var(--mono); font-size: 11.5px; line-height: 1; padding: 3px 5px;
      border-radius: 4px; background: transparent; color: var(--ink-3);
      box-shadow: inset 0 0 0 1px var(--hair-2); }

/* ── tooltip: origin-aware, scales from its trigger ── */
.tip { position: relative; }
.tip::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) scale(0.96); transform-origin: bottom center;
  background: var(--ink); color: var(--paper); font-size: 12px; line-height: 1;
  padding: 7px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity var(--t-pop) var(--ease-out), transform var(--t-pop) var(--ease-out);
  z-index: 40;
}
@media (hover: hover) and (pointer: fine) {
  .tip:hover::after { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ── row actions that appear on hover, so the list stays quiet ── */
.reveal { opacity: 0; transition: opacity var(--t-pop) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .rowitem:hover .reveal, .rowitem:focus-within .reveal { opacity: 1; }
}
@media (hover: none) { .reveal { opacity: 1; } }

/* ── sparkline ── */
.spark { width: 96px; height: 28px; overflow: visible; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark .fill { fill: var(--accent); opacity: .09; stroke: none; }

/* ── command palette ── */
.palette-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 80; opacity: 0; }
.palette { position: fixed; top: 14vh; left: 50%; width: min(560px, calc(100vw - 32px));
           transform: translateX(-50%); z-index: 81; background: var(--paper);
           border-radius: 11px; box-shadow: var(--sh-pop);
           overflow: hidden; will-change: transform, opacity; }
.palette input { width: 100%; border: 0; outline: none; background: transparent;
                 padding: 18px 20px; font-size: 17px; color: var(--ink); }
.palette-list { max-height: 320px; overflow-y: auto; border-top: 1px solid var(--hair); padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px;
                border-radius: var(--r-sm); cursor: pointer; color: var(--ink-2); }
.palette-item[aria-selected="true"] { background: var(--accent-soft); color: var(--ink); }

/* A policy block: read-only, wide, and scrollable rather than wrapped, because
   JSON that wraps mid-string is hard to check against what you pasted. */
.policy { margin: 0 0 var(--s3); padding: var(--s4); border-radius: var(--r-sm);
          background: var(--wash); box-shadow: inset 0 0 0 1px var(--hair);
          font-size: 12px; line-height: 1.6; max-height: 260px;
          overflow: auto; white-space: pre; }

/* ── searchable select ──
   Same visual language as the command palette, but anchored to a field rather
   than the viewport: it belongs to the input above it, so it shares that
   input's width and sits directly under it. */
.ss { position: relative; }
.ss-input { padding-right: 34px; text-overflow: ellipsis; }
.ss-clear { position: absolute; top: 0; right: 0; width: 34px; height: 40px; border: 0;
            background: transparent; color: var(--ink-3); font-size: 18px; line-height: 1;
            cursor: pointer; }
.ss-clear:hover { color: var(--ink); }
.ss-pop { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0;
          max-height: 300px; overflow-y: auto; padding: 6px;
          background: var(--paper); border-radius: var(--r-lg);
          box-shadow: var(--sh-pop); }
.ss-item { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px;
           border-radius: var(--r-sm); cursor: pointer; color: var(--ink-2); }
.ss-item[aria-selected="true"] { background: var(--accent-soft); color: var(--ink); }
.ss-label { font-weight: 500; color: var(--ink); }
.ss-item[aria-selected="true"] .ss-label { color: var(--ink); }
.ss-sub { font-size: 12px; color: var(--ink-3); }
.ss-item.has-link { padding-right: 104px; }
.ss-link { position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
           padding: 4px 8px; border-radius: var(--r-sm); color: var(--ink-3);
           text-decoration: none; white-space: nowrap; }
.ss-link:hover { color: var(--link); background: var(--paper); }
.ss-note { padding: 10px 12px; text-align: center; margin: 0; }

/* ── file tree ── */
.tree { font-family: var(--mono); font-size: 13px; }
.tree .node { display: flex; align-items: center; gap: 8px; padding: 5px 0; color: var(--ink-2); }
.tree .node .name { color: var(--ink); }
.tree .indent { padding-left: 22px; }
.tree .chg { margin-left: auto; font-size: 11px; }

/*
 * The hidden attribute has to beat an inline display.
 *
 * `[hidden] { display: none }` is a normal-specificity rule, so any element
 * carrying display in a style attribute ignores it — el.hidden = true then does
 * nothing at all, silently. The demo's loading overlay is positioned with an
 * inline display:grid, so it could never be dismissed however many ways the
 * code tried. !important here rather than hunting inline styles one at a time,
 * because the next one will be written the same way.
 */
[hidden] { display: none !important; }

/* ── admin sub-nav ────────────────────────────────────────
 * A second row rather than more items in the bar: the customer's four links
 * are the product, and burying them among nine operator tools makes the common
 * case worse to serve the rare one.
 */
.subnav { display: flex; gap: var(--s5); overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--hair); margin-bottom: var(--s6); }
.subnav::-webkit-scrollbar { display: none; }
.subnav-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 0 0 10px; font-size: 14px; font-weight: 500; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 130ms ease, border-color 130ms ease; }
.subnav-item.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
@media (hover: hover) and (pointer: fine) { .subnav-item:hover { color: var(--ink); } }

/* ── admin sub-nav: a second row under the bar, in the bar's column ──
   .subnav above stays for in-page tab strips (app-site's Upload / AMP). */
.admin-sub { border-bottom: 1px solid var(--hair); }
.admin-sub-inner { max-width: 1200px; margin: 0 auto; padding: 0 var(--s7); display: flex; gap: var(--s5);
  overflow-x: auto; scrollbar-width: none; }
.admin-sub-inner::-webkit-scrollbar { display: none; }
.admin-sub a { display: inline-flex; align-items: center; height: 46px; position: relative; white-space: nowrap;
  font-size: 14px; color: var(--ink-2); transition: color var(--t-pop) var(--ease-out); }
.admin-sub a[aria-current="page"] { color: var(--ink); font-weight: 500; }
.admin-sub a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--ink); }
.admin-sub a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .admin-sub a:hover { color: var(--ink); } }
@media (pointer: coarse) { .admin-sub a { height: 48px; } }
@media (max-width: 860px) { .admin-sub-inner { padding: 0 var(--s4); } }
.admin-sub + .main { padding-top: var(--s6); }

/* ── row menu (•••): the account menu's popover, anchored to a list row ── */
.row-more { width: 32px; height: 32px; border-radius: var(--r); color: var(--ink-3); font-size: 13px; letter-spacing: 1px; }
.row-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row-more[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .row-more:hover { background: var(--hover); color: var(--ink); } }
@media (pointer: coarse) { .row-more { width: 44px; height: 44px; } }
.row-menu .menu-pop { min-width: 200px; }
.menu-item.danger { color: var(--err); }
.menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* The header language control: a select that reads as a quiet button. */
.lang-pick { appearance: none; -webkit-appearance: none; font: 500 13px/1 var(--sys);
  color: var(--ink-2); background: transparent; border: 1px solid var(--hair);
  border-radius: var(--r-sm); padding: 0 22px 0 9px; height: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 12px) 13px, calc(100% - 8px) 13px;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
  transition: border-color 130ms ease, color 130ms ease; }
.lang-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .lang-pick:hover { border-color: var(--ink-3); color: var(--ink); }
}

/* Progress and quota. Deliberately NOT called .bar — that is the app bar. */
.meter { height: 4px; border-radius: 4px; background: var(--hair); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--ink);
                transition: width 260ms var(--ease-out); }
.meter.warn > span { background: var(--warn); }
.meter.full > span { background: var(--err); }
@media (prefers-reduced-motion: reduce) { .meter > span { transition: none; } }

/* Anything scrolled to clears the pinned chrome instead of landing under it.
   --chrome-h is measured and published by renderBar in nc.js; the fallback is
   the bar's own height, which is all there is before that runs. */
html { scroll-padding-top: calc(var(--chrome-h, 61px) + var(--s4)); }

.bar { position: sticky; top: 0; z-index: 20; background: var(--glass);
       -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
       border-bottom: 1px solid var(--hair); }

/* skeletons for loading, not spinners where a shape is known */
@keyframes shimmer { 0% { opacity: .55 } 50% { opacity: 1 } 100% { opacity: .55 } }
.skel { background: var(--sink); border-radius: var(--r-sm); animation: shimmer 1.4s ease-in-out infinite; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise 300ms var(--ease-out) both; }
.d1{animation-delay:50ms}.d2{animation-delay:100ms}.d3{animation-delay:150ms}.d4{animation-delay:200ms}

/* ── sheet + toast: spring-driven, so no transitions here ── */
/*
 * 84/85, above `.editor-surface` (80).
 *
 * A sheet is modal: whatever asks it a question is waiting for the answer. At
 * 60/61 a sheet opened from the full-screen template editor rendered BEHIND it —
 * invisible, un-clickable, and the page silently unresponsive because the scrim
 * was still swallowing clicks. That made the unsaved-changes confirm below
 * impossible to add until this moved.
 */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 84; opacity: 0; }
/*
 * max-height + overflow-y, promoted from the two screens that already had it.
 *
 * Without a cap a tall sheet grows past the top of the viewport and the content
 * up there is simply unreachable — it is positioned from `bottom: 0`, so it is
 * the TOP that overflows, including the heading that says what the sheet is for.
 * admin-providers.html and app-hosting.html had both hit it and patched it
 * locally with exactly these two declarations; the other eleven screens had not.
 *
 * `touch-action: pan-y`, which is the other half of the fix. The drag used to be
 * bound to the whole sheet, so this had to be `none` — and `none` is exactly what
 * stopped a finger scrolling the contents. The gesture now lives on .sheet-grip
 * (see ui.js), so the body is free to scroll and only the grip suppresses it.
 *
 * The trade, stated plainly: dismissing by swipe means swiping the GRIP rather
 * than anywhere on the sheet. Tapping the scrim and every [data-close] button
 * still close it, so nothing is reachable by gesture alone.
 */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 85;
         background: var(--paper); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
         box-shadow: var(--sh-pop); padding: var(--s3) var(--s6) var(--s6);
         max-width: 620px; margin: 0 auto; touch-action: pan-y; will-change: transform;
         max-height: 88vh; overflow-y: auto; }
/*
 * The grip is the drag handle now, so it is the one part that must NOT pan.
 * Without `touch-action: none` here the browser claims the vertical gesture for
 * scrolling and the sheet can no longer be swiped away at all.
 *
 * The hit area is deliberately much larger than the 4px bar: `padding` plus a
 * transparent border give a finger something to find, while the visible line
 * stays the same size. 40x4 was never a touch target.
 */
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--hair-2);
              cursor: grab; touch-action: none;
              /*
               * Negative top margin and a reduced bottom one, so the 20px of new
               * padding buys a hit area WITHOUT moving the bar or widening the gap
               * under it: -10 top cancels the 10 above, 24-10 keeps the visible
               * distance to the heading at 24px.
               */
              box-sizing: content-box; padding: 10px 28px; background-clip: content-box;
              margin: -10px auto calc(var(--s5) - 10px); }
/*
 * 90: the top of the ladder, and it has to be.
 *
 * This was 70, below `.editor-surface` (80, in admin-templates.html and
 * app-templates.html) and below `.palette` (81). So saving an 800 KB template
 * showed its confirmation BEHIND the editor and the operator saw nothing happen
 * at all — the one moment feedback matters most.
 *
 * The ladder, for anything added later: bar 20 · menu-pop 50 · scrim 60 ·
 * sheet 61 · editor-surface 80 · palette-scrim 80 · palette 81 · toasts 90.
 * A toast is the topmost layer by definition; nothing should outrank it.
 */
.toasts { position: fixed; right: var(--s5); bottom: var(--s5); z-index: 90;
          display: flex; flex-direction: column; gap: var(--s2); width: 340px; max-width: calc(100vw - 48px); }
.toast { background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--sh-pop);
         padding: 12px 16px; touch-action: pan-y; will-change: transform; cursor: grab; }
.toast:active { cursor: grabbing; }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { opacity: .88; }
  .btn-quiet:hover { background: var(--hover); }
  .btn-plain:hover { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 2px; }
  .card-hover:hover { background: var(--hover); }
  /* --accent-hi, not --link: --link is what a .link is at rest now, so hover
     has to be the step past it or it does nothing. */
  a.link:hover { color: var(--accent-hi); }
}

/* ── the app bar ──────────────────────────────────────────
 * The nav scrolls sideways rather than collapsing behind a hamburger: four
 * links fit on a phone, and a menu that hides four links is a menu that costs
 * a tap to learn nothing.
 */
/*
 * The app bar carries more than the reading measure allows.
 *
 * An admin sees six nav items plus search, language, appearance, sign out and
 * New site. At the 1100px .wrap that overflowed and the nav scrolled — which
 * reads as a cropped menu, not as something scrollable. Its own wider container
 * plus an earlier collapse of the search label fits it without hiding anything.
 */
/*
 * "Viewing as a customer". Sticky under the bar, because the one failure mode
 * of this feature is forgetting it is on and reporting a hidden column as a
 * bug.
 */
/* Under the bar, not behind it: both pin to the top, so at top:0 the bar (z 20)
   would cover this the moment the page scrolled. */
.viewas { position: sticky; top: var(--bar-h, 61px); z-index: 19; display: flex; align-items: center; gap: var(--s3);
          padding: 7px var(--s5); font-size: 13px; background: var(--accent-soft); color: var(--accent-hi);
          border-bottom: 1px solid var(--hair); }
.viewas .btn-plain { margin-left: auto; color: inherit; text-decoration: underline; font-size: 12.5px; }
[data-theme="dark"] .viewas { background: #1e3a8a3d; color: #bfdbfe; }

.bar-inner { max-width: 1200px; margin: 0 auto; padding: 0 var(--s7); height: 60px; gap: var(--s5); }
.bar-nav { overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; flex: 0 1 auto; }
.bar-nav::-webkit-scrollbar { display: none; }
.bar-nav a { white-space: nowrap; }
.bar-logo { font-weight: 600; font-size: 15px; color: var(--ink); }
.bar-nav a { color: var(--ink-2); height: 60px; display: inline-flex; align-items: center; position: relative; }
.bar-nav a[aria-current="page"] { color: var(--ink); font-weight: 500; }
.bar-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink); }

.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
      background: var(--hover); box-shadow: inset 0 0 0 1px var(--hair-2);
      font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.av:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) { .av { width: 44px; height: 44px; } }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; z-index: 50;
            background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--sh-pop); padding: 6px;
            transform-origin: top right; opacity: 0; transform: scale(.95);
            transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out); }
.menu-pop.open { opacity: 1; transform: none; transition-duration: var(--t-menu); }
.menu-who { display: grid; gap: 1px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--hair); }
.menu-who b { font-weight: 500; font-size: 14px; }
.menu-item { display: flex; align-items: center; width: 100%; padding: 8px 10px; border-radius: var(--r-sm);
             font-size: 14px; color: var(--ink); text-align: left; }
.menu-lang .lang-pick { width: 100%; height: 32px; }
.menu-sep { height: 1px; background: var(--hair); margin: 5px 2px; }
@media (hover: hover) and (pointer: fine) { a.menu-item:hover, button.menu-item:hover { background: var(--hover); } }
@media (prefers-reduced-motion: reduce) { .menu-pop { transform: none !important; } }
.main { padding: var(--s7) var(--s7) var(--s9); }

/* The shortcut is unreachable without a keyboard, and the label is the first
   thing worth losing when the bar gets tight. */
@media (max-width: 1180px) { .bar-search span, .bar-search kbd { display: none; } }

@media (max-width: 860px) {
  /* 48px of gutter on a 375px screen left 279px of page. .main and .bar-inner
     already stepped down here; the three public pages use .wrap throughout. */
  .wrap, .wrap-narrow, .wrap-wide { padding: 0 var(--s4); }
  .section { padding: var(--s8) 0; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr !important; gap: var(--s6) !important; }
  /* The shortcut is unreachable without a keyboard, so the button shrinks to
     its icon rather than advertising a key that is not there. */
  .bar-search span, .bar-search kbd { display: none; }
  .main { padding: var(--s6) var(--s4) var(--s8); }
  .bar-inner { padding: 0 var(--s4); }
}
/*
 * Phones: two rows. The right-hand controls needed almost the whole width at
 * 375px and the nav shrank to nothing, so the main navigation vanished. The
 * left group dissolves (display: contents) so its nav can wrap onto its own
 * full-width, sideways-scrolling row.
 */
@media (max-width: 640px) {
  .bar-inner { flex-wrap: wrap; height: auto; row-gap: var(--s2); padding-top: var(--s3); padding-bottom: var(--s3); }
  .bar-left { display: contents; }
  .bar-nav { order: 3; flex: 1 0 100%; gap: var(--s5) !important; padding-bottom: 2px; }
  .bar-nav a { height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 120ms !important; }
  .rise, .skel { animation: none; opacity: 1; transform: none; }
  .btn:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .bar { background: var(--paper); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --hair: #a1a1aa; --hair-2: #71717a; --ink-2: #3f3f46; --ink-3: #52525b; }
  [data-theme="dark"] { --hair: #52525b; --hair-2: #71717a; --ink-2: #d4d4d8; --ink-3: #a1a1aa; }
  .bar { background: var(--paper); backdrop-filter: none; }
}
/* Fingers, not cursors. A 32px button and a ~19px text "Delete" are hard to hit
   on a phone. Small buttons grow to 44px; text buttons get a bigger touch area
   from padding cancelled by an equal negative margin, so nothing moves. */
@media (pointer: coarse) {
  /* 44, not the 40 this was: the public header is two .btn-sm and nothing else,
     and every other target in this block — .lang-pick, .av, .row-more — is 44. */
  .btn-sm { height: 44px; }
  .btn-plain { padding: 10px 6px; margin: -10px -6px; }
  /* .seg > button got 44px at ≤720px; these two never did, and .lang-pick sits
     in all three public headers. */
  .subnav-item { min-height: 44px; padding-bottom: 14px; }
  .lang-pick { height: 44px; }
}

/* ── section: grouping by space and a hairline, never a box ── */
.sec { padding: var(--s4) 0; border-top: 1px solid var(--hair); }
.sec.first { border-top: 0; padding-top: 0; }
.sec > .sec-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
/* A label for screen readers only, where the field's context says it visually. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
           clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── list: rows divided by hairlines; the caller sets grid-template-columns ── */
.list { font-size: 14px; }
.list-head, .list-row { display: grid; gap: var(--s5); align-items: center; }
.list-head { font-size: 13px; color: var(--ink-3); padding: 9px 10px; margin: 0 -10px; border-bottom: 1px solid var(--hair); }
.list-row { padding: 14px 10px; margin: 0 -10px; border-bottom: 1px solid var(--hair); border-radius: var(--r-sm); position: relative; }
.list-row[data-href], .list-row.clickable { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .list-row:hover { background: var(--hover); }
  .list-row:hover .reveal { opacity: 1; }
}
.list-row:focus-within .reveal { opacity: 1; }
/* Keyboard parity with hover: the revealed actions carry --hover of their own,
   so without a tinted row they land as a grey patch on white. */
.list-row:focus-within { background: var(--hover); }

/* ── segmented control: a grey track; the chosen option is a raised button.
   Never plain text: in review a text-only toggle was missed entirely. ── */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--hover); border-radius: 9px;
       box-shadow: inset 0 0 0 1px var(--hair); font-size: 14px; }
.seg > button { padding: 5px 12px; border-radius: var(--r); color: var(--ink-2); white-space: nowrap;
       cursor: pointer; user-select: none;
       transition: background-color var(--t-pop) ease, color var(--t-pop) ease, box-shadow var(--t-pop) ease; }
.seg > button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 720px) { .seg > button { min-height: 44px; } }   /* the 44px phone target */
.seg > .on, .seg > [aria-pressed="true"] { background: var(--paper); color: var(--ink); font-weight: 500;
       box-shadow: 0 0 0 1px var(--hair-2), 0 1px 2px rgba(0,0,0,.06); }
[data-theme="dark"] .seg > .on, [data-theme="dark"] .seg > [aria-pressed="true"] { background: #26262a; box-shadow: 0 0 0 1px var(--hair-2); }
@media (hover: hover) and (pointer: fine) {
  .seg > :not(.on):not([aria-pressed="true"]):hover { color: var(--ink); background: rgba(0,0,0,.035); }
  [data-theme="dark"] .seg > :not(.on):not([aria-pressed="true"]):hover { background: rgba(255,255,255,.05); }
}

/* ── status: a dot and words; colour is never the only signal ── */
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.status-dot.warn { background: #f59e0b; } .status-dot.err { background: #ef4444; }
.status-dot.off { background: var(--hair-2); } .status-dot.run { background: var(--accent); }

/* ── image URL check (checkImageUrl in ui.js): a thumbnail beside the input and
   one line under it. Amber means "could not load it from here", never "blocked". ── */
.img-field { display: flex; gap: var(--s2); }
.img-field > .input { flex: 1 1 auto; min-width: 0; }
.thumb { width: 41px; height: 41px; flex: none; border-radius: 8px; overflow: hidden;
         display: grid; place-items: center; background: var(--sink);
         box-shadow: inset 0 0 0 1px var(--hair); font-weight: 600; color: var(--warn); }
.thumb img { max-width: 100%; max-height: 100%; }
.hint[data-state="ok"] { color: var(--ok); }
.hint[data-state="warn"] { color: var(--warn); }
.input.is-warn { box-shadow: inset 0 0 0 1px var(--warn); }
.input.is-warn:focus { box-shadow: inset 0 0 0 1px var(--warn), 0 0 0 3px var(--warn-soft); }
