:root {
  --bg: #0a0c10;
  --bg-1: #0f1218;
  --bg-2: #151921;
  --bg-3: #1c2129;
  --bg-4: #252b35;
  --border: #232831;
  --border-strong: #2f3540;
  --fg: #e8eaed;
  --fg-mid: #aab1bd;
  --fg-dim: #7a8290;
  --fg-faint: #4a5260;

  --accent: #7aa2f7;
  --accent-2: #a78bfa;
  --accent-glow: rgba(122, 162, 247, 0.18);
  --accent-strong: #5b8df0;

  --green: #2bd97f;
  --green-glow: rgba(43, 217, 127, 0.16);
  --red: #ef5d6f;
  --red-glow: rgba(239, 93, 111, 0.14);
  --yellow: #f0b86e;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;

  --radius: 8px;
  --radius-lg: 12px;
  --radius-sm: 6px;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-glow: 0 0 0 1px var(--accent-glow), 0 0 24px var(--accent-glow);

  --t: 160ms cubic-bezier(0.2, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*::selection { background: var(--accent-glow); color: var(--fg); }

html, body {
  height: 100%;
  background:
    radial-gradient(circle at 20% 0%, rgba(122, 162, 247, 0.04), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(167, 139, 250, 0.03), transparent 50%),
    var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  font-feature-settings: "cv11", "ss01";
  overflow: hidden;
}

button {
  background: var(--bg-3);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--t);
}
button:hover {
  background: var(--bg-4);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
button:active { transform: translateY(0); }
button.primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #0a0c10;
  border-color: transparent;
  font-weight: 600;
}
button.primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.icon-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-mid);
  cursor: pointer;
  transition: all var(--t);
}
.icon-btn:hover {
  background: var(--bg-3);
  color: var(--fg);
  border-color: var(--border-strong);
}

input, textarea {
  background: var(--bg-1);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: all var(--t);
}
input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder, textarea::placeholder { color: var(--fg-faint); }

kbd {
  display: inline-block;
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-mid);
  line-height: 1.2;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 18, 24, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: relative;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .logo {
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.brand-text {
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 15px;
}
.brand-dim { color: var(--fg-dim); font-weight: 500; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-pill {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
}
.stat-num { font-weight: 700; color: var(--green); }
.stat-label { color: var(--fg-dim); }

.conn-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--fg-mid);
}
.conn-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 6px currentColor;
}
.conn-pill.online { color: var(--green); border-color: rgba(43, 217, 127, 0.25); }
.conn-pill.online .conn-dot { background: var(--green); }
.conn-pill.offline { color: var(--red); border-color: rgba(239, 93, 111, 0.25); }
.conn-pill.offline .conn-dot { background: var(--red); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}
.conn-pill.connecting .conn-dot { animation: pulse-dot 1.4s ease-in-out infinite; }

/* ── Layout ─────────────────────────────────────────────────────────────── */

.layout {
  --sidebar-w: 280px;
  --chat-w: 380px;
  height: calc(100vh - 52px);
  display: grid;
  grid-template-columns: var(--sidebar-w) 4px 1fr 4px var(--chat-w);
  gap: 0;
}

.sidebar, .main-panel, .chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.chat-panel { background: var(--bg-1); position: relative; }

.resize-handle {
  background: var(--border);
  cursor: col-resize;
  transition: background var(--t);
  position: relative;
  z-index: 4;
  user-select: none;
}
.resize-handle::before {
  content: "";
  position: absolute;
  inset: 0 -3px;     /* widen the hit area to 10px without changing layout */
}
.resize-handle:hover,
.resize-handle.dragging {
  background: var(--accent);
}
body.resizing-cols,
body.resizing-cols * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.search-wrap {
  flex: 1;
  position: relative;
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-faint);
  font-size: 14px;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 7px 32px 7px 30px;
  font-size: 12.5px;
}
.kbd-hint {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.machine-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.machine {
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
  transition: all var(--t);
  position: relative;
}
.machine:hover {
  background: var(--bg-2);
  border-color: var(--border);
}
.machine.active {
  background: var(--bg-2);
  border-color: var(--accent-strong);
  box-shadow: var(--shadow-glow);
}
.machine.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 0 3px 3px 0;
}

.machine-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.os-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}
.os-icon-img {
  display: block;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}
/* OS-specific tint — pulled from each project's brand mark */
.os-macos    { color: #d6d6d6; }
.os-windows  { color: #00a4ef; }
.os-ubuntu   { color: #e95420; }
.os-debian   { color: #d70a53; }
.os-fedora   { color: #294172; }
.os-arch     { color: #1793d1; }
.os-alpine   { color: #0d597f; }
.os-redhat   { color: #ee0000; }
.os-linux    { color: #f0b86e; }
.os-unknown  { color: var(--fg-faint); }

.machine-header-title .os-icon { width: 16px; height: 16px; }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.machine.online .status-dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow), 0 0 0 2px rgba(43, 217, 127, 0.18);
}
.machine.offline .status-dot {
  background: var(--fg-faint);
  opacity: 0.6;
}

.machine-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--fg);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.machine-os-glyph {
  font-size: 11px;
  color: var(--fg-dim);
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.machine-meta {
  font-size: 11.5px;
  color: var(--fg-dim);
  margin-top: 4px;
  margin-left: 16px;
}

.machine-stats {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  margin-left: 16px;
}
.machine-disk {
  margin-top: 8px;
  margin-left: 16px;
}
.machine-disk .stat-block-label { font-size: 10.5px; }
.stat-block {
  flex: 1;
  font-size: 10.5px;
}
.stat-block-label {
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
  margin-bottom: 3px;
  display: flex;
  justify-content: space-between;
}
.stat-block-val { color: var(--fg-mid); font-weight: 600; }
.stat-bar {
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  transition: width 600ms cubic-bezier(0.2, 0, 0.2, 1);
}
.stat-bar-fill.warn { background: linear-gradient(90deg, var(--yellow), #ff9a3d); }
.stat-bar-fill.danger { background: linear-gradient(90deg, #ff7a8a, var(--red)); }

/* ── Empty states ───────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-dim);
}
.empty-icon {
  font-size: 36px;
  color: var(--fg-faint);
  margin-bottom: 8px;
  font-weight: 100;
}
.empty-text { font-size: 13px; color: var(--fg-mid); margin-bottom: 4px; }
.empty-sub { font-size: 11.5px; color: var(--fg-dim); }

/* ── Main panel ─────────────────────────────────────────────────────────── */

.main-head {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
}
.machine-header {
  padding: 14px 20px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.machine-header-text {
  flex: 1;
  min-width: 0;
}
.machine-header-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.machine-header-sub {
  font-size: 11.5px;
  color: var(--fg-dim);
  margin-top: 2px;
}
.machine-header-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.machine-header-status.online {
  background: var(--green-glow);
  color: var(--green);
}
.machine-header-status.offline {
  background: var(--red-glow);
  color: var(--red);
}

.tabs {
  display: flex;
  padding: 0 16px;
  gap: 2px;
}
.tab {
  background: none;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--fg-dim);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 7px;
  position: relative;
  bottom: -1px;
  border-bottom: 2px solid transparent;
  transform: none !important;
}
.tab:hover { color: var(--fg-mid); background: var(--bg-2); }
.tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
  background: var(--bg);
}
.tab-glyph {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.7;
}

.tab-content {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.tab-content.active { display: flex; }

/* ── PTY terminal (xterm.js) ────────────────────────────────────────────── */

.term-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  font-size: 12px;
}
.term-bar-label {
  color: var(--fg-mid);
  font-family: var(--mono);
  font-size: 12px;
}
.term-bar-actions { display: flex; gap: 6px; }

.xterm-host {
  flex: 1;
  background: var(--bg);
  padding: 8px 10px;
  overflow: hidden;
  position: relative;
  min-height: 0;
}
.xterm-host .xterm {
  width: 100%;
  height: 100%;
}
.xterm-host .xterm-viewport {
  background: var(--bg) !important;
}

/* ── Legacy terminal (kept for fallback) ────────────────────────────────── */

.term-output {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  background:
    radial-gradient(circle at 0% 0%, rgba(122, 162, 247, 0.025), transparent 60%),
    var(--bg);
}
.term-hint {
  color: var(--fg-dim);
  font-size: 11.5px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--sans);
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.term-hint strong { color: var(--fg-mid); font-weight: 600; }
.term-hint-keys { display: flex; gap: 4px; align-items: center; }

.term-block { margin-bottom: 12px; animation: slide-in 200ms ease-out; }
@keyframes slide-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.term-cmd {
  color: var(--accent);
  font-weight: 600;
  display: flex;
  gap: 8px;
}
.term-cmd::before { content: "$"; color: var(--accent-2); flex-shrink: 0; }
.term-stdout { color: var(--fg); white-space: pre-wrap; word-wrap: break-word; padding-left: 16px; }
.term-stderr { color: var(--red); white-space: pre-wrap; word-wrap: break-word; padding-left: 16px; }
.term-meta {
  color: var(--fg-faint);
  font-size: 11px;
  padding-left: 16px;
  margin-top: 4px;
  font-family: var(--sans);
}
.term-meta-ok { color: var(--green); }
.term-meta-err { color: var(--red); }
.term-pending {
  color: var(--fg-dim);
  padding-left: 16px;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
}
.term-pending::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.term-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-1);
}
.prompt-glyph {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
}
.term-input-bar input {
  flex: 1;
  font-family: var(--mono);
  background: var(--bg);
  font-size: 13px;
}
.run-btn {
  background: var(--bg-3);
  font-family: var(--mono);
  padding: 7px 18px;
}

/* ── File manager ───────────────────────────────────────────────────────── */

.fm-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}
.fm-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--fg-mid);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--t);
}
.fm-btn:hover {
  background: var(--bg-3);
  color: var(--fg);
  border-color: var(--border-strong);
}
.fm-btn.primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #0a0c10;
  border-color: transparent;
  font-weight: 600;
}
.fm-btn.primary:hover { filter: brightness(1.1); box-shadow: 0 4px 14px var(--accent-glow); }

.fm-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
  font-family: var(--mono);
  font-size: 12px;
  min-width: 0;
}
.fm-crumb {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--fg-mid);
  transition: all var(--t);
  flex-shrink: 0;
}
.fm-crumb:hover { background: var(--bg-2); color: var(--fg); }
.fm-crumb.last { color: var(--fg); cursor: default; }
.fm-crumb.last:hover { background: transparent; }
.fm-sep { color: var(--fg-faint); flex-shrink: 0; }

.fm-dropzone {
  flex: 1;
  position: relative;
  overflow: auto;
  background: var(--bg);
}
.fm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.fm-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 9px 14px;
  color: var(--fg-dim);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 1;
}
.fm-table tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t);
}
.fm-table tbody tr:hover { background: var(--bg-2); }
.fm-table tbody td {
  padding: 8px 14px;
  vertical-align: middle;
}
.col-name { width: auto; }
.col-size { width: 100px; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--fg-mid); white-space: nowrap; }
.col-mtime { width: 150px; font-size: 12px; color: var(--fg-mid); white-space: nowrap; }
.col-perm { width: 70px; font-family: var(--mono); font-size: 11px; color: var(--fg-dim); }
.col-actions { width: 110px; text-align: right; }

.fm-row-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
}
.fm-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 14px;
}
.fm-icon.dir { color: var(--accent); }
.fm-icon.file { color: var(--fg-dim); }
.fm-name-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fm-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity var(--t);
}
.fm-table tbody tr:hover .fm-actions { opacity: 1; }
.fm-action-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-dim);
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all var(--t);
}
.fm-action-btn:hover {
  background: var(--bg-3);
  color: var(--fg);
  border-color: var(--border-strong);
  transform: none;
}
.fm-action-btn.danger:hover { color: var(--red); border-color: var(--red); }

.fm-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}
.fm-dropzone.dragging .fm-drop-overlay { display: flex; }
.fm-drop-card {
  background: var(--bg-2);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  padding: 40px 60px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  box-shadow: 0 0 40px var(--accent-glow);
}
.fm-drop-icon { font-size: 36px; margin-bottom: 8px; }

.fm-editor {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  z-index: 10;
}
.fm-editor.hidden { display: none; }
.fm-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  gap: 8px;
}
.fm-editor-head > div:last-child { display: flex; gap: 6px; }
.fm-editor-path {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg-mid);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#fmEditorTextarea {
  flex: 1;
  resize: none;
  border-radius: 0;
  border: none;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 16px 20px;
  line-height: 1.55;
}
#fmEditorTextarea:focus { box-shadow: none; }

.modal-card button.danger {
  background: linear-gradient(180deg, var(--red) 0%, #c14654 100%);
  color: white;
}

/* ── Screenshot ─────────────────────────────────────────────────────────── */

.screenshot-bar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}
.screenshot-view {
  flex: 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
}
.screenshot-view img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}

/* ── Chat ───────────────────────────────────────────────────────────────── */

/* Minimal chat header — just a tiny meta line + a settings button */
.chat-head.minimal {
  padding: 10px 14px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  border: none;
}
.chat-head-meta {
  font-size: 11.5px;
  color: var(--fg-dim);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-head-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-dim);
  padding: 5px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
}
.chat-head-btn:hover {
  background: var(--bg-2);
  color: var(--fg);
  border-color: var(--border);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg-intro {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(167, 139, 250, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: var(--radius);
}
.msg-intro-glyph {
  font-size: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex-shrink: 0;
  line-height: 1;
}
.msg-intro-text {
  font-size: 12.5px;
  color: var(--fg-mid);
  line-height: 1.55;
}

.msg {
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: slide-in 200ms ease-out;
}

/* User: small chip, mauve accent, top-right (no pure white text — easier on eyes) */
.msg-user {
  background: rgba(167, 139, 250, 0.18);
  color: var(--fg);
  border: 1px solid rgba(167, 139, 250, 0.25);
  align-self: flex-end;
  max-width: 80%;
  padding: 8px 14px;
  border-radius: 14px;
  border-top-right-radius: 6px;
  font-weight: 500;
  font-size: 13px;
}

/* Assistant: no bubble, full width, just floats on the panel background */
.msg-assistant {
  background: transparent;
  border: none;
  align-self: stretch;
  max-width: 100%;
  padding: 0 2px;
  color: var(--fg);
}

.msg-system {
  background: transparent;
  color: var(--fg-dim);
  font-size: 11.5px;
  font-style: italic;
  text-align: center;
  padding: 6px;
}
.msg-system.error {
  color: var(--red);
  background: var(--red-glow);
  border-radius: var(--radius-sm);
  font-style: normal;
  text-align: left;
  padding: 8px 12px;
  font-style: normal;
}

.msg-stream {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: stretch;
  max-width: 100%;
}
.msg-stream .msg-assistant {
  align-self: flex-start;
  max-width: 92%;
}

/* ── Markdown styling ───────────────────────────────────────────────────── */

.md p { margin: 0 0 8px 0; }
.md p:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 {
  font-weight: 700;
  margin: 12px 0 6px 0;
  line-height: 1.3;
}
.md h1 { font-size: 18px; }
.md h2 { font-size: 16px; }
.md h3 { font-size: 14.5px; }
.md h4, .md h5, .md h6 { font-size: 13px; }
.md strong { font-weight: 700; color: var(--fg); }
.md em { font-style: italic; }
.md code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(122,162,247,0.12);
  color: var(--accent);
  padding: 1.5px 5px;
  border-radius: 3px;
}
.md pre {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}
.md pre code {
  background: none;
  color: var(--fg);
  padding: 0;
  font-size: inherit;
}
.md ul, .md ol { margin: 4px 0 8px 22px; padding: 0; }
.md ul li, .md ol li { margin: 3px 0; }
.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.md a:hover { color: var(--accent-2); }
.md blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: 10px;
  margin: 6px 0;
  color: var(--fg-mid);
}
.md hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
.md table { border-collapse: collapse; margin: 8px 0; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 9px; font-size: 12.5px; }
.md th { background: var(--bg-3); font-weight: 600; }

/* ── Tool cards ─────────────────────────────────────────────────────────── */

.tool-card {
  align-self: flex-start;
  max-width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--radius);
  overflow: hidden;
  animation: slide-in 200ms ease-out;
  transition: border-color var(--t);
}
.tool-card.running { border-left-color: var(--accent-2); }
.tool-card.ok { border-left-color: var(--green); }
.tool-card.err { border-left-color: var(--red); }

.tool-card-head {
  padding: 8px 12px;
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
}
.tool-card-glyph {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-2);
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}
.tool-card.ok .tool-card-glyph { color: var(--green); }
.tool-card.err .tool-card-glyph { color: var(--red); }
.tool-card-name {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--fg);
  flex-shrink: 0;
}
.tool-card-summary {
  flex: 1;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tool-card.ok .tool-card-summary { color: var(--green); }
.tool-card.err .tool-card-summary { color: var(--red); }

.tool-card-chevron {
  color: var(--fg-faint);
  font-size: 10px;
  transition: transform var(--t);
  flex-shrink: 0;
}
.tool-card.expanded .tool-card-chevron { transform: rotate(90deg); }

.tool-card-spinner {
  display: none;
  width: 12px; height: 12px;
  border: 2px solid var(--bg-4);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tool-spin 700ms linear infinite;
  flex-shrink: 0;
}
.tool-card.running .tool-card-spinner { display: inline-block; }
@keyframes tool-spin {
  to { transform: rotate(360deg); }
}

/* ── Approval state ────────────────────────────────────────────────── */
.tool-card.needs-approval {
  border-left-color: #f0ad4e;
  background: rgba(240, 173, 78, 0.05);
}
.tool-card.needs-approval .tool-card-glyph { color: #f0ad4e; }
.tool-approval-bar {
  background: rgba(240, 173, 78, 0.08);
  border-top: 1px solid rgba(240, 173, 78, 0.4);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}
.tool-approval-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
}
.tool-approval-icon {
  color: #f0ad4e;
  font-size: 16px;
  flex-shrink: 0;
}
.tool-approval-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--fg-dim);
  cursor: pointer;
  user-select: none;
}
.tool-approval-checkbox input { margin: 0; cursor: pointer; }
.tool-approval-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.tool-approval-actions button {
  padding: 5px 14px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--fg);
  cursor: pointer;
  font-size: 12px;
}
.tool-approval-actions button:hover { background: var(--bg-3, var(--bg-1)); }
.tool-approval-actions button.primary {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}
.tool-approval-actions button.primary:hover { filter: brightness(1.1); }

/* ── Settings: divider + danger-mode toggle ───────────────────────── */
.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0 6px;
}
.settings-toggle {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  cursor: pointer;
}
.settings-toggle input {
  margin-top: 3px;
  cursor: pointer;
}
.settings-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-toggle-title { font-size: 13px; color: var(--fg); }
.settings-toggle-sub {
  font-size: 11.5px;
  color: var(--fg-dim);
  line-height: 1.4;
}

.tool-card-body {
  display: none;
  padding: 10px 12px;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  line-height: 1.5;
}
.tool-card.expanded .tool-card-body { display: block; }
.tool-card-section { margin-bottom: 8px; }
.tool-card-section:last-child { margin-bottom: 0; }
.tool-card-section-label {
  color: var(--fg-faint);
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.tool-pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--fg);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
}

.chat-loading {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.chat-loading-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.2s ease-in-out infinite;
}
.chat-loading-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-loading-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ── Composer (Kimi-style: textarea on top, action bar below) ───────────── */

.chat-composer {
  margin: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px 8px;
  transition: border-color var(--t), box-shadow var(--t);
}
.chat-composer:focus-within {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.12);
}
.chat-composer textarea {
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  padding: 4px 4px 0;
  min-height: 22px;
  max-height: 200px;
  width: 100%;
}
.chat-composer textarea:focus { box-shadow: none; }
.chat-composer textarea::placeholder { color: var(--fg-faint); }

.composer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 0 2px;
}
.composer-spacer { flex: 1; }

.composer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--t);
  font-family: inherit;
}
.composer-pill:hover {
  background: var(--bg-3);
  border-color: var(--border);
  transform: none;
}
.composer-pill svg { color: var(--fg-dim); }
.composer-pill-tier {
  color: var(--green);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

.composer-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-dim);
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t);
}
.composer-icon-btn:hover {
  background: var(--bg-3);
  border-color: var(--border);
  color: var(--fg);
  transform: none;
}

.send-btn {
  background: rgba(167, 139, 250, 0.18);
  color: var(--accent-2);
  border: 1px solid rgba(167, 139, 250, 0.3);
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--t);
}
.send-btn:hover {
  background: rgba(167, 139, 250, 0.28);
  border-color: var(--accent-2);
  color: var(--fg);
}
.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.send-btn.stop {
  background: rgba(239, 93, 111, 0.18);
  border-color: rgba(239, 93, 111, 0.35);
  color: var(--red);
}
.send-btn.stop:hover {
  background: rgba(239, 93, 111, 0.28);
  color: white;
}

/* ── Model popover ──────────────────────────────────────────────────────── */

.model-popover {
  position: absolute;
  bottom: 70px;
  left: 14px;
  width: 300px;
  max-height: 360px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-2);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop-in 150ms cubic-bezier(0.2, 0, 0.2, 1);
}
.model-popover.hidden { display: none; }
.model-popover-search {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.model-popover-search input {
  width: 100%;
  font-size: 12.5px;
  padding: 6px 10px;
  background: var(--bg-1);
}
.model-popover-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}
.model-popover-group-label {
  font-size: 10px;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  padding: 8px 10px 4px;
  position: sticky;
  top: 0;
  background: var(--bg-2);
  z-index: 1;
}
.model-popover-group-label:first-child { padding-top: 4px; }
.model-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--fg);
  transition: background var(--t);
}
.model-popover-item:hover { background: var(--bg-3); }
.model-popover-item.active {
  background: rgba(167, 139, 250, 0.14);
  color: var(--accent-2);
  font-weight: 600;
}
.model-popover-item .name {
  flex: 1;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-popover-item .check {
  color: var(--accent-2);
  opacity: 0;
}
.model-popover-item.active .check { opacity: 1; }
.model-popover-empty {
  padding: 16px;
  text-align: center;
  color: var(--fg-dim);
  font-size: 12px;
}

/* ── Disabled panels (no machine selected) ──────────────────────────────── */

.panel-disabled {
  position: relative;
}
.panel-disabled::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: all;
  z-index: 5;
}
.panel-disabled .disabled-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 6;
  pointer-events: none;
  color: var(--fg-mid);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}
.panel-disabled .disabled-glyph {
  font-size: 28px;
  color: var(--fg-faint);
}
.panel-disabled .disabled-sub {
  font-size: 11.5px;
  color: var(--fg-dim);
}

.disabled-overlay { display: none; }
.panel-disabled .disabled-overlay { display: flex; }

/* When disabled, prevent interaction with anything inside */
.panel-disabled input,
.panel-disabled textarea,
.panel-disabled button,
.panel-disabled .tab,
.panel-disabled .xterm-host {
  pointer-events: none;
  opacity: 0.5;
}

/* ── Modal ──────────────────────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 150ms ease;
}
.modal-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 460px;
  max-width: 90vw;
  box-shadow: var(--shadow-2);
  animation: pop-in 200ms cubic-bezier(0.2, 0, 0.2, 1);
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-card h3 { margin-bottom: 6px; font-size: 16px; }
.modal-card p { color: var(--fg-dim); margin-bottom: 18px; font-size: 13px; }
.modal-card input {
  width: 100%;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 12px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ── Auth screen ────────────────────────────────────────────────────────── */

.auth-screen {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(122, 162, 247, 0.08), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(167, 139, 250, 0.06), transparent 50%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.auth-screen.hidden { display: none; }
.auth-card {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 420px;
  max-width: 100%;
  box-shadow: var(--shadow-2);
  animation: pop-in 250ms cubic-bezier(0.2, 0, 0.2, 1);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  justify-content: center;
}
.auth-brand .logo {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 28px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--fg-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  transform: none !important;
}
.auth-tab:hover { color: var(--fg-mid); background: var(--bg-3); }
.auth-tab.active {
  background: var(--bg-3);
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.auth-form { display: flex; flex-direction: column; gap: 4px; }
.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 12px;
  margin-bottom: 4px;
  display: block;
}
.form-optional { color: var(--fg-faint); font-weight: 400; text-transform: none; letter-spacing: 0; }
.auth-form input { font-size: 14px; padding: 10px 12px; }
.auth-error {
  color: var(--red);
  font-size: 12px;
  min-height: 18px;
  margin-top: 12px;
  font-weight: 500;
}
.auth-submit {
  width: 100%;
  padding: 11px;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
}
.auth-foot {
  margin-top: 20px;
  font-size: 11.5px;
  color: var(--fg-dim);
  text-align: center;
  line-height: 1.5;
}

/* ── User pill ──────────────────────────────────────────────────────────── */

.user-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--fg-mid);
}
.user-pill .icon-btn { width: 22px; height: 22px; font-size: 12px; }

/* ── Settings ───────────────────────────────────────────────────────────── */

.settings-card { width: 540px; }
.settings-card .form-label { margin-top: 16px; }
.settings-card input,
.settings-card select {
  width: 100%;
  font-family: var(--mono);
  font-size: 12.5px;
}
.settings-card select {
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
}
.form-hint {
  font-size: 11.5px;
  color: var(--fg-dim);
  margin-top: 4px;
}
.form-hint.error { color: var(--red); }
input[readonly] {
  background: var(--bg-3);
  color: var(--fg-mid);
  cursor: default;
}
input[readonly]:focus {
  border-color: var(--border);
  box-shadow: none;
}
.link-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 0 4px;
  margin-left: 4px;
}
.link-btn:hover { color: var(--accent-2); transform: rotate(90deg); transition: transform var(--t); }
.link-btn:disabled { color: var(--fg-faint); cursor: not-allowed; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: var(--shadow-2);
  animation: toast-in 250ms cubic-bezier(0.2, 0, 0.2, 1);
  pointer-events: auto;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { border-color: rgba(43, 217, 127, 0.3); }
.toast.success .toast-glyph { color: var(--green); }
.toast.error { border-color: rgba(239, 93, 111, 0.3); }
.toast.error .toast-glyph { color: var(--red); }
.toast.info .toast-glyph { color: var(--accent); }
.toast-glyph { font-weight: 700; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* ── Scrollbars ─────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bg-4);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

/* ── Utility / responsive ───────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .layout { --sidebar-w: 240px; --chat-w: 320px; }
}
@media (max-width: 900px) {
  .layout {
    grid-template-columns: var(--sidebar-w) 4px 1fr;
    --sidebar-w: 200px;
  }
  .chat-panel, #resizeRight { display: none; }
}
