/* glyph — Nytra platform theme (palette and tokens from the Strata console, ADR 0028). No external fonts or assets. */

/* Palette. Dark is the default; the theme code always writes data-theme. */
:root {
  --surface-0: #0d1117;
  --surface-1: #161b22;
  --surface-2: #1c232c;
  --surface-3: #232b35;
  --line: #2b3138;
  --line-strong: #3d444d;
  --fg: #e6edf3;
  --fg-dim: #c3ccd6;
  --fg-faint: #8b949e;
  --accent-base: #4c8dff;
  --danger-base: #f85149;
  --green-base: #3fb950;
  --amber-base: #d29922;
  --primary: #5b97ff;
  --primary-hover: #88b4ff;
  --error: #f9645d;
  --success: #3fb950;
  --warning: #d29922;
  --wash: 14%;
  --shadow-color: rgba(0, 0, 0, 0.4);
  --overlay-bg: rgba(0, 0, 0, 0.7);
  --brand-highlight: #d6e8ff;
  --brand-mark: #79c0ff;
  --brand-mid: #4c8dff;
  --brand-deep: #2563c9;
  /* Chart series: told apart by lightness as well as hue. */
  --series-read: #5b97ff;
  --series-write: #f0883e;
  --series-put: #3fb9a8;
  --series-get: #b083f0;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --surface-0: #ffffff;
  --surface-1: #f6f8fa;
  --surface-2: #eaeef2;
  --surface-3: #dde3ea;
  --line: #d0d7de;
  --line-strong: #afb8c1;
  --fg: #1f2328;
  --fg-dim: #414850;
  --fg-faint: #656d76;
  --accent-base: #0969da;
  --danger-base: #cf222e;
  --green-base: #1a7f37;
  --amber-base: #9a6700;
  --primary: #085dc2;
  --primary-hover: #04408c;
  --error: #b91e29;
  --success: #177031;
  --warning: #865900;
  --wash: 12%;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --overlay-bg: rgba(0, 0, 0, 0.3);
  --brand-highlight: #a5d6ff;
  --brand-mark: #4c8dff;
  --brand-mid: #0969da;
  --brand-deep: #0a3069;
  --series-read: #0969da;
  --series-write: #bc4c00;
  --series-put: #0f7b6c;
  --series-get: #8250df;
  color-scheme: light;
}

/* The terminal font: JetBrainsMono Nerd Font Mono, served by glyph itself
   (as voyd does) so prompts like Starship draw their powerline separators
   and icons on devices without a Nerd Font installed, iPads above all. An
   installed copy is used first. The Mono variant keeps icons one cell wide. */
@font-face {
  font-family: "Glyph Mono";
  src: local("JetBrainsMono NFM"), local("JetBrainsMonoNFM-Regular"),
    url("/fonts/JetBrainsMonoNerdFontMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: "Glyph Mono";
  src: local("JetBrainsMono NFM Bold"), local("JetBrainsMonoNFM-Bold"),
    url("/fonts/JetBrainsMonoNerdFontMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}

/* Semantic tokens: components read these, never the palette. */
:root {
  --bg-primary: var(--surface-0);
  --bg-secondary: var(--surface-1);
  --bg-tertiary: var(--surface-2);
  --bg-hover: var(--surface-3);
  --text-primary: var(--fg);
  --text-secondary: var(--fg-dim);
  --text-muted: var(--fg-faint);
  --border: var(--line);
  --border-strong: var(--line-strong);
  --primary-dim: color-mix(in srgb, var(--accent-base) var(--wash), transparent);
  --error-dim: color-mix(in srgb, var(--danger-base) var(--wash), transparent);
  --success-dim: color-mix(in srgb, var(--green-base) var(--wash), transparent);
  --warning-dim: color-mix(in srgb, var(--amber-base) var(--wash), transparent);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --fast: 0.15s ease;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
html, body { height: 100dvh; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { white-space: pre-wrap; word-break: break-word; margin: 0; }
svg { width: 16px; height: 16px; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-sm); }
::selection { background: var(--primary); color: var(--bg-primary); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.grow { flex: 1; }
.spaced { margin-top: 12px; }
h1 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; }
h2 { margin: 0; font-size: 14px; font-weight: 600; }
h2 .n { margin-left: 8px; font: 400 12px var(--mono); color: var(--text-muted); }
h2.spaced { margin-top: 20px; margin-bottom: 8px; }

/* ---------------------------------------------------------------- shell */

/* The visual viewport height, set by app.js, keeps the terminal above an
   on-screen keyboard. */
.layout { display: flex; height: var(--vvh, 100dvh); overflow: hidden; }
.sidebar {
  width: 236px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 12px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  transition: width 0.16s ease;
}
.brand-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px 14px; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; }
.brand b { font-weight: 700; }
.brand .mark { width: 20px; height: 20px; }
.icon-btn {
  width: 28px; height: 28px; padding: 0; flex-shrink: 0;
  display: grid; place-items: center;
  border: 0; border-radius: var(--radius-md); background: none;
  color: var(--text-muted); cursor: pointer;
  transition: background var(--fast), color var(--fast), opacity 0.12s ease;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { color: var(--text-primary); background: var(--bg-hover); }
.icon-btn.danger:hover { color: var(--error); background: var(--error-dim); }
/* The collapse control is a layout preference: dim until pointed at. */
.collapse-btn { margin-left: auto; opacity: 0.15; }
.collapse-btn:hover, .collapse-btn:focus-visible { opacity: 1; background: var(--bg-tertiary); }

.nav { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-group {
  display: flex; align-items: center; gap: 6px;
  margin: 4px 0 4px; padding: 0 4px 0 10px; min-height: 28px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); white-space: nowrap; overflow: hidden;
}
.nav-group .n { font: 400 11px var(--mono); letter-spacing: 0; }
.nav-group .icon-btn { margin-left: auto; width: 24px; height: 24px; }
.nav-group .icon-btn svg { width: 15px; height: 15px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--fast), color var(--fast);
}
.nav a svg { width: 17px; height: 17px; }
.nav a:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.nav a.active { color: var(--primary); background: var(--primary-dim); }
.nav a.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Double-click renames, so a double-click must not select the name. */
.nav a { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
/* A session's state: amber while reconnecting, red once it is lost. */
.nav .state { margin-left: auto; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--warning); }
.nav .state.err { background: var(--error); }
.nav .viewers { margin-left: auto; padding: 0 6px; border-radius: var(--radius-sm); font: 11px var(--mono); background: var(--bg-hover); color: var(--text-secondary); }
.nav .state + .viewers { margin-left: 6px; }
.nav-empty { padding: 8px 10px; font-size: 12.5px; color: var(--text-muted); }

.foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.foot-row { display: flex; align-items: center; gap: 6px; }
.foot-row .theme-toggle { flex: 1; margin: 0; }
.foot-link {
  width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 7px 10px; border: 0; border-radius: var(--radius-md);
  background: none; color: var(--text-muted); font-size: 13px; text-align: left; cursor: pointer; white-space: nowrap;
  transition: background var(--fast), color var(--fast);
}
.foot-link svg { width: 16px; height: 16px; }
.foot-link:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.theme-toggle { display: flex; gap: 2px; padding: 2px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.theme-toggle button {
  flex: 1; display: grid; place-items: center; padding: 4px 0;
  border: 0; border-radius: 2px; background: none; color: var(--text-muted); cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.theme-toggle button svg { width: 13px; height: 13px; }
.theme-toggle button:hover { color: var(--text-primary); background: var(--bg-hover); }
.theme-toggle button.on { color: var(--primary); background: var(--bg-tertiary); }

/* The accent menu: a footer button that opens a list, like Strata's menus. */
.accent-menu { position: relative; }
.accent-btn .accent-name { margin-left: auto; color: var(--text-muted); font-size: 12px; }
/* In the sidebar the accent is one more segment at the end of the theme
   switch: just its swatch. The menu opens above the whole row. */
.foot-row { position: relative; }
.foot-row .accent-menu { position: static; display: flex; align-self: stretch; }
.foot-row .accent-btn {
  width: auto; gap: 0; padding: 0 9px; align-self: stretch;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-primary);
}
.foot-row .accent-btn .foot-label, .foot-row .accent-btn .chev { display: none; }
.foot-row .accent-btn .sw { margin: 0; }
.foot-row .accent-btn:hover, .foot-row .accent-btn[aria-expanded="true"] { background: var(--bg-hover); }
.accent-btn .chev { display: grid; color: var(--text-muted); transform: rotate(180deg); transition: transform var(--fast); }
.accent-btn .chev svg { width: 12px; height: 12px; }
.accent-btn[aria-expanded="true"] { background: var(--bg-tertiary); color: var(--text-primary); }
.accent-btn[aria-expanded="true"] .chev { transform: none; }
.sw { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
:root[data-theme="light"] .sw { background: var(--sw-light); }
.sw.current, :root[data-theme="light"] .sw.current { background: var(--primary); }
.foot-link .sw { margin: 0 2px; }
.menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); z-index: 50;
  padding: 4px 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 -4px 16px var(--shadow-color);
}
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border: 0; background: none; text-align: left; cursor: pointer;
  color: var(--text-secondary); font-size: 13px;
  transition: background var(--fast), color var(--fast);
}
.menu-item:hover, .menu-item:focus-visible { outline: none; background: var(--bg-tertiary); color: var(--text-primary); }
.menu-item .tick { margin-left: auto; display: grid; color: var(--primary); visibility: hidden; }
.menu-item .tick svg { width: 14px; height: 14px; }
.menu-item.on { color: var(--text-primary); }
.menu-item.on .tick { visibility: visible; }

.mobile-bar, .nav-backdrop { display: none; }

/* Collapsed: a rail of icons; names stay in each link's title. */
@media (min-width: 769px) {
  .collapsed .sidebar { width: 60px; padding: 14px 8px; }
  .collapsed .brand b, .collapsed .nav-label, .collapsed .viewers, .collapsed .foot-label, .collapsed .nav-group span, .collapsed .nav-empty { display: none; }
  /* In the rail the accent button is its swatch; the menu opens beside it. */
  .collapsed .accent-menu .menu { left: calc(100% + 8px); right: auto; bottom: 0; width: 180px; box-shadow: 0 8px 24px var(--shadow-color); }
  .collapsed .foot-row .accent-menu { width: 100%; }
  .collapsed .foot-row .accent-btn { width: 100%; justify-content: center; padding: 7px 0; }
  .collapsed .brand-row { flex-direction: column; gap: 10px; padding: 6px 0 14px; }
  .collapsed .collapse-btn { margin-left: 0; }
  .collapsed .nav a, .collapsed .foot-link { justify-content: center; padding-left: 0; padding-right: 0; }
  .collapsed .nav .state { position: absolute; top: 5px; right: 8px; margin: 0; }
  .collapsed .nav-group { justify-content: center; padding: 0; }
  .collapsed .nav-group .icon-btn { margin: 0; }
  .collapsed .foot-row { flex-direction: column; }
  .collapsed .theme-toggle { flex-direction: column; width: 100%; }
}

/* ---------------------------------------------------------------- terminal pane */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-primary); }
.term-head {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  min-height: 41px; padding: 6px 8px 6px 16px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
}
.term-head h1 { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-head .title { min-width: 0; flex: 1; font: 12px var(--mono); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-head .acts { display: flex; gap: 2px; margin-left: auto; }
.term-stack { position: relative; flex: 1; min-height: 0; }
/* One host per session; only the active one is shown so the rest keep
   their state and sockets. */
.term-host { position: absolute; inset: 0; background: var(--bg-primary); }
.term-host[hidden] { display: none; }
/* The gutter is the terminal element's own padding: the fit addon
   subtracts that, but counts a padded container as usable height, which
   pushed the last row out of view. */
.term-host .xterm { height: 100%; padding: 8px 4px 4px 12px; }
.term-host .xterm-viewport { background: transparent !important; }
.term-host .xterm-viewport::-webkit-scrollbar-thumb { background: var(--border-strong); }
/* Stops iOS gestures fighting the terminal's own scrolling. */
.term-host { touch-action: pan-x pan-y; }

.status {
  position: absolute; top: 10px; left: 50%; z-index: 5; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--radius-md);
  font-size: 12.5px; white-space: nowrap;
  background: var(--warning-dim); color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--amber-base) 30%, transparent);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px var(--shadow-color);
}
.status.err { background: var(--error-dim); color: var(--error); border-color: color-mix(in srgb, var(--danger-base) 30%, transparent); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
.status.err::before { animation: none; }
.status .link { font-size: 12.5px; color: inherit; text-decoration: underline; }
@keyframes pulse { 50% { opacity: 0.3; } }

.empty-state { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.empty-card {
  width: 100%; max-width: 380px; padding: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.empty-card h1 { font-size: 18px; }
.empty-card p { margin: 0 0 6px; font-size: 13px; color: var(--text-muted); }
.empty-card kbd, .dialog kbd {
  padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--radius-sm);
  background: var(--bg-primary); font: 11px var(--mono); color: var(--text-secondary);
}

/* On-screen keys for touch devices: what a phone keyboard lacks. */
.keys {
  display: none; flex-shrink: 0; gap: 6px; overflow-x: auto;
  padding: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  scrollbar-width: none;
}
.keys::-webkit-scrollbar { display: none; }
.touch .keys.on { display: flex; }
/* No terminal, no keys: the empty state takes the whole pane. */
.touch .main.empty .keys { display: none; }
.key {
  flex: none; min-width: 44px; height: 36px; padding: 0 10px;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary);
  font: 500 13px var(--mono); cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.key svg { width: 15px; height: 15px; }
.key:active { background: var(--bg-hover); }
.key.on { border-color: var(--primary); background: var(--primary-dim); color: var(--primary); }
.kb-btn { display: none; }
.touch .kb-btn { display: grid; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 12px; min-width: 5.5rem;
  border: 1px solid var(--primary); border-radius: var(--radius-md);
  background: var(--primary); color: var(--bg-primary);
  font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover:not([disabled]) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.plain { background: var(--bg-tertiary); border-color: var(--border); color: var(--text-primary); }
.btn.plain:hover:not([disabled]) { background: var(--bg-tertiary); border-color: var(--primary); color: var(--primary); }
.btn.danger { background: transparent; border-color: var(--error); color: var(--error); }
.btn.danger:hover:not([disabled]) { background: var(--error); border-color: var(--error); color: var(--bg-primary); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--primary); font-size: 12px; font-weight: 500; cursor: pointer; }
.link:hover { color: var(--primary-hover); text-decoration: underline; }

/* ---------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--text-secondary); }
.field .hint { font-size: 11.5px; color: var(--text-muted); }
.input {
  width: 100%; padding: 6px 10px;
  background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  transition: border-color var(--fast);
}
.input:focus { outline: none; border-color: var(--primary); }
.input::placeholder { color: var(--text-muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.error { margin: 0; font-size: 12px; color: var(--error); }

/* ---------------------------------------------------------------- dialogs */

.overlay {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto;
  display: grid; place-items: center; padding: 16px;
  background: var(--overlay-bg);
}
/* The first heading is the dialog's header; its .actions row is the footer. */
.dialog {
  width: min(440px, 100%);
  padding: 0 20px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px var(--shadow-color);
}
.dialog > h2:first-child { margin: 0 -20px 16px; padding: 14px 20px; font-size: 16px; border-bottom: 1px solid var(--border); }
.dialog p { margin: 0 0 14px; font-size: 13px; color: var(--text-secondary); }
.dialog .actions { margin: 16px -20px -16px; padding: 12px 20px; border-top: 1px solid var(--border); }
.shortcuts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.shortcuts dt { white-space: nowrap; }
.shortcuts dd { margin: 0; color: var(--text-secondary); }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 120;
  padding: 8px 14px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-strong);
  font-size: 13px; box-shadow: 0 8px 24px var(--shadow-color);
}

/* ---------------------------------------------------------------- sign in */

.signin { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px 16px; }
.signin .brand { font-size: 20px; }
.signin .brand .mark { width: 24px; height: 24px; }
.signin-card {
  width: 100%; max-width: 360px; padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.signin-card h1 { font-size: 18px; }
.signin-card p { margin: 2px 0 0; font-size: 13px; }
.signin-card .field { margin: 0; }
.signin-card .btn { width: 100%; }
.signin .fine { max-width: 360px; margin: 0; text-align: center; font-size: 12px; color: var(--text-muted); }
.signin-prefs { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.signin .theme-toggle { width: 120px; }

/* ---------------------------------------------------------------- accounts and tools */

.badge { margin-left: 6px; padding: 0 6px; border-radius: var(--radius-sm); background: var(--primary-dim); color: var(--primary); font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.dialog.wide { width: min(640px, 100%); }
.tool-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.tool { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.tool:first-child { border-top: 0; }
.tool:hover { background: var(--bg-tertiary); }
.tool input { flex: none; margin: 0; }
.tool input:disabled + .tool-main { opacity: 0.75; }
.tool-main { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.tool-state { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--warning); }
.tool.ok .tool-state { color: var(--success); }
.tool-job { margin-top: 12px; }
.tool-job-head { margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.tool-job.running .tool-job-head { color: var(--primary); }
.tool-job.succeeded .tool-job-head { color: var(--success); }
.tool-job.failed .tool-job-head { color: var(--error); }
.tool-log {
  max-height: 220px; overflow: auto; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-primary);
  font: 11.5px/1.5 var(--mono); color: var(--text-secondary); white-space: pre-wrap;
}
.tools-body .error { margin-top: 10px; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 768px) {
  /* Phones: a top bar; the sidebar slides in as a drawer. */
  .layout { flex-direction: column; }
  .mobile-bar {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    padding: 6px 8px; padding-top: calc(6px + env(safe-area-inset-top, 0px));
    background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  }
  .mobile-bar .nav-btn { width: 36px; height: 36px; color: var(--text-secondary); }
  .mobile-bar .here { min-width: 0; flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-bar .icon-btn { width: 36px; height: 36px; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 200;
    width: 260px; transform: translateX(-100%); transition: transform 0.2s ease;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 32px var(--shadow-color); }
  .collapse-btn { display: none; }
  .nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 199; background: rgba(0, 0, 0, 0.5); }
  .term-head { display: none; }
  .term-host .xterm { padding: 4px 2px 2px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
