/* Layout: shell (rail, sticky topbar with game + environment, working column); the config page adds a config list column, the editor, and an inspector that docks right on wide screens and becomes a drawer or phone sheet otherwise */
:root {
	--h: 266;
	--c: 0.17;
	--paper: oklch(0.972 0.006 var(--h));
	--sheet: oklch(0.996 0.002 var(--h));
	--sunk: oklch(0.953 0.009 var(--h));
	--hover: oklch(0.942 0.014 var(--h));
	--ink: oklch(0.24 0.03 var(--h));
	--ink-2: oklch(0.44 0.03 var(--h));
	--ink-3: oklch(0.56 0.025 var(--h));
	--rule: oklch(0.905 0.012 var(--h));
	--rule-strong: oklch(0.82 0.018 var(--h));
	--accent: oklch(0.48 var(--c) var(--h));
	--accent-hi: oklch(0.41 var(--c) var(--h));
	--accent-ink: oklch(0.99 0.004 var(--h));
	--accent-soft: oklch(0.945 calc(var(--c) * 0.22) var(--h));
	--accent-line: oklch(0.8 calc(var(--c) * 0.5) var(--h));
	--ring: oklch(0.6 var(--c) var(--h) / 0.22);
	--chart: oklch(0.58 calc(var(--c) * 0.85) var(--h));
	--staged: #8f4c00;
	--staged-soft: #fdf0d6;
	--staged-line: #e9b65f;
	--good: #17744a;
	--good-soft: #def2e6;
	--bad: #b0261d;
	--bad-soft: #fae2df;
	--live: #b43c08;
	--live-soft: #fde6da;
	--moved: #1f5fa8;
	--moved-soft: #e1ecfa;
	--ai: #6b3fb8;
	--ai-soft: #efe8fb;
	--ai-line: #cfbaf0;
	--av-l: 0.87;
	--av-c: 0.07;
	--av-ink: 0.34;
	--scrim: oklch(0.2 0.03 var(--h) / 0.36);
	--shadow-sm: 0 1px 2px oklch(0.2 0.03 var(--h) / 0.08);
	--shadow: 0 1px 2px oklch(0.2 0.03 var(--h) / 0.06), 0 14px 34px oklch(0.2 0.03 var(--h) / 0.15);
	--code-key: oklch(0.42 0.12 var(--h));
	--code-str: #17744a;
	--code-num: #a3480a;
	--code-lit: #8a2a8a;
	--f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
	--f-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
	--f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
	--radius: 12px;
	--rail: 236px;
	--gut: clamp(16px, 1.8vw, 28px);
	--nav-h: 64px;
	--bnav-h: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
	--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	--spring: cubic-bezier(0.34, 1.5, 0.64, 1);
	--brand: #6D4AFF;
	--brand-ink: #FBFAFF;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--paper: oklch(0.165 0.012 var(--h));
		--sheet: oklch(0.215 0.015 var(--h));
		--sunk: oklch(0.255 0.017 var(--h));
		--hover: oklch(0.285 0.022 var(--h));
		--ink: oklch(0.97 0.006 var(--h));
		--ink-2: oklch(0.87 0.016 var(--h));
		--ink-3: oklch(0.76 0.02 var(--h));
		--rule: oklch(0.35 0.018 var(--h));
		--rule-strong: oklch(0.48 0.022 var(--h));
		--accent: oklch(0.78 calc(var(--c) * 0.7) var(--h));
		--accent-hi: oklch(0.85 calc(var(--c) * 0.6) var(--h));
		--accent-ink: oklch(0.19 0.04 var(--h));
		--accent-soft: oklch(0.34 calc(var(--c) * 0.4) var(--h));
		--accent-line: oklch(0.58 calc(var(--c) * 0.6) var(--h));
		--ring: oklch(0.78 var(--c) var(--h) / 0.22);
		--chart: oklch(0.72 calc(var(--c) * 0.7) var(--h));
		--staged: #f2b85e;
		--staged-soft: #33260d;
		--staged-line: #7a5517;
		--good: #63cf96;
		--good-soft: #132f21;
		--bad: #ff8b80;
		--bad-soft: #3a1714;
		--live: #ff9b5e;
		--live-soft: #3a1f11;
		--moved: #8ab8f5;
		--moved-soft: #142640;
	--ai: #c4a8f6;
	--ai-soft: #2a2040;
	--ai-line: #4f3b78;
		--av-l: 0.46;
		--av-c: 0.08;
		--av-ink: 0.93;
		--scrim: oklch(0 0 0 / 0.55);
		--shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4);
		--shadow: 0 1px 2px oklch(0 0 0 / 0.4), 0 14px 34px oklch(0 0 0 / 0.5);
		--code-key: oklch(0.8 0.09 var(--h));
		--code-str: #7fd6a4;
		--code-num: #f5ad74;
		--code-lit: #e09be0;
		color-scheme: dark;
	}
}
:root[data-theme="dark"], :root[data-theme="midnight"] {
	--paper: oklch(0.165 0.012 var(--h));
	--sheet: oklch(0.215 0.015 var(--h));
	--sunk: oklch(0.255 0.017 var(--h));
	--hover: oklch(0.285 0.022 var(--h));
	--ink: oklch(0.97 0.006 var(--h));
	--ink-2: oklch(0.87 0.016 var(--h));
	--ink-3: oklch(0.76 0.02 var(--h));
	--rule: oklch(0.35 0.018 var(--h));
	--rule-strong: oklch(0.48 0.022 var(--h));
	--accent: oklch(0.78 calc(var(--c) * 0.7) var(--h));
	--accent-hi: oklch(0.85 calc(var(--c) * 0.6) var(--h));
	--accent-ink: oklch(0.19 0.04 var(--h));
	--accent-soft: oklch(0.34 calc(var(--c) * 0.4) var(--h));
	--accent-line: oklch(0.58 calc(var(--c) * 0.6) var(--h));
	--ring: oklch(0.78 var(--c) var(--h) / 0.22);
	--chart: oklch(0.72 calc(var(--c) * 0.7) var(--h));
	--staged: #f2b85e;
	--staged-soft: #33260d;
	--staged-line: #7a5517;
	--good: #63cf96;
	--good-soft: #132f21;
	--bad: #ff8b80;
	--bad-soft: #3a1714;
	--live: #ff9b5e;
	--live-soft: #3a1f11;
	--moved: #8ab8f5;
	--moved-soft: #142640;
	--ai: #c4a8f6;
	--ai-soft: #2a2040;
	--ai-line: #4f3b78;
	--av-l: 0.46;
	--av-c: 0.08;
	--av-ink: 0.93;
	--scrim: oklch(0 0 0 / 0.55);
	--shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4);
	--shadow: 0 1px 2px oklch(0 0 0 / 0.4), 0 14px 34px oklch(0 0 0 / 0.5);
	--code-key: oklch(0.8 0.09 var(--h));
	--code-str: #7fd6a4;
	--code-num: #f5ad74;
	--code-lit: #e09be0;
	color-scheme: dark;
}
:root[data-theme="midnight"] {
	--paper: oklch(0 0 0);
	--sheet: oklch(0.17 0.01 var(--h));
	--sunk: oklch(0.215 0.013 var(--h));
	--hover: oklch(0.25 0.016 var(--h));
	--ink: oklch(0.985 0.004 var(--h));
	--ink-2: oklch(0.9 0.012 var(--h));
	--ink-3: oklch(0.8 0.016 var(--h));
	--rule: oklch(0.37 0.016 var(--h));
	--rule-strong: oklch(0.54 0.02 var(--h));
	--accent: oklch(0.81 calc(var(--c) * 0.72) var(--h));
	--accent-soft: oklch(0.32 calc(var(--c) * 0.45) var(--h));
	--accent-line: oklch(0.62 calc(var(--c) * 0.62) var(--h));
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
	margin: 0; background: var(--paper); color: var(--ink);
	font-family: var(--f-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 650; line-height: 1.12; }
h2 { font-size: 1.08rem; font-weight: 620; }
h3 { font-size: 1rem; font-weight: 620; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--f-mono); font-size: 0.86em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 0.84rem; }
.grow { flex: 1; min-width: 0; }
.eyebrow { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
.i.tiny { width: 14px; height: 14px; }
.short { display: none; }

/* Shell */

.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100%; }
:root:has(.app.mini) { --rail: 68px; }
.side {
	background: var(--sheet); border-right: 1px solid var(--rule); padding: 14px 12px; padding-left: max(12px, env(safe-area-inset-left, 0px));
	display: flex; flex-direction: column; gap: 14px;
	position: sticky; top: 0; align-self: start; height: 100dvh; overflow-y: auto; overflow-x: hidden;
}
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 4px 6px; margin: -4px -2px; min-width: 0; border: 0; border-radius: 9px; background: none; cursor: pointer; transition: background 0.15s, transform 0.15s var(--ease); }
.brand:hover { background: var(--hover); }
.brand:active { transform: scale(0.97); }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; transition: background 0.3s; }
.brand-name { font-family: var(--f-display); font-weight: 650; font-size: 1.04rem; line-height: 1.1; }
.rail-tog { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--ink-3); cursor: pointer; transition: background 0.15s, color 0.15s; }
.rail-tog:hover { background: var(--hover); color: var(--ink); }
.rail-tog .i { width: 18px; height: 18px; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > .eyebrow { padding: 0 4px; }
.select { position: relative; display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
.select select {
	appearance: none; -webkit-appearance: none; width: 100%; height: 36px; padding: 0 32px 0 12px;
	border-radius: 9px; border: 1px solid var(--rule-strong); background: var(--sheet);
	font-weight: 650; font-size: 0.9rem; cursor: pointer; text-overflow: ellipsis;
}
.select select:hover { border-color: var(--ink-3); }
.select > .i { position: absolute; right: 10px; width: 16px; height: 16px; pointer-events: none; color: var(--ink-3); }

.switcher {
	display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; padding: 7px 8px; border-radius: 10px;
	border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink); text-align: left; cursor: pointer;
	transition: border-color 0.15s, background 0.15s;
}
.switcher:hover { border-color: var(--ink-3); background: var(--hover); }
.switcher .sw-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.switcher b { font-weight: 700; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher small { font-size: 0.74rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher > .i { width: 16px; height: 16px; flex: none; color: var(--ink-3); }
.topbar .switcher.game { width: auto; max-width: 260px; padding: 4px 8px 4px 5px; gap: 8px; }
.obadge {
	--s: 28px; width: var(--s); height: var(--s); flex: none; display: grid; place-items: center; border-radius: 8px;
	background: oklch(var(--av-l) var(--av-c) var(--ah, 260)); color: oklch(var(--av-ink) 0.07 var(--ah, 260));
	font-family: var(--f-display); font-weight: 700; font-size: 0.72rem; letter-spacing: 0.02em;
}
.obadge.game { --s: 26px; border-radius: 50%; font-size: 0.66rem; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-h { padding: 14px 10px 4px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.nav-h:first-child { padding-top: 0; }
.nav a {
	position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; text-decoration: none; white-space: nowrap;
	color: var(--ink-2); font-weight: 650; transition: background 0.15s, color 0.15s; cursor: pointer;
}
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav a .chip { margin-left: auto; }
.nav a .chip + .chip { margin-left: 0; }
.nav-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 0.86rem; }
.who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.who .grow { min-width: 0; }
.who .name { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { display: block; color: var(--ink-3); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who { width: 100%; padding: 6px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; cursor: pointer; transition: background 0.15s; }
.side-foot .who:hover { background: var(--hover); }
.side-foot .who > .i { width: 18px; height: 18px; flex: none; color: var(--ink-3); }

.app.mini .brand-word, .app.mini .sw-text, .app.mini .switcher > .i, .app.mini .nav-l, .app.mini .nav a .chip, .app.mini .side-foot .who .grow, .app.mini .side-foot .who > .i { display: none; }
.app.mini .side { padding-inline: 10px; align-items: stretch; }
.app.mini .side-top { flex-direction: column; gap: 8px; }
.app.mini .brand { padding: 0; }
.app.mini .switcher { justify-content: center; padding: 6px 0; border-color: transparent; background: none; }
.app.mini .switcher:hover { background: var(--hover); }
.app.mini .nav a { justify-content: center; padding: 10px 0; }
.app.mini .nav-h { height: 1px; padding: 0; margin: 10px 8px; background: var(--rule); font-size: 0; }
.app.mini .nav-h:first-child { display: none; }
.app.mini .nav a:has(.chip.staged)::after { content: ""; position: absolute; top: 7px; right: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--staged); }
.app.mini .side-foot .who { justify-content: center; padding: 6px 0; }

.pop.switch-pop { width: 290px; }
.switch-list { display: flex; flex-direction: column; gap: 2px; max-height: min(360px, 60dvh); overflow-y: auto; }
.switch-menu .grow { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-menu .grow small { margin-left: 0; }
.switch-menu button[aria-checked="true"] { background: var(--accent-soft); }
.switch-menu button[aria-checked="true"] > .i { color: var(--accent); }
.switch-create { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); }
.switch-menu .switch-create button { justify-content: center; border: 1px dashed var(--accent-line); color: var(--accent); }
.switch-menu .switch-create button .i { color: var(--accent); }
.switch-menu .switch-create button:hover { background: var(--accent-soft); }

.drawer-body.settings { gap: 0; }
.set-sec { display: flex; flex-direction: column; gap: 14px; padding: 18px 0; border-top: 1px solid var(--rule); }
.set-sec:first-child { padding-top: 0; border-top: 0; }
.set-sec h3 { font-size: 0.98rem; }
.set-who { display: flex; align-items: center; gap: 12px; }
.set-who .grow { display: flex; flex-direction: column; min-width: 0; }
.set-who small { color: var(--ink-3); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-open small { display: block; color: var(--ink-3); font-size: 0.8rem; }
.set-open .seg { align-self: flex-start; }

.avatar {
	--s: 34px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
	background: oklch(var(--av-l) var(--av-c) var(--ah, 260)); color: oklch(var(--av-ink) 0.07 var(--ah, 260));
	font-family: var(--f-display); font-weight: 700; font-size: calc(var(--s) * 0.38);
}
.faces { display: inline-flex; align-items: center; }
.faces .avatar { --s: 26px; box-shadow: 0 0 0 2px var(--paper); margin-left: -6px; }
.faces .avatar:first-child { margin-left: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
	position: sticky; top: 0; z-index: 12; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
	padding: 10px max(var(--gut), env(safe-area-inset-right, 0px)) 10px var(--gut); min-height: 58px; border-bottom: 1px solid var(--rule);
	background: color-mix(in oklch, var(--paper) 88%, transparent); backdrop-filter: blur(10px);
}
.topbar .mbrand { display: none; }
.status { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--ink-2); min-width: 0; }
.status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; animation: ping 2.4s var(--ease) infinite; }
.dot.warn { background: var(--staged); animation: none; box-shadow: 0 0 0 3px var(--staged-soft); }

.page { padding-block: 22px 140px; padding-left: var(--gut); padding-right: max(var(--gut), env(safe-area-inset-right, 0px)); max-width: 1180px; width: 100%; margin-inline: auto; display: flex; flex-direction: column; gap: 18px; }
.page.wide { max-width: none; }
.page-head { display: flex; flex-direction: column; gap: 4px; }
.page-head.row-head { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.route { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.page.enter .route > *:not(.stagger), .page.enter .route > .stagger > * { animation: rise 0.42s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }

/* Controls */

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 14px;
	border-radius: 9px; border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink);
	font-weight: 650; font-size: 0.9rem; cursor: pointer; white-space: nowrap; text-decoration: none; position: relative; overflow: hidden;
	transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.18s var(--spring);
}
.btn:hover { background: var(--hover); }
.btn:active:not([disabled]) { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.live { background: var(--live); border-color: var(--live); color: var(--sheet); }
.btn.live:hover { background: color-mix(in oklch, var(--live) 86%, var(--ink)); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 0.84rem; }
.btn.icon { padding: 0; width: 36px; }
.btn.small.icon { width: 30px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn .i { width: 16px; height: 16px; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-size: inherit; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
kbd { font-family: var(--f-mono); font-size: 0.74rem; line-height: 1; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--rule-strong); border-bottom-width: 2px; color: var(--ink-3); background: var(--paper); }

.seg { position: relative; display: inline-flex; padding: 3px; border-radius: 10px; background: var(--sunk); border: 1px solid var(--rule); isolation: isolate; flex: none; max-width: 100%; }
.seg > button {
	position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 12px; border: 0; border-radius: 7px;
	background: none; font-weight: 650; font-size: 0.86rem; color: var(--ink-2); cursor: pointer; transition: color 0.2s; white-space: nowrap;
}
.seg > button:hover { color: var(--ink); }
.seg > button[aria-pressed="true"] { color: var(--ink); }
.seg > button .i { width: 15px; height: 15px; }
.seg > .thumb {
	position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 7px;
	background: var(--sheet); box-shadow: 0 0 0 1px var(--rule-strong), var(--shadow-sm);
	transition: transform 0.32s var(--ease), width 0.32s var(--ease), background 0.3s;
}
.seg.live > .thumb { background: var(--live-soft); box-shadow: 0 0 0 1px color-mix(in oklch, var(--live) 35%, transparent); }
.seg.live > button[aria-pressed="true"] { color: var(--live); }
.seg.small > button { padding: 3px 10px; font-size: 0.8rem; }

.switch {
	position: relative; width: 44px; height: 26px; flex: none; border-radius: 99px; border: 0; padding: 0;
	background: var(--rule-strong); cursor: pointer; transition: background 0.25s;
}
.switch::after {
	content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
	background: var(--sheet); box-shadow: var(--shadow-sm); transition: transform 0.32s var(--spring);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.switch.mini { width: 34px; height: 20px; }
.switch.mini::after { width: 14px; height: 14px; }
.switch.mini[aria-checked="true"]::after { transform: translateX(14px); }

.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 1px 9px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; background: var(--sunk); color: var(--ink-2); }
.chip .i { width: 12px; height: 12px; }
.chip.ok { background: var(--good-soft); color: var(--good); }
.chip.staged { background: var(--staged-soft); color: var(--staged); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--accent-soft); color: var(--accent); }
.chip.live { background: var(--live-soft); color: var(--live); }
.chip.moved { background: var(--moved-soft); color: var(--moved); }
.chip.mono { font-family: var(--f-mono); font-weight: 500; }

.tip {
	position: fixed; left: 0; top: 0; z-index: 100; max-width: 280px; padding: 7px 10px; border-radius: 8px;
	background: var(--ink); color: var(--paper); font-size: 0.78rem; font-weight: 500; line-height: 1.35; font-family: var(--f-body);
	box-shadow: var(--shadow); pointer-events: none; opacity: 0; transition: opacity 0.12s; overflow-wrap: anywhere;
}
.tip.show { opacity: 1; }

.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-start; justify-content: space-between; padding: 14px 16px 12px; }
.card-head .titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-head .sub { font-size: 0.84rem; color: var(--ink-3); }
.card-body { padding: 0 16px 16px; }
.card-foot { padding: 10px 16px 12px; border-top: 1px solid var(--rule); }
.notice { display: flex; gap: 12px; align-items: center; border-radius: var(--radius); padding: 12px 14px; flex-wrap: wrap; animation: rise 0.3s var(--ease) both; }
.notice.info { background: var(--accent-soft); border: 1px solid var(--accent-line); }
.notice.warn { background: var(--staged-soft); border: 1px solid var(--staged-line); }
.notice.bad { background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.notice .grow { flex: 1 1 260px; min-width: 0; }
.notice > .i { color: var(--accent); }
.notice.warn > .i { color: var(--staged); }
.notice.bad > .i { color: var(--bad); }
.empty { padding: 26px 16px; color: var(--ink-3); text-align: center; }

.table-wrap { overflow-x: auto; }
table.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.ledger th { text-align: left; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.ledger td { padding: 8px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.ledger tr:last-child td { border-bottom: 0; }
.path { display: block; font-family: var(--f-mono); font-size: 0.74rem; color: var(--ink-3); font-weight: 400; }
select.inline { border: 1px solid var(--rule-strong); border-radius: 7px; padding: 4px 8px; background: var(--sheet); font-weight: 650; }

.copy {
	display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 2px 6px; margin: -2px -6px;
	border-radius: 6px; color: var(--ink-3); cursor: pointer; font-size: inherit;
}
.copy:hover { background: var(--hover); color: var(--accent); }
.copy .i { width: 14px; height: 14px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--rule-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; display: inline-block; }

/* Config workspace */

@property --insp-on { syntax: "<number>"; inherits: true; initial-value: 0; }
.cfg-shell {
	--split: 18px; display: grid; align-items: start; overflow-x: clip;
	grid-template-columns: var(--list-px) var(--split) minmax(0, 1fr) calc(var(--insp-on) * var(--split)) calc(var(--insp-on) * var(--insp-px));
	transition: --insp-on 0.38s var(--ease);
}
.cfg-shell.with-insp { --insp-on: 1; }
.split { align-self: stretch; position: relative; cursor: col-resize; touch-action: none; outline: 0; }
.split::before { content: ""; position: absolute; inset-block: 0; left: 50%; width: 2px; translate: -50% 0; border-radius: 99px; background: var(--rule-strong); opacity: 0; transition: opacity 0.15s, background 0.15s; }
.split:hover::before { opacity: 1; }
.split:focus-visible::before, .split.dragging::before { opacity: 1; background: var(--accent); }
.cfg-shell:not(.with-insp) > .split[data-split="insp"] { pointer-events: none; }
body.resizing { cursor: col-resize; user-select: none; }
.cfg-list { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100dvh - 96px); }
.cfg-list .card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cfg-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 8px 14px; }
.cfg-list-head h2 { font-size: 1rem; }
.mini-search { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--rule-strong); background: var(--paper); min-width: 0; transition: border-color 0.15s, box-shadow 0.2s; }
.mini-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.mini-search .i { width: 15px; height: 15px; color: var(--ink-3); }
.mini-search input { border: 0; outline: 0; background: transparent; width: 100%; min-width: 0; font-size: 0.88rem; }
.cfg-list .mini-search { margin: 0 12px 8px; }
.ctree { overflow-y: auto; padding: 0 6px 8px; display: flex; flex-direction: column; gap: 1px; --twist-w: 22px; --twist-gap: 2px; }
.ct {
	display: flex; align-items: center; gap: 7px; width: 100%; border: 0; background: none; text-align: left; cursor: pointer;
	padding: 6px 8px; border-radius: 8px; color: var(--ink-2); font-weight: 650; font-size: 0.88rem; transition: background 0.15s, color 0.15s;
}
.ct:hover { background: var(--hover); color: var(--ink); }
.ct[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.ct .i { width: 15px; height: 15px; color: var(--ink-3); }
.ct[aria-current="true"] .i { color: var(--accent); }
.ct-kids { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 4px 38px; padding-left: 3px; border-left: 1px solid var(--rule-strong); }
.ct.sub { padding-left: 5px; gap: 6px; font-weight: 500; font-size: 0.85rem; }
.ct .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.ct .chip { font-size: 0.66rem; padding: 0 7px; letter-spacing: 0.04em; }
.ct .cnt { font-size: 0.72rem; color: var(--ink-3); font-weight: 700; }
.cfg-list .foot { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--rule); }
.cfg-list .foot .btn { flex: 1; }

.ed { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ed-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.ed-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ed-title h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ed-title h1 .chip { font-family: var(--f-body); letter-spacing: 0.06em; font-size: 0.68rem; }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 0.86rem; color: var(--ink-3); }
.crumbs button { border: 0; background: none; padding: 2px 4px; border-radius: 6px; color: var(--ink-2); font-weight: 650; cursor: pointer; }
.crumbs button:hover { background: var(--hover); color: var(--accent); }
.crumbs .i { width: 14px; height: 14px; }
.ed-desc { color: var(--ink-3); font-size: 0.88rem; }
.ed-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 8px; border-radius: var(--radius); background: var(--sheet); border: 1px solid var(--rule); }
.toolbar .mini-search { flex: 1 1 150px; min-width: 120px; }
.toolbar .mini-search input { text-overflow: ellipsis; }
.toolbar.roomy .mini-search { max-width: 260px; }
.toolbar.roomy .tools { margin-left: auto; }
.toolbar.compact .tools .lbl { display: none; }
.toolbar.compact .tools .btn:has(.lbl) { padding-inline: 0; aspect-ratio: 1; }
.toolbar label.tog { display: inline-flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--ink-2); font-weight: 650; cursor: pointer; white-space: nowrap; }
.toolbar .sep { width: 1px; align-self: stretch; background: var(--rule); }

.editor-card { container: tree / inline-size; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); min-width: 0; overflow: hidden; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.78rem; color: var(--ink-3); align-items: center; padding: 8px 14px; border-top: 1px solid var(--rule); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Tree rows */

.trows { display: flex; flex-direction: column; padding: 6px 0; }
.tr {
	position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 6px;
	min-height: 44px; padding: 4px 10px 4px 6px; transition: background 0.18s;
}
.tr:hover { background: color-mix(in oklch, var(--hover) 60%, transparent); }
.tr.sel { background: var(--accent-soft); }
.tr.sel::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--accent-line); pointer-events: none; }
.tr::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; transform-origin: top; }
.tr.st-added::before { background: var(--good); animation: stripe 0.35s var(--ease) both; }
.tr.st-changed::before { background: var(--staged); animation: stripe 0.35s var(--ease) both; }
.tr.st-moved::before { background: var(--moved); animation: stripe 0.35s var(--ease) both; }
.tr.st-added { background: color-mix(in oklch, var(--good-soft) 70%, transparent); }
.tr.st-changed { background: color-mix(in oklch, var(--staged-soft) 75%, transparent); }
.tr.st-moved { background: color-mix(in oklch, var(--moved-soft) 70%, transparent); }
.tr.sel.st-changed, .tr.sel.st-added, .tr.sel.st-moved { background: var(--accent-soft); }
.tr.err { background: color-mix(in oklch, var(--bad-soft) 70%, transparent); }
.tr.hl { box-shadow: inset 0 0 0 2px var(--accent-line); }
.tr.flash { animation: flash 1.6s var(--ease); }
.tr.dragging { opacity: 0.45; }
.tr.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.tr.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.tr.enter-row { animation: rise 0.3s var(--ease) both; }
.handle { width: 22px; height: 30px; display: grid; place-items: center; color: var(--ink-3); cursor: grab; border-radius: 6px; opacity: 0; transition: opacity 0.15s; }
.tr:hover .handle, .tr.sel .handle { opacity: 1; }
.handle .i { width: 14px; height: 14px; }
.tmain { --ind: 28px; display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: calc(var(--d, 0) * var(--ind)); position: relative; }
.tmain::before { content: ""; position: absolute; left: 0; top: -8px; bottom: -8px; width: calc(var(--d, 0) * var(--ind));
	background-image: repeating-linear-gradient(90deg, transparent 0 11px, var(--rule-strong) 11px 12px, transparent 12px var(--ind)); pointer-events: none; }
.twisty { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border: 0; background: none; border-radius: 6px; color: var(--ink-3); cursor: pointer; }
.twisty:hover { background: var(--hover); color: var(--ink); }
.twisty .i { width: 15px; height: 15px; transition: transform 0.25s var(--ease); }
.twisty.open .i { transform: rotate(90deg); }
.twisty.none { visibility: hidden; }
.kin, .vin {
	height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--rule); background: var(--paper);
	min-width: 0; transition: border-color 0.15s, box-shadow 0.2s, background 0.15s;
}
.kin { font-weight: 650; }
.ebox { position: relative; display: block; height: 32px; min-width: 0; }
.ebox > input { position: absolute; left: 0; top: 0; width: 100%; text-overflow: ellipsis; }
.ebox > input:focus { z-index: 3; }
.kbox { width: clamp(110px, 13vw, 180px); flex: 0 1 auto; min-width: 88px; }
.vbox { flex: 1 1 120px; }
.vin { flex: 1 1 120px; font-variant-numeric: tabular-nums; }
.vin.num { font-family: var(--f-mono); font-size: 0.86rem; }
.kin:hover, .vin:hover { border-color: var(--rule-strong); }
.kin:focus, .vin:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); background: var(--sheet); }
.kin.bad, .vin.bad { border-color: var(--bad); }
.tb { flex: none; font-family: var(--f-mono); font-size: 0.64rem; font-weight: 500; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 5px; background: var(--sunk); color: var(--ink-3); text-transform: uppercase; }
.tb.object, .tb.array { background: var(--staged-soft); color: var(--staged); }
.tb.formula { background: var(--accent-soft); color: var(--accent); }
.kcount { font-size: 0.8rem; color: var(--ink-3); white-space: nowrap; }
/* Floor fits the widest control at its smallest: a slider track plus its number box. */
.tval { display: flex; align-items: center; gap: 8px; flex: 0 1 var(--valw, 300px); min-width: 200px; }
.tval.wide { --valw: 300px; }
.tval.box { flex: 0 0 auto; min-width: 0; }
.tdesc { flex: 1 1 0; min-width: 40px; display: flex; }
.dtext {
	max-width: 100%; border: 0; background: none; padding: 4px 6px; border-radius: 6px; color: var(--ink-3); font-size: 0.82rem; text-align: left;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.dtext:hover { background: var(--hover); color: var(--ink-2); }
.dtext.empty { display: inline-flex; align-items: center; gap: 6px; opacity: 0; }
.dtext .i { width: 13px; height: 13px; }
.tr:hover .dtext.empty, .tr.sel .dtext.empty, .dtext.empty:focus-visible { opacity: 1; }
.din { display: block; width: 100%; min-height: 30px; padding: 5px 8px; border-radius: 7px; border: 1px solid var(--accent); background: var(--sheet); font-size: 0.84rem; line-height: 1.4; box-shadow: 0 0 0 3px var(--ring); outline: 0; resize: none; field-sizing: content; }
.nmore { display: none; flex: none; border: 0; background: none; padding: 4px 6px; border-radius: 6px; color: var(--accent); font-size: 0.78rem; font-weight: 650; cursor: pointer; transition: background 0.15s; }
.nmore:hover { background: var(--hover); }
.note.clip .nmore, .note.open .nmore { display: block; }
.note.open { flex-wrap: wrap; }
.note.open .dtext { white-space: normal; overflow-wrap: anywhere; }
.tmain:has(> .tdesc.open, > .tdesc.editing, > .tdesc.wrapped) { flex-wrap: wrap; row-gap: 6px; }
.tdesc.open, .tdesc.editing, .tdesc.wrapped { flex-basis: 100%; padding-left: 26px; }
.tflags { display: flex; align-items: center; gap: 4px; }
.flag { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: var(--ink-3); }
.flag .i { width: 14px; height: 14px; }
.flag.priv { color: var(--staged); background: var(--staged-soft); }
.flag.lock { color: var(--ink-2); background: var(--sunk); }
.rbtn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.rbtn:hover { background: var(--sheet); border-color: var(--rule-strong); color: var(--ink); }
.rbtn .i { width: 16px; height: 16px; }
.tr .addbelow { opacity: 0; }
.tr:hover .addbelow, .tr.sel .addbelow { opacity: 1; }
.errline { grid-column: 2 / -1; display: flex; align-items: center; gap: 6px; color: var(--bad); font-size: 0.8rem; font-weight: 650; padding-left: calc(var(--d, 0) * 28px + 32px); }
.errline .i { width: 14px; height: 14px; }
@media (max-width: 760px) { .tr > .errline { grid-column: 1 / -1; } }

/* Formula */

.fx {
	flex: 1 1 140px; min-width: 0; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px 0 8px; border-radius: 8px;
	border: 1px dashed var(--accent-line); background: color-mix(in oklch, var(--accent-soft) 55%, var(--paper)); cursor: text; text-align: left;
	overflow: hidden; transition: border-color 0.15s, box-shadow 0.2s;
}
.fx:hover { border-style: solid; border-color: var(--accent); }
.fx .fxi { font-family: var(--f-mono); font-style: italic; font-weight: 500; font-size: 0.8rem; color: var(--accent); flex: none; }
.fx code { font-family: var(--f-mono); font-size: 0.8rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.fx code .rf { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 3px; }
.fx code .fn { color: var(--ink); font-weight: 500; }
.res { flex: 0 1 auto; min-width: 0; max-width: 100%; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 22px; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--sheet); border: 1px solid var(--rule); font-weight: 700; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.res.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: var(--bad-soft); font-family: var(--f-mono); font-size: 0.76rem; }
.res.bump { animation: bump 0.4s var(--spring); }
.fx-edit { --fx-h: 32px; --fx-line: 18px; --fx-lines: 8; position: relative; flex: 1 1 140px; min-width: 0; height: var(--fx-h); }
.fx-float { position: absolute; z-index: 1; top: 0; left: 0; width: var(--fx-room, 100%); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.fx-in {
	display: block; width: 100%; min-height: var(--fx-h); max-height: calc(var(--fx-h) + var(--fx-line) * (var(--fx-lines) - 1)); field-sizing: content; resize: none;
	padding: calc((var(--fx-h) - var(--fx-line)) / 2 - 1px) 10px; border-radius: 8px; border: 1px solid var(--accent); background: var(--sheet); color: var(--ink);
	font-family: var(--f-mono); font-size: 0.84rem; line-height: var(--fx-line); white-space: pre-wrap; overflow-wrap: anywhere;
	box-shadow: 0 0 0 3px var(--ring), var(--shadow-sm); outline: 0;
}
.fx-msg {
	display: flex; align-items: baseline; gap: 8px; max-width: 100%; padding: 5px 10px; border-radius: 8px; background: var(--sheet); color: var(--ink-2);
	border: 1px solid var(--rule-strong); box-shadow: var(--shadow-sm); font-size: 0.8rem; line-height: 1.35;
}
.fx-msg b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fx-msg.bad { align-items: flex-start; gap: 6px; color: var(--bad); font-weight: 650; border-color: color-mix(in srgb, var(--bad) 35%, var(--rule)); }
.fx-msg .i { width: 14px; height: 14px; flex: none; margin-top: 1px; }
body:has(> .suggest) .fx-msg { visibility: hidden; }
.tr:has(.fx-edit), .lr:has(.fx-edit) { z-index: 2; }
.editor-card:has(.fx-edit) { overflow: visible; }
.tr.fxing .errline, .lr.fxing .lpath .chip.bad { visibility: hidden; }
.formula-box {
	display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 10px; border: 1px solid var(--accent-line);
	background: color-mix(in oklch, var(--accent-soft) 45%, var(--sheet));
}
.formula-box textarea { --fx-lines: 12; font-family: var(--f-mono); font-size: 0.86rem; line-height: 1.5; min-height: 64px; max-height: calc(1.5em * var(--fx-lines) + 2 * (8px + 1px)); field-sizing: content; resize: none; border: 1px solid var(--rule-strong); border-radius: 8px; padding: 8px 10px; background: var(--paper); white-space: pre-wrap; overflow-wrap: anywhere; }
.formula-box textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.fres { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.86rem; color: var(--ink-2); }
.fres b { font-family: var(--f-display); font-size: 1.25rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.fres .err { color: var(--bad); font-weight: 650; display: inline-flex; gap: 6px; align-items: center; }
.refchips { display: flex; flex-wrap: wrap; gap: 6px; }
.refchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); background: var(--sheet); border-radius: 8px; padding: 3px 8px; font-family: var(--f-mono); font-size: 0.76rem; cursor: pointer; color: var(--ink-2); transition: border-color 0.15s, color 0.15s; }
.refchip:hover { border-color: var(--accent); color: var(--accent); }
.refchip b { font-family: var(--f-body); color: var(--ink); font-size: 0.8rem; }
.suggest {
	--suggest-w: min(360px, calc(100vw - 2 * 8px));
	position: fixed; left: 0; top: 0; z-index: 30; width: max-content; min-width: min(240px, var(--suggest-w)); max-width: var(--suggest-w); max-height: min(280px, 45dvh); overflow-y: auto; overscroll-behavior: contain;
	padding: 4px; border-radius: 10px; background: var(--sheet); border: 1px solid var(--rule); box-shadow: var(--shadow); animation: drop 0.18s var(--ease) both;
}
.suggest button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; border: 0; background: none; border-radius: 7px; padding: 5px 8px; cursor: pointer; font-family: var(--f-mono); font-size: 0.78rem; color: var(--ink-2); text-align: left; }
.suggest button[aria-selected="true"], .suggest button:hover { background: var(--hover); color: var(--ink); }
.suggest small { font-family: var(--f-body); color: var(--ink-3); }
.suggest .sg-path { min-width: 0; overflow-wrap: anywhere; }
.suggest .sg-fn, .sg-hint { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px; }
.sg-hint { display: flex; padding: 5px 8px; }
.sg-sig { font-family: var(--f-mono); font-size: 0.78rem; color: var(--ink-2); overflow-wrap: anywhere; }
.sg-sig b { color: var(--accent); font-weight: 650; }
.sg-sig em { font-style: normal; font-weight: 700; color: var(--ink); background: var(--accent-soft); border-radius: 4px; padding: 0 3px; }
.suggest .sg-fn small, .sg-hint small { font-size: 0.76rem; line-height: 1.35; }

/* List view */

.lrows { display: flex; flex-direction: column; }
.lr { display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 5px 12px 5px 14px; border-top: 1px solid var(--rule); min-height: 42px; position: relative; }
.lr:first-child { border-top: 0; }
.lr:hover { background: color-mix(in oklch, var(--hover) 60%, transparent); }
.lr.sel { background: var(--accent-soft); }
.lr::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.lr.st-added::before { background: var(--good); }
.lr.st-changed::before { background: var(--staged); }
.lr.st-moved::before { background: var(--moved); }
.lkey { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.lkey .kbox { flex: 1 1 12ch; width: auto; max-width: none; }
.lpath { min-width: 0; font-family: var(--f-mono); font-size: 0.8rem; color: var(--ink-3); overflow-wrap: anywhere; cursor: pointer; }
.lnote { grid-column: 1 / -1; display: flex; align-items: flex-start; min-width: 0; }
.lnote .dtext, .lnote .nmore { padding-block: 2px; }
.lr .tval { justify-content: flex-start; }

/* JSON view */

.json-wrap { position: relative; }
.json { margin: 0; padding: 14px 16px; font-family: var(--f-mono); font-size: 0.82rem; line-height: 1.65; overflow: auto; max-height: 70vh; white-space: pre; tab-size: 2; color: var(--ink-2); counter-reset: ln; }
.json .ln { display: block; padding-left: 3.4em; position: relative; }
.json .ln::before { counter-increment: ln; content: counter(ln); position: absolute; left: 0; width: 2.4em; text-align: right; color: var(--rule-strong); }
.json .k { color: var(--code-key); }
.json .s { color: var(--code-str); }
.json .n { color: var(--code-num); }
.json .l { color: var(--code-lit); }
.json .f { color: var(--accent); background: var(--accent-soft); border-radius: 4px; }
.json .pv { opacity: 0.55; }
.json-raw { width: 100%; min-height: 60vh; border: 0; border-top: 1px solid var(--rule); background: var(--paper); padding: 14px 16px; font-family: var(--f-mono); font-size: 0.82rem; line-height: 1.65; resize: vertical; }
.json-raw:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--accent-line); }
.json-bar { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--rule); }

/* Inspector */

.insp { position: sticky; top: 76px; max-height: calc(100dvh - 96px); overflow-y: auto; display: flex; flex-direction: column; }
.cfg-shell > .insp { justify-self: end; width: var(--insp-px); transform: translateX(calc((1 - var(--insp-on)) * (100% + var(--split)))); }
.insp-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 14px 12px 16px; border-bottom: 1px solid var(--rule); }
.insp-head .grow { display: flex; flex-direction: column; gap: 4px; }
.insp-head h2 { overflow-wrap: anywhere; }
.insp-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 16px; }
.isec { display: flex; flex-direction: column; gap: 8px; }
.isec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; font-size: 0.86rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.rule-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--rule); font-size: 0.86rem; }
.rule-row .grow { display: flex; flex-direction: column; }
.rule-row small { color: var(--ink-3); font-size: 0.76rem; }
.rule-row.fail { border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-soft); }
.rule-row .i { width: 15px; height: 15px; }
.rule-row .ok-i { color: var(--good); }
.rule-row .bad-i { color: var(--bad); }
.usedby { display: flex; flex-direction: column; gap: 6px; }
.snippet { position: relative; font-family: var(--f-mono); font-size: 0.76rem; padding: 9px 38px 9px 10px; border-radius: 9px; background: var(--sunk); color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.snippet .copy { position: absolute; right: 8px; top: 7px; margin: 0; }
.drift-box { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--moved-soft); border: 1px solid color-mix(in srgb, var(--moved) 35%, transparent); font-size: 0.86rem; }
.drift-box b { color: var(--moved); }
.vedit { display: flex; gap: 8px; align-items: center; }
.vedit .vin { height: 40px; font-size: 0.95rem; }

/* Drawer, tray, sheet, popover, toasts */

.tray {
	position: fixed; left: var(--rail); right: 0; bottom: 0; z-index: 15; display: flex; gap: 12px; align-items: center;
	padding: 12px max(var(--gut), env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) var(--gut);
	background: var(--sheet); border-top: 1px solid var(--rule); box-shadow: 0 -10px 30px oklch(0.2 0.03 var(--h) / 0.1);
	transform: translateY(115%); transition: transform 0.45s var(--spring); visibility: hidden;
}
.tray.show { transform: none; visibility: visible; }
.tray .count { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 99px; background: var(--staged); color: var(--sheet); display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.tray .count.bump { animation: bump 0.4s var(--spring); }
.tray-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tray-text b { font-family: var(--f-display); font-weight: 650; }
.tray-text small { color: var(--ink-3); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray .err-count { color: var(--bad); font-weight: 700; }
.tray .discard { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.tray .discard:hover { background: color-mix(in srgb, var(--bad) 16%, var(--bad-soft)); }
.pop.discard-pop { width: min(320px, calc(100vw - 24px)); padding: 14px; }
.dconfirm { display: flex; flex-direction: column; gap: 10px; }
.dc-title { font-family: var(--f-display); font-weight: 650; font-size: 1rem; }
.dconfirm p { margin: 0; }
.dc-who { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: 10px; }
.dc-who li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--rule); font-size: 0.86rem; min-width: 0; }
.dc-who li:first-child { border-top: 0; }
.dc-who .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-who b { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.dc-who li.theirs b { color: var(--bad); }
.dconfirm .ed-actions { justify-content: center; }
.dconfirm .btn.go { background: var(--bad); border-color: var(--bad); color: var(--sheet); }
.dconfirm .btn.go:hover { background: color-mix(in oklch, var(--bad) 86%, var(--ink)); border-color: color-mix(in oklch, var(--bad) 86%, var(--ink)); }

.scrim { position: fixed; inset: 0; z-index: 20; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer {
	position: fixed; top: 0; right: 0; bottom: 0; z-index: 21; width: min(520px, 100%); display: flex; flex-direction: column;
	background: var(--sheet); border-left: 1px solid var(--rule); box-shadow: var(--shadow);
	padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
	transform: translateX(104%); visibility: hidden; transition: transform 0.42s var(--ease), visibility 0s 0.42s;
}
.drawer.show { transform: none; visibility: visible; transition: transform 0.42s var(--ease), visibility 0s; }
.drawer.insp-drawer { width: min(400px, 100%); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--rule); }
.drawer-head .grow { display: flex; flex-direction: column; gap: 2px; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--rule); align-items: center; }
.chg-list { border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.chg { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 12px; border-top: 1px solid var(--rule); align-items: center; }
.chg:first-child { border-top: 0; }
.chg.off { opacity: 0.5; }
.chg.off .chg-path { text-decoration: line-through; }
.chg-list.enter .chg { animation: rise 0.3s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.chg-path { font-family: var(--f-mono); font-size: 0.8rem; overflow-wrap: anywhere; }
.chg-vals { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.88rem; }
.chg-vals s { color: var(--ink-3); font-weight: 500; text-decoration-thickness: 1.5px; }
.chg-vals .to { color: var(--staged); }
.chg-vals .i { color: var(--ink-3); width: 14px; height: 14px; }
.chg-group { padding: 6px 12px; background: var(--sunk); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.cbox { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--rule-strong); display: grid; place-items: center; cursor: pointer; background: var(--sheet); padding: 0; transition: background 0.15s, border-color 0.15s; }
.cbox .i { width: 12px; height: 12px; stroke-width: 3; color: var(--accent-ink); transform: scale(0); transition: transform 0.22s var(--spring); }
.cbox[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.cbox[aria-checked="true"] .i { transform: scale(1); }
.cbox.derived { border-style: dashed; cursor: default; }
.meter { display: flex; flex-direction: column; gap: 6px; font-size: 0.84rem; color: var(--ink-2); }
.meter .track { height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.meter .fill { height: 100%; border-radius: 99px; background: var(--chart); transform-origin: left; animation: widen 0.7s var(--ease) both; }
.meter .fill.over { background: var(--staged); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 12px; color: var(--ink-3); transition: color 0.2s; }
.steps li .grow { display: flex; flex-direction: column; }
.steps li small { font-size: 0.8rem; color: var(--ink-3); }
.steps li.now, .steps li.done { color: var(--ink); }
.st-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--rule-strong); flex: none; }
.steps li.now .st-icon { border-color: var(--accent); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.steps li.done .st-icon { border-color: var(--good); background: var(--good-soft); color: var(--good); animation: pop 0.35s var(--spring); }
.st-icon .i { width: 14px; height: 14px; stroke-width: 2.4; }
.st-time { font-family: var(--f-mono); font-size: 0.76rem; color: var(--ink-3); }
.save-result { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 8px 0 4px; }
.pub-sending, .pub-done {
	--turn: 0.42s; --swing: 1.8s; --home: 0.34s; --click: 0.3s; --reach: 12px; --stretch: 1.22;
	--unturn-at: calc(var(--home) / 2); --click-at: calc(var(--unturn-at) + var(--turn)); --text-at: var(--unturn-at);
}
.pub-stage {
	--from-turn: 90deg; --from-x: var(--reach); --from-sx: 1; --from-sy: 1;
	width: 84px; height: 84px; overflow: visible; margin-bottom: 4px;
}
.pub-stage path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ps-bl, .ps-br { stroke: var(--ink); stroke-width: 5; }
.ps-dot { fill: var(--brand); }
.ps-check { stroke: var(--brand-ink); stroke-width: 2.6; stroke-dasharray: 12; stroke-dashoffset: 12; }
.ps-braces, .ps-knob, .ps-dot, .ps-bl, .ps-br { transform-box: fill-box; transform-origin: center; }
.pub-sending .ps-braces { animation: ps-turn var(--turn) var(--ease) both; }
.pub-sending .ps-knob { animation: ps-drift var(--turn) var(--ease) both, ps-swing var(--swing) linear var(--turn) infinite; }
.pub-sending > h2, .pub-sending > p, .pub-done > h2, .pub-done > p { animation: rise 0.4s var(--ease) both; }
.pub-done > h2, .pub-done > p { animation-delay: var(--text-at); }
.pub-done .ps-knob { animation: ps-home var(--home) var(--ease) both; }
.pub-done .ps-braces { animation: ps-unturn var(--turn) var(--spring) var(--unturn-at) both; }
.pub-done .ps-bl { animation: ps-clamp-l var(--click) var(--ease) var(--click-at) both; }
.pub-done .ps-br { animation: ps-clamp-r var(--click) var(--ease) var(--click-at) both; }
.pub-done .ps-dot { animation: ps-click var(--click) var(--spring) var(--click-at) both; }
.pub-done .ps-check { animation: draw var(--click) var(--ease) calc(var(--click-at) + var(--click) / 2) forwards; }
@keyframes ps-turn { from { transform: none; } to { transform: rotate(90deg); } }
@keyframes ps-drift { from { transform: none; } to { transform: translateX(var(--reach)); } }
@keyframes ps-swing {
	0%, 100% { transform: translateX(var(--reach)); animation-timing-function: cubic-bezier(0.12, 0, 0.39, 0); }
	25%, 75% { transform: translateX(0) scale(var(--stretch), calc(2 - var(--stretch))); animation-timing-function: cubic-bezier(0.61, 1, 0.88, 1); }
	50% { transform: translateX(calc(var(--reach) * -1)); animation-timing-function: cubic-bezier(0.12, 0, 0.39, 0); }
}
@keyframes ps-home { from { transform: translateX(var(--from-x)) scale(var(--from-sx), var(--from-sy)); } to { transform: none; } }
@keyframes ps-unturn { from { transform: rotate(var(--from-turn)); } to { transform: none; } }
@keyframes ps-clamp-l { 50% { transform: translateX(calc(var(--reach) / 8)); } }
@keyframes ps-clamp-r { 50% { transform: translateX(calc(var(--reach) / -8)); } }
@keyframes ps-click { 45% { transform: scale(var(--stretch)); } }
@media (prefers-reduced-motion: no-preference) { :root:not([data-motion="reduced"]) .spinner.pub-spin { display: none; } }
@media (prefers-reduced-motion: reduce) { .pub-stage *, .pub-sending > *, .pub-done > * { animation: none !important; } .pub-done .ps-check { stroke-dashoffset: 0; } }
:root[data-motion="reduced"] :is(.pub-stage *, .pub-sending > *, .pub-done > *) { animation: none !important; }
:root[data-motion="reduced"] .pub-done .ps-check { stroke-dashoffset: 0; }
.servers { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 4px; }
.servers i { aspect-ratio: 1; border-radius: 3px; background: var(--sunk); transition: background 0.2s; max-width: 100%; }
.servers i.on { background: var(--good); animation: pop 0.3s var(--spring); }
.servers i.slow { background: var(--staged); animation: pop 0.3s var(--spring); }
.lat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lat > div { border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.lat b { font-family: var(--f-display); font-size: 1.3rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.lat small { color: var(--ink-3); font-size: 0.76rem; }
.sim { font-size: 0.76rem; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.sim .i { width: 13px; height: 13px; }

/* The tail sits below the screen so the opening overshoot never shows a gap under the sheet. */
.sheet {
	--sheet-tail: 32px;
	position: fixed; left: 0; right: 0; bottom: calc(-1 * var(--sheet-tail)); z-index: 21; max-height: calc(88dvh + var(--sheet-tail)); overflow-y: auto; overscroll-behavior: contain;
	padding: 8px 16px calc(18px + env(safe-area-inset-bottom, 0px) + var(--sheet-tail)); background: var(--sheet);
	border-radius: 20px 20px 0 0; box-shadow: var(--shadow);
	transform: translateY(104%); visibility: hidden; transition: transform 0.24s var(--ease), visibility 0s 0.24s;
}
#sheet::after { bottom: calc(var(--sheet-tail) + env(safe-area-inset-bottom, 0px)); }
.sheet.show { transform: none; visibility: visible; transition: transform 0.3s cubic-bezier(0.22, 1.16, 0.36, 1), visibility 0s; }
.grabber { position: relative; width: 40px; height: 5px; border-radius: 99px; background: var(--rule-strong); margin: 4px auto 14px; cursor: grab; touch-action: none; }
.grabber::before { content: ""; position: absolute; inset: -16px -80px -12px; }
.sheet-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.sheet-nav button { display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-radius: 10px; border: 0; background: none; color: var(--ink); font-weight: 650; text-align: left; cursor: pointer; }
.sheet-nav button:hover { background: var(--hover); }

.pop {
	position: fixed; z-index: 25; padding: 6px; border-radius: 12px; min-width: 220px;
	background: var(--sheet); border: 1px solid var(--rule); box-shadow: var(--shadow);
	transform-origin: 50% 0; opacity: 0; transform: scale(0.96) translateY(-6px); pointer-events: none; visibility: hidden;
	transition: opacity 0.18s, transform 0.25s var(--ease), visibility 0s 0.25s;
}
.pop[data-place="above"] { transform-origin: 50% 100%; transform: scale(0.96) translateY(6px); }
.pop[data-place="right"] { transform-origin: 0 50%; transform: scale(0.96) translateX(-6px); }
.pop[data-place="left"] { transform-origin: 100% 50%; transform: scale(0.96) translateX(6px); }
.pop.show { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity 0.18s, transform 0.25s var(--spring), visibility 0s; }
.pop.wide { width: 330px; padding: 16px; }
.menu { display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 8px; text-align: left; cursor: pointer; font-weight: 650; font-size: 0.88rem; color: var(--ink); }
.menu button:hover { background: var(--hover); }
.menu button .i { width: 16px; height: 16px; color: var(--ink-3); }
.menu button.danger { color: var(--bad); }
.menu button.danger .i { color: var(--bad); }
.menu button small { margin-left: auto; color: var(--ink-3); font-weight: 500; font-size: 0.76rem; }
.menu button[disabled] { opacity: 0.45; cursor: not-allowed; }
.menu hr { border: 0; height: 1px; background: var(--rule); margin: 4px 6px; }
.menu .mlabel { padding: 6px 10px 2px; }
.menu button .i.end { margin-left: auto; width: 14px; height: 14px; }
.pop.row-pop { max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
.pop.row-pop:not(.fpick-pop) { width: 264px; }
.menu .typeopts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 2px 6px 6px; }
.menu .typeopts button { gap: 7px; padding: 6px 8px; border: 1px solid var(--rule); font-size: 0.82rem; color: var(--ink-2); transition: border-color 0.15s, background 0.15s, color 0.15s; }
.menu .typeopts button .i { width: 15px; height: 15px; transition: color 0.15s; }
.menu .typeopts button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .typeopts button:hover { border-color: var(--rule-strong); color: var(--ink); }
.menu .typeopts button:hover .i { color: var(--ink-2); }
.menu .typeopts button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.menu .typeopts button[aria-pressed="true"] .i { color: var(--accent); }
.menu .typeopts button.pending { border-color: var(--staged); background: var(--staged-soft); color: var(--ink); }
.menu .typeopts button.pending .i { color: var(--staged); }
:is(.menu, .isec) .type-warn { display: flex; flex-direction: column; gap: 8px; margin: 0 6px 6px; padding: 9px 10px; border-radius: 9px; background: var(--staged-soft); font-size: 0.82rem; line-height: 1.4; }
:is(.menu, .isec) .type-warn p { display: flex; align-items: flex-start; gap: 8px; margin: 0; }
:is(.menu, .isec) .type-warn p .i { width: 16px; height: 16px; margin-top: 1px; color: var(--staged); }
:is(.menu, .isec) .tw-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
:is(.menu, .isec) .tw-actions button { width: auto; padding: 5px 10px; border-radius: 7px; border: 1px solid var(--rule-strong); background: var(--sheet); font-size: 0.8rem; }
:is(.menu, .isec) .tw-actions button.go { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
:is(.menu, .isec) .tw-actions button.go:hover { background: var(--accent-hi); }
.isec .type-warn { margin: 8px 0 0; }
.ctl-pick button.pending { border-color: var(--staged); background: var(--staged-soft); color: var(--ink); }
.ctl-pick button.pending .i { color: var(--staged); }

.toast-root { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 30; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100% - 32px); transition: bottom 0.4s var(--spring); }
body.has-tray .toast-root { bottom: calc(var(--tray-h, 0px) + 24px); }
.toast { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; background: var(--ink); color: var(--paper); font-weight: 650; font-size: 0.88rem; box-shadow: var(--shadow); animation: toast-in 0.35s var(--spring) both; }
.toast .i { width: 16px; height: 16px; }
.toast.out { animation: toast-out 0.25s var(--ease) both; }

/* Appearance */

.tp { display: flex; flex-direction: column; gap: 16px; }
.tp-sec { display: flex; flex-direction: column; gap: 8px; }
.tp-between { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.tp-between small { display: block; color: var(--ink-3); font-size: 0.8rem; }
.modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mode-card {
	display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 8px; border-radius: 10px; border: 1px solid var(--rule); background: var(--paper);
	cursor: pointer; font-size: 0.8rem; font-weight: 650; color: var(--ink-2); transition: border-color 0.15s, transform 0.2s var(--spring);
}
.mode-card:hover { border-color: var(--ink-3); }
.mode-card:active { transform: scale(0.96); }
.mode-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); color: var(--ink); }
.mode-prev { position: relative; height: 46px; border-radius: 6px; overflow: hidden; display: grid; grid-template-columns: 26% 1fr; gap: 3px; padding: 4px; }
.mode-prev i { border-radius: 3px; display: flex; flex-direction: column; gap: 3px; padding: 4px; }
.mode-prev i::before, .mode-prev i::after { content: ""; height: 3px; border-radius: 2px; }
.mode-prev i:last-child::before { width: 70%; background: oklch(0.62 var(--c) var(--h)); }
.mode-prev i:last-child::after { width: 45%; }
.mode-prev i:first-child::before { width: 80%; }
.mode-prev i:first-child::after { width: 60%; }
.m-light { background: #eef0f5; }
.m-light i { background: #ffffff; }
.m-light i:first-child::before, .m-light i:first-child::after, .m-light i:last-child::after { background: #d3d8e2; }
.m-dark { background: #161a22; }
.m-dark i { background: #232834; }
.m-dark i:first-child::before, .m-dark i:first-child::after, .m-dark i:last-child::after { background: #3a4152; }
.m-midnight { background: #000000; }
.m-midnight i { background: #15171d; }
.m-midnight i:first-child::before, .m-midnight i:first-child::after, .m-midnight i:last-child::after { background: #2c3040; }
.m-system { background: linear-gradient(90deg, #eef0f5 50%, #161a22 50%); }
.m-system i:first-child { background: #ffffff; }
.m-system i:first-child::before, .m-system i:first-child::after { background: #d3d8e2; }
.m-system i:last-child { background: linear-gradient(90deg, #ffffff 31%, #232834 31%); }
.m-system i:last-child::after { background: #3a4152; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.sw {
	width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; display: grid; place-items: center;
	background: oklch(0.6 var(--sc) var(--sh)); color: oklch(0.99 0 0); transition: transform 0.25s var(--spring), box-shadow 0.2s;
}
.sw:hover { transform: scale(1.1); }
.sw .i { width: 16px; height: 16px; stroke-width: 2.6; transform: scale(0); transition: transform 0.25s var(--spring); }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--sheet), 0 0 0 5px oklch(0.6 var(--sc) var(--sh)); }
.sw[aria-pressed="true"] .i { transform: scale(1); }

/* Forms, setup, history, people */

.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.grow { flex: 1 1 200px; }
.field label { font-weight: 650; font-size: 0.88rem; }
.field label i { font-style: normal; font-weight: 400; color: var(--ink-3); }
.field input, .field select, .field textarea { border: 1px solid var(--rule-strong); border-radius: 9px; padding: 8px 11px; background: var(--paper); width: 100%; transition: border-color 0.15s, box-shadow 0.2s; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.field textarea { min-height: 70px; resize: vertical; }
.field .hint { font-size: 0.8rem; color: var(--ink-3); }
.env-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.env-box { border: 1px solid var(--rule); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.env-box.prod { border-color: color-mix(in srgb, var(--live) 45%, var(--rule)); }
.env-box h3 { display: flex; align-items: center; gap: 8px; }
.uni { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; background: var(--sunk); font-size: 0.86rem; flex-wrap: wrap; }
.uni .mono { color: var(--ink-3); }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.two { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.code { margin: 0; font-family: var(--f-mono); font-size: 0.8rem; line-height: 1.6; padding: 12px 14px; border-radius: 10px; background: var(--sunk); color: var(--ink-2); overflow-x: auto; white-space: pre; }
.code .k { color: var(--code-key); }
.code .s { color: var(--code-str); }
.code .c { color: var(--ink-3); font-style: italic; }
.code-wrap { position: relative; }
.code-wrap .copy { position: absolute; top: 9px; right: 12px; margin: 0; }

.history { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.vlist { display: flex; flex-direction: column; padding: 6px; max-height: 640px; overflow-y: auto; }
.vitem { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 0; border-radius: 9px; background: none; padding: 9px 10px; cursor: pointer; transition: background 0.15s; animation: rise 0.3s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.vitem:hover { background: var(--hover); }
.vitem[aria-current="true"] { background: var(--accent-soft); }
.vitem .vnum { font-family: var(--f-display); font-weight: 650; font-variant-numeric: tabular-nums; min-width: 38px; }
.vitem[aria-current="true"] .vnum { color: var(--accent); }
.vitem .grow { display: flex; flex-direction: column; gap: 2px; }
.vitem small { color: var(--ink-3); font-size: 0.78rem; }
.vitem .msg { font-weight: 650; font-size: 0.9rem; line-height: 1.3; }
.vmeta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.wizard { display: flex; flex-direction: column; gap: 16px; }
.wsteps { display: flex; gap: 6px; }
.wsteps span { flex: 1; height: 4px; border-radius: 99px; background: var(--sunk); overflow: hidden; position: relative; }
.wsteps span::after { content: ""; position: absolute; inset: 0; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 0.45s var(--ease); }
.wsteps span.on::after { transform: scaleX(1); }
.wpane { display: flex; flex-direction: column; gap: 14px; animation: wslide 0.38s var(--ease) both; }
.wpane.back { animation-name: wslide-back; }
.scope-list { display: flex; flex-direction: column; gap: 6px; }
.scope { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--rule); font-size: 0.86rem; }
.scope .mono { color: var(--ink-2); }
.scope .grow small { display: block; color: var(--ink-3); font-size: 0.78rem; }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); background: var(--sheet); border: 1px solid var(--rule); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); animation: rise 0.4s var(--ease) both; }
.login-card .logo { width: 48px; height: 48px; border-radius: 14px; }
.login-card .logo .i { width: 26px; height: 26px; }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; }
.gmark { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); box-shadow: inset 0 0 0 4px var(--accent); }
.login-card.connect { width: min(480px, 100%); }
.connect h1 { font-size: 1.35rem; }
.connect .group { display: flex; flex-direction: column; gap: 8px; }
.connect .pick-label { font-weight: 650; font-size: 0.88rem; }
.connect .choices { display: none; flex-direction: column; gap: 14px; }
.connect .choices.on { display: flex; }
.connect .select { display: flex; }
.connect .answer { display: flex; flex-direction: row-reverse; gap: 8px; }
.connect .answer .btn { flex: 1; }
.connect label.opt, .connect label.cbox-row { position: relative; }
.connect .opt > input, .connect .cbox-row > input { position: absolute; opacity: 0; pointer-events: none; }
.connect .opt:has(> input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.connect .opt:has(> input:checked) .radio { border-color: var(--accent); }
.connect .opt:has(> input:checked) .radio::after { transform: scale(1); }
.connect .opt:has(> input:disabled) { opacity: 0.55; cursor: not-allowed; border-color: var(--rule-strong); }
.connect .opt:has(> input:focus-visible), .connect .cbox-row:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.connect .cbox-row:has(> input:checked) { border-color: var(--accent); }
.connect .cbox-row:has(> input:checked) .cbox { background: var(--accent); border-color: var(--accent); }
.connect .cbox-row:has(> input:checked) .cbox .i { transform: scale(1); }

.bnav { display: none; }

.cfg-pick { display: none !important; }
@media (max-width: 1380px) {
	.cfg-shell.with-insp { --insp-on: 0; }
	.cfg-shell .insp, .cfg-shell .split[data-split="insp"] { display: none; }
}
@media (max-width: 1080px) {
	.cfg-shell { grid-template-columns: minmax(0, 1fr); }
	.cfg-shell .split { display: none; }
	.cfg-list { display: none; }
	.cfg-pick { display: inline-flex !important; margin-bottom: 12px; }
	.history { grid-template-columns: minmax(0, 1fr); }
	.two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
	.app { grid-template-columns: minmax(0, 1fr); }
	.side { display: none; }
	.topbar { padding: 8px 16px; min-height: 54px; gap: 8px; top: 0; padding-top: calc(8px + env(safe-area-inset-top, 0px)); flex-wrap: nowrap; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
	.topbar .mbrand { display: grid; }
	.topbar .status, .long { display: none; }
	.short { display: inline; }
	.topbar .select { flex: 0 1 auto; }
	.topbar .seg > button { padding: 5px 10px; }
	.page { padding-block: 16px calc(var(--nav-h) + 120px); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
	h1 { font-size: 1.5rem; }
	.bnav {
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 16; display: grid; grid-template-columns: repeat(4, 1fr);
		padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); background: var(--sheet); border-top: 1px solid var(--rule);
	}
	.bnav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border: 0; background: none; color: var(--ink-3); font-size: 0.72rem; font-weight: 700; cursor: pointer; }
	.bnav .ic { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 99px; transition: background 0.25s var(--ease), color 0.2s; }
	.bnav [aria-current="page"] { color: var(--accent); }
	.bnav [aria-current="page"] .ic { background: var(--accent-soft); }
	.tray { left: 0; bottom: var(--bnav-h); padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); gap: 10px; box-shadow: 0 -6px 18px oklch(0.2 0.03 var(--h) / 0.08); }
	.tray .discard { padding-inline: 10px; }
	.tray .discard span { display: none; }
	.toast-root { bottom: calc(var(--bnav-h) + 14px); }
	body.has-tray .toast-root { bottom: calc(var(--bnav-h) + var(--tray-h, 0px) + 14px); }
	.drawer { top: 5%; left: 0; width: 100%; border-left: 0; border-radius: 20px 20px 0 0; transform: translateY(104%); }
	.drawer.insp-drawer { width: 100%; }
	.handle, .tr .addbelow { display: none; }
	.tr { grid-template-columns: minmax(0, 1fr) auto; padding-left: 10px; }
	.tmain { flex-wrap: wrap; row-gap: 6px; }
	.tmain::before { display: none; }
	.tmain { --ind: 14px; }
	.kbox { width: auto; flex: 1 1 120px; }
	.tval, .tval.wide { flex: 1 1 100%; padding-left: 32px; }
	.tdesc { flex-basis: 100%; padding-left: 26px; }
	.dtext.empty { display: none; }
	.lr { grid-template-columns: minmax(0, 1fr) auto; }
	.lr .tval { grid-column: 1 / -1; }
	.lr .tflags { grid-area: 1 / 2; }
	.lr .tb { display: none; }
	.modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.toolbar .sep { display: none; }
	.servers { grid-template-columns: repeat(10, minmax(0, 1fr)); }
	.ed-top .ed-tools { width: 100%; }
}
@media (max-width: 460px) {
	.tray-text small { display: none; }
	.lat b { font-size: 1.1rem; }
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
@keyframes tip { from { opacity: 0; transform: translateY(4px); } }
@keyframes stripe { from { transform: scaleY(0); } }
@keyframes bump { 40% { transform: scale(1.3); } }
@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes widen { from { transform: scaleX(0); } }
@keyframes flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--good) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes wslide { from { opacity: 0; transform: translateX(24px); } }
@keyframes wslide-back { from { opacity: 0; transform: translateX(-24px); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.shake { animation: shake 0.36s; }

::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
	.spinner, .steps li.now .st-icon { animation-duration: 2.4s !important; animation-iteration-count: infinite !important; }
}
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after {
	animation-duration: 0.01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important;
}
:root[data-motion="reduced"] .spinner, :root[data-motion="reduced"] .steps li.now .st-icon { animation-duration: 2.4s !important; animation-iteration-count: infinite !important; }


/* Rows appear gently when they're added; kept rows never re-animate */
.tr, .lr { animation: row-in 0.24s var(--ease) both; }
@keyframes row-in { from { opacity: 0; transform: translateY(3px); } }
.rbtn.undo { color: var(--staged); }
.rbtn.undo:hover { border-color: var(--staged-line); background: var(--staged-soft); color: var(--staged); }

/* View switch and tools stay in reach while scrolling */
.ed-bar { position: sticky; top: var(--topbar-h, 58px); z-index: 8; background: var(--paper); padding-block: 8px; margin-block: -8px; }
.toolbar .tools { display: flex; align-items: center; gap: 6px 8px; flex-wrap: nowrap; }
.toolbar .tools .tog { white-space: nowrap; }

/* Controls */
.ctl-slider { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.rng { position: relative; flex: 1 1 100px; min-width: 70px; display: flex; align-items: center; height: 32px; }
.rng input[type="range"] {
	-webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 0; border-radius: 99px; cursor: pointer;
	background: linear-gradient(90deg, var(--accent) var(--p), var(--rule-strong) var(--p));
}
.rng input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--accent);
	box-shadow: var(--shadow-sm); transition: transform 0.15s var(--spring);
}
.rng input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.18); }
.rng input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--accent); }
.defmark { position: absolute; top: 22px; width: 2px; height: 5px; border-radius: 1px; background: var(--ink-3); transform: translateX(-1px); pointer-events: none; }
.ctl-slider .vin { flex: 0 0 64px; width: 64px; }
.stepper { display: inline-flex; align-items: stretch; height: 32px; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--paper); flex: 0 0 auto; }
.stepper button { width: 30px; border: 0; background: var(--sunk); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: background 0.15s, color 0.15s; }
.stepper button:hover:not([disabled]) { background: var(--accent-soft); color: var(--accent); }
.stepper button[disabled] { opacity: 0.4; cursor: not-allowed; }
.stepper button .i { width: 14px; height: 14px; transition: transform 0.15s var(--spring); }
.stepper button:active:not([disabled]) .i { transform: scale(0.8); }
.stepper .vin { border: 0; border-radius: 0; width: 60px; flex: 0 0 60px; text-align: center; height: 30px; }
.stepper .vin:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.when-btn {
	display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--rule);
	background: var(--paper); cursor: pointer; font-weight: 650; font-size: 0.86rem; max-width: 100%; min-width: 0; transition: border-color 0.15s, background 0.15s;
}
.when-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.when-btn .i { width: 15px; height: 15px; color: var(--accent); }
.when-btn span { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when-btn small { flex: 0 100 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.swatch { position: relative; width: 32px; height: 32px; border-radius: 8px; background: var(--sw); flex: none; cursor: pointer; box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.18); overflow: hidden; transition: transform 0.18s var(--spring); }
.swatch:hover { transform: scale(1.06); }
.swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.vin.mono { font-family: var(--f-mono); font-size: 0.84rem; text-transform: uppercase; }
.tb.datetime, .tb.color { background: var(--moved-soft); color: var(--moved); }
.when { display: flex; flex-direction: column; gap: 10px; }
.when-row { display: flex; gap: 8px; }
.when-row input { height: 36px; border: 1px solid var(--rule-strong); border-radius: 9px; padding: 0 10px; background: var(--paper); min-width: 0; }
.when-row input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.when-row input[type="date"] { flex: 1.4; }
.when-row input[type="time"] { flex: 1; }
.when-prev { padding: 8px 10px; border-radius: 9px; background: var(--sunk); font-size: 0.86rem; min-height: 38px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--rule-strong); background: var(--sheet); font-weight: 650; font-size: 0.8rem; cursor: pointer; transition: border-color 0.15s, color 0.15s, transform 0.18s var(--spring); }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
.chip-btn:active { transform: scale(0.94); }
.ed-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ctl-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.ctl-pick button {
	display: flex; align-items: center; gap: 8px; min-width: 0; height: 38px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--rule-strong); background: var(--sheet);
	font-weight: 650; font-size: 0.84rem; text-align: left; cursor: pointer; color: var(--ink-2); transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.ctl-pick button .i { width: 16px; height: 16px; color: var(--ink-3); transition: color 0.15s; }
.ctl-pick button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctl-pick button:hover { border-color: var(--accent-line); color: var(--ink); }
.ctl-pick button:hover .i { color: var(--accent); }
.ctl-pick button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ctl-pick button[aria-pressed="true"] .i { color: var(--accent); }
.ctl-pick button:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ring); }
.ctl-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; padding: 12px; border-radius: 10px; background: var(--sunk); border: 1px solid var(--rule); }
.ctl-opts .field-inline { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ctl-opts .field-inline > span { font-size: 0.84rem; font-weight: 650; color: var(--ink-2); }
.seg-mini { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--paper); border: 1px solid var(--rule); }
.seg-mini button { height: 26px; padding: 0 12px; border: 0; border-radius: 6px; background: none; font-weight: 650; font-size: 0.8rem; color: var(--ink-3); cursor: pointer; transition: background 0.15s, color 0.15s; }
.seg-mini button:hover { color: var(--ink); }
.seg-mini button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--rule-strong); }
.ctl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.note-in { width: 100%; min-height: 56px; resize: vertical; border: 1px solid var(--rule-strong); border-radius: 9px; padding: 8px 10px; background: var(--paper); font-size: 0.9rem; line-height: 1.4; }
.note-in:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }

/* Notices and chips */
.notice.good { background: var(--good-soft); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); }
.notice.good > .i { color: var(--good); }
.notice.ai { background: var(--ai-soft); border: 1px solid var(--ai-line); }
.notice.ai > .i { color: var(--ai); }
.chip.ai { background: var(--ai-soft); color: var(--ai); }
.usage-alerts { display: flex; flex-direction: column; gap: 10px; }
.ua-object { margin-top: 4px; overflow-wrap: anywhere; }
.notice.sugg-bar { padding: 10px 14px; }
.sg-group { display: flex; flex-direction: column; gap: 8px; }
.sg-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.sg-head > .cbox { flex: none; margin-top: 2px; }
.sg-head > .grow { flex: 1 1 200px; min-width: 0; }
.sg-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.sg-msg { margin-top: 2px; font-size: 0.88rem; color: var(--ink-2); overflow-wrap: anywhere; }
.sg-acts { display: flex; gap: 6px; margin-left: auto; }
.sg-why { grid-column: 2 / -1; display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--ink-3); }
.sg-why.bad { color: var(--bad); }
.chg.held > .chg-path, .chg.held > .chg-end, .chg.held > .chg-vals { opacity: 0.55; }
.cbox[aria-checked="mixed"] { background: var(--accent); border-color: var(--accent); }
.cbox[aria-checked="mixed"] .i { transform: scale(1); }
.cbox:disabled { cursor: default; opacity: 0.45; }
.pop-in { animation: pop 0.35s var(--spring) both; }

/* Config list */
.ctrow { display: flex; align-items: center; gap: var(--twist-gap); }
.ctrow .ct { flex: 1; min-width: 0; }
.twistbtn { width: var(--twist-w); height: 30px; padding: 0; border: 0; background: none; border-radius: 6px; display: grid; place-items: center; color: var(--ink-3); cursor: pointer; flex: none; }
.twistbtn:hover { background: var(--hover); color: var(--ink); }
.twistbtn .i { width: 14px; height: 14px; transition: transform 0.25s var(--ease); }
.twistbtn .i.open { transform: rotate(90deg); }
.twistbtn.none { visibility: hidden; }
.ctrow.naming .ct { cursor: text; background: var(--paper); box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--ring); }
.ctrow.naming .ct:has([aria-invalid="true"]) { box-shadow: inset 0 0 0 1px var(--bad), 0 0 0 3px var(--bad-soft); }
.ctrow.naming input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 0; background: transparent; font: inherit; color: var(--ink); }
.ctrow.naming input::placeholder { color: var(--ink-3); font-weight: 500; }
.ct-err { margin: 2px 0 4px calc(var(--twist-w) + var(--twist-gap)); padding: 0 8px; color: var(--bad); }
.cfg-naming { flex-direction: column; align-items: stretch; gap: 4px; }
.cfg-naming .ct-err { margin: 0; padding: 0 4px; }
.naming-field { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--accent); box-shadow: 0 0 0 3px var(--ring); background: var(--sheet); cursor: text; }
.naming-field:has([aria-invalid="true"]) { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.naming-field .i { width: 16px; height: 16px; color: var(--ink-3); }
.naming-field input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 0; background: transparent; font: inherit; font-weight: 650; font-size: 0.9rem; color: var(--ink); }

/* Drawers and pages */
.drawer .insp-in-drawer { position: static; max-height: none; animation: none; flex: 1; min-height: 0; overflow-y: auto; }
.drawer-body > *, .insp-body > * { flex-shrink: 0; }
.chg-end { display: inline-flex; align-items: center; gap: 4px; }
.chg .rbtn { width: 26px; height: 26px; }
.chg .rbtn .i { width: 14px; height: 14px; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; }
.eyebrow.live-t { color: var(--live); }
.eyebrow.acc-t { color: var(--accent); }
.acks { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.acks-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.vbody { display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mcp-tools { display: flex; flex-direction: column; }
.mcp-tool { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--rule); align-items: baseline; }
.mcp-tool:first-child { border-top: 0; }
.mcp-tool .mono { color: var(--ai); }
.feed { display: flex; flex-direction: column; }
.fitem { display: flex; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--rule); }
.ficon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--ai-soft); color: var(--ai); flex: none; }
.ficon .i { width: 16px; height: 16px; }
.opts-col { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; text-align: left; border: 1px solid var(--rule-strong); background: var(--sheet); cursor: pointer; transition: border-color 0.15s, background 0.15s; width: 100%; }
.opt:hover { border-color: var(--accent); }
.opt small { display: block; color: var(--ink-3); font-size: 0.8rem; font-weight: 400; }
.opt:disabled { opacity: 0.55; cursor: not-allowed; }
.opt:disabled:hover { border-color: var(--rule-strong); }
.opt .radio { margin-top: 2px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--rule-strong); flex: none; display: grid; place-items: center; }
.opt .radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform 0.25s var(--spring); }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt[aria-checked="true"] .radio { border-color: var(--accent); }
.opt[aria-checked="true"] .radio::after { transform: scale(1); }
.cbox-row { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 99px; border: 1px solid var(--rule-strong); background: var(--sheet); cursor: pointer; font-weight: 650; }
.cbox-row[aria-pressed="true"] { border-color: var(--accent); }
td.r { text-align: right; }
@media (max-width: 760px) {
	.mcp-tool { grid-template-columns: minmax(0, 1fr); gap: 2px; }
	.ctl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* App states */
.boot { padding: 40px; color: var(--ink-3); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.dot.bad { background: var(--bad); animation: none; box-shadow: 0 0 0 3px var(--bad-soft); }
.skel { border-radius: 8px; background: linear-gradient(90deg, var(--sunk) 0%, var(--hover) 50%, var(--sunk) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skel-panel { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-state { padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.big-logo { width: 48px; height: 48px; border-radius: 14px; }
.big-logo .i { width: 26px; height: 26px; }
.ro .handle { visibility: hidden; }
.ro .kin, .ro .vin { cursor: default; }
.errlist { margin: 6px 0 8px; padding-left: 1.1em; font-size: 0.86rem; }
.uni-list { display: flex; flex-direction: column; gap: 6px; }
.uni-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.uni-row input { height: 34px; border: 1px solid var(--rule-strong); border-radius: 8px; padding: 0 10px; background: var(--paper); min-width: 0; }
.uni-row input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.env-box h3 .grow { flex: 1; }
.danger-zone { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--rule)); }
.danger-zone .grow { flex: 1 1 220px; }
.btn.danger { color: var(--bad); }
.tog.small { font-size: 0.82rem; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; }
.vin:disabled, .kin[readonly], .pick-val:disabled, .when-btn:disabled, .fx:disabled { color: var(--ink); -webkit-text-fill-color: var(--ink); opacity: 1; cursor: default; }
.vin:disabled, .pick-val:disabled { background: var(--sunk); }
.when-btn:disabled:hover, .fx:disabled:hover { border-color: var(--rule); background: var(--paper); }
.vdelivery { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.vdelivery h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.drawer-body .vdelivery { margin: 4px 0 0; }
.dlv-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dlv { border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dlv-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.88rem; }
.dlv-head .i { color: var(--ink-3); }
.dlv-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.dstep { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 650; background: var(--sunk); color: var(--ink-2); transition: background 0.25s, color 0.25s; }
.dstep .i { width: 13px; height: 13px; }
.dstep .spinner { width: 11px; height: 11px; border-width: 1.5px; }
.dstep.sent { background: var(--good-soft); color: var(--good); }
.dstep.sent .i, .dstep.failed .i { animation: pop 0.3s var(--spring); }
.dstep.failed { background: var(--bad-soft); color: var(--bad); }
.dstep.skipped { color: var(--ink-3); }
.dlv-err { font-size: 0.8rem; color: var(--bad); overflow-wrap: anywhere; }
.dlv-err.skipped { color: var(--ink-3); }
.dlv-sum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.86rem; color: var(--ink-2); }
.dlv-sum .i { color: var(--good); }
.dlv-sum .grow { flex: 1 1 220px; }
.keybox { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 6px; }
.keybox code { font-size: 0.82rem; padding: 6px 10px; border-radius: 8px; background: var(--sheet); border: 1px solid var(--rule); overflow-wrap: anywhere; min-width: 0; user-select: all; }
:root { --peer-l: 0.42; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --peer-l: 0.84; } }
:root[data-theme="dark"], :root[data-theme="midnight"] { --peer-l: 0.84; }
.here .more { font-size: 0.75rem; color: var(--ink-3); margin-left: -2px; }
.pface { position: relative; display: inline-grid; border-radius: 50%; flex: none; }
.pface .avatar { box-shadow: 0 0 0 2px var(--sheet), 0 0 0 3.5px oklch(0.64 0.16 var(--ph)); }
.faces .pface { margin-left: -5px; }
.faces .pface:first-child { margin-left: 0; }
.faces .pface .avatar { margin-left: 0; }
.pface.editing::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%; background: oklch(0.64 0.16 var(--ph)); box-shadow: 0 0 0 2px var(--sheet); }
.faces.mini { margin-left: 4px; }
.faces.mini .avatar { --s: 18px; }
.here-list { min-width: 260px; }
.here-list button { align-items: center; gap: 10px; }
.here-list small { display: block; color: var(--ink-3); font-weight: 400; overflow-wrap: anywhere; }
.tr.peer, .lr.peer { box-shadow: inset 3px 0 0 oklch(0.64 0.16 var(--ph)); }
.peer-tag { display: inline-flex; align-items: center; gap: 5px; max-width: 190px; height: 24px; padding: 0 9px 0 3px; border-radius: 99px; font-size: 0.75rem; font-weight: 650; white-space: nowrap; background: oklch(0.64 0.16 var(--ph) / 0.16); color: oklch(var(--peer-l) 0.14 var(--ph)); }
.peer-tag > span { overflow: hidden; text-overflow: ellipsis; }
.peer-tag .avatar { --s: 18px; }
.caret { display: inline-block; width: 1.5px; height: 0.95em; margin-left: 1px; vertical-align: -0.12em; background: currentColor; animation: caret 1.1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.by { display: inline-grid; }
.by .avatar { --s: 20px; }
.tr.rf0, .lr.rf0 { animation: rflash0 1.6s var(--ease); }
.tr.rf1, .lr.rf1 { animation: rflash1 1.6s var(--ease); }
@keyframes rflash0 { from { background: oklch(0.72 0.15 var(--fh) / 0.32); } }
@keyframes rflash1 { from { background: oklch(0.72 0.15 var(--fh) / 0.32); } }

.mark { width: 30px; height: 30px; flex: none; color: var(--ink); display: block; }
.mark.big { width: 52px; height: 52px; }
.wordmark { height: 19px; width: auto; color: var(--ink); display: block; }
.brand { gap: 7px; }
.lockup { display: flex; align-items: center; gap: 6px; }
.lockup .mark { width: 52px; height: 52px; }
.lockup .wordmark { height: 34px; }
.topbar .mbrand { place-items: center; }

.swatch { border: 0; padding: 0; }
.pop.color { width: 280px; padding: 14px; }
.cp { display: flex; flex-direction: column; gap: 12px; }
.cp-sv { position: relative; height: 160px; border-radius: 10px; cursor: crosshair; touch-action: none; background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(var(--hue) 100% 50%)); box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.12); }
.cp-knob { position: absolute; left: var(--sx); top: var(--sy); width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--sw); box-shadow: 0 0 0 2.5px #fff, 0 0 0 4px oklch(0 0 0 / 0.35), 0 2px 6px oklch(0 0 0 / 0.35); pointer-events: none; }
.cp-strip { display: flex; align-items: center; gap: 10px; }
.cp-compare { display: flex; flex: none; width: 44px; height: 30px; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.15); }
.cp-compare span { flex: 1; background: var(--sw); }
.cp-hue { flex: 1; appearance: none; -webkit-appearance: none; height: 12px; border-radius: 99px; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); outline: none; }
.cp-hue::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: hsl(var(--hue) 100% 50%); box-shadow: 0 0 0 2.5px #fff, 0 0 0 4px oklch(0 0 0 / 0.3); cursor: pointer; }
.cp-hue::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: hsl(var(--hue) 100% 50%); box-shadow: 0 0 0 2.5px #fff, 0 0 0 4px oklch(0 0 0 / 0.3); cursor: pointer; }
.cp-formats .seg { width: 100%; }
.cp-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cp-field { display: flex; flex-direction: column; gap: 3px; font-size: 0.72rem; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.cp-field.wide { grid-column: 1 / -1; }
.cp-field input { height: 32px; border: 1px solid var(--rule-strong); border-radius: 8px; padding: 0 9px; background: var(--paper); color: var(--ink); font: 600 0.9rem var(--f-mono); min-width: 0; text-transform: uppercase; }
.cp-field input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.cp-row { display: flex; flex-direction: column; gap: 6px; }
.cp-label { font-size: 0.72rem; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-chip { width: 22px; height: 22px; border-radius: 6px; border: 0; padding: 0; background: var(--sw); box-shadow: inset 0 0 0 1px var(--rule-strong); cursor: pointer; transition: transform 0.15s var(--spring); }
.cp-chip:hover { transform: scale(1.12); }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choice-head, .choice { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.choice-head { font-size: 0.72rem; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.choice-head i { text-transform: none; font-weight: 400; letter-spacing: 0; }
.choice input { height: 32px; border: 1px solid var(--rule-strong); border-radius: 8px; padding: 0 9px; background: var(--paper); color: var(--ink); min-width: 0; }
.choice input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.choice.on input:first-child { border-color: var(--accent-line); }
.choice.dup input:first-child { border-color: var(--bad); }
.choice-tools { display: flex; gap: 2px; }
.choice-tools .rbtn { width: 26px; height: 26px; }
.choice-tools .rbtn:disabled { opacity: 0.35; cursor: default; }
.choice-add { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.bad-t { color: var(--bad); }

.here { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px; border: 0; border-radius: 99px; background: none; color: var(--ink-3); font-size: 0.78rem; font-weight: 650; cursor: pointer; transition: background 0.15s; }
.here:hover { background: var(--hover); }
.pdots { display: inline-flex; gap: 3px; margin-left: 6px; align-items: center; }
.pdots i { width: 7px; height: 7px; border-radius: 50%; background: oklch(0.64 0.16 var(--ph)); }
.pbubble { display: inline-flex; align-items: center; gap: 6px; height: 20px; min-width: 20px; padding: 0 6px; border-radius: 99px; background: oklch(0.6 0.16 var(--ph)); color: #fff; max-width: 170px; overflow: hidden; white-space: nowrap; transition: max-width 0.2s var(--ease); }
.pbubble b { font: 700 0.62rem var(--f-display); letter-spacing: 0.02em; }
.pbubble .ptext { font: 500 0.74rem var(--f-mono); overflow: hidden; text-overflow: ellipsis; opacity: 0.95; }
.pbubble:not(.typing) { padding: 0; justify-content: center; }

@container tree (max-width: 700px) {
	.tmain { flex-wrap: wrap; row-gap: 6px; }
	.kbox { width: auto; flex: 1 1 110px; max-width: 220px; }
	.tval:not(.box) { flex: 1 1 100%; min-width: 0; padding-left: 32px; }
	.lr .tval { padding-left: 0; }
	.tdesc { flex-basis: 100%; padding-left: 26px; }
	.dtext.empty { display: none; }
}

.row-btns { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.ledger tr.off td { color: var(--ink-3); }
.ledger tr.off b { color: var(--ink-2); }
.opt .cbox { flex: none; margin-top: 1px; }

.top-crumb { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 0.9rem; }
.top-crumb b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obadge.has-logo { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); overflow: hidden; }
.obadge img { width: 100%; height: 100%; object-fit: cover; display: block; }
.obadge.big { --s: 72px; border-radius: 18px; font-size: 1.5rem; }
.sheet-who { display: flex; align-items: center; gap: 12px; padding: 4px 4px 18px; }
.sheet-who .grow { min-width: 0; }
.sheet-who .name { font-weight: 700; }
.sheet-who small { color: var(--ink-3); }
.sheet .switcher { margin-bottom: 4px; }
.sheet-sec { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--rule); }
.sheet-sec .nav-h { padding: 2px 10px 4px; }
.sheet-sec .sheet-nav { margin-top: 0; }
.sheet-nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.logo-edit { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo-drop { border-radius: 20px; padding: 4px; border: 2px dashed transparent; transition: border-color 0.15s, background 0.15s; }
.logo-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.stack-sm { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row-btns.start { justify-content: flex-start; align-items: center; }

/* Scroll edges: fades and a "more this way" pointer; app.js sets --more-up and --more-down from each scroller's position */
@property --more-up { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --more-down { syntax: "<number>"; inherits: true; initial-value: 0; }
@keyframes edge-bob { 0%, 100% { background-position: 50% var(--bob-from), 0 0; } 50% { background-position: 50% var(--bob-to), 0 0; } }
:root {
	--edge-h: 40px;
	--edge-inset: 8px;
	--edge-bob: 3px;
	--chev-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b87a0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 15l6-6 6 6'/%3E%3C/svg%3E");
	--chev-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b87a0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.side { --edge-gap: 14px; }
.switch-list { --edge-gap: 2px; }
.ctree { --edge-gap: 1px; }
.drawer-body { --edge-gap: 16px; }
:is(.side, .switch-list, .ctree, .insp, .drawer-body, .sheet, .vlist, .fp-list)::before,
:is(.side, .switch-list, .ctree, .insp, .drawer-body, .sheet, .vlist, .fp-list)::after {
	content: ""; position: sticky; z-index: 3; display: block; flex: none; height: var(--edge-h); pointer-events: none;
	animation: edge-bob 1.6s ease-in-out infinite;
}
:is(.side, .switch-list, .ctree, .insp, .drawer-body, .sheet, .vlist, .fp-list)::before {
	--bob-from: calc(var(--edge-inset) + var(--edge-bob)); --bob-to: var(--edge-inset);
	top: 0; margin-bottom: calc(-1 * (var(--edge-h) + var(--edge-gap, 0px)));
	opacity: var(--more-up);
	background: var(--chev-up) no-repeat 50% var(--bob-from), linear-gradient(var(--sheet) 25%, transparent);
}
:is(.side, .switch-list, .ctree, .insp, .drawer-body, .sheet, .vlist, .fp-list)::after {
	--bob-from: calc(100% - var(--edge-inset) - var(--edge-bob)); --bob-to: calc(100% - var(--edge-inset));
	bottom: 0; margin-top: calc(-1 * (var(--edge-h) + var(--edge-gap, 0px)));
	opacity: var(--more-down);
	background: var(--chev-down) no-repeat 50% var(--bob-from), linear-gradient(transparent, var(--sheet) 75%);
}
@media (prefers-reduced-motion: reduce) { :is(.side, .switch-list, .ctree, .insp, .drawer-body, .sheet, .vlist, .fp-list)::before, :is(.side, .switch-list, .ctree, .insp, .drawer-body, .sheet, .vlist, .fp-list)::after { animation: none; } }
:root[data-motion="reduced"] :is(.side, .switch-list, .ctree, .insp, .drawer-body, .sheet, .vlist, .fp-list)::before, :root[data-motion="reduced"] :is(.side, .switch-list, .ctree, .insp, .drawer-body, .sheet, .vlist, .fp-list)::after { animation: none; }

/* Selects: where the browser allows styling the list, match the app's menus */
@supports (appearance: base-select) {
	select, ::picker(select) { appearance: base-select; }
	select { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
	.select > .i { display: none; }
	select::picker-icon { content: ""; width: 16px; height: 16px; flex: none; margin-left: auto; background: var(--chev-down) no-repeat center / 16px; transition: rotate 0.2s var(--ease); }
	select:open::picker-icon { rotate: 180deg; }
	.select select { padding-right: 10px; }
	::picker(select) {
		margin-block: 6px; padding: 6px; border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); color: var(--ink);
		box-shadow: var(--shadow); max-height: min(360px, 60dvh); transform-origin: 50% 0;
		opacity: 0; transform: scale(0.96) translateY(-6px);
		transition: opacity 0.16s, transform 0.22s var(--ease), overlay 0.22s allow-discrete, display 0.22s allow-discrete;
	}
	::picker(select):popover-open { opacity: 1; transform: none; }
	@starting-style { ::picker(select):popover-open { opacity: 0; transform: scale(0.96) translateY(-6px); } }
	option { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: 0.88rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
	option:hover, option:focus-visible { background: var(--hover); color: var(--ink); outline: 0; }
	option:checked { background: var(--accent-soft); color: var(--accent); }
	option::checkmark { order: 1; margin-left: auto; color: var(--accent); }
	option:disabled { opacity: 0.45; cursor: not-allowed; }
	optgroup { padding: 4px 0; }
	optgroup legend { padding: 6px 10px 2px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
}

.chip.caps { display: inline-block; vertical-align: middle; text-transform: uppercase; letter-spacing: 0.06em; line-height: 1; padding-block: 5px; text-box: trim-both cap alphabetic; }
.tb { line-height: 1; padding-block: 4px; text-box: trim-both cap alphabetic; }
.pop { box-shadow: 0 1px 2px oklch(0 0 0 / 0.12), 0 14px 40px -6px oklch(0 0 0 / 0.38); }
.pop.color { box-shadow: 0 2px 6px oklch(0 0 0 / 0.18), 0 22px 56px -8px oklch(0 0 0 / 0.5); }

.pick-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink); text-align: left; cursor: pointer; transition: border-color 0.15s; }
.pick-btn:hover { border-color: var(--accent); }
.pick-btn .grow { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pick-btn b { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-btn small { font-size: 0.76rem; color: var(--ink-3); }
.pick-btn > .i { width: 16px; height: 16px; flex: none; color: var(--ink-3); }
.pop.fpick-pop { width: 300px; padding: 8px; }
.fpick { display: flex; flex-direction: column; gap: 8px; }
.fp-list { --edge-gap: 1px; display: flex; flex-direction: column; gap: 1px; max-height: min(320px, 50dvh); overflow-y: auto; }
.fp-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px 6px calc(8px + var(--d, 0) * 16px); border: 0; border-radius: 7px; background: none; color: var(--ink-2); font-size: 0.86rem; font-weight: 600; text-align: left; cursor: pointer; }
.fp-list button:hover { background: var(--hover); color: var(--ink); }
.fp-list button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.fp-list .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-list small { color: var(--ink-3); font-size: 0.74rem; }
.fp-list .i { width: 15px; height: 15px; flex: none; color: var(--ink-3); }
.fp-list button[aria-selected="true"] .i { color: var(--accent); }
.mp-head { display: flex; align-items: center; gap: 6px; }
.mp-head .grow { display: flex; flex-direction: column; min-width: 0; }
.mp-head b { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-list .mp-cfg { color: var(--ink); font-weight: 750; }
.fp-list button[aria-disabled="true"] { opacity: 0.55; cursor: default; background: none; }

.rbtn.more { border-color: var(--rule); color: var(--ink-2); }
.tr:hover .rbtn.more, .tr.sel .rbtn.more, .lr:hover .rbtn.more { background: var(--sheet); border-color: var(--rule-strong); color: var(--ink); }
.menu-btn { gap: 6px; }
.menu-btn .i:last-child { width: 14px; height: 14px; color: var(--ink-3); }

.trows, .lrows { position: relative; }
.drop-mark { position: absolute; z-index: 4; left: calc(34px + var(--d, 0) * 28px); right: 10px; height: 0; pointer-events: none; }
.drop-mark::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.drop-mark::after { content: ""; position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.drop-pill { position: absolute; left: 12px; top: -12px; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 0.78rem; white-space: nowrap; box-shadow: var(--shadow-sm); animation: ghost-in 0.14s var(--ease) both; }
.drop-pill b { font-weight: 700; }
.drop-pill .i { width: 12px; height: 12px; }
.drop-pill span { opacity: 0.85; }
@keyframes ghost-in { from { opacity: 0; transform: translateY(3px); } }
.tr.drop-into { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.drag-pill { position: fixed; top: -200px; left: 0; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: var(--sheet); border: 1px solid var(--accent-line); color: var(--ink); box-shadow: var(--shadow); font-size: 0.88rem; }
.drag-pill .i { width: 14px; height: 14px; color: var(--accent); }
@media (max-width: 760px) { .drop-mark { left: calc(10px + var(--d, 0) * 14px); } }

.json .jk, .json .jv { cursor: text; border-radius: 4px; transition: background 0.12s, box-shadow 0.12s; }
.json .jk:hover, .json .jv:hover { background: var(--hover); box-shadow: 0 0 0 2px var(--hover); }
.json .jin { field-sizing: content; min-width: 4ch; max-width: 100%; padding: 0 4px; border: 1px solid var(--accent); border-radius: 5px; background: var(--sheet); color: var(--ink); font: inherit; box-shadow: 0 0 0 3px var(--ring); outline: 0; vertical-align: baseline; }
.json .jind { display: inline-block; width: calc(var(--n) * 2ch); }

.pick-val { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; height: 32px; padding: 0 8px 0 10px; border-radius: 8px; border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink); font-weight: 600; font-size: 0.88rem; text-align: left; cursor: pointer; transition: border-color 0.15s, background 0.15s, box-shadow 0.2s; }
.pick-val:hover { border-color: var(--accent); }
.pick-val:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.pick-val .grow { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-val > .i { width: 16px; height: 16px; flex: none; color: var(--accent); }
.pick-val small { font-size: 0.74rem; font-weight: 700; }
.pick-val:disabled { cursor: default; }
.pick-val:disabled > .i { color: var(--ink-3); }
.vpick { display: flex; flex-direction: column; gap: 8px; }
.vpick .fp-list small.mono { font-family: var(--f-mono); }
.fp-list button:focus-visible { outline: 0; background: var(--hover); box-shadow: inset 0 0 0 2px var(--accent-line); }

.virtual > .tr, .virtual > .lr, .virtual > .vitem { animation: none; }
.vpad { display: block; flex: none; overflow-anchor: none; }

.page-edge { position: fixed; left: var(--rail); right: 0; z-index: 11; height: var(--edge-h); pointer-events: none; animation: edge-bob 1.6s ease-in-out infinite; }
.page-edge.top {
	--bob-from: calc(var(--edge-inset) + var(--edge-bob)); --bob-to: var(--edge-inset);
	top: var(--topbar-h, 58px); opacity: var(--more-up);
	background: var(--chev-up) no-repeat 50% var(--bob-from), linear-gradient(var(--paper) 30%, transparent);
}
.page-edge.bottom {
	--bob-from: calc(100% - var(--edge-inset) - var(--edge-bob)); --bob-to: calc(100% - var(--edge-inset));
	bottom: var(--tray-h, 0px); opacity: var(--more-down);
	background: var(--chev-down) no-repeat 50% var(--bob-from), linear-gradient(transparent, var(--paper) 70%);
}
@media (max-width: 760px) {
	.page-edge { left: 0; }
	.page-edge.bottom { bottom: calc(var(--bnav-h) + var(--tray-h, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .page-edge { animation: none; } }
.page.wide ~ .page-edge.top { display: none; }
.ed-bar > .toolbar { position: relative; }
.ed-bar > .toolbar::after {
	--bob-from: calc(var(--edge-inset) + var(--edge-bob)); --bob-to: var(--edge-inset);
	content: ""; position: absolute; left: -1px; right: -1px; top: calc(100% + 9px); height: var(--edge-h); pointer-events: none;
	background: var(--chev-up) no-repeat 50% var(--bob-from), linear-gradient(var(--paper) 30%, transparent);
	opacity: var(--more-up); animation: edge-bob 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .ed-bar > .toolbar::after { animation: none; } }
:root[data-motion="reduced"] .ed-bar > .toolbar::after { animation: none; }
:root[data-motion="reduced"] .page-edge { animation: none; }
.drawer-grab { display: none; }
@media (max-width: 760px) {
	.drawer-grab { display: block; flex: none; margin: 8px auto 2px; }
	.drawer.insp-drawer .insp-in-drawer { padding-top: 4px; }
}

:root {
	--pop-bg: var(--sheet);
	--pop-line: var(--rule);
	--pop-shadow: 0 1px 2px oklch(0 0 0 / 0.12), 0 14px 40px -6px oklch(0 0 0 / 0.38);
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--pop-bg: oklch(0.255 0.017 var(--h));
		--pop-line: var(--rule-strong);
		--pop-shadow: 0 0 0 1px oklch(0 0 0 / 0.45), 0 20px 56px -6px oklch(0 0 0 / 0.8);
	}
}
:root[data-theme="dark"] {
	--pop-bg: oklch(0.255 0.017 var(--h));
	--pop-line: var(--rule-strong);
	--pop-shadow: 0 0 0 1px oklch(0 0 0 / 0.45), 0 20px 56px -6px oklch(0 0 0 / 0.8);
}
:root[data-theme="midnight"] {
	--pop-bg: oklch(0.225 0.014 var(--h));
	--pop-line: var(--rule-strong);
	--pop-shadow: 0 0 0 1px oklch(0 0 0 / 0.6), 0 20px 56px -6px oklch(0 0 0 / 0.9);
}
.pop, .pop.color { background: var(--pop-bg); border-color: var(--pop-line); box-shadow: var(--pop-shadow); }
.pop .mini-search, .pop .cp-field input { background: var(--sheet); }

.thumb-edit { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.thumb-drop { position: relative; display: grid; place-items: center; width: 192px; max-width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; border: 2px dashed transparent; background: linear-gradient(135deg, oklch(var(--av-l) var(--av-c) var(--ah)), oklch(calc(var(--av-l) - 0.1) var(--av-c) calc(var(--ah) + 40))); transition: border-color 0.15s; }
.thumb-drop img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-drop.over { border-color: var(--accent); }

.cp-formats .seg > button { flex: 1; }
.ct[aria-current="true"] .chip.info { background: var(--accent); color: var(--accent-ink); }
.cfg-shell > .insp.leaving { pointer-events: none; }
