/* ═══════════════════════════════════════════════════════════════════════════
   Antigravity Web Studio — 21st.dev Inspired Design System
   Obsidian Glass Dark + Warm Paper Light · Bento Spotlight · Border Beam
   ═══════════════════════════════════════════════════════════════════════════ */

:root,
[data-theme="dark"] {
  --bg-canvas: #09090b;
  --bg-sidebar: #0c0c10;
  --bg-surface: #121217;
  --bg-elevated: #18181f;
  --bg-hover: rgba(255, 255, 255, 0.055);
  --bg-active: rgba(99, 102, 241, 0.14);
  --bg-glass: rgba(18, 18, 24, 0.78);
  --bg-composer: rgba(20, 20, 27, 0.86);
  --bg-user-bubble: linear-gradient(135deg, rgba(49, 46, 129, 0.55), rgba(39, 39, 52, 0.82));
  --bg-code: #0d0d12;
  --bg-artifact-paper: #0e0e13;

  --border-subtle: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-accent: rgba(129, 140, 248, 0.45);

  --text-primary: #f4f4f6;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-accent: #818cf8;

  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-cyan: #06b6d4;

  --shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, 0.68), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-composer: 0 16px 40px -10px rgba(0, 0, 0, 0.65);
  --grid-dot: rgba(255, 255, 255, 0.045);
  --aurora-opacity: 0.22;
}

[data-theme="light"] {
  --bg-canvas: #f8f8fa;
  --bg-sidebar: #f1f2f6;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-hover: rgba(15, 23, 42, 0.045);
  --bg-active: rgba(79, 70, 229, 0.09);
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-composer: rgba(255, 255, 255, 0.95);
  --bg-user-bubble: linear-gradient(135deg, #eef2ff, #f3f4f6);
  --bg-code: #f4f4f7;
  --bg-artifact-paper: #ffffff;

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);
  --border-accent: rgba(99, 102, 241, 0.42);

  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --text-accent: #4f46e5;

  --accent-primary: #4f46e5;
  --accent-secondary: #7c3aed;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-cyan: #0891b2;

  --shadow-lg: 0 20px 45px -15px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(15, 23, 42, 0.06);
  --shadow-composer: 0 12px 32px -8px rgba(15, 23, 42, 0.1);
  --grid-dot: rgba(15, 23, 42, 0.055);
  --aurora-opacity: 0.11;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: "Inter", "Plus Jakarta Sans", "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 140, 0.25);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 140, 0.45);
}

.hidden {
  display: none !important;
}

/* ── Ambient Aurora & 21st.dev Dot Pattern ─────────────────────────────── */
.ambient-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 24px 24px;
}

.ambient-backdrop::before,
.ambient-backdrop::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: var(--aurora-opacity);
  transition: opacity 0.4s ease;
}

.ambient-backdrop::before {
  width: 540px;
  height: 360px;
  top: -120px;
  left: 18%;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
}

.ambient-backdrop::after {
  width: 500px;
  height: 340px;
  bottom: -140px;
  right: 12%;
  background: radial-gradient(circle, #8b5cf6 0%, #ec4899 50%, transparent 75%);
}

/* ── Login Gate (21st.dev Spotlight Auth Card) ─────────────────────────── */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-canvas);
}

.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 410px;
  padding: 36px 32px 32px;
  border-radius: 22px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.brand-orb {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.55);
  flex-shrink: 0;
}

.auth-card h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
  line-height: 1.55;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.input-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.studio-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.studio-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.primary-btn {
  width: 100%;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.55);
}

.primary-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(0);
}

.auth-error {
  color: var(--accent-rose);
  font-size: 12.5px;
  margin-bottom: 12px;
  min-height: 18px;
}

/* ── Main App Shell (3-Column Studio) ──────────────────────────────────── */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── 1. Left Conversation Sidebar ──────────────────────────────────────── */
.sidebar {
  width: 280px;
  min-width: 280px;
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 30;
}

.sidebar.collapsed {
  margin-left: -280px;
}

.sidebar-header {
  padding: 16px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.015em;
}

.brand-orb.sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.new-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.new-chat-btn:hover {
  border-color: var(--border-accent);
  background: var(--bg-active);
  color: var(--text-accent);
}

.sidebar-controls {
  padding: 0 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 7px 10px 7px 31px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--border-accent);
}

.workspace-select {
  width: 100%;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

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

.session-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 12px 8px 4px;
}

.session-item {
  group: session;
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
  border: 1px solid transparent;
}

.session-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.session-item.active {
  background: var(--bg-active);
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.session-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
}

.session-status-dot.running {
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseDot 1.4s infinite ease-in-out;
}

.session-status-dot.waiting_permission {
  background: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
  animation: pulseDot 1s infinite ease-in-out;
}

.session-title-wrap {
  flex: 1;
  min-width: 0;
}

.session-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.art-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 5px;
  border-radius: 99px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-accent);
  font-size: 10.5px;
  font-weight: 600;
}

.session-actions {
  display: none;
  align-items: center;
  gap: 2px;
}

.session-item:hover .session-actions,
.session-item.active .session-actions {
  display: flex;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.icon-btn.xs {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.cli-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-weight: 500;
}

.cli-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* ── 2. Center Chat Stage ──────────────────────────────────────────────── */
.chat-stage {
  flex: 1;
  min-width: 360px;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.topbar {
  height: 54px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 15;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.active-session-heading {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

.cwd-pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  white-space: nowrap;
}

.studio-drawer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.studio-drawer-toggle:hover,
.studio-drawer-toggle.active {
  border-color: var(--border-accent);
  background: var(--bg-active);
  color: var(--text-accent);
}

.count-chip {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* ── Live Steps Checklist Banner ───────────────────────────────────────── */
.plan-banner {
  margin: 10px auto 0;
  width: calc(100% - 32px);
  max-width: 820px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 12px;
  z-index: 10;
}

.plan-step-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
}

.plan-step-pill.done {
  color: var(--accent-emerald);
}

.plan-step-pill.in_progress {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Messages Scroll Viewport ──────────────────────────────────────────── */
.messages-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 16px;
  scroll-behavior: smooth;
}

.messages-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 28px;
}

/* 21st.dev Welcome Hero & Bento Spotlight Cards */
.welcome-hero {
  max-width: 740px;
  margin: 5vh auto 0;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-accent);
  background: var(--bg-active);
  color: var(--text-accent);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.welcome-hero h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-hero p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  text-align: left;
}

.spotlight-card {
  position: relative;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s;
}

.spotlight-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    320px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(99, 102, 241, 0.14),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.spotlight-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
}

.spotlight-card:hover::before {
  opacity: 1;
}

.spotlight-icon {
  font-size: 18px;
  margin-bottom: 8px;
}

.spotlight-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.spotlight-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ── Message Bubbles ───────────────────────────────────────────────────── */
.msg-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeSlideUp 0.22s ease-out;
}

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

.msg-user-card {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 18px 18px 4px 18px;
  background: var(--bg-user-bubble);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
  justify-content: flex-end;
}

.att-thumb-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  cursor: pointer;
  max-width: 240px;
}

.att-thumb-card img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 7px;
}

.msg-assistant-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}

.assistant-avatar {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.assistant-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Thinking Accordion */
.thought-box {
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow: hidden;
}

.thought-summary {
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  user-select: none;
  list-style: none;
}

.thought-summary::-webkit-details-marker {
  display: none;
}

.thought-summary.streaming .shimmer-text {
  background: linear-gradient(90deg, var(--text-muted), var(--text-primary), var(--text-muted));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 2s infinite linear;
}

.thought-content {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
  font-family: inherit;
}

/* Tool Execution Chips */
.tool-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: "JetBrains Mono", monospace;
}

.tool-pill.in_progress,
.tool-pill.pending {
  border-color: var(--border-accent);
  color: var(--text-accent);
}

/* Interactive Permission Approval Card */
.permission-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), var(--bg-elevated));
  border: 1px solid rgba(245, 158, 11, 0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 10px 28px -8px rgba(245, 158, 11, 0.2);
}

.permission-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-amber);
}

.permission-detail {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  overflow-x: auto;
}

.permission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.perm-btn {
  padding: 6px 13px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.perm-btn.allow {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #fff;
}

.perm-btn.deny:hover {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}

/* Inline Claude-style Artifact Reference Card & Inline Media */
.inline-artifacts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.artifact-inline-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  min-width: 240px;
  max-width: 360px;
  transition: all 0.18s ease;
}

.artifact-inline-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -8px rgba(99, 102, 241, 0.35);
}

.art-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-active);
  color: var(--text-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.art-card-meta {
  flex: 1;
  min-width: 0;
}

.art-card-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.art-card-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.inline-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.inline-media-box {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
}

.inline-media-box img,
.inline-media-box video {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.inline-media-box video {
  cursor: default;
  background: #000;
}

/* ── 21st.dev Floating Composer Dock ───────────────────────────────────── */
.composer-outer {
  padding: 6px 20px 18px;
  z-index: 20;
}

.composer-card {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  border-radius: 20px;
  background: var(--bg-composer);
  backdrop-filter: blur(22px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-composer);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.composer-card:focus-within {
  border-color: var(--border-accent);
  box-shadow: 0 16px 42px -10px rgba(99, 102, 241, 0.22), 0 0 0 1px rgba(129, 140, 248, 0.35);
}

.composer-card.streaming {
  border-color: rgba(139, 92, 246, 0.6);
}

/* Slash Command Popover */
.slash-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 12px;
  width: 340px;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
}

.slash-item {
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.slash-item:hover,
.slash-item.active {
  background: var(--bg-active);
}

.slash-cmd-name {
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-accent);
}

.slash-cmd-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pending Attachment Preview Strip */
.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 0;
}

.pending-att-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 28px 6px 8px;
  border-radius: 11px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  max-width: 220px;
}

.pending-att-chip img {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
}

.pending-att-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.remove-att-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--bg-hover);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.composer-textarea {
  width: 100%;
  min-height: 54px;
  max-height: 210px;
  padding: 14px 16px 8px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.55;
}

.composer-textarea::placeholder {
  color: var(--text-muted);
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 10px 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-select {
  appearance: none;
  padding: 5px 24px 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, color 0.15s;
}

.pill-select:hover,
.pill-select:focus {
  border-color: var(--border-accent);
  color: var(--text-primary);
}

.pill-select.yolo-active {
  border-color: rgba(16, 185, 129, 0.55);
  color: var(--accent-emerald);
  background-color: rgba(16, 185, 129, 0.09);
}

.attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.attach-btn:hover {
  border-color: var(--border-accent);
  color: var(--text-primary);
}

.usage-chip {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 6px;
}

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: none;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

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

.send-btn.stop-mode {
  background: var(--accent-rose);
}

/* ── 3. Right Resizable Studio Pane (Artifacts & Media Gallery) ────────── */
.pane-resizer {
  width: 5px;
  cursor: col-resize;
  background: transparent;
  border-left: 1px solid var(--border-subtle);
  transition: background 0.15s;
  z-index: 25;
}

.pane-resizer:hover,
.pane-resizer.dragging {
  background: var(--accent-primary);
}

.studio-pane {
  width: 48vw;
  min-width: 360px;
  max-width: 72vw;
  height: 100%;
  background: var(--bg-artifact-paper);
  display: flex;
  flex-direction: column;
  z-index: 24;
  box-shadow: -12px 0 36px -16px rgba(0, 0, 0, 0.45);
}

.studio-pane.maximized {
  position: fixed;
  inset: 0;
  width: 100vw !important;
  max-width: 100vw !important;
  z-index: 90;
}

.studio-pane-header {
  height: 54px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.segmented-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.seg-btn {
  padding: 5px 11px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.seg-btn.active {
  background: var(--bg-active);
  color: var(--text-accent);
}

.studio-subbar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.artifact-picker-select {
  flex: 1;
  min-width: 180px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
}

.studio-pane-body {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

/* Rich Markdown Pro Typography (Claude / Notion / 21st Quality) */
.md-prose {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-primary);
  word-break: break-word;
}

.artifact-doc-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 36px 64px;
}

.md-prose h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.md-prose h2 {
  font-size: 18.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 28px 0 12px;
  color: var(--text-primary);
}

.md-prose h3 {
  font-size: 15.5px;
  font-weight: 600;
  margin: 20px 0 8px;
}

.md-prose p {
  margin: 0 0 12px;
}

.md-prose ul,
.md-prose ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

.md-prose li {
  margin-bottom: 5px;
}

.md-prose hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 24px 0;
}

.md-prose a {
  color: var(--text-accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-accent);
}

.md-prose a:hover {
  border-bottom-style: solid;
}

.md-prose code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
}

.md-prose pre {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.md-prose pre code {
  padding: 0;
  border: none;
  background: transparent;
  font-size: 12.5px;
  line-height: 1.6;
}

.md-prose blockquote {
  margin: 14px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--accent-primary);
  background: var(--bg-hover);
  border-radius: 0 10px 10px 0;
  color: var(--text-secondary);
}

/* GitHub Alert Callouts ([!IMPORTANT], [!WARNING], [!CAUTION], [!TIP], [!NOTE]) */
.gh-callout {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 13px;
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
  background: var(--bg-surface);
}

.gh-callout-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
}

.gh-callout.note {
  border-left-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.07);
}
.gh-callout.note .gh-callout-title { color: var(--accent-cyan); }

.gh-callout.tip {
  border-left-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.07);
}
.gh-callout.tip .gh-callout-title { color: var(--accent-emerald); }

.gh-callout.important {
  border-left-color: var(--accent-secondary);
  background: rgba(139, 92, 246, 0.08);
}
.gh-callout.important .gh-callout-title { color: var(--accent-secondary); }

.gh-callout.warning {
  border-left-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.08);
}
.gh-callout.warning .gh-callout-title { color: var(--accent-amber); }

.gh-callout.caution {
  border-left-color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.08);
}
.gh-callout.caution .gh-callout-title { color: var(--accent-rose); }

/* Clean Responsive Tables */
.table-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.md-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.md-prose th,
.md-prose td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
}

.md-prose th {
  background: var(--bg-surface);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.md-prose tr:last-child td {
  border-bottom: none;
}

.md-prose input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  margin-right: 6px;
  cursor: pointer;
  transform: translateY(2px);
}

/* Mermaid Diagram Card */
.mermaid-card {
  margin: 18px 0;
  padding: 20px 16px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

/* HTML Sandbox Iframe */
.iframe-stage {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  background: var(--bg-canvas);
}

.artifact-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  transition: width 0.25s ease;
}

.artifact-iframe.mobile-vp {
  width: 390px;
  margin: 16px auto;
  height: calc(100% - 32px);
  border-radius: 24px;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

/* Media Gallery Grid */
.gallery-container {
  padding: 20px;
}

.gallery-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--bg-active);
  border-color: var(--border-accent);
  color: var(--text-accent);
  font-weight: 600;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.gallery-card {
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.gallery-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
}

.gallery-preview {
  height: 155px;
  background: var(--bg-code);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gallery-preview img,
.gallery-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-doc-icon {
  font-size: 34px;
}

.gallery-info {
  padding: 10px 12px;
}

.gallery-name {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  justify-content: space-between;
}

/* Drag & Drop Fullscreen Overlay */
.dropzone-overlay {
  position: fixed;
  inset: 12px;
  z-index: 300;
  border-radius: 24px;
  border: 2px dashed var(--accent-primary);
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  pointer-events: none;
}

/* Lightbox Modal & Settings Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.modal-card {
  width: 100%;
  max-width: 420px;
  padding: 26px;
  border-radius: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 12.5px;
  box-shadow: var(--shadow-lg);
  animation: fadeSlideUp 0.2s ease-out;
}

/* Animations */
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    box-shadow: var(--shadow-lg);
  }
  .studio-pane {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 92vw !important;
    max-width: 92vw !important;
  }
  .pane-resizer {
    display: none;
  }
  .bento-grid {
    grid-template-columns: 1fr;
  }
}
