/* Antigravity Mobile & Desktop Remote Workspace — Matte Carbon × Champagne Gold (v2.3.0) */

:root {
  --bg: #0b0c0e;
  --bg-glow: radial-gradient(ellipse 75% 40% at 50% -12%, rgba(226, 168, 107, 0.08), transparent 72%);
  --surface: #121418;
  --surface-2: #1a1d23;
  --surface-glass: rgba(11, 12, 14, 0.88);
  --bubble-user: #232730;
  --bubble-user-border: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f2f3f5;
  --text-2: #a6acb8;
  --muted: #6c727f;
  --primary: #f3f4f6;
  --primary-text: #0b0c0e;
  --accent: #e2a86b;
  --accent-soft: rgba(226, 168, 107, 0.14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #e2a86b;
  --warn-soft: rgba(226, 168, 107, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --code-bg: #07080a;
  --shadow-lg: 0 20px 52px rgba(0, 0, 0, 0.62);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans SC", "Microsoft YaHei UI", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #f7f6f2;
  --bg-glow: radial-gradient(ellipse 75% 40% at 50% -12%, rgba(180, 106, 40, 0.06), transparent 72%);
  --surface: #ffffff;
  --surface-2: #eeede7;
  --surface-glass: rgba(247, 246, 242, 0.9);
  --bubble-user: #18181b;
  --bubble-user-border: rgba(24, 24, 27, 0.12);
  --border: rgba(24, 24, 27, 0.07);
  --border-strong: rgba(24, 24, 27, 0.14);
  --text: #18181b;
  --text-2: #52525b;
  --muted: #8a8a93;
  --primary: #18181b;
  --primary-text: #ffffff;
  --accent: #b46a28;
  --accent-soft: rgba(180, 106, 40, 0.11);
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.12);
  --warn: #b46a28;
  --warn-soft: rgba(180, 106, 40, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.11);
  --code-bg: #14161a;
  --shadow-lg: 0 14px 36px rgba(24, 24, 27, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans) !important;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, textarea, select {
  font-family: var(--font-sans) !important;
  color: inherit;
}

.hidden { display: none !important; }

/* App Shell */
.app-shell {
  display: flex;
  height: 100dvh;
  width: 100%;
  background: var(--bg);
  background-image: var(--bg-glow);
  position: relative;
}

/* Sidebar Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(4px);
  transition: opacity 0.22s ease;
}

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  width: min(320px, 86vw);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateX(-104%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: var(--shadow-lg);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
}

.drawer-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.drawer-sync {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  flex-shrink: 0;
}
.pulse-dot.mini { width: 7px; height: 7px; }
.pulse-dot.online {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.65);
}
.pulse-dot.running {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(226, 168, 107, 0.65);
  animation: pulseGlow 1.5s infinite;
}
.pulse-dot.offline {
  background: var(--danger);
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.55; }
}

.drawer-actions {
  display: flex;
  gap: 8px;
  padding: 4px 14px 10px;
}

.new-chat-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: var(--primary-text);
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.new-chat-btn:active { transform: scale(0.98); }
.plus-glyph { font-size: 17px; line-height: 1; }

.drawer-section-label {
  padding: 2px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.project-chips {
  display: flex;
  gap: 6px;
  padding: 0 14px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.project-chips::-webkit-scrollbar { display: none; }

.proj-chip {
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.proj-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(226, 168, 107, 0.35);
  font-weight: 600;
}

.search-wrap {
  position: relative;
  padding: 0 14px 8px;
}
.search-icon {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-60%);
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px 8px 30px;
  font-size: 13px;
  outline: none;
}
.search-wrap input:focus { border-color: var(--accent); }

.scope-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0 14px 8px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
}
.scope-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
}
.scope-tab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conv-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 11px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.active {
  background: var(--surface-2);
  border-color: transparent;
}

.conv-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}
.conv-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.conv-item-time {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.conv-item-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.src-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  flex-shrink: 0;
}
.src-tag.qq { background: var(--accent-soft); color: var(--accent); }
.src-tag.mobile { background: rgba(52, 211, 153, 0.15); color: var(--ok); }
.conv-item-proj {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-foot {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.foot-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12.5px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.foot-btn:hover { background: var(--surface-2); color: var(--text); }
.danger-text { color: var(--danger) !important; }

/* Main Pane */
.main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* Topbar */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.conv-header-info {
  min-width: 0;
  flex: 1;
}

.conv-header-title {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-header-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn.ghost {
  border-color: transparent;
  background: transparent;
}
.icon-btn:active { transform: scale(0.95); }

.badge-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* In-App Browser Banner */
.inapp-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--accent-soft);
  border-bottom: 1px solid rgba(226, 168, 107, 0.2);
  color: var(--text);
  font-size: 12px;
}
.banner-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

/* Chat Viewport */
.chat-viewport {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 20px;
}

/* Welcome View */
.welcome-view {
  max-width: 680px;
  margin: 12px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeSlideUp 0.35s ease;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-orb {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  padding: 2px;
  background: linear-gradient(135deg, rgba(226, 168, 107, 0.45), rgba(255, 255, 255, 0.12));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  margin-bottom: 14px;
}
.hero-logo {
  width: 100%;
  height: 100%;
  border-radius: 17px;
  display: block;
}
.hero-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero-desc {
  margin: 0 0 22px;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 460px;
}

.welcome-block {
  width: 100%;
  margin-bottom: 18px;
}
.welcome-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  padding-left: 2px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 8px;
}
.proj-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.proj-card.active {
  background: var(--accent-soft);
  border-color: rgba(226, 168, 107, 0.38);
}
.proj-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.proj-card-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
}
.proj-card-path {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.starter-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.starter-card {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.starter-card:hover { border-color: var(--accent); color: var(--text); }
.starter-card:active { transform: scale(0.99); }
.starter-ico { font-size: 16px; }

/* Active Thread */
.thread-view {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thread-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  font-size: 12px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text);
}
.status-pill.running { background: var(--accent-soft); color: var(--accent); }
.status-pill.completed { background: var(--ok-soft); color: var(--ok); }
.status-pill.awaiting_approval, .status-pill.queued { background: var(--warn-soft); color: var(--warn); }
.status-pill.rejected, .status-pill.cancelled { background: var(--danger-soft); color: var(--danger); }

.retry-inline-btn {
  margin-left: auto;
  background: var(--accent);
  color: #06131f;
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.artifacts-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.artifact-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.artifact-chip:hover { border-color: var(--accent); }

.message-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Message Bubbles */
.msg-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeSlideUp 0.2s ease;
}

.msg-row.user {
  align-items: flex-end;
}

.user-bubble {
  max-width: min(88%, 580px);
  background: var(--bubble-user);
  border: 1px solid var(--bubble-user-border);
  color: #f8fafc;
  padding: 11px 14px;
  border-radius: 18px 18px 5px 18px;
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-meta {
  font-size: 11px;
  color: var(--muted);
  padding: 0 4px;
}

.assistant-card {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 4px 2px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}

.assistant-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--text-2);
}

/* Collapsible Thinking */
.thinking-box {
  background: transparent;
  border: none;
  border-left: 2px solid var(--border-strong);
  border-radius: 0;
  padding-left: 10px;
  overflow: hidden;
}
.thinking-box summary {
  padding: 4px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.thinking-box summary::-webkit-details-marker { display: none; }
.thinking-content {
  padding: 6px 0 4px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.65;
  white-space: pre-wrap;
  border-top: none;
}

/* Tool Call Pills */
.tool-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  max-width: 100%;
}
.tool-pill code {
  font-family: var(--font-mono) !important;
  font-size: 11px;
  color: var(--accent);
}
.tool-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
  color: var(--muted);
}

/* Markdown Typography */
.markdown-body {
  font-size: 14.5px;
  line-height: 1.68;
  color: var(--text);
  word-break: break-word;
}
.markdown-body p { margin: 0 0 10px; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  margin: 14px 0 8px;
  font-weight: 700;
  line-height: 1.35;
}
.markdown-body h1 { font-size: 18px; }
.markdown-body h2 { font-size: 16px; }
.markdown-body h3 { font-size: 15px; }
.markdown-body ul, .markdown-body ol {
  margin: 6px 0 10px;
  padding-left: 20px;
}
.markdown-body li { margin-bottom: 4px; }
.markdown-body blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  color: var(--text-2);
}
.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body code {
  font-family: var(--font-mono) !important;
  font-size: 12.5px;
  background: var(--surface-2);
  padding: 2px 5px;
  border-radius: 5px;
}

.code-block-wrap {
  margin: 10px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--code-bg);
}
.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 11px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: #94a3b8;
  font-family: var(--font-mono) !important;
}
.copy-code-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #e2e8f0;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.code-block-wrap pre {
  margin: 0;
  padding: 11px 12px;
  overflow-x: auto;
  font-family: var(--font-mono) !important;
  font-size: 12.5px;
  line-height: 1.55;
  color: #e2e8f0;
}
.code-block-wrap pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
  display: block;
  overflow-x: auto;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border);
  padding: 6px 9px;
  text-align: left;
}
.markdown-body th {
  background: var(--surface-2);
  font-weight: 600;
}

.error-box {
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--danger);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13px;
}

/* Running Indicator */
.running-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  color: var(--accent);
}
.typing-dots {
  display: inline-flex;
  gap: 4px;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Sticky Bottom Composer */
.composer-wrap {
  flex-shrink: 0;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}

.composer-controls {
  max-width: 780px;
  margin: 0 auto 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.ctrl-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ctrl-left::-webkit-scrollbar { display: none; }

.ctrl-pill {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  max-width: 155px;
  cursor: pointer;
}
.ctrl-pill:focus { border-color: var(--accent); }

.ctrl-hint {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.composer-box {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 6px 6px 6px 14px;
  transition: border-color 0.15s ease;
}
.composer-box:focus-within {
  border-color: var(--accent);
}

.composer-box textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 15px;
  line-height: 1.45;
  max-height: 136px;
  padding: 6px 0;
  color: var(--text);
}
.composer-box textarea::placeholder { color: var(--muted); }

.thumb-strip {
  max-width: 780px;
  margin: 0 auto 8px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px;
}
.thumb-item {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.attach-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.attach-btn:hover { background: var(--accent-soft); color: var(--accent); }

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--primary-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.send-btn:active { transform: scale(0.93); }

/* Bottom Sheets & Modals */
.sheet-overlay, .modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay { align-items: center; padding: 18px; }

.sheet-card {
  width: 100%;
  max-width: 680px;
  max-height: 78dvh;
  background: var(--surface);
  border-top: 1px solid var(--border-strong);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: var(--shadow-lg);
  animation: sheetSpringUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sheetSpringUp {
  from { opacity: 0.4; transform: translateY(36px); }
  to { opacity: 1; transform: translateY(0); }
}
.sheet-card.tall { max-height: 88dvh; }
.sheet-card.compact { max-width: 460px; }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.sheet-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.sheet-head-actions { display: flex; align-items: center; gap: 8px; }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

.mini-btn {
  padding: 5px 11px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.action-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.action-row {
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.approval-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px;
  margin-bottom: 10px;
}
.approval-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}
.approval-title {
  font-size: 14px;
  font-weight: 700;
  margin: 4px 0;
}
.approval-reason {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 10px;
}
.approval-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.primary-btn, .ok-btn, .danger-btn {
  border: none;
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.primary-btn { background: var(--primary); color: var(--primary-text); }
.ok-btn { background: var(--ok); color: #041d15; }
.danger-btn { background: var(--danger); color: #fff; }
.full { width: 100%; }

/* Pairing Modal */
.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.modal-logo-wrap { margin-bottom: 10px; }
.modal-logo { width: 54px; height: 54px; border-radius: 14px; }
.modal-card h2 { margin: 0 0 8px; font-size: 18px; }
.modal-sub { margin: 0 0 16px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.pair-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 13px;
  font-size: 20px;
  font-family: var(--font-mono) !important;
  letter-spacing: 0.25em;
  text-align: center;
  margin-bottom: 12px;
  outline: none;
}
.pair-input:focus { border-color: var(--accent); }
.form-error { margin-top: 8px; font-size: 13px; color: var(--danger); min-height: 18px; }

.empty-box {
  text-align: center;
  color: var(--muted);
  padding: 34px 16px;
  font-size: 13.5px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(86px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  max-width: 90vw;
  text-align: center;
}

/* Desktop / Tablet Permanent Sidebar (Antigravity 2.0 layout) */
@media (min-width: 900px) {
  .drawer {
    position: relative;
    transform: none !important;
    width: 310px;
    box-shadow: none;
  }
  .drawer-backdrop { display: none !important; }
  #openDrawerBtn, #closeDrawerBtn { display: none; }
  .chat-viewport { padding: 20px 28px 24px; }
}
