/* Synapse CTI web UI, styled to docs/ent-style.md.
   Token values come from the Ent design system (vendored copy in ent-security/ent-claudlos
   src/styles/ent-tokens.css). No build step: plain CSS with custom properties. */

/* ---------- Fonts (self-hosted; OFL) ---------- */
@font-face {
  font-family: "Inter"; src: url("fonts/InterVariable.woff2") format("woff2-variations");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---------- Tokens: light (default) ---------- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* shadcn semantic tokens */
  --background: hsl(30 100% 99%);
  --foreground: hsl(0 0% 0%);
  --card: hsl(0 0% 100%);
  --muted: hsl(35 27% 96%);
  --muted-foreground: hsl(30 7% 38%);   /* ≥4.5:1 on muted and tinted surfaces too */
  --border: hsl(35 15% 88%);
  --input: hsl(35 15% 88%);
  --primary: hsl(152 67% 61%);
  --destructive: hsl(0 72% 51%);
  --destructive-text: hsl(0 72% 45%);
  --ring: hsl(0 0% 0%);

  /* Ent palette */
  --neutral-400-30: rgba(212, 208, 201, 0.3);
  --neutral-900: #12100a;
  --neutral-50: #fffefc;
  --brand-950: #141c0b;          /* brand-day-950: logo */
  --brand-600: #6f7962;

  --red-500: #e2545b;    --red-text: #a72b45;     /* red-700 */
  --amber-500: #ef7b40;  --amber-text: #b15323;   /* orange-700 */
  --green-500: #53ab76;  --green-text: #12653e;   /* green-700 */
  --blue-500: #49bbe1;   --blue-text: #1c6078;    /* seafoam-800: 700 was 3.9:1 on its tint */

  /* Ent Bloom: primary actions and "where your changes go" */
  --bloom: #67cf91;
  --bloom-ink: #07361c;          /* approved pairing: #07361C on #67CF91 */
  --bloom-hover: #53ab76;
  --where-main: var(--amber-text);

  --shadow-sm: 0 1px 2px rgba(67, 67, 66, 0.08);
  --shadow-md: 0 4px 12px rgba(67, 67, 66, 0.1);
  --shadow-lg: 0 12px 24px rgba(67, 67, 66, 0.12);
  color-scheme: light;
}

/* ---------- Tokens: dark ---------- */
:root.dark {
  --background: hsl(45 4% 5%);
  --foreground: hsl(30 100% 99%);
  --card: hsl(30 17% 9%);
  --muted: hsl(20 6% 10%);
  --muted-foreground: hsl(30 7% 62%);   /* ≥4.5:1 on the tinted sidebar and where-box too */
  --border: hsl(40 6% 20%);
  --input: hsl(40 6% 20%);
  --primary: hsl(152 51% 61%);
  --destructive: hsl(0 62% 30%);
  --destructive-text: #ee6f6f;
  --ring: hsl(30 100% 99%);

  --neutral-400-30: rgba(110, 107, 101, 0.3);
  --neutral-900: #fcfbf8;
  --neutral-50: #000000;
  --brand-950: #defff0;          /* brand-night-50 */
  --brand-600: #a6f3c5;

  --red-text: #f68c8a;     /* red-300 */
  --amber-text: #ffa068;   /* orange-300 */
  --green-text: #a6f3c5;   /* green-300 */
  --blue-text: #75d2f1;    /* blue1-300 */
  --bloom-hover: #8ce4af;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 400 14px/20px var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
code, pre, kbd { font-family: var(--font-mono); }
code { font-size: 12px; background: var(--muted); padding: 1px 4px; border-radius: 4px; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

.muted { color: var(--muted-foreground); }
.text-sm { font-size: 14px; line-height: 20px; }
.text-primary { color: var(--primary); }
.w-full { width: 100%; }
.stack-4 > * + * { margin-top: 16px; }
.spacer { flex: 1; }
.label-caps {
  font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted-foreground);
}
.beta { font-size: 11px; font-weight: 400; color: var(--muted-foreground); margin-left: 4px; }

/* Icons (Phosphor sprite) */
.i { width: 16px; height: 16px; flex: none; }
.i-sm { width: 14px; height: 14px; flex: none; }
.i-lg { width: 24px; height: 24px; flex: none; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Controls ---------- */
.field { display: grid; gap: 8px; }
.field label { font-size: 14px; font-weight: 500; }
.field-inline { display: inline-flex; align-items: center; gap: 8px; }
input, select, textarea {
  background: var(--card); border: 1px solid var(--input); border-radius: 6px;
  padding: 7px 10px; font-size: 14px; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
textarea { font-family: var(--font-mono); font-size: 13px; resize: vertical; width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted-foreground); opacity: 1; }
:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--bloom); color: var(--bloom-ink); }
.btn-primary:hover:not(:disabled) { background: var(--bloom-hover); }
.btn-outline { background: var(--card); border-color: var(--input); }
.btn-lg { height: 40px; padding: 0 20px; }
.google-icon { width: 16px; height: 16px; flex: none; }
.btn-outline:hover:not(:disabled) { background: var(--muted); }
.btn-ghost { background: transparent; color: var(--muted-foreground); height: 28px; padding: 0 8px; font-size: 12px; }
.btn-ghost:hover { color: var(--foreground); background: color-mix(in srgb, var(--muted) 70%, transparent); }

/* ---------- Tinted chips, banners (formula: bg 10%, border 25%, text 700 / dark 300) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; line-height: 16px; font-weight: 500;
  padding: 1px 7px; margin: 1px 4px 1px 0; border-radius: 999px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 40%, transparent); color: var(--muted-foreground);
  font-family: var(--font-mono); white-space: nowrap;
}
.tint-red   { background: color-mix(in srgb, var(--red-500) 10%, transparent);   border-color: color-mix(in srgb, var(--red-500) 25%, transparent);   color: var(--red-text); }
.tint-amber { background: color-mix(in srgb, var(--amber-500) 10%, transparent); border-color: color-mix(in srgb, var(--amber-500) 25%, transparent); color: var(--amber-text); }
.tint-green { background: color-mix(in srgb, var(--green-500) 10%, transparent); border-color: color-mix(in srgb, var(--green-500) 25%, transparent); color: var(--green-text); }
.tint-blue  { background: color-mix(in srgb, var(--blue-500) 10%, transparent);  border-color: color-mix(in srgb, var(--blue-500) 25%, transparent);  color: var(--blue-text); }
.chip.dashed { border-style: dashed; }
.chip-quiet { background: transparent; color: var(--muted-foreground); }
.chip-btn { cursor: pointer; }
.chip-btn:hover, .chip-btn[aria-expanded=true] { border-color: currentColor; }

/* action menu (pivot, tag chips, filter buttons) */
.menu {
  position: fixed; z-index: 50; display: flex; flex-direction: column; gap: 2px; padding: 4px;
  max-width: min(480px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-md);
}
.menu-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 8px; min-width: 0;
  border: 0; border-radius: 4px; background: none; text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: color-mix(in srgb, var(--muted) 70%, transparent); box-shadow: none; }
.menu-label, .menu-storm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-label { font-size: 13px; }
.menu-label .count { margin-left: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.menu-storm { font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); }
[aria-busy=true] { cursor: progress; opacity: .6; }

.banner { border-radius: 6px; border: 1px solid; padding: 12px 16px; font-size: 14px; }
.banner-red { border-color: color-mix(in srgb, var(--red-500) 25%, transparent); background: color-mix(in srgb, var(--muted) 50%, transparent); color: var(--red-text); }
.error-box {
  border-radius: 6px; border: 1px solid color-mix(in srgb, var(--destructive) 30%, transparent);
  background: color-mix(in srgb, var(--destructive) 5%, transparent); color: var(--destructive-text);
  padding: 12px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.err + .err { margin-top: 12px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--destructive) 20%, transparent); }
.err > * + * { margin-top: 8px; }
.err-title { font-weight: 600; }
.err-text { color: var(--foreground); }
.err-spot {
  margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--background); color: var(--foreground);
  font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.err-spot mark {
  background: color-mix(in srgb, var(--destructive) 18%, transparent); color: inherit;
  text-decoration: underline wavy var(--destructive); text-underline-offset: 3px;
}
.err-spot mark.eol { display: inline-block; min-width: 1ch; }
.err-actions .btn { color: var(--foreground); }
.err-raw { display: block; font-size: 12px; white-space: pre-wrap; }
.err-details summary {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none;
  font-size: 13px; color: var(--muted-foreground); border-radius: 4px;
}
.err-details summary::-webkit-details-marker { display: none; }
.err-details summary:hover { color: var(--foreground); }
.err-details summary:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.err-details summary .i-sm { transition: transform .15s ease-out; }
.err-details[open] summary .i-sm { transform: rotate(90deg); }
.err-details .err-raw { margin-top: 6px; color: var(--destructive-text); }
#login-key-help p { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .err-details summary .i-sm { transition: none; } }
.err-more { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }

/* ---------- Login ---------- */
.login { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: color-mix(in srgb, var(--muted) 30%, var(--background)); padding: 16px; }
.login-box { width: 100%; max-width: 384px; padding: 24px; }
.login-box > * + * { margin-top: 24px; }
.login-head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.login-logo { width: 40px; height: 40px; color: var(--brand-950); }
.login-or { display: flex; align-items: center; gap: 12px; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.login-head h1 { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.025em; }

/* ---------- App shell ---------- */
.shell { display: flex; height: 100vh; padding: 12px; gap: 12px; }
.sidebar {
  width: 220px; flex: none; height: 100%; display: flex; flex-direction: column; gap: 24px;
  padding: 16px 12px; border-radius: 20px; overflow: hidden;
  background: var(--neutral-400-30); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: width .2s ease;
}
.sb-logo { display: flex; align-items: center; gap: 10px; padding: 0 6px; height: 28px; color: var(--brand-950); }
.sb-logo-mark { width: 24px; height: 24px; flex: none; }
.sb-wordmark { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.sb-toggle {
  width: 100%; height: 32px; border-radius: 999px; border: 1px solid var(--border); margin-top: -12px;
  background: color-mix(in srgb, var(--card) 60%, transparent); color: var(--muted-foreground);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: color .15s, background-color .15s;
}
.sb-toggle:hover { color: var(--foreground); background: var(--card); }
.sb-group { display: flex; flex-direction: column; gap: 4px; }
/* Where changes go: Bloom in a branch, amber when writing straight to main. Always on screen. */
.sb-where {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--bloom) 55%, transparent); text-align: left; width: 100%;
  background: color-mix(in srgb, var(--bloom) 18%, var(--card)); color: var(--foreground);
  font-size: 13px; line-height: 16px; transition: background-color .15s, border-color .15s;
}
.sb-where .i { color: var(--green-text); }
.sb-where-text { display: flex; flex-direction: column; min-width: 0; }
.sb-where-k { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); }
.sb-where-name { font-family: var(--font-mono); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-where:hover { border-color: var(--bloom); }
:root[data-where="main"] .sb-where {
  border-color: color-mix(in srgb, var(--amber-500) 45%, transparent);
  background: color-mix(in srgb, var(--amber-500) 12%, var(--card));
}
:root[data-where="main"] .sb-where .i, :root[data-where="main"] .sb-where-name { color: var(--where-main); }
:root[data-where="read"] .sb-where { border-color: var(--border); background: color-mix(in srgb, var(--card) 60%, transparent); }
:root[data-where="read"] .sb-where .i { color: var(--muted-foreground); }
/* the pickers carry the same colour, so the page and the frame agree */
:root[data-where="branch"] :is(#views, #tag-views) { border-color: var(--bloom); box-shadow: inset 3px 0 0 var(--bloom); }
:root[data-where="main"] :is(#views, #tag-views) { border-color: color-mix(in srgb, var(--amber-500) 60%, transparent); }
.sb-group-label { font-size: 14px; font-weight: 600; color: color-mix(in srgb, var(--foreground) 80%, transparent); padding: 0 8px 4px; }
.sb-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px; border: 0;
  background: transparent; color: color-mix(in srgb, var(--foreground) 80%, transparent);
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; width: 100%;
  transition: background-color .15s, color .15s; white-space: nowrap;
}
.sb-item:hover { background: color-mix(in srgb, var(--card) 60%, transparent); color: var(--foreground); }
.sb-item.active { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }
.sb-item.active .i { color: var(--brand-600); }
.sb-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--input); display: flex; flex-direction: column; gap: 4px; }
.sb-label { overflow: hidden; text-overflow: ellipsis; }
.role-chip { margin-left: auto; flex: none; }

/* What a role can't do is hidden, for clarity only: Synapse refuses it either way. */
:root[data-role="viewer"] .needs-write { display: none !important; }
:root:not([data-role="admin"]) .needs-admin { display: none !important; }
:root[data-role="admin"] .not-admin { display: none !important; }

.shell.collapsed .sidebar { width: 80px; }
.shell.collapsed .sb-label {   /* hidden from sight only: screen readers still get the names */
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.shell.collapsed .sb-logo, .shell.collapsed .sb-item, .shell.collapsed .sb-where { justify-content: center; padding: 0; }

.content { flex: 1; min-width: 0; min-height: 0; display: flex; }
.page { flex: 1; min-width: 0; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-title { display: flex; align-items: center; gap: 8px; font-size: 24px; line-height: 32px; font-weight: 700; }
.subtitle { font-size: 14px; color: var(--muted-foreground); margin-top: 2px; max-width: 80ch; text-wrap: pretty; }
.status { font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-sm); }
.query-card { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.query-card textarea { border-radius: 6px; min-height: 76px; }
/* Suggestions float under the caret, so nothing below the box moves. */
.query-card { position: relative; }
.ac-list {
  position: absolute; z-index: 20; margin: 0; padding: 4px; list-style: none;
  width: min(460px, calc(100% - 16px)); max-height: 288px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg);
}
.ac-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ac-item:hover { background: color-mix(in srgb, var(--neutral-400-30) 50%, transparent); }
.ac-item[aria-selected=true] { background: var(--neutral-400-30); }
.ac-name { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.ac-type { font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground); }
.ac-doc { grid-column: 1 / -1; font-size: 12px; color: var(--muted-foreground); }
.query-tools { position: absolute; top: 4px; right: 8px; display: flex; gap: 2px; }
.query-card textarea { padding-right: 260px; }
.query-bar { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.query-bar select { min-width: 160px; }
.run-group { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.btn-step { height: 36px; font-size: 14px; padding: 0 10px; }

.msgs {
  margin: 0; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 50%, transparent); color: var(--muted-foreground);
  font-size: 12px; line-height: 18px; white-space: pre-wrap; max-height: 10em; overflow: auto;
}

/* ---------- Table ---------- */
.table-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: auto; box-shadow: var(--shadow-sm); container-type: inline-size; }
table { width: 100%; border-collapse: collapse; }
thead { background: color-mix(in srgb, var(--muted) 30%, transparent); border-bottom: 1px solid var(--border); }
th {
  text-align: left; padding: 10px 16px; font-size: 12px; font-weight: 500; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}
tbody tr + tr td { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
tbody tr:not(.empty):hover { background: color-mix(in srgb, var(--muted) 30%, transparent); }
td { padding: 12px 16px; font-size: 14px; vertical-align: top; }
td.form { font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
/* an indicator is never split mid-label ("examp / le.org" copies wrong by eye): it keeps its width and
   the table scrolls sideways, with the row actions pinned (td.action) */
td.valu { font-family: var(--font-mono); font-weight: 500; overflow-wrap: break-word; min-width: 12em; }
td.action { text-align: right; white-space: nowrap; }
/* row actions stay reachable when a narrow table scrolls sideways */
td.action, th.col-action { position: sticky; right: 0; background: var(--card); }
th.col-action { background: color-mix(in srgb, var(--muted) 30%, var(--card)); }
tbody tr:not(.empty):hover td.action, tr.node.open td.action { background: color-mix(in srgb, var(--muted) 30%, var(--card)); }
tr.node.kb-active td.action { background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
.col-form { width: 1%; }
.col-action { width: 1%; }
tr.empty td { padding: 32px 16px; text-align: center; color: var(--muted-foreground); }
tr.empty .i { vertical-align: -3px; margin-right: 6px; }

/* ---------- Node detail (expandable rows) ---------- */
.col-toggle, td.toggle { width: 1%; padding-right: 0; }
th.col-toggle { padding-top: 6px; padding-bottom: 6px; }
tr.node { cursor: pointer; }
.disclose {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: -2px 0;
  border: 0; border-radius: 6px; background: none; color: var(--muted-foreground); cursor: pointer;
}
.disclose:hover:not(:disabled) { color: var(--foreground); background: color-mix(in srgb, var(--muted) 70%, transparent); }
.disclose:disabled { opacity: .4; cursor: default; }
.disclose .i-sm { transition: transform .15s ease-out; }
.disclose[aria-expanded="true"] .i-sm { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .disclose .i-sm { transition: none; } }
tr.node.open, tr.node.open + tr.detail-row { background: color-mix(in srgb, var(--muted) 30%, transparent); }
tbody tr.detail-row td { border-top: 0; padding: 0 16px 16px 56px; cursor: auto; }
tbody tr.detail-row:hover { background: color-mix(in srgb, var(--muted) 30%, transparent); }
.detail {
  display: flex; flex-direction: column; gap: 14px; padding: 14px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card);
  /* when the table scrolls sideways (phones), the panel stays in view at the card's width */
  position: sticky; left: 10px; max-width: calc(100cqw - 20px); box-sizing: border-box;
}
.detail-h { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); margin-bottom: 6px; }
/* at most two columns, so the eye doesn't zig-zag across a wide screen */
.props { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(min(100%, 320px), calc(50% - 12px)), 1fr)); gap: 4px 24px; margin: 0; }
.prop.wide { grid-column: 1 / -1; }
.prop { display: grid; grid-template-columns: minmax(5em, 8em) 1fr auto; gap: 12px; align-items: baseline; min-width: 0; }
.prop dt { font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground); overflow-wrap: anywhere; }
.prop dt[title] { text-decoration: underline dotted color-mix(in srgb, var(--muted-foreground) 50%, transparent); text-underline-offset: 3px; cursor: help; }
.prop dd { margin: 0; display: flex; flex-wrap: wrap; gap: 2px 10px; min-width: 0; }
.prop dd.long { flex-direction: column; align-items: flex-start; }
.prop dd.long > .pv { white-space: pre-wrap; }
.prop dd.clamp > .pv { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.more { font-size: 12px; color: var(--muted-foreground); }
.tools { display: flex; gap: 2px; align-self: center; }
.copy, .filter {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; align-self: center;
  border: 0; border-radius: 6px; background: none; color: var(--muted-foreground); cursor: pointer; opacity: 0;
}
.prop:hover :is(.copy, .filter), .copy:focus-visible, .filter:focus-visible, .filter[aria-expanded=true] { opacity: 1; }
:is(.copy, .filter):hover { color: var(--foreground); background: color-mix(in srgb, var(--muted) 70%, transparent); }
@media (hover: none) { .copy, .filter { opacity: .6; } }
.prop.computed dt, .prop.computed .pv { opacity: .7; }
.prop.is-unset dt { opacity: .7; }
.prop.changed dt { color: var(--foreground); }
.dot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--amber-500, #f59e0b); vertical-align: middle; }
.derived { margin-top: 10px; }
.detail-sub { font-size: 11px; font-weight: 500; color: var(--muted-foreground); margin-bottom: 4px; }
.props.unset { margin-top: 6px; }
.rel { color: var(--muted-foreground); font-size: 12px; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; gap: 6px; }
a.btn { text-decoration: none; color: inherit; }
.btn-sm .count { font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.branch-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.branch-changes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.branch-changes li { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; display: flex; gap: 8px; }
.branch-changes .add { color: var(--green-text); }
.branch-changes .del { color: var(--red-text); }
.branch-changes .sign { width: 1ch; flex: none; }
.pv { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; text-align: left; }
.nowrap { white-space: nowrap; }
.link {
  border: 0; background: none; padding: 0; color: var(--foreground); cursor: pointer;
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--muted-foreground) 45%, transparent); text-underline-offset: 3px;
}
.link:hover { text-decoration-color: currentColor; }
.edges { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.edges li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-width: 0; }
.preview { font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground); overflow-wrap: anywhere; }
.edge { font-family: var(--font-mono); font-size: 12px; display: inline-flex; align-items: baseline; gap: 6px; }
.edge .count { font-size: 11px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

/* ---------- Dialog ---------- */
.dialog {
  width: min(560px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--foreground); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.dialog[open] { animation: slide-in .2s ease-out; }
.dialog-head h3 { font-size: 18px; line-height: 28px; font-weight: 600; }
.dialog-head p { margin-top: 4px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.md-nodes { list-style: none; margin: 0; padding: 8px 12px; max-height: 40vh; overflow: auto; border: 1px solid var(--border); border-radius: 6px; display: flex; flex-direction: column; gap: 4px; }
.md-nodes li { display: flex; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Toasts (bottom-centre: clear of the query, the page heading and the row actions on the right) ---------- */
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: 14px; animation: slide-in .2s ease-out;
}
.toast .i { margin-top: 2px; }
.toast.ok .i { color: var(--green-text); }
.toast.err { border-color: color-mix(in srgb, var(--red-500) 25%, transparent); }
.toast.err .i { color: var(--red-text); }
.toast-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { border: 0; background: none; color: var(--muted-foreground); cursor: pointer; padding: 0; }

/* ---------- Tooltip (sidebar items) ---------- */
.tip {
  position: fixed; z-index: 60; max-width: 260px; padding: 6px 10px; border-radius: 6px;
  background: var(--neutral-900); color: var(--neutral-50); font-size: 12px; line-height: 16px;
  box-shadow: var(--shadow-lg); pointer-events: none;
}

@keyframes slide-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Narrow screens ---------- */
/* ---------- graph branches ---------- */
.page[hidden] { display: none; }
/* the page scrolls as a whole; don't let the tall review card squash the branch table */
#page-branches > * { flex-shrink: 0; }
.btn-outline.danger { color: var(--red-text); }
.btn-outline.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--red-500) 10%, transparent); }
.review { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.review-head h3 { font-size: 18px; line-height: 28px; font-weight: 600; }
.ran { display: flex; gap: 8px; align-items: baseline; color: var(--muted-foreground); }
.ran code { font-family: var(--font-mono); color: var(--foreground); overflow-wrap: anywhere; }
.changes { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.changes > li { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.change-node { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.change-node code { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.change-list { list-style: none; padding: 0; margin: 6px 0 0 4px; display: flex; flex-direction: column; gap: 2px; }
.change-list li { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.change-list .add { color: var(--green-text); }
.change-list .del { color: var(--red-text); }
.branch-name { font-weight: 500; }
.branch-desc { display: block; color: var(--muted-foreground); font-size: 12px; }
.pkg-toggle .i-sm { transition: transform .15s ease-out; }
.pkg-toggle[aria-expanded="true"] .i-sm { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .pkg-toggle .i-sm { transition: none; } }
tbody tr.pkg-detail-row td { border-top: 0; padding: 0 16px 16px; }
.pkg-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pkg-forms { display: flex; flex-wrap: wrap; gap: 4px; }
.text-red { color: var(--red-text); }
.vault-edit { height: 28px; padding: 0 10px; font-size: 12px; }
.pkg-cmds { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: max-content 1fr auto; gap: 6px 16px; align-items: baseline; }
.pkg-cmds li { display: contents; }
.pkg-cmds .link { justify-self: start; }
/* permission and module names are long: give them a wider label column than node props get */
.pkg-detail .prop { grid-template-columns: minmax(8em, 16em) 1fr auto; }
@media (max-width: 640px) {
  .col-meta { display: none; }      /* version and source repeat in the details panel */
  .pkg-detail .prop { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pkg-cmds { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .pkg-cmds li > span:last-child { margin-bottom: 6px; }
}

/* Below 1100px the sidebar folds to icons by itself: the table needs the room more than the labels */
@media (max-width: 1100px) {
  .sidebar { width: 80px; }
  .sb-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sb-logo, .sb-item, .sb-where { justify-content: center; padding: 0; }
  .sb-toggle { display: none; }
}
@media (max-width: 900px) {
  .query-tools { position: static; justify-content: flex-end; margin: -4px 0 -4px; order: -1; }
  .query-card textarea { padding-right: 10px; }
}

@media (max-width: 720px) {
  .shell { padding: 8px; gap: 8px; }
  .sidebar { width: 64px; padding: 12px 8px; }
  .page { padding: 8px; }
  .grid-2 { grid-template-columns: 1fr; }
  td, th { padding-left: 10px; padding-right: 10px; }
  .col-edited { display: none; }
  tbody tr.detail-row td { padding: 0 10px 12px; }
  .detail { padding: 12px; }
  .prop { grid-template-columns: 1fr auto; gap: 0 8px; padding-bottom: 6px; }
  .prop dt { grid-column: 1; }
  .prop dd { grid-column: 1; }
  .prop .tools { grid-column: 2; grid-row: 1 / span 2; }
  .branch-badge { margin-left: 0; }
}

/* ---------- Tags page ---------- */
#page-tags > * { flex-shrink: 0; }
.tags-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px; }
.tags-bar select { min-width: 160px; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.search .i-sm { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); }
.search input { width: 100%; padding-left: 32px; }
.tags-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.tag-tree-card { padding: 8px; max-height: calc(100vh - 260px); overflow: auto; }
.tag-tree, .tag-tree ul { list-style: none; margin: 0; padding: 0; }
.tag-tree li.empty { padding: 24px; text-align: center; color: var(--muted-foreground); }
.tag-row {
  display: flex; align-items: center; gap: 6px; min-height: 32px; border-radius: 6px;
  padding: 2px 8px 2px calc(4px + var(--depth, 0) * 18px);
}
.tag-row:hover { background: color-mix(in srgb, var(--muted) 50%, transparent); }
[aria-selected="true"] > .tag-row { background: color-mix(in srgb, var(--muted) 90%, transparent); }
.disclose-gap { width: 24px; flex: none; }
.tag-row .disclose[aria-expanded="true"] .i-sm { transform: rotate(90deg); }
.tag-main {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; border: 0; background: none;
  padding: 4px 0; text-align: left; cursor: pointer; color: var(--foreground);
}
.tag-base { font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.tag-icon { align-self: center; color: var(--muted-foreground); }
.tag-main:hover .tag-icon, [aria-selected="true"] > .tag-row .tag-icon { color: var(--foreground); }
.tag-title { font-size: 13px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-main.untitled .tag-base { color: var(--muted-foreground); }
.tag-row .count { font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.tag-row .chip { font-size: 11px; }
.lock { display: inline-flex; color: var(--muted-foreground); }
.tag-editor { padding: 16px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
.te-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.te-name { font-family: var(--font-mono); font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.te-badges { display: flex; gap: 6px; }
.te-badges .chip { display: inline-flex; align-items: center; gap: 4px; }
.te-derived .prop { grid-template-columns: minmax(5em, 8em) 1fr; }
.te-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tag-editor textarea { font-family: inherit; font-size: 14px; }
.te-derived { margin-top: 4px; }
@media (max-width: 900px) {
  .tags-layout { grid-template-columns: 1fr; }
  .tag-tree-card { max-height: 50vh; }
  .tag-editor { position: static; }
}

/* ---------- TOON export ---------- */
.dialog-wide { width: min(880px, calc(100vw - 32px)); }
.toon-out {
  margin: 0; padding: 12px; max-height: min(60vh, 560px); overflow: auto; border-radius: 6px;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--muted) 50%, transparent);
  font-size: 12px; line-height: 18px; white-space: pre;
}
.toon-warn { color: var(--red-text); }
.pkg-docs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; align-items: baseline; }
.pkg-docs li { display: contents; }
.pkg-docs .link { justify-self: start; }

/* a Power-Up doc, rendered from Markdown (renderMarkdown in app.js) */
.md-doc {
  max-height: min(65vh, 640px); overflow: auto; padding: 4px 16px 4px 0;
  font-size: 14px; line-height: 22px; overflow-wrap: anywhere;
}
.md-doc > :first-child { margin-top: 0; }
.md-doc h1, .md-doc h2, .md-doc h3, .md-doc h4, .md-doc h5, .md-doc h6 { font-weight: 600; margin: 20px 0 8px; }
.md-doc h1 { font-size: 20px; line-height: 28px; }
.md-doc h2 { font-size: 17px; line-height: 24px; }
.md-doc h3 { font-size: 15px; line-height: 22px; }
.md-doc h4, .md-doc h5, .md-doc h6 { font-size: 14px; }
.md-doc p, .md-doc ul, .md-doc ol, .md-doc blockquote, .md-doc .md-table, .md-doc .md-code { margin: 0 0 12px; }
.md-doc ul, .md-doc ol { padding-left: 20px; }
.md-doc blockquote { padding-left: 12px; border-left: 3px solid var(--border); color: var(--muted-foreground); }
.md-doc code { font-family: var(--font-mono); font-size: 12px; padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--muted) 60%, transparent); }
.md-doc .md-code {
  padding: 12px; overflow: auto; border-radius: 6px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 50%, transparent); font-size: 12px; line-height: 18px; white-space: pre;
}
.md-doc .md-code code { padding: 0; background: none; }
.md-doc .md-table { overflow: auto; border: 1px solid var(--border); border-radius: 6px; }
.md-doc th, .md-doc td { padding: 6px 10px; font-size: 13px; text-align: left; border-top: 1px solid var(--border); }
.md-doc a { color: var(--foreground); text-underline-offset: 3px; }
.md-doc .link { font: inherit; }

/* ---------- Settings ---------- */
.settings-card { padding: 16px; max-width: 760px; }
.settings-card + .settings-card { margin-top: 16px; }
.settings-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.settings-card > p + p, .settings-card > ol + p { margin-top: 12px; }
.settings-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.settings-facts dt { color: var(--muted-foreground); }
.settings-steps { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; font-size: 14px; line-height: 20px; }
.settings-code { position: relative; margin: 6px 0; }
.settings-code > :is(code, pre) {
  display: block; padding: 10px 36px 10px 12px; border-radius: 6px; border: 1px solid var(--border); font-size: 13px;
  background: color-mix(in srgb, var(--muted) 50%, transparent); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0;
}
.settings-code .copy { position: absolute; top: 6px; right: 6px; opacity: 1; }

/* ---------- Users ---------- */
.key-out {
  display: block; padding: 12px; border-radius: 6px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 50%, transparent); font-size: 13px; word-break: break-all; user-select: all;
}
.user-actions, .pkg-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.perm-roles { display: inline-flex; gap: 12px; }
.perm-roles label { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Storm examples drawer ---------- */
.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(460px, 100%); max-width: none;
  height: 100%; max-height: none; overflow-y: auto; border-radius: 0; border-width: 0 0 0 1px;
}
.drawer[open] { animation: drawer-in .2s ease-out; }
@keyframes drawer-in { from { transform: translateX(1rem); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer[open] { animation: none; } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; }
.drawer-head > div { flex: 1; }
.ex-group + .ex-group { margin-top: 20px; }
.ex-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ex-group-head h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); }
.ex-group-head a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.ex-list { list-style: none; margin: 0; padding: 0; }
.ex { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.ex-title { font-size: 14px; }
.ex-edit { margin-left: 6px; font-size: 11px; color: var(--amber-text); }
.ex code { grid-column: 1; font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground); overflow-wrap: anywhere; }
.ex .btn { grid-column: 2; grid-row: 1 / span 2; }
/* Power-Ups drawer: a dense picker, one row per command */
#pu-filter { width: 100%; }
.pu-drawer .drawer-head h3 { flex: 1; }
.pu-pkg + .pu-pkg { margin-top: 16px; }
.pu-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--muted-foreground); }
.pu-nokey { font-size: 11px; font-weight: 500; color: var(--amber-text); }
.pu-list { list-style: none; margin: 0; padding: 0; }
.pu-cmd { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 5px 8px; border: 0; border-radius: 6px; background: none; color: var(--foreground); text-align: left; cursor: pointer; }
.pu-cmd:hover:not(:disabled), .pu-cmd:focus-visible { background: var(--muted); outline: none; }
.pu-cmd:disabled { opacity: .45; cursor: not-allowed; }
.pu-cmd code { padding: 2px 0 0; font-family: var(--font-mono); font-size: 13px; background: none; }
.pu-forms { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-left: auto; }
.pu-run { flex: none; margin-top: 4px; color: var(--muted-foreground); }
.pu-cmd:hover:not(:disabled) .pu-run, .pu-cmd:focus-visible .pu-run { color: var(--green-text); }
.pu-form { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); white-space: nowrap; }
.pu-noinput { border-style: dashed; font-family: inherit; font-style: italic; }
.pu-legend { display: flex; justify-content: space-between; padding: 0 8px 6px; margin-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); }
.pu-legend span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Keyboard keys (vim-style) ---------- */
.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;
}
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 5px; border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; background: var(--muted); color: var(--foreground); font-size: 12px; line-height: 18px; text-align: center;
}
/* The keyboard's row: the theme's green, no outline (a ring on a table row clips against its borders).
   Focused: a stronger tint and a full bar; focus elsewhere (the query bar, a dialog): a softer one. */
tr.node:focus, tr.node:focus-visible { outline: none; box-shadow: none; }
tr.node.kb-active { background: color-mix(in srgb, var(--primary) 7%, transparent); }
tr.node.kb-active > td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--primary) 45%, transparent); }
tr.node.kb-active:focus { background: color-mix(in srgb, var(--primary) 15%, transparent); }
tr.node.kb-active:focus > td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.keys-switches { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; }
.keys-switches label { display: inline-flex; align-items: center; gap: 6px; }
.keys-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 16px 24px; max-height: 60vh; overflow: auto; }
.keys-group h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); margin-bottom: 6px; }
.keys-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.keys-table td { padding: 4px 0; vertical-align: top; border: 0; }
.keys-table td.keys-keys { width: 9.5em; padding-right: 12px; white-space: nowrap; color: var(--muted-foreground); }

/* ---------- Step through ---------- */
.steps-card { flex: none; padding: 16px; overflow-x: auto; }
.steps-head { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; margin-bottom: 8px; }
.steps-head h3 { font-size: 16px; font-weight: 600; }
.steps-head p { grid-column: 1; }
.steps-head .btn { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
.steps-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.steps-table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted-foreground); padding: 6px 8px; }
.steps-table td { padding: 6px 8px; border-top: 1px solid var(--border); vertical-align: middle; }
.steps-table code { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.steps-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#steps-note:not(:empty) { margin-top: 8px; }
#steps-restore { margin-top: 8px; }
@media (max-width: 640px) {
  .steps-table .step-n { display: none; }     /* the order is plain; room for the operation */
}
