:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #22263a;
  --border: #2d3148;
  --text: #e2e8f0;
  --text-muted: #6b7280;
  --accent: #3b82f6;
  --accent-dim: #1d4ed8;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --sidebar-w: 220px;
  --radius: 8px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
*:focus:not(:focus-visible) { outline: none; }

html, body { height: 100%; height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; }

/* ── Layout ── */
.cx-app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

.cx-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width .2s;
}
.cx-app[data-sidebar="collapsed"] .cx-sidebar { width: 64px; }
.cx-app[data-sidebar="collapsed"] .cx-brand-name,
.cx-app[data-sidebar="collapsed"] .cx-nav-label,
.cx-app[data-sidebar="collapsed"] .cx-signout span { display: none; }
.cx-app[data-sidebar="collapsed"] .cx-brand { padding: 16px; justify-content: center; }
.cx-app[data-sidebar="collapsed"] .cx-nav-item { padding: 12px 0; justify-content: center; gap: 0; }
.cx-app[data-sidebar="collapsed"] .cx-nav-icon { width: auto; font-size: 18px; }
.cx-app[data-sidebar="collapsed"] .cx-sidebar-footer { padding: 12px 0; display: flex; justify-content: center; }
.cx-app[data-sidebar="collapsed"] .cx-signout { padding: 8px; min-width: 0; }

.cx-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cx-nav { list-style: none; padding: 8px 0; flex: 1; }
.cx-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 0;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
}
.cx-nav-item:hover { background: var(--surface-2); color: var(--text); }
.cx-nav-item.active { background: rgba(59,130,246,.15); color: var(--accent); }

.cx-nav-icon { width: 20px; text-align: center; flex-shrink: 0; }

.cx-sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }

.cx-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.cx-mobile-backdrop { display: none; }

.cx-topbar {
  height: 48px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  flex-shrink: 0;
}
.cx-topbar-title { font-weight: 600; font-size: 15px; }
.cx-toggle-sidebar { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; }

.cx-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Page ── */
.cx-page { max-width: 900px; }
.cx-page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.cx-page-header h1 { font-size: 20px; font-weight: 700; }

/* ── Buttons ── */
.cx-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.cx-btn:hover { background: var(--border); }
.cx-btn.is-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.cx-btn.is-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
.cx-btn.is-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.cx-btn.is-ghost:hover { background: var(--surface-2); color: var(--text); }
.cx-btn.is-small { padding: 4px 10px; font-size: 12px; }

/* ── Badge ── */
.cx-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.cx-badge.is-online { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: var(--green); }
.cx-badge.is-offline { background: rgba(107,114,128,.1); border-color: rgba(107,114,128,.2); color: var(--text-muted); }

/* ── Status dot ── */
.cx-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.cx-status-dot.is-online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.cx-status-dot.is-idle { background: var(--green); }
.cx-status-dot.is-busy { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ── Agent Card ── */
.cx-agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.cx-agent-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cx-agent-id { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.cx-agent-since { margin-left: auto; font-size: 12px; color: var(--text-muted); }

/* ── Repo ── */
.cx-repo { border-bottom: 1px solid var(--border); }
.cx-repo:last-child { border-bottom: none; }
.cx-repo-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255,255,255,.02);
}
.cx-repo-path { font-family: var(--mono); font-size: 12px; color: var(--text-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Session row ── */
.cx-session {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 24px;
  cursor: pointer;
  transition: background .15s;
}
.cx-session:hover { background: var(--surface-2); }
.cx-session-id { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.cx-session-status { font-size: 12px; color: var(--text-muted); }
.cx-session-since { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.cx-session-empty { padding: 8px 24px; font-size: 12px; color: var(--text-muted); font-style: italic; }

/* ── Chat session ── */
.cx-content:has(.cx-session-page) { padding: 0; overflow: hidden; }
.cx-session-page { display: flex; flex-direction: column; height: 100%; max-width: none; overflow: hidden; }
.cx-session-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 40px;
}
.cx-session-title { font-family: var(--mono); font-size: 13px; color: var(--accent); }

.cx-chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  scroll-behavior: smooth;
}

.cx-chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 92%;
}
.cx-chat-msg.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.cx-chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  color: var(--accent);
}
.cx-chat-avatar.is-user {
  background: rgba(59,130,246,.2);
  border-color: rgba(59,130,246,.4);
  font-size: 10px;
  font-family: var(--font);
  font-weight: 600;
}

.cx-chat-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-top-left-radius: 4px;
  padding: 10px 14px;
  min-width: 0;
  overflow: hidden;
}
.cx-chat-msg.is-user .cx-chat-bubble {
  background: rgba(59,130,246,.12);
  border-color: rgba(59,130,246,.3);
  border-radius: 12px;
  border-top-right-radius: 4px;
}
.cx-chat-msg.is-error .cx-chat-bubble {
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.3);
}

.cx-chat-text {
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  color: var(--text);
}
.cx-chat-msg.is-error .cx-chat-text { color: var(--red); }

/* Markdown rendered output */
.cx-markdown { font-size: 13.5px; line-height: 1.65; color: var(--text); word-break: break-word; }
.cx-markdown > *:first-child { margin-top: 0; }
.cx-markdown > *:last-child { margin-bottom: 0; }
.cx-markdown p { margin: 0 0 .6em; }
.cx-markdown h1,.cx-markdown h2,.cx-markdown h3,.cx-markdown h4 { margin: .9em 0 .35em; font-weight: 600; line-height: 1.25; }
.cx-markdown h1 { font-size: 1.25em; }
.cx-markdown h2 { font-size: 1.1em; }
.cx-markdown h3 { font-size: 1em; }
.cx-markdown ul,.cx-markdown ol { margin: .4em 0 .6em 1.4em; padding: 0; }
.cx-markdown li { margin: .15em 0; }
.cx-markdown li > p { margin: 0; }
.cx-markdown code { font-family: var(--mono); font-size: 12px; background: rgba(255,255,255,.07); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.cx-markdown pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: .5em 0; overflow-x: auto; }
.cx-markdown pre code { background: none; border: none; padding: 0; font-size: 12.5px; line-height: 1.55; }
.cx-markdown blockquote { border-left: 3px solid var(--primary); margin: .5em 0; padding: .3em .8em; background: rgba(59,130,246,.06); border-radius: 0 4px 4px 0; color: var(--text-muted); }
.cx-markdown a { color: var(--primary); text-decoration: none; }
.cx-markdown a:hover { text-decoration: underline; }
.cx-markdown table { border-collapse: collapse; margin: .5em 0; font-size: 12.5px; }
.cx-markdown th,.cx-markdown td { border: 1px solid var(--border); padding: 5px 10px; }
.cx-markdown th { background: var(--surface); font-weight: 600; }
.cx-markdown hr { border: none; border-top: 1px solid var(--border); margin: .8em 0; }

.cx-chat-typing {
  display: flex;
  gap: 10px;
  align-items: center;
}
.cx-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-top-left-radius: 4px;
}
.cx-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: cx-typing 1.4s infinite ease-in-out;
}
.cx-typing-dots span:nth-child(2) { animation-delay: .2s; }
.cx-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes cx-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .35; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.cx-chat-input-row {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface);
  flex-shrink: 0;
}
.cx-chat-textarea {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  resize: none;
  min-height: 42px;
  max-height: 200px;
  overflow-y: auto;
  transition: border-color .15s;
}
.cx-chat-textarea:focus { border-color: var(--accent); }
.cx-chat-textarea::placeholder { color: var(--text-muted); }
.cx-chat-send {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
  border-radius: 8px;
}

/* ── Auth ── */
.cx-auth-shell {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.cx-auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
}
.cx-auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 28px;
}
.cx-auth-card h1 { font-size: 18px; margin-bottom: 20px; }
.cx-auth-form { display: flex; flex-direction: column; gap: 10px; }
.cx-auth-form label { font-size: 13px; color: var(--text-muted); }
.cx-auth-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.cx-auth-form input:focus { border-color: var(--accent); }
.cx-auth-form .cx-btn { margin-top: 6px; justify-content: center; }

/* ── Alert ── */
.cx-alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.cx-alert.is-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: var(--red); }

/* ── Empty ── */
.cx-empty { color: var(--text-muted); padding: 40px 0; text-align: center; }
.cx-empty p { margin-bottom: 8px; }
.cx-empty code { background: var(--surface-2); padding: 2px 8px; border-radius: 4px; font-family: var(--mono); }
.cx-download-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 20px 0 12px; }
.cx-download-row .cx-btn { text-decoration: none; }
.cx-empty-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ── Session status text ── */
.cx-session-status { font-size: 12px; color: var(--text-muted); }
.cx-session-status.is-busy { color: var(--yellow); }

/* ── Elapsed time ── */
.cx-session-elapsed { margin-left: auto; font-size: 11px; color: var(--text-muted); font-family: var(--mono); }
.cx-session-elapsed-header { font-size: 12px; color: var(--text-muted); font-family: var(--mono); }

/* ── Repo name + path hint ── */
.cx-repo-name { font-weight: 600; font-size: 13px; color: var(--text); flex-shrink: 0; }
.cx-repo-path-hint { font-family: var(--mono); font-size: 11px; color: var(--text-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ── Session count badge ── */
.cx-session-count-badge { font-size: 11px; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 100px; padding: 1px 7px; }

/* ── Spinner ── */
.cx-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: cx-spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes cx-spin { to { transform: rotate(360deg); } }
.cx-btn.is-loading { opacity: .7; cursor: not-allowed; }
.cx-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Reconnect badge in topbar ── */
.cx-reconnect-badge {
  margin-left: auto;
  font-size: 12px;
  color: var(--yellow);
  display: flex;
  align-items: center;
  gap: 6px;
}
.cx-reconnect-badge::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  animation: pulse 1.2s infinite;
}

/* ── Banner ── */
.cx-banner {
  padding: 10px 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.cx-banner.is-error { background: rgba(239,68,68,.1); border-bottom: 1px solid rgba(239,68,68,.3); color: var(--red); }
.cx-banner.is-info { background: rgba(59,130,246,.1); border-bottom: 1px solid rgba(59,130,246,.3); color: var(--accent); }

/* ── Toast notifications ── */
.cx-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.cx-toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  max-width: 360px;
  animation: cx-toast-in .2s ease;
  pointer-events: auto;
}
.cx-toast.is-info { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.cx-toast.is-error { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.4); color: var(--red); }
.cx-toast.is-success { background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.4); color: var(--green); }
@keyframes cx-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Settings page ── */
.cx-settings-section { padding: 16px; }
.cx-settings-section-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 12px; }
.cx-settings-repo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.cx-settings-repo-row:last-of-type { border-bottom: none; }
.cx-settings-repo-row .cx-repo-path { flex: 1; font-family: var(--mono); font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-settings-add-repo { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.cx-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: border-color .15s;
  min-width: 0;
}
.cx-input:focus { border-color: var(--accent); }
.cx-btn.is-danger { color: var(--red); }
.cx-btn.is-danger:hover { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); }

/* ── Search input in header ── */
.cx-search-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  width: 200px;
  transition: border-color .15s;
}
.cx-search-input:focus { border-color: var(--accent); }

/* ── Git panel in repo ── */
.cx-git-panel { padding: 10px 16px; background: rgba(0,0,0,.2); border-bottom: 1px solid var(--border); }
.cx-git-panel-top { margin-bottom: 16px; border-radius: var(--radius); border: 1px solid var(--border); }
.cx-git-branch { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.cx-git-branch-badge { font-size: 12px; color: var(--accent); background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.3); border-radius: 100px; padding: 2px 8px; }
.cx-git-status { font-family: var(--mono); font-size: 12px; color: var(--text-muted); white-space: pre-wrap; word-break: break-all; margin: 4px 0; }
.cx-git-log { font-family: var(--mono); font-size: 11px; color: var(--text-muted); white-space: pre-wrap; word-break: break-all; margin-top: 6px; }

/* ── Stats page ── */
.cx-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 28px; }
.cx-stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 16px; text-align: center; }
.cx-stat-value { font-size: 36px; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom: 6px; }
.cx-stat-label { font-size: 12px; color: var(--text-muted); }
.cx-section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin: 24px 0 10px; }
.cx-history-list { display: flex; flex-direction: column; gap: 2px; }
.cx-history-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius); cursor: pointer; transition: background .15s; }
.cx-history-row:hover { background: var(--surface); }
.cx-history-ended { opacity: .7; }
.cx-history-machine { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.cx-history-exit { font-size: 11px; font-family: var(--mono); padding: 1px 6px; border-radius: 4px; }
.cx-history-exit.is-ok { background: rgba(16,185,129,.1); color: var(--green); }
.cx-history-exit.is-err { background: rgba(239,68,68,.1); color: var(--red); }

/* ── Repo browser ── */
.cx-browse-page { max-width: none; }
.cx-browse-layout { display: flex; gap: 16px; min-height: 400px; }
.cx-browse-tree { width: 280px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-y: auto; }
.cx-browse-breadcrumb { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12px; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.cx-browse-crumb { color: var(--accent); cursor: pointer; }
.cx-browse-crumb:hover { text-decoration: underline; }
.cx-browse-sep { color: var(--text-muted); padding: 0 2px; }
.cx-browse-entry { display: flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px; transition: background .1s; }
.cx-browse-entry:hover, .cx-browse-entry.is-selected { background: var(--surface-2); }
.cx-browse-entry.is-dir { font-weight: 500; }
.cx-browse-icon { font-size: 14px; flex-shrink: 0; }
.cx-browse-size { margin-left: auto; font-size: 11px; color: var(--text-muted); font-family: var(--mono); }
.cx-browse-content { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
.cx-browse-filename { padding: 8px 16px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 12px; color: var(--accent); }
.cx-browse-code { margin: 0; padding: 16px; font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre; overflow-x: auto; color: var(--text); }

/* ── Mobile backdrop ── */
.cx-mobile-backdrop {
  display: none;
}

/* ── Mobile ── */
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }

  .cx-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 100; width: 220px;
    transform: translateX(-100%); transition: transform .2s;
  }
  .cx-app[data-mobile-nav="open"] .cx-sidebar { transform: translateX(0); }
  .cx-app[data-mobile-nav="open"] .cx-brand-name,
  .cx-app[data-mobile-nav="open"] .cx-nav-label,
  .cx-app[data-mobile-nav="open"] .cx-signout span { display: inline; }

  .cx-mobile-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99;
    backdrop-filter: blur(2px);
  }

  .cx-content { padding: 12px; }

  /* Page header: search full-width on second row, push button fits */
  .cx-page-header { gap: 8px; }
  .cx-page-header h1 { font-size: 17px; }
  .cx-search-input { flex: 1; width: auto; min-width: 0; order: 3; }
  .cx-push-btn { order: 2; flex-shrink: 0; }

  /* Agent card header: clip long IDs, don't wrap */
  .cx-agent-header { flex-wrap: nowrap; overflow: hidden; }
  .cx-agent-id { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
  .cx-agent-since { flex-shrink: 0; white-space: nowrap; }
  .cx-session-count-badge { flex-shrink: 0; white-space: nowrap; }

  /* Repo header: wrap allowed, smaller gap */
  .cx-repo-header { gap: 6px; flex-wrap: wrap; }
  .cx-repo-name { font-size: 12px; }
  .cx-repo-path-hint { display: none; }

  /* Session row: clip ID */
  .cx-session-id { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
}
