/* ============================================================
   Terminal.mamosh.top — Bujo Pro theme (Mamosh design contract)
   Tokens + components copied from the Mamosh design system
   (mamosh.top/app/assets/app.css). Per DESIGN-RULES.md this file
   must never drift toward a plain/default look.
   ============================================================ */

/* ---------- tokens (verbatim Mamosh) ---------- */
:root {
  --font-main: "Nunito", system-ui, "Segoe UI", sans-serif;
  --font-hand: "Caveat", "Lalezar", "Vazirmatn", cursive;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wobble: 200px 14px 210px 15px/15px 210px 14px 200px;
  --wobble2: 15px 210px 14px 200px/200px 14px 210px 15px;
  --blob: 48% 52% 50% 50%/52% 48% 52% 48%;
  --ink: #3A3F47;
}
html[data-mode="light"] {
  --bg: #FDFCF8; --bg-soft: #FAF7EF; --card: #FFFDF7;
  --text: #33383F; --text-dim: #666C74; --muted: #A2A7AD;
  --border: var(--ink); --border-soft: rgba(58,63,71,.28);
  --accent: #E85D5D; --accent-2: #3E9EE8; --accent-contrast: #FFFDF7;
  --chip-bg: #F3F0E6;
  --shadow: 1.5px 2px 0 rgba(58,63,71,.15);
  --dot: rgba(60,65,72,.20);
  --tip-bg: #33383F; --tip-text: #FFFDF7;
  --ok: #58B86C; --danger: #D64545; --warn: #B08A20;
  /* terminal surface follows the paper */
  --term-bg: #26221C; --term-fg: #ECE6D9;
}
html[data-mode="dark"] {
  --bg: #211E19; --bg-soft: #2A2620; --card: #2B2721;
  --text: #ECE6D9; --text-dim: #B4AC9C; --muted: #7E776A;
  --border: #C9C1B0; --border-soft: rgba(201,193,176,.3);
  --accent: #F07B6F; --accent-2: #6CB8EC; --accent-contrast: #211E19;
  --chip-bg: #332E26;
  --shadow: 1.5px 2px 0 rgba(0,0,0,.45);
  --dot: rgba(236,230,217,.10);
  --tip-bg: #ECE6D9; --tip-text: #211E19;
  --ok: #58B86C; --danger: #D64545; --warn: #D9AE2E;
  --ink: #C9C1B0;
  --term-bg: #1B1915; --term-fg: #E4DECF;
}

/* ---------- base (verbatim) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: var(--border-soft) transparent; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--dot) 1.1px, transparent 1.3px);
  background-size: 19px 19px;
  color: var(--text); font-family: "Vazirmatn", var(--font-main);
  font-size: 15.5px; line-height: 1.55; min-height: 100vh;
  transition: background-color .3s, color .3s;
}
html[lang="en"] body { font-family: var(--font-main); font-size: 14.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
svg.ico { display: block; flex: none; }
[data-ico] { display: inline-flex; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
* { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- designed scrollbars (verbatim) ---------- */
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track, *::-webkit-scrollbar-corner { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 30%, var(--border-soft));
  border-radius: 99px; border: 2px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--accent); background-clip: padding-box; }

/* ---------- buttons / fields / cards (verbatim) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border: 2px solid var(--border); border-radius: var(--wobble);
  background: var(--card); font-weight: 800; font-size: 14px; box-shadow: var(--shadow);
  transition: transform .15s ease, background-color .2s, color .2s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-contrast); }
.btn.subtle { background: var(--chip-bg); }
.btn.danger { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn.sm { padding: 7px 13px; font-size: 12.5px; }
.btn svg { width: 17px; height: 17px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-icon {
  min-width: 42px; height: 42px; padding: 0 13px; border-radius: var(--wobble);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; font-weight: 700;
  background: var(--card); color: var(--text);
  border: 2px solid var(--border); box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.btn-icon:active { transform: translateY(1px); }
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon.sm { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 12px; box-shadow: none; border-width: 2px; }
.btn-icon.sm svg { width: 15px; height: 15px; }
.btn-icon.danger { color: var(--danger); }

.card {
  background: var(--card); border: 2px solid var(--border); border-radius: var(--wobble);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card:nth-child(2n) { border-radius: var(--wobble2); }
.card h3 {
  margin: 0 0 12px; font-family: var(--font-hand); font-size: 21px; font-weight: 700;
  transform: rotate(-.5deg); display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 800; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field select, .field textarea, .input, textarea.input {
  width: 100%; padding: 12px 14px; font-size: 16px; /* no iOS zoom */
  font-family: inherit; font-weight: inherit;
  background: var(--bg-soft); border: 2px solid var(--border-soft); border-radius: 10px;
  color: var(--text); transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus,
textarea.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.form-error { color: var(--danger); font-size: 13px; font-weight: 700; min-height: 20px; margin: 4px 0; }
.ltr-in { direction: ltr; text-align: start; }
textarea.mono { direction: ltr; text-align: left; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; }

.seg { display: inline-flex; background: var(--chip-bg); border: 2px solid var(--border-soft); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 800; color: var(--text-dim); }
.seg button.active { background: var(--accent); color: var(--accent-contrast); }
.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px;
  border: 2px solid var(--border-soft); border-radius: var(--wobble2);
  font-size: 13px; font-weight: 800; color: var(--text-dim); background: var(--card);
  transition: all .18s ease;
}
.chip.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 800; padding: 1px 9px; border-radius: 9999px;
  border: 1.5px solid var(--border-soft); color: var(--text-dim);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.err { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }

/* ---------- designed controls (verbatim) ---------- */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field select, select.input {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2333383F' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: left 14px center; padding-inline-start: 40px;
}
html[data-mode="dark"] .field select, html[data-mode="dark"] select.input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23C9C1B0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(30,28,22,.42); z-index: 200;
  display: grid; place-items: center; padding: 18px; animation: modalFade .18s ease;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: min(440px, 100%); max-height: 92dvh; overflow-y: auto;
  background: var(--card); border: 2px solid var(--border);
  border-radius: var(--wobble); box-shadow: var(--shadow); padding: 20px;
  animation: modalPop .16s ease;
}
.modal-card:nth-child(2n) { border-radius: var(--wobble2); }
@keyframes modalPop { from { transform: scale(.96) rotate(-.4deg); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-card h3 { margin: 0 0 12px; font-family: var(--font-hand); font-size: 22px; font-weight: 700; transform: rotate(-.5deg); }
.modal-card .modal-text { font-size: 13.5px; color: var(--text-dim); margin-bottom: 14px; overflow-wrap: anywhere; }
.modal-acts { display: flex; gap: 8px; margin-top: 14px; }
.modal-acts .btn { flex: 1; }
.fp-box {
  direction: ltr; text-align: left; font-family: var(--font-mono); font-size: 11.5px;
  background: var(--bg-soft); border: 1.5px dashed var(--border-soft); border-radius: 8px;
  padding: 8px 10px; overflow-wrap: anywhere; margin: 6px 0;
}
.fp-box b { color: var(--danger); } .fp-box.new b { color: var(--ok); }

/* toast + tip (verbatim) */
#toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(8px); z-index: 300;
  background: var(--tip-bg); color: var(--tip-text);
  padding: 10px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease; max-width: 88vw; text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#tip { position: fixed; z-index: 99; pointer-events: none; background: var(--tip-bg); color: var(--tip-text);
  padding: 7px 11px; border-radius: 10px; font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 8px 24px rgba(0,0,0,.28); opacity: 0; transform: translateY(4px);
  transition: opacity .15s, transform .15s; }
#tip.on { opacity: 1; transform: translateY(0); }

/* ============================================================
   LOGIN (cloned anatomy)
   ============================================================ */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); padding: 26px 24px 22px; margin: 0; }
.login-logo { display: flex; justify-content: center; margin-bottom: 10px; }
.login-logo img { width: 72px; height: 72px; filter: drop-shadow(0 2px 6px rgba(30,28,22,.18)); }
.login-title { text-align: center; font-family: var(--font-hand); font-size: 32px; font-weight: 700; transform: rotate(-1deg); margin: 0 0 2px; }
.login-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin: 0 0 18px; }
.login-topbar { position: fixed; top: 14px; inset-inline-end: 14px; display: flex; gap: 8px; z-index: 20; }
html[data-mode="dark"] .i-sun { display: block; } html[data-mode="dark"] .i-moon { display: none; }
html[data-mode="light"] .i-sun { display: none; } html[data-mode="light"] .i-moon { display: block; }
.pw-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.pw-toggle { background: none; border: none; color: var(--muted); cursor: pointer; padding: 3px; border-radius: 7px; display: inline-flex; }
.pw-toggle:hover { color: var(--text); }
.pw-wrap { position: relative; }
.ver-foot-plain { text-align: center; margin-top: 12px; font-size: 10.5px; color: var(--muted); direction: ltr; }
.brand-name { font-family: var(--font-hand); font-size: 26px; font-weight: 700; transform: rotate(-1.5deg); display: inline-block; }

/* ============================================================
   APP SHELL
   ============================================================ */
.shell { display: grid; grid-template-columns: 320px 1fr; height: 100dvh; }

.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  padding: 16px 14px; overflow-y: auto;
  scrollbar-width: thin;
  border-inline-end: 2px dashed var(--border-soft);
  background: color-mix(in srgb, var(--bg-soft) 55%, transparent);
}
.sidebar-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sidebar-head img { width: 42px; height: 42px; border-radius: 10px; }
.sidebar-head .who { min-width: 0; flex: 1; }
.sidebar-head .who b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; text-align: start; }
.sidebar-head .who span { font-size: 11.5px; color: var(--muted); }

.conn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.conn-item { position: relative; }
.conn-btn {
  width: 100%; text-align: start; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 2px solid var(--border); border-radius: 17px 15px 18px 14px/14px 18px 15px 17px;
  box-shadow: var(--shadow); padding: 12px 13px; transition: transform .15s ease;
  cursor: pointer; user-select: none;
}
.conn-item:nth-child(2n) .conn-btn { border-radius: 15px 17px 14px 18px/18px 14px 17px 15px; }
.conn-btn:hover { transform: translateY(-1px); }
.conn-btn.active { border-color: var(--accent); }
.conn-btn .c-ico {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  background: var(--chip-bg); border: 2px solid var(--border-soft); border-radius: var(--blob);
  color: var(--accent); transform: rotate(-2deg);
}
.conn-btn .c-meta { min-width: 0; flex: 1; }
.conn-btn .c-name { display: block; font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; text-align: start; }
.conn-btn .c-host { display: block; direction: ltr; unicode-bidi: isolate; text-align: start; font-family: var(--font-mono); font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-btn .c-acts { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.conn-btn:hover .c-acts, .conn-btn:focus-within .c-acts { opacity: 1; }
@media (pointer: coarse) { .conn-btn .c-acts { opacity: 1; } }

.sidebar-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 2px dashed var(--border-soft);
}
.topbar .spacer { flex: 1; }
.only-mobile { display: none; }

/* tabs — wobble chips like mamosh .tab */
.tabbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px 4px;
  overflow-x: auto; scrollbar-width: none; flex: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 7px 12px; border: 2px solid var(--border-soft); border-radius: var(--wobble);
  background: var(--card); font-size: 12.5px; font-weight: 800; color: var(--text-dim);
}
.tab:nth-child(2n) { border-radius: var(--wobble2); }
.tab.active { border-color: var(--accent); color: var(--accent); transform: rotate(-.6deg); }
.tab .t-close { display: inline-flex; padding: 2px; border-radius: 6px; color: inherit; opacity: .65; }
.tab .t-close:hover { opacity: 1; background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.tab .t-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.tab.connected .t-dot { background: var(--ok); }
.tab.error .t-dot { background: var(--danger); }
.tab.connecting .t-dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* terminal stage */
.stage { flex: 1; min-height: 0; position: relative; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
.term-pane { position: absolute; inset: 10px 14px calc(10px + env(safe-area-inset-bottom)); display: none; }
.term-pane.active { display: block; }
.term-frame {
  position: absolute; inset: 0; overflow: hidden;
  border: 2px solid var(--border); border-radius: 14px 12px 15px 13px/13px 15px 12px 14px;
  box-shadow: var(--shadow); background: var(--term-bg);
}
.term-frame .xterm { position: absolute; inset: 8px; }
.empty-stage {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px;
}
.empty-stage .big { font-family: var(--font-hand); font-size: clamp(30px, 5vw, 44px); font-weight: 700; transform: rotate(-1deg); display: inline-block; line-height: 1.2; }
.empty-stage .sub { color: var(--text-dim); font-size: 13px; max-width: 340px; }
.empty-stage .art { font-size: 54px; color: var(--accent); opacity: .85; transform: rotate(-4deg); }

.statusbar {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
  border-top: 2px dashed var(--border-soft);
  font-size: 11.5px; color: var(--text-dim); min-height: 30px;
}
.statusbar .st-name { font-weight: 800; unicode-bidi: plaintext; }
.statusbar .st-host { direction: ltr; unicode-bidi: isolate; font-family: var(--font-mono); font-size: 10.5px; }
.statusbar .spacer { flex: 1; }
.statusbar .st-rtt { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* xterm chrome overrides — themed scrollbars inside the terminal frame */
.term-frame .xterm-viewport { scrollbar-width: thin; }
.xterm .xterm-screen { z-index: 0; }
.xterm-decoration-container { display: none; }

/* SFTP bottom sheet (ed-sheet pattern, verbatim geometry) */
.ed-backdrop { position: fixed; inset: 0; background: rgba(20,17,12,.45); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .25s; }
.ed-backdrop.on { opacity: 1; pointer-events: auto; }
.ed-sheet {
  position: fixed; z-index: 81; inset-inline: 0; bottom: 0; height: min(72dvh, 640px);
  display: flex; flex-direction: column;
  background: var(--card); border-top: 2.5px solid var(--border); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(14px + env(safe-area-inset-bottom, 0));
  transform: translateY(105%); transition: transform .3s cubic-bezier(.2,.7,.3,1);
}
.ed-sheet.on { transform: translateY(0); }
.ed-grab { width: 44px; height: 5px; border-radius: 99px; background: var(--border-soft); margin: 4px auto 10px; flex: none; }
.ed-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ed-head h3 { margin: 0; font-family: var(--font-hand); font-size: 24px; transform: rotate(-.5deg); }
.ed-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 12px; direction: ltr; justify-content: flex-start; }
.crumb { padding: 3px 7px; border-radius: 8px; color: var(--accent-2); font-weight: 700; }
.crumb:hover { background: var(--chip-bg); }
.crumb-sep { color: var(--muted); }

.file-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 8px -4px 0; padding: 0 4px; }
.file-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  padding: 9px 10px; border-radius: 10px; border: 1.5px solid transparent;
}
.file-row:hover { background: var(--chip-bg); }
.file-row .f-ico { color: var(--warn); flex: none; }
.file-row.dir .f-ico { color: var(--accent-2); }
.file-row .f-name { flex: 1; min-width: 0; direction: ltr; unicode-bidi: plaintext; text-align: start; font-family: var(--font-mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .f-size { flex: none; direction: ltr; unicode-bidi: isolate; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.file-row .f-acts { flex: none; display: flex; gap: 2px; opacity: 0; }
.file-row:hover .f-acts, .file-row:focus-within .f-acts { opacity: 1; }
.drop-hint {
  border: 2px dashed var(--accent); border-radius: 12px;
  outline: 2px dashed transparent;
}
.sheet.dragging-over .file-list { outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: 12px; opacity: .75; }
.up-progress { flex: none; font-size: 12px; color: var(--text-dim); min-height: 18px; padding: 2px 4px; }

/* user rows in the admin sheet */
.u-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1.5px dashed var(--border-soft); }
.u-row:last-child { border-bottom: 0; }
.u-row .u-name { flex: 1; min-width: 0; font-weight: 800; font-size: 14px; unicode-bidi: plaintext; text-align: start; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .only-mobile { display: inline-flex; }
  /* the wide lang chip overflows the mobile topbar — it lives in the sidebar */
  #langBtn2 { display: none; }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 90;
    width: min(320px, 88vw);
    transform: translateX(-105%);
    transition: transform .22s ease;
    background: var(--bg);
    border-inline-end: 2px solid var(--border);
  }
  /* RTL: sidebar is anchored at the inline-start (right) — slide it further right */
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open { overflow: hidden; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 89; background: rgb(0 0 0 / .5); }
  .stage { padding-inline: 8px; }
  .term-pane { inset-inline: 8px; }
  .topbar { padding: 8px 10px; }
  .statusbar .st-host { display: none; }
  .modal-backdrop { padding: 10px; }
}
