/* Global box model: padding and border count inside width — easier layouts. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Root font and colors: dark theme, system fonts for a native feel. */
:root {
  --bg: #0c0e12;
  --bg-elevated: #141820;
  --border: #2a3140;
  --text: #e8eaef;
  --muted: #8b95a8;
  --text-assistant: #e8eaef;
  --text-user: #e8eaef;
  /* User bubble (Claude.ai-style pill) */
  --user-bubble-bg: #2b3f5c;
  --user-bubble-border: #3d5270;
  --accent: #6ea8ff;
  --accent-dim: rgba(110, 168, 255, 0.15);
  --radius: 12px;
  --sidebar-width: 220px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/*
  SCROLL MODEL:
  - html & body: no page scroll.
  - #chat: single scrollable column (position: relative so message offsetTop is usable for scroll).
*/

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Fills the viewport; does not scroll (children handle their own overflow). */
.shell {
  display: flex;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Left rail: context switcher (desktop); on phones the nav hides and the select shows */
.sidebar {
  flex-shrink: 0;
  width: var(--sidebar-width);
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 4;
}

.sidebar-label {
  margin: 0 0 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Vertical list of context names */
.context-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.context-btn {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 44px;
}

.context-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Strong visual for whichever context is loaded */
.context-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

/* ── Focused-chat sidebar rows ─────────────────────────────────────── */
.context-row {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}
.context-row.is-draggable {
  cursor: grab;
}
.context-row.is-draggable:active {
  cursor: grabbing;
}
.context-row.dragging {
  opacity: 0.4;
}
/* Drop indicator lines — a 2px accent line above or below the target row. */
.context-row.drop-above::before,
.context-row.drop-below::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
}
.context-row.drop-above::before { top: -4px; }
.context-row.drop-below::after  { bottom: -4px; }
.context-row .context-btn {
  flex: 1;
  min-width: 0;             /* allow text truncation */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-delete-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.context-row:hover .context-delete-btn,
.context-row:focus-within .context-delete-btn {
  opacity: 1;
}
.context-delete-btn:hover {
  color: #e05;
}

.context-add-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, color 0.15s;
  min-height: 44px;
}
.context-add-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.context-select-wrap {
  display: none;
  flex-direction: column;
  gap: 6px;
}

.context-select-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.context-select {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.context-active-desc {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

/*
  Main column: column flex. Does NOT scroll — only #chat inside it scrolls.
  height: 100% + max-height keeps this column within the viewport beside the sidebar.
*/
.app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  max-width: 720px;
  margin: 0 auto;
}

/* Top bar — stays above #chat (not inside it), so no sticky needed for chat scroll */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

/* Compact badge showing current mode next to the title */
.active-pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(110, 168, 255, 0.35);
  border-radius: 999px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Mobile bar + hamburger menu (hidden on desktop) ────────────────────── */
.mobile-bar {
  display: none; /* shown only inside the mobile media query */
}

.mobile-context-select {
  flex: 1;
  min-height: 40px;
  padding: 0 10px;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  appearance: auto;
}

.mobile-menu-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1.25rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  color: var(--text);
}

/* Slide-down panel that appears under the mobile bar */
.mobile-menu {
  display: none; /* toggled by JS via hidden attribute */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  z-index: 20;
  flex-direction: column;
  /* Will be pushed down by JS to sit below the mobile bar */
}

.mobile-menu:not([hidden]) {
  display: flex;
}

.mobile-menu-item {
  width: 100%;
  padding: 14px 20px;
  text-align: left;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.mobile-menu-item:last-child {
  border-bottom: none;
}

.mobile-menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* ── Mobile layout (≤640px) ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Stack everything vertically; shell is the positioning parent for the menu. */
  .shell {
    flex-direction: column;
    height: 100%;
    min-height: 0;
    position: relative;
  }

  .app {
    flex: 1;
    min-height: 0;
  }

  /* Sidebar is completely hidden — navigation moves to the mobile bar. */
  .sidebar {
    display: none;
  }

  /* Show the mobile bar: dropdown + hamburger */
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top));
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 6;
  }

  /* Hide desktop header Clear + Sign out buttons — they're in the hamburger menu. */
  .header-actions {
    display: none;
  }

  /* Active pill not needed — context shown in dropdown. */
  .active-pill {
    display: none;
  }

  /* Tighter header on mobile. */
  .header {
    padding: 10px 14px;
  }

  .title {
    font-size: 1rem;
  }

  /* Messages: comfortable reading size. */
  .chat {
    padding: 14px 14px;
    padding-bottom: 100px;
    gap: 1.25rem;
  }

  .msg-user {
    max-width: 88%;
  }

  .msg-assistant .msg-text {
    font-size: 0.9375rem;
    line-height: 1.65;
  }

  /* Composer: full width, account for home indicator on iPhone. */
  .composer {
    left: 0;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

/* Single conversation column: everything scrolls here (position relative for offsetTop) */
.chat {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
  /* Space for fixed composer at bottom of viewport */
  padding-bottom: 100px;
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* ensures align-self: flex-end works on user bubbles */
  gap: 1.5rem;
  -webkit-overflow-scrolling: touch;
}

/* Web search status line */
.searching-hint {
  margin: 0;
  padding: 2px 0 4px;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1.45;
  align-self: flex-start;
  flex-shrink: 0;
  border: none;
  background: transparent;
}

.searching-hint[hidden] {
  display: none;
}

/* Fallback model indicator */
.fallback-hint {
  margin: 0;
  padding: 2px 0 4px;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.03em;
  line-height: 1.45;
  align-self: flex-start;
  flex-shrink: 0;
}

.fallback-hint[hidden] {
  display: none;
}

/* Placeholder when there are no messages */
.empty-hint {
  color: var(--muted);
  text-align: center;
  padding: 24px 12px;
  font-size: 0.95rem;
}

.empty-hint[hidden] {
  display: none;
}

/* Messages: user = rounded bubble (right); assistant = plain document text (left, full width) */
.msg {
  margin: 0;
  word-wrap: break-word;
}

/* User: rounded pill, right-aligned, no border */
.msg-user {
  align-self: flex-end;
  max-width: min(85%, 32rem);
  padding: 10px 16px;
  border-radius: 18px;
  background: var(--user-bubble-bg);
  text-align: left;
}

.msg-user .msg-text {
  margin: 0;
  color: var(--text-user);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.msg-user .msg-meta {
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
}

/* Assistant: no box — document-style reading on page background */
.msg-assistant {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  padding: 0.35rem 0;
  border: none;
  background: transparent;
  text-align: left;
}

.msg-assistant .msg-text {
  margin: 0;
  color: var(--text-assistant);
  font-size: 1rem;
  line-height: 1.75;
  white-space: pre-wrap;
  max-width: 52rem;
}

.msg-assistant .msg-meta {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: left;
}

/* Fixed bottom area for input + send (offset on desktop so it lines up with chat column past sidebar). */
.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  border-top: 1px solid var(--border);
  z-index: 3;
}

@media (min-width: 641px) {
  .composer {
    left: var(--sidebar-width);
  }
}

.composer-form {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

/* Input: min 16px font on iOS avoids unwanted zoom on focus. */
#user-input {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}

#user-input:focus {
  border-color: var(--accent);
}

/* Recording: red pulsing border + animated placeholder */
#user-input.voice-recording,
#user-input.voice-recording:focus {
  border-color: #ef4444;
  animation: input-record-pulse 1.2s ease-in-out infinite;
}

/* Transcribing: static accent border */
#user-input.voice-transcribing,
#user-input.voice-transcribing:focus {
  border-color: var(--accent);
}

@keyframes input-record-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50%       { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

/* Buttons: large tap targets for mobile (44px min). */
.btn {
  min-height: 44px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #0a0c10;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.875rem;
}

.btn-ghost:hover {
  color: var(--text);
}

/* API error inside assistant bubble */
.msg-error-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

.msg-retry-btn {
  margin-top: 8px;
  display: block;
}

/* ── Attach (+) button + dropdown menu ───────────────────────────────── */
.attach-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.btn-attach {
  min-width: 44px;
  width: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--muted);
  border-color: var(--border);
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.btn-attach:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
}

.attach-menu[hidden] {
  display: none;
}

.attach-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 10;
}

.attach-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.attach-menu-item:hover,
.attach-menu-item:focus-visible {
  background: var(--border);
  outline: none;
}

.attach-menu-item svg {
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Attachment preview above composer ───────────────────────────────── */
.attachment-preview[hidden] {
  display: none;
}

.attachment-preview {
  max-width: 720px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.attachment-preview-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 6px;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.attachment-preview-thumb.is-image {
  background-color: transparent;
}

.attachment-preview-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.attachment-preview-name {
  flex: 1;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-preview-remove {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.attachment-preview-remove:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* Drag-over state on the composer form */
.composer-form.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius);
}

/* Image shown inline inside a user message bubble */
.msg-image {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  margin-bottom: 6px;
}

/* Small chip shown above user message text for non-image attachments */
.msg-file-chip {
  display: inline-block;
  margin-bottom: 6px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Microphone button ──────────────────────────────────────────────────── */
.btn-mic {
  min-width: 44px;
  width: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--muted);
  border-color: var(--border);
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none; /* prevents scroll-drag while holding on mobile */
}

.btn-mic:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted);
}

/* Red pulse while actively recording */
.btn-mic.mic-recording {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  animation: mic-pulse 1.2s ease-in-out infinite;
}

/* Accent colour while waiting for transcription API response */
.btn-mic.mic-transcribing {
  color: var(--accent);
  border-color: var(--accent);
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Temporary error toast shown above the composer */
.voice-error {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 0.85rem;
  z-index: 10;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
}

/* ── Connections trigger (sidebar bottom) ──────────────────────────────── */
.connections-trigger {
  margin-top: auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 40px;
}

.connections-trigger:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.connections-trigger-label { flex: 1; text-align: left; }

/* Green dot: visible when at least one service is connected */
.connections-trigger-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.connections-trigger-dot[hidden] { display: none; }

/* Inline dot variant for mobile menu item */
.mobile-conn-dot {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
}

/* ── Connections panel (slide-out) ─────────────────────────────────────── */
.conn-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 29;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.conn-panel-backdrop.is-visible { opacity: 1; }
.conn-panel-backdrop[hidden] { display: none; }

.conn-panel {
  position: fixed;
  z-index: 30;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
}

.conn-panel[hidden] { display: none; }

/* Desktop: slides right from beside the sidebar */
.conn-panel {
  top: 0;
  bottom: 0;
  left: var(--sidebar-width);
  width: 280px;
  border-radius: 0;
  transform: translateX(-100%);
}

.conn-panel.is-open { transform: translateX(0); }

.conn-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.conn-panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.conn-panel-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.conn-panel-close:hover { color: var(--text); }

.conn-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* ── Connection card (one per service) ─────────────────────────────────── */
.conn-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.conn-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.conn-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.conn-card-status { font-size: 0.75rem; }

.conn-status-on { color: #22c55e; }

.conn-card-desc {
  margin: 0 0 10px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.conn-card-btn {
  width: 100%;
  min-height: 36px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
}

.conn-card-btn-primary {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(110, 168, 255, 0.35);
}

.conn-card-btn-primary:hover {
  background: rgba(110, 168, 255, 0.25);
}

.conn-card-btn-danger {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.conn-card-btn-danger:hover {
  color: #ef4444;
  border-color: #ef4444;
}

.conn-card-hint {
  font-size: 0.7rem;
  color: var(--muted);
}

/* ── Mobile: panel becomes a bottom sheet ──────────────────────────────── */
@media (max-width: 640px) {
  .conn-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .conn-panel.is-open { transform: translateY(0); }
}

/* Visually hidden but available to screen readers. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
