/*
  Formclip, in the Pagecrumb settings style. Unlayered, so it wins over oat's @layer rules.
  Square edges, hairline rules, Geist for text and Geist Mono for labels and data,
  neutral surfaces (no cream), and one lime accent that only ever means "on".
  Every colour is light-dark(), so [data-theme] only has to pin color-scheme.
*/

@font-face {
  font-family: "Geist";
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Geist Mono";
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/geist-mono-latin.woff2") format("woff2");
}

:root {
  color-scheme: light dark;
  --bg: light-dark(#ffffff, #0b0b0a);
  --bg-2: light-dark(#fafaf9, #0f0f0e);
  --fg: light-dark(#0a0a0a, #f2f2ef);
  --text-2: light-dark(#52524e, #a3a39d);
  --text-3: light-dark(#6b6b66, #8e8e87);
  --text-4: light-dark(#8f8f89, #76766f);
  --rule: light-dark(#0a0a0a, #3a3a37);
  --rule-soft: light-dark(#e7e7e4, #1f1f1d);
  --edge: light-dark(#d6d6d1, #3a3a37);
  --field: light-dark(#ffffff, #121211);
  --field-edge: light-dark(#d6d6d1, #2e2e2b);
  --hover: light-dark(#f4f4f2, #141413);
  --current: light-dark(#ffffff, #1a1a18);
  --lime: light-dark(#b6f03c, #c5f54a);
  --lime-wash: light-dark(#f4fbe3, #171d0c);
  --danger: light-dark(#b42318, #ff8f80);
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  /* Code tokens: each at least 6:1 on the code background and the copied flash, in both themes. */
  --code-tag: light-dark(#1d4ed8, #8ab4ff);
  --code-attr: light-dark(#8a4500, #e2b86b);
  --code-value: light-dark(#2e6b1c, #a6d98a);
  --enter-y: 6px;
  --enter-scale: 0.97;
  --press: 0.97;

  /* oat's own tokens, mapped so its base elements match. */
  --background: var(--bg);
  --foreground: var(--fg);
  --card: var(--bg);
  --primary: light-dark(#0a0a0a, #c5f54a);
  --primary-foreground: light-dark(#ffffff, #0b0b0a);
  --muted: var(--hover);
  --muted-foreground: var(--text-3);
  --accent: var(--hover);
  --border: var(--rule-soft);
  --input: var(--field-edge);
  --ring: var(--fg);
  --font-sans: var(--sans);
  --font-mono: var(--mono);
  --radius-small: 0;
  --radius-medium: 0;
  --radius-large: 0;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Base and browser surfaces ---------- */

html { scrollbar-color: var(--edge) transparent; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; caret-color: var(--fg); }
::selection { background: light-dark(#e3f7b8, #3b4a16); color: var(--fg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:not(.button):hover { color: inherit; }
p a, .hint a, .quiet a { text-decoration: underline; }
h1, h2, h3 { font-weight: 500; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--hover); border-radius: 0; padding: 0.1em 0.35em; }
pre code { background: none; padding: 0; font-size: inherit; }
kbd { display: inline-block; min-width: 1.5em; padding: 0 0.35em; font: 11px/1.6 var(--mono); text-align: center; color: var(--text-2); border: 1px solid var(--edge); background: var(--bg-2); }
.mono { font-family: var(--mono); }
.quiet { color: var(--text-3); }
.eyebrow { font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.lede { margin: 0; color: var(--text-2); line-height: 1.6; }
.hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-3); }
/* An operator detail still to fill in (src/legal.js). */
.todo { padding: 0 0.3em; border-radius: 3px; background: color-mix(in oklab, oklch(74% 0.125 30) 45%, transparent); color: inherit; font-family: var(--mono); }
.icon { width: 16px; height: 16px; flex: none; }

/* ---------- Buttons: square, hairline-bordered, ghost by default ---------- */

:is(button, a.button, summary.button) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; min-height: 0; padding: 0 12px;
  border: 1px solid var(--edge); border-radius: 0; background: transparent; color: var(--fg);
  font: 500 13px/1 var(--sans); white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms var(--ease);
}
:is(button, a.button, summary.button):hover:not(:disabled) { background: transparent; border-color: var(--fg); color: var(--fg); }
:is(button, a.button, summary.button):active:not(:disabled, [data-pending]) { transform: scale(var(--press)); }
/* Working: after 300ms (fast replies never flash) the label fades and a spinner takes its place. */
button[data-pending] { position: relative; cursor: progress; --spinner: var(--fg); color: transparent !important; transition-delay: 300ms; }
button.primary[data-pending] { --spinner: var(--primary-foreground); }
button.danger[data-pending] { --spinner: var(--danger); }
button[data-pending]::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px;
  border: 1.5px solid var(--spinner); border-right-color: transparent; border-radius: 50%;
  opacity: 0; animation: spin 640ms linear infinite, appear 120ms ease 300ms forwards;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes appear { to { opacity: 1; } }
/* A short rise for things that appear in place: menus, confirmations, field errors. */
@keyframes reveal { from { opacity: 0; transform: translateY(calc(var(--enter-y) * -0.66)); } }
:is(button, a.button, summary.button):disabled { color: var(--text-4); cursor: default; }
:is(button, a.button, summary.button).ghost { border-color: transparent; color: var(--text-2); }
:is(button, a.button, summary.button).ghost:hover:not(:disabled) { border-color: transparent; background: var(--hover); color: var(--fg); }
:is(button, a.button).primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
:is(button, a.button).primary:hover:not(:disabled) { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); opacity: 0.88; }
:is(button, a.button, summary.button).small { height: 28px; padding: 0 10px; font-size: 12.5px; }
:is(button, a.button).large { height: 44px; padding: 0 20px; font-size: 14px; gap: 8px; }
:is(button, a.button).block { display: flex; width: 100%; }
:is(button, summary.button).danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
:is(button, summary.button).danger:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
:is(button, summary.button).ghost.danger { border-color: transparent; }
button.icon-button { width: 32px; padding: 0; border-color: transparent; color: var(--text-3); }
button.icon-button:hover:not(:disabled) { border-color: transparent; background: var(--hover); color: var(--fg); }
button.icon-button.small { width: 26px; height: 26px; padding: 0; }
summary.button { list-style: none; }
summary.button::-webkit-details-marker, summary.button::marker { display: none; content: ""; }
summary.button::after { display: none; }

/* ---------- Fields ---------- */

.field { display: grid; gap: 8px; }
.field label { font-size: 13px; font-weight: 500; }
.field small { font-size: 12.5px; line-height: 1.5; color: var(--text-3); }
/* A plain line under the field: the vendor sheet draws every role=alert as a boxed banner. */
.field-error { animation: reveal 180ms var(--ease); display: block; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; font-size: 13px; line-height: 1.5; color: var(--danger); }
:is(input, textarea)[aria-invalid="true"] { border-color: var(--danger); }
:where(input:not([type=hidden], [type=checkbox], [type=radio]), textarea, select) {
  margin: 0; height: 36px; padding: 0 12px; font: 13px var(--sans);
  background: var(--field); color: var(--fg); border: 1px solid var(--field-edge); border-radius: 0; box-shadow: none;
}
textarea { height: auto; min-height: 88px; padding: 10px 12px; font: 12.5px/1.6 var(--mono); resize: vertical; }
/* Focus stays inside the field so it never grows past the button beside it. */
:where(input, textarea, select):focus { outline: none; border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
::placeholder { color: var(--text-3); opacity: 1; }
input[type=checkbox] { accent-color: light-dark(#0a0a0a, #c5f54a); border-radius: 0; }
.stack { display: grid; gap: 16px; }
.inline-field { display: flex; gap: 8px; }
.inline-field input { flex: 1; min-width: 0; }
.inline-field button { height: 36px; } /* match the 36px field beside it */
.actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Brand ---------- */

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; color: var(--fg); }
.brand-mark { color: var(--fg); flex: none; }
.brand-mark .crumb { fill: light-dark(#0a0a0a, #c5f54a); }

/* ---------- Shell: navigation | list | record ---------- */

body.app { height: 100dvh; overflow: hidden; }
:root { --nav-w: 240px; }
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) 360px; height: 100dvh; transition: grid-template-columns 280ms var(--ease); }
.shell:has(> .pane-detail:empty) { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
.pane-detail:empty { display: none; }
/* Hidden on wide screens: the panel leaves the grid and slides over the list only while a row is
   open, the same drawer narrower screens always use (see "Narrower screens"). */
@media (width > 1240px) {
  :root[data-detail="collapsed"] .shell { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  :root[data-detail="collapsed"] .pane-detail {
    position: fixed; inset: 0 0 0 auto; z-index: 30; width: min(440px, 100vw);
    border-left: 1px solid var(--rule); transform: translateX(100%); visibility: hidden;
    transition: transform 220ms var(--ease), visibility 0s 220ms;
  }
  :root[data-detail="collapsed"] .shell[data-detail-open] .pane-detail { transform: none; visibility: visible; transition: transform 220ms var(--ease); }
  :root[data-detail="collapsed"] .detail-head .detail-close { display: inline-flex; }
}
/* Below 1024px a docked panel would leave the list under ~430px, so it is always a drawer there
   and Details has nothing to switch. */
@media (width < 1024px) { .grid-toolbar .detail-toggle { display: none; } }

/* Clipped sideways so the wordmark and footer never spill over the page while the column widens. */
.pane-nav { display: flex; flex-direction: column; min-height: 0; overflow-x: clip; background: var(--bg-2); border-right: 1px solid var(--rule-soft); }
.nav-head { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--rule-soft); }
/* Scoped so they outrank the base :is(button, a.button) rule. */
.pane-nav .nav-close, .pane-main .nav-open, .detail-head .detail-close { display: none; }
/* Collapsed: a 56px rail. Every item keeps its left edge, so nothing drifts while the column
   narrows; hidden labels stay readable to screen readers. "width > 760px" leaves no gap below the
   max-width: 760px drawer at fractional widths. */
@media (width > 760px) {
  :root[data-sidebar="collapsed"] { --nav-w: 56px; }
  :root[data-sidebar="collapsed"] :is(.nav-workspace, .nav-section-head .eyebrow, .tree) { display: none; }
  :root[data-sidebar="collapsed"] :is(.pane-nav .brand span, .nav-foot .ghost span) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  :root[data-sidebar="collapsed"] .nav-head { position: relative; }
  /* Only the mark shows; pointing at it, or tabbing to it, turns it into the toggle. */
  :root[data-sidebar="collapsed"] .nav-collapse { position: absolute; top: 12px; left: 12px; opacity: 0; background: var(--hover); color: var(--fg); }
  :root[data-sidebar="collapsed"] .nav-head:hover .nav-collapse, :root[data-sidebar="collapsed"] .nav-collapse:focus-visible { opacity: 1; }
  :root[data-sidebar="collapsed"] .nav-head:is(:hover, :has(.nav-collapse:focus-visible)) .brand { opacity: 0; }
  :root[data-sidebar="collapsed"] .nav-section-head { padding: 14px 0 0 15px; }
  :root[data-sidebar="collapsed"] .nav-foot { flex-direction: column; align-items: flex-start; gap: 4px; margin-top: auto; padding: 10px 0 10px 12px; }
  :root[data-sidebar="collapsed"] .nav-foot .nav-settings { margin: 0; }
  :root[data-sidebar="collapsed"] .nav-foot .ghost { width: 32px; height: 32px; padding: 0; }
}
/* Touch screens cannot point first, so the expand button shows in place of the mark. */
@media (width > 760px) and (hover: none) {
  :root[data-sidebar="collapsed"] .nav-collapse { opacity: 1; }
  :root[data-sidebar="collapsed"] .pane-nav .brand { visibility: hidden; }
}
.nav-workspace { display: grid; gap: 4px; padding: 18px 16px 4px; min-width: 0; }
.nav-workspace strong { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-section-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 10px 6px 16px; }

.tree { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0 8px 20px; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree li { margin: 0; }
.tree-site + .tree-site { margin-top: 12px; }
.tree-site-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 30px; padding-left: 8px; }
.tree-site-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
@media (hover: hover) {
  .tree-site-row .icon-button { opacity: 0; transition: opacity 120ms ease; }
  .tree-site-row:hover .icon-button, .tree-site-row .icon-button:focus-visible { opacity: 1; }
}
.tree a {
  display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  height: 32px; padding: 0 8px 0 10px; color: var(--text-2); text-decoration: none; font-size: 13.5px;
}
.tree a { transition: background-color 120ms ease, color 120ms ease; }
@media (hover: hover) and (pointer: fine) { .tree a:hover { background: var(--hover); color: var(--fg); } }
.tree a[aria-current] { background: var(--current); color: var(--fg); font-weight: 500; box-shadow: inset 0 0 0 1px var(--rule-soft); }
.tree-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
button.tree-empty { justify-content: flex-start; width: 100%; height: 32px; padding: 0 10px; border-color: transparent; color: var(--text-3); font-weight: 400; }
button.tree-empty:hover:not(:disabled) { border-color: transparent; background: var(--hover); }
.nav-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 12px; border-top: 1px solid var(--rule-soft); }

/* State: a square dot, lime-filled when on (pagecrumb's "configured"). */
.dot { width: 7px; height: 7px; box-shadow: inset 0 0 0 1px var(--text-4); }
.dot[data-state="on"] { background: var(--lime); box-shadow: 0 0 0 1px light-dark(#0a0a0a, transparent); }
.status { display: inline-flex; align-items: center; gap: 8px; margin-inline-end: 6px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.status::before { content: ""; width: 7px; height: 7px; box-shadow: inset 0 0 0 1px var(--text-4); }
.status[data-state="on"] { color: var(--fg); }
.status[data-state="on"]::before { background: var(--lime); box-shadow: 0 0 0 1px light-dark(#0a0a0a, transparent); }
/* Saved but not yet confirmed by a passing check: half lit. */
.status[data-state="pending"] { color: var(--fg); }
.status[data-state="pending"]::before { background: linear-gradient(to right, var(--lime) 50%, transparent 50%); box-shadow: 0 0 0 1px light-dark(#0a0a0a, var(--text-4)); }

/* ---------- Pane 2: the list ---------- */

.pane-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.main-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; padding: 22px 24px 18px; border-bottom: 1px solid var(--rule); }
.main-title { display: grid; gap: 6px; min-width: 0; }
.main-title h1 { margin: 0; font-size: 26px; letter-spacing: -0.03em; line-height: 1.1; overflow-wrap: anywhere; }
.main-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

.onboard { padding: 72px 48px; max-width: 680px; }
.onboard h1 { margin: 0; font-size: 48px; letter-spacing: -0.04em; line-height: 1.02; text-wrap: balance; }
.onboard .lede { max-width: 540px; margin: 20px 0 32px; font-size: 16px; }
.main-head + .onboard { padding-top: 56px; }
.main-head + .onboard h1 { font-size: 36px; }

/* ---------- Form activity: one strip split by hairlines ---------- */

.stats-wrap { flex: none; container-type: inline-size; border-bottom: 1px solid var(--rule-soft); }
.stats { margin: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.stat { display: grid; align-content: start; gap: 6px; min-width: 0; padding: 14px 16px 16px; }
.stat:first-child { padding-left: 24px; }
.stat + .stat { border-left: 1px solid var(--rule-soft); }
.stat dt { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.stat dd { margin: 0; min-width: 0; }
.stat-value { font-size: 24px; font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Notes wrap to a second line rather than lose words to an ellipsis. */
.stat-note { font-size: 12.5px; line-height: 1.4; color: var(--text-3); text-wrap: pretty; font-variant-numeric: tabular-nums; }
/* Narrow: two columns, hairlines between them; an odd last cell takes the full row. */
@container (max-width: 760px) {
  .stats { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat, .stat:first-child { padding: 12px 16px 14px 24px; }
  .stat + .stat { border-left: 0; }
  .stat:nth-child(even) { border-left: 1px solid var(--rule-soft); }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--rule-soft); }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---------- Grid toolbar ---------- */

.grid { flex: 1; display: flex; flex-direction: column; min-height: 0; container-type: inline-size; }
/* Narrow list pane: toolbar buttons go icon-only, labels stay for screen readers. */
@container (max-width: 640px) {
  .grid-toolbar :is(button, summary.button):not([data-grid-delete]) > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .grid-toolbar :is(button, summary.button).small { padding: 0 7px; }
  .grid-count { display: none; }
  .grid-toolbar .grid-search { flex: 1 1 auto; margin-inline-end: 8px; }
}
/* No room for both: while rows are selected, the selection bar stands in for the search. */
@container (max-width: 800px) {
  .grid-toolbar:has(> .grid-selection:not([hidden])) .grid-search { display: none; }
  .grid-toolbar .grid-selection { margin-inline-end: auto; }
}
html:not(.js) .grid-toolbar, html:not(.js) .grid-host { display: none; }
html:not(.js) .grid { padding: 16px 24px; overflow: auto; }
/* One line at every width: the search gives up room first, the buttons go icon-only (above). */
.grid-toolbar { display: flex; align-items: center; gap: 4px; padding: 10px 16px 10px 24px; white-space: nowrap; border-bottom: 1px solid var(--rule-soft); }
.grid-toolbar > * { flex: none; }
.grid-search { position: relative; flex: 0 1 260px; min-width: 96px; margin-inline-end: 12px; }
.grid-search .icon { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
.grid-search input { width: 100%; height: 30px; padding-left: 32px; background: transparent; }
.grid-count { margin-inline-end: auto; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); font-variant-numeric: tabular-nums; }
.grid-selection { display: inline-flex; align-items: center; gap: 4px; margin-inline-end: 8px; padding-inline-end: 12px; border-right: 1px solid var(--rule-soft); }
.grid-selection[hidden] { display: none; }
.grid-selection .mono { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; margin-inline-end: 4px; }
:is([data-grid-filters], #detail-toggle)[aria-pressed="true"] { background: var(--hover); color: var(--fg); }

.menu { position: relative; border: 0; overflow: visible; }
.menu[open] > summary { background: var(--hover); color: var(--fg); border-bottom: 0; }
.menu > .menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0;
  display: grid; gap: 0; min-width: 220px; max-height: 360px; overflow-y: auto; padding: 6px;
  background: var(--bg); border: 1px solid var(--rule);
}
.menu-panel label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; font-size: 13px; font-weight: 400; cursor: pointer; overflow-wrap: anywhere; }
.menu-panel label:hover { background: var(--hover); }
.menu[open] > .menu-panel { transform-origin: top right; animation: pop 150ms var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(calc(var(--enter-y) * -0.66)) scale(var(--enter-scale)); } }
.menu-panel button { justify-self: start; margin-top: 4px; }
.menu-more { padding: 0 6px; }
.menu-actions { min-width: 200px; }
.menu-actions form { margin: 0; display: grid; }
.menu-actions hr { margin: 6px 0; border: 0; border-top: 1px solid var(--rule-soft); }
.menu-actions button.menu-item { justify-self: stretch; margin: 0; height: 32px; padding: 0 8px; justify-content: flex-start; gap: 10px; border: 0; font-size: 13px; font-weight: 400; color: var(--fg); }
.menu-actions button.menu-item { transition: background-color 100ms ease, color 100ms ease; }
.menu-actions button.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-actions button.menu-item.danger { color: var(--danger); }
.menu-actions button.menu-item.danger:hover:not(:disabled) { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }

/* ---------- Grid (Tabulator, restyled) ---------- */

.grid-host { position: relative; flex: 1; min-height: 0; }
.grid-host > div { position: absolute; inset: 0; }
.grid .tabulator { border: 0; background: var(--bg); font: 13px/1.4 var(--sans); color: var(--fg); font-variant-numeric: tabular-nums; }
.grid .tabulator .tabulator-header { background: var(--bg); color: var(--text-3); border-bottom: 1px solid var(--edge); font-weight: 400; }
.grid .tabulator .tabulator-header .tabulator-col { background: var(--bg); border-right: 1px solid var(--rule-soft); }
.grid .tabulator .tabulator-header .tabulator-col:hover,
.grid .tabulator .tabulator-header .tabulator-col.tabulator-sortable.tabulator-col-sorter-element:hover { background: var(--hover); }
.grid .tabulator .tabulator-col .tabulator-col-content { padding: 9px 10px 8px; }
.grid .tabulator .tabulator-col .tabulator-col-title { display: flex; align-items: center; gap: 6px; font: 11px/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.grid .tabulator .tabulator-col .tabulator-header-popup-button { order: 2; margin-inline-start: auto; display: inline-grid; place-items: center; padding: 1px; color: var(--text-4); }
.grid .tabulator .tabulator-col .tabulator-header-popup-button:hover { background: var(--rule-soft); color: var(--fg); }
.grid .tabulator .tabulator-header-popup-button .icon { width: 14px; height: 14px; }
.grid .tabulator .tabulator-col .tabulator-header-filter { margin-top: 6px; }
.grid:not(.show-filters) .tabulator .tabulator-col .tabulator-header-filter { display: none; }
.grid .tabulator .tabulator-header-filter input { height: 26px; padding: 0 8px; font: 12px var(--mono); background: var(--field); border: 1px solid var(--field-edge); }
.grid .tabulator .tabulator-col-sorter .tabulator-arrow { border-bottom-color: var(--edge); }
.grid .tabulator .tabulator-col.tabulator-sortable[aria-sort="ascending"] .tabulator-arrow { border-bottom-color: var(--fg); }
.grid .tabulator .tabulator-col.tabulator-sortable[aria-sort="descending"] .tabulator-arrow { border-top-color: var(--fg); }
.grid .tabulator .tabulator-col-resize-handle:hover { background: var(--fg); }
.grid .tabulator .tabulator-header .tabulator-col.tabulator-frozen { background: var(--bg); z-index: 11; }
/* Tabulator pins frozen columns with inline sticky positioning; too narrow to pin, they scroll. */
.grid .tabulator.frozen-unpinned .tabulator-frozen { position: relative !important; left: auto !important; }

.grid .tabulator .tabulator-tableholder, .grid .tabulator .tabulator-tableholder .tabulator-table { background: var(--bg); color: var(--fg); }
.grid .tabulator .tabulator-tableholder .tabulator-placeholder span { color: var(--text-3); font: 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.grid .tabulator-row, .grid .tabulator-row.tabulator-row-even { min-height: 36px; background: var(--bg); border-bottom: 1px solid var(--rule-soft); }
.grid .tabulator-row .tabulator-cell { padding: 9px 10px; border-right: 1px solid var(--rule-soft); }
.grid .tabulator-row .tabulator-cell.tabulator-frozen { background: inherit; }
.grid .tabulator-row .tabulator-frozen.tabulator-frozen-left,
.grid .tabulator-header .tabulator-frozen.tabulator-frozen-left { border-right: 1px solid var(--edge); }
.grid .tabulator-row .tabulator-cell.tabulator-row-header { border-bottom: 0; background: inherit; }
.grid .tabulator-row.tabulator-selectable:hover { background: var(--hover); cursor: default; }
.grid .tabulator-row.tabulator-selected, .grid .tabulator-row.tabulator-selected:hover { background: var(--lime-wash); }
.grid .tabulator-row.is-active, .grid .tabulator-row.is-active:hover { background: var(--current); box-shadow: inset 0 1px 0 var(--fg), inset 0 -1px 0 var(--fg); }
.grid .tabulator-row .tabulator-cell[tabulator-field="received"] { font: 12px var(--mono); color: var(--text-2); }
.grid-open { font-weight: 500; text-decoration: none; }
.grid-open:hover { text-decoration: underline; }

.tabulator-menu.tabulator-popup-container { background: var(--bg); color: var(--fg); border: 1px solid var(--rule); border-radius: 0; padding: 4px; box-shadow: none; font: 13px var(--sans); }
.tabulator-menu .tabulator-menu-item { padding: 7px 10px; border-radius: 0; }
.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover { background: var(--hover); }
.tabulator-menu .tabulator-menu-separator { border-top-color: var(--rule-soft); margin: 4px 0; }
.tabulator .tabulator-alert { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.tabulator .tabulator-alert .tabulator-alert-msg { background: var(--bg); color: var(--fg); border: 1px solid var(--rule); border-radius: 0; font: 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; padding: 8px 12px; }

/* No-JavaScript fallback table */
.list table { width: 100%; border-collapse: collapse; font-size: 13px; }
.list th { padding: 8px 10px; font: 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); text-align: start; border-bottom: 1px solid var(--edge); }
.list td { padding: 10px; border-bottom: 1px solid var(--rule-soft); }
.list a { text-decoration: none; }
.num { text-align: end; white-space: nowrap; }
.pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }
.pager-steps { display: flex; gap: 8px; }

/* ---------- Pane 3: the record ---------- */

.pane-detail { min-height: 0; overflow-y: auto; background: var(--bg); border-left: 1px solid var(--rule-soft); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 24px 24px 18px; border-bottom: 1px solid var(--rule-soft); }
.detail-head > div { display: grid; gap: 6px; min-width: 0; }
.detail-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; line-height: 1.25; overflow-wrap: anywhere; }
.detail-head p { margin: 0; font-size: 11.5px; }
.kv { margin: 0; }
.kv > div { display: grid; gap: 5px; padding: 14px 24px; border-bottom: 1px solid var(--rule-soft); }
.kv dt { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); overflow-wrap: anywhere; }
.kv dd { margin: 0; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.kv dd p { margin: 0; }
.kv dd p + p { margin-top: 4px; }
.detail-foot { padding: 16px 24px 32px; }

/* Settings: groups with the intro on the left and the controls on the right, like Pagecrumb. */
.nav-foot .nav-settings { margin-inline-end: auto; margin-inline-start: 4px; }
.settings { max-width: 920px; padding: 8px 24px 64px; }
.settings-notice { margin: 16px 0 0; padding: 10px 12px; border: 1px solid var(--edge); background: var(--bg-2); font-size: 13px; }
.settings-group { display: flex; flex-wrap: wrap; gap: 16px 48px; padding: 32px 0; border-bottom: 1px solid var(--rule-soft); }
.settings-group:last-child { border-bottom: 0; }
.settings-intro { flex: 1 1 200px; min-width: 0; display: grid; align-content: start; gap: 8px; }
.settings-intro h2 { margin: 0; font-size: 18px; font-weight: 500; letter-spacing: -0.02em; }
.settings-intro p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.settings-body { flex: 999 1 380px; min-width: 0; }
.settings-body button, .settings-body .button { height: 36px; }
.settings-facts { display: grid; margin: 0; border-top: 1px solid var(--rule-soft); }
.settings-facts > div { display: grid; grid-template-columns: minmax(0, 180px) minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule-soft); }
.settings-facts dt { font-size: 13px; color: var(--text-3); }
.settings-facts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }

/* Invite decision bar: only on the admin's Invite requests form. */
.invite-decision { display: grid; gap: 12px; padding: 16px 24px 18px; border-bottom: 1px solid var(--rule-soft); background: var(--bg-2); }
.invite-decision:empty, [data-invite-slot]:empty { display: none; }
.invite-state { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; font-size: 13px; color: var(--text-2); }
.invite-state strong { color: var(--fg); font-weight: 600; }
.invite-decision[data-state="invited"] .invite-state strong::before,
.invite-decision[data-state="signed-up"] .invite-state strong::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 8px; background: var(--lime); vertical-align: 1px; }
.invite-decision[data-state="blocked"] .invite-state strong { color: var(--danger); }
.invite-notice { margin: 0; padding: 8px 10px; border: 1px solid var(--edge); background: var(--bg); font-size: 13px; }
.invite-approve { display: grid; gap: 8px; justify-items: start; }
.invite-approve input { width: 100%; height: 36px; }
.invite-approve .hint { margin-bottom: 4px; }
.invite-approve label { font-size: 12px; color: var(--text-3); }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-actions form { margin: 0; }
.invite-pill { font-size: 12.5px; color: var(--text-2); }
.invite-pill[data-state="pending"] { color: var(--fg); font-weight: 600; }
.invite-pill[data-state="blocked"] { color: var(--danger); }
.invite-pill[data-state="signed-up"], .invite-pill[data-state="invited"] { color: var(--fg); }
details.confirm { border: 0; overflow: visible; }
details.confirm > summary { padding: 0 10px; }
details.confirm[open] > summary { border-bottom: 0; }
details.confirm[open] > form { animation: reveal 180ms var(--ease); }
details.confirm > form { margin: 12px 0 0; padding: 14px; display: grid; gap: 12px; justify-items: start; border: 1px solid var(--edge); }
details.confirm > form p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
/* Deleting a site or form: the consequence in full ink, the name field at full width. */
.delete-confirm { justify-items: start; }
details.confirm > form.delete-confirm p, .delete-confirm > p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--fg); max-width: 60ch; }
.delete-confirm .field { justify-self: stretch; }
.detail-empty { display: grid; align-content: center; justify-items: start; gap: 10px; height: 100%; padding: 32px; }
.detail-empty p { max-width: 30ch; margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text-3); }

/* ---------- Dialogs: a small settings sheet ---------- */

dialog.sheet {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 64px); padding: 0;
  background: var(--bg); color: var(--fg); border: 1px solid var(--rule); border-radius: 0; box-shadow: none;
  /* oat animates dialogs for 300ms; pagecrumb keeps motion short, and closing is quicker than opening. */
  opacity: 0; transform: translateY(var(--enter-y)) scale(0.985);
  transition: opacity 140ms ease, transform 140ms var(--ease), overlay 140ms allow-discrete, display 140ms allow-discrete;
}
dialog.sheet[open] { display: flex; flex-direction: column; opacity: 1; transform: none; transition-duration: 200ms; }
@starting-style { dialog.sheet[open] { opacity: 0; transform: translateY(var(--enter-y)) scale(0.985); } }
dialog.sheet::backdrop {
  background: light-dark(rgb(10 10 10 / 0.24), rgb(0 0 0 / 0.62)); opacity: 0;
  transition: opacity 140ms ease, overlay 140ms allow-discrete, display 140ms allow-discrete;
}
dialog.sheet[open]::backdrop { opacity: 1; transition-duration: 200ms; }
@starting-style { dialog.sheet[open]::backdrop { opacity: 0; } }
.sheet-head { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 12px 14px 24px; border-bottom: 1px solid var(--rule-soft); }
.sheet-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.sheet-head form { margin: 0; }
.sheet-body { display: grid; gap: 18px; padding: 20px 24px 24px; overflow-y: auto; }
.sheet-body .lede { font-size: 14px; }
.sheet-section { padding-top: 20px; border-top: 1px solid var(--rule-soft); }
.sheet-subhead { margin: 0; font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }

.copy { display: grid; gap: 6px; }
.copy-head { display: flex; align-items: center; justify-content: space-between; }
.copy-head button { height: 24px; padding: 0 6px; font-size: 12px; }
.swap { display: inline-grid; justify-items: start; align-items: center; }
.swap > * { grid-area: 1 / 1; transition: opacity 160ms ease, transform 220ms var(--ease), filter 160ms ease; }
.swap > :last-child { opacity: 0; filter: blur(2px); }
.swap > svg:last-child { transform: scale(0.5); }
[data-copied] .swap > :first-child { opacity: 0; filter: blur(2px); }
[data-copied] .swap > svg:first-child { transform: scale(0.5); }
[data-copied] .swap > :last-child { opacity: 1; filter: none; transform: none; }
[data-copied].copy-button { color: var(--fg); }
.copy pre { transition: background-color 600ms ease, border-color 600ms ease; margin: 0; padding: 12px; font: 12px/1.6 var(--mono); background: var(--bg-2); border: 1px solid var(--rule-soft); border-radius: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.copy pre.one-line { white-space: normal; word-break: break-all; }

/* ---------- Spam protection ---------- */

.spam-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.spam-head .status { margin: 0; }
.spam-on { margin: 0; font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 10px; align-items: start; font-size: 13.5px; line-height: 22px; }
.steps li::before {
  content: counter(step); grid-row: span 2; display: grid; place-items: center; width: 22px; height: 22px;
  font: 11px var(--mono); color: var(--text-2); border: 1px solid var(--edge);
}
.out-link { justify-self: start; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; line-height: 20px; color: var(--fg); text-decoration: underline; text-decoration-color: var(--edge); transition: text-decoration-color 120ms ease; }
.out-link:hover { text-decoration-color: currentColor; }
.out-link .icon { width: 13px; height: 13px; color: var(--text-3); }
.secret-field { display: flex; gap: 8px; }
.secret-field input { flex: 1; min-width: 0; }
.secret-field button { flex: none; min-width: 56px; height: 36px; }
.rules { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--rule-soft); }
.rules .hint { margin: 0; }
.rule { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: start; }
.rule input { margin: 3px 0 0; }
.rule label { margin: 0; font-size: 13.5px; font-weight: 500; }
.rule small { grid-column: 2; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
/* Without scripting the toggle would do nothing, so it only appears when it works. */
[data-reveal] { display: none; }
.js [data-reveal] { display: inline-flex; }
.t-tag { color: var(--code-tag); }
.t-attr { color: var(--code-attr); }
.t-value { color: var(--code-value); }
.t-punct, .t-comment { color: var(--text-3); }
.t-comment { font-style: italic; }
/* Quick to light up, slow to fade: the eye catches what was copied. */
.copy[data-copied] pre { background: var(--lime-wash); border-color: color-mix(in srgb, var(--lime) 70%, transparent); transition-duration: 80ms; }

/* ---------- Toast: a quiet confirmation after a save or delete ---------- */

.toast {
  position: fixed; z-index: 60; right: 16px; bottom: 16px; display: flex; align-items: center; gap: 10px;
  max-width: min(420px, calc(100vw - 32px)); padding: 11px 14px 11px 12px;
  background: var(--fg); color: var(--bg); font-size: 13.5px; line-height: 1.45;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.16);
  animation: toast-in 240ms var(--ease), toast-out 180ms ease 3.2s forwards;
}
/* Reading it holds it: the timer pauses while the pointer is over it. */
.toast:hover { animation-play-state: paused; }
@keyframes toast-in { from { opacity: 0; transform: translateY(calc(var(--enter-y) * 2)); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(var(--enter-y)); visibility: hidden; } }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- Solo pages: sign-in and errors ---------- */

body.solo { min-height: 100dvh; display: grid; }
.solo-corner { position: fixed; top: 16px; right: 16px; }
.solo-main { display: grid; place-items: center; padding: 64px 24px; }
.solo-card { width: min(100%, 420px); }
.solo-card .brand { margin-bottom: 48px; }
.solo-card h1 { margin: 0 0 16px; font-size: 40px; letter-spacing: -0.04em; line-height: 1.04; }
.solo-body p { margin: 0 0 28px; font-size: 15px; line-height: 1.6; color: var(--text-2); }
.solo-body .button { height: 44px; }

.solo-main:has(.auth-flow) { padding-top: clamp(72px, 13vh, 132px); }
.solo-card:has(.auth-flow) h1 { overflow-wrap: anywhere; }
.auth-flow { display: grid; gap: 20px; }
.auth-flow p { margin: 0; font-size: 14px; }
.auth-flow input:not([type=hidden]) { width: 100%; height: 44px; font-size: 16px; }
.auth-flow #code { font-family: var(--mono); letter-spacing: 0.18em; }
.auth-flow .auth-error { color: var(--danger); }
.auth-email {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px;
  padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--edge);
  overflow-wrap: anywhere;
}
.auth-email a { color: var(--text-2); }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-2); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--edge); }

/* ---------- Narrower screens ---------- */

@media (max-width: 1240px) {
  :root { --nav-w: 232px; }
  .shell, .shell:has(> .pane-detail:empty) { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .pane-detail {
    position: fixed; inset: 0 0 0 auto; z-index: 30; width: min(440px, 100vw);
    border-left: 1px solid var(--rule); transform: translateX(100%); visibility: hidden;
    transition: transform 220ms var(--ease), visibility 0s 220ms;
  }
  .shell[data-detail-open] .pane-detail { transform: none; visibility: visible; transition: transform 220ms var(--ease); }
  .detail-head .detail-close { display: inline-flex; }
}
/* Docked with Details from 1024px: the panel takes its column back, as on wide screens. */
@media (1024px <= width <= 1240px) {
  :root[data-detail="expanded"] .shell { grid-template-columns: var(--nav-w) minmax(0, 1fr) 360px; }
  :root[data-detail="expanded"] .shell:has(> .pane-detail:empty) { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  :root[data-detail="expanded"] .pane-detail { position: static; z-index: auto; width: auto; border-left-color: var(--rule-soft); transform: none; visibility: visible; transition: none; }
  :root[data-detail="expanded"] .detail-head .detail-close { display: none; }
}

@media (max-width: 760px) {
  .shell, .shell:has(> .pane-detail:empty) { grid-template-columns: minmax(0, 1fr); }
  .pane-nav {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(300px, 86vw);
    border-right: 1px solid var(--rule); transform: translateX(-100%); visibility: hidden;
    transition: transform 220ms var(--ease), visibility 0s 220ms;
  }
  .shell[data-nav-open] .pane-nav { transform: none; visibility: visible; transition: transform 220ms var(--ease); }
  .shell[data-nav-open]::after { content: ""; position: fixed; inset: 0; z-index: 35; background: rgb(0 0 0 / 0.3); }
  .pane-nav .nav-close { display: inline-flex; }
  .pane-nav .nav-collapse { display: none; }
  .pane-main .nav-open { display: inline-flex; position: absolute; top: 14px; left: 10px; z-index: 2; }
  .main-head { padding: 16px 16px 14px 52px; }
  .main-title h1 { font-size: 22px; }
  .grid-toolbar { padding: 8px 12px; }
  .onboard { padding: 72px 20px 48px; }
  .onboard h1 { font-size: 36px; }
  .solo-card h1 { font-size: 34px; }
  .toast { left: 16px; right: 16px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --enter-y: 0px; --enter-scale: 1; --press: 1; }
  .shell, .pane-detail, .pane-nav, .shell[data-detail-open] .pane-detail, .shell[data-nav-open] .pane-nav { transition: none !important; }
  dialog.sheet, dialog.sheet[open] { transform: none; }
  .swap > *, [data-copied] .swap > * { transform: none !important; filter: none !important; }
  button[data-pending]::after { animation: appear 120ms ease 300ms forwards; }
}
