@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/static/ahn.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ground: #11151c;
  --rail: #161d29;
  --surface: #181d26;
  --surface-hover: #1f2631;
  --surface-sunk: #0d1117;
  --line: #283040;
  --line-strong: #364052;
  --text: #e8ecf2;
  --text-2: #a7b0bd;
  --text-3: #8a94a3;
  --accent: #6cb3ff;
  --accent-ink: #0b1a2c;
  --accent-soft: rgb(108 179 255 / 0.14);
  --todo: #4fd16f;
  --glitch: #f2c94c;
  --done: #8d96a5;
  --error: #ff6b6b;
  --unsure: #ff9f43;
  --hint: #c39bff;
  --offline: #5a6474;
  --shadow: 0 12px 32px -8px rgb(0 0 0 / 0.55), 0 2px 6px rgb(0 0 0 / 0.35);
  --font: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;
  --t-meta: 12px;
  --t-small: 13px;
  --t-body: 14px;
  --t-section: 16px;
  --t-title: 20px;
  --row-h: 52px;
  --head-h: 36px;
  --r-control: 6px;
  --r-square: 3px;
  --r-panel: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --ground: #eef1f5;
  --rail: #dfe5ee;
  --surface: #ffffff;
  --surface-hover: #f4f6f9;
  --surface-sunk: #e6eaf0;
  --line: #d3d9e2;
  --line-strong: #bcc5d2;
  --text: #18202c;
  --text-2: #465265;
  --text-3: #5b6779;
  --accent: #1d68c7;
  --accent-ink: #ffffff;
  --accent-soft: rgb(29 104 199 / 0.1);
  --todo: #1c8f40;
  --glitch: #9a6f00;
  --done: #6b7483;
  --error: #c62f2f;
  --unsure: #c25e00;
  --hint: #7a45c9;
  --offline: #a3acb9;
  --shadow: 0 12px 32px -10px rgb(24 32 44 / 0.25), 0 2px 6px rgb(24 32 44 / 0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.4;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
::selection { background: var(--accent); color: var(--accent-ink); }
input, select, button, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid var(--ground); }
::-webkit-scrollbar-track { background: transparent; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 208px 1fr; height: 100vh; }
.rail {
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 16px 10px 12px;
  gap: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 7px); gap: 2px; }
.brand-mark i { width: 7px; height: 7px; border-radius: 2px; background: var(--todo); }
.brand-mark i:nth-child(3n+2) { background: var(--glitch); }
.brand-mark i:nth-child(n+7) { background: transparent; box-shadow: inset 0 0 0 1.5px var(--done); }
.brand-name { font-weight: 700; font-size: 14px; line-height: 1.15; letter-spacing: -0.005em; }
.brand-name small { display: block; font-weight: 400; color: var(--text-3); font-size: var(--t-meta); }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 0; border-radius: var(--r-control);
  background: transparent; color: var(--text-2); cursor: pointer; text-align: left;
  font-weight: 600; transition: background 150ms var(--ease), color 150ms var(--ease);
}
.nav-btn svg { width: 18px; height: 18px; flex: none; }
.nav-btn:hover { background: var(--surface-hover); color: var(--text); }
.nav-btn[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.nav-btn[aria-current="page"] svg { color: var(--accent); }
.nav-btn .badge { margin-left: auto; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.rail-version { color: var(--text-3); font-size: 11px; padding: 8px 10px 0; line-height: 1.35; }

main { position: relative; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.view-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px 12px;
}
.view-head h1 { font-size: var(--t-title); font-weight: 700; margin: 0 8px 0 0; letter-spacing: -0.01em; }
.view-body { padding: 0 20px 20px; overflow: auto; min-height: 0; flex: 1; }
.grow { flex: 1; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.hint-text { color: var(--text-3); font-size: var(--t-small); max-width: 75ch; text-wrap: pretty; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-control);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; font-weight: 600; font-size: var(--t-small); white-space: nowrap;
  transition: background 150ms var(--ease), border-color 150ms var(--ease), opacity 150ms;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-hover); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn.danger:hover { border-color: var(--error); color: var(--error); }
.btn.sm { height: 26px; padding: 0 8px; font-size: var(--t-meta); }
.btn.icon { width: 30px; padding: 0; }
.btn.icon.sm { width: 26px; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--text-3); border-top-color: var(--accent); animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.field {
  height: 32px; padding: 0 10px; border-radius: var(--r-control);
  border: 1px solid var(--line-strong); background: var(--surface-sunk); color: var(--text);
  min-width: 0;
}
.field::placeholder { color: var(--text-3); }
.field:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
select.field { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px; background-size: 5px 5px; background-repeat: no-repeat; }
select.field option { background: var(--surface); color: var(--text); }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 9px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search .field { padding-left: 32px; width: 280px; }
.kbd { font-size: 11px; color: var(--text-3); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; margin-left: -34px; pointer-events: none; }

.check { appearance: none; width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--text-3);
  background: transparent; cursor: pointer; display: inline-grid; place-content: center; margin: 0; flex: none;
  transition: background 120ms, border-color 120ms; }
.check:hover { border-color: var(--text); }
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.check:indeterminate { background: var(--accent); border-color: var(--accent); }
.check:indeterminate::after { content: ""; width: 8px; height: 2px; background: var(--accent-ink); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 20px; background: var(--line-strong);
  position: relative; cursor: pointer; transition: background 150ms var(--ease); margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); transition: transform 150ms var(--ease); box-shadow: 0 1px 2px rgb(0 0 0 / 0.3); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; border-radius: 9px;
  font-size: 11px; font-weight: 700; background: var(--surface-sunk); color: var(--text-2); white-space: nowrap; }
.badge.new { background: var(--todo); color: #08240f; }
:root[data-theme="light"] .badge.new { color: #ffffff; }
.badge.unsure { background: rgb(255 159 67 / 0.16); color: var(--unsure); }
.badge.error { background: rgb(255 107 107 / 0.14); color: var(--error); }
.badge.ok { background: rgb(79 209 111 / 0.14); color: var(--todo); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
:root[data-theme="light"] .badge.ok { color: #146c30; }
:root[data-theme="light"] .badge.error { color: #a82222; }
:root[data-theme="light"] .badge.unsure { color: #9a4a00; }

/* ---------- status squares (the world) ---------- */
.sq { --c: var(--done); width: 12px; height: 12px; border-radius: var(--r-square); flex: none; display: inline-block; position: relative; }
.sq.todo { background: var(--todo); }
.sq.glitched { background: var(--glitch); }
.sq.done { box-shadow: inset 0 0 0 2px var(--done); }
.sq.offline { background: var(--offline); transform: scale(0.55); border-radius: 50%; }
.sq.error { background: var(--error); clip-path: polygon(0 0, 100% 0, 100% 62%, 62% 100%, 0 100%); }
.sq.ignored { box-shadow: inset 0 0 0 1.5px var(--offline); opacity: 0.8; }
.sq.busy { background: var(--accent); transform: scale(0.6); border-radius: 50%; animation: breathe 1.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.35; } }
.sq.pulse { animation: pulse 600ms var(--ease); }
@keyframes pulse { 40% { transform: scale(1.45); } }

/* ---------- slots view ---------- */
.filters { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 20px 10px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 15px;
  border: 1px solid var(--line); background: transparent; color: var(--text-2); cursor: pointer; font-weight: 600;
  font-size: var(--t-small); transition: background 150ms, border-color 150ms, color 150ms; }
.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.chip .n { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.chip .sq { width: 10px; height: 10px; }

.strip-area { padding: 0 20px 12px; }
.strip-frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 10px 12px; }
.strip-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; font-size: var(--t-small); }
.strip-head strong { font-weight: 700; }
.strip { display: flex; flex-wrap: wrap; gap: 3px; max-height: 96px; overflow: auto; }
.strip .sq { width: 11px; height: 11px; cursor: pointer; }
.strip .sq:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.strip .sq.offline { transform: scale(0.5); }
.strip-empty { color: var(--text-3); font-size: var(--t-small); }

.actionbar { display: flex; align-items: center; gap: 8px; padding: 0 20px 10px; flex-wrap: wrap; }
.actionbar .sel-count { font-size: var(--t-small); color: var(--text-2); min-width: 92px; }
.queue-pill { font-size: var(--t-small); color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; }
.queue-pill .sq { margin-right: 2px; }

.list-wrap { container-type: inline-size; position: relative; flex: 1; min-height: 0; margin: 0 20px 16px; border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--surface); overflow: hidden; }
.list { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; }
.list-inner { position: relative; }
.grp { position: absolute; left: 0; right: 0; height: var(--head-h); display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--rail); border-bottom: 1px solid var(--line); font-size: var(--t-small); font-weight: 700; color: var(--text-2); }
.grp .n { color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.grp .grp-actions { margin-left: auto; display: flex; gap: 6px; }
.row { position: absolute; left: 0; right: 0; height: var(--row-h); display: grid;
  grid-template-columns: 22px 24px 14px minmax(200px, 1.6fr) minmax(176px, 1fr) 136px minmax(130px, 1fr) auto;
  align-items: center; gap: 12px; padding: 0 12px 0 14px; border-bottom: 1px solid var(--line); cursor: default;
  transition: background 120ms; }
.row:hover { background: var(--surface-hover); }
.row.is-open { background: rgb(108 179 255 / 0.09); }
:root[data-theme="light"] .row.is-open { background: rgb(29 104 199 / 0.06); }
.row.is-ignored .r-name, .row.is-ignored .counts { opacity: 0.6; }
.r-id { min-width: 0; }
.r-name { font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.r-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; min-width: min(9ch, 100%); }
.r-name .badge { flex: none; }
.r-sub { font-size: var(--t-meta); color: var(--text-3); display: flex; gap: 6px; align-items: center; min-width: 0; }
.r-sub .g { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-sub .w { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-sub .w.unsure { color: var(--unsure); }
.r-sub .w.none { color: var(--error); }
.counts { display: flex; gap: 14px; align-items: baseline; min-width: 0; }
.count { display: flex; flex-direction: column; line-height: 1.1; }
.count b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.count span { font-size: 11px; color: var(--text-3); }
.count.todo b { color: var(--todo); }
.count.glitch b { color: var(--glitch); }
.count.hint b { color: var(--hint); }
.count.zero b { color: var(--text-3); }
.prog { display: flex; flex-direction: column; gap: 5px; font-size: var(--t-meta); color: var(--text-2); }
.bar { height: 4px; border-radius: 2px; background: var(--surface-sunk); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--done); border-radius: 2px; transition: width 300ms var(--ease); }
.bar.todo i { background: var(--todo); }
.bar.glitched i { background: var(--glitch); }
.r-state { font-size: var(--t-small); color: var(--text-2); display: flex; align-items: center; gap: 7px; min-width: 0; }
.r-state .msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-state.error { color: var(--error); }
.r-state.go { color: var(--todo); font-weight: 700; }
.r-actions { display: flex; gap: 4px; justify-content: flex-end; }
.r-actions .btn.ghost { color: var(--text-3); }
.row:hover .r-actions .btn.ghost { color: var(--text-2); }

.empty { display: grid; place-items: center; text-align: center; padding: 48px 24px; color: var(--text-2); gap: 10px; }
.empty h2 { margin: 0; font-size: var(--t-section); color: var(--text); }
.empty p { margin: 0; max-width: 52ch; text-wrap: pretty; }

/* ---------- detail panel ---------- */
.detail { position: absolute; top: 0; right: 0; bottom: 32px; width: min(540px, 46%); min-width: 380px; background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 20;
  transform: translateX(0); transition: transform 200ms var(--ease); }
.detail.closing { transform: translateX(102%); }
.d-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px 12px; align-items: start; }
.d-head .sq { width: 16px; height: 16px; margin-top: 5px; }
.d-title { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.d-sub { font-size: var(--t-small); color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }
.d-stats { display: flex; gap: 18px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.d-stats .go { margin-left: auto; font-size: var(--t-small); font-weight: 700; }
.d-name { padding: 10px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; font-size: var(--t-small); flex-wrap: wrap; }
.d-name select { max-width: 260px; height: 28px; }
.d-tools { padding: 10px 18px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--line); }
.d-tools .search .field { width: 100%; }
.d-tools .search { flex: 1 1 220px; }
.d-toggles { display: flex; gap: 4px; flex-wrap: wrap; }
.d-list { flex: 1; overflow: auto; padding: 4px 0 12px; }
.region { border-bottom: 1px solid var(--line); }
.region > button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 18px; border: 0; background: transparent;
  cursor: pointer; font-weight: 700; font-size: var(--t-small); color: var(--text-2); text-align: left; }
.region > button:hover { color: var(--text); }
.region > button .chev { width: 14px; height: 14px; transition: transform 150ms var(--ease); flex: none; }
.region.closed > button .chev { transform: rotate(-90deg); }
.region.closed .locs { display: none; }
.region .n { color: var(--text-3); font-weight: 600; margin-left: auto; font-variant-numeric: tabular-nums; }
.loc { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 6px 18px 6px 30px; font-size: var(--t-body); }
.loc:hover { background: var(--surface-hover); }
.loc .sq { width: 10px; height: 10px; }
.loc .l { overflow-wrap: anywhere; }
.loc .l small { color: var(--text-3); margin-left: 6px; }
.loc .loc-act { opacity: 0; transition: opacity 120ms; }
.loc:hover .loc-act, .loc:focus-within .loc-act { opacity: 1; }
.loc.is-new .l { color: var(--todo); font-weight: 600; }
.loc.hinted .l { color: var(--hint); }
.loc.excluded .l { color: var(--text-3); }
.loc.ignored .l { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.d-foot { padding: 10px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- tables (connexion, presets, apworlds) ---------- */
.section { border-top: 1px solid var(--line); padding: 16px 0 18px; }
.section:first-child { border-top: 0; padding-top: 4px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head h2 { font-size: var(--t-section); margin: 0; font-weight: 700; }
.form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.form-row label.lbl { font-size: var(--t-small); color: var(--text-2); font-weight: 600; }
.room-line { font-size: var(--t-small); color: var(--text-2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-panel); overflow: auto; background: var(--surface); max-height: 520px; }
table.t { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
table.t th { position: sticky; top: 0; background: var(--rail); text-align: left; font-weight: 700; color: var(--text-2);
  padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
table.t td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: var(--surface-hover); }
table.t td.wrap { overflow-wrap: anywhere; }
table.t .field { height: 28px; }
table.t td .unsure { color: var(--unsure); font-weight: 600; }
table.t td .none { color: var(--error); font-weight: 600; }
table.t td .sure { color: var(--text); }
.path { font-size: var(--t-small); color: var(--text); padding: 0 10px; height: 32px; display: inline-flex; align-items: center;
  background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--r-control); min-width: 0; flex: 1 1 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.subtab { border: 0; background: transparent; padding: 8px 12px; cursor: pointer; color: var(--text-2); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.settings-grid { display: grid; gap: 12px; max-width: 760px; }
.setting { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting .s-text b { display: block; font-weight: 600; }
.setting .s-text span { font-size: var(--t-small); color: var(--text-3); }
.journal { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: 12px; line-height: 1.55; white-space: pre-wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 10px 12px; margin: 0;
  color: var(--text-2); overflow: auto; flex: 1; min-height: 0; }
.journal .w { color: var(--glitch); }
.journal .e { color: var(--error); }

/* ---------- toasts / tooltip / status ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; width: 340px; }
.toast { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-panel); box-shadow: var(--shadow);
  padding: 12px 14px; display: grid; grid-template-columns: auto 1fr; gap: 10px; cursor: pointer;
  animation: toast-in 200ms var(--ease); }
.toast .sq { margin-top: 4px; }
.toast b { display: block; font-size: var(--t-body); }
.toast span { font-size: var(--t-small); color: var(--text-2); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--text); color: var(--ground); font-size: var(--t-meta);
  padding: 5px 8px; border-radius: 5px; max-width: 360px; box-shadow: var(--shadow); font-weight: 600; }
.statusbar { height: 32px; display: flex; align-items: center; gap: 12px; padding: 0 20px; font-size: var(--t-meta); color: var(--text-3);
  border-top: 1px solid var(--line); background: var(--rail); }
.statusbar .msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- compact window ---------- */
body.compact .shell { grid-template-columns: 1fr; }
body.compact .rail { display: none; }
.compact-view { display: flex; flex-direction: column; height: 100vh; }
.compact-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; }
.compact-head b { font-size: var(--t-body); }
.compact-strip { padding: 0 12px 10px; }
.compact-list { flex: 1; overflow: auto; padding: 0 8px 10px; }
.c-row { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-control); cursor: pointer; }
.c-row:hover { background: var(--surface-hover); }
.c-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-row .g { font-size: var(--t-meta); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-row b { font-size: 16px; font-variant-numeric: tabular-nums; }
.c-row b.todo { color: var(--todo); }
.c-row b.glitch { color: var(--glitch); }

@container (max-width: 1020px) {
  .row { grid-template-columns: 22px 24px 14px minmax(170px, 1.6fr) minmax(150px, 1fr) minmax(100px, 1fr) auto; }
  .row .prog { display: none; }
}
@container (max-width: 760px) {
  .row { grid-template-columns: 22px 24px 14px minmax(150px, 1fr) minmax(120px, auto) auto; }
  .row .r-state { display: none; }
}
main.has-detail #view-slots { margin-right: min(540px, 46%); transition: margin-right 200ms var(--ease); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ---------- favourites ---------- */
.star { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 0; border-radius: var(--r-control); background: transparent;
  color: var(--text-3); cursor: pointer; padding: 0; transition: color 120ms, background 120ms; }
.star svg { width: 16px; height: 16px; }
.star:hover { color: var(--text); background: var(--surface-hover); }
.star.on { color: var(--accent); }
.star:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row .star { opacity: 0; }
.row:hover .star, .row .star.on, .row .star:focus-visible { opacity: 1; }
.grp.fav { color: var(--text); }
.grp-star { width: 14px; height: 14px; color: var(--accent); flex: none; }
.c-row.fav .nm::before { content: "★ "; color: var(--accent); }
.d-warn { display: flex; gap: 10px; align-items: flex-start; margin: 10px 18px 0; padding: 9px 12px; border-radius: var(--r-control);
  background: rgb(255 159 67 / 0.12); color: var(--text); font-size: var(--t-small); }
.d-warn svg { width: 16px; height: 16px; color: var(--unsure); flex: none; margin-top: 1px; }
.preset-editor > .d-warn { margin: 0 0 12px; }

/* ---------- presets: list + editor ---------- */
.presets-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px 1fr; gap: 0; border-top: 1px solid var(--line); }
.preset-list { overflow: auto; padding: 10px 8px; border-right: 1px solid var(--line); background: var(--rail); display: flex; flex-direction: column; gap: 2px; }
.p-item { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: start; text-align: left; border: 0; background: transparent;
  color: var(--text); padding: 9px 10px; border-radius: var(--r-control); cursor: pointer; font: inherit; }
.p-item .sq { margin-top: 4px; }
.p-item:hover { background: var(--surface-hover); }
.p-item[aria-current="true"] { background: var(--accent-soft); }
.p-item[aria-current="true"] b { color: var(--accent); }
.p-txt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.p-txt b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-txt small { font-size: var(--t-meta); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-txt small.faint { color: var(--text-3); }
.p-foot { margin-top: auto; padding: 10px 6px 2px; font-size: var(--t-meta); }
.preset-editor { padding-top: 16px; max-width: 1180px; }
.preset-editor table.t td.wrap { min-width: 110px; }
.preset-editor table.t td.file { white-space: nowrap; font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: 12px; }
.pe-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pe-name.field { font-size: 18px; font-weight: 700; height: 38px; width: min(420px, 100%); background: transparent; border-color: transparent; padding: 0 8px; margin-left: -8px; }
.pe-name.field:hover { border-color: var(--line); }
.pe-name.field:focus { background: var(--surface-sunk); border-color: var(--accent); }
.folder-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.folder-row .field { flex: 1 1 360px; min-width: 0; }
.field.mono, .mono { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: 12.5px; }
.server-row #pf-host { width: 240px; }
.server-row #pf-port { width: 84px; font-variant-numeric: tabular-nums; }
.server-row #pf-pw { width: 160px; }
.ap-folders { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.ap-folder { display: grid; grid-template-columns: minmax(120px, 200px) 1fr auto auto; gap: 12px; align-items: center; padding: 8px 12px;
  border-bottom: 1px solid var(--line); font-size: var(--t-small); }
.ap-folder:last-child { border-bottom: 0; }
.ap-folder .mono, .ap-folder .faint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 900px) {
  .presets-layout { grid-template-columns: 1fr; }
  .preset-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 180px; }
}
:root[data-theme="light"] .p-item[aria-current="true"] { background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.p-item[aria-current="true"] small.faint { color: var(--text-2); }
.btn.ign { min-width: 78px; justify-content: center; }

