/* =================================================================
   Bytro Remote - Mobile Web UI v2
   Design system from pencil.pen design frames
   Colors: #18181b bg, #222226 surface, #4285F4 accent blue
   All class names aligned with index.html + app.js
   ================================================================= */

/* ---- CSS Variables ---- */
:root {
  --bg-primary: #18181b;
  --bg-surface: #222226;
  --bg-surface-dark: #1A1A1D;
  --bg-surface-deeper: #1F1F23;
  --bg-input: #1A1A1D;
  --bg-code: #111114;
  --bg-overlay: #09090BCC;
  --bg-user-bubble: #2B3548;
  --bg-hover: #202024;

  --border: #27272a;
  --border-subtle: #2A2A31;
  --border-strong: #2F2F37;
  --border-action: #3B4A63;
  --border-user: #3B4A63;

  --text-primary: #FFFFFF;
  --text-secondary: #D4D4D8;
  --text-tertiary: #A1A1AA;
  --text-muted: #71717A;
  --text-dim: #6B7280;
  --text-placeholder: #5F5F68;
  --text-code: #E4E4E7;
  --text-user: #E7EEF9;

  --accent-blue: #4285F4;
  --accent-blue-light: #60A5FA;
  --accent-blue-pale: #93C5FD;
  --accent-purple: #A855F7;
  --accent-purple-light: #C084FC;
  --accent-green: #10B981;
  --accent-green-light: #34D399;
  --accent-green-pale: #86EFAC;
  --accent-yellow: #F59E0B;
  --accent-yellow-light: #FBBF24;
  --accent-yellow-pale: #FDE68A;
  --accent-red: #EF4444;
  --accent-red-pale: #FCA5A5;

  --accent-blue-12: rgba(66,133,244,0.07);
  --accent-blue-30: rgba(66,133,244,0.19);
  --accent-green-18: rgba(16,185,129,0.09);
  --accent-green-33: rgba(16,185,129,0.2);
  --accent-yellow-12: rgba(245,158,11,0.07);
  --accent-yellow-33: rgba(245,158,11,0.2);
  --accent-purple-12: rgba(168,85,247,0.07);
  --accent-purple-33: rgba(168,85,247,0.2);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 12px;
  --r-xl: 14px;
  --r-2xl: 16px;
  --r-3xl: 18px;
  --r-pill: 999px;
  --r-screen: 32px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', 'JetBrains Mono', monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Reset ---- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  position: fixed;
  width: 100%;
}

body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100%;
  max-width: 100vw;
}

#app {
  height: 100%;
  width: 100%;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  position: relative;
  overflow: hidden;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; height: 0; }
::-webkit-scrollbar:horizontal { display: none; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #52525b; }

/* ================================================================
   SCREENS
   ================================================================ */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.screen.active { display: flex; }

/* ================================================================
   LOGIN SCREEN
   ================================================================ */
#screen-login {
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
  min-height: 100dvh;
}

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 320px;
}

.login-logo {
  margin-bottom: 20px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 28px;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-input {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'JetBrains Mono', monospace;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  text-align: center;
  letter-spacing: 2px;
}

.login-input:focus {
  border-color: var(--accent-blue);
}

.login-input::placeholder {
  letter-spacing: 0;
  color: var(--text-placeholder);
}

.login-error {
  font-size: 13px;
  color: var(--accent-red);
  text-align: center;
  padding: 4px 0;
}

.login-btn {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: none;
  background: var(--accent-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.login-btn:active {
  opacity: 0.85;
}

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

/* ================================================================
   SESSION LIST SCREEN (A9IBY)
   ================================================================ */
#screen-sessions {
  padding: 14px 14px 18px;
  gap: 12px;
  overflow-x: hidden;
}

/* -- Session Header -- */
.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0 4px;
  flex-shrink: 0;
}

.session-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-header-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-blue-light);
  flex-shrink: 0;
}
.session-header-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: contain;
}

.session-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-header-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.session-header-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
}

.btn-new-chat {
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  background: var(--bg-surface-deeper);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.btn-new-chat:active { background: var(--bg-surface); }

/* -- Project Section -- */
.project-section {
  flex-shrink: 0;
}

.project-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-2xl);
  background: var(--bg-surface-dark);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.project-selector:active { background: var(--bg-surface); }

.project-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-blue-light);
  flex-shrink: 0;
}

.project-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.project-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-blue-pale);
  flex-shrink: 0;
}

.project-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* -- Project Dropdown -- */
.project-dropdown {
  background: var(--bg-surface-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  margin-top: 4px;
  overflow: hidden;
  animation: fadeSlideDown 0.15s ease;
}

.project-dropdown.hidden { display: none; }

.project-dropdown-list {
  display: flex;
  flex-direction: column;
}

/* -- Search -- */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-xl);
  background: var(--bg-surface-dark);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.search-icon {
  width: 14px;
  height: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
}

.search-input::placeholder { color: var(--text-placeholder); }

/* -- Session List -- */
.session-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
  width: 100%;
}

/* -- Session Card -- */
.session-card {
  padding: 12px;
  border-radius: var(--r-3xl);
  background: var(--bg-surface-dark);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.session-card:active { background: var(--bg-surface); }
.session-card.running { background: var(--bg-surface); border-color: var(--border); }

.session-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.session-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.session-card-time {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  flex-shrink: 0;
}

.session-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
}

.session-card-model {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.session-card-count {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
}

/* -- Session Card Status -- */
.session-card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--r-pill);
  background: var(--bg-surface-deeper);
  border: 1px solid var(--border-subtle);
  font-size: 10px;
  font-weight: 700;
}

.session-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.session-card-status.running { color: var(--accent-blue-pale); }
.session-status-dot.running { background: var(--accent-blue-pale); animation: pulse 1.5s ease-in-out infinite; }
.session-card-status.idle { color: #9CA3AF; }
.session-status-dot.idle { background: var(--text-dim); }
.session-card-status.done { color: var(--accent-green-pale); }
.session-status-dot.done { background: var(--accent-green-light); }

/* -- Pulse Dots -- */
.pulse-dots { display: flex; align-items: center; gap: 3px; }
.pulse-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-blue-pale);
  animation: dotPulse 1.4s ease-in-out infinite;
}
.pulse-dot:nth-child(2) { animation-delay: 0.2s; }
.pulse-dot:nth-child(3) { animation-delay: 0.4s; }

/* -- Connection Status -- */
.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  font-size: 11px;
  flex-shrink: 0;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.connected { background: var(--accent-green); }
.status-dot.connecting { background: var(--accent-yellow); animation: pulse 1.5s ease-in-out infinite; }
.status-dot.disconnected { background: var(--accent-red); }

.status-text {
  font-weight: 600;
  color: var(--text-tertiary);
}

.status-url {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ================================================================
   TRANSITION SCREEN (hP5AW)
   ================================================================ */
#screen-transition {
  align-items: center;
  justify-content: center;
}

.transition-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}

.transition-logo {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.transition-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.transition-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
}

.transition-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue-light);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.dot-1 { opacity: 1; }
.dot-2 { opacity: 0.6; animation-delay: 0.2s; }
.dot-3 { opacity: 0.3; animation-delay: 0.4s; }

.transition-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ================================================================
   CHAT SCREEN (jshUZ / pVq95)
   ================================================================ */
#screen-chat {
  gap: 6px;
  padding: 10px 14px 16px;
  position: relative;
  overflow-x: hidden;
}

/* -- Generic Buttons -- */
.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  background: var(--bg-surface-deeper);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.icon-btn:active { background: var(--bg-surface); }
.icon-btn svg { width: 14px; height: 14px; }

/* -- Session Bar -- */
.session-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0 6px;
  flex-shrink: 0;
}

.session-bar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.session-bar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-bar-status {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.session-bar-status.streaming { color: var(--accent-blue-pale); }

.session-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* -- Model Badge -- */
.model-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--bg-surface-deeper);
  border: 1px solid var(--border-subtle);
  color: var(--accent-blue-pale);
}

.model-badge.opus { color: #FBBF24; }
.model-badge.sonnet { color: #818CF8; }
.model-badge.haiku { color: #34D399; }
.model-badge.gpt { color: #10A37F; }
.model-badge.gemini { color: #4285F4; }

/* ================================================================
   MESSAGES
   ================================================================ */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 0;
  min-height: 0;
  width: 100%;
}

/* -- Message Wrapper -- */
.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.message.user { align-items: flex-end; }

/* -- Message Header -- */
.msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-role-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  flex-shrink: 0;
}

.msg-role-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.msg-time {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* -- Assistant Bubble -- */
.message.assistant .msg-body {
  padding: 0 2px;
  width: 100%;
  overflow-x: hidden;
  word-break: break-word;
}

/* -- User Bubble -- */
.message.user .msg-header {
  justify-content: flex-end;
}

.message.user .msg-role-name {
  color: var(--accent-blue-light);
}

.message.user .msg-body {
  padding: 12px 14px;
  border-radius: var(--r-xl);
  background: var(--bg-user-bubble);
  border: 1px solid var(--border-user);
  max-width: 85%;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-user);
  line-height: 1.6;
}

.msg-images {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.msg-image-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  object-fit: cover;
  border: 1px solid var(--border);
}

/* -- Streaming Cursor -- */
.msg-body.streaming-cursor::after {
  content: '···';
  letter-spacing: 2px;
  color: var(--accent-blue);
  animation: pulseDots 1.4s ease-in-out infinite;
  margin-left: 4px;
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
  vertical-align: middle;
}

/* -- Typing indicator (shown immediately after send) -- */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  min-height: 20px;
}
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-blue);
  opacity: 0.4;
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* -- Markdown in assistant bubble -- */
.message.assistant .msg-body h1,
.message.assistant .msg-body h2,
.message.assistant .msg-body h3 {
  color: var(--text-primary);
  font-weight: 700;
  margin: 8px 0 4px;
}

.message.assistant .msg-body h1 { font-size: 14px; }
.message.assistant .msg-body h2 { font-size: 13px; }
.message.assistant .msg-body h3 { font-size: 12px; }
.message.assistant .msg-body h1:first-child,
.message.assistant .msg-body h2:first-child,
.message.assistant .msg-body h3:first-child { margin-top: 0; }

.message.assistant .msg-body p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 3px 0;
  line-height: 1.5;
}

.message.assistant .msg-body ul,
.message.assistant .msg-body ol {
  font-size: 12px;
  color: var(--text-secondary);
  padding-left: 14px;
  margin: 3px 0;
}

.message.assistant .msg-body li { margin: 2px 0; }

.message.assistant .msg-body code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-code);
  color: var(--text-code);
  padding: 2px 5px;
  border-radius: 4px;
}

.message.assistant .msg-body pre code {
  display: block;
  padding: 10px;
  background: none;
  overflow-x: auto;
}

.message.assistant .msg-body strong { color: var(--text-primary); }
.message.assistant .msg-body em { color: var(--text-secondary); font-style: italic; }

.message.assistant .msg-body a {
  color: var(--accent-blue-light);
  text-decoration: none;
}

/* -- Blockquote -- */
.message.assistant .msg-body blockquote {
  margin: 6px 0;
  padding: 6px 10px;
  border-left: 3px solid var(--accent-blue);
  background: var(--bg-surface);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.6;
}

.message.assistant .msg-body blockquote p {
  margin: 2px 0;
  color: inherit;
}

/* -- Horizontal Rule -- */
.message.assistant .msg-body hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

/* -- Tables (responsive scroll wrapper added by JS) -- */
.msg-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 6px 0;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

.message.assistant .msg-body table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.5;
  table-layout: auto;
}

.message.assistant .msg-body thead {
  background: var(--bg-surface);
}

.message.assistant .msg-body th {
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.message.assistant .msg-body td {
  padding: 6px 10px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  word-break: break-word;
}

.message.assistant .msg-body tr:last-child td {
  border-bottom: none;
}

.message.assistant .msg-body tbody tr:hover {
  background: var(--bg-hover);
}

/* -- Images in markdown -- */
.message.assistant .msg-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
  margin: 4px 0;
}

/* -- Task lists (checkbox) -- */
.message.assistant .msg-body input[type="checkbox"] {
  margin-right: 6px;
  accent-color: var(--accent-blue);
  vertical-align: middle;
}

/* -- Nested lists -- */
.message.assistant .msg-body li > ul,
.message.assistant .msg-body li > ol {
  margin: 2px 0;
  padding-left: 12px;
}

/* ================================================================
   CODE BLOCKS
   ================================================================ */
.code-block-wrapper {
  border-radius: var(--r-lg);
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  margin: 6px 0;
  max-width: 100%;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: #0D0D10;
  border-bottom: 1px solid var(--border-subtle);
}

.code-lang {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
}

.code-copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
}

.code-copy-btn:active { background: var(--bg-surface-deeper); }

.code-block-wrapper pre {
  margin: 0;
  padding: 10px;
  overflow-x: auto;
}

.code-block-wrapper code {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
}

/* ================================================================
   STATUS PANELS (STICKY TASK + SUBAGENT BAR)
   ================================================================ */
.status-panels {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}
.status-panels.hidden { display: none; }

.status-chips {
  display: flex;
  gap: 0;
}
.status-chip {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.status-chip:not(:last-child) {
  border-right: 1px solid var(--border);
}
.status-chip:active { background: var(--bg-hover); }
.status-chip svg:first-child {
  flex-shrink: 0;
  color: var(--text-muted);
}
.status-chip span { flex: 1; text-align: left; }
.status-chip-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.status-chip.expanded .status-chip-chevron {
  transform: rotate(90deg);
}

.status-panel-body {
  border-top: 1px solid var(--border);
  padding: 4px 0;
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* -- Todo items (shared by status panel and inline card) -- */
.status-todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
}
.status-todo-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.status-todo-text {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}
.status-todo-item.completed .status-todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.status-todo-item.in-progress .status-todo-text {
  color: var(--text-primary);
}

/* -- Subagent items -- */
.status-agent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
}
.status-agent-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.status-agent-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-agent-type {
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: var(--r-pill);
  background: var(--bg-hover);
}
.status-agent-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}
.status-agent-badge.running { color: var(--accent-blue); }
.status-agent-badge.success { color: var(--accent-green); }
.status-agent-badge.stopped { color: var(--text-muted); }

/* -- Inline TodoWrite card body -- */
.todo-inline-list {
  padding: 2px 0 4px;
  border-top: 1px solid var(--border-subtle);
}
.todo-inline-list.collapsed { display: none; }

/* ================================================================
   TOOL CARDS
   ================================================================ */
.tool-card {
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 2px 0;
  flex-shrink: 0;
  max-width: 100%;
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

.tool-card-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.tool-icon-wrap {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-icon-wrap svg { width: 14px; height: 14px; }

.tool-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.tool-card-input-inline {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

/* -- Tool Status Badge -- */
.tool-status-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: var(--r-pill);
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}

.tool-status-badge.success { background: var(--accent-green-18); color: var(--accent-green-light); }
.tool-status-badge.running { background: var(--accent-blue-12); color: var(--accent-blue-pale); }
.tool-status-badge.error { background: rgba(239,68,68,0.1); color: var(--accent-red-pale); }

.spinner-small {
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* -- Tool Detail Panel -- */
.tool-detail-panel {
  border-top: 1px solid var(--border-subtle);
  padding: 8px 10px;
}

.tool-detail-panel.collapsed { display: none; }

.tool-input-section,
.tool-result-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.tool-result-section { margin-bottom: 0; }

.tool-section-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tool-raw {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  padding: 8px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.tool-result { min-height: 20px; }

.tool-expand-btn {
  background: none;
  border: none;
  color: var(--accent-blue-light);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  font-family: var(--font-sans);
}

/* ================================================================
   TOOL GROUPS (consecutive same-type tool grouping)
   ================================================================ */
.tool-group {
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 2px 0;
  flex-shrink: 0;
  max-width: 100%;
}

.tool-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

.tool-group-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-group-chevron.expanded { transform: rotate(90deg); }
.tool-group-chevron svg { width: 14px; height: 14px; }

.tool-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.tool-group-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  min-width: 18px;
  text-align: center;
}

.tool-group-status {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tool-group-items {
  border-top: 1px solid var(--border-subtle);
}

.tool-group-items.collapsed { display: none; }

.tool-group-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 10px 5px 32px;
  border-top: 1px solid var(--border-subtle);
}

.tool-group-item:first-child { border-top: none; }

.tool-group-item-text {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.tool-group-item .tool-status-badge {
  padding: 2px 4px;
  font-size: 0;
  gap: 0;
}

.tool-group-item .tool-status-badge svg { display: block; }

/* ================================================================
   THINKING BLOCKS
   ================================================================ */
.thinking-block {
  border-radius: var(--r-2xl);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 2px 0;
  flex-shrink: 0;
  max-width: 100%;
}

.thinking-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
}

.thinking-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent-purple);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.thinking-spinner.done {
  border-color: var(--accent-green);
  border-top-color: var(--accent-green);
  animation: none;
}

.thinking-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-purple-light);
}

.thinking-preview {
  flex: 1;
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thinking-chevron {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 0.2s;
}

.thinking-chevron.expanded { transform: rotate(180deg); }

.thinking-body {
  padding: 0 12px 12px;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

.thinking-body.collapsed { display: none; }

/* ================================================================
   INLINE ASK CARD (pVq95 - permission in message stream)
   ================================================================ */
.inline-ask-card {
  border-radius: var(--r-2xl);
  background: var(--bg-surface);
  border: 1px solid var(--accent-yellow-33);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0;
  flex-shrink: 0;
}

.inline-ask-header {
  display: flex;
  align-items: center;
}

.inline-ask-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--accent-yellow-12);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-yellow-light);
}

.inline-ask-badge svg { width: 14px; height: 14px; }

.inline-ask-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.inline-ask-desc {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-ask-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-deny,
.btn-allow {
  padding: 6px 16px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
}

.btn-deny {
  background: var(--bg-surface-deeper);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-deny:active { background: var(--bg-hover); }

.btn-allow {
  background: var(--accent-yellow-33);
  color: var(--accent-yellow-light);
}

.btn-allow:active { opacity: 0.8; }

/* ================================================================
   COMPOSER
   ================================================================ */
.composer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 0;
}

.composer-top-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.selector-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-surface-deeper);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-family: var(--font-sans);
  color: var(--text-secondary);
}

.selector-pill:active { background: var(--bg-surface); }
.selector-pill svg { flex-shrink: 0; }

.pill-label {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-chevron {
  color: var(--text-muted);
}

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

.composer-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.composer-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--r-xl);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  outline: none;
}

.composer-input::placeholder { color: var(--text-placeholder); }
.composer-input:focus { border-color: var(--accent-blue); }

.attach-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-xl);
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.attach-btn:active { color: var(--text-secondary); border-color: var(--text-muted); }
.attach-btn.has-images { color: var(--accent-blue); border-color: var(--accent-blue); }

.image-preview-strip {
  display: flex;
  gap: 6px;
  padding: 0 4px 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.image-preview-strip.hidden { display: none; }

.image-preview-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.image-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-xl);
  background: var(--accent-blue);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.send-btn:active { opacity: 0.8; }

.send-btn-stop {
  background: var(--accent-red);
  padding: 0;
}

.send-btn-stop:active { opacity: 0.7; }

.stop-btn-inner {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stop-btn-ring {
  position: absolute;
  inset: 0;
  animation: spinRing 1s linear infinite;
}
.stop-btn-icon {
  position: relative;
  color: white;
}

/* ================================================================
   DROPDOWNS (Model + Permission + Project)
   Design spec: Model=1Aj59, Permission=DTMl4
   ================================================================ */
.model-dropdown,
.permission-dropdown {
  position: fixed;
  z-index: 150;
  border-radius: 12px;
  background: #1A1A1D;
  border: 1px solid #2A2A31;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.67);
  max-height: 300px;
  overflow-y: auto;
  animation: fadeSlideUp 0.15s ease;
}

.model-dropdown { width: 220px; }
.permission-dropdown { width: 310px; }

.dropdown-hidden { display: none !important; }
.dropdown-visible { display: block !important; }

.dropdown-list {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}

.dropdown-group-header {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: #71717A;
}

/* -- Dropdown Item (shared) -- */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 0 4px;
  cursor: pointer;
  transition: background 0.1s;
}

.dropdown-item:active { background: rgba(255,255,255,0.04); }

.dropdown-item-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropdown-item-text {
  flex: 1;
  min-width: 0;
}

.dropdown-item-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.dropdown-item-desc {
  font-size: 10px;
  font-weight: 400;
  color: #71717A;
}

.dropdown-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.dropdown-separator {
  height: 1px;
  background: #2A2A31;
  margin: 2px 14px;
}

/* -- Model Dropdown (1Aj59 design) -- */
.model-dropdown .dropdown-item-icon { width: 14px; height: 14px; }
.model-dropdown .dropdown-item-icon svg { width: 14px; height: 14px; }
.model-dropdown .dropdown-item-text { font-size: 12px; font-weight: 500; color: #CCCCCC; }
.model-dropdown .dropdown-item.selected { background: rgba(168, 85, 247, 0.08); }
.model-dropdown .dropdown-item.selected .dropdown-item-text { color: #FFFFFF; }
.model-dropdown .dropdown-check { color: #A855F7; }

/* -- Permission Dropdown (DTMl4 design) -- */
.permission-dropdown .dropdown-item-icon { width: 16px; height: 16px; color: #71717A; }
.permission-dropdown .dropdown-item-icon svg { width: 16px; height: 16px; }
.permission-dropdown .dropdown-item-text { font-size: 12px; font-weight: 600; color: #FFFFFF; }
.permission-dropdown .dropdown-item.selected { background: rgba(245, 158, 11, 0.08); }
.permission-dropdown .dropdown-check { color: #F59E0B; }
.permission-dropdown .dropdown-item.warn .dropdown-item-text { color: #FFFFFF; }
.permission-dropdown .dropdown-item.warn .dropdown-item-desc { color: #EF4444; }

/* ================================================================
   OVERLAYS (shared)
   ================================================================ */
.overlay-hidden { display: none; }

.overlay-visible {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 18px calc(var(--safe-bottom) + 16px);
  animation: fadeIn 0.2s ease;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
}

.overlay-close {
  background: transparent;
  border: 1px solid var(--border-subtle);
}

/* ================================================================
   APPROVAL OVERLAY (u80LL)
   ================================================================ */
.approval-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 354px;
  border-radius: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideUp 0.3s ease;
}

.approval-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.approval-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--accent-blue-12);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-blue-pale);
}

.approval-badge svg { width: 14px; height: 14px; }

.approval-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.4;
}

.approval-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: var(--r-lg);
  background: var(--bg-surface-deeper);
  border: 1px solid var(--border-subtle);
}

.approval-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}

.step-number {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-blue-pale);
  flex-shrink: 0;
  min-width: 20px;
}

.step-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.5;
}

.approval-plan-content {
  max-height: 50vh;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  -webkit-overflow-scrolling: touch;
}
.approval-plan-content h1 { font-size: 14px; font-weight: 800; color: var(--text-primary); margin: 8px 0 4px; }
.approval-plan-content h2 { font-size: 13px; font-weight: 700; color: var(--text-primary); margin: 6px 0 3px; }
.approval-plan-content h3 { font-size: 12px; font-weight: 700; color: var(--text-primary); margin: 4px 0 2px; }
.approval-plan-content p { margin: 3px 0; }
.approval-plan-content ul, .approval-plan-content ol { padding-left: 18px; margin: 3px 0; }
.approval-plan-content li { margin: 2px 0; }
.approval-plan-content code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-surface-deeper);
  padding: 1px 4px;
  border-radius: 3px;
}
.approval-plan-content pre {
  background: var(--bg-surface-deeper);
  padding: 8px;
  border-radius: var(--r-md);
  overflow-x: auto;
  margin: 4px 0;
}
.approval-plan-content pre code {
  background: none;
  padding: 0;
}

.approval-plan-fallback {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
}

.approval-risk {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r-lg);
  background: var(--accent-yellow-12);
  border: 1px solid var(--accent-yellow-33);
}

.risk-icon {
  flex-shrink: 0;
  color: var(--accent-yellow);
}

.risk-icon svg { width: 16px; height: 16px; }

.risk-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-yellow-light);
  line-height: 1.5;
}

.approval-actions {
  display: flex;
  gap: 10px;
}

/* -- Shared Action Buttons -- */
.btn-secondary,
.btn-primary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--r-xl);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
}

.btn-secondary {
  background: var(--bg-surface-deeper);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-secondary:active { background: var(--bg-hover); }

.btn-primary {
  background: var(--accent-blue);
  color: white;
}

.btn-primary:active { opacity: 0.8; }

.btn-primary svg,
.btn-secondary svg { width: 14px; height: 14px; }

/* ================================================================
   ASK QUESTION OVERLAY (nW8L6 design)
   ================================================================ */
.ask-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 354px;
  border-radius: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.ask-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ask-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  background: var(--accent-purple-12);
  border: 1px solid var(--accent-purple-33);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-purple-light);
}

.ask-badge svg { width: 14px; height: 14px; }

.ask-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* -- Ask Title & Desc -- */
.ask-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.4;
}

.ask-desc {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* -- Question Progress Card (nested dark card) -- */
.ask-progress-card {
  border-radius: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ask-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ask-progress-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.ask-progress-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-purple);
}

.ask-progress-bar {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
}

.ask-progress-fill {
  height: 100%;
  background: var(--accent-purple);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.ask-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ask-tab {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ask-tab-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.ask-tab-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.ask-tab.active {
  background: var(--accent-purple-12);
  border-color: var(--accent-purple-33);
}

.ask-tab.active .ask-tab-label {
  color: var(--accent-purple-light);
}

.ask-tab.answered .ask-tab-label { color: var(--accent-green-light); }

/* -- Active Question Card (nested dark card) -- */
.ask-question-card {
  border-radius: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ask-question-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ask-question-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.ask-question-type {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-purple-light);
}

.ask-question-text {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.5;
}

.ask-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ask-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}

.ask-choice:has(.ask-radio:checked),
.ask-choice.selected {
  border-color: var(--accent-blue-30);
  background: var(--accent-blue-12);
}

.ask-radio { display: none; }

.ask-radio-custom {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2C2C30;
  border: 1px solid #52525B;
  flex-shrink: 0;
  display: inline-block;
  margin-top: 1px;
}

.ask-radio:checked + .ask-radio-custom {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.ask-choice-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.ask-choice-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.ask-choice-desc {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.ask-choice:has(.ask-radio:checked) .ask-choice-desc,
.ask-choice.selected .ask-choice-desc {
  color: var(--accent-blue-pale);
}

/* -- Ask Other -- */
.ask-choice-other {
  border-radius: 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
}

.ask-other-input-wrap {
  border-radius: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ask-other-input-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

.ask-other-input {
  width: 100%;
  padding: 0;
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-sans);
}

.ask-other-input::placeholder { color: var(--text-muted); }

/* -- Ask Actions -- */
.ask-actions {
  display: flex;
  gap: 6px;
}

.ask-actions .btn-secondary {
  flex: 0 0 auto;
  width: 110px;
}

.ask-submit-btn {
  background: var(--accent-purple);
}

/* ================================================================
   UTILITIES
   ================================================================ */
.hidden { display: none !important; }

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 12px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
}

.empty-icon {
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-icon svg { width: 32px; height: 32px; }

.empty-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.empty-sub {
  font-size: 12px;
  color: var(--text-dim);
}

/* -- Toast -- */
.toast-container {
  position: absolute;
  top: 60px;
  left: 14px;
  right: 14px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: var(--r-lg);
  font-size: 12px;
  font-weight: 600;
  animation: fadeSlideDown 0.2s ease;
  pointer-events: auto;
}

.toast.info {
  background: var(--accent-blue-12);
  border: 1px solid var(--accent-blue-30);
  color: var(--accent-blue-pale);
}

.toast.error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--accent-red-pale);
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

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

@keyframes pulseDots {
  0%, 20% { opacity: 0.3; }
  50% { opacity: 1; }
  80%, 100% { opacity: 0.3; }
}

@keyframes spinRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
